Skip to content

Follow the packet's whole rename lineage in the origin-retention walk - #1024

Closed
brettheap wants to merge 7 commits into
mainfrom
fix/1003-origin-retention-rename-chain
Closed

brettheap wants to merge 7 commits into
mainfrom
fix/1003-origin-retention-rename-chain

Conversation

@brettheap

@brettheap brettheap commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Lane: openxfactory-1

The gap

#849 widened the origin-retention walk to ask EVERY commit it visits whether that commit moved an already-ratified packet — but the enumeration underneath it is a path-limited git log for the name the tree spells today, and a path-limited git log follows no rename. The closure therefore reached exactly ONE hop. Put a lawful draft rename between the move and the current name — ratify r → rename+un-ratify r→s → rename s→t while draft → ratify t — and the walk for t begins at the s→t hop, whose former blob is a draft and refuses nothing, while the r→s hop that actually moved the ratified packet is never enumerated at all; the later re-ratification is then taken as the baseline, waving through every origin mutation made in between. That is #833's failure and #849's, reached by one hop more than either closed. The reproduction is the one filed in #1003 off PR #999's review bench (thread PRRT_kwDOTAvnrs6hsp6c, scripts/proposal-support.py:840 at that head), and it is now a fixture.

First finding: this is REALIZATION, not an OpenSpec change

Asked and answered before any code beyond the failing tests, because a widened refusal on a gate with no bypass flag is governance surface if canon does not already carry it.

The requirement #695, #846 and #999 all realize is openspec/specs/release-realization/spec.md:262 § "Origin retention at archive", and it is the only hit in openspec/specs for origin + retention/rename/former:

The archive gate SHALL verify that a change's .openspec.yaml still carries its original origin declaration unchanged. […] Mutation of an origin declaration after ratification SHALL be rejected at the archive gate.

Scenario: An origin was mutated after ratification

  • WHEN the archive gate finds the origin declaration differs from the declaration present at ratification
  • THEN the archive MUST fail

The text names no rename, no former path and no hop count — it is silent on renames in both directions. What it does name is the thing that decides the question: the comparison is against the declaration present AT RATIFICATION. The #1003 defect is that after a rename chain the walk compares against a commit that is not the ratification, so the comparison the requirement mandates is not the comparison being run. Closing it implements the ratified sentence rather than extending it.

Three checks behind that reading, each measured rather than argued:

