feat: add structured artifact-contract diff reporting - #89
Conversation
|
Post-CI final diff review completed at head
Final evidence: all four remote checks passed; |
|
Superseded by the policy-compliant stacked replacement:
Each replacement is independently scoped below the 500-line substantive gate, has dedicated compatibility/error-path tests, a documented design/risk/compatibility/rollback boundary, and four green remote checks. The full stacked head also passed an external clean-clone reproduction: 29 strict artifacts, 6 visual snapshots, 8 existing schema tests, and 249 passed / 1 skipped. Closing this oversized draft without merge. The branch and this discussion remain available as implementation provenance; no branch is deleted. |
Summary
artifact-contract-diff/v1report for missing, extra, and changed reviewer artifactsTracks #85.
Design decision
The package comparator is the authoritative semantic core; the CLI is a thin human/JSON projection. Text-like artifacts share one strict UTF-8 and CRLF/CR-to-LF normalization policy with
regenerate_artifacts.py. The comparator hashes normalized bytes first and parses structure only for changed, missing, or extra JSON/JSONL. Invalid digest shapes, unsafe paths, symlinks, special files, resource-limit violations, and report destinations inside either input tree fail closed with exit2.Main risk
The main compatibility risk is line-ending equivalence: the existing regeneration gate now treats lone CR the same way the new triage comparator does. A parity regression locks LF, CRLF, and lone-CR behavior. The larger implementation surface also warrants delayed review and either reduction or an independently verifiable stack before this PR becomes ready.
Compatibility impact
Additive reviewer tooling only: no committed artifact schema, demo behavior, SIEM integration, or release output changes.
artifact-contract-diff/v1is a new strict report contract. Existing binary comparison semantics remain presence-only. The regeneration gate gains lone-CR normalization parity; all currently committed strict artifacts still reproduce byte-contract-equivalently.Rollback path
Revert this branch's six semantic commits. There is no data migration, generated-artifact update, release tag, or persisted state to unwind; the prior
python scripts/regenerate_artifacts.py --checkworkflow remains the fallback.Validation
python -m pytest -q tests/test_artifact_contract_diff.py tests/test_artifact_regeneration_check.py— 26 passed, 1 platform-conditional skippython scripts/regenerate_artifacts.py --check— 29 strict artifacts matched; 6 visual snapshots regenerated presence-onlydata/processed/richer_sampleself-compare — 4 comparable unchanged; 3 binaries presence-only; JSON validated againstartifact-contract-diff/v1; privacy/timestamp scan passedpython scripts/check_release_contract.py— 8 schema tests passed; full suite 238 passed, 1 platform-conditional skipgit diff --check origin/main...HEAD— passedReview state
Draft: 9 files and 1,831 added lines exceed the lightweight-review threshold. Do not merge until the size boundary is reduced or split, CI is green, bot feedback is resolved, and the required delayed compatibility review is complete.