Deliver complete P08 review sources through frozen file references
This commit is contained in:
@@ -98,6 +98,25 @@ def packet_with_actual_evidence(self, task_id, role, sha=None):
|
||||
packet_core.git = actual_git
|
||||
else:
|
||||
packet = original_packet(self, task_id, role, sha)
|
||||
if role == 'reviewer' and self.config['project'] == 'the-tree-p08-03-code' and task_id == 'P08-03':
|
||||
import hashlib
|
||||
frozen = Path(os.environ['OWNER_P08_PREPARED_REVIEW'])
|
||||
prefix, data = packet.split('\nDATA:\n', 1)
|
||||
body = json.loads(data)
|
||||
context = frozen / '.owner-review-context'
|
||||
context.mkdir(exist_ok=True)
|
||||
manifest = {'candidate': sha, 'complete_sources': {}, 'validation_sources': {}}
|
||||
for key in ('sources', 'validation_sources'):
|
||||
for name in body[key]:
|
||||
path = frozen / name
|
||||
require(path.is_file() and not path.is_symlink(), 'committed reviewer source available')
|
||||
raw = path.read_bytes()
|
||||
manifest['complete_sources' if key == 'sources' else key][name] = {'path': name, 'bytes': len(raw), 'sha256': hashlib.sha256(raw).hexdigest()}
|
||||
body[key] = {'complete_manifest': '.owner-review-context/source-manifest.json', 'section': 'complete_sources' if key == 'sources' else key, 'instruction': 'Read complete files directly from this frozen checkout; no source omitted or truncated.'}
|
||||
(context / 'source-manifest.json').write_text(json.dumps(manifest, ensure_ascii=False, indent=2))
|
||||
(context / 'complete-diff.txt').write_text(body['diff'])
|
||||
body['diff'] = {'path': '.owner-review-context/complete-diff.txt', 'instruction': 'Read complete candidate diff; all original content preserved.'}
|
||||
packet = prefix + '\nDATA:\n' + json.dumps(body, ensure_ascii=False)
|
||||
extra = os.environ.get('OWNER_REVIEW_SUPPLEMENT')
|
||||
if role == 'reviewer' and extra:
|
||||
prefix, data = packet.split('\nDATA:\n', 1)
|
||||
|
||||
Reference in New Issue
Block a user