So: a fix/ PR, code and fixtures, no OpenSpec packet and no doc change (the doc's sentence above is already true of this branch and was already true of a lineage it could not yet reach).

What moved — the walk

scripts/proposal-support.py. ratifying_commit's body is five lines over the helpers below; the question it asks each commit is unchanged.

  • _commits_touching(root, rel, bounds=None) — the existing --full-history --topo-order --reverse --format=%H enumeration, lifted out and given optional bounds so a predecessor's history can be read as it stood BEFORE the hop that renamed it. Deliberately not --follow: --follow would have to replace the enumeration, and it walks the simplified history of one path, which would trade away the --full-history property the walk depends on (a commit that changed the file on a merged branch must not be pruned).
  • _parents(root, revision) — git rev-list --parents -n 1, so a hop's history is bounded by every parent rather than by <hop>^. A lineage that ran through a merge is then read from both sides (bench round 1).
  • _incarnation(root, change, rel, hop) — the predecessor's own commits, TRIMMED to the incarnation that hop renamed away: reading newest first, commits are kept until one is reached where the name stood in no parent, and that one is the last kept. Without the trim, a name previously occupied by a DIFFERENT packet drags that occupant's hops into this packet's lineage — a false refusal, permanent, on a gate with no bypass flag (bench round 1, and its own fixture). The trim loses no hop: git pairs a rename only where the destination is ADDED, so only the commit that brought a name into being can carry a predecessor at all.
  • _lineage_commits(root, change, rel) — the walk itself, iterative with a frame per name, predecessors asked FIRST so a refusal names the EARLIEST hop that moved a ratified packet, and a seen memo over (former, revision) pairs. Renames only (kinds="R"), never copies: following a copy backwards would walk into the SOURCE packet's history and refuse a packet honestly authored as a draft copy of a ratified one, on a gate with no bypass flag by design (Origin retention at archive has no running implementation; #685 shipped a post-ratification edit to the archived .openspec.yaml origin block #690).
  • _refuse_if_moved(...) / _moved_packet_refusal(...) — the per-commit question and the refusal text, each in one place for both callers, asked with the path that commit spelled. The baseline still comes from the current name alone: a ratification found under a former name is a refusal, never a commit to re-base onto, because nothing in this corpus declares a former id (proposal-support's origin-retention walk silently re-bases to a LATER commit when a ratified change's path moves (a rename), waving through every mutation between the real ratification and it — the failure its own docstring names; no refuse, no bypass #833).

No depth cap, and that is a decision rather than an omission. The walk is iterative over a finite history with a seen memo, so it terminates without one, and the realization record's own sentence — "renaming a DRAFT change is unaffected" — carries no number for a cap to enforce. A constant would refuse a packet renamed often but lawfully, on a gate with no bypass flag (#690), which is a refusal nobody ruled. test_a_long_lawful_draft_rename_chain_is_not_capped walks 70 hops and expects a baseline, and ratifying_commit's docstring says why where a reader will look.

What moved — and every read of history fails closed

The bench's second round found the other half of the same design: git answers "there is nothing there" and "I cannot tell you" with the same empty value in more than one place, and a widened walk reads more history, so it meets more of them. Read flat, a checkout carrying only part of its history reports no ratified predecessor, no predecessor at all and no earlier history — three clean answers, none of them true, and the guard silently off exactly where it cannot prove anything.

  • _pairing_at(root, revision, rel, *, kinds) — "" where git ANSWERED and reported no pairing, None where git DECLINED (an unresolvable revision, a --follow that failed). renamed_from stays as its flattened reading for the callers and fixtures that legitimately want one; the guard reads the tri-state.
  • _path_present(root, revision, rel) — git ls-tree, which separates ABSENT (exit 0, no row) from UNREADABLE (non-zero) where git show cannot. This is the incarnation boundary test: "the name stood in no parent" is now read off the TREE, not off a failed git show.
  • _readable_blob(root, change, revision, rel) — the text, None where the path is genuinely absent (the deletion commits the walk visits depend on that answer), and a REFUSAL where git could not read it.
  • _unreadable_history(change, need) — the refusal, origin-retention-history-unreadable, exit 2, CANNOT RUN, the same shape as every other arm of this gate. need NAMES the read that failed ("it needed the blob … as at …", "whether … renamed … in from an earlier name"), because "cannot verify" without it sends an operator hunting a defect in the packet rather than the missing half of their checkout.
  • The baseline read in origin_retention_errors is the same defect one layer up: was_text is the declaration AT RATIFICATION, and an unreadable read of it fell into the pre-contract "NOT COMPARABLE" branch, skipping every comparison and returning no findings at all. Absent is still NOT COMPARABLE; unreadable now refuses.
  • The two reads in _accept_declaration_problems were measured rather than changed, and are now pinned: with the accepted mutation's blob unreadable the entry fails its own predicate, the headline mutation finding stands and the archive refuses; and the declaration AT RATIFICATION is read through _readable_blob BEFORE any disposition is consulted, so a silence there refuses before the record is reached at all.

Measured, not feared. A --filter=blob:none clone whose promisor is unreachable LISTS a predecessor's proposal.md in its tree and cannot read the blob behind it (git 2.43.0), and it cannot pair any rename that was not byte-exact, because similarity detection reads blobs. On the #1003 chain in such a checkout the pre-fix walk RETURNED a baseline and printed ORIGIN RETAINED over an origin mutated after ratification (origin_retention_errors → []), where the same history fully readable refuses. Both are fixtures.

A correction to this description

Until this round, the paragraph above the fixtures described _predecessor_history(...) and "a lineage deeper than _LINEAGE_HOP_LIMIT = 64 hops refuses". That was the FIRST DRAFT of the implementation, not the code: the cap was dropped deliberately, the helper was replaced by _lineage_commits/_incarnation, and a 70-hop fixture asserts the lawful chain is not refused. The bench caught the contradiction between the description and the shipped behaviour, and the description is corrected to the code rather than the code to the description.

What is NOT closed, said rather than implied

An un-ratification that lands in its OWN commit BEFORE the rename leaves every hop moving a DRAFT, so no hop answers the question and the later re-ratification is still the baseline. Whether a re-ratification after a return to draft is lawfully a NEW baseline is a governance question rather than an author's; #1003 names the shape whose un-ratification rides IN the rename commit. Today's answer for the other shape is PINNED by test_an_un_ratification_before_the_rename_is_a_stated_gap — the precedent being #846's own stated-gap fixture for #849's shape, which #999 later flipped — rather than changed here.

A shallow clone is the other stated boundary: at a grafted boundary commit git reports no parents and therefore no rename pairing, which is renamed_from's pre-existing blindness rather than anything this branch widens or narrows. Refusing every shallow checkout outright is a new refusal class on a gate with no bypass flag (#690) and belongs to a change that says so. It is named in the walk's docstring.

Fixtures — thirteen, five of them red first

All in OriginRetentionAtArchiveTests, with four helpers (rename_and_un_ratify, a_lineage_with_a_mutated_origin, a_moved_ratified_lineage / an_un_ratifying_lineage, partial_checkout + assert_the_full_clone_refuses).

fixture added before after
test_a_rename_chain_refuses_at_the_hop_that_moved_the_ratified_packet (the issue's reproduction) 50bc03a9 FAIL — OriginRetentionError not raised refuses, naming the r→s hop
test_a_three_hop_rename_chain_still_refuses_at_the_first_hop 50bc03a9 FAIL — OriginRetentionError not raised refuses, same commit named
test_a_ratified_packet_renamed_twice_refuses_at_the_first_hop 50bc03a9 FAIL — refuses, but names the LAST hop refuses at the FIRST hop
test_a_draft_renamed_twice_and_ratified_at_the_end_still_archives (control) 50bc03a9 pass pass
test_a_draft_fork_by_copy_renamed_afterwards_still_archives (control — the copy boundary) 50bc03a9 pass pass
test_an_un_ratification_before_the_rename_is_a_stated_gap (pin) 50bc03a9 pass pass
test_a_reused_intermediate_name_does_not_contaminate_a_later_packet (+ its anti-vacuity half) a90e6ccd FAIL — raised, naming a PREVIOUS occupant's move the reused name is trimmed; the really-renamed packet still refuses
test_a_rename_that_landed_through_a_merge_still_refuses a90e6ccd pass (pins both halves: no pairing at the merge, the pairing and the refusal at the branch commit) pass
test_a_lineage_git_will_not_read_refuses_rather_than_reading_a_silence (extended by acaffe97) a90e6ccd FAIL — the current name's own git log read its failure as an empty history and refused on the not ratified arm refuses origin-retention-history-unreadable, naming the read that failed
test_a_long_lawful_draft_rename_chain_is_not_capped (70 hops) a90e6ccd pass pass
test_a_partial_checkout_that_cannot_read_the_predecessor_refuses acaffe97 FAIL — _incarnation kept ONE commit where the full checkout keeps two, the ratified hop trimmed out the boundary is read off the tree; the walk refuses naming the blob
test_a_partial_checkout_that_cannot_read_the_pairing_refuses (the #1003 chain) acaffe97 FAIL — ratifying_commit RETURNED a baseline, ORIGIN RETAINED printed over a mutated origin, origin_retention_errors → [] refuses naming the pairing it could not read
test_an_unreadable_accepted_declaration_refuses_the_acceptance 5886ca39 FAIL against a90e6ccd — ORIGIN RETENTION NOT COMPARABLE … declares no origin (pre-contract packet) and NO findings, with a valid disposition record present the acceptance is refused, and the baseline read refuses before the record is consulted

Also in this round, found by reading rather than filed: partial_checkout had been defined twice in the class (Python binds the second), and the comment above the pair claimed both fixtures' partial clone had previously "accepted the late re-ratification" where only one had. Both corrected in 2bc60386, with the running bytes untouched.

Gates

Branch 2bc60386 against a control clone at origin/main 9378eca5:

  • python3 -m pytest tests/proposal-support -q → 142 passed, 72 subtests passed; control → 129 passed, 72 subtests passed. +13 fixtures, no skips, nothing existing changed.
  • Corpus sweep, pre-fix module vs post-fix module side by side over the same tree — every active AND archived packet: 0 refusals before, 0 refusals after, 0 baselines moved, 0 answers changed. Wall clock 0.31s → 0.43s per packet for a gate that runs once per archive. The in-repo sweep fixture (test_the_guard_refuses_nothing_on_this_repository_today) asserts the same invariant over whatever is active, one subtest per change.
  • python3 scripts/proposal-support.py . verify → exit 0, proposal support verification ok.
  • python3 scripts/doc-health.py --single-repo ., branch vs control: both exit 0, both 328 lines, diff CLEAN once the repo-identity token (the checkout's own directory name) is normalised. Headline on both, as-of 2026-09-13: canon share 40.3%, 31 critical / 9 error / 26 warning / 23 info, new regressions 0.
  • OPENSPEC_TELEMETRY=0 openspec validate --all --strict: 104 passed, 3 failed (107 items) on BOTH, the three being the disposition-codexfactory-* packets that carry no spec delta by construction. This branch touches no openspec/ path, which is why the identity is the measurement.

No other consumer: ratifying_commit, ratified_under_a_former_path and renamed_from are called from nothing outside this script and its own tests (grep over the whole tree), and the nightly proposal-origin doc-health family compares manifest against packet without walking history, so it shares neither the gap nor the fix.

refs #1003 · refs #999 · refs #849 · refs #833

🤖 Generated with Claude Code

Summary by Sourcery

Make origin-retention validation trace a packet's full rename lineage so ratified origins cannot be bypassed through intermediate renames and re-ratification.

Bug Fixes:

  • Ensure origin-retention validation follows a packet across its complete rename lineage, preventing later re-ratification from incorrectly becoming the comparison baseline.
  • Refuse origin-retention checks when required lineage history cannot be read instead of treating unavailable history as empty.
  • Preserve correct behavior for draft renames, copy-based forks, reused path names, merge-based renames, and deep rename chains.

Enhancements:

  • Refactor commit-history enumeration and moved-packet refusal handling into reusable helpers while preserving the existing validation question and refusal wording.
  • Report the earliest rename that moved an already-ratified packet, including lineage context for operators.

Tests:

  • Add comprehensive coverage for multi-hop rename chains, draft and copy controls, reused intermediate names, merge scenarios, unreadable history, and long lawful rename chains.

#849 widened the walk to ask every commit it VISITS whether that commit
moved an already-ratified packet, but the enumeration underneath is a
path-limited `git log` for the name the tree spells today, and a
path-limited `git log` follows no rename. So the closure reached exactly
one hop. Put a lawful draft rename between the move and the current name
— `ratify r → rename+un-ratify r→s → rename s→t while draft → ratify t` —
and the walk for `t` begins at the `s→t` hop, whose former blob is a
draft and refuses nothing; the `r→s` hop that moved the ratified packet
is never enumerated, and the later re-ratification is taken as the
baseline, waving through every origin mutation made in between. That is
#833's failure and #849's, reached by one hop more than either closed,
and it is the reproduction filed in #1003 off PR #999's review bench.

The hops are now followed backwards through `renamed_from` — the
`--follow` pairing no git config can switch off — rather than by making
the enumeration `--follow`, which walks the simplified history of one
path and would have traded away the `--full-history` property the walk
depends on. Each earlier name is enumerated the same way the current one
is, predecessors are asked FIRST so a refusal names the earliest hop that
moved a ratified packet, and the question asked at each commit is
unchanged: `kinds="RC"` where the blob is ratified, `kinds="R"` where it
is not. RENAMES ONLY, never copies, which is the line #999 drew for the
same reason — following a copy backwards would walk into the source
packet's history and refuse a lawful fork-by-copy on a gate with no
bypass flag (#690). The baseline still comes from the current name alone:
a ratification found under a former name is a refusal, never a commit to
re-base onto, because nothing in this corpus declares a former id (#833).

Realization of the promoted requirement, not an extension of it:
`release-realization` § "Origin retention at archive" compares against
"the declaration present at ratification" and names no rename, former
path or hop count, and the ratified realization record
(`docs/document-lifecycle.md`, Status: standard) already states the rule
with no hop count — "Renaming a ratified change is therefore blocked
until a change declares a FORMER ID". So this is code and fixtures, as
#695, #846 and #999 each were, and no OpenSpec packet.

Measured. `pytest tests/proposal-support -q`: 135 passed, 70 subtests
(129 before, +6, no new skips). Over the whole corpus — 210 active plus
archived packets, the pre-fix and post-fix modules loaded side by side —
0 refusals before, 0 refusals after, 0 baselines moved, 147 resolving to
a commit and 63 reading "not ratified" either way; 0.31s → 0.43s per
packet for a gate that runs once per archive.

An un-ratification that lands in its OWN commit BEFORE the rename is NOT
closed here: every hop then moves a draft, whether a re-ratification
after a return to draft is lawfully a new baseline is a governance
question rather than an author's, and today's answer is pinned by a
fixture rather than changed.

refs #1003

Lane: openxfactory-1
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Copilot AI lite review requested due to automatic review settings September 13, 2026 02:13

@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.

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 1 day and 15 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@sourcery-ai

sourcery-ai Bot commented Sep 13, 2026

Copy link
Copy Markdown

Reviewer's Guide

Fixes origin-retention validation so it follows and checks every rename hop back to the packet’s ratified identity, without following copies or changing baseline semantics; comprehensive fixtures cover regressions, lawful draft/copy cases, and the explicitly deferred scenario.

Sequence diagram for whole rename lineage origin-retention validation

sequenceDiagram
    participant Gate as Archive gate
    participant RC as ratifying_commit
    participant History as _commits_touching
    participant Lineage as _predecessor_history
    participant Rename as renamed_from
    participant Refusal as _refuse_if_moved

    Gate->>RC: ratifying_commit(root, change)
    RC->>History: _commits_touching(current_path)
    loop Each current-name commit
        RC->>Lineage: _predecessor_history(current_path, revision)
        Lineage->>Rename: renamed_from(revision, path, kinds=R)
        alt Earlier rename exists
            Lineage->>History: _commits_touching(former_path, revision^)
            loop Earlier-name commits
                Lineage->>Lineage: _predecessor_history(former_path, earlier)
                Lineage->>Refusal: _refuse_if_moved(earlier_path, earlier)
                Refusal-->>Lineage: Continue or raise refusal
            end
        end
        RC->>Refusal: _refuse_if_moved(current_path, revision)
        Refusal-->>RC: Ratified baseline or refusal
    end
    RC-->>Gate: Ratifying commit or OriginRetentionError
Loading

Flow diagram for rename-lineage origin-retention decisions

flowchart TD
    A[Start with current packet path] --> B[_commits_touching current path]
    B --> C[_predecessor_history follows renamed_from]
    C --> D{Former path via rename?}
    D -- No --> E[_refuse_if_moved current commit]
    D -- Yes --> F{Copy or rename?}
    F -- Copy --> G[Do not follow copy]
    F -- Rename --> H[_commits_touching former path before rename]
    H --> I[Check predecessor commits first]
    I --> J{Ratified packet moved?}
    J -- Yes --> K[Raise OriginRetentionError at earliest hop]
    J -- No --> L[Continue lineage checks]
    L --> E
    G --> E
    E --> M{Current commit ratified?}
    M -- Yes --> N[Use current-name commit as baseline]
    M -- No --> O[Continue current-name history]
Loading

File-Level Changes

Change Details Files
Extend origin-retention history traversal across the packet’s complete rename lineage while preserving full-history commit enumeration and current-name baseline semantics.
  • Extract path-limited full-history commit enumeration with optional pre-rename bounds.
  • Traverse predecessor names through rename-only Git pairing, processing earliest lineage hops first.
  • Add memoization and a 64-hop safety limit that refuses when lineage traversal cannot be bounded.
  • Centralize per-commit movement checks and refusal construction, appending lineage context for earlier-name hops.
  • Keep copies and draft-only rename chains exempt, and retain the stated gap for un-ratification in a separate commit.
scripts/proposal-support.py
Add regression and boundary fixtures covering multi-hop rename retention behavior.
  • Add failing-first reproductions for two- and three-hop chains and verify refusal at the earliest ratified move.
  • Verify existing refusal behavior for ratified packets renamed multiple times.
  • Preserve successful archiving for draft rename chains and draft copy-then-rename forks.
  • Pin the separate un-ratification-before-rename scenario as an explicitly unchanged gap.
tests/proposal-support/test_proposal_support.py

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@brettheap

Copy link
Copy Markdown
Contributor Author

@codex review

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

Unresolved history-failure, lineage-limit, merge-parent, and boundary-test issues remain.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Extends archive origin-retention checks across multi-hop packet rename histories.

Changes:

  • Adds rename-lineage traversal and centralized refusal handling.
  • Preserves draft-rename and copy-fork behavior.
  • Adds regression fixtures for rename chains and edge cases.
File summaries
File Summary
tests/proposal-support/test_proposal_support.py Adds multi-hop rename, draft, copy, and stated-gap regression coverage.
scripts/proposal-support.py Implements lineage traversal. Unresolved findings: one critical issue (2 votes) for masking Git failures, and three moderate issues (1, 2, and 1 votes) concerning the 64-hop cap, merge-parent handling, and missing boundary coverage.
Review details

Suppressed comments (2)

scripts/proposal-support.py:970

  • This hard cap rejects a packet after 64 rename hops before checking whether any hop moved a ratified packet. A packet that remained draft through 65 ordinary renames and was ratified only at the end would therefore be refused even though the documented archive contract says draft renames are unaffected, and this gate has no bypass. Traverse the finite Git lineage without an arbitrary false-refusal cap, or explicitly establish a governed limit and its archive behavior.
    if hops >= _LINEAGE_HOP_LIMIT:
        raise OriginRetentionError(
            f"REFUSE origin-retention-path-moved: {change}: the "
            f"origin-retention walk CANNOT RUN. Following this packet's "
            f"rename lineage back from `{rel}` passed "

scripts/proposal-support.py:976

  • The new _LINEAGE_HOP_LIMIT fail-closed path is not covered by the added fixtures. A 65-hop rename history should raise OriginRetentionError; without a boundary test, an off-by-one in hops or a regression in seen could recurse or pass while the suite remains green. Add a generated over-limit fixture and assert the refusal is surfaced by the archive gate.
    if hops >= _LINEAGE_HOP_LIMIT:
        raise OriginRetentionError(
            f"REFUSE origin-retention-path-moved: {change}: the "
            f"origin-retention walk CANNOT RUN. Following this packet's "
            f"rename lineage back from `{rel}` passed "
            f"{_LINEAGE_HOP_LIMIT} hops without reaching a name that was "
            f"never renamed into — `{path}` came in from `{former}` at "
            f"{revision[:12]} — which nothing in this corpus does, so the "
            f"walk stops rather than following a lineage it cannot bound. "
            f"The baseline was never established, and a check that cannot "
            f"run must not pass (issue #1003).")
  • Files reviewed: 2/2 changed files
  • Comments generated: 2
  • 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 thread scripts/proposal-support.py Resolved
Comment thread scripts/proposal-support.py Resolved

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 50bc03a92d

ℹ️ 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".

Comment thread scripts/proposal-support.py Resolved
All three are about what the new walk does BESIDES closing the chain, and
all three are taken rather than argued.

A PATH IS NOT AN IDENTITY (Codex P2). Reading the whole history of an
intermediate name drags a previous occupant's hops into this packet's
lineage: an old ratified `r` renamed to `s`, `s` renamed onward, the name
later taken by a new draft that is renamed to `t` and ratified, and the
walk refused `t` for somebody else's move — permanently, this gate having
no bypass flag. `_incarnation` now trims a predecessor's history to the
incarnation the hop actually renamed away, reading newest first and
stopping at the commit where the name stood in no parent. Trimming loses
no hop: git pairs a rename when the destination is ADDED, so only that
commit can carry a predecessor at all.

A FAILED `git log` IS NOT AN EMPTY HISTORY (Copilot). `_commits_touching`
now answers None where git declined to answer and `[]` only where git
said there is nothing, and the lineage refuses CANNOT RUN on None —
`origin-retention-history-unreadable` — rather than reading silence as
"there is nothing earlier here". The current name's own enumeration keeps
the behaviour it always had, which is itself a refusal: measured on a
repository with a hop's parent commit object deleted, the gate answers
`not ratified` and the archive stops.

THE PREDECESSOR BOUND IS EVERY PARENT, not `<hop>^` (Copilot). Measured
first, because the shape matters more than the fear: git reports no
rename pairing AT a merge commit — `git log --follow -1 <merge> -- <path>`
answers with the branch's own rename commit, and `renamed_from` accepts a
pairing only where git's `%H` is the revision asked about — so the
merged rename is asked about at the branch commit that made it, where
the parent read is exact, and the walk already refused that shape. A
fixture now pins it. `_parents` is used anyway because it is the honest
shape of the question.

AND THE DEPTH CAP IS GONE (Copilot, suppressed). "Renaming a DRAFT change
is unaffected" carries no number, so the walk carries none: it is
iterative rather than recursive, bounded by the history itself, and a
packet renamed seventy times while draft archives on the ratification it
finally got. The lineage is also LAZY now, so the ordinary packet's early
return costs what it always did: `tests/proposal-support` went 98s → 73s
on the same machine, against 41s before the lineage existed, with the
corpus sweep fixture the bulk of it either way.

Four fixtures, three of them red against this branch's own previous
commit: the reused intermediate name, the unreadable lineage, the
seventy-hop draft chain (the merge one passes there too, which is the
point — it pins a measurement rather than repairing a defect).
`pytest tests/proposal-support -q`: 139 passed, 70 subtests. Corpus sweep
over 210 active plus archived packets, pre-fix module beside post-fix:
0 refusals either way, 0 baselines moved, 63.3s → 74.9s for the whole
corpus.

refs #1003

Lane: openxfactory-1
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Copilot AI review requested due to automatic review settings September 13, 2026 02:41
No conflict: main's landings since 3cf8b0b touch the openDox/openXdox
pin lockstep, the engineering profile's display facet and the
code-surface gate packet, none of which this branch reads.

refs #1003

Lane: openxfactory-1
Co-Authored-By: Claude Fable 5.1 <[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

Resolve the documented depth-limit inconsistency and ensure unreadable history and reused-path incarnations fail closed.

Get a fresh assessment by requesting another Copilot review.

Review details

Suppressed comments (1)

scripts/proposal-support.py:1066

  • Only predecessor segments are trimmed; the current-name segment still includes every historical incarnation of that path. If a ratified packet once occupied the current id, was renamed away, and a new draft is later authored at that same id, this loop reaches the old move and refuses the unrelated packet before its own ratification. The added reused-name fixture covers only an intermediate name; the current segment also needs an incarnation boundary (or an equivalent identity check).
    THE CURRENT NAME'S OWN SEGMENT IS NOT TRIMMED, unlike the predecessors':
    the walk has always asked every commit that touched the name the tree
    spells today, whatever occupied it before, and narrowing that here would
    be a behaviour change this issue did not ask for.
  • Files reviewed: 2/2 changed files
  • Comments generated: 4
  • Review effort level: Lite

Comment thread scripts/proposal-support.py Resolved
Comment thread scripts/proposal-support.py Resolved
Comment thread scripts/proposal-support.py Resolved
Comment thread scripts/proposal-support.py Resolved
@brettheap

Copy link
Copy Markdown
Contributor Author

RULING affecting this PR — Brett Heap, 2026-09-13T03:0xZ, verbatim "option 2 on 1003 with the fix" (full record on #1003, issuecomment link there): #1003's remedy is option 2 — the former-id declaration mechanism (#833 (b)) encoded fail-closed on an undeclared rename arrival, plus the interim docstring+pinned-fixture half — not option 1, which this PR implements. As #1003's claim holder, lane openxfactory-1 decides whether to redirect this PR to the option-2 shape or close it in favor of an option-2 packet.

Lane: openxfactory-5 (openXfactory-5)

brettheap and others added 3 commits September 12, 2026 23:29
A READ GIT DECLINED IS NOT AN ANSWER, and four of them were being taken
as one. `git_show_text` returns None for a path that is ABSENT and for a
blob it could not READ; `renamed_from` returns None for "no pairing" and
for a `git log --follow` that failed; `_commits_touching` answered None
for the current name and the caller wrote `or []`. Read flat, a checkout
carrying only part of its history reports no ratified predecessor, no
predecessor at all and no earlier history — three clean answers, none of
them true — and the guard is silently off exactly where it cannot prove
anything. Copilot filed all three on `a90e6ccd`; all three are taken as
one design, because they are one defect.

MEASURED, NOT FEARED, on a real partial checkout. A
`--filter=blob:none` clone whose promisor is unreachable LISTS a
predecessor's `proposal.md` in its tree and cannot read the blob behind
it (git 2.43.0), and it cannot pair any rename that was not byte-exact,
because similarity detection reads blobs. On the #1003 chain in such a
checkout the previous commit's walk answered `ORIGIN RETAINED` over an
origin mutated after ratification, resolving the late re-ratification as
its baseline, while the same history fully readable refuses
`origin-retention-path-moved`. That is now a fixture.

SO EACH READ KEEPS THE TWO APART, in this module's own convention —
None is git declining, an empty answer is git saying there is nothing.
`_pairing_at` answers `""` for no pairing and None for a failed read,
with `renamed_from` left as its flattened reading for the callers that
want one. `_path_present` asks `git ls-tree`, which separates ABSENT
(exit 0, no row) from UNREADABLE (non-zero) where `git show` cannot.
`_readable_blob` asks both and refuses on the disagreement, so a commit
where the packet is absent still answers "not ratified here" — the
deletion commits the walk visits depend on that — while a blob nobody
can read refuses. `_unreadable_history` now NAMES the read that failed,
because "cannot verify" without it sends an operator to look for a
defect in the packet rather than for the missing half of their checkout.

THE CURRENT NAME'S OWN ENUMERATION IS FIXED TOO, which the previous
round left alone on the reasoning that it already refused. It did — on
the `not ratified` arm, which tells an operator to go and commit a
ratification that is sitting in the history they could not read. A
refusal must name what happened.

AND THE BASELINE READ IN `origin_retention_errors`, which is the same
defect one layer up: `was_text` is the declaration AT RATIFICATION, and
an unreadable read of it fell into the pre-contract "NOT COMPARABLE"
branch, skipping every comparison and returning no findings at all — an
archive passing on a silence. Absent is still NOT COMPARABLE; unreadable
now refuses. The disposition record's own reads were measured rather
than changed: an unreadable commit there already fails the acceptance
and leaves the mutation refused.

NO DEPTH CAP, ON THE RECORD (the fourth finding). The PR description
still described `_LINEAGE_HOP_LIMIT = 64` from the first draft; the
implementation dropped it deliberately in `a90e6ccd` and the reasoning
holds — the walk is iterative with a `seen` memo over a finite history,
so it terminates without one, and "renaming a DRAFT change is
unaffected" carries no number for a cap to enforce. A constant would
refuse a packet renamed often but lawfully, on a gate with no bypass
flag (#690). The description is corrected to the code rather than the
code to the description, and `ratifying_commit`'s docstring now says so
where a reader will look.

Four fixtures, all red against `a90e6ccd`: the two partial checkouts
(one that cannot read the predecessor's blob, one that cannot read the
pairing), the current name's unreadable enumeration, and the split
between `renamed_from`'s flat reading and the guard's. Each partial
checkout proves its own premise before asserting anything — the tree
lists what the blob read cannot reach — and skips rather than passing if
a git ignores the filter. `pytest tests/proposal-support -q`: 141
passed, 71 subtests, against 129 on `main`. Corpus sweep over 211 active
plus archived packets, main's module beside this one: 0 refusals either
way, 0 baselines moved, 0 answers changed.

refs #1003

Lane: openxfactory-1
Co-Authored-By: Claude Fable 5.1 <[email protected]>
No conflict: main's landing since 5488529 is
add-target-release-deferred-allocation — the third `target_release`
value, its validator and its own tests — which this branch neither
reads nor is read by.

refs #1003

Lane: openxfactory-1
Co-Authored-By: Claude Fable 5.1 <[email protected]>
`acaffe97` said the disposition record's own reads were "measured rather
than changed" — an unreadable commit there already fails the acceptance
and leaves the mutation refused. That was a reading of the code, and a
reading is not a fixture: the next hand to touch
`_accept_declaration_problems` has nothing to fail. So the claim is
measured again, with a real object deleted out of `.git/objects`, and
pinned where that hand will meet it.

BOTH HALVES ASK THE SAME QUESTION WHERE THE CODE DID NOT CHANGE. The
record's own read: with the accepted mutation's blob unreadable, the
entry fails its own predicate — "declares no origin, so there is no
declaration to accept" — the headline mutation finding stands, and
`archive_change` refuses. Fail closed, reached through a check the
record already carried. And the ORDERING that makes the other read
safe: the declaration AT RATIFICATION goes through `_readable_blob`
BEFORE any disposition is consulted, so a silence there refuses
`origin-retention-history-unreadable` and the record — valid, committed,
naming that very commit — is never reached at all.

RED AGAINST `a90e6ccd` on the second half, and not in the way a missing
helper is red: that module answered `ORIGIN RETENTION NOT COMPARABLE
change-r: the packet at the ratifying commit declares no origin
(pre-contract packet)` and returned NO findings — an archive passing on
a silence, over a mutated origin, with a valid disposition record
sitting right there. That is the failure `acaffe97` ends, now measured
end to end rather than described.

MEASURED. `pytest tests/proposal-support -q`: 142 passed, 72 subtests,
against 129 passed, 72 subtests on `origin/main` 9378eca — +13, no
skips. `proposal-support.py . verify` exit 0. `doc-health.py
--single-repo`, this branch against a control at 9378eca: both exit 0,
both 328 lines, IDENTICAL once the repo-identity token is normalised
(31 critical, 9 error, 26 warning, 23 info, 0 new regressions).
`openspec validate --all --strict`: 104 passed, 3 failed on both, the
same three `disposition-codexfactory-*` packets that carry no delta by
construction.

refs #1003

Lane: openxfactory-1
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Copilot AI review requested due to automatic review settings September 13, 2026 04:17
`partial_checkout` was defined TWICE in `OriginRetentionAtArchiveTests`
(`5886ca39`, lines 2146 and 2238). Python binds the second, so the first
was dead the moment it was written — and dead in the worst way, since a
later hand edits the copy that reads first and watches nothing change.
The two bodies are identical apart from docstring wording and one
comment, so the SECOND one stays and the running bytes are untouched.

AND THE COMMENT ABOVE THEM SAID MORE THAN WAS MEASURED. It read that
both fixtures' partial clone "accepted the late re-ratification and
printed `ORIGIN RETAINED` over a mutated origin". Against `a90e6ccd`
that is true of ONE of them: on the #1003 chain, whose hop cannot be
paired without reading blobs, the walk RETURNED a baseline
(`209823db046c`) and printed `ORIGIN RETAINED` while
`origin_retention_errors` answered `[]`. On the byte-exact chain a
sibling arm still refused — but it named the LAST hop where the full
clone names the FIRST, which is the lineage trimmed at a tree it could
not read, and is why that fixture pins `_incarnation` directly rather
than through an outcome. The comment now says which is which, because
the pair only teaches that if the difference is on the page.

`pytest tests/proposal-support -q`: 142 passed, 72 subtests — unchanged
by either edit, which is the point of both.

refs #1003

Lane: openxfactory-1
Co-Authored-By: Claude Fable 5.1 <[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

Reconcile the documented depth limit with the implementation/tests and remove the duplicate helper.

Get a fresh assessment by requesting another Copilot review.

Review details

Suppressed comments (2)

scripts/proposal-support.py:1226

  • The PR description says the lineage is bounded by _LINEAGE_HOP_LIMIT = 64, but this implementation explicitly imposes no depth cap and the new test requires a 70-hop chain to succeed. Please reconcile the description with the shipped behavior (or add the documented limit and update the test), otherwise the supported behavior is ambiguous.
    ITERATIVE, WITH A `seen` MEMO, rather than recursive: the lineage is
    finite (every hop is bounded by a strictly earlier commit, and no commit
    is its own ancestor), so no cap on its depth is needed and none is
    imposed — a cap would be a refusal for a packet renamed often but
    lawfully, and "renaming a DRAFT change is unaffected" has no number in it

tests/proposal-support/test_proposal_support.py:2387

  • The PR description says lineages deeper than _LINEAGE_HOP_LIMIT = 64 must refuse, but this change explicitly implements no depth cap and adds a 70-hop test that must archive successfully. Please reconcile the implementation/fixture with the stated contract, or update the PR description so the delivered behavior is unambiguous.
            commit_all(root, "ratify it under the name it ended up with")
            head = self.sha(root)
            self.assertEqual(support.ratifying_commit(root, current), head)
            self.assertEqual(
                support.origin_retention_errors(root, moved,
                                                change=current), [])
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite

Copilot AI review requested due to automatic review settings September 13, 2026 04:22

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

Reconcile the documented 64-hop lineage cap with the unbounded implementation and regression test.

Review details

Suppressed comments (1)

scripts/proposal-support.py:1227

  • The implementation and the 70-hop regression test explicitly make the lineage unbounded, but the PR description says a _LINEAGE_HOP_LIMIT = 64 exists and that deeper lineages refuse. Please reconcile this contract before merge—either implement/test the cap or update the description and acceptance notes to state the intentional unbounded behavior.
    ITERATIVE, WITH A `seen` MEMO, rather than recursive: the lineage is
    finite (every hop is bounded by a strictly earlier commit, and no commit
    is its own ancestor), so no cap on its depth is needed and none is
    imposed — a cap would be a refusal for a packet renamed often but
    lawfully, and "renaming a DRAFT change is unaffected" has no number in it
    (raised by the review bench on PR #1024).
  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
C Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@brettheap

Copy link
Copy Markdown
Contributor Author

Lane: openxfactory-1 (openXfactory-1)

FREEZE

  • Head 2bc60386b074d35b16b2df3a418df0f6ad4fe148 (pushed 04:22:18Z; origin/main 9378eca5 merged in at 27970e10, and still an ancestor at the last guard-fetch).
  • Review threads 8 / 0 unresolved — counted through GraphQL, not by eye. Every thread carries a reply that names the commit which took it and a measurement behind the claim.
  • closingIssuesReferences = []. This PR says refs #1003 and nothing else in any commit message, the description or any reply; the issue stays open for Brett Heap to close.
  • Required checks: six of six PASS on this head — pytest-suite run 34737730962 (success, 14m44s), lane-line, openspec-cli-pin, release-tag-gate, signed-execution-chain-gate, wallet-validation. Advisory and green besides: clearing-dispatch-gate, merge-master-approval, openreposhape-pin. Sourcery review skipping. SonarCloud Code Analysis FAILS — refused with a measurement below.
  • mergeStateStatus reads BLOCKED and reviewDecision REVIEW_REQUIRED: that is the code-owner approval, not a check. Not draft, MERGEABLE.

The bench, closed

round on findings taken in
1 50bc03a9 3 — the predecessor scan bounded to the current path incarnation; _commits_touching's failed git log read as an empty history; <hop>^ reading only the first parent a90e6ccd
2 a90e6ccd 4 — git_show_text flattening ABSENT into UNREADABLE at the incarnation boundary; or [] on the current name's enumeration; renamed_from flattening the same two; the description's _LINEAGE_HOP_LIMIT = 64 contradicting an unbounded walk acaffe97 (code) + the description rewrite on this PR
3 5886ca39 1 — partial_checkout defined twice in the test class 2bc60386, pushed ~30s before that review posted; the two crossed
4 2bc60386 0 new comments; one suppressed re-flag of the depth-cap contradiction, computed against the description as it stood BEFORE the rewrite closed

The round-4 re-flag is REFUSED as already taken: the description was corrected at 04:25Z (see "A correction to this description" in the body, and the reply on the PRRT_kwDOTAvnrs6h1vCG thread), and ratifying_commit's docstring carries the same paragraph. Nothing in the code changed for it, because the code was right and the description was not.

SonarCloud: ONE finding, refused with a measurement

Quality Gate ERROR on new_security_rating 3 (threshold 1), from exactly one issue: pythonsecurity:S8705 "Command Argument Injection via faulty LLM-supplied CLI arguments", scripts/proposal-support.py:757-761 — the git ls-tree call in _path_present. Measured, not argued:

  • There is no shell. All 14 subprocess.run calls in the module pass a LIST argv and none passes shell=True (grep -c 'shell=True' → 0), so no metacharacter in any operand is interpreted by anything.
  • Neither operand can be read as an option. The call is git ls-tree --name-only --end-of-options <revision> -- <rel>: --end-of-options guards the revision and -- guards the path. That is the module's standing defence, and this branch ADDS to it rather than diluting it — --end-of-options appears 6 times on this branch against 4 on origin/main.
  • The command is read-only plumbing. git ls-tree lists a tree; it writes nothing, and it is invoked with check=False so a refusal is a return value, not an exception.
  • The flow the rule objects to already exists on origin/main, where the same gate passed. On main, ratified_under_a_former_path takes former out of git's own rename pairing (line 755) and hands it straight back to git as an argv operand (git_show_text, line 758). The new sink is new code, not a new shape.
  • The line already carries this module's # NOSONAR: argv is allowlisted; shell is disabled marker, which the security engine's rule class does not honour. Clearing the gate would take a SonarCloud act on the shared project, which this lane does not take; it is named here instead so whoever lands can rule on it.

What the continuation rounds put on the record

acaffe97 made every read under the walk fail closed (_pairing_at, _path_present, _readable_blob, _unreadable_history, and the baseline read in origin_retention_errors), with two partial-checkout fixtures built on a real --filter=blob:none clone whose promisor is cut. 5886ca39 pinned the two reads that pass were deliberately left alone — _accept_declaration_problems — by deleting a blob object out of .git/objects and asserting the acceptance is refused, and that the baseline read refuses before any disposition is consulted. 2bc60386 removed a shadowed duplicate helper and narrowed a comment to what was measured.

Figures on the head: pytest tests/proposal-support -q 142 passed, 72 subtests, against 129 passed, 72 subtests on a control clone at origin/main 9378eca5. proposal-support.py . verify exit 0. doc-health.py --single-repo branch vs that control: both exit 0, both 328 lines, identical once the repo-identity token is normalised. openspec validate --all --strict: 104 passed / 3 failed on both, the same three disposition-codexfactory-* packets.

Not landing, not closing the issue, not deleting the branch — the lane stops here.

@brettheap

Copy link
Copy Markdown
Contributor Author

Lane: openxfactory-1 (openXfactory-1)

CLOSED in favor of the option-2 packet — lane openxfactory-1, session 3da6c3f9@Eagle, 2026-09-13T04:45:57Z.

Brett Heap's RULING on #1003 (2026-09-13T03:0xZ, verbatim "option 2 on 1003 with the fix"; record at #1003 (comment), echoed on this PR at #1024 (comment)) selects the former-id declaration mechanism, fail-closed on an undeclared rename arrival, plus an interim docstring-and-fixture pin of the multi-hop gap. It names this PR as the option-1 shape that is NOT selected, and leaves redirect-or-close to this lane as #1003's claim holder. This lane's call is CLOSE: openxFactory refuses non-fast-forward pushes, so a redirect would stack revert commits on top of a walk the ruling says is deleted when the mechanism lands. A clean successor is the smaller record.

What stands from this PR:

Successors, both this lane's under the standing #1003 claim:

  1. OpenSpec change add-declared-former-id over release-realization, the option-2 remedy. PR to follow. Ratification is Brett Heap's word.
  2. Interim plain-fix PR on fix/1003-interim-pin-multi-hop-gap: ratifying_commit's docstring names the multi-hop gap as deliberate and a fixture pins it, the The origin-retention walk refuses a moved path instead of silently re-basing to the rename commit #846 precedent.

refs #1003

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