Skip to content

Realize factory-origin-identity: the sibling register, its disjointness validator, and the mint runbook (draft — the key is NOT minted) - #610

Merged
brettheap merged 8 commits into
mainfrom
realize/factory-identity-register
Sep 3, 2026
Merged

brettheap merged 8 commits into
mainfrom
realize/factory-identity-register

Conversation

@brettheap

Copy link
Copy Markdown
Contributor

Realization of the ratified change add-cpc-clearing-boundary (PR #560, merged c0270d28), capability factory-origin-identity, tasks 2.1–2.6. Task 2.7's cross-repo half is codexFactory PR — the two are ONE governed act.

DRAFT, AND IT CANNOT MERGE AS IT STANDS. THAT IS THE INTENDED STATE.

The operator has not minted the per-factory Ed25519 origin key. did, public_key_multibase and key_fingerprint therefore carry the literal sentinel FILL-IN-AT-MINT — never a plausible 43-character base64url literal, because a value that looks like a key is worse than no value: it merges, and every downstream reader then treats a key nobody holds as the repository's identity.

Both readers refuse the tree while the sentinels stand. Reproduce with python3 scripts/validate-factory-identity.py .:

note  factory-identity register read: governance/factory-identity/register.yaml (1 row(s))
note  factory-identity register: 1 active origin row(s) over 1 originating repository(ies)
note  factory-identity: disjointness holds against governance/review-authority/ (1 identifier(s) here, 23 identifier(s) there, 0 shared)
error [factory-identity-placeholder-unminted] governance/factory-identity/attestations/custody-attest-wal-origin-codexfactory-0001.yaml:32: the value is the mint sentinel 'FILL-IN-AT-MINT'. ...
error [factory-identity-placeholder-unminted] governance/factory-identity/attestations/custody-attest-wal-origin-codexfactory-0001.yaml:37: ...
error [factory-identity-placeholder-unminted] governance/factory-identity/wallets/wal-origin-codexfactory-0001.yaml:66: ...
error [factory-identity-placeholder-unminted] governance/factory-identity/wallets/wal-origin-codexfactory-0001.yaml:68: ...
error [factory-identity-placeholder-unminted] governance/factory-identity/wallets/wal-origin-codexfactory-0001.yaml:69: ...
error [factory-identity-tier-unattested] governance/factory-identity/register.yaml: rows[0]: grant 'grant-origin-codexfactory-0001' declares authority_tier 'act' with no COMPLETED custody attestation for wallet 'wal-origin-codexfactory-0001'. An origin key whose custody is undeclared or UNATTESTED caps at 'request' and is NOT evidence that the originating repository itself acted

validate-factory-identity: 6 error(s)

And the PINNED openXwallet reader, inside the REQUIRED wallet-validation check, refuses the same three values independently by schema pattern:

ERROR [schema] .../wallets/wal-origin-codexfactory-0001.yaml: key_reference/did: 'FILL-IN-AT-MINT' does not match '^did:[a-z0-9]+:[A-Za-z0-9._:%-]+$'
ERROR [schema] .../wallets/wal-origin-codexfactory-0001.yaml: key_reference/key_fingerprint: 'FILL-IN-AT-MINT' does not match '^sha256:[0-9a-f]{64}$'
ERROR [schema] .../wallets/wal-origin-codexfactory-0001.yaml: key_reference/public_key_multibase: 'FILL-IN-AT-MINT' does not match '^z[1-9A-HJ-NP-Za-km-z]+$'
validate-openxwallet: 3 error(s), 0 warning(s)

Two independent refusals, neither of which a reviewer can wave through. The gate goes green exactly when the mint is complete, and not before.

What lands

1. governance/factory-identity/ — the SIBLING register (tasks 2.1–2.4)

A sibling of the review-authority intake register, never an extension (design D1, operator-confirmed 2026-09-01): separate file, separate rows, separate reader invocation, its own staleness bound.

  • Deliberately kindless (D3), inherited from the intake register — and D3's rule-of-three trigger is recorded in the header so instance THREE's author mints a schema instead of copying the header a third time. Wallet and grant records beside it carry schema_version + kind from the pinned neutral vocabulary; the custody attestation is kindless for the same recorded reason its review-authority counterpart is.
  • No seat spelling (D2): holder_class: organisation, no seat_keys block, no agent: holder prefix, no keys: set (exactly ONE origin identity is ratified, so a declared key set would express a plurality the contract refuses).
  • Rows carry the six facts the ratified enumeration names plus row_id (the row's own name, needed because the revocation scenario requires a resuming row to NAME the row it supersedes), and no authority_tier column — authority is a property of the grant and its custody attestation, and a register column restating it is two places for one fact to disagree.
  • The register declares its OWN revocation_staleness_bound: P7D and its own revocation_staleness_ceiling: P7D, inheriting neither from the intake register nor from any revocation mechanism realized for it. Ceiling equal to the bound on purpose: from today the bound can be tightened by an edit to one line and widened by no edit at all.

2. scripts/validate-factory-identity.py — the checked rules (task 2.5)

The ratified DISJOINTNESS RULE — no key_id, decentralized identifier or public-key fingerprint in both register families, the finding names the shared value, and it is not waivable by declaring different acts (the check never reads act). Plus: the placeholder refusal; the unattested-custody cap; one-active-row-per-repository with supersession as the legal rotation shape; row/grant expiry equality and the 90-day ceiling; the register's top level and every row closed as exact sets (the register is kindless, so the reader IS the shape); and the secret-name refusal the ratified requirement's own words demand.

ONE DERIVATION, ONE PLACE. Every public-key decoding and every fingerprint is imported from the pinned openXwallet/scripts/validate-openxwallet.py — decode_public_key_multibase, _decode_public_key, fingerprint_of_public_key, _fingerprint_of — never copied. When the gitlink is absent the reader REFUSES (exit 2) rather than falling back to arithmetic of its own, because a fallback would be the second implementation arriving exactly when nobody is looking. The single encoder it does own (b58encode, for the mint helper) round-trips every value back through the pinned decoder before printing.

--derive is proven against a live key: test_derive_reproduces_a_known_minted_key feeds it the lead-quality seat's public half exactly as governance/review-authority/register.yaml records it and asserts the outputs equal that same key's did, public_key_multibase and key_fingerprint exactly as wal-agent-mrc-0001 records them.

3. Wiring into the REQUIRED check (task 2.6)

Two steps appended to wallet-validation (the token the org ruleset pins), after the scoped gitlink init and the pin verification. The assertion is positive: the log must carry the factory-identity register read: NOTE and a literal active-row count and a disjointness note ending 0 shared, and must carry no factory-identity-* finding code. A green check that never opened the register is impossible.

4. docs/factory-origin-key-mint-runbook.md (task 2.3/2.4 support)

The operator ceremony, with the mint-record template mirroring codexFactory's 2026-08-28 seat-key mint record. It is the ONLY governed document that names the CI secret — the ratified requirement forbids "a secret name resolvable to key material" anywhere in the register family, and the reader refuses one. That is a deliberate divergence from governance/review-authority/register.yaml, which does name its seat secrets in prose; the divergence is the ratified sentence.

The choices, recorded

Secret name FACTORY_ORIGIN_SIGNING_KEY in codexFactory's worker-credentials environment The seat keys are COUNCIL_SEAT_SIGNING_KEY_<SEAT> because a council has seats. A repository holds exactly one origin identity, so a suffix would imply a plurality the contract forbids; the name is scoped by the environment, not by a suffix. That environment is where the four seat keys already live, so the custody determination (holder_readable, ceiling act) is the one already attested for them.
Act originate A verb in the same grammar as review; names what is evidenced (this repository originated this request) rather than the artifact; collides with no intake act. sign/seal/attest rejected — each names a mechanism several acts share, so a grant scoped to one would confer more than the origin act.
Scope objects: [opensoft/codexFactory], expiry 90 days A signature evidences that repository's origination and nothing else. 90 days unconditional because no projection path can revoke an origin row at clearing (D9, OQ1 open) — the lapse is the only propagation mechanism that works today.
Where the three sentinels live the wallet record, not the register The ratified row enumeration is closed at six facts and D2 forbids a per-key block in this register, so the public half lives in key_reference as did / public_key_multibase / key_fingerprint. The base64url spelling appears only in the mint record's table.

What is NOT claimed

  • Read-time refusal is NOT in force. The pinned openXwallet reader indexes every wallet and grant record in a scanned tree into one context, so an origin wallet in this sibling tree remains resolvable BY IT as a review row's wallet_ref. Scoping it is an openXwallet dependency (tasks 5.1/5.2, OQ3). Until it lands the disjointness rule is the whole of the enforcement, and the spec's own scenario refuses any document saying otherwise. The register header, the runbook, the README and the reader's docstring all say so.
  • At-clearing revocation is NOT in force. No projection path exists (OQ1). The declared bound is the honest ceiling on propagation.
  • The origin signature is not yet realizable. digest_subject is closed at seventeen members and none is a manifest (task 2.9, a tranche widening).

Evidence

  • python3 -m pytest tests/factory_identity tests/openxwallet_consumer_gate -q → 60 passed (44 new).
  • python3 -m pytest tests/openxwallet_consumer_gate tests/doc-health tests/factory_identity -q → 1471 passed.
  • OPENSPEC_TELEMETRY=0 openspec validate --all --strict → 86 passed, 0 failed. No change packet was edited; this is realization.
  • python3 scripts/proposal-support.py . verify → ok.
  • doc-health --fail-on error, families proposal-origin, status-validity, location-conformance, promotion-fidelity → clean; modified-block-currency → info/contested only, all pre-existing in unrelated packets. ratified-provenance carries two pre-existing criticals in add-sequenced-after-substrate and add-structured-scope-substrate — files this change does not touch; the new runbook produces zero findings.

What the operator does next

Follow docs/factory-origin-key-mint-runbook.md: generate a 32-byte Ed25519 seed offline on a host shell; run python3 scripts/validate-factory-identity.py --derive <public-half> to get did, key_fingerprint and public_key_multibase through the pinned decoders; store the 64-hex private seed as FACTORY_ORIGIN_SIGNING_KEY in codexFactory's worker-credentials environment and nowhere else; replace the five FILL-IN-AT-MINT sentinels (three in the wallet, two in the attestation) and re-stamp the grant/row dates if the mint is later than the drafted issued_at; re-run all four local checks; write the mint record from the runbook's template. Then this PR goes green and is landable by a human act only — it is a permanently human-only surface, floored by name in the sibling codexFactory PR.

…d the mint runbook

Realization of the ratified change `add-cpc-clearing-boundary` (PR #560, merged
c0270d2), capability `factory-origin-identity`, tasks 2.1-2.6. Task 2.7's
cross-repo half — codexFactory's exact-set floor file — lands in the same
governed act as its own draft.

DRAFT, AND IT CANNOT MERGE AS IT STANDS. THAT IS THE INTENDED STATE. The
operator has not minted the per-factory Ed25519 origin key, so `did`,
`public_key_multibase` and `key_fingerprint` carry the literal sentinel
`FILL-IN-AT-MINT` rather than a plausible 43-character base64url literal that
would pass a scanner and a reader alike. Both readers refuse the tree while the
sentinels stand: the new one with the named finding
`factory-identity-placeholder-unminted`, and the PINNED openXwallet reader with
three schema pattern refusals inside the REQUIRED `wallet-validation` check.

WHAT LANDS

* `governance/factory-identity/` — a SIBLING of the review-authority intake
  register, never an extension (design D1). Deliberately kindless, with D3's
  rule-of-three trigger recorded in the header for instance THREE's author.
  `holder_class: organisation`, no `seat_keys` block, no `agent:` prefix (D2).
  Rows carry the six facts the ratified enumeration names plus the row's own
  name, and NO `authority_tier` column. The register declares its OWN
  `revocation_staleness_bound` AND its own ceiling, inheriting neither.
* `scripts/validate-factory-identity.py` — the ratified DISJOINTNESS RULE (no
  `key_id`, `did` or public-key fingerprint in both families; not waivable by
  declaring different acts), the placeholder refusal, the unattested-custody
  cap, one-active-row-per-repository, and the secret-name refusal the ratified
  requirement's own words demand. It DERIVES NOTHING OF ITS OWN: every decoding
  and every fingerprint is imported from the pinned openXwallet reader, and it
  REFUSES rather than falling back when the gitlink is absent.
* Wiring into the REQUIRED `wallet-validation` check with a POSITIVE log
  conjunction, so a green check that never opened the register is impossible.
* `docs/factory-origin-key-mint-runbook.md` — the operator ceremony, and the
  ONLY governed document that names the CI secret, because the ratified
  requirement forbids a secret name resolvable to key material anywhere in the
  register family and the reader refuses one.

WHAT IS NOT CLAIMED. A read-time refusal of an origin key presented for a
review act is NOT in force: the pinned reader still indexes every wallet record
in a scanned tree into one context (openXwallet dependency, tasks 5.1/5.2,
OQ3). Origin revocation at the moment of clearing is NOT in force: no
projection path exists (OQ1), so the declared bound is the honest ceiling on
propagation and a 90-day unconditional expiry is the mechanism that actually
works.

Co-Authored-By: Claude Fable 5 <[email protected]>
Copilot AI lite review requested due to automatic review settings September 3, 2026 03:37

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @brettheap! 👋

Your private repo does not have access to Sourcery.

Please upgrade to continue using Sourcery ✨

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The validator’s “cannot run” paths currently exit with status 1 via string SystemExit (contradicting the documented exit-code contract that reserves 2 for inability to run).

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR realizes the factory-origin-identity capability by adding a new sibling governance register family under governance/factory-identity/, a validator (scripts/validate-factory-identity.py) that enforces register closure + disjointness vs governance/review-authority/, and wiring the validator into the required wallet-validation gate with a positive log conjunction (plus tests and an operator mint runbook).

Changes:

  • Add the governance/factory-identity/ register family (register, wallet, grant, custody attestation) plus the operator mint runbook.
  • Introduce scripts/validate-factory-identity.py and a comprehensive test suite that covers both positives and every refusal path.
  • Extend the required wallet-validation workflow to run the new validator and assert it actually read/adjudicated the sibling register.
File summaries
File Description
tests/factory_identity/test_validator.py Adds end-to-end and synthetic-tree tests for the factory-identity validator (positives + refusals + derive helper).
tests/factory_identity/test_gate_wiring.py Pins that the validator runs inside the required wallet-validation job and that the assertion step is positive (not vacuous).
scripts/validate-factory-identity.py Implements register closure, placeholder refusal, secret-name/key-material refusal, custody-tier cap, and disjointness vs review-authority; includes --derive helper.
README.md Documents the new mint runbook and that the required gate now reads the sibling factory-identity register (including non-claim of read-time refusal).
governance/factory-identity/register.yaml Adds the kindless sibling register with bound/ceiling and the first origin row.
governance/factory-identity/README.md Adds a top-level explanation of the sibling register family and its constraints.
governance/factory-identity/wallets/wal-origin-codexfactory-0001.yaml Adds the first origin wallet record (currently with FILL-IN-AT-MINT sentinels).
governance/factory-identity/grants/grant-origin-codexfactory-0001.yaml Adds the first origin grant record (scope, tier, expiry semantics).
governance/factory-identity/attestations/custody-attest-wal-origin-codexfactory-0001.yaml Adds the (currently incomplete) custody attestation template used to lift the unattested authority cap.
docs/factory-origin-key-mint-runbook.md Adds the operator ceremony/runbook for minting, deriving public values, provisioning the CI secret, and recording the mint.
.github/workflows/openxwallet-consumer-gate.yml Wires the new validator into the required check and asserts the “register-read conjunction” positively.
Review details

Suppressed comments (2)

scripts/validate-factory-identity.py:214

  • When spec_from_file_location fails (spec or loader is None), the code raises SystemExit with a string, which again exits with status 1. Per the script's own EXIT CODES section, loader/usage failures should be exit code 2.
    if spec is None or spec.loader is None:  # pragma: no cover
        raise SystemExit(f"validate-factory-identity: cannot load {path}")

scripts/validate-factory-identity.py:224

  • If the pinned reader is present but missing required symbols, this currently raises SystemExit with a string message (exit status 1). This is also a "reader could not run" condition per the script's documented exit codes, so it should exit with status 2 to distinguish it from actual validation findings (status 1).
        if not hasattr(module, name):
            raise SystemExit(
                f"validate-factory-identity: the pinned reader at {path} has no "
                f"{name!r}; the pin predates the derivation path this reader "
                f"reuses, and inventing a local one is refused")
  • Files reviewed: 11/11 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.

Comment on lines +205 to +210
if not path.is_file():
raise SystemExit(
f"validate-factory-identity: the pinned openXwallet reader is not "
f"at {path}. Run `git submodule update --init openXwallet`. This "
f"program REFUSES rather than deriving keys with arithmetic of its "
f"own: one derivation, one place.")
brettheap and others added 3 commits September 3, 2026 10:10
…ecklist

`docs/factory-origin-key-mint-runbook.md` asked the operator to hand-write
nine values across four files in two repositories, two of which have to match
CHARACTER FOR CHARACTER. Four of five sentinels replaced is a register naming a
key reference nobody can resolve — discovered after the seed is already
provisioned and unrecoverable, because the private half has no backup by
design. `scripts/mint-factory-origin-key.py` makes the five writes ONE act, so
that state is unreachable.

IT DERIVES NOTHING. `did`, `key_fingerprint` and `public_key_multibase` come
from CALLING `validate-factory-identity.py`'s own `derive` entry point
in-process — which itself refuses unless the PINNED openXwallet decoders are
importable and round-trips every value through them before printing. So the
encodings written into the register are, by construction, the encodings the
REQUIRED `wallet-validation` check judges them by.
`test_the_derive_path_is_the_validators_own` compares the in-process values
against the runbook's own `--derive` subprocess, character for character.

THE PRIVATE HALF REACHES ONE DESTINATION. The 32-byte seed is written to
`gh secret set --body -` on the child's STDIN — never argv (world-readable in
/proc), never an environment variable, never a temp file — then overwritten and
deleted. The program's command log records argv and the LENGTH of anything
written to a child's stdin, never its bytes. The end-to-end test inspects every
argv and every printed line and requires the seed in none of them, while
confirming it DID reach the store: an absence check alone would pass on a run
that never stored the key.

FAIL-CLOSED, IN ORDER, AND EVERY REFUSAL NAMED. Eight read-only preflight
checks run before anything is spent; `register-already-minted` and
`secret-already-exists` are the two independent guards on ONE ORIGIN IDENTITY
PER REPOSITORY, and they are also the idempotence story. Custody precedes the
register edit, so a failed store leaves the family untouched. All four gates run
before either commit, the register reader must also emit `0 shared` (a green run
that adjudicated nothing is a vacuous pass), and any failure leaves the tree
MODIFIED AND UNCOMMITTED because the remediation for a bad fill is the diff. It
readies both pull requests and does NOT merge — it prints the two merge commands,
because `governance/factory-identity/` is a permanently human-only surface.

AND THE MINT WOULD HAVE TURNED THE REQUIRED SUITE RED.
`test_the_shipped_tree_refuses_until_the_key_is_minted` asserted
`returncode == 1` unconditionally, and `test_no_plausible_key_literal_was_
invented` asserted that no `did:key` or `sha256:` literal sits under the
family — both true only BEFORE the mint, despite the first one's docstring
claiming it was 'the thing that goes green'. The runbook's step 5 ('all four
must be clean') was therefore unsatisfiable. Both are now state-aware: five
sentinels standing and the reader refusing, or none standing and the reader
clean, with anything in between failing as a HALF-COMPLETED MINT — and the
post-mint half asserts the inverse (exactly one did:key literal, exactly one
fingerprint appearing exactly twice) rather than lapsing into a claim a tree
that lost its register would also satisfy.

33 new tests, 77 in tests/factory_identity. The runbook's steps collapse to the
one command and its manual checklist is retained verbatim as an appendix for the
day the program cannot run.

Co-Authored-By: Claude Fable 5 <[email protected]>
MEASURED, not anticipated. With `scripts/mint-factory-origin-key.py` run against
the REAL family on the real tree, the three non-pytest gates went clean —
`verify-openxwallet-pin.py`, the PINNED validator, and the register reader with
0 errors and `0 shared` — and TEN tests in `test_mint_script.py` failed. The
fixture copies the shipped family to get the real file shapes, the real comment
bodies the targeted fill must not disturb, and the real wallet/grant/row joins,
so it also inherited the family's STATE: after the mint there are no sentinels
and the expiry pair is re-stamped, and every preflight and fill test was then
asserting against an already-minted tree.

That is the same defect `test_validator.py` carried, reintroduced one file
over: a suite that can only be green before the act it exists to make possible.
Step 5 of the runbook says all four gates must be clean, and the fourth is this
suite.

`unmint()` normalizes the copied family back to the freshly-drafted state — the
five sentinels restored and the two expiries re-drafted to 2026-09-02 /
2026-12-01, against which every test passes `--today 2026-09-03` so the
re-stamp branch is exercised deterministically. What stays real is everything
the tests actually exercise. Verified in BOTH states: 77 passed with the family
unminted, and 77 passed with it filled by the program.

Co-Authored-By: Claude Fable 5 <[email protected]>
…cter secret

`gh secret set --help` (2.86.0): '-b, --body string   The value for the
secret (READS FROM STANDARD INPUT IF NOT SPECIFIED)'. The flag takes no magic
dash. `--body -` is a body whose value is one hyphen, so `gh` exits 0 having
stored the one-character secret '-' — and this program would have printed a
successful mint, filled the register with the public half of a key whose
private half reached no destination, run four green gates over it, and readied
both pull requests. The failure would have surfaced far away, at the first
signature, for a reason nobody would connect back to the mint. The stdin path
is reached by OMITTING the flag, which is `gh`'s own documented example
(`gh secret set MYSECRET < myfile.txt`).

AND BECAUSE THAT CLASS OF FAILURE IS SILENT, THE STORE IS NOW CONFIRMED. A
secret's value can never be read back, so the only available evidence is that
the NAME appears where preflight proved it did not. The program re-lists after
storing and refuses `secret-set-unconfirmed` rather than editing the register
— which closes the general case, not only the dash: any `gh` that exits 0
having stored nothing now stops the run before a public half is published.
`test_a_store_that_exits_zero_but_stored_nothing_refuses` drives it, and the
FakeRunner now MODELS the store (a successful set appends to its secret list)
so the confirmation has something real to be wrong about. It also asserts
`--body` is absent from the invocation, so the dash cannot come back.

The runbook says all of this in prose, because its APPENDIX asks an operator to
perform the same step by hand.

SEPARATELY: tests/factory_identity/__init__.py, which repairs a collection
abort that predates this work. `tests/factory_identity/test_gate_wiring.py`
(added by 7647c96) collides by BASENAME with the pre-existing
`tests/signed_execution_chain/test_gate_wiring.py`, and under pytest's default
prepend import mode both contend for one flat `sys.modules` entry. Measured at
this branch's base: the REQUIRED `pytest-suite` invocation
(`pytest tests/ -q -m 'not postgres'`) collected 8761 of 9099 and INTERRUPTED
with one collection error, while `pytest tests/factory_identity -q` was green —
so a per-directory run cannot see this class of defect, and #610's required
check was red for a reason unrelated to the register. Making the directory a
package gives its modules `factory_identity.`-prefixed names; that is the
pattern `tests/sequenced_after/`, `tests/avatar_client_validator/` and
`tests/hermes_runtime_contracts/` already use for the same reason. Collection
now reports 8803/9141 with no error.

Co-Authored-By: Claude Fable 5 <[email protected]>
Copilot AI review requested due to automatic review settings September 3, 2026 14:33
…me, not the program's

The record template asked for `Ruled by: <name>, in session <date> — '<the
recorded word>'`, and the first cut of this program filled both from
constants: 'Brett Heap' and 'mint the codexFactory origin key'. Both are
fabrications in a governed record.

THE QUOTATION. A program that invents a sentence and attributes it to a named
person, inside a `Status: record` document, is fabricating evidence of a ruling
however innocuous the sentence reads — and this record is the thing a later
reader consults to learn what was decided. `--ruling` carries the operator's
own word; its DEFAULT says plainly that none was recorded and points at the
pull request thread, which is true and checkable rather than plausible.

THE NAME. It is now READ from the custody attestation's `verified_by.name`,
which is where the register already declares the responsible operator under the
Human Escalation Contract. A second spelling in this program would be two
places for one fact to disagree, and the day they diverged the record would
attribute the ruling to whoever the program's author had in mind rather than to
whoever attested the custody. An attestation naming nobody now refuses
`operator-unnamed` at preflight instead of yielding a record signed by a
literal.

The success banner also tells the operator to READ THE RECORD BEFORE MERGING and
echoes the ruling it used, because the obligation and not-discharged sections
are prose no program can judge for him.

80 tests in tests/factory_identity.

Co-Authored-By: Claude Fable 5 <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The validator and mint scripts currently have concrete correctness issues (exit-code contract mismatches, misleading disjointness note wording, and a ceiling-check bypass on malformed timestamps) that should be fixed before relying on them in the required gate and operator ceremony.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (1)

scripts/validate-factory-identity.py:209

  • load_pinned_reader() raises SystemExit(<string>) for missing/invalid pinned reader, which exits with status 1 (not 2). This contradicts the script’s documented exit codes (2 = cannot run) and the mint script/tests that rely on an exit-2 refusal when the gitlink/pin is absent or invalid.
    if not path.is_file():
        raise SystemExit(
            f"validate-factory-identity: the pinned openXwallet reader is not "
            f"at {path}. Run `git submodule update --init openXwallet`. This "
            f"program REFUSES rather than deriving keys with arithmetic of its "
  • Files reviewed: 14/14 changed files
  • Comments generated: 4
  • Review effort level: Lite

Comment on lines +217 to +224
path = root / VALIDATOR_REL
if not path.is_file():
raise SystemExit(f"mint-factory-origin-key: no register reader at {path}; "
f"this program derives nothing of its own and cannot "
f"proceed without it")
spec = importlib.util.spec_from_file_location("_mint_fi_validator", path)
if spec is None or spec.loader is None: # pragma: no cover - importlib shape
raise SystemExit(f"mint-factory-origin-key: cannot load {path}")
Comment on lines +620 to +630
issued = _parse_dt(grant.get("issued_at"))
expires = _parse_dt(grant.get("expires_at"))
if issued is not None and expires is not None:
days = (expires - issued).total_seconds() / 86400
if days > MAX_GRANT_DAYS:
f.error("factory-identity-expiry-window",
f"{label}: grant {grant_ref!r} runs {days:.0f} days, past "
f"the {MAX_GRANT_DAYS}-day ceiling this realization adopts. "
f"No projection path can revoke an origin row at clearing "
f"(design D9, OQ1 open), so a short unconditional expiry is "
f"the only propagation mechanism that works today")
Comment on lines +703 to +706
f.note(f"factory-identity: disjointness holds against "
f"{'/'.join(REVIEW_DIR_PARTS)}/ "
f"({len(ours)} identifier(s) here, {len(theirs)} identifier(s) there, "
f"{len(shared)} shared)")
Comment on lines +1238 to +1254
finally:
seed = b"\x00" * 32
del seed
public_b64u = base64.urlsafe_b64encode(public_raw).decode("ascii").rstrip("=")
values = derive_public_values(validator, plan.pinned, public_b64u)
print(" seed generated; the public half is derived and round-tripped "
"through the PINNED decoders")

try:
instant = store_private_half(runner, seed_hex)
finally:
seed_hex = "0" * 64
del seed_hex
print(f" {SECRET_NAME} stored in {TARGET_REPO} / {ENVIRONMENT} at "
f"{instant}")
print(" the seed is overwritten and deleted; it was never printed, "
"logged, or written to disk")
Copilot AI review requested due to automatic review settings September 3, 2026 14:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The factory-identity validator’s “pinned reader missing/bad pin” paths exit with status 1 instead of the documented status 2, and the mint script lacks a named refusal for missing cryptography (currently would traceback), both of which need correcting before approval.

Review details

Suppressed comments (4)

Previously missed (1) — in code that hasn't changed since the last review.

scripts/mint-factory-origin-key.py:1291

  • run_mint() imports cryptography inside the mint path, but does not handle ImportError. If cryptography is missing on the operator host, the script will crash with a traceback (after generating a seed) instead of producing a named refusal and exiting with code 2 (“could not run at all”). Catch ImportError and raise a Refusal with a clear remediation.

scripts/validate-factory-identity.py:210

  • load_pinned_reader() raises SystemExit(<message>) when the openXwallet gitlink is absent, which exits with status code 1. The module docstring documents exit code 2 for “could not run at all (… no pinned reader …)”, so this path should print the message to stderr and exit 2 to match the documented contract (and to distinguish a runtime failure from validation findings).
    if not path.is_file():
        raise SystemExit(
            f"validate-factory-identity: the pinned openXwallet reader is not "
            f"at {path}. Run `git submodule update --init openXwallet`. This "
            f"program REFUSES rather than deriving keys with arithmetic of its "
            f"own: one derivation, one place.")

scripts/validate-factory-identity.py:215

  • When spec_from_file_location() cannot produce a loader, load_pinned_reader() currently raises SystemExit(<message>), which exits with status code 1. This should be treated as “the reader could not run at all” and should therefore exit 2 (per this script’s documented exit codes).
    spec = importlib.util.spec_from_file_location(
        "_pinned_openxwallet_reader", path)
    if spec is None or spec.loader is None:  # pragma: no cover
        raise SystemExit(f"validate-factory-identity: cannot load {path}")
    module = importlib.util.module_from_spec(spec)

scripts/validate-factory-identity.py:225

  • If the pinned reader is present but missing required symbols, load_pinned_reader() raises SystemExit(<message>) (exit code 1). This is another “could not run at all / bad pin” condition and should exit 2 to match the documented exit codes and keep exit code 1 reserved for actual validation findings.
    for name in ("decode_public_key_multibase", "fingerprint_of_public_key",
                 "_decode_public_key", "_fingerprint_of",
                 "PUBLIC_KEY_B64U_LEN"):
        if not hasattr(module, name):
            raise SystemExit(
                f"validate-factory-identity: the pinned reader at {path} has no "
                f"{name!r}; the pin predates the derivation path this reader "
                f"reuses, and inventing a local one is refused")
    return module
  • Files reviewed: 14/14 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

…:59Z

The operator minted the ONE Ed25519 origin identity of opensoft/codexFactory
and provisioned its private half at 2026-09-03T19:34:59Z. The five
FILL-IN-AT-MINT sentinels are replaced by the public values the
register reader's own derive path produced through the PINNED
openXwallet decoders; nothing here was computed by a second
implementation.

The private half exists only as an encrypted environment secret in
opensoft/codexFactory's own hosted worker-credentials environment. It entered no
git working tree, no log and no argv.

The grant is re-stamped to issued_at 2026-09-03T00:00:00Z and
expires_at 2026-12-02T00:00:00Z because the mint happened after the
drafted issuance date; the backing row's expires_at is
character-for-character equal, which the reader compares.

All four gates ran clean against this tree before this commit: the
openXwallet pin, the PINNED validator as wallet-validation runs it,
the factory-identity register reader (0 errors, 0 shared), and
tests/factory_identity.
Copilot AI review requested due to automatic review settings September 3, 2026 19:35
@brettheap
brettheap marked this pull request as ready for review September 3, 2026 19:35

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @brettheap! 👋

Your private repo does not have access to Sourcery.

Please upgrade to continue using Sourcery ✨

…ity-register

catch-up to main after the 2026-09-03 mint; README index reconciled

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

There are correctness/operational issues in the validator’s “completed attestation” determination and mint-script dependency handling, plus a documented state mismatch that needs reconciliation.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (3)

Previously missed (2) — in code that hasn't changed since the last review.

scripts/mint-factory-origin-key.py:1288

  • If cryptography is not installed, the mint path will currently raise ImportError and crash with a traceback. This is a “cannot run at all” condition (exit 2 per the header) and should fail with a clear, single-line error so operators don’t misdiagnose a partial run.
    .github/workflows/openxwallet-consumer-gate.yml:213
  • The workflow comment says the gate pins counts “LITERAL, NOT [0-9]+”, but the very next grep pattern still uses [0-9]+ for the “(N row(s))” note. Either the comment should be narrowed to the counts that are actually literal, or the grep should be tightened to a literal value so the comment matches reality.

README.md:663

  • This README section states the operator “has not minted” the origin key and that the public values are still the FILL-IN-AT-MINT sentinel, but the current governance/factory-identity/ artifacts in this PR already contain concrete did/public_key_multibase/key_fingerprint values and a non-sentinel verified_at. Please reconcile the README (and PR title/description) with the actual tree state so readers don’t get a false red/green expectation about the required gate.
  and origin-signature verification becomes a THIRD verification class, conjunctive
  with the provider resolution (a verifying signature over contradicted provenance
  refuses; confirmed provenance with no verifying signature refuses) and reported as
  its own dispatch-record outcome rather than folded into the provider-verified set,
  while the POLICY-CHECKED fields — class constraints, worker profile, permitted
  • Files reviewed: 14/14 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment on lines +642 to +650
def _attestation_for(attestations: dict[str, dict], wallet_ref: str) -> bool:
for doc in attestations.values():
if doc.get("subject_wallet_ref") != wallet_ref:
continue
values = [value for _, value in _walk_strings(doc)]
if any(SENTINEL in value for value in values):
return False
return True
return False
Copilot AI review requested due to automatic review settings September 3, 2026 19:41
@brettheap
brettheap merged commit ea117d4 into main Sep 3, 2026
4 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

It contains concrete inconsistencies with the stated “unminted placeholder” state (and a validator exit-code contract issue), which should be corrected before this can be considered landable.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (2)

scripts/validate-factory-identity.py:210

  • load_pinned_reader() raises SystemExit(<message>) when the pinned openXwallet reader is absent, which exits with status 1 (string exit code) rather than the documented/expected status 2 for “could not run at all”. This makes the CLI exit-code contract ambiguous for callers and for scripts distinguishing findings (1) vs usage/runtime refusal (2).
        raise SystemExit(
            f"validate-factory-identity: the pinned openXwallet reader is not "
            f"at {path}. Run `git submodule update --init openXwallet`. This "
            f"program REFUSES rather than deriving keys with arithmetic of its "
            f"own: one derivation, one place.")

governance/factory-identity/attestations/custody-attest-wal-origin-codexfactory-0001.yaml:37

  • This attestation’s header says verified_at must remain FILL-IN-AT-MINT until the operator mints and provisions the key. The file currently has a concrete RFC3339 instant, which contradicts that intent and prevents the validator’s placeholder / “tier-unattested” behavior from reflecting the unminted state.
verified_at: "2026-09-03T19:34:59Z"
  • Files reviewed: 14/14 changed files
  • Comments generated: 3
  • Review effort level: Lite

# the register's. Present so this row attests A KEY rather than a wallet id: a
# rotation that changes the key without a fresh attestation must not inherit the
# old one's cap lift.
attested_key_fingerprint: sha256:d88db98a5b77c1b7acb71551a91f21854571c1e163a444e91d37569b0062c0df
Comment on lines +66 to +69
did: "did:key:z6MksXruCCtyYyfUsYiemkSrjK9qAiarBsnYoMjGVNnNxbbu"
key_id: key-factory-codexfactory-0001
key_fingerprint: sha256:d88db98a5b77c1b7acb71551a91f21854571c1e163a444e91d37569b0062c0df
public_key_multibase: z6MksXruCCtyYyfUsYiemkSrjK9qAiarBsnYoMjGVNnNxbbu
Comment on lines +1280 to +1291
seed = secrets.token_bytes(32)
try:
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives.asymmetric.ed25519 import (
Ed25519PrivateKey)
public_raw = Ed25519PrivateKey.from_private_bytes(seed).public_key(
).public_bytes(encoding=serialization.Encoding.Raw,
format=serialization.PublicFormat.Raw)
seed_hex = seed.hex()
finally:
seed = b"\x00" * 32
del seed
Copilot AI review requested due to automatic review settings September 3, 2026 19:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

There are concrete contract inconsistencies (documented exit code vs actual exit status) and multiple narrative/state mismatches (PR description vs README/registry artifacts, plus minted artifacts still labeled “NOT YET” in-file) that should be reconciled before approval.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (4)

scripts/validate-factory-identity.py:210

  • load_pinned_reader() documents that a missing/unloadable pinned reader is a “could not run” condition (exit code 2), but it currently raises SystemExit(<message>), which results in process exit status 1. This makes the exit codes inconsistent with the module’s documented contract and with callers/tests that distinguish refusal (1) from “cannot run” (2).
    if not path.is_file():
        raise SystemExit(
            f"validate-factory-identity: the pinned openXwallet reader is not "
            f"at {path}. Run `git submodule update --init openXwallet`. This "
            f"program REFUSES rather than deriving keys with arithmetic of its "
            f"own: one derivation, one place.")

scripts/mint-factory-origin-key.py:1285

  • If cryptography is not installed, the mint currently raises an uncaught ImportError (traceback) after generating a seed, which violates the script’s documented exit-code contract (“could not run” = 2) and produces a noisy/less-actionable failure mode for operators. Handle the import explicitly and exit 2 with a clear message.
    seed = secrets.token_bytes(32)
    try:
        from cryptography.hazmat.primitives import serialization
        from cryptography.hazmat.primitives.asymmetric.ed25519 import (
            Ed25519PrivateKey)
        public_raw = Ed25519PrivateKey.from_private_bytes(seed).public_key(

governance/factory-identity/wallets/wal-origin-codexfactory-0001.yaml:40

  • This wallet record still states it is “NOT YET MINTED” and that the key fields carry FILL-IN-AT-MINT, but the same file now contains minted did / public_key_multibase / key_fingerprint values. This makes the governed record internally inconsistent and could mislead operators/reviewers about whether the key is live.
# NOT YET MINTED — AND THE PLACEHOLDER IS THE POINT. `did`,
# `public_key_multibase` and `key_fingerprint` carry the literal sentinel
# `FILL-IN-AT-MINT`. No plausible 43-character base64url literal was invented to
# make a scanner or a reader happy: a value that LOOKS like a key is worse than
# no value, because it merges. All three sentinels are refused twice over —

governance/factory-identity/attestations/custody-attest-wal-origin-codexfactory-0001.yaml:22

  • This attestation file still says it is “NOT YET ATTESTABLE” and that the key fields carry FILL-IN-AT-MINT, but the file now contains a concrete verified_at timestamp and a non-sentinel attested_key_fingerprint. Please update the header comment to reflect the attestation’s minted/completed state so the file doesn’t contradict itself.
# NOT YET ATTESTABLE, AND SAYING SO IS THE WHOLE VALUE OF THIS FILE. What an
# attestation asserts is that the DECLARED custody model MATCHES REALITY. No key
# exists yet, so there is no reality to match: `verified_at` and
# `attested_key_fingerprint` carry the literal sentinel `FILL-IN-AT-MINT` and
# `scripts/validate-factory-identity.py` refuses the tree while they stand. An
  • Files reviewed: 14/14 changed files
  • Comments generated: 2
  • Review effort level: Lite

Comment thread README.md
Comment on lines +708 to +723
**REALIZATION COMPLETE AT THIS PR.** The sibling register family
`governance/factory-identity/` — register, wallet, grant and custody
attestation for the first originating repository `opensoft/codexFactory` —
plus the disjointness validator `scripts/validate-factory-identity.py`, the
operator mint program `scripts/mint-factory-origin-key.py`, their 80 tests,
its wiring into the REQUIRED `wallet-validation` check with a positive log
conjunction, and the mint runbook
`docs/factory-origin-key-mint-runbook.md`. **The operator minted the
codexFactory origin key at 2026-09-03T19:34:59Z** via
`scripts/mint-factory-origin-key.py`: the private half exists only as the
`FACTORY_ORIGIN_SIGNING_KEY` secret in codexFactory's `worker-credentials`
environment, the register at `governance/factory-identity/` is filled with
the derived public values, and the mint record is recorded in
codexFactory's `hermes/domain/factory-identity/records/`. The realization
for `opensoft/codexFactory` is therefore COMPLETE at this PR, and further
factories are added by the same runbook.
Comment on lines +139 to +144
# UNTIL THE MINT, THIS ROW CONFERS NOTHING. The wallet it points at declares
# `FILL-IN-AT-MINT` where its public half belongs, and both
# `scripts/validate-factory-identity.py` and the PINNED openXwallet reader
# REFUSE the tree while that sentinel stands. That refusal is the point: the
# register cannot merge holding a placeholder, and no plausible-looking key
# was invented to make it green.
@brettheap

Copy link
Copy Markdown
Contributor Author

(lane repo-shape, 2026-09-03T20:13Z) — pytest-suite is red on main since this merge, and it reproduces identically on every PR that runs against main now.

Observed on lane repo-shape's #616 (run 33798470102, head a981c98, which touches none of these paths) and on this PR's own run 33798107640: 6 failed, 8935 passed, all six in tests/factory_identity/test_mint_script.py — ModuleNotFoundError: No module named 'cryptography' at scripts/mint-factory-origin-key.py:1282. The dependency is absent from the --require-hashes lock the suite installs. Reporting, not fixing: this is your lane's object. Until it lands, pytest-suite cannot be green for anyone.

@brettheap

Copy link
Copy Markdown
Contributor Author

Lane: openxfactory-1d (cross-lane notice)

This PR's landing turned main's pytest-suite RED — run 33798223792 at ea117d4e: six tests/factory_identity/test_mint_script.py tests fail on ModuleNotFoundError: No module named 'cryptography' (scripts/mint-factory-origin-key.py:1282); the pytest-suite job installs only requirements/hermes-runtime-contracts.lock, which lacks it. Filed as #620 with the remedy (add a pinned, hashed cryptography to that lock, as doc-health already does). Every open PR now inherits the six failures. Please identify your lane on #620 (rule 5) and take the fix, or say so if you cannot.

brettheap added a commit that referenced this pull request Sep 3, 2026
#624)

contract-v3.1 was cut by #616 (squash 19d0087) and its annotated tag pushed
there. It does not verify at its own commit. verify-tag --tag contract-v3.1 and
verify-commit --commit 19d0087 both report:

  HGR-RELEASE-DIGEST-MISMATCH error path=requirements/hermes-runtime-contracts.in: digest does not match the raw Git blob at the pinned commit
  HGR-RELEASE-DIGEST-MISMATCH error path=requirements/hermes-runtime-contracts.lock: digest does not match the raw Git blob at the pinned commit

MEASURED CAUSE. The v3.1 inventory was built last at #616's head a981c98 and
verified there. The branch forked at 0bf37d1 and three first-parent landings
reached main before the squash: ea117d4 (#610), 4fc7b94 (#566) and 995c0ad,
the merge of 11db75e (#621, "The mint script's Ed25519 dependency is declared
where the suite installs it"). Intersecting the eighteen paths of `git diff --name-only
a981c98 19d0087` with the 283 registered members of contract-v3.1.digests.yaml
leaves exactly two, both #621's: requirements/hermes-runtime-contracts.in and
.lock. The lane published the tag without re-running verify-commit at the merge
commit — Bundle Realization Order step 4, skipped. That was lane repo-shape's
error, in the cutting session itself.

REMEDY, per docs/contract-versioning-policy.md § Immutable Tag Correction: the
published tag is never moved, deleted or re-tagged. The defect is corrected by a
superseding release allocated through the same realization order. contract-v3.1's
tag and inventory remain in place as immutable provenance, its number is never
reused, and nothing is declared spent — v3.1 was PUBLISHED, so it is DEFECTIVE
rather than a number that could never be published. Ruled by Brett Heap,
convener, 2026-09-03: "cut 3.2".

CLASS: ADDITIVE (minor). `git diff --name-status contract-v3.1 HEAD` at the
branch point is empty — the tag peels to origin/main's tip — so this bundle is
v3.1's realized surface with the two requirements files as they now stand. The
only registered movement is #621's cryptography==50.0.0 declaration and its lock
closure: a build dependency added, no required field, no shape removed, no
semantics changed. No consumer pinned at contract-v3.1 is made non-conformant.

One candidate commit, per Bundle Realization Order step 2: manifest, changelog,
the release-boundary hand statement and the rebuilt inventory move together.
Membership is 283 rows in both inventories, unchanged; five digests move —
this cut's own three release-surface files plus the two requirements files.
No new capability is realized beyond what contract-v3.1 named.
contracts/releases/contract-v3.1.digests.yaml is byte-identical.

Lane: repo-shape

Claude-Session: https://claude.ai/code/session_015WekBEXf55Xv64psGe5t3T

Co-authored-by: Claude Fable 5.1 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants