feat(01-07): audit prepared fidelity materials and strict human acceptance

This commit is contained in:
UnixNight committed 2026-11-13 12:17:46 -05:00
1 parent d78b13566d
commit 026def9c5a
6 files changed
+459 -5

No files matched your search

+169
View File
@@ -0,0 +1,169 @@
# Phase 01 combined acceptance session
Materials preparation is separate from acceptance. The final local checkpoint is
`dist/fidelity/phase01`; all 120 obligations remain OPEN until actual captures and
human review. This document prepares the single combined session; it does not
report that any physical, audible, Windows or original fact has been observed.
Read [Windows/DxWnd instructions](windows-session.md) and
[Linux capture instructions](linux-session.md) together. They contain the exact
collector commands, settings, annotation fields and complete procedures. The
sealed packages retain source `446930d2a30d6d616c60ac5e59e4169a840bea09`, dirty true,
diff `90cef95669caece53fe2d2c4736cf2ac05ed27f5d25ca03ab572589686bcb73d`.
The later tools/checklist revision never replaces that runtime provenance.
1. Recheck immutable materials immediately before local transfer:
`python3 tools/recon/fidelity_acceptance.py ready --checkpoint dist/fidelity/phase01`.
Require `materials_ready: true`, separately `acceptance: human_needed`. A changed
package/resource requires a fresh identified checkpoint. Preserve the old bundle.
2. On the actual Windows PC select already installed DxWnd, its original exported
profile, recorder, browser and media tools. Record versions, executable hashes,
Windows/GPU/driver identities and actual settings. Run the bundled PowerShell
preflight and selftests; save their complete positive counts and failures.
3. Use only generated original copies. Retain pristine/pre/retained/post inventories,
original and relocated DxWnd profiles, wrapper limitations and the actual child
launch method. Observe moving game imagery, intelligible game audio, crop and
aspect before recording scenarios. Black/silent captures remain failed evidence.
4. Follow `protocol/agenda.json`: eight fresh/retained × natural/skipped × ordinary/
held-input cells, each with continuous, dialogue-return, bank-left, bank-right,
landing-idle obligations on original-DxWnd and native Windows (80). Follow the
same 40 obligations on native Linux. Retained departure/return must remain in
one process/clock. Continuous is lab → VR04 → lab → outside. No fixture, warp,
Wine, cross-publish, injected input or second fresh launch fills these slots.
5. Complete Linux real-display, physical-input and actual audible-device checks.
The saved `linux-01-06-matrix-preflight-linux` failure explains the current TTY/
auto_null limitation; it proves no captured gameplay. Retain failed/aborted/
skipped results and use fresh launch IDs for retries.
6. Review actual paired recordings in the identified local browser, including
decode/playback, seeking, complete tails, exclusive audio, corresponding events,
raw elapsed/event drift, actual speed and optional overlays. Keep source MKV,
derivation tool/hash/argv/time mapping and visible review gain. Do not invent
timing/pixel/angle/audio thresholds or hide drift through retiming.
7. Record the following named human findings with reviewer and concrete notes:
`A1` original moving imagery/intelligible audio/DxWnd limits; `A2` actual browser
decode/seek/exclusive audio; `EVID-02-unclassified` original capture boundaries;
`EVID-04-unclassified` native route/input/audio/identity; `P1` preservation;
`P2` honest unretimed/unmixed/non-synthetic comparison; `P3` history/full-scope/
native transparency; `browser`; `paired_review`; `physical_input`. A1/A2 are
separate from the two flagged assumptions. Insufficient observation remains
human_needed; descriptor-less P1/P2/P3 cannot be automatically dismissed.
8. Return the complete tree once by local filesystem/USB/existing local share.
Compare mutable result/original-run inventories with the source transfer
inventory, recheck READY/manifest and every linked hash before atomic import.
Keep packages, original copies and media local and ignored.
## Result reconciliation contract — integration agent only
The human tester collects, observes and returns the tree. The integration agent
performs the following local reconciliation after return; the tester is never
asked to engineer JSON or run the Python tooling. No normalized gameplay receipt
exists yet. Do not run reconciliation on failed/skipped/aborted/incomplete runs as
if they were successful; import those unchanged as diagnostic history.
Keep raw collector receipts immutable. Use the existing receipt importer on a
fresh local result destination; it validates hashes/containment and rejects
conflicting duplicates. Reviewed acceptance receipts are separately authored
records retaining the raw collector identity, actual media/events and limitations;
they must satisfy the shared receipt schema, source/package/resource binding and
full scenario continuity. Raw collection success never becomes review success.
Windows source/package/resources initially identify the exact `fidelity-build.json`
seal. Original reviewed receipts additionally identify the unchanged original
inventory and actual generated-copy pre/post inventories; missing raw collector
fields require evidence-backed normalization, never invented values.
Work on a **fresh sibling derived directory** for each captured raw receipt. Copy
every raw referenced file byte-identically into that directory, copy the raw
`receipt.json` as `raw-receipt.json`, and preserve `raw-receipt.sha256`. Make the
reviewed receipt a new ID ending `-reviewed`; retain the original launch/session
and clock IDs. Add the hashed raw receipt to `artifacts` with role `diagnostic`.
The integration agent uses this exact mapping; every new path is inside that fresh
derived directory and every identity uses `identify_file(actual_path)` including
SHA-256, size and header. No path or command from returned metadata is executed.
| Reviewed field | Actual source and required validation |
|---|---|
| Native executable | Raw identity copy; match manifest package executable SHA-256 |
| Native package | Exact selected RID's copied `fidelity-build.json`; match sealed package SHA-256 |
| Windows native source/resources | Same actual `fidelity-build.json` file; retain its source commit/dirty/diff fields. Resources are proven by exact full seal equality |
| Linux native source | Raw `identity/BUILD-INFO.txt`, with commit/dirty/diff taken from the matching exact package seal |
| Linux native resources | Raw `identity/resources.json`, exactly equal to manifest package resources |
| Original executable | Actual selected executable from the generated run (`Neutron.exe` or the recorded selected variant); identify its bytes and compare to that exact pristine member, retaining any mismatch as open |
| Original package/resources | Save `identify_tree(original-pristine)` and actual generated-copy pre/post inventories as separate hashed JSON; preserve all raw original content identities |
| Original pre/post | Save complete actual `identify_tree(original-pristine)` before/after return validation; require files and tree digest equal to the baseline and manifest original_pre. These describe authoritative/pristine preservation, separately from writable copy changes |
| Original copy pre/post/retained | Raw `copy-pre.json`, `copy-post.json`, `retained-copy.json`; preserve exact actual bytes/hashes and bind continuity to those hashes |
| Original source/launcher | Save manifest `tool_source` as `collector-source.json` and identify the actual bundled Windows collector; source commit/dirty/diff describes collector tooling, never recovered original source code |
| Original DxWnd/profile | Retain hashed actual `dxwnd-tool.json`, source profile and relocated export; explicit wrapper settings/limits are required |
| Platform/version/GPU/driver/Vulkan/SDL | Actual raw queries and human device/version records; absent observations remain missing, never guessed |
| Events/continuity/derivatives | Preserve actual raw values and hashed media; supplement only from observed annotations with methods/uncertainty; never generate invented markers |
| Review | Set visible/audible/ordinary_input/human_reviewed true only from the named, receipt-bound actual reviewer findings |
For example a Windows native raw receipt `port-fresh-natural-ordinary-continuous-01`
already identifies `identity/build.json` as source/package/resources. Its reviewed
identity retains that **same file/hash**, keeps source commit/dirty/diff from its
contents, and binds executable to manifest `packages.win-x64.executable`. It does
not substitute BUILD-INFO for that raw source or regenerate a package seal.
The reviewed record's minimal projection looks like this (metavariables below
are populated from the actual retained records by the integration agent):
```json
{
"receipt_id": "port-fresh-natural-ordinary-continuous-01-reviewed",
"session_id": "port-fresh-natural-ordinary-continuous-01",
"status": "reviewed",
"identity": {
"source": {"path":"identity/build.json", "sha256":"ACTUAL_SEAL_HASH", "size":0,
"header":"ACTUAL_HEADER", "commit":"ACTUAL_BUILD_COMMIT", "dirty":true,
"diff_sha256":"ACTUAL_BUILD_DIFF"}
},
"review": {"visible":true,"audible":true,"ordinary_input":true,"human_reviewed":true},
"acceptance": {"state":"accepted","remaining":[]}
}
```
This projection is **not a usable receipt or positive finding**: retain all other
required raw fields, replace every metavariable/size with identified actual values,
keep limitations/discrepancies, and include missing identity mappings above.
Clear `missing_evidence` and acceptance remaining only when each corresponding
fact has actually been supplied and reviewed. Otherwise preserve the gap and
`state: open`. The shared validator and strict audit reject incomplete reviewed
records. Do not overwrite raw receipts or label normalized copies as raw captures.
After writing the complete derived receipt, the agent validates/imports with the
existing API (run from repository root; substitute the actual derived directory):
```sh
PYTHONPATH=tools/recon python3 -c 'from pathlib import Path; from fidelity_receipts import read_receipt,validate_receipt,import_receipt; p=Path("LOCAL_DERIVED/receipt.json"); print(validate_receipt(read_receipt(p),p.parent)); print(import_receipt(p,p.parent,Path("dist/fidelity/phase01/results/imported")))'
```
An absent mapping or unobserved human fact is an OPEN result. Never manufacture
source, original, device, media or review identities to make this command pass.
In `results/current.json`, list the explicit current receipt paths as
`{"receipts":["imported/receipt-id/receipt.json"]}`. Preserve historical/superseded
records outside that selection. Conflicting duplicate slots cannot be selected.
In `results/human-review.json`, use `schema_version: 1`, exact selected
`receipt_ids`, a `receipt_sha256` object mapping each ID to its actual receipt hash,
and `checks` mapping every name above to `{ "observed": true, "reviewer":
"actual reviewer", "notes": "specific observation and limitations" }`. Empty or
false findings remain pending. These fields describe witnessed facts; tools never
generate positive human findings.
Run strict audit on the complete local result tree:
`python3 tools/recon/fidelity_acceptance.py audit --checkpoint dist/fidelity/phase01 --results dist/fidelity/phase01/results --require-complete`.
Nonzero means acceptance remains open. `--allow-open` may return zero for structural
inspection while explicitly reporting human_needed and every missing obligation;
it never satisfies EVID-02/EVID-04. Export actual paired selected receipts with the
existing `fidelity_review.py export` command; the prepared viewer starts empty.
## Pending acceptance checklist
- [ ] Original-DxWnd 40 obligations, actual imagery/audio/input and wrapper review.
- [ ] Native Windows 40 obligations, physical input/audio and exact runtime identity.
- [ ] Native Linux 40 obligations, real display/audio and physical input.
- [ ] Actual paired browser playback, seeking, exclusive audio and exposed drift.
- [ ] Both unclassified assumptions, A1/A2 backstops and P1/P2/P3 dispositions.
- [ ] Returned identities and strict audit passed; current/history discrepancies reconciled.
Phase 1 and all EVID requirements remain pending. The roadmap permits independent
source-backed recovery while these access dependencies remain open; it does not
waive them or authorize broader gameplay admission.
+44
View File
@@ -0,0 +1,44 @@
# Phase 01 evidence baseline — preparation, acceptance OPEN
The final acceptance checkpoint is `dist/fidelity/phase01`, freshly assembled from
the existing sealed 01-05 packages plus the final Linux/audit/session materials.
Prepared identities and generated media remain local and ignored. Runtime source:
`446930d2a30d6d616c60ac5e59e4169a840bea09`, dirty true; publish diff:
`90cef95669caece53fe2d2c4736cf2ac05ed27f5d25ca03ab572589686bcb73d`.
Original files remain governed by `docs/original-manifest.json` (539 files).
| Proof category | Current result | Acceptance |
|---|---|---|
| Immutable local tools/protocol/packages | Separate readiness audit | Materials only |
| Actual original-DxWnd | No returned gameplay recordings | OPEN 0/40 |
| Native Windows | Cross-publish/resource identity only | OPEN 0/40 |
| Native Linux physical/audible route | Failed TTY/null-audio preflight | OPEN 0/40 |
| Actual paired browser/audio review | No original/native recording pair | human_needed |
The retained actual diagnostic receipt is
`linux-01-06-matrix-preflight-linux`, from
`artifacts/fidelity/linux-current-receipts/`. It records no selected X11 display,
only `auto_null.monitor`, absent recording and absent observer events. No game was
launched. This is failed native preflight evidence, not native gameplay acceptance.
Historical Wine/component/GPU results keep their original scope and revision.
The strict audit reports every missing case/obligation and rejects synthetic,
misclassified, stale, wrong-resource, historical/conflicting or unreviewed evidence.
Its metadata unit fixtures exercise both complete coverage and rejection behavior;
their invented media/observations are never imported as runtime proof.
## Remaining discrepancies and judgments
The blocking gaps are actual original-DxWnd and native Windows execution, Linux
display/audio/physical-input access, complete 120-obligation captures, returned
media identity and real paired review. The NewGame.tsk story entry is not the
original main menu. DxWnd wrapper/timing/render behavior must remain separately
identified. No universal timing/pixel/audio tolerance is asserted.
A1 (original moving imagery/intelligible audio) and A2 (actual browser playback,
seek and exclusive audio) remain **human_needed**. EVID-02/EVID-04 unclassified
assumptions remain unresolved/flagged; P1 preservation, P2 honest comparison and
P3 history/native transparency require explicit final judgment. Follow the single
[combined session checklist](checkpoint-session.md). All EVID requirements and
Phase 1 acceptance remain OPEN under the roadmap source-backed continuation
exception. No movement, rendering, gameplay or collision admission changed.
+61 -2
View File
@@ -9,6 +9,7 @@ import unittest
from unittest import mock
import test_fidelity_scenarios
import test_fidelity_checkpoint
ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(ROOT / 'tools/recon'))
@@ -36,7 +37,8 @@ class AcceptanceTests(unittest.TestCase):
self.package['build'] = {'source': {k: identity['source'][k]
for k in ('commit', 'dirty', 'diff_sha256')}}
# Bind real hashed metadata files in the test instead of accepting labels.
for key, data in [('package', {'source': self.package['build']['source']}),
for key, data in [('original_pre', {'tree_sha256': 'c' * 64}),
('package', {'source': self.package['build']['source']}),
('resources', self.package['resources'])]:
path = self.record_root / (key + '.json')
path.write_bytes(receipts.canonical_bytes(data))
@@ -81,7 +83,6 @@ class AcceptanceTests(unittest.TestCase):
for path in self.record_root.iterdir():
if path.is_file() and root != self.record_root:
(root / path.name).write_bytes(path.read_bytes())
value['identity']['original_pre']['tree_sha256'] = 'c' * 64
records.append((value, root))
review = copy.deepcopy(self.review)
review['receipt_ids'] = [r['receipt_id'] for r, _ in records]
@@ -104,6 +105,24 @@ class AcceptanceTests(unittest.TestCase):
self.package['resources']['assets']['tree_sha256'] = '0' * 64
self.assertTrue(self.audit()['errors'])
def test_windows_seal_source_and_resource_format_is_supported(self):
source = self.record['identity']['source']
self.record['identity']['source'] = dict(self.record['identity']['package'],
**{k: source[k] for k in ('commit', 'dirty', 'diff_sha256')})
self.record['identity']['resources'] = self.record['identity']['package']
self.package['build']['source']['status_sha256'] = 'not copied into receipt'
path = self.record_root / 'package.json'
path.write_bytes(receipts.canonical_bytes({'source': self.package['build']['source']}))
updated = dict(receipts.identify_file(path), path=path.name)
self.package['seal'] = updated
for key in ('package', 'resources', 'source'):
self.record['identity'][key].update(updated)
self.assertEqual(self.audit()['matrix']['accepted'], 1)
def test_mismatched_source_revision_rejected(self):
self.record['identity']['source']['commit'] = 'wrong revision'
self.assertTrue(self.audit()['errors'])
def test_synthetic_original_rejected(self):
self.record['artifacts'][0]['synthetic'] = True
self.assertEqual(self.audit()['matrix']['accepted'], 0)
@@ -164,3 +183,43 @@ class AcceptanceTests(unittest.TestCase):
with mock.patch.object(self.api(), 'preflight', return_value={'status': 'ready'}):
with self.assertRaises((ValueError, FileNotFoundError)):
self.api().ready(self.root)
def prepared(self):
fixture = test_fidelity_checkpoint.FidelityCheckpoint()
fixture.setUp()
self.addCleanup(fixture.doCleanups)
fixture.prepare()
root = fixture.output
manifest = receipts.read_json(root / 'manifest.json')
manifest['tooling_only'] = False
(root / 'manifest.json').write_bytes(receipts.canonical_bytes(manifest))
prepared = receipts.read_json(root / 'READY.json')
prepared['manifest'] = dict(receipts.identify_file(root / 'manifest.json'), path='manifest.json')
(root / 'READY.json').write_bytes(receipts.canonical_bytes(prepared))
return root, manifest
def test_ready_validates_all_materials_separately_from_acceptance(self):
root, manifest = self.prepared()
with mock.patch.object(self.api(), '_package', side_effect=lambda _, rid, __: manifest['packages'][rid]):
report = self.api().ready(root)
self.assertTrue(report['materials_ready'])
self.assertEqual(report['acceptance'], 'human_needed')
def test_ready_rejects_tampered_final_checklist(self):
root, _ = self.prepared()
(root / 'docs/evidence/checkpoint-session.md').write_text('changed')
with self.assertRaises(ValueError):
self.api().ready(root)
def test_audit_explicit_selection_reads_actual_failed_linux_hashes(self):
root, manifest = self.prepared()
source = ROOT / 'artifacts/fidelity/linux-current-receipts/linux-01-06-matrix-preflight-linux'
paths = []
if source.exists():
imported = receipts.import_receipt(source / 'receipt.json', source, root / 'results/imported')
paths.append(Path(imported['path']).relative_to(root / 'results').as_posix())
(root / 'results/current.json').write_bytes(receipts.canonical_bytes({'receipts': paths}))
with mock.patch.object(self.api(), '_package', side_effect=lambda _, rid, __: manifest['packages'][rid]):
report = self.api().audit(root, root / 'results')
self.assertEqual(report['acceptance'], 'human_needed')
self.assertEqual(report['matrix']['accepted'], 0)
+1 -1
View File
@@ -164,7 +164,7 @@ class FidelityCheckpoint(unittest.TestCase):
def test_complete_session_materials_and_eighty_windows_obligations(self):
self.prepare()
for name in ('tests/fidelity-windows.Tests.ps1', 'docs/evidence/windows-session.md',
for name in (*self.api().MATERIALS,
'protocol/annotation-template.json', 'protocol/settings-template.json'):
self.assertTrue((self.output / name).is_file(), 'complete session material missing: ' + name)
agenda = receipts.read_json(self.output / 'protocol/agenda.json')
+170
View File
@@ -0,0 +1,170 @@
#!/usr/bin/env python3
"""Offline checkpoint readiness and strict original/native acceptance.
Human findings are declarations bound to exact receipts, never inferred from
successful tools. --allow-open is structural inspection, not acceptance.
"""
import argparse
from pathlib import Path
import sys
from fidelity_checkpoint import MATERIALS, PROJECT, _package, preflight
from fidelity_receipts import (audit_scenarios, canonical_bytes, contained_path,
identify_file, identify_tree, read_json, read_receipt, validate_receipt,
validate_scenario_contract)
CHECKS = ('A1', 'A2', 'EVID-02-unclassified', 'EVID-04-unclassified',
'P1', 'P2', 'P3', 'browser', 'paired_review', 'physical_input')
def ready(checkpoint):
root = Path(checkpoint)
checked = preflight(root)
manifest = read_json(root / 'manifest.json')
if manifest['tooling_only']:
raise ValueError('Synthetic checkpoint is tooling-only, not final materials')
names = {entry['path'] for entry in manifest['files']}
required = set(MATERIALS) | {'protocol/scenarios.json', 'protocol/capabilities.json',
'protocol/agenda.json', 'protocol/settings-template.json',
'protocol/annotation-template.json', 'review/index.html', 'review/viewer.mjs',
'review/review.json'}
if required - names:
raise ValueError('Missing final session materials: ' + ', '.join(sorted(required - names)))
# A source checkout must not hand off an older tooling/checklist copy after
# later edits. On a transferred checkpoint PROJECT is the checkpoint itself.
for name in MATERIALS:
if identify_file(PROJECT / name) != identify_file(root / name):
raise ValueError('Final material differs from current source; assemble a fresh checkpoint: ' + name)
protocol = read_json(root / 'protocol/scenarios.json')
validate_scenario_contract(protocol)
for rid, identity in manifest['packages'].items():
if _package(root / 'port' / rid, rid, False) != identity:
raise ValueError('Package/observer identity inconsistent: ' + rid)
agenda = read_json(root / 'protocol/agenda.json')
expected = {(s, c['id'], o) for s in ('original-windows-dxwnd', 'port-windows-native')
for c in protocol['cells'] for o in c['obligations']}
actual = {(r['side'], r['case_id'], r['obligation_id']) for r in agenda['runs']}
if actual != expected or len(agenda['runs']) != 80:
raise ValueError('Incomplete or duplicate Windows session agenda')
# Exported ledger links are already normalized by the exporter. Recheck
# every active link against the sealed actual materials at final handoff.
ledger = read_json(root / 'review/review.json')['ledger']
for capability in ledger['capabilities']:
for link in capability.get('source_links', []):
if link.get('href'):
identify_file(contained_path(root / 'review', link['href']))
return {'schema_version': 1, 'materials_ready': checked['status'] == 'ready',
'checked_files': checked['checked_files'], 'acceptance': 'human_needed',
'required': 120, 'pending': list(CHECKS),
'meaning': 'Identified offline materials only; all execution/review remains separate'}
def _bind(receipt, root, manifest):
identity = receipt['identity']
if receipt['evidence_kind'] == 'native_port':
rid = {'linux': 'linux-x64', 'windows': 'win-x64'}[receipt['platform']['os']]
expected = manifest['packages'][rid]
if identity['executable']['sha256'] != expected['executable']['sha256']:
raise ValueError('Wrong current executable identity')
if identity['source']['sha256'] not in (expected['build_info']['sha256'], expected['seal']['sha256']):
raise ValueError('Wrong current source identity')
if any(identity['source'].get(k) != expected['build']['source'].get(k)
for k in ('commit', 'dirty', 'diff_sha256')):
raise ValueError('Wrong source revision/dirty/diff provenance')
package = read_json(contained_path(root, identity['package']['path']))
resources = read_json(contained_path(root, identity['resources']['path']))
if (package.get('source') != expected['build']['source'] or
identity['package']['sha256'] != expected['seal']['sha256']):
raise ValueError('Wrong current package seal/source')
if resources != expected['resources'] and identity['resources']['sha256'] != expected['seal']['sha256']:
raise ValueError('Wrong current resources')
elif receipt['evidence_kind'] == 'original_dxwnd':
before = read_json(contained_path(root, identity['original_pre']['path']))
if before.get('tree_sha256') != manifest['original_pre']['tree_sha256']:
raise ValueError('Wrong authoritative original inventory')
def audit_records(protocol, manifest, records, review):
errors, usable, seen = [], [], set()
if manifest.get('tooling_only'):
errors.append('Synthetic checkpoint cannot qualify as runtime evidence')
for receipt, root in records:
label = str(receipt.get('receipt_id', '<missing>'))
try:
if label in seen:
raise ValueError('Duplicate/conflicting receipt ID; retain history outside current selection')
seen.add(label)
valid = validate_receipt(receipt, root)
if receipt.get('superseded_by') or receipt.get('historical'):
raise ValueError('Superseded/historical receipt is not current applicability')
if valid['accepted']:
_bind(receipt, root, manifest)
usable.append((receipt, root))
except (KeyError, TypeError, ValueError, OSError) as error:
errors.append(label + ': ' + str(error))
matrix = audit_scenarios(protocol, usable)
errors.extend(matrix['invalid'])
checks = review.get('checks', {})
human_needed = [key for key in CHECKS if not (isinstance(checks.get(key), dict)
and checks[key].get('observed') is True and checks[key].get('reviewer')
and checks[key].get('notes'))]
if set(review.get('receipt_ids', [])) != seen:
errors.append('Human review must bind the exact selected receipt IDs')
passed = matrix['complete'] and not errors and not human_needed
return {'schema_version': 1, 'materials_ready': True,
'acceptance': 'passed' if passed else 'human_needed', 'matrix': matrix,
'errors': errors, 'human_needed': human_needed,
'meaning': 'Declared reviewed evidence; no automatic physical/audible truth or universal tolerance'}
def audit(checkpoint, results):
root, results = Path(checkpoint), Path(results)
ready(root)
manifest = read_json(root / 'manifest.json')
for rid, package in manifest['packages'].items():
package['seal'] = identify_file(root / 'port' / rid / 'fidelity-build.json')
# A strict, explicit selection prevents newest-date selection and preserves
# failed/superseded histories. The tree walk rejects symlinks/case aliases.
identify_tree(results)
selection = results / 'current.json'
paths = read_json(selection).get('receipts', []) if selection.exists() else []
if not isinstance(paths, list) or len(paths) > 120 or len(set(paths)) != len(paths):
raise ValueError('Current receipt selection must be a bounded unique array')
records = []
for name in paths:
path = contained_path(results, name)
records.append((read_receipt(path), path.parent))
review_path = results / 'human-review.json'
review = read_json(review_path) if review_path.exists() else {}
# Bind review to actual receipt bytes, not just reusable labels.
for receipt, directory in records:
expected = review.get('receipt_sha256', {}).get(receipt['receipt_id'])
if expected != identify_file(directory / 'receipt.json')['sha256']:
review = dict(review, checks={})
break
return audit_records(read_json(root / 'protocol/scenarios.json'), manifest, records, review)
def main(argv=None):
parser = argparse.ArgumentParser(description=__doc__)
sub = parser.add_subparsers(dest='command', required=True)
prepare = sub.add_parser('ready')
prepare.add_argument('--checkpoint', type=Path, required=True)
check = sub.add_parser('audit')
check.add_argument('--checkpoint', type=Path, required=True)
check.add_argument('--results', type=Path, required=True)
mode = check.add_mutually_exclusive_group(required=True)
mode.add_argument('--require-complete', action='store_true')
mode.add_argument('--allow-open', action='store_true')
args = parser.parse_args(argv)
try:
report = ready(args.checkpoint) if args.command == 'ready' else audit(args.checkpoint, args.results)
print(canonical_bytes(report).decode())
return 0 if args.command == 'ready' or args.allow_open or report['acceptance'] == 'passed' else 1
except (ValueError, OSError, KeyError, TypeError) as error:
print('Fidelity audit failed; acceptance OPEN: ' + str(error), file=sys.stderr)
return 2
if __name__ == '__main__':
sys.exit(main())
+14 -2
View File
@@ -25,9 +25,20 @@ RIDS = ('linux-x64', 'win-x64')
FLAGS = ['--fidelity-output', '--fidelity-session', '--fidelity-case']
MAX_FILE_BYTES = 8 * 1024**3
MUTABLE = ('results', 'original-runs')
MATERIALS = ('scripts/collect-fidelity-windows.ps1',
MATERIALS = ('scripts/collect-fidelity-linux.sh',
'scripts/collect-fidelity-windows.ps1',
'scripts/collect-fidelity-windows.cmd',
'tests/fidelity-windows.Tests.ps1', 'docs/evidence/windows-session.md')
'tests/fidelity-windows.Tests.ps1', 'docs/evidence/windows-session.md',
'docs/evidence/linux-session.md', 'docs/evidence/checkpoint-session.md',
'docs/evidence/phase01-baseline.md', 'docs/evidence/scenarios.json',
'docs/evidence/capabilities.json', 'tests/test_fidelity_acceptance.py',
'tests/test_fidelity_scenarios.py',
'tools/recon/fidelity_acceptance.py', 'tools/recon/fidelity_checkpoint.py',
'tools/recon/fidelity_capture.py', 'tools/recon/fidelity_receipts.py',
'tools/recon/fidelity_review.py', 'tools/recon/fidelity_ledger.py',
'tools/recon/fidelity_viewer/index.html',
'tools/recon/fidelity_viewer/viewer.mjs',
'tools/recon/fidelity_viewer/style.css')
def _copy_file(source, target):
@@ -185,6 +196,7 @@ def prepare_checkpoint(original, original_manifest, packages, output, tooling=Fa
(temporary / 'incomplete.json').unlink()
files = identify_tree(temporary)['files']
manifest = {'schema_version': 1, 'checkpoint_id': output.name,
'tool_source': source_identity(PROJECT),
'created_utc': utc_now(), 'tooling_only': tooling, 'packages': identities,
'original_manifest': identify_file(original_manifest),
'original_pre': {'tree_sha256': before['tree_sha256'], 'count': len(before['files'])},