diff --git a/docs/plans/original-completion-2026-10-02/execution/p08-03/PREPARED_REVIEW_REUSE_CHECKS.json b/docs/plans/original-completion-2026-10-02/execution/p08-03/PREPARED_REVIEW_REUSE_CHECKS.json new file mode 100644 index 0000000..4c240a8 --- /dev/null +++ b/docs/plans/original-completion-2026-10-02/execution/p08-03/PREPARED_REVIEW_REUSE_CHECKS.json @@ -0,0 +1,13 @@ +{ + "candidate": "7e2368f5c453a3900ba1bb038d7138d25f7eb4fb", + "coordinator_sha256": "56e7a0b28366e19f9180a422b22d5bcc7efc75f4955f8d100ab9d14d315c77ba", + "checks": { + "same_candidate_prepared_reference_reuse": "pass", + "changed_proof_bytes_rejected": "pass", + "extra_proof_file_rejected": "pass" + }, + "found_and_fixed": "Canonicalize /var vs /private/var before build-file-set comparison; do not copy already validated prepared sources or regenerate prepared manifest.", + "scope": "isolated temporary coordinator checks only; no provider/native run or production proof/source mutation", + "unit_acceptance": false, + "capacity_deletion_approval": "still pending; no deletion" +} diff --git a/docs/plans/original-completion-2026-10-02/execution/p08-03/reference_semantic_review.py b/docs/plans/original-completion-2026-10-02/execution/p08-03/reference_semantic_review.py index f90f4e0..1aa5a0f 100644 --- a/docs/plans/original-completion-2026-10-02/execution/p08-03/reference_semantic_review.py +++ b/docs/plans/original-completion-2026-10-02/execution/p08-03/reference_semantic_review.py @@ -41,8 +41,11 @@ def install(core): and core.git(target, 'rev-parse', 'HEAD') == revision, 'exact owned partial semantic checkout') for path in target.rglob('*'): - if path.is_file() and path.name != '.git': + core.require(not path.is_symlink(), 'ordinary prepared checkout') + if path.is_file() and path != target / '.git': relative = path.relative_to(target).as_posix() + if path.relative_to(target).parts[0] in ('.review-material', '.owner-review-context'): + continue # Owner-generated data is checked separately by the manifest. core.require(relative in names and not path.is_symlink() and digest_file(path) == digest_file(source / relative), 'only identical committed copies in partial checkout') @@ -54,10 +57,11 @@ def install(core): core.require(current.is_file() and not current.is_symlink(), 'ordinary committed source') copy = target / name copy.parent.mkdir(parents=True, exist_ok=True) - subprocess.run(['/bin/cp', '-pc', str(current), str(copy)], check=True) + if not copy.exists(): + subprocess.run(['/bin/cp', '-pc', str(current), str(copy)], check=True) core.git(target, 'read-tree', 'HEAD') core.require(core.git(target, 'rev-parse', 'HEAD') == revision - and not core.git(target, 'status', '--porcelain'), 'whole CoW checkout matches committed candidate') + and not core.git(target, 'diff', 'HEAD', '--name-only'), 'whole CoW checkout matches committed candidate') self._owner_frozen_review_checkout = target self.event(TASK, 'owner_exact_candidate_cow_checkout', {'candidate': revision, 'source': str(source), 'target': str(target), @@ -73,10 +77,31 @@ def install(core): 'no live proof writer during reference freeze') checkout = Path(checkout) destination = checkout / '.review-material' - core.require(not destination.exists(), 'fresh manifest destination') - destination.mkdir() build = Path(self.allocation(task_id)['build_dir']).resolve() core.require(build.is_relative_to(self.runtime(task_id).resolve()), 'existing task runtime only') + if destination.exists(): + manifest = core.read_json(destination / 'manifest.json') + core.require(manifest['candidate'] == revision and manifest['task_id'] == task_id + and manifest['complete_nonsecret_registered_validation_material'], 'same complete prepared proof') + expected = set() + for entry in manifest['files']: + path = Path(entry['path']) + core.require(path.resolve().is_relative_to(build) or path.resolve().is_relative_to(destination.resolve()), + 'existing registered proof scope only') + core.require(path.is_file() and not path.is_symlink() + and path.stat().st_size == entry['bytes'] + and digest_file(path) == entry['sha256'], 'whole prepared proof bytes') + if path.resolve().is_relative_to(build): expected.add(str(path.resolve())) + actual = {str(path) for path in build.rglob('*') if path.is_file() + and not core.secret_path(str(path.relative_to(build)))} + core.require(actual == expected, 'whole prepared proof file set') + self._owner_reference_manifest = manifest + self._owner_reference_build = build + self.event(task_id, 'owner_complete_reference_material_reuse', + {'candidate': revision, 'files': len(manifest['files']), 'whole_bytes_and_set_verified': True}) + return {'path': '.review-material/manifest.json', 'file_count': len(manifest['files']), + 'byte_limit': None, 'instruction': 'Complete same-candidate prepared proof reused after all bytes and file-set checks.'} + destination.mkdir() rows = [] excluded = [] @@ -170,8 +195,8 @@ already permitted task runtime. There is no file-count or byte cap. Report any r core.require(path.is_file() and not path.is_symlink() and path.stat().st_size == entry['bytes'] and digest_file(path) == entry['sha256'], 'whole proof changed during review') - expected_build = {entry['path'] for entry in manifest['files'] - if Path(entry['path']).is_relative_to(runner._owner_reference_build)} + expected_build = {str(Path(entry['path']).resolve()) for entry in manifest['files'] + if Path(entry['path']).resolve().is_relative_to(runner._owner_reference_build)} actual_build = {str(path) for path in runner._owner_reference_build.rglob('*') if path.is_file() and not core.secret_path(str(path.relative_to(runner._owner_reference_build)))} core.require(actual_build == expected_build, 'whole proof file set changed during review')