Repository navigation
Resolve a packet reference by identity, and give the resolver its named consumer - #1037
Conversation
Slice 5 of add-declared-former-id branches from the slice-1/2 prep tip 2a9cfbd, which predates origin/main dd07374 (#1036, #1033, #888). The merge keeps the branch's diff against main honest and touches no file this slice owns. Lane: openxfactory-1 Co-Authored-By: Claude Fable 5.1 <[email protected]>
… ambiguous `scripts/packet_reference.py`, and `tests/packet_reference/` as its lane. Realizes `add-declared-former-id` §§ 5.1, 5.1a, 5.2 and 5.2a — the ADDED requirement *A packet reference resolves by identity, not by path* — whole, except for its consumer, which is the next commit. THE DEFECT, MEASURED ON THIS TREE AND NOT ASSUMED. Every packet relocates exactly once, `openspec/changes/<id>/` to `openspec/changes/archive/<YYYY-MM-DD>-<id>/`, and every record citing it by path goes stale at that moment by an act nobody thinks of as breaking anything. `scripts/validate-pin-registrations.py`'s `check_citations` resolves the RAW PATH and refuses exit 1 on an absent one (landed for issue #840, after PR #834 renamed a change directory and left two live citations naming the old id while every run still exited 0). Re-measured here today: its 17 in-tree referents include SIX pointing into FOUR ACTIVE packets — `prepare-openspec-1-12-readiness` (x2), `add-chain-attestation`, `disposition-codexfactory-floor-relocation-retitle` and `disposition-codexfactory-regular-pr-council-clearance-archive` (x2). The next of those four to archive turns a lawful act into an exit-1 refusal of a gate nobody touched. WHAT RESOLVES, AND WHAT IS REPORTED. * `RESOLVED` — the id stands in exactly one place (active, a dated archive directory, or a packet declaring it in `former_ids:`) AND that packet carries the cited file. Scenarios *A cited path names a packet that has since archived* and *A cited path names an id a packet declares as a former id*. * `DANGLING`, half `identity` — the id stands nowhere. Scenario *A cited path resolves to no identity at all*; the one outcome of the four that is a defect of the citing record. * `DANGLING`, half `file` — the id stands and the packet does not carry the remainder. BOTH HALVES RESOLVE AND THE FAILURE SAYS WHICH HALF FAILED; reported against the FILE and never against the packet. Scenario *The identity resolves and the cited file does not*, with § 5.1a's two fixtures: a live id with a deleted remainder, and an archived id whose remainder moved inside the packet. * `AMBIGUOUS` — the id would stand in more than one place, never settled by preferring a candidate. Scenario *An id resolves to more than one packet*, with both of its THENs: two dated archive directories, and a live directory beside somebody's declared former id. The second is asked twice with the file present in the first-sorted candidate and then only in the last, so a resolver that silently picked one could not pass by symmetry. * `NOT_A_PACKET_REFERENCE` — a fifth answer that is not an outcome. A path addressing no packet is handed back and the caller's own path resolution is left where it is. `openspec/changes/README.md` is this corpus's own case and a resolver reading it as a change id would report the README dangling. Scenario *A reference names another repository's packet* (§ 5.2) is realized as a STRUCTURAL INCAPACITY rather than a behaviour: the module holds no repository vocabulary and no module-level root, resolves against the root it is handed, and answers the same reference differently against two roots — so it cannot be the reader that says a packet is somebody else's, and the `qualified` classification stays exactly where § 5.2 leaves it, in `read_citation`. READ FROM `proposal-support.py`, NOT RESPELLED: `CHANGE_ID_RE`, `change_id_of`, `ARCHIVE_DATE_PREFIX`, `declared_former_ids_of`, `FormerIdError`, `FORMER_IDS_KEY`. What is built here is the WORKING-TREE LOCATION INDEX, and the module states why it is built rather than reused: `identity_paths_at` resolves the same two-candidate rule AT A REVISION for the archive gate and RAISES on ambiguity, where a citation is resolved IN THE WORKING TREE and ambiguity is a third OUTCOME a reporting reader must return rather than raise. `former_identity_claimants` answers who OWNS an identity, as prose for a finding, where this answers where a packet STANDS, as a path. `test_the_index_claims_at_least_what_the_corpus_ownership_sweep_claims` pins the two in step over a fixture AND over the live corpus, and states the one difference: the sweep deliberately does not read an archived directory's own id, and resolution needs it. MEASURED. 18 tests. Against the parent commit `2a9cfbda`+merge: 1 collection error, 0 collected — `scripts/packet_reference.py` does not exist there. After: 18 passed in 1.81s. Non-vacuity proved by mutation rather than asserted — four mutations of the landed module, each red in the tests that name it: ambiguity settled by sort order (2 failed), declared claims dropped (4 failed), the file half never checked (2 failed), archived claims dropped (8 failed). `tests/pin_registrations` and `tests/proposal-support` unchanged at 232 passed, 290 subtests. Fixtures are built in `tmp_path` on `tests/pin_registrations/`'s stated precedent, with ONE corpus sweep over the 47 active and 167 archived packets this repository really carries, asserting each resolves to exactly itself and not one of them is ambiguous. WHAT THIS COMMIT DELIBERATELY DOES NOT DO. No consumer — the resolver is a reader with no caller until the next commit, which is the shape `design.md` D11(2) named and § 5.0 exists to refuse. No `doc-health` delta and no twenty-fourth check family (`design.md` D4, RULED (a)). No reporting sweep for the unresolvable remainder: that is § 6.1's successor and is not filed here. No edit to `scripts/proposal-support.py`, which a sibling slice holds, and no edit to any `openspec/changes/` file. No corrected spelling is offered for any reference, because "correcting a record is not the remedy this requirement imposes" and offering one is how a reader becomes an editor. Refs #1003. Lane: openxfactory-1 Co-Authored-By: Claude Fable 5.1 <[email protected]>
…s reading raw paths `add-declared-former-id` § 5.0, whole: "Without this task the resolver would be a reader with no caller." `scripts/validate-pin-registrations.py`'s `check_citations` now resolves every `tree-path` referent BY IDENTITY through `scripts/packet_reference.py`, and the four active packets its citations point into can archive without turning a lawful act into an exit-1 refusal. THE DEFECT THIS REPAIRS, MEASURED ON THIS TREE AND NOT ASSUMED. The arm was landed for issue #840 (PR #834 renamed a change directory; two live citations went on naming the old id; every run still exited 0) and it resolved the RAW PATH — which is exactly what the archive relocation moves. Re-measured here: 17 in-tree referents, of which SIX point into FOUR ACTIVE packets — `prepare-openspec-1-12-readiness` (x2), `add-chain-attestation`, `disposition-codexfactory-floor-relocation-retitle`, and `disposition-codexfactory-regular-pr-council-clearance-archive` (x2). The next of those four to archive would have reded a gate nobody touched. WHAT THE ARM DOES NOW, AND WHAT IT DELIBERATELY STILL DOES. * A referent that ADDRESSES A PACKET resolves by its id — the location that id occupies now, active or archived, or any packet declaring it in `former_ids:`. Realizes scenarios *A cited path names a packet that has since archived* and *A cited path names an id a packet declares as a former id* at the caller. * BOTH HALVES, AND THE FINDING SAYS WHICH FAILED. An id that stands nowhere is the IDENTITY half and is a defect of the citing record (issue #840's own refusal, still exit 1, now saying more than "no such path"); an id that stands in a packet not carrying the remainder is the FILE half, reported against the file. Scenarios *A cited path resolves to no identity at all* and *The identity resolves and the cited file does not*. * AN ID THAT RESOLVES TWICE IS REFUSED AS AMBIGUOUS, with the repair named against the DECLARATION that made one identity resolve twice and never against the citing record — which, where a reference resolves, owes no edit at all. Scenario *An id resolves to more than one packet*. * THE CROSS-REPOSITORY CASE IS LEFT EXACTLY WHERE § 5.2 LEAVES IT. `qualified` referents (12 of the 36 today) are classified by `read_citation` and the resolver is NEVER ASKED — asserted with a spy, not inferred from an exit code, because a resolver consulted about a foreign path would report it dangling. * A REFERENT THAT ADDRESSES NO PACKET KEEPS THE PATH RESOLUTION IT ALWAYS HAD. `openspec/changes/README.md` is this corpus's own case; reading its second segment as a change id would report the README dangling. Guarded by a test that is green on BOTH sides of this commit. ONE NEW PRINTED LINE, AND NOT ONE FIGURE OF THE COUNTS LINE MOVED. `relocated` is reported only when it happened, so today's run is byte-identical — every in-tree citation is still spelled where it stands — and the line appears the day the first of the four packets archives. `read_citation`, the alignment proof, the WARN arms, the counts and the containment refusal are untouched. MEASURED. `tests/pin_registrations` 62 -> 70, `tests/packet_reference` 18; 88 passed together. Against the parent commit `6b39004f`: 7 failed / 63 passed. Non-vacuity proved by mutation: reverting the arm to raw-path resolution reds 5 of them. `python3 scripts/validate-pin-registrations.py .` exit 0, counts line unchanged word for word: "6 disposition(s) carry 40 citation(s) naming 36 referent(s) — 17 name a path in this tree, 0 a URL, 7 a forge reference, 12 a path qualified to another repository; 4 citation(s) name no machine referent; 18 line(s) the two readers read differently (11 truncated at a `#`, 7 read as a single-key mapping), classified from the line; every in-tree path resolves". `tests/proposal-support` unchanged at 170 passed / 290 subtests. AND § 5.4's POPULATION, RE-MEASURED THROUGH THE RESOLVER ON THIS TREE: over every tracked file except `openspec/changes/archive/`, `tests/` and `specs/`, 104 distinct `openspec/changes/<id>/…` references resolve to nothing by path; 64 of them RESOLVE BY IDENTITY through this resolver; 40 remain, which the resolver separates further than the measuring recipe could — 34 whose identity stands nowhere and 6 whose packet stands without the cited file. AMBIGUOUS: 0, corpus-wide. (Caveat carried from the plan: the population is a RE-IMPLEMENTATION of `design.md` M4's recipe — M4's authoring script was never committed — so the delta against M4's 94/58/36 at `9378eca5` is approximately, not exactly, comparable.) ONE EXISTING TEST MOVED WITH THE TEXT IT ASSERTS, and it is named rather than buried: `test_a_citation_naming_a_path_that_is_gone_is_reported` pinned the substring "but no such path is in this tree" for a referent that addresses a packet, and that finding now says the packet id resolves to nothing and which half failed. Exit 1, the citation named, the row's OK line withheld and the footnote sentence are all as they were. An assertion moved with its subject, not an assertion loosened to keep a suite green. WHAT THIS COMMIT DELIBERATELY DOES NOT DO. No `doc-health` delta and no twenty-fourth check family (`design.md` D4, RULED (a)). No reporting sweep for the 40 that do not resolve — § 6.1's successor, filed by nobody here. No edit to `scripts/proposal-support.py`, held by a sibling slice, and none to any `openspec/changes/` file, so Rule 6's landing window does not apply. No correction offered for any citation: correcting a record is not the remedy this requirement imposes. Refs #1003. Lane: openxfactory-1 Co-Authored-By: Claude Fable 5.1 <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved critical and moderate findings remain in packet indexing and former-ID resolution.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds identity-based packet reference resolution, integrates it into citation validation, and extends former-ID origin-retention handling.
Changes:
- Adds the packet resolver and comprehensive scenario tests.
- Updates pin registration validation for archived and former identities.
- Extends proposal-support logic and tests for former IDs and rename chains.
File summaries
| File | Summary and final findings |
|---|---|
tests/proposal-support/test_proposal_support.py |
Adds former-ID and origin-retention coverage. |
tests/pin_registrations/test_pin_registration_sweep.py |
Adds citation resolver integration coverage. |
tests/packet_reference/test_packet_reference.py |
Adds packet resolver scenario coverage. |
scripts/validate-pin-registrations.py |
Integrates identity-based citation resolution. |
scripts/proposal-support.py |
Moderate (3 votes, line 554): Date-prefixed active IDs are parsed incorrectly. Moderate (1 vote, line 730): Filter invalid active directories. Moderate (2 votes, line 614): Reject reserved archive former IDs. Moderate (1 vote, line 733): Filter non-dated archive directories. Nit (1 vote, line 1453): Update stale origin-retention documentation. Moderate (1 vote, line 1203): Correct historical resolution of date-prefixed archive IDs. |
scripts/packet_reference.py |
Critical (1 vote, line 334): Prevent symlinked packet directories from resolving outside the root. Nit (1 vote, line 397): Distinguish archive-location ambiguity from declaration ambiguity. |
Review details
Suppressed comments (5)
scripts/packet_reference.py:398
- The report always says an ambiguous identity's defect belongs to a declaration, but the two-archive-directory ambiguity has no
former_ids:declaration at all. In that case this message sends the operator to repair a declaration that does not exist, instead of identifying the duplicate archive locations as the corpus defect; distinguish archive-location collisions from declaration collisions (or use neutral wording).
"to the declaration that made one identity resolve twice and not "
"to the citing record, which owes no edit")
scripts/proposal-support.py:731
- This sweep claims every directory directly under
openspec/changesas a live packet, whilePacketIndexandactive_change_dironly accept names matchingCHANGE_ID_RE. A non-packet directory with an invalid id (for example_fixtures) would therefore create a false ownership claim and make the sweep disagree with the resolver. Apply the same id filter used byPacketIndexhere.
live = [d for d in sorted(changes.iterdir())
if d.is_dir() and d.name != "archive"]
scripts/proposal-support.py:734
- The archived side has the same mismatch: this sweep reads every directory under
archive/, whilePacketIndexonly treats directories with the archive-date prefix as packets. A recovery/backup directory such asarchive/not-datedcan therefore claim former ids in the ownership sweep even though the resolver ignores it. Apply the sameARCHIVE_DATE_PREFIX.match(d.name)filter here.
archived = ([d for d in sorted(archived_root.iterdir()) if d.is_dir()]
if archived_root.is_dir() else [])
scripts/proposal-support.py:1457
- This paragraph still documents the pre-change one-path walk, but
ratifying_baselinenow unions the current and declared former identities and resolves a path at each revision; the following paragraph also says the read is always the active path. Leaving this stale contract in the public function docstring will mislead callers about which history and proposal file are examined. Update both descriptions to match the identity-based walk.
A line-by-line walk over the commits that touched that ONE path, oldest
first, reading each blob — not `git log -S`, which would match the string
inside a fenced example and inside a `- Status: ratified` bullet alike, and
not `git log -G`, which has the same problem. The walk is bounded by the
number of commits that touched a single file (a handful, for a change
scripts/proposal-support.py:1205
- Bug: the historical resolver repeats the same ambiguity independently:
_ARCHIVE_DIR_REreadsarchive/2026-08-04-add-aas identityadd-a, while the archive wrapper stores the date-prefixed ID unchanged. For a packet with ID2026-08-04-add-a,identity_paths_atwill not find its archive path, so origin-retention can miss the true ratification and fall back to a wrongnot ratified/later baseline. Reuse the corrected archive-identity resolution here rather than matchinggroup('id')unconditionally.
name = row.rstrip("/").rsplit("/", 1)[-1]
match = _ARCHIVE_DIR_RE.match(name)
if match is None or match.group("id") != identity:
- Files reviewed: 6/6 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Copilot review, PR #1037, `scripts/packet_reference.py:336`: the archive directory scan uses `is_dir()`, which follows symlinks, so a symlinked archive packet pointing outside `root` was indexed and read through the link while `check_citations` containment-checks only the CITED SPELLING — a path that never itself crosses the link, since the link sits at the ARCHIVE LOCATION the identity resolves TO, a path this module's own directory scan builds and the citing record never typed. THE DEFECT, MEASURED ON THIS TREE BEFORE THIS COMMIT AND NOT ASSUMED. A fixture archive directory `2026-09-10-add-a-linked-one` symlinked to a directory outside `root`, carrying its own `.openspec.yaml` and a `proposal.md` reading "outside content, not part of the checkout": before this commit, `PacketIndex(root).identities()` included `add-a-linked-one`, `Claim.carries("proposal.md")` answered `True`, and `resolve(root, "openspec/changes/add-a-linked-one/proposal.md")` reported RESOLVED — and reading the corpus's own spelling of the resolved path (`root / resolution.resolved_rel`) returned the outside bytes verbatim. After: the directory contributes no claim, `identities()` omits it, and the same citation resolves DANGLING at the IDENTITY half. THE CONTAINMENT RULE CHOSEN, AND WHY, NAMED PER THE REVIEW'S OWN ALTERNATIVES. `resolve_in_tree` in `scripts/validate-pin-registrations.py` — which this module's own docstring already credits with "a reference that walks out of the tree is the caller's containment question and never this reader's" — resolves fully (`.resolve()`, following every symlink) and checks `is_relative_to(root)`; it does NOT refuse a symlink that stays inside the tree. `_contained`/`_contained_dir` mirror that idiom exactly rather than the blanket `is_dir(follow_symlinks=False)` alternative, which would also exclude a symlink that never leaves `root` and has no reason to. THE DISPOSITION CHOSEN IS SKIP, NOT REFUSE: a directory that fails containment CONTRIBUTES NO CLAIM, the same posture `PacketIndex._build` already holds for a malformed `former_ids:` declaration — "a resolver that raised here would turn one packet's malformed declaration into a refusal of every citation in the corpus" — true in the same words of one hostile symlink, and this module's ratified requirement has no CANNOT-RUN outcome for `resolve` to raise into; DANGLING at the identity half is the existing, correct answer for an id nothing legitimately claims. EVERY OTHER `is_dir()`/`exists()`/`iterdir()` ON A WORKING-TREE PATH IN THIS MODULE IS HARDENED THE SAME WAY, GREPPED RATHER THAN GUESSED, in one commit: * `PacketIndex._build`'s `changes.is_dir()` guard and its `live`/`archived` directory-scan comprehensions (the archive one is line 336; the LIVE one beside it follows the identical shape and gets an identical fixture, `test_a_symlinked_live_packet_pointing_outside_root_is_not_indexed`). * The `.openspec.yaml` marker check inside `_build`: a REAL, contained packet directory whose marker file is itself a symlink escaping `root` no longer has its `former_ids:` read. * `Claim.carries`, now taking `root` (its one call site, in `resolve`, already has it): a remainder joined onto an already-contained `self.path` can still name a symlink escaping `root` from inside an otherwise sound packet, and is refused the same way — reported DANGLING at the FILE half, the packet's own identity having resolved soundly. * `resolve`'s own `not candidates` fallback (`Path(root) / claimed`, formerly a bare `.exists()`): a claimed path free of `.`/`..` can still name a symlink segment, and is no longer read as "present" through one. MEASURED. `tests/packet_reference tests/pin_registrations`: 88 passed on `34473ecd` before this commit; the four new tests fail against that same tree (asserted directly, by running them against `34473ecd`'s own `packet_reference.py`); 92 passed after. `tests/proposal-support` untouched, 170 passed / 290 subtests, unchanged from before this commit — this commit edits no file that suite exercises. `python3 scripts/validate-pin-registrations.py .` exits 0, counts line unchanged word for word: "6 disposition(s) carry 40 citation(s) naming 36 referent(s) — 17 name a path in this tree, 0 a URL, 7 a forge reference, 12 a path qualified to another repository; 4 citation(s) name no machine referent; … every in-tree path resolves" — the live corpus carries no symlinked packet, so this fix moves no figure on it. `python3 -m pyflakes scripts/packet_reference.py` exits 0. `python3 scripts/doc-health.py --single-repo .` exits 0, no ERROR-severity finding. WHAT THIS COMMIT DELIBERATELY DOES NOT DO. No edit to `scripts/proposal-support.py`, held by the sibling PR #1038 fixing two other threads on this same review. No new `Resolution` status and no new printed finding channel: `PacketIndex` is a library with no findings list, and the ratified requirement's outcome space (RESOLVED / DANGLING / AMBIGUOUS / NOT_A_PACKET_REFERENCE) already has a correct answer for a claim that must not stand. No change to any `openspec/changes/` file, so Rule 6's landing window does not apply. Refs #1003. Lane: openxfactory-1 Co-Authored-By: Claude Fable 5.1 <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved critical and moderate findings remain in proposal-support.py and packet_reference.py.
Get a fresh assessment by requesting another Copilot review.
Review details
Suppressed comments (5)
scripts/packet_reference.py:474
- The generic ambiguity report always says the defect belongs to the declaration that created the duplicate, but
test_an_id_resolving_twice_is_ambiguous_and_never_preferredalso covers two dated archive directories, where noformer_idsdeclaration caused the collision. That message misdirects the repair and provides no archive-duplicate guidance; distinguish declared-identity conflicts from duplicate active/archive locations when constructing the report.
def _ambiguous_report(identity: str, candidates) -> str:
return (f"the packet id `{identity}` resolves to MORE THAN ONE packet — "
+ "; ".join(claim.why for claim in candidates)
+ " — so this reference is AMBIGUOUS and is NOT resolved by "
"preferring one candidate: a resolver that picked one would make "
"this record's meaning depend on sort order. The defect belongs "
"to the declaration that made one identity resolve twice and not "
"to the citing record, which owes no edit")
scripts/proposal-support.py:1293
- Unlike
PacketIndex._build, this working-tree scan followsarchiveand candidate packet symlinks without checking that their resolved directories and.openspec.yamlremain underroot. A checkout containing an archive symlink to an external directory can therefore feed outside data intodeclared_former_ids_of()and change the identities used by the origin-retention walk. Apply the same containment check used byPacketIndexbefore iterating or loading these paths.
if archive.is_dir():
candidates += [d for d in sorted(archive.iterdir())
if d.is_dir() and change_id_of(d) == change]
for directory in candidates:
if (directory / ".openspec.yaml").is_file():
return declared_former_ids_of(directory, change)
scripts/proposal-support.py:614
archivepassesCHANGE_ID_RE, but it is a reserved structural directory:active_change_dirrejects it andpacket_reference()explicitly refuses it as an identity. This lets a packet declare a former ID that can never resolve to a packet, contrary to the requirement that every declared former ID resolve to the packet that moved. Reject this sentinel as a separate former-ID shape error.
if not CHANGE_ID_RE.fullmatch(entry):
scripts/proposal-support.py:554
- This strips a date prefix from every directory name, including active IDs and archived IDs that already begin with
YYYY-MM-DD-. The pinned CLI intentionally archives such an ID unchanged (archive_directory_name()andnames_this_change()document this ambiguity), so a valid ID such as2026-08-04-add-ais loaded asadd-a; the resolver can then miss the packet or attach declarations to the wrong identity. Identity extraction needs archive context and the pre-run active-ID disambiguation instead of a global substitution.
return _ARCHIVE_DATE_RE.sub("", directory.name)
scripts/proposal-support.py:1448
- The new wrapper documentation says
ratifying_baselineresolves the packet across declared identities, but the remaining docstring immediately describes a one-path, active-only walk and says archived packets are read through the active path. That no longer matches the implementation, which unions current/former identities and resolves each identity at each ref; leaving the old contract in place will mislead callers and future changes about archive and former-id behavior. Update the retained walk description to match the new baseline algorithm.
A THIN WRAPPER SINCE `add-declared-former-id`: the resolution itself is
`ratifying_baseline`, which returns the identity and the path beside the
commit because the declaration at that commit is read under the identity
the packet was RATIFIED under, not under the one it carries now. This
function keeps its name and its one return value for the callers that only
- Files reviewed: 6/6 changed files
- Comments generated: 2
- Review effort level: Lite
Fix round 1 on PR #1038, taking Codex P2 `PRRT_kwDOTAvnrs6iElb4` and Copilot `PRRT_kwDOTAvnrs6iEmbV` / `PRRT_kwDOTAvnrs6iEmbp` — and Copilot `PRRT_kwDOTAvnrs6iEemp` on the stacked PR #1037, which reads the same lines because slices 1–2 are this branch's. THE RULE WAS ALREADY WRITTEN DOWN IN THIS FILE, and the identity readers took only half of it. `archive_directory_name` states the pinned CLI's own behaviour, copied from `@fission-ai/[email protected]` rather than approximated: a change whose id ALREADY carries a `YYYY-MM-DD-` prefix is archived under that id UNCHANGED, because "re-prefixing would stutter the name, and when the archive runs on a later day the folder would sort under a day on which the change did not happen". `names_this_change` then says what follows: a directory called `2026-08-04-foo` is the wrong-day archive of `foo` AND the archive of a change whose id IS `2026-08-04-foo`, and "the two readings are indistinguishable from the name". Neither reader admitted the second reading, and one of them applied the strip where there is no ambiguity at all. MEASURED against this branch's head `5859f053`: change_id_of(openspec/changes/2026-08-04-add-dated) -> 'add-dated' identity_paths_at(root, HEAD, '2026-09-09-foo') -> [] (with openspec/changes/archive/2026-09-09-foo/proposal.md standing) proposal_path_at(root, HEAD, '2026-09-09-foo') -> None declared_former_ids_in_tree(root, '2026-09-10-bar') -> [] (with that archived packet declaring former_ids: [old-bar]) The first renames a live packet: `CHANGE_ID_RE` admits a leading date, `active_change_dir` resolves such an id verbatim, and the corpus's own pinned- CLI fixture is `2026-08-04-add-dated`. `former_identity_claimants` passes every LIVE directory through `change_id_of`, so that packet's `former_ids:` was validated and attributed as `add-dated`'s — the "an entry may not name the packet's OWN id" arm asked about a packet that does not exist, and missed the self-claim that was written. The second and third are worse, because their answer is a SILENCE the walk acts on: an identity reported ABSENT at every commit it occupies, and a declaring packet handed the UNDECLARED answer — the shed-lineage failure this mechanism exists to stop, arriving through the reader rather than through a move. WHAT CHANGED. * `change_id_of` — strips only for a directory UNDER `archive/`. An active directory's name IS its id. The archived half's residual ambiguity is stated rather than pretended away, and the docstring names the two helpers that do settle it. * `_archive_dir_carries` — the archive-row test, both readings: the exact identity name first, then the dated interpretation. Admitting both is what the requirement asks for — the identity resolution "SHALL NOT infer an identity from rename detection, from similarity between two packets, or from any walk over a lineage", and a directory name is none of those. * `identity_paths_at` — uses it, so a preserved date-prefixed id resolves to the directory it occupies. Where ONE identity matches TWO directories that way, `proposal_path_at` refuses `origin-retention-identity-ambiguous` naming both, which is the ratified scenario *A declared identity resolves to two locations at one commit* — reachable for a dated id only now that the exact reading exists. * `_change_ids_of_proposal_path` (was `_change_id_of_proposal_path`) — a LIST, the directory's own name first. `_refuse_an_undeclared_move` tests the DECLARED lineage against all of them, so a lawful move out of a preserved dated archive id is recognised instead of taking the undeclared refusal; `_first_change_id_of_proposal_path` serves the callers that want one string. * `declared_former_ids_in_tree` — chooses its archived candidate with `names_this_change`, the reading this file already settled for the archive wrapper, which also takes the ACTIVE ids into account the way that helper's own docstring requires. * `former_identity_claimants` — one residue named rather than left to be discovered: its ARCHIVED half still reads the commoner interpretation, so a packet archived under a preserved dated id that declares its OWN id would escape the self-claim arm. The estate has no change of that shape today, the live half is now exact, and settling the archived half needs the active-ids reading a sweep over departed packets cannot take. Four tests, all four failing against `5859f053` on behaviour rather than on a missing symbol: test_an_active_id_that_begins_with_a_date_keeps_it AssertionError: 'add-dated' != '2026-08-04-add-dated' test_a_preserved_date_prefixed_archive_id_resolves_to_its_directory AssertionError: Lists differ: [] != ['openspec/changes/archive/…'] test_an_archived_packet_under_a_preserved_dated_id_declares_lineage AssertionError: Lists differ: [] != ['old-bar'] test_an_identity_matching_two_archive_directories_still_refuses AssertionError: 1 != 2 tests/proposal-support: 179 passed before, 183 after, 290 subtests either way. `proposal-support.py . verify` -> `proposal support verification ok`, exit 0. Refs #1003. Lane: openxfactory-1 Co-Authored-By: Claude Fable 5.1 <[email protected]>
Fix round 1 on PR #1038, taking Copilot `PRRT_kwDOTAvnrs6iEenD` — raised on the stacked PR #1037 because `former_id_problems` is slice 1's reader and reaches that review through this branch. The fix belongs here, where the reader lives. MEASURED against this branch's head `5859f053`: former_id_problems("x", {"former_ids": ["archive"]}) -> [] active_change_dir(root, "archive") -> SupportError identity_paths_at(root, HEAD, "archive") -> [] `archive` matches `CHANGE_ID_RE` like any other slug, so the grammar arm cannot refuse it and nothing else did. A packet could therefore publish `former_ids: [archive]`, and the declaration would be accepted, indexed by `former_identity_claimants`, and carried into `ratifying_baseline` as an identity to resolve — where every resolution answers silence, because `openspec/changes/archive/` is the archive ROOT and never a packet. A declared lineage that resolves to nothing is exactly the shape the reader exists to refuse: `declared_former_ids` raises rather than returning the entries it could read, precisely so the walk is never handed a lineage its author did not write. WHAT CHANGED. * `RESERVED_CHANGE_ID` — hoisted beside `CHANGE_ID_RE`, for the reason that pattern was hoisted: the declaration and the walk that consumes it cannot be allowed to disagree about what a change id is. `active_change_dir` now reads it instead of spelling the literal a second time. * `former_id_problems` — a seventh arm, refusing an entry that names it, saying why the grammar above cannot: it is a lawful slug and an unlawful identity. One test, failing against `5859f053` with `AssertionError: 0 != 1` — the entry accepted where a refusal is required: `test_an_entry_naming_the_reserved_archive_segment_refuses`. tests/proposal-support: 183 passed before, 184 after, 290 subtests either way. `proposal-support.py . verify` -> `proposal support verification ok`, exit 0. Refs #1003. Lane: openxfactory-1 Co-Authored-By: Claude Fable 5.1 <[email protected]>
Fix round 1 on PR #1038, taking Copilot `PRRT_kwDOTAvnrs6iGr_N` and `PRRT_kwDOTAvnrs6iGr_s` — raised on the stacked PR #1037 against `scripts/proposal-support.py`, which is this branch's slice 1–2 work, so the fix belongs here. Both land on the two readers that hand `ratifying_baseline` its lineage. (1) A SYMLINK IS `active_change_dir`'S TRAVERSAL REACHED FROM THE TREE. That function already refuses a change NAME with path syntax in it — "anything with path syntax would let a caller-supplied name traverse outside openspec/changes/" — and a committed symlink is the same traversal arriving through a pull request instead of through a caller. Git tracks one as an ordinary object (mode `120000`), and `is_dir()`/`iterdir()` both follow it silently. MEASURED with `openspec/changes/archive` committed as a symlink to a directory outside the checkout: git ls-files -s -> 120000 … openspec/changes/archive former_identity_claimants -> claims 'stolen-identity', attributed to `openspec/changes/archive/2026-09-09-forged` declared_former_ids_in_tree(root, '2026-09-09-forged') -> ['stolen-identity'] An `.openspec.yaml` nobody in this repository wrote, read as this corpus's lineage and carried to the archive gate. `contained_dir` now guards the `changes` root, the `archive` root and every candidate child in both readers. It RESOLVES before it compares, so a link chain cannot walk out in more than one hop, and it resolves `root` too so a checkout reached through a symlinked parent is not refused as foreign. It answers a BOOLEAN and not the resolved path, deliberately: `change_id_of` reads a packet's identity off the path that was WALKED (it asks whether the parent is `archive/`), and handing it a resolved spelling would rename a packet reached through an in-repository link. The live corpus tracks ZERO symlinks anywhere — `git ls-files -s | grep ^120000` is empty — so this refuses nothing that stands today. It is the surface being closed, not a finding being repaired. (2) TWO PLACES FOR ONE ID IS AN AMBIGUITY TO REPORT, IN THE WORKING TREE TOO. `declared_former_ids_in_tree` returned the FIRST candidate holding a packet. Where an identity stands both actively and in the archive, the two `.openspec.yaml` files may declare different lineages, so the lineage the walk resolved was chosen by this reader's ordering rather than by an author — which is the line `proposal_path_at` already draws one layer down, and the ground `archived_change_dirs` gives for returning a LIST. MEASURED before the change: with `openspec/changes/change-x/` declaring `[from-the-active-copy]` and `openspec/changes/archive/2026-09-09-change-x/` declaring `[from-the-archived-copy]`, it returned `['from-the-active-copy']` silently. `ratifying_baseline` happened to refuse afterwards, because both locations also stand at the commit it visits first — but that is the COMMITTED tree agreeing with the working one, which a reader of the WORKING tree may not assume. It now refuses `origin-retention-identity-ambiguous`, CANNOT RUN, naming both locations and the usual cause (an archived packet whose active directory was left standing). One location is still an answer, not a refusal. Neither refusal fires on the corpus: 47 active ids, 167 archived directories, no active id matching an archive directory under `names_this_change`, and no id matched by two archive directories. Two tests, both failing against `30d40c1c`: `test_a_symlinked_archive_cannot_import_an_identity_from_outside` (`AssertionError: 'stolen-identity' unexpectedly found in …`) and `test_an_identity_holding_a_packet_in_two_places_refuses_the_lineage` (`AssertionError: OriginRetentionError not raised`). The first also asserts that the packets this repository DOES contain are still swept, so the guard is containment and not a switched-off sweep. tests/proposal-support: 184 passed before, 186 after, 290 subtests either way. tests/pin_registrations + openspec_cli_pin + sequenced_after + carve_manifest + notebooklm: 751 passed, 3 skipped. `proposal-support.py . verify` exit 0; `validate-pin-registrations.py .` exit 0; `doc-health.py --single-repo .` byte-identical to the pre-fix-round run. Refs #1003. Lane: openxfactory-1 Co-Authored-By: Claude Fable 5.1 <[email protected]>
…-reference-resolver Lane: openxfactory-1 Co-Authored-By: Claude Fable 5.1 <[email protected]>
…tation call sites main 701c8fd (landed from PR #1038's fix round) narrowed change_id_of to strip the archive date prefix only where directory.parent.name is literally "archive" (RESERVED_CHANGE_ID) — fixing the defect Copilot raised against both PR #1038 and this PR (#1037): the old, unconditional strip mis-read an ACTIVE directory whose own id merely looks dated (this corpus's own `2026-08-04-add-dated`), stripping a slice of its real id. Both of this file's own call sites, and this suite's own corpus-sweep helper, called change_id_of on a bare leaf name read out of a citation string — Path(parts[3]) here, Path(n) in the test — with no real parent at all. Under the new contract that bare Path answers "not archived" and change_id_of hands the dated spelling back unchanged, so a citation to the archive's old date (or the test's own reconstruction of one) no longer matches the claim PacketIndex._build recorded under the stripped id, and two references that used to resolve now dangle: * test_an_archived_spelling_resolves_by_id_when_the_archive_date_moves * test_every_packet_in_this_corpus_resolves_to_exactly_itself Both call sites now prefix the leaf with the segment the citation was already read from (ARCHIVE_SEGMENT / "archive"), matching the contract PacketIndex._build already satisfies by passing a real directory whose parent truly is named archive. Both listed tests pass again; the full suite (tests/packet_reference tests/pin_registrations tests/proposal-support) is 291 passed, 290 subtests passed. Lane: openxfactory-1 Co-Authored-By: Claude Fable 5.1 <[email protected]>
There was a problem hiding this comment.
Sorry @brettheap, you've used your own review budget of 250,000 diff characters for the last 7 days.
You can request another review in 3 days and 4 hours by commenting @sourcery-ai review. Upgrade to get a review now.
|
Lane: openxfactory-1 (openXfactory-1) Please review this now-current slice 5 (merge |
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved critical and moderate findings remain.
Get a fresh assessment by requesting another Copilot review.
Review details
Suppressed comments (4)
scripts/packet_reference.py:434
- This call also uses
change_id_of's stripped reading implicitly. Forarchive/2026-09-09-foo, the default identity isfoo, so aformer_ids: [2026-09-09-foo]self-claim is accepted here and indexed as a former-identity claim even though the repository's ownership sweep checks both archive identities and rejects that self-claim. Read the archive's candidate identities and apply the same self-claim/malformed-declaration handling before adding declarations.
declared = support.declared_former_ids_of(directory)
scripts/packet_reference.py:484
_ambiguous_reportalways says the collision belongs to a declaration, but the resolver also reports ambiguity for two dated archive directories, where neither candidate may have aformer_ids:declaration. That message misattributes the repair to a declaration that may not exist; make the attribution conditional on a declared claim or use wording that covers duplicate packet locations as well, while retaining that the citing record owes no edit.
"this record's meaning depend on sort order. The defect belongs "
"to the declaration that made one identity resolve twice and not "
"to the citing record, which owes no edit")
scripts/validate-pin-registrations.py:929
- This informational line is emitted as
OKeven when another citation in the same row has already setok = False. The checker has an established convention thatOKis used only when the row is actually okay (seescripts/validate-pin-registrations.py:1020-1026); otherwise a failing run can contain anOK <row_id>line that misleads readers and log consumers. Use the row'sokstate for this label, as the later summary already does.
print(f"OK {row_id}: {relocated} in-tree citation(s) resolve BY "
tests/packet_reference/test_packet_reference.py:124
- This helper coerces every
former_idsargument withlist(...), so the scalar passed bytest_a_malformed_former_ids_declaration_is_left_to_its_own_readeris written as a list of characters rather than as the scalar declaration its docstring describes. That means the new test never covers the non-sequence shape (and its current failure could be caused by duplicate/invalid character entries instead). Preserve non-list values here, or construct that fixture with an explicit rawpacket_yaml, so the claimed malformed-declaration boundary is actually tested.
document[support.FORMER_IDS_KEY] = list(former_ids)
- Files reviewed: 4/4 changed files
- Comments generated: 1
- Review effort level: Lite
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fbc18db19e
ℹ️ 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".
…-claim check about both too Copilot (PRRT_kwDOTAvnrs6iSjPt) and Codex P2 (PRRT_kwDOTAvnrs6iSmuD) independently found the same gap once the merge landed main's fixed change_id_of: an archived directory whose own id begins with a date is indistinguishably the archived stripped id AND the archived literal one (archive_directory_name preserves an already-dated id unchanged), and PacketIndex._build's archived loop indexed only change_id_of(directory) — the stripped reading alone. A citation to the packet's own literal, dated id (openspec/changes/2026-08-04-add-dated/...) reported IDENTITY- DANGLING although that exact proposal stands in the archived directory. Copilot's comment named a second half: the declared-former-ids loop's self-claim check defaults to the same stripped reading, so a former_ids entry equal to the packet's own LITERAL id was not refused. Both loops now use packet_identities_of (proposal-support.py's already- landed plural sibling of change_id_of, proven at former_identity_ claimants) instead of the singular change_id_of: * The archived-registration loop indexes every identity packet_identities_of returns, so the literal reading resolves too -- MINUS the one case _archive_dir_carries already rules out: the literal reading yields to a genuinely live packet of that exact name (a change that is live has not been archived, so an archive directory spelled exactly like a live id cannot be that live packet's own archive). Mirrors the working-tree precedent declared_former_ids_in_tree already established for this same guard; the stripped reading carries no such guard, on the same precedent's own history of the opposite bug. * The declared-former-ids loop passes identities[0] (the directory's own literal name) to declared_former_ids_of explicitly instead of relying on its default (the stripped reading alone), and adds the any(identity in declared for identity in identities) check former_identity_ claimants already uses -- so a self-claim under EITHER reading withholds the whole packet's declaration, not only the one entry. Three new tests pin this against the specific gap each reviewer named, plus the guard: test_a_dated_id_archived_packet_resolves_under_its_ literal_id and test_an_archived_self_claim_under_either_reading_ suppresses_its_declaration each fail against the pre-fix code (measured by reverting scripts/packet_reference.py alone and re-running just these three); test_the_literal_archived_reading_yields_to_a_live_packet_of_ that_name necessarily passes either way, since the pre-fix code never added the literal reading for the guard to suppress -- it pins the guard against a future regression rather than against this bug, and is named here rather than left to look load-bearing when it is not. Full suite: 294 passed, 290 subtests passed (was 291/290 before these three). pyflakes clean on both files. validate-pin-registrations.py and doc-health.py --single-repo . unchanged (doc-health: 31 critical, 10 error, 28 warning, 24 info, 0 new regressions). Lane: openxfactory-1 Co-Authored-By: Claude Fable 5.1 <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved critical and moderate findings remain.
Get a fresh assessment by requesting another Copilot review.
Review details
Suppressed comments (4)
Previously missed (1) — in code that hasn't changed since the last review.
scripts/validate-pin-registrations.py:929
- When one citation relocates successfully but another citation in the same row is dangling or ambiguous,
okis already false, yet this prints anOKstatus before the laterMEASUREDsummary. That contradicts the checker’s row-status convention and can make a failing pin look green to readers or output consumers; use a non-OK prefix wheneverokis false.
scripts/packet_reference.py:521
- For the two-archive case, neither candidate is a
former_ids:declaration, but this suffix still tells the reader to repair “the declaration.” Name duplicate archive locations as a corpus/relocation collision, while retaining declaration guidance for former-id collisions.
"to the declaration that made one identity resolve twice and not "
"to the citing record, which owes no edit")
tests/packet_reference/test_packet_reference.py:825
- These corpus-size floors make the anti-vacuity test fail during the normal archive lifecycle this PR is meant to support: with the stated 47 active packets, eight otherwise-valid archives reduce
livebelow 40 while the resolver can still be completely correct. Pin a stable invariant (or a non-vacuous condition that does not require a minimum number of active packets) instead of coupling correctness to how many packets remain active.
live = sorted(d.name for d in changes.iterdir()
if d.is_dir() and d.name != "archive")
archived = sorted(d.name for d in (changes / "archive").iterdir()
if d.is_dir())
assert len(live) >= 40 and len(archived) >= 150, (len(live), len(archived))
tests/pin_registrations/test_pin_registration_sweep.py:2168
- This anti-vacuity assertion only requires four packet references, not the four packets this test says the live pin cites. All six citations could be retargeted to other packets and the count would still pass, so the guarantee would no longer cover the archive moves described above. Assert that the named packet identities are a subset of
packet_referents.
assert len(packet_referents) >= 4, packet_referents
- Files reviewed: 4/4 changed files
- Comments generated: 2
- Review effort level: Lite
…n's citations to raw paths Two more Copilot findings on the second push (PRRT_kwDOTAvnrs6iTGJQ, PRRT_kwDOTAvnrs6iTGJw), both taken: * `PacketIndex._build`'s declared-former-ids loop caught only `FormerIdError` around `declared_former_ids_of`. `load_packet` catches `yaml.YAMLError` around its own read but not a bad encoding, and `marker.is_file()` only proves the path is a regular file at that instant -- so a packet whose `.openspec.yaml` is not valid UTF-8 (or goes unreadable between the two calls) raised `UnicodeDecodeError` or `OSError` past this module's own stated "malformed declaration contributes no claim" contract and aborted the whole index build, crashing pin validation for every OTHER citation in the corpus too. Caught alongside `FormerIdError` now, on the same "no claim, no crash" footing as any other malformed declaration. `test_a_marker_that_cannot_be_read_at_all_contributes_no_claim_either` reproduces the exact `UnicodeDecodeError` traceback against the pre-fix except clause and passes after. * `tests/pin_registrations/test_pin_registration_sweep.py`'s `test_the_live_pin_carries_citations_and_every_in_tree_path_resolves` still asserted raw `.exists()` for every in-tree citation, unmoved since before this slice's own resolver-aware sibling (`test_the_live_pin_registration_citations_still_resolve`) was added beside it -- so it would have reported a failure the moment any of the four actively-cited packets archives, on the exact lawful act this PR exists to stop breaking. Swapped for `packet_reference.resolve(...).ok`, keeping its own qualifier and non-empty-citation assertions. Full suite: 295 passed, 290 subtests passed (was 294/290). pyflakes clean on all three touched files. validate-pin-registrations.py and doc-health.py --single-repo . unchanged (31 critical, 10 error, 28 warning, 24 info, 0 new regressions). Lane: openxfactory-1 Co-Authored-By: Claude Fable 5.1 <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
Two moderate findings and one nit remain unresolved.
Get a fresh assessment by requesting another Copilot review.
Review details
Suppressed comments (1)
scripts/validate-pin-registrations.py:932
- When one citation relocates successfully but another citation in the same row fails, this unconditional
OKline makes the failed row look green before the finalMEASUREDsummary.check_rowalready documents the invariant thatOKis only used for a successful row (lines 1020-1027); use the row'sokvalue for this status as well.
print(f"OK {row_id}: {relocated} in-tree citation(s) resolve BY "
f"IDENTITY to a packet that no longer stands where the citation "
f"spells it — the archive relocation, or a declared rename. A "
f"reference that resolves owes the citing record no edit")
- Files reviewed: 4/4 changed files
- Comments generated: 2
- Review effort level: Lite
…ambiguity on a declaration Two more Copilot findings on the third push (PRRT_kwDOTAvnrs6iTWyS, PRRT_kwDOTAvnrs6iTWy0), both taken: * `packet_reference()` refused any `.`/`..` segment alike. `resolve_in_tree` (the consumer) refuses only `..` explicitly, and its `candidate.parts` is built by `pathlib`, which elides a bare `.` silently -- so a citation such as `openspec/changes/foo/./proposal.md` resolves at its raw path while `foo` is active, but this reader bailed out of identity resolution for it entirely. The day `foo` archives, the raw path is gone and nothing rescues that one citation by identity -- the exact defect this module exists to stop, reintroduced through the one segment nobody thought to spell unusually. `parts` now drops `.` segments (matching `pathlib`'s own elision) and only `..` is refused. `test_a_bare_dot_segment_is_dropped_and_not_refused` proves the dotted and plain spellings resolve identically and that `..` is still refused; it fails against the pre-fix code (measured). * `_ambiguous_report`'s closing sentence said the defect "belongs to the declaration that made one identity resolve twice" unconditionally -- but two dated archive directories for one id are a duplicate PACKET LOCATION with no `former_ids:` declaration involved at all, and the old wording sent an operator looking for a declaration that does not exist. Reworded to name both possible causes; each candidate's own `why` already says which applies to it. `test_a_duplicate_packet_location_is_ambiguous_with_no_declaration_at_all` pins the no-declaration case (fails against the pre-fix wording, measured); `test_an_ambiguous_referent_is_refused_against_the_declaration` in `tests/pin_registrations/` moved its pinned substring the same way `test_a_citation_naming_a_path_that_is_gone_is_reported` already moved with an earlier wording change, and `test_the_ambiguity_belongs_to_the_declaration_and_not_to_the_citing_record` needed no change (it asserts "declaration", which the new wording still contains). Full suite: 297 passed, 290 subtests passed (was 295/290). pyflakes clean on all three touched files. validate-pin-registrations.py and doc-health.py --single-repo . unchanged (31 critical, 10 error, 28 warning, 24 info, 0 new regressions). Lane: openxfactory-1 Co-Authored-By: Claude Fable 5.1 <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
Two moderate findings and one test-coverage nit remain unresolved.
Get a fresh assessment by requesting another Copilot review.
Review details
Suppressed comments (2)
Previously missed (1) — in code that hasn't changed since the last review.
tests/packet_reference/test_packet_reference.py:124
- This fixture does not serialize the scalar it claims to test:
_packet()converts every non-Noneformer_idsvalue withlist(), soformer_ids="add-an-old-id"becomes a list of characters. The test happens to remain malformed because-is invalid and several characters repeat, but it never exercises the scalar-shape refusal; preserve the supplied value here (the list fixtures remain lists) or construct this case with an explicit scalar YAML value.
scripts/packet_reference.py:360
- The archive parser strips
2026-09-01-and then rejects the resulting identity when it is the reserved wordarchive. However,CHANGE_ID_REandactive_change_dirallow the valid date-prefixed ID2026-09-01-archive, andPacketIndexindexes that literal identity forarchive/2026-09-01-archive. A citation to that archived packet is therefore treated asNOT_A_PACKET_REFERENCEand falls back to raw-path handling instead of resolving by identity (or reporting a file-half failure); use the literal directory identity when the stripped form is invalid/reserved and add this edge case to the tests.
if identity == ARCHIVE_SEGMENT or not support.CHANGE_ID_RE.fullmatch(identity):
return None
- Files reviewed: 4/4 changed files
- Comments generated: 1
- Review effort level: Lite
… handling Copilot (PRRT_kwDOTAvnrs6iTm2d), on the fourth push: the previous round taught packet_reference() to drop a bare `.` segment before computing an identity, but `Resolution.relocated` and `_resolved_report` compare the resolved path against `_normalised(claimed)`, which still only dropped EMPTY segments and never stripped surrounding whitespace either. A citation such as `openspec/changes/add-a-live-one/./tasks.md` against a packet that has never archived therefore resolved to precisely the path spelled, `.` aside, and still reported `relocated is True` with the archive/rename message claiming the path was "not the path the record spells" -- false. `_normalised` now applies the identical `.strip()` and `.` and empty-segment drop `packet_reference()` itself applies, so the two agree on what counts as the same spelling. Measured against the intermediate state this round starts from (packet_reference() already dot-dropping, _normalised not yet fixed): reproduces the exact false RELOCATED report, and passes after. Full suite: 298 passed, 290 subtests passed (was 297/290). pyflakes clean. validate-pin-registrations.py and doc-health.py --single-repo . unchanged (31 critical, 10 error, 28 warning, 24 info, 0 new regressions). Lane: openxfactory-1 Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
There was a problem hiding this comment.
🔵 Needs a closer look
Four moderate issues remain in output status reporting and test coverage for malformed and non-packet references.
Review details
Suppressed comments (4)
scripts/validate-pin-registrations.py:929
- This line is printed even when another citation in the same row has already set
ok = False, so a failing row can emitOK <row_id>before the finalMEASUREDline. That contradicts this checker’s existing “OK only where the row is OK” convention (see the guard at lines 1020–1026) and can make CI output look successful; use a non-success prefix for the failing-row case or condition the prefix onok.
print(f"OK {row_id}: {relocated} in-tree citation(s) resolve BY "
tests/packet_reference/test_packet_reference.py:620
_packetconverts every non-Noneformer_idsvalue withlist(former_ids), so passing this string writes a list of characters, not the scalar shown in the comment. This test therefore never exercises the scalar-shape branch it claims to cover; preserve the scalar in the fixture (or pass it throughpacket_yaml) so the resolver's malformed-declaration behavior is tested for the intended input.
former_ids="add-an-old-id") # a scalar, not a sequence
tests/pin_registrations/test_pin_registration_sweep.py:955
Resolution.okis deliberately true forNOT_A_PACKET_REFERENCE, so this replacement no longer verifies that the live pin's non-packet citations still exist. If adocs/...oropenspec/specs/...target disappears, this anti-vacuity test will still pass, unlike the old.exists()assertion. Keep the caller-owned path check for this status (for example, useresolve_in_tree()andtarget.exists()) before treating it as resolved.
unresolved = [referent for referent in in_tree
if not module.packet_reference.resolve(
REPO_ROOT, referent).ok]
assert not unresolved, f"citations that do not resolve: {unresolved}"
tests/pin_registrations/test_pin_registration_sweep.py:2186
- This second live-corpus assertion has the same false-positive gap:
NOT_A_PACKET_REFERENCEmakesresolution.oktrue without checking the raw path. Thus a missing non-packet citation can leaveunresolvedempty and still satisfy this test, even though the consumer must validate those paths itself. Preserve that path validation for this status rather than usingokas the whole assertion.
resolution = module.packet_reference.resolve(
REPO_ROOT, referent, index=index)
if not resolution.ok:
unresolved.append(resolution.report)
- Files reviewed: 4/4 changed files
- Comments generated: 0 new
- Review effort level: Lite
|
Lane: openxfactory-1 (openXfactory-1) FREEZE at head Unresolved review threads: 0 (12 total; the first 5 — Codex outcome (one review, 21:35:25Z, thread
TAKEN in Copilot outcomes this session (6 threads), verbatim summaries and dispositions:
A further Copilot re-review at 22:52:20Z on this final head found nothing new (0 additional threads) — convergence. Check rollup (six required):
Landing is the orchestrator's act on Brett Heap's word. |
|
Lane: openxfactory-1 (openXfactory-1) WORD 2026-09-15T19:00Z — Brett Heap, by multiple choice in lane openxfactory-1's window, verbatim option "Land both now" (the question: land #1037 and #1039, both FROZEN with all checks green and guard PASS, disjoint files). This is the landing word for this PR; landing follows now as an admin merge commit. In the same walkthrough he ruled Q4 "Yes, task 5.3 is authority", Q1 "Dedicated required check" (he performs the ruleset act), Q2 "Yes, with disposition + carry-forward issue" — recorded on #1003. |
|
Lane: openxfactory-1 (openXfactory-1) LANDING — lane openxfactory-1, session ea50c958-b384-4f43-b073-0540ec00231a@Eagle, 2026-09-15T19:02:22Z, PR #1037 into opensoft/openxFactory main Guard at 2026-09-15T19:02:25Z on head |
Carries PR #1037 (slice 5, the identity-based reference resolver, merge `8f393758`) and PR #1039 (slice 4, the landing validator and its gate workflow, merge `92d519b0`) into this branch, plus the unrelated `extend-prose-tagging-target-to-pinned-capabilities` work that landed beside them. No conflict: this branch's only edits to `scripts/proposal-support.py` and `tests/proposal-support/test_proposal_support.py` are docstrings, and main touched neither file. `docs/document-lifecycle.md` auto-merged — main's addition is the pinned-target marker grammar, a different paragraph from this branch's § 5.3 amendment. Refs #1003. Lane: openxfactory-1 Co-Authored-By: Claude Fable 5.1 <[email protected]>
…they left `add-declared-former-id` § 2.4, §§ 4.1-4.4 and §§ 5.0-5.2a are ticked against what LANDED, never against a branch: slice 4 as PR #1039, merge `92d519b0` (2026-09-15T19:15:01Z) — `scripts/former_id_arrival.py`, `scripts/validate-former-id-arrival.py`, `tests/former_id_arrival/test_former_id_arrival.py`, `tests/former_id_arrival/test_former_id_arrival_gate_wiring.py` and `.github/workflows/former-id-arrival-gate.yml`; and slice 5 as PR #1037, merge `8f393758` (2026-09-15T19:02:27Z) — `scripts/packet_reference.py`, `tests/packet_reference/test_packet_reference.py`, the `check_citations` arm of `scripts/validate-pin-registrations.py` and `tests/pin_registrations/test_pin_registration_sweep.py`. Every reader, every commit and every fixture named under a box was verified to exist on `main` before it was written down. The § 2 preamble said a narrower thing and now says the true one. BRETT HEAP'S RULINGS OF 2026-09-15, each written under the box it settles with the recording URL beside it. * **Q4 - "Yes, task 5.3 is authority"** (19:00Z, #1003 comment 5686436893). The amendment of `docs/document-lifecycle.md` - `Status: standard`, ratified by PR #846's act - rests on this packet's own ratified task § 5.3, which commissions the edit by quoting the exact sentence, plus `proposal.md`'s `code_surface:`, which names the file. No separate amendment route, and not deferred to promotion. § 5.3's "Q4 IS OUTSTANDING" paragraph is replaced by the ruling; the phrase survives nowhere in this packet. * **Q1 - "Dedicated required check"** (same record). The arrival gate stays a dedicated workflow and the context to require is the job id `former-id-arrival-gate`. § 4.5 STAYS UNTICKED: the shape is ruled, the act is his console act and it is not performed. Re-measured live at 2026-09-15T19:41Z, `GET /repos/opensoft/openxFactory/rules/branches/main` still returns three required-status-check rules and the gate is in none of them, so it runs and refuses nothing. * **Q2 - "Yes, with disposition + carry-forward issue"** (same record). The packet may archive with § 4.5 open, carrying the disposition plus a carry-forward issue, on the `add-signed-execution-chain` precedent (its own § 4.5/4.6 archived open at openxFactory issue #534, requirement 9 reaching canon meeting its own degraded case). The self-report is CITED where it already stands - `.github/workflows/former-id-arrival-gate.yml:13-21` and `:23-32` - rather than duplicated, and the one place the precedent had that this packet does not is named: the CLI itself emits no warning. FILING the carry-forward issue is the orchestrator's act at the archive, on his word, and is not performed here. * **Q5 - "File it after #1041 lands"** (19:0xZ, #1003 comment 5686628685). § 6.1's successor is filed as a routing record, not claimed, after this pull request lands. Filing is a reserved act; the box stays open. * **"Close when #1041 lands"** (same record). Recorded under § 7.2 AS A DEPARTURE rather than papered over: that box reads "AT THE ARCHIVE PULL REQUEST AND NOWHERE ELSE" and his ruling puts the closing earlier, at this slice's landing. It is his call, the box says so itself, and the box stays open because the act has not happened. Nothing on this branch carries a closing keyword against #1003 in any form. `docs/document-lifecycle.md` § 5.3's enforcement clause is RE-DATED and not rewritten: it said "as measured on 2026-09-14 that gate had not landed on `main`", which stopped being true at `92d519b0`. It now says the gate HAS landed and RUNS on every pull request, is named by no branch ruleset, and that an undeclared arrival therefore sees a red check beside a merge button that works. The rule and its enforcement stay stated separately; the ratified sentence and the promoted clause "renaming a DRAFT change, and a single commit that renames a draft and ratifies it, are unaffected" are untouched. § 5.4's figures are DATED rather than re-asserted: 104 / 64 / 40 is the reading at `701c8fde` on 2026-09-14, and the tree has moved twice since, an archive being exactly the act that moves this population. What the successor gains instead of a third re-implementation of M4's uncommitted recipe is named - § 5.1's resolver is committed and tested, separates the identity half from the file half, and will not read 104 / 64 / 40 because the extraction recipe differs and not because the corpus changed. LEFT OPEN, with the owner under each: § 4.5 (his console act), §§ 6.1-6.5 (residue), § 7.1 (the archive and the promotion) and § 7.2 (the closing). Thirty-one boxes ticked, eight open. Refs #1003. Lane: openxfactory-1 Co-Authored-By: Claude Fable 5.1 <[email protected]>
…ince amended Brett Heap ruled it, 2026-09-15T19:0xZ, by multiple choice in this lane's window, verbatim "Amend the row in #1041" (#1003 (comment)). Two claims in the `add-declared-former-id` OpenSpec Records row had been overtaken by the packet's own realization and are corrected where they stand, in the grammar the block already uses for a row amended by its own realization (`add-consent-custody-rederivation-record`, README:1564 — the superseded text is kept in place and dated rather than deleted). 1. The row quoted `docs/document-lifecycle.md`'s "Renaming a ratified change is therefore blocked until a change declares a FORMER ID (issue #833, a successor packet)" IN THE PRESENT TENSE, as what canon says. Slice 6 amends that sentence. The quote is kept and re-tensed — THEN STATED, "quoted here as the text that stood, not as the text that stands" — with a pointer to the amendment at the foot of the row. 2. The row said "`tasks.md` § 1 is ticked and §§ 2-7 stay open". That was true of the ratification and is false of the realization. It is re-tensed to the ratification it describes, and the amendment records what is true now: ratified 2026-09-13; realization slices 1-5 LANDED — PR #1038 → `701c8fde`, PR #1037 → `8f393758`, PR #1039 → `92d519b0` — and slice 6 is this pull request; § 4.5 (his operator act, re-measured live at 2026-09-15T19:41Z and still named by no branch ruleset) and § 7 (the archive and the promotion into `openspec/specs/release-realization/spec.md`) OUTSTANDING, the archive ruled admissible with § 4.5 open as a disposition plus a carry-forward issue. Thirty-one of thirty-nine boxes ticked, eight open. No other row moves and no numeral elsewhere in the block moves: this amendment neither archives nor un-archives anything, so the Active and Archived enumerations are exactly as `8944758c` left them. Refs #1003. Lane: openxfactory-1 Co-Authored-By: Claude Fable 5.1 <[email protected]>



Lane: openxfactory-1 (openXfactory-1)
Claim: #1003 (comment)
Base PR #1038 landed at
701c8fde; this diff is slice 5 alone after the merge-from-main2010988a. Slice 5's own change is four files:scripts/packet_reference.pytests/packet_reference/test_packet_reference.pyscripts/validate-pin-registrations.py(check_citations'stree-patharm)tests/pin_registrations/test_pin_registration_sweep.pyWhat this realizes
add-declared-former-id§§ 5.0, 5.1, 5.1a, 5.2, 5.2a — the ADDED requirement A packet reference resolves by identity, not by path, whole, and its named consumer. All six scenarios, by title:test_a_cited_path_naming_a_packet_that_has_since_archived_resolves_by_id; at the caller,test_an_archived_by_id_referent_passes_where_the_raw_path_is_gonetest_a_cited_path_naming_a_declared_former_id_resolves_to_that_packettest_a_cited_path_resolving_to_no_identity_at_all_is_dangling; at the caller,test_a_referent_whose_identity_resolves_nowhere_still_refusestest_an_identity_that_resolves_with_a_missing_file_names_the_file_half(§ 5.1a's two fixtures); at the caller,test_a_referent_whose_identity_resolves_but_whose_file_does_not_still_refusestest_a_reference_to_another_repository_is_out_of_scope; at the caller,test_a_referent_qualified_to_another_repository_is_still_out_of_scope(a spy, proving the resolver is never asked)test_an_id_resolving_twice_is_ambiguous_and_never_preferred(asked twice, with the file in the first-sorted candidate and then only in the last, so a resolver that picked one cannot pass by symmetry) andtest_the_ambiguity_belongs_to_the_declaration_and_not_to_the_citing_recordPlus the requirement's own remedy sentence as behaviour —
test_a_reference_that_resolves_owes_the_citing_record_no_edit— and "BOTH HALVES SHALL RESOLVE, AND A FAILURE SHALL SAY WHICH HALF FAILED" as a discrimination rather than two substrings, intest_the_report_names_which_half_failed.Why the consumer is not optional, measured on this tree
scripts/validate-pin-registrations.py'scheck_citationswas landed for issue #840 (PR #834 renamed a change directory and left two live citations naming the old id while every run still exited 0) and it resolves the RAW PATH. Re-measured here, verbatim:Six of those 17 in-tree referents point into FOUR ACTIVE packets —
prepare-openspec-1-12-readiness(×2),add-chain-attestation,disposition-codexfactory-floor-relocation-retitle,disposition-codexfactory-regular-pr-council-clearance-archive(×2). Each will archive; each archive moves the path and keeps the id. The next of those four archives would have turned a lawful act into an exit-1 refusal of a gate nobody touched. That is the dated failure this PR prevents.Before → after: the counts line is unchanged word for word and the run is byte-identical today, because every in-tree citation is still spelled where it stands. One new line appears only when a citation resolves somewhere other than its spelling — i.e. the day the first of those four packets archives.
§ 5.4 / § 6.1 population, re-measured through the resolver
Over every tracked file except
openspec/changes/archive/,tests/andspecs/, on this branch:openspec/changes/<id>/…references resolve to nothing by path;scripts/packet_reference.py;former_ids:declared today).Caveat carried from the realization plan: this population is a RE-IMPLEMENTATION of
design.mdM4's recipe — M4's authoring script was never committed — so the delta against M4's 94 / 58 / 36 at9378eca5is approximately, not exactly, comparable. The reporting sweep for the 40 is § 6.1's successor and is deliberately not built or filed here.Validators
python3 -m pytest tests/packet_reference tests/pin_registrations -qtests/pin_registrationswas 62)python3 scripts/validate-pin-registrations.py .every in-tree path resolves;OK contracts/manifest.yaml: 2 pin registration(s) coherepython3 -m pytest tests/proposal-support -qpython3 scripts/doc-health.py --single-repo .OPENSPEC_TELEMETRY=0 openspec validate --all --strictTotals: 107 passed, 2 failed (109 items)— the same two pre-existing failures (add-chain-attestation,add-composed-view-authoring), no thirdpython3 -m pyflakes scripts/packet_reference.py scripts/validate-pin-registrations.pydoc-health's error count is 6 against the plan's recorded 5, and the extra one is not this PR's:
ideation/cross-reference.mdline 51 (malformed xspec: marker), byte-identical toorigin/main, which arrived withc6f64947(#888 derive-possibles) after the plan's baseline was taken.Non-vacuity, proved by mutation rather than asserted
Four mutations of the landed resolver, each red in the tests that name it: ambiguity settled by sort order (2 failed), declared claims dropped (4 failed), the file half never checked (2 failed), archived claims dropped (8 failed). And one of the consumer: reverting the arm to raw-path resolution reds 5 of
tests/pin_registrations. Against the parent commits:tests/packet_reference= 1 collection error / 0 collected (the module does not exist there); thetests/pin_registrationsadditions = 7 failed / 63 passed.One existing test moved with the text it asserts
test_a_citation_naming_a_path_that_is_gone_is_reportedpinned the substring "but no such path is in this tree" for a referent that addresses a packet; that finding now says the packet id resolves to nothing and which half failed. Exit 1, the citation named, the row's OK line withheld and the "suppression with a footnote" sentence are all as they were. Named here rather than buried: an assertion moved with its subject, not an assertion loosened to keep a suite green.What this PR deliberately does not do
openspec/changes/file and no README row is touched, so Rule 6's landing window does not apply (git diff --stat origin/main...HEAD -- openspec/is empty).doc-healthdelta and no twenty-fourth check family (design.mdD4, RULED (a)).scripts/proposal-support.py(a sibling slice holds it) and none underscripts/former_id_arrival*(another sibling's).Fix round 1
Copilot reviewed 2026-09-14T10:24Z, three threads:
scripts/packet_reference.py:336(directory scans useis_dir(), whichfollows symlinks; a symlinked archive packet pointing outside
rootgetsindexed and read through the link) — TAKEN, my file. Fixed in
cac9a6fb4fae2abbc04cd2925702eb7908d0faf9:_contained/_contained_dirmirror
scripts/validate-pin-registrations.py'sresolve_in_treecontainment idiom (
.resolve()thenis_relative_to(root)) rather than ablanket
is_dir(follow_symlinks=False)— the house rule is "escapingrootis refused," not "no symlinks at all." A directory (or file) thatfails containment CONTRIBUTES NO CLAIM, the same posture
PacketIndex._buildalready holds for a malformed
former_ids:declaration; no newResolutionstatus. Measured against34473ecdbefore the fix: asymlinked archive packet was indexed,
Claim.carries()answeredTruethrough the link,
resolve()reported RESOLVED, and reading the corpus'sown spelling of the resolved path returned bytes from outside the
checkout verbatim; after, the same citation resolves DANGLING at the
identity half. Every other
is_dir()/exists()/iterdir()on aworking-tree path in this module got the identical containment check in
the same commit — the LIVE half of the directory scan (line 336's
sibling), the
.openspec.yamlmarker check,Claim.carries's remainderjoin (now takes
root), andresolve's own path-presence fallback —each with its own new test, all four measured failing against
34473ecdand passing after.
tests/packet_reference tests/pin_registrations:88 → 92 passed;
tests/proposal-supportunchanged (170 passed / 290subtests, untouched file);
validate-pin-registrations.py .exit 0,counts line unchanged word for word;
pyflakesexit 0;doc-health.py --single-repo .exit 0 — 31 critical / 10 error / 28warning / 24 info, 0 new regressions vs previous report, and none of
the 41 critical/error findings names
packet_reference.pyortests/packet_reference/(all are pre-existingrelease-inventory-driftand
tag-hygienedebt, unrelated to this change).Thread replied and resolved.
scripts/proposal-support.py:554(change_id_ofstrips aYYYY-MM-DD-prefix from every basename, though a date-prefixed ACTIVE idis valid) — fixed on the base PR Realize add-declared-former-id, slices 1-3: read the declared lineage, baseline by identity, fail closed on every history read #1038 — this PR inherits them. Not this
PR's file; left untouched here.
scripts/proposal-support.py:614(former_ids: [archive]passesCHANGE_ID_REthougharchiveis reserved) — fixed on the base PRRealize add-declared-former-id, slices 1-3: read the declared lineage, baseline by identity, fail closed on every history read #1038 — this PR inherits them. Same handling as above.
Merge-from-main currency pass
Base PR #1038 (slices 1–3) landed on
mainat701c8fde(21:09Z) while this branch was still stacked on the slice-1/2 prep tip2a9cfbda. Mergedorigin/mainin as a merge commit,2010988a: no conflict, because this branch never carried its own edit toscripts/proposal-support.pyortests/proposal-support/— confirmed by inspecting each of this branch's own commits individually, not only by the merge going clean — so main's side landed whole.git diff --stat origin/main...HEADnow shows slice 5 alone, the four files in the table above.The merge surfaced a real integration gap, not a textual conflict. Main's fix at
proposal-support.py:554— already named in Fix round 1 above as "fixed on the base PR #1038 — this PR inherits them" — narrowedchange_id_ofto strip an archive date prefix only where thePathit is handed hasarchivefor a parent (so an ACTIVE id that merely looks dated, e.g. this corpus's own2026-08-04-add-dated, is read verbatim instead of mis-stripped). Inheriting that fix by merge was necessary but not sufficient: two call sites — this file's ownpacket_reference()(the archive-spelling branch) and this suite's own corpus-sweep helper — calledchange_id_ofon a bare leaf name with no real parent, which the narrowed function now reads as "not archived" and hands back unstripped, dangling two citations that used to resolve:test_an_archived_spelling_resolves_by_id_when_the_archive_date_movestest_every_packet_in_this_corpus_resolves_to_exactly_itselfFixed in
fbc18db1: both call sites now prefix the leaf with the segment the citation was already read from (archive/), matching the contractPacketIndex._buildalready satisfies by passing a real directory whose parent truly is namedarchive. Re-verified atfbc18db1:python3 -m pytest tests/packet_reference tests/pin_registrations tests/proposal-support -qpython3 scripts/validate-pin-registrations.py .python3 -m pyflakes scripts/packet_reference.pypython3 scripts/doc-health.py --single-repo .Findings: 31 critical, 10 error, 28 warning, 24 info. New regressions vs previous report: 0.— byte-identical (repo label aside) to the same command run against a control worktree oforigin/mainbuilt the same way: slice 5 adds zero findingsOPENSPEC_TELEMETRY=0 openspec validate --all --strictTotals: 107 passed, 2 failed (109 items)— the same two pre-existing failures (add-chain-attestation,add-composed-view-authoring), confirmed identical on theorigin/maincontrol worktree; noopenspec/file is touched by this PRdoc-health's error count moved from the 6 recorded earlier in this body to 10 since this PR was drafted — the control-worktree comparison confirms that is
origin/main's own drift in the interval, not anything slice 5 adds.refs #1003
refs #833 — the dangling-cited-path finding this repairs.
Merging is not this lane's; this PR lands on Brett Heap's word.
🤖 Generated with Claude Code
Summary by Sourcery
Resolve packet citations by identity in pin-registration validation so archived or renamed packets remain valid while ambiguous, missing, and unsafe references are reported precisely.
New Features:
Bug Fixes:
Enhancements:
Tests: