Repository navigation
Close the two bindings a docs review proved evadable, and true the prose to the code - #120
Conversation
…ose to the code A third adversarial pass reviewed what openxWallet SAYS rather than what it does, holding the prose to the family's own standard: a sentence overstating what the contract guarantees is an audit record asserting something the mechanism cannot support. Ten verified findings. Validator tightened up to its prose (the fail-closed direction): - Rule (r): the presenting wallet is now DERIVED from the presenting key through the corpus's wallet records, never read from the record's own attribution.wallet_ref alone. Omitting the optional self-declared ref skipped the audience binding entirely, and declaring the audience's ref alongside another wallet's key passed it on a lie. A presenting key no wallet declares is refused (presenting-key-unresolved); a declared ref contradicting the presented key is attribution laundering. - Rule (q): a composition whose wallet_ref does not resolve is refused (composition-wallet-unresolved) instead of silently skipping the class check the profile README promised; the rule's firing case also gains the probe it never had (composition-on-non-agent). Five new negative fixtures: 16 positives + 29 negatives, 11/11 requirements, all 20 finding codes red-proven load-bearing. Prose corrected down to the mechanism everywhere else: - The custody-registry schema description keyed the unearned-ceiling promise on the NAME act_unsupervised (rank-keyed in code since the hardening pass; the README already said so) and described the collapse rule in its pre-hardening readable-only form — as did the CHANGELOG and the core README. - "Key material is unrepresentable" is now scoped to FIELDS; the value scan is stated as what it is — a PEM/JWK blocklist a raw hex seed passes — with the consumer obligation named. - reconstructable_without_wallet: "declared true or refused" corrected to what is enforced and what the promoted spec asks: an explicit false is refused, omission is permitted. - "Present iff refused" -> "Required when refused" (one direction is enforced); "seven kinds of the core" -> six core + one profile; two new stated limits (expiry is enforced via grant state, not recomputed from timestamps; coverage closure is per requirement, not per rule). - Stale registration headers: both wallet family READMEs + the custody registry said "at the next additive bundle cut" though registration happened at contract-v1.31; same fix for domain-ontology (v1.22) and worker-enrollment (v1.29). Manifest corpus comment said 16+16 (never true; born at 17, missed by the 17->24 sweep). plan/tasks still said fifteen codes / seventeen rules; traceability said "four fail-open gaps" while listing ten and a crash. Five manifest digests refreshed (pre-tag, description/comment edits only); 132 per-file digests verify. Full record: traceability.yaml review_docs section. Co-Authored-By: Claude Fable 5 <[email protected]>
There was a problem hiding this comment.
Hi @brettheap! 👋
Your private repo does not have access to Sourcery.
Please upgrade to continue using Sourcery ✨
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ea1906c128
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| presenting_key = (attribution.get("presenting_key_ref") | ||
| if attribution.get("mode") != "unattributed" else None) | ||
| key_wallet = ctx.wallet_by_key.get(presenting_key) if presenting_key else None |
There was a problem hiding this comment.
Bind the audience to the proof key
When the proof and attribution blocks name different keys, this derives the presenting wallet from the attribution block—the same self-declared data this change is intended not to trust. A permitted exercise can therefore record a non-audience key in proof_of_possession.presenting_key_ref while naming the audience's known key in attribution.presenting_key_ref; the schema permits both values and no later check compares them, so the audience binding validates cleanly. Derive from the proof key and reject any conflicting attribution key.
Useful? React with 👍 / 👎.
| key_id = (doc.get("key_reference") or {}).get("key_id") | ||
| if key_id: | ||
| self.wallet_by_key[key_id] = doc["wallet_id"] |
There was a problem hiding this comment.
Preserve the DID when indexing wallet keys
When two wallets use the same local key_id under different DIDs, the later wallet silently overwrites the earlier entry and exercises are attributed according to file order. This is a valid corpus shape because openxwallet-record.schema.yaml defines key_id as naming a key within its DID anchor, not globally. The new audience check therefore produces false matches or lets one wallet's key be treated as another's; index a full key reference or reject ambiguous identifiers instead of collapsing them into one string.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Pull request overview
This PR tightens the openxWallet validator to match two previously overstated documentation guarantees (audience binding and composition wallet resolution), and corrects multiple contract/prose surfaces to describe the mechanism accurately. It also expands the negative fixture corpus and updates traceability/red-proof evidence and manifest digests accordingly.
Changes:
- Harden validator rule (r) by deriving the presenting wallet via key→wallet resolution, and add new negative fixtures for the previously evadable audience binding.
- Harden validator rule (q) to refuse unresolvable composition wallet refs, and add negative fixtures for unresolved and non-agent composition wallets.
- Align documentation/schema descriptions, counts, traceability, and evidence outputs to the updated validator behavior and corpus size (16 positives / 29 negatives, 20 load-bearing finding codes).
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| specs/006-openxwallet-contracts/traceability.yaml | Updates requirement→probe mappings, adds review_docs record, and refreshes corpus/code counts. |
| specs/006-openxwallet-contracts/tasks.md | Updates documented rule/code counts to current validator/corpus reality. |
| specs/006-openxwallet-contracts/plan.md | Updates documented load-bearing finding code count. |
| specs/006-openxwallet-contracts/evidence/red-proof-output.txt | Updates recorded red-proof output for the expanded set of finding codes. |
| scripts/validate-openxwallet.py | Implements fail-closed audience binding via key→wallet derivation and refuses unresolved composition wallets; updates prose docstring. |
| ideation/staging/INDEX.md | Updates staged index entry to reflect 29 negatives for openxWallet realization. |
| contracts/worker-enrollment/README.md | Fixes stale “next additive bundle cut” registration header to the actual version. |
| contracts/README.md | Updates openxWallet validator entry counts (24→29 negatives). |
| contracts/openxwallet/README.md | Corrects custody-collapse prose and clarifies expiry enforcement + coverage closure semantics. |
| contracts/openxwallet/openxwallet-subject-attestation.schema.yaml | Corrects comment to match actual enforcement for reconstructable_without_wallet. |
| contracts/openxwallet/openxwallet-record.schema.yaml | Refines description of key-material exclusion (fields vs value blocklist limits). |
| contracts/openxwallet/openxwallet-grant-exercise.schema.yaml | Corrects refusal prose (“Required when refused”). |
| contracts/openxwallet/openxwallet-custody.registry.yaml | Fixes stale registration header. |
| contracts/openxwallet/openxwallet-custody-registry.schema.yaml | Corrects schema description to match rank-keyed ceiling rule + collapse rule semantics. |
| contracts/openxwallet/examples/negative/exercise-presenting-key-unknown-to-the-corpus.yaml | Adds negative fixture for unknown presenting key (new fail-closed path). |
| contracts/openxwallet/examples/negative/exercise-presenting-key-of-another-wallet.yaml | Adds negative fixture for evasion by omitting attribution.wallet_ref. |
| contracts/openxwallet/examples/negative/exercise-attributed-to-a-wallet-not-presenting-its-key.yaml | Adds negative fixture for declared stand-in attribution laundering. |
| contracts/openxwallet-agent-profile/README.md | Clarifies that non-resolving composition wallet refs are refused (aligns prose to validator). |
| contracts/openxwallet-agent-profile/examples/negative/composition-for-a-wallet-that-does-not-resolve.yaml | Adds negative fixture for unresolved composition wallet. |
| contracts/openxwallet-agent-profile/examples/negative/composition-declared-for-a-non-agent-wallet.yaml | Adds negative fixture for composition on a non-agent wallet. |
| contracts/manifest.yaml | Refreshes digests for the registered files whose bytes changed (docs-only edits). |
| contracts/domain-ontology/README.md | Fixes stale “next additive bundle cut” registration header to the actual version. |
| contracts/CHANGELOG.md | Updates custody-collapse prose and corpus/finding-code counts to match current reality. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| if kind == "xfactory_wallet_record" and doc.get("wallet_id"): | ||
| self.wallets[doc["wallet_id"]] = doc | ||
| key_id = (doc.get("key_reference") or {}).get("key_id") | ||
| if key_id: | ||
| self.wallet_by_key[key_id] = doc["wallet_id"] |
| attribution = doc.get("attribution") or {} | ||
| presenting_key = (attribution.get("presenting_key_ref") | ||
| if attribution.get("mode") != "unattributed" else None) | ||
| key_wallet = ctx.wallet_by_key.get(presenting_key) if presenting_key else None |
Codex and Copilot, reviewing the audience-binding fix, converged on the same two findings — and both are the review_hardening pattern recurring on the repair itself: the fix asked a slightly wrong question. - The derivation read attribution.presenting_key_ref: self-declared data, the same trust mistake one field over. A record could name the audience's key in attribution while proof_of_possession recorded the non-audience key that actually signed, and nothing compared them. The binding key is now the VERIFIED proof block's key when one is recorded; an attribution key contradicting it is laundering. The same ground truth closes a third route neither reviewer named: a verified proof by the wrong key on an act recorded 'unattributed' skipped the audience binding entirely while staying permitted — a verified presented key is an establishable identity, and recording the act as nobody's is now laundering too. (An UNVERIFIED proof key still establishes nothing: the corpus's verification-failure positive stays honest and stays green.) - key_id is scoped to its DID anchor, so two wallets may legally share one; the flat key->wallet dict silently resolved that by file order. The index now keeps all holders, and a bare presenting key declared by more than one wallet is refused as ambiguous rather than guessed (shares the red-proven presenting-key-unresolved code; unfixturable in a one-document-per-probe corpus, recorded in traceability). Two new probes for the laundering shapes: corpus 16 + 31, still 20 load-bearing codes. Counts swept (CHANGELOG, contracts index, INDEX row, manifest comment, traceability); full record in traceability.yaml review_docs under binding-key-was-still-self-declared. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Both review findings addressed in b3f132c — and both were real; thank you. They are the
Two new negative probes for the laundering shapes; corpus is 16 + 31, all 20 finding codes red-proven, @codex review |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 25 out of 25 changed files in this pull request and generated 1 comment.
Suppressed comments (1)
scripts/validate-openxwallet.py:1038
composition-wallet-unresolvedis only emitted whenctx.walletsis non-empty. If a corpus contains a composition record but no wallet records,wallet_refwill never resolve and (per rule (q) + README) should be refused rather than passed over; the current guard makes resolution optional in that case.
If the intent is truly fail-closed on unresolvable wallet_ref, this check should not depend on ctx.wallets being populated.
if wallet_ref and wallet is None and ctx.wallets:
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b3f132c688
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| else None) | ||
| verified_key = (proof.get("presenting_key_ref") | ||
| if verified is True else None) | ||
| presenting_key = verified_key or attributed_key |
There was a problem hiding this comment.
Require the verified proof to name the binding key
The fresh path after the earlier fix is that proof_of_possession.presenting_key_ref remains optional: an authenticated, permitted exercise can set presented: true and verified: true, omit the proof key, and put the audience's key only in attribution.presenting_key_ref. This fallback then derives the wallet from that self-declared attribution and the record validates without ever recording which key actually verified, leaving the original audience-laundering route open; a verified proof with no key should fail rather than fall back to attribution.
Useful? React with 👍 / 👎.
| elif len(owners) > 1: | ||
| f.error("presenting-key-unresolved", |
There was a problem hiding this comment.
Exclude reference wallets from repository ambiguity checks
When validating a consumer repository, ctx is already populated from every packaged positive example at lines 1316–1320, and repo_scan adds the consumer's wallets to that same key index. Consequently, a valid consumer wallet with a DID-scoped key_id matching an example key such as key-poster-0001 is treated as having multiple owners here and every exercise using it is refused as ambiguous, even when the consumer corpus contains only one owner. Build the repository lookup from repository artifacts rather than mixing the reference corpus into it.
Useful? React with 👍 / 👎.
…ver itself Codex's second pass on the binding found the same pattern a third time — each repair trusted a field the record was still free to shape: - proof_of_possession.presenting_key_ref is optional, so a record could claim verified=true, omit the proof key, and be bound through the self-declared attribution key again — the original laundering route, one omission deeper. A verified proof that does not record WHICH key verified is now refused (presenting-key-unresolved) instead of falling back to attribution. Unverified proofs still bind through the declared key; an unverified signature establishes nothing either way. - Repo mode indexed consumer records into the context already holding the packaged positives, so a teaching fixture could resolve a live reference — and once ambiguity refusal landed, a consumer wallet legitimately reusing a DID-scoped key_id an example also uses (key-poster-0001) had every exercise refused as ambiguous against a fixture. Repo scans now build their own context from the scanned repo's records plus the canonical registry; verified by scanning a scratch consumer repo that reuses the key_id under its own DID. One new probe: corpus 16 + 32, still 20 load-bearing codes. Counts swept; record in traceability.yaml review_docs (verified-proof-could-omit-its-key, reference-corpus-polluted-repo-resolution). Co-Authored-By: Claude Fable 5 <[email protected]>
|
Both round-two findings addressed in 24c60c7 — real again, and the same pattern a third time (each repair trusted a field the record was still free to shape; recorded that way in
Corpus 16 + 32, all 20 codes red-proven, @codex review |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 26 out of 26 changed files in this pull request and generated no new comments.
Suppressed comments (2)
scripts/validate-openxwallet.py:800
presenting_keyresolution is currently skipped whenctx.wallets_by_keyis empty (if presenting_key and ctx.wallets_by_key:). In repo-scan mode, a repo containing exercises but no wallet records would bypass the presenting-wallet derivation entirely, making the audience binding effectively optional again. This should be fail-closed: if a presenting key is present but no wallet declares it (including the case where there are zero wallet records), the exercise should getpresenting-key-unresolved.
if presenting_key and ctx.wallets_by_key:
scripts/validate-openxwallet.py:1053
composition-wallet-unresolvedis only raised whenctx.walletsis non-empty (if wallet_ref and wallet is None and ctx.wallets:). In repo-scan mode, a repo containing only a composition record (or otherwise missing wallet records) would silently pass the resolution requirement even though the README and rule (q) intend unresolved wallets to be refused. This should be fail-closed wheneverwallet_refis set but does not resolve.
if wallet_ref and wallet is None and ctx.wallets:
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 24c60c7749
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| f"{attributed_key!r} while the verified proof was " | ||
| f"presented by {verified_key!r}; attribution follows the " | ||
| f"key that actually signed") | ||
| if presenting_key and ctx.wallets_by_key: |
There was a problem hiding this comment.
Reject presenting keys when the wallet index is empty
When a scanned consumer repo contains a grant and permitted exercise but no wallet records, repo_ctx.wallets_by_key is empty, so this condition skips resolution entirely; presented_by then falls back to the exercise's self-declared attribution.wallet_ref. Because grant ceiling resolution also skips an empty wallet index, the record can claim an arbitrary verified key alongside the grant's audience wallet and validate without any wallet establishing ownership of that key. Perform the lookup whenever presenting_key is present and treat an empty owner list as presenting-key-unresolved.
Useful? React with 👍 / 👎.
| # asymmetry the custody-ceiling and grant bindings already close. | ||
| wallet_ref = doc.get("wallet_ref") | ||
| wallet = ctx.wallets.get(wallet_ref) if wallet_ref else None | ||
| if wallet_ref and wallet is None and ctx.wallets: |
There was a problem hiding this comment.
Reject unresolved compositions when no wallets were indexed
When repo-scan input contains a composition but no wallet records, ctx.wallets is empty and this condition suppresses composition-wallet-unresolved; the subsequent holder-class check also has no wallet to inspect, so the otherwise-valid composition passes. This is especially reachable now that repository scans use an isolated context rather than packaged positives, and it leaves the newly documented fail-closed resolution rule ineffective for a standalone consumer composition. Remove the collection-truthiness guard so every unresolved wallet_ref is refused.
Useful? React with 👍 / 👎.
…s corpus Codex round three, same pattern in its last hiding place: the fail-closed unresolved-ref rules carried empty-collection guards (`and ctx.wallets`, `and ctx.wallets_by_key`) — dead code while every context held the packaged positives, live and FAIL-OPEN the moment repo scans got their own context. A consumer repo declaring no wallets at all skipped every resolution those rules exist to force: an exercise's presenting key fell back to the self-declared attribution wallet, a grant's custody ceiling never bound, and a composition passed unresolved. Guards removed from all three rules (e, q, r) — Codex named q and r; (e) carried the identical guard, so the class closes rather than the instances. Verified on scratch repos: grant+exercise with no wallet records fires custody-ceiling-unresolved AND presenting-key-unresolved, a lone composition fires composition-wallet-unresolved, and the valid consumer repo still scans clean. Corpus unchanged (16 + 32, 20 codes red-proven; the packaged contexts are never empty, which is exactly why the guards were invisible there). Co-Authored-By: Claude Fable 5 <[email protected]>
|
Round-three findings addressed in the latest commit — both real, and the same pattern in its last hiding place (recorded in The empty-collection guards ( @codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1d851ce073
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # wallet legitimately reusing a DID-scoped key_id that an example also | ||
| # uses must not be refused as ambiguous against it. A consumer corpus is | ||
| # closed over itself. | ||
| repo_ctx = Context(ctx.registry, ctx.vocabulary) |
There was a problem hiding this comment.
Report unresolved constraints in an isolated repository context
When a scanned repository contains a valid wallet, grant, and exercise whose constraint_evaluations reference a constraint but contains no xfactory_wallet_distinct_holder_constraint records, this fresh context leaves repo_ctx.constraints empty. The existing if ref and ctx.constraints and ref not in ctx.constraints condition then suppresses constraint-unresolved, so even --strict accepts an evaluation whose governing constraint cannot be resolved; before this isolation change, the packaged constraint made that condition run. Check evaluation references unconditionally rather than using collection truthiness as an existence guard.
Useful? React with 👍 / 👎.
…ances Codex round four: the constraint-unresolved warning carried the same empty-collection guard the round-three fix removed from the error rules, so a scanned repo with no constraint records accepted an evaluation whose governing constraint resolves to nothing, even under --strict. Removed — and with it the two custody-model-unknown guards on the canonical custody set, the pattern's last instances anywhere in the validator (unreachable in practice since an empty canonical registry turns the self-test red, removed so the pattern is extinct rather than rare). Verified: a scratch repo whose exercise evaluates an undeclared constraint now warns; the wallet-less and composition-only repos still fail closed; the valid consumer repo still scans clean; corpus 16 + 32, 20 codes red-proven, --strict and digests green. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Round-four finding addressed in the latest commit. The Verified: an exercise evaluating an undeclared constraint warns in an isolated repo context; the wallet-less and composition-only repos still fail closed; the valid consumer repo scans clean; 16 + 32, 20 codes red-proven, full suite green. @codex review |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 26 out of 26 changed files in this pull request and generated no new comments.
Suppressed comments (3)
specs/006-openxwallet-contracts/traceability.yaml:53
- The OXW-R3
red_provenentry only mentionsproof-of-possession-missingandverification-failure-miscategorised, but the OXW-R3 probe list now also exercises (and red-proves)audience-mismatchandpresenting-key-unresolved(see updated corpus / red-proof output). Updating this line will keep the traceability record aligned with the current red-proof set.
red_proven: >-
proof-of-possession-missing and verification-failure-miscategorised
neutered in turn; corpus went red each time. Three probes because the
specs/006-openxwallet-contracts/traceability.yaml:46
- The OXW-R3 negative confirmations now include audience-binding/presenting-key probes (audience-mismatch / presenting-key-unresolved), but the
enforced_byline for OXW-R3 still says only “rules i, j”. This traceability row should reflect that rule (r) incheck_exerciseis also exercised by the listed probes.
This issue also appears on line 51 of the same file.
examples/negative/exercise-refusal-names-the-wrong-absence.yaml,
examples/negative/exercise-verification-failure-as-unauthenticated.yaml,
examples/negative/exercise-permitted-on-unverified-proof.yaml,
specs/006-openxwallet-contracts/traceability.yaml:184
- PR description says the corpus is “16 positives + 29 negatives” and mentions “five new negative fixtures”, but the repo currently has 32 negative confirmations under
contracts/openxwallet*/examples/negative/(28 core + 4 agent-profile), matching thisnegative_confirmations: 32update. Please update the PR description counts so it matches the actual corpus contents.
positive_examples: 16
negative_confirmations: 32
distinct_finding_codes_proven: 20
|
Round-five findings addressed in the latest commit — both real (recorded in
Corpus 16 + 33, all 21 finding codes red-proven, full suite green, all prior scratch scenarios unchanged. @codex review |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 27 out of 27 changed files in this pull request and generated no new comments.
Suppressed comments (5)
scripts/validate-openxwallet.py:494
- The authority_tiers index tries to avoid unhashable tier ids by excluding only lists/dicts. A YAML
!!setid would still be unhashable and would crash the dict comprehension. Since tier ids are expected to be strings, it’s safer to explicitly require a string id here.
models = doc.get("custody_models") or []
tiers = {t.get("id"): t.get("rank") for t in (doc.get("authority_tiers") or [])
if isinstance(t, dict) and not isinstance(t.get("id"), (list, dict))}
scripts/validate-openxwallet.py:560
- In the custody-collapse check, the guards before tiers.get(...) exclude only list/dict. If authority_ceiling is a YAML
!!set(unhashable), tiers.get(...) will still raise TypeError and abort validation. Prefer a simpleisinstance(ceiling, str)guard before doing dict lookups.
e_rank = tiers.get(env_member.get("authority_ceiling")) \
if not isinstance(env_member.get("authority_ceiling"), (list, dict)) else None
for holder_member in holder_members:
if env_member is holder_member:
continue # a self-comparison carries no information
scripts/validate-openxwallet.py:919
- The evaluated constraint_ref set-comprehension can still crash on unhashable values (e.g., YAML
!!set) because it only filters out lists/dicts. constraint_ref is expected to be a string, so filtering toisinstance(..., str)both avoids crashes and matches the intended type.
evaluated = {e.get("constraint_ref")
for e in (doc.get("constraint_evaluations") or [])
if isinstance(e, dict)
and not isinstance(e.get("constraint_ref"), (list, dict))}
scripts/validate-openxwallet.py:365
- _hashable_set claims to return the hashable members of a doc-supplied list, but it only filters out lists/dicts. YAML can legally contain
!!setvalues (loaded by yaml.safe_load as Pythonset), which are unhashable; including them here will still raise TypeError and abort validation (the failure mode this helper is meant to prevent).
This issue also appears in the following locations of the same file:
- line 492
- line 556
- line 916
doc-supplied lists must not crash on an unhashable member; the schema
finding on the malformed document is the report, not a harness error."""
if not isinstance(values, list):
return set()
return {v for v in values if not isinstance(v, (list, dict))}
specs/006-openxwallet-contracts/traceability.yaml:185
- The PR description states the corpus is “16 positives + 29 negatives” and “all 20 finding codes”, but traceability.yaml now records 33 negative confirmations and 21 distinct finding codes proven. Please reconcile the PR description with these updated counts (or adjust the counts here if the description is authoritative).
corpus:
positive_examples: 16
negative_confirmations: 33
distinct_finding_codes_proven: 21
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 37b6d296c7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| evaluated = {e.get("constraint_ref") | ||
| for e in (doc.get("constraint_evaluations") or []) | ||
| if isinstance(e, dict)} | ||
| if isinstance(e, dict) | ||
| and not isinstance(e.get("constraint_ref"), (list, dict))} |
There was a problem hiding this comment.
Guard the constraint-evaluation container before iterating
When a repo-scanned permitted exercise has a schema-invalid scalar such as constraint_evaluations: 1, this comprehension still attempts to iterate the integer before the accumulated schema finding can be reported, raising TypeError and causing the top-level handler to return exit 2 and discard all findings. Fresh evidence beyond the earlier key_reference report is that the new element-level guard only runs after the container has already been assumed iterable; normalize the container to a list before this comprehension.
Useful? React with 👍 / 👎.
…ting Codex round six: `value or []` passes a truthy scalar straight to iteration, so a schema-invalid `constraint_evaluations: 1` crashed the run (exit 2, all findings discarded) before its own schema finding could be reported. Added `_sequence` — the list twin of `_mapping` — and normalized every doc-derived container the rules iterate or test membership against: constraint evaluations (both sites), grant acts (both sites), declared constraint refs, custody models, authority tiers, and the composition component set. Fuzz corpus grown to eleven malformed documents (scalar containers in exercise, grant, registry and composition): exit 1 with findings, never a harness error. Corpus unchanged: 16 + 33, 21 codes red-proven, strict green. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Round-six finding addressed in the latest commit. @codex review |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 27 out of 27 changed files in this pull request and generated no new comments.
Suppressed comments (2)
scripts/validate-openxwallet.py:502
check_custody_registrybuildstierswith potentially non-int ranks (it only filters the id type), and later comparese_rank >= h_rank. If a schema-invalid registry supplies a non-intrank(e.g., dict/list), this path will raiseTypeErrorand abort the run — the opposite of the new “type-guarded, never crash the harness” intent for malformed docs.
models = _sequence(doc.get("custody_models"))
tiers = {t.get("id"): t.get("rank") for t in _sequence(doc.get("authority_tiers"))
if isinstance(t, dict) and not isinstance(t.get("id"), (list, dict))}
specs/006-openxwallet-contracts/traceability.yaml:185
- The PR description states the corpus is “16 positives + 29 negatives” and “20 finding codes”, but
traceability.yamlnow recordsnegative_confirmations: 33anddistinct_finding_codes_proven: 21(consistent with the new fixtures / red-proof output). Please reconcile the PR description so reviewers aren’t left with conflicting totals.
corpus:
positive_examples: 16
negative_confirmations: 33
distinct_finding_codes_proven: 21
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 535d0fca59
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| for ref in _sequence(grant.get("distinct_holder_constraint_refs")): | ||
| if ref not in evaluated: |
There was a problem hiding this comment.
Guard malformed declared constraint references
In repo-scan mode, a schema-invalid grant whose distinct_holder_constraint_refs is a list containing a list or mapping still aborts validation when a permitted exercise resolves that grant: the outer container now reaches this loop safely, but ref not in evaluated attempts to hash the malformed member and raises TypeError, producing exit 2 and discarding the accumulated schema findings. Fresh evidence after the scalar-container fix is that nested unhashable references remain unguarded; filter members to strings (or otherwise hashable values) before the membership test.
Useful? React with 👍 / 👎.
| tiers = {t.get("id"): t.get("rank") for t in _sequence(doc.get("authority_tiers")) | ||
| if isinstance(t, dict) and not isinstance(t.get("id"), (list, dict))} |
There was a problem hiding this comment.
Validate authority-tier ranks before comparing them
When repo scanning a schema-invalid custody registry with a non-integer tier rank, this comprehension retains the malformed rank. If an environment model and a holder model reference tiers whose ranks have incompatible types—for example rank: [] and rank: 2—the later collapse check evaluates e_rank >= h_rank and raises TypeError, so the run exits 2 instead of reporting the registry's schema findings. Restrict the rank table to valid integer ranks or guard both operands before comparison.
Useful? React with 👍 / 👎.
Codex round seven, the crash class two levels down: an unhashable member INSIDE distinct_holder_constraint_refs reached the evaluated-set membership test, and a non-integer tier rank survived the tier table into the collapse comparison — each a TypeError that exits 2 and discards every accumulated finding. Members are now skipped where unhashable (the grant's schema finding is the report), and the tier table is restricted to integer ranks (a dropped tier makes ceilings naming it 'unknown', failing closed alongside the registry's own schema finding). Fuzz corpus grown to fourteen documents, adding a grant with nested list/mapping constraint refs resolved by a permitted exercise, and a registry mixing rank kinds across the collapse pair: exit 1 with findings, never a harness error. Corpus unchanged: 16 + 33, 21 codes red-proven, strict green. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Round-seven findings addressed in the latest commit — the crash class two levels down, members rather than containers. Unhashable members inside @codex review |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 27 out of 27 changed files in this pull request and generated no new comments.
Suppressed comments (2)
specs/006-openxwallet-contracts/traceability.yaml:185
- The PR description states the corpus is "16 positives + 29 negatives" and "20 finding codes" load-bearing, but the updated artifacts in this PR (including this file) say 33 negative confirmations and 21 distinct finding codes proven. Please update the PR description numbers to match the code/docs changes to prevent confusion during review and later auditing.
corpus:
positive_examples: 16
negative_confirmations: 33
distinct_finding_codes_proven: 21
specs/006-openxwallet-contracts/traceability.yaml:89
- OXW-R5 now lists
wallet-record-duplicating-another-wallet-id.yamland mentionsrecord-id-duplicatein red-proof, butenforced_bystill points only tocheck_exercise (rule k). Therecord-id-duplicatefinding is emitted byvalidate_openxwallet.validate_record, so the traceability row should include that enforcing check to avoid misattributing how the probe is enforced.
OXW-R5:
statement: Every exercise is key-attributed
artifact: contracts/openxwallet/openxwallet-grant-exercise.schema.yaml
enforced_by: validate_openxwallet.check_exercise (rule k)
negative_confirmation: >-
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6c42e098f0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if isinstance(e, dict) | ||
| and not isinstance(e.get("constraint_ref"), (list, dict))} | ||
| for ref in _sequence(grant.get("distinct_holder_constraint_refs")): | ||
| if isinstance(ref, (list, dict)): |
There was a problem hiding this comment.
Check actual hashability before constraint membership
Fresh evidence beyond the addressed list/mapping case is PyYAML's safe !!set tag: a schema-invalid grant containing distinct_holder_constraint_refs: [!!set {bad: null}] produces a Python set, which this guard does not skip, so the subsequent ref not in evaluated hashes it and raises TypeError. Repo validation then exits 2 and discards the accumulated schema findings; filter members by actual hashability or accept only schema-valid strings.
Useful? React with 👍 / 👎.
Codex round eight: the round-seven guards skipped list and dict members, but PyYAML's safe !!set tag yields a Python set — exactly as unhashable and not on the list. Enumerating unhashable types is the same mistake as enumerating key-material formats: a blocklist where a property test belongs. All five guards (the constraint-refs loop, the evaluated-set comprehension, _hashable_set itself, the tier-id table, and both collapse-rank lookups) now ask hash() directly via a _hashable helper. Fuzz corpus grown to eighteen documents with !!set members in grant acts, constraint refs, evaluation refs, tier ids and ceilings, plus a derived grant resolving the malformed parent: exit 1 with findings, never a harness error. Corpus unchanged: 16 + 33, 21 codes red-proven, strict green. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Round-eight finding addressed in the latest commit — and the framing was the fix: enumerating unhashable types is the same mistake as enumerating key-material formats, a blocklist where a property test belongs. All five member-level guards (constraint-refs loop, evaluated-set comprehension, @codex review |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 27 out of 27 changed files in this pull request and generated no new comments.
Suppressed comments (5)
specs/006-openxwallet-contracts/traceability.yaml:57
- OXW-R3
red_provendoesn’t mention the finding codes introduced by the new probes (audience-mismatch,presenting-key-unresolved). Since these codes are now exercised by OXW-R3’s negative confirmations and appear in the red-proof output, update the summary so it matches what is actually red-proven for this requirement.
red_proven: >-
proof-of-possession-missing and verification-failure-miscategorised
neutered in turn; corpus went red each time. Three probes because the
requirement carries three distinct clauses — presentation is
insufficient, the refusal names the missing PROOF rather than a missing
grant, and a verification failure stays distinguishable from an
unauthenticated request.
specs/006-openxwallet-contracts/traceability.yaml:143
- OXWA-R1
enforced_byreferences only rule (o), but this row’s negative confirmations and red_proven summary includecomposition-wallet-unresolved/composition-on-non-agent, which are enforced under rule (q) incheck_agent_composition. Updateenforced_byto include rule (q) so the traceability points to the correct checks.
OXWA-R1:
statement: An agent holder declares its composition
artifact: contracts/openxwallet-agent-profile/openxwallet-agent-composition.schema.yaml
enforced_by: validate_openxwallet.check_agent_composition (rule o)
specs/006-openxwallet-contracts/traceability.yaml:185
- The PR description claims the corpus is "16 positives + 29 negatives" and "all 20 finding codes"; in-repo documentation updated here records 33 negative confirmations and 21 distinct finding codes proven. Please align the PR description numbers with the updated corpus counts so reviewers aren’t left with conflicting totals.
corpus:
positive_examples: 16
negative_confirmations: 33
distinct_finding_codes_proven: 21
specs/006-openxwallet-contracts/traceability.yaml:90
- OXW-R5
enforced_bypoints only tocheck_exercise (rule k), but this requirement’s negative confirmations now also includewallet-record-duplicating-another-wallet-id.yaml, which is enforced via the duplicate-id detection invalidate_record/indexing (record-id-duplicate). The traceability row should include that enforcement location.
OXW-R5:
statement: Every exercise is key-attributed
artifact: contracts/openxwallet/openxwallet-grant-exercise.schema.yaml
enforced_by: validate_openxwallet.check_exercise (rule k)
negative_confirmation: >-
specs/006-openxwallet-contracts/traceability.yaml:45
- OXW-R3’s
enforced_byline above still cites only rules (i, j), but this requirement’s negative confirmations now include audience binding / presenting-key cases enforced under rule (r) incheck_exercise. Updateenforced_byso it points to all enforcing rules for this requirement.
examples/negative/exercise-refusal-names-the-wrong-absence.yaml,
examples/negative/exercise-verification-failure-as-unauthenticated.yaml,
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Copilot's suppressed nit, taken because it is this PR's own standard: the row's probes now red-prove audience-mismatch and presenting-key-unresolved alongside the original two codes, and the record said only the original two. Co-Authored-By: Claude Fable 5 <[email protected]>
The release digest inventory for the bundle registered at the contract-v1.31 changelog entry: the openxWallet holder-agnostic core (six kinds, closed custody registry) and its first profile (the agent composition record), realized by Speckit feature 006-openxwallet-contracts through PRs #115, #116 and #120 — landing, validator hardening, and the docs-truth pass that followed the third adversarial review. The new families' per-file digests are carried by contracts/manifest.yaml inside this inventory, per the v1.30 convention; the packaged corpus and validator are content-addressed by the release commit. Co-Authored-By: Claude Fable 5 <[email protected]>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 27 out of 27 changed files in this pull request and generated no new comments.
Suppressed comments (3)
specs/006-openxwallet-contracts/traceability.yaml:94
- In OXW-R5,
enforced_bysays onlycheck_exercise (rule k), but this row now includes the duplicate wallet-id probe and red-proofsrecord-id-duplicate, which is emitted by the per-record validation/indexing path (notcheck_exercise). Please updateenforced_byto include the duplicate-id enforcement so the traceability row remains accurate.
statement: Every exercise is key-attributed
artifact: contracts/openxwallet/openxwallet-grant-exercise.schema.yaml
enforced_by: validate_openxwallet.check_exercise (rule k)
negative_confirmation: >-
examples/negative/wallet-record-duplicating-another-wallet-id.yaml,
specs/006-openxwallet-contracts/tasks.md:76
- PR description says the corpus is "16 positives + 29 negatives" and "20 finding codes" load-bearing, but the updated artifacts in this PR show 33 negatives and 21 load-bearing codes. Please update the PR description numbers to match the repo state (or adjust the repo changes if the description is the intended target).
- [x] 6.4 `# requirement:` attribution plus closed coverage checking in both
directions, so a requirement cannot silently lose its probe.
- [x] 6.5 Red-proof harness (`evidence/red-proof.py`) and its recorded output:
all twenty-one finding codes load-bearing.
specs/006-openxwallet-contracts/traceability.yaml:55
- In OXW-R3,
enforced_bystill lists only rules (i, j), but this requirement is now also enforced by the audience binding / presenting-key resolution logic (rule r) — reflected by the newaudience-mismatch/presenting-key-unresolvedred-proof entries below. Updateenforced_byso traceability matches the actual enforcement points.
This issue also appears on line 90 of the same file.
red_proven: >-
proof-of-possession-missing, verification-failure-miscategorised,
audience-mismatch and presenting-key-unresolved neutered in turn;
corpus went red each time. The probes cover the requirement's distinct
clauses — presentation is insufficient, the refusal names the missing
What this is
The third adversarial pass over openxWallet — this one reviewing what the family says rather than what it does, after #115 (landing) and #116 (validator hardening). The standard applied is the family's own: a sentence overstating what the contract guarantees is the same failure the capability exists to refuse — an audit record asserting something the mechanism cannot support. The review produced ten verified findings (each backed by a counterexample document run through the validator, or an exact quote against the artifact); per Brett's direction, the two findings where the prose promised real enforcement are closed by tightening the validator up to the prose, and everything else is corrected down to the mechanism.
Validator tightened (the fail-closed direction)
Rule (r) — the audience binding no longer trusts a self-declaration. The check compared the grant's audience against the record's own
attribution.wallet_ref, an optional field: omitting it skipped the binding entirely, and declaring the audience's ref alongside another wallet's key passed it on a lie — the exact scenario the shipped negative fixture claims is caught, evaded by dropping one field. The presenting wallet is now derived from the presenting key through the corpus's wallet records (key_reference.key_id→ wallet). A presenting key no wallet declares is refused (presenting-key-unresolved, the same fail-closed asymmetry the grant and custody-ceiling bindings already close); a declared ref contradicting the presented key is attribution laundering.Rule (q) — a composition's wallet must actually resolve. The profile README promised "must resolve to a wallet whose holder class is
agent", but the rule fired onlyif wallet is not None— a danglingwallet_refvalidated cleanly and the class check never ran. Unresolved is now refused (composition-wallet-unresolved), and the rule's firing case gains the negative fixture it never had (composition-on-non-agentwas enforced but regression-unguarded).Five new negative fixtures. Corpus: 16 positives + 29 negatives, 11/11 requirements, all 20 finding codes red-proven load-bearing.
Prose corrected
act_unsupervised— the code has been rank-keyed since 5f61c4b, and the README already said so; the two surfaces disagreed. Also restated the collapse rule in its post-Close ten fail-open gaps an adversarial review found in the wallet validator #116 evidences-keyed form here, in the CHANGELOG, and in the core README (all three still described the pre-hardening readable-only check).additionalProperties: falseeverywhere); the value scan stated as what it is: a PEM/JWK blocklist that a raw hex/base64 seed passes, with the consumer obligation named.reconstructable_without_wallet: "declared true or the record is refused" corrected to actual enforcement (an explicitfalseis refused; omission is permitted — which is what the promoted requirement asks).refused" → "Required whenrefused" (only one direction enforced); "seven kinds of the holder-agnostic core" → six core + one profile.state, not recomputed from timestamps at exercise; coverage closure is per requirement, not per rule.contract-v1.31. Same-class fixes fordomain-ontology(v1.22) andworker-enrollment(v1.29), found by sweep.Registration hygiene
Five registered files changed bytes (description/comment edits only, pre-tag —
contract-v1.31has no annotated tag yet); their manifest digests are refreshed with a dated note, andvalidate-manifest-digests.pyverifies all 132. The full defect-by-defect record lives inspecs/006-openxwallet-contracts/traceability.yamlunder the newreview_docssection, alongside #116'sreview_hardening.Verification
python3 scripts/validate-openxwallet.py— 0 errors, 16 positives / 29 negatives / 11-of-11--strictand whole-repo scan — cleanred-proof.py— all 20 codes load-bearing (output recorded in evidence/)validate-manifest-digests.py— 132 digests verify🤖 Generated with Claude Code