Repository navigation
Compare a composed tier-2 issuance against the certificate it composes with - #996
Conversation
…s with The binding's two references were checked for presence in their own pools, independently, so a binding naming certificate C and issuance evidence E composed and verified where E recorded the issuance of some other certificate C'. Both directions of the binding are now compared, where both references resolved, under the existing forged_attestation_identity code. refs #582 Lane: openxfactory-2 Co-Authored-By: Claude Fable 5.1 <[email protected]>
Reviewer's GuideThe PR closes a cross-reference integrity gap in tier-2 issuance composition by validating the certificate and issuance evidence references in both directions once their records resolve, reusing the existing forged_attestation_identity refusal code and adding targeted reader tests without changing missing-part handling or the out-of-scope identifier-collision behavior. Sequence diagram for bidirectional tier-2 issuance reference validationsequenceDiagram
participant Reader
participant View
participant Binding
participant Certificate
participant Evidence
participant Refusal
Reader->>Binding: get(certificate_ref)
Reader->>Binding: get(issuance_evidence_ref)
Reader->>View: certificates.get(certificate_ref)
Reader->>View: issuances.get(issuance_evidence_ref)
alt both references resolve
Reader->>Evidence: get(certificate_ref)
alt evidence certificate_ref != binding certificate_ref
Reader->>Refusal: error(forged_attestation_identity)
end
Reader->>Certificate: get(issuance_evidence)
alt present is true and evidence_ref is a string
alt certificate evidence_ref != binding issuance_evidence_ref
Reader->>Refusal: error(forged_attestation_identity)
end
end
else a referenced record is missing
Reader->>Refusal: preserve missing-part refusal
end
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
🟡 Changes recommended
Add independent mutation tests covering both new mismatch checks.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds bidirectional consistency checks for tier-2 issuance composition.
Changes:
- Validates certificate and issuance-evidence references agree.
- Reuses
forged_attestation_identityfor mismatches.
File summaries
| File | Description |
|---|---|
scripts/signed_execution_chain/attestation.py |
Adds guarded bidirectional reference validation. |
Review details
Suppressed comments (2)
scripts/signed_execution_chain/attestation.py:551
- These two new consistency predicates are not exercised by the current reader tests: the positive corpus only contains matching references, and the existing
forged_attestation_identitynegative covers a missing evidence record rather than either mismatch. A mutation test should independently changeissuance_evidence.certificate_refandcertificate.issuance_evidence.evidence_refwhile keeping all records present, otherwise either comparison could regress to a no-op while the closed-code probe still passes.
if certificate is not None and evidence is not None:
evidenced = evidence.get("certificate_ref")
if evidenced != cert_ref:
scripts/signed_execution_chain/attestation.py:568
- The reverse comparison is likewise untested: there is no reader test that mutates a certificate's
issuance_evidence.evidence_refwhile keeping the binding's evidence record resolvable. Add that second in-memory mutation and assert the existing refusal code, otherwise this independently introduced direction can regress unnoticed.
if (isinstance(back, dict) and back.get("present") is True
and isinstance(carried, str) and carried != evidence_ref):
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…sing part missing Five pins over the tranche-two corpus mutated in memory: the packaged composition agrees in both directions and stays green, each compared field refuses a mismatch under forged_attestation_identity, an honestly-absent evidence record is not read as a disagreement, and an unresolvable reference is still reported as one of the three records missing. refs #582 Lane: openxfactory-2 Co-Authored-By: Claude Fable 5.1 <[email protected]>
There was a problem hiding this comment.
🔵 Needs a closer look
Update the affected test to exercise the owning validator or accurately scope its assertion and documentation.
Review details
Suppressed comments (1)
tests/signed_execution_chain/test_chain_reader.py:1158
- This docstring claims the mutated binding is still refused, but
_validate()only runs the signed-execution-chain reader: itscheck_shapes()schema-validates the consumed certificate andcheck_issuance()has nopresent: falserefusal. The test only asserts that the new disagreement message is absent, so it does not prove the stated refusal and can pass with zero errors. Either exercise the owning trust-anchor validator or scope the docstring to the behavior this test actually checks.
The binding is still refused — by the rules that own the absence — but never
as two records naming each other differently."""
- Files reviewed: 2/2 changed files
- Comments generated: 0 new
- Review effort level: Lite
…it does The docstring claimed the binding "is still refused" while the test runs this reader alone, which has no refusal for an honestly absent issuance-evidence record: the mutated corpus validates with zero errors, so the sentence named a refusal the assertion never reached. The claim is scoped to what this test runs and the refusal is attributed to the validator that owns it, scripts/validate-trust-anchor.py under issuance-evidence-absent-trusted, red-proven by the packaged negative unexplained-certificate-recorded-as-trusted.yaml over the same shape. The silence the guard exists for is now asserted rather than described: no disagreement line, and no error from this reader at all. refs #582 Lane: openxfactory-2 Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
There was a problem hiding this comment.
Sorry @brettheap, you've used your own review budget of 250,000 diff characters for the last 7 days.
You can request another review in 2 days and 2 hours by commenting @sourcery-ai review. Upgrade to get a review now.
|
Lane: openxfactory-2 (openXfactory-2) |
origin/main moved five commits ahead of this branch's fork point, three of which touch files this PR also declares edits on: - #995 (9e43f3d, ASK-7 window): four declared lines on the cli.py and serve.py rows of docs/opendox-carve-manifest.yaml, plus the four scripts/tests files that quote the running "862" declared-line total (carve_lines.py, validate-carve-manifest.py, verify-carve-arrival.py, tests/carve_manifest/test_carve_manifest.py). - #984 (a1ef886): carve tooling/admissions hardening unrelated to the five rows this PR touches. - #997, #996, #999: no overlap with this PR's files. Conflict resolution, keeping both sides: - docs/opendox-carve-manifest.yaml: the header comment block now carries the ASK-7 window's paragraph (landed first, 2026-09-11) ahead of the § 3.4 SLICE-S3 paragraph (2026-09-12), in landing order. The S3 paragraph's own arithmetic is untouched (it was already stated as a DELTA — "+40 over two rows" — precisely so a later-landing sibling act would not need to rewrite it); only its framing of the ASK-7 window changed from "is in flight" to "already moved the running total to 866", since this merge is the event that makes ASK-7's landing a fact rather than a future one. The four ASK-7 row edits (cli.py:834, serve.py:155/725/1338) and the two S3 row edits (app.js's 37 lines, test_bullseye_widget.py's 3 lines) are all kept. - scripts/carve_lines.py, scripts/validate-carve-manifest.py, scripts/verify-carve-arrival.py: each had a single docstring line citing the running declared-line total — "866" from main (ASK-7), "902" from this branch (which assumed the pre-ASK-7 base of 862). Corrected to 906 in all three: 866 (post-ASK-7) + 40 (this act's own delta) = 906, matching the pinned test assertion. - tests/carve_manifest/test_carve_manifest.py: merged both narrative additions to test_the_real_manifest_carries_the_ruled_q_l7_amendment in landing order (ASK-7 then S3), corrected the final aggregate assertion from this branch's stale (902, 151) to (906, 151), kept main's per-row pinned ASK-7 checks (cli_row/serve_row) verbatim, and fixed their comment's citation of the aggregate from (866, 150) to (906, 151) to match the corrected assert two lines above. Also fixed a second, non-conflicting docstring in test_the_line_count_is_exactly_the_expression_the_validator_carried that still read "902". A pre-existing defect, unrelated to the conflict, found while resolving: the test_bullseye_widget.py row's two edits (already on this branch's HEAD before any merge, commit 6843a25) had a blank line splicing them apart, which left the `adapter calls` edit's `note:` key duplicated with the `path constants` edit's original note — YAML silently keeps the last of a duplicate key, so the S3 note was silently discarded and the wrong note landed on the wrong edit. Confirmed with a duplicate-key-aware loader before and after. Fixed by restoring each edit's own note; a full-document duplicate-key scan afterward finds none remaining anywhere in the manifest. Verified after resolution: - python3 scripts/validate-carve-manifest.py: OK, 456 rows, 168 moved_verbatim / 150 moved_with_declared_edit / 138 not_moved. - python3 scripts/verify-carve-arrival.py --destination opendox_code --phase B against openDox-code PR #14's head (09b42f5b): DECLARED src/opendox/web/app.js, DECLARED tests/test_bullseye_widget.py, 0 refusals (three newly-created files admitted ad hoc for this local check only: src/opendox/view_extension.py, src/opendox/web/views/view_extension.js, tests/test_view_registry.py — the governed admissions-file entries for those belong to the pin-bump PR that follows #14's own landing, not this row-annotation PR). The one "unapplied" declared-edit row the summary counts is scripts/ideation_dashboard/doxbench_scope_types.py, an unrelated pre-existing row (successor #838, open at the carve) — not S3. - pytest tests/carve_arrival tests/carve_manifest tests/carve_conformance -q: 269 passed (121 + 110 + 38). Lane: openxfactory-4-opendox-extraction Refs #656 Co-Authored-By: Claude Sonnet 5 <[email protected]>



Lane: openxfactory-2 (openXfactory-2)
What.
check_issuance()compares the composed tier-2 issuance against thecertificate it composes with, in both directions, at the point where the
binding's two references have resolved.
Why. The binding's
certificate_refandissuance_evidence_refwere eachchecked for presence in their OWN pool, independently, and nothing compared the
issuance-evidence record's own
certificate_refwith the binding's. A bindingnaming certificate
Cand issuance evidenceE, whereE.certificate_refissome other certificate
C', composed and verified: three records, all present,all schema-valid, all resolvable, and the issuance act that is supposed to
evidence
C's issuance evidencing something else.check_signatures()resolvesthe certificate separately, from the signature side, and never closed the gap
either. The ratified
add-chain-attestationscenario is explicit that theevidence "records the controller's issuance act and references that
certificate".
How. Two comparisons, guarded on both references having resolved so a
missing part is still reported as the missing part it is, and reported under the
EXISTING closed code
forged_attestation_identity— no new code, the closedenumeration stays closed and its packaged probe stays honest:
issuance_evidence.certificate_refvssigned_binding.certificate_ref;certificate_record.issuance_evidence.evidence_refvssigned_binding.issuance_evidence_ref, only where the certificate recordspresent: trueand carries a string reference, because an honestly-absentevidence record is
add-trust-anchor's own state and is not restated here.The design note posted on the issue before any code states the same shape.
How verified. Both comparisons are pinned per compared field in
tests/signed_execution_chain/test_chain_reader.pyby mutating the packagedcorpus in memory — the reader's own stated policy for this shape, since the
disagreement lives inside
signed_binding, whose signature this reader verifiesand whose fixture key's private half is not in this repository. The matching case
is the packaged tranche-two corpus itself: all ten binding/certificate/evidence
triples agree in both directions and stay green. Reader self-test: 113 packaged
records valid across 2 corpora, 108 negatives still invalid for their intended
reason, 95/95 closed refusal codes red-proven.
Out of scope, deliberately: the
bindings_by_id/inceptionslast-write-winssibling hazard the issue raises. It is a refusal over the family's OWN
identifiers, needs its own code-or-reuse decision and its own probe, and folding
it in here would make this fix unreviewable as what it is.
refs #582
🤖 Generated with Claude Code
Summary by Sourcery
Ensure composed tier-2 issuances consistently bind certificates and issuance evidence in both directions.
Bug Fixes:
Enhancements:
Tests: