Skip to content

Realize refine-demote-round-trip-mechanics: origin resolution, returned-artifact headers, fence-aware authorship, enriched demote slot - #221

Merged
brettheap merged 5 commits into
mainfrom
change/refine-demote-round-trip-mechanics
Aug 20, 2026
Merged

brettheap merged 5 commits into
mainfrom
change/refine-demote-round-trip-mechanics

Conversation

@brettheap

Copy link
Copy Markdown
Contributor

Realizes the ratified change refine-demote-round-trip-mechanics (ratified 2026-08-19, PR #218). All four parts, plus two in-session rulings recorded in the proposal front matter.

What this does

  1. Origin resolution: generator._change_entry resolves origin_staging_id from the change's own .openspec.yaml origin block (kind: staged, first path segment below ideation/staging/), with the pick-edge fallback retained and explicit --staging-topic still first. Measured blast radius disclosed in the proposal: 35 changes gain a value (4 active + 31 archived), 16 new renderable wheel edges, 19 dangling values dropped by link().
  2. Returned artifacts (in-session ruling, recommended option adopted): the demote adds Status: draft to returned governed markdown lacking a header, and staged to a header-less live primary fragment (same expression as the restore arm, so the two cannot drift), via the sanctioned decode arm — per-line endings preserved, additions recorded in DemotionExecution.status_headers_added and the topic README. The whole-folder forward transition of a returned topic no longer refuses; the driven test runs on the real 93-of-94 header-less shape with no isolation. The delta carries a named carve-out so the byte bound and the code cannot disagree.
  3. Proposed by: record: the forward transition's update is fence-aware and anchored to the status header's block; pre-existing duplicates collapse to exactly one line naming the latest change; the demote's bounded refresh stays untouched (mutation-pinned from both sides). The two gates now share one status grammar (strict, fence-aware, no 15-row window) — 11-of-1133 reader disagreements before, 0 after.
  4. State-at-demote slot: carries task_progress beside the status (active — 2 of 4 tasks done); absent progress renders the status alone.

Verification

  • Build → adversarial Opus review → fix → focused re-verify, three laps; the final lap closed with one documentation item and no code change.
  • 35 mutations run, 35 killed (each anchored-and-asserted before applying); the reviewer independently re-ran 8 of them.
  • Live lap proof: forward → demote (no --staging-topic) → whole-folder forward again, exit 0 end-to-end, on both the builder's and the reviewer's independent fixtures.
  • Gates: openspec validate --all --strict 63/63; tests/ideation-dashboard 3539 passed; tests/proposal-support 28 passed; tests/doc-health exactly the four known pre-existing test_client_identity_composition failures, enumerated, nothing else.
  • doc-health baseline (clone-based, git-backed, no normalization): zero content-driven findings moved.
  • Cross-branch: merges cleanly with change/align-status-reader-to-real-lines in both orders; merged-tree test run green.

target_release: implementation_pending — the change stays ACTIVE until realization evidence is recorded at the archive gate; the banner was updated to state the surface is built on this branch.

🤖 Generated with Claude Code

brettheap and others added 4 commits August 19, 2026 16:03
… round-trip rule

Three defects a full lap turned up after align-demote-to-round-trip-rule, plus
Brett's Decision 3. None of them is the rule; all four are the mechanics around it.

1. ORIGIN RESOLUTION GAINS A DECLARED PRECEDENCE ORDER. `generator._change_entry`
   resolved `origin_staging_id` from possibles-register pick edges alone, and the
   forward transition removes the staging folder those edges point at — so the
   field was None for exactly the changes that had actually reached proposal.
   Measured on this corpus: ZERO pick edges carry a change_id, so the mapping was
   empty. The answer was already on disk and unread: the forward transition writes
   an `origin:` block into the change's own `.openspec.yaml`, and
   `_load_openspec_meta` already parses that file for `_ratifier_of`. This adds a
   reader, not a file read. The topic id is the BASENAME of `origin.path`, not the
   namespaced `origin.id`, so only one place knows the id's shape. Only
   `kind: staged` answers; an ad-hoc origin still resolves nothing and the refusal
   still names `--staging-topic`. An explicitly supplied topic still outranks both.

2. THE DEMOTE'S OWN INDEX NO LONGER BLOCKS THE TOPIC'S NEXT TRANSITION. The
   `<topic>/openspec/INDEX.md` a demote writes carried no `Status:` header, and the
   forward transition refuses governed markdown without one — the reverse
   transition leaving a landmine for the next lap of the very cycle it is half of.
   It now carries `Status: draft`: the state it shares with the returned drafts it
   lists, regenerated by the next demote rather than the durable evidence `record`
   would claim (design Decision 2). Driven, not asserted — the new test demotes a
   topic and then runs the REAL forward transition over the whole folder.

3. THE PROPOSAL GATE RECORDS ITS AUTHORSHIP ONCE PER DOCUMENT. `proposed_content`
   rewrote `Status: staged` into `Status: draft` plus a `Proposed by:` line, so a
   document making its second lap collected a second line and its third a third.
   It now UPDATES an existing line. The fix sits on the gate that WRITES the line
   and deliberately not on the demote's refresh: that refresh is ratified as bounded
   to the provenance slots and the marked sections, "leaving every other byte of
   that file unchanged", and deduping a header there would trade a data-loss
   guarantee for tidiness (design Decision 3). A regression test pins that boundary.

4. THE STATE-AT-DEMOTE SLOT CARRIES TASK PROGRESS (Brett's Decision 3).
   `plan_demotion` refuses any change that is not active, so the slot could only
   ever read `active`. `DemotionPlan` now carries `task_progress` beside
   `status_at_demote` — snapshot-derived, because the executor never sees a
   snapshot — and the slot renders `active - 9 of 22 tasks done` as plain prose.
   A change recording no tasks renders the status ALONE, never `active -
   unavailable`: the ratified unavailable rule is about a value that could not be
   RESOLVED, and a change with no tasks has none to resolve.

Gates: `openspec validate refine-demote-round-trip-mechanics --strict` and
`--all --strict` (63/63) green; `tests/ideation-dashboard` 3504 passed / 6 skipped;
`tests/proposal-support` 19 passed; `tests/doc-health` 661 passed with exactly the
four known pre-existing `test_client_identity_composition.py` failures; doc-health
full run baseline-identical; 14 mutations run against the non-obvious bites, 14
killed.

Realization evidence for the archive gate is NOT recorded here (task 7.2) —
`target_release: implementation_pending` means this does not archive on landing.

Co-Authored-By: Claude Fable 5 <[email protected]>
…tifact half, and four demonstrated defects

Adversarial review returned FIX-FIRST. Brett ruled on the deferred item and the
reviewer demonstrated four more defects; all are addressed here.

THE RULING (Brett, 2026-08-19, in-session multiple choice, recommended option
adopted): the returned-artifact half of the whole-folder requirement is realized
in this change. My narrow reading — that "an artifact the reverse transition
wrote" meant only the ones it authors — was rejected: `execute_demotion_plan`
literally writes `tasks.md` into the topic, the purpose clause says "returned
material" and "left behind" rather than "authored", and the scenario's THEN is an
unqualified whole-folder outcome. Decisively, the "ratified byte-exact-move
guarantee" I cited DOES NOT EXIST in ratified text; the only line-ending
requirements are about the destination fragment refresh.
`test_a_crlf_document_survives_a_demote_move_byte_exactly` was a wave-re-review
regression pin, not contract, and is updated to the new contract.

So the demote's move arm now adds `Status: draft` to any returned governed
markdown that lacks a header, through the SAME decode arm the status flip uses,
each line keeping the ending it had. Measured at 8426dbc (this branch's own base)
by the forward gate's own reader — a `Status:` line outside every fence: 93 of 94
`tasks.md`, 154 of 158 spec deltas, 65 of 68 `design.md` and 49 of 94
`proposal.md` carry none, so nearly every returned change artifact blocked the
next lap. The INDEX was merely the first offender in sorted order, which is how
the rest stayed hidden. The header goes inside a `---` front-matter block where one opens the
document (which is where the one real hand-fixed returned topic in the corpus
carries it) and under the leading title otherwise. Additions are RECORDED, in the
execution result and by name in the topic README. Task 2.2's driven test drops
its isolation and runs on the real header-less shape.

C1 — the `Proposed by:` reader was fence-blind and header-unanchored. A record
inside a code fence both SUPPRESSED adding the real one (against this change's
own ADDED scenario "the record MUST be added") and got silently rewritten to name
the current change; a record far below the header was rewritten in place, leaving
the header block with none. Both readers are now fence-aware and the record is
anchored to the status header's own block. `Status:` detection is fence-aware for
the same reason and because the block cannot be located without it.

C2 — `^Status:\s*staged\s*$` consumed the newline after the header (`\s*` is
greedy, `$` is satisfied one line later), deleting a human's blank line between
the header block and the body on every lap. The rewrite is row-based now, so
nothing outside the two lines this gate owns is touched. Pinned by line count.

C3 — pre-existing duplicate records are collapsed to exactly one naming the
current change, outside fences. The ratified requirement is unconditional;
refreshing one of three and leaving two stale satisfies the letter of an update
and none of the point. The demote's bounded refresh stays untouched.

C5 — `origin.path`'s topic is the first segment below `ideation/staging/`, not
the path's basename. The forward gate accepts any directory below the staging
root, so a declared `ideation/staging/<topic>/openspec` resolved to `openspec` —
a folder nobody named, into which the demote would then plan every returning file.

Also: the status line no longer loses its `\r` in either arm (the should-fix,
taken rather than renaming the test around it); `state_at_demote` guards a
progress record that does not add up; the proposal's scope sentence is corrected
from "four changes" to the measured 35 (4 active + 31 archived) with the 16 new
renderable wheel edges named; task 1.5's premise is corrected in place rather than
left ticked as work done, because no pin reads the field at all; and the mover
joins the fence-agreement test as the FOURTH implementation of the one ``` rule.

Gates: `openspec validate refine-demote-round-trip-mechanics --strict` and
`--all --strict` (63/63) green; tests/ideation-dashboard 3523 passed / 6 skipped;
tests/proposal-support 28 passed; tests/doc-health 661 passed with exactly the
four known pre-existing `test_client_identity_composition.py` failures;
doc-health full run baseline-identical; 27 mutations run, 27 killed — two of the
first round were mis-aimed and one exposed a real coverage hole (the kind gate was
covered only by a case the path guard also refused), which is now its own test.

Co-Authored-By: Claude Fable 5 <[email protected]>
… status grammar, and the collapse's stated scope

R1 (MUST FIX) — MY DECLARED-NOT-DONE CLAIM WAS FALSE, and the reviewer
demonstrated it. I wrote that the outline was out of scope because its source
always arrives carrying a status header. That is true of the SNAPSHOT the restore
arm applies and false of the LIVE FRAGMENT the refresh-in-place arm reads: a
document the human owns, which never passed the forward gate and so never had to
acquire one. Reproduced here before fixing — a header-less working outline demoted
cleanly (`outline_refusal: None`), was written back with no header, and left the
topic one-way, the next whole-folder transition refusing on
`ideation/staging/<topic>/<topic>.md` itself.

The refreshed outline bytes now go through `_add_status_header`. The VALUE is
`staged`, not the `draft` returned change artifacts get, and it is taken from the
same expression the restore arm uses (`outline.status_flip or STAGED_STATUS`) so
the two arms cannot drift — the ratified rule is explicit that a returning file
whose destination is the topic's declared primary fragment keeps `Status: staged`
and MUST NOT be flipped to draft. Not ambiguous, so not escalated. Because the add
DEFERS to an existing header, a live fragment's own status is still never
rewritten; only its absence is filled. The preserved-snapshot copy the same arm
writes gets the same treatment at `draft`.

R2 (SHOULD FIX) — `gate_console._status_row` (15-row window, fence-blind, prefix
match) disagreed with the forward gate's `proposal-support._status_row` (whole
document, fence-aware, strict) on 11 of the corpus's 1133 markdown documents.
Ten are documents the forward gate REFUSES but the demote judged headed — seven
archived-change evidence artifacts carrying `Status: record · …` /
`Status: record (in progress — …)`, plus `docs/notebooklm-sync-open-item.md` and
two `specs/007-client-identity-roster/` ruling docs — and one
(`.specify/memory/constitution.md`) disagrees the other way, a real header the old
window could not see, where the demote would have inserted a SECOND one beside it.
Aligned to the gate's grammar; the two readers now disagree on 0 of 1133, and they
are pinned against each other in the same file as the fence-flag agreement test.

The alignment also stops `_flip_status` overwriting a line like
`Status: record (in progress — …)`, which was silent data loss dressed as a status
flip. That moved one existing pin:
`test_a_form_feed_in_a_status_line_does_not_invent_a_line_boundary` asserted the
flip replaced a whole malformed row with a bare value, discarding the human's
trailing text. Its real property — no invented line boundary — is unchanged and
still asserted; the assertion that pinned the discarding is replaced by one
showing the text survives, plus the composed flip+add still satisfying the
ratified "the restored fragment MUST carry `Status: staged`".

P1 — the collapse's scope is now stated where a reader meets it rather than left
to be inferred from code: it removes unfenced `Proposed by:` lines ANYWHERE in the
document, not only in the header block, because "exactly one such record" is
unconditional and a stale record in the body is as ambiguous as one in the header.
Only the KEPT record is anchored to the header block. Measured, not estimated: 0
of 1133 corpus documents carry a second such record or one outside their header
block today. Recorded in the document-lifecycle delta (with a scenario) and in
`record_authorship`'s docstring.

Gates: `openspec validate refine-demote-round-trip-mechanics --strict` and
`--all --strict` (63/63) green; tests/ideation-dashboard 3539 passed / 6 skipped;
tests/proposal-support 28 passed; tests/doc-health 661 passed with exactly the
four known pre-existing `test_client_identity_composition.py` failures; doc-health
full run baseline-identical against this branch's own base, so R2 stands as a code
fix rather than a recorded disposition; 35 mutations run, 35 killed (8 new, one
per new behavior including both header-value arms and all three reader relaxations).

Co-Authored-By: Claude Fable 5 <[email protected]>
…the delta that pins it

Documentation only — no code or test changes.

The MODIFIED `ideation-dashboard` delta pinned the refresh-in-place arm as
"bounded to the provenance slots and the marked proposal-element sections,
leaving every other byte of that file unchanged", with no carve-out for the
lifecycle status header the reverse transition now adds where a live fragment
carries none. A reader of the promoted text could not predict that insertion —
which is exactly the standard this change's own Ruling-4 reasoning set when it
insisted the enriched state-at-demote slot needed a MODIFIED delta rather than
being absorbed as an implementation detail. Left unstated, the code and the
contract would disagree about a byte the code writes.

Stated as a NAMED CARVE-OUT rather than as a rescoping of the bound to "the
refresh proper". Scoping would have been shorter and worse: it would leave
everything the verb does before the refresh unbounded by implication, which is
the opposite of the guarantee the paragraph exists to make. The carve-out admits
exactly one addition, says why the cycle cannot work without it, ties it to the
execution record, and closes with the bound restated so nothing else may be
written.

Added to the requirement prose, plus a scenario for the case the existing
differs-case scenario does not cover (the fragment carrying no header at all),
plus the matching `- **AND**` obligations. Task 3.2's unqualified boundary
assertion named the same clause and now names the carve-out too, so the two texts
do not disagree — with the point that an authorship dedupe is still NOT one of
them: that bound admits exactly one addition, and it is the one without which the
topic cannot be transitioned at all.

Gates: `OPENSPEC_TELEMETRY=0 openspec validate refine-demote-round-trip-mechanics
--strict` exit 0, `--all --strict` exit 0 (63/63).

Co-Authored-By: Claude Fable 5 <[email protected]>
Copilot AI lite review requested due to automatic review settings August 20, 2026 01:01

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hi @brettheap! 👋

Your private repo does not have access to Sourcery.

Please upgrade to continue using Sourcery ✨

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Implements the ratified refine-demote-round-trip-mechanics change across the forward gate (proposal-support.py), the reverse gate (ideation_dashboard.gate_console), and snapshot generation (ideation_dashboard.generator), with expanded tests and updated OpenSpec change artifacts to match the realized mechanics.

Changes:

  • Add declared-origin (.openspec.yaml origin.path) precedence for origin_staging_id, ahead of pick-edge fallback.
  • Make demotion return paths transitionable by ensuring returned governed Markdown has lifecycle Status: headers (plus aligned, fence-aware status/authorship parsing between gates).
  • Enrich the demote provenance slot (Status at demote) with task progress (active — X of Y tasks done) when available.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/proposal-support/test_proposal_support.py Adds focused tests for fence-aware, CRLF-safe, anchored/deduped Proposed by: handling in the forward gate.
tests/ideation-dashboard/test_round_trip.py Pins the proposal-support mover’s fence and line-splitting behavior against other implementations.
tests/ideation-dashboard/test_generator.py Adds tests for origin-staging resolution precedence and path-shape edge cases.
tests/ideation-dashboard/test_gate_console.py Expands demote tests for added status headers, execution recording, and enriched state-at-demote slot behavior.
scripts/proposal-support.py Introduces split-keepends + fence primitives; implements anchored/deduped authorship recording and strict status parsing.
scripts/ideation_dashboard/generator.py Implements declared staged-origin parsing from .openspec.yaml and uses it to populate origin_staging_id.
scripts/ideation_dashboard/gate_console.py Aligns status-header grammar with the forward gate; ensures returned Markdown is headered; enriches demote slot via task progress.
openspec/changes/refine-demote-round-trip-mechanics/tasks.md Updates the change’s task checklist to reflect completed/measured work and the in-session ruling scope.
openspec/changes/refine-demote-round-trip-mechanics/specs/ideation-dashboard/spec.md Updates the demote rule contract with the explicit header-add carve-out and new scenario coverage.
openspec/changes/refine-demote-round-trip-mechanics/specs/document-lifecycle/spec.md Specifies unconditional collapse scope for Proposed by: records outside fences.
openspec/changes/refine-demote-round-trip-mechanics/proposal.md Updates proposal metadata and impact notes to match realized behavior and the recorded ruling.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread scripts/ideation_dashboard/generator.py Outdated
Comment on lines +292 to +295
parts = [part for part in path.strip().split("/") if part not in ("", ".")]
if parts[:2] != ["ideation", "staging"] or len(parts) < 3:
return None
return parts[2]
brettheap pushed a commit that referenced this pull request Aug 20, 2026
Prose-only, per the reviewer's final pass and an explicit constraint:
scripts/proposal-support.py is NOT edited here, because the sibling branch
change/refine-demote-round-trip-mechanics (PR #221) has already rewritten
exactly the sites this finding names, and any edit here would manufacture
a merge conflict with work that supersedes it.

F7 (demonstrated, recorded in tasks.md 7.5, ruled out of scope for
conversion): proposal-support.py carries two lifecycle-Status: readers and
one writer on unshared rules -- proposed_content's reader (LF-only re.M,
raises SupportError on a plain CR-only file), the writer beside it
(LF-only re.sub), and _declares_staged_status (pseudo-line splitlines plus
its own fence toggle). Out of scope because the promoted delta's
requirement is titled "The deterministic pass reads a document's lifecycle
header by real lines" and its purpose clause is about what THE PASS
reports -- proposal-support is a standalone mover reporting nothing to the
pass, so it was never inside the requirement's boundary. Distinguished
from a broken twin on a second ground: the reader's 251-of-1227 divergence
from corpus.parse_status is its own pre-existing CONTRACT difference
(single-token/unbounded values), not a regression the line rule causes --
the line-rule divergence proper is the same 0-of-1227 latent shape as
every other deferred item.

Fetched and read the sibling branch's version of the file to confirm what
the merged tree will actually have: it carries its own fourth private
real-line/fence primitive (_split_keepends/_fenced_flags), a fence-aware
row-based _status_row/record_authorship pair replacing the LF-only re.M
reader/writer entirely, _declares_staged_status moved onto the same
primitive, and a new "FOURTH implementation" entry in
test_round_trip.py's shared-fixture fence agreement test. One stale spot
survives even there -- _declares_staged_status's docstring still points at
"families._scan_lines already tracks fences for the same reason" without
saying which aspect (fence-tracking, not the real-line split) is meant --
recorded as a one-line follow-up for after both branches merge, not fixed
on either branch now.

code_surface: the unqualified "EVERY reader of a governed document's
lifecycle header" replaced with the actual boundary the delta draws --
the deterministic pass and the dashboard readers scan real lines through
the shared primitive -- pointing at tasks.md 7 for the recorded
exceptions, so this archive-gate input stops overclaiming past what the
requirement's own title and purpose clause cover.

Co-Authored-By: Claude Fable 5 <[email protected]>
…pelling on the way in

Copilot's inline finding on PR #221, and it is real. The forward transition wrote
the staged origin's path as `str(source.relative_to(root))`, which on a Windows
checkout yields `ideation\staging\<topic>`, while
`generator._declared_origin_staging` splits that field on `/` alone. Origin
resolution would silently fail there — degrading to the `--staging-topic` refusal
rather than corrupting anything, but silently, which is the half that matters: the
demote would go back to asking for a topic it has recorded on disk.

Normalized at BOTH ends, because each end fixes a different half.

THE WRITER records POSIX (`relative_to(root).as_posix()`). The origin path is a
machine-readable record other tools split on `/` — this generator resolves the
demote's destination topic from it, and doc-health's `proposal-origin` family
joins it to a repo root — so its spelling must not depend on the operating system
of whoever ran the gate. The manifest records the same value twice
(`origin.path` and the top-level `origin_path`, the latter being what doc-health
reads); both now come from ONE derivation, so a manifest cannot contradict itself
about the path it came from.

THE READER tolerates backslashes anyway. Fixing the writer cannot reach records
already on disk, so the reader normalizes rather than assuming its own spelling.
It does mean a POSIX directory whose name legally contains a backslash would be
split — an absurd case traded for a real one, and the staged-origin id grammar
does not admit it. `origin_errors`'s own coherence check got the same one-line
normalization: a backslash-spelled path joined to one nonexistent component
there, so `is_dir()` failed and the check SKIPPED instead of running, and a check
that silently does not run is worse than one that fails.

MEASURED, NOT ASSUMED: 0 of 102 origin/manifest files in this repo carry a
backslash-spelled path field, so this changes no behavior on this corpus and none
at all on POSIX. Stated plainly because the honest justification is the record
format, not an observed failure — the gate has only ever run here on POSIX.

Tests: the existing nested-path case is parametrized with two backslash spellings
rather than growing a Windows test family, plus one writer test on the recorded
value. That writer test also pins the SOURCE, and deliberately: on POSIX
`str(PurePath)` and `as_posix()` return the same string, so a regression to
`str()` passes every value assertion on every Linux CI run and the defect appears
only on the platform the suite does not execute. Mutation-checked — reverting the
writer to `str()` and re-deriving `origin_path` independently both SURVIVED the
value assertions and are killed by the structural ones.

NOT TOUCHED, and named rather than left implicit: the manifest's `files[]`
entries (`source_path`, `path`, `source_snapshot_path`) and `remaining_paths` are
still `str(...)`. They are the same defect class, they feed recorded sha256s and
the archive verify round-trip, and changing them is a different change with its
own evidence. Out of scope here, not overlooked.

Gates: `openspec validate refine-demote-round-trip-mechanics --strict` exit 0,
`--all --strict` exit 0 (63/63); tests/ideation-dashboard 3541 passed / 6 skipped
exit 0; tests/proposal-support 29 passed exit 0; 38 mutations run, 38 killed.

Co-Authored-By: Claude Fable 5 <[email protected]>
Copilot AI review requested due to automatic review settings August 20, 2026 01:22
@brettheap
brettheap merged commit 6c3d87c into main Aug 20, 2026
1 check passed
brettheap pushed a commit that referenced this pull request Aug 20, 2026
Prose-only, per the reviewer's final pass and an explicit constraint:
scripts/proposal-support.py is NOT edited here, because the sibling branch
change/refine-demote-round-trip-mechanics (PR #221) has already rewritten
exactly the sites this finding names, and any edit here would manufacture
a merge conflict with work that supersedes it.

F7 (demonstrated, recorded in tasks.md 7.5, ruled out of scope for
conversion): proposal-support.py carries two lifecycle-Status: readers and
one writer on unshared rules -- proposed_content's reader (LF-only re.M,
raises SupportError on a plain CR-only file), the writer beside it
(LF-only re.sub), and _declares_staged_status (pseudo-line splitlines plus
its own fence toggle). Out of scope because the promoted delta's
requirement is titled "The deterministic pass reads a document's lifecycle
header by real lines" and its purpose clause is about what THE PASS
reports -- proposal-support is a standalone mover reporting nothing to the
pass, so it was never inside the requirement's boundary. Distinguished
from a broken twin on a second ground: the reader's 251-of-1227 divergence
from corpus.parse_status is its own pre-existing CONTRACT difference
(single-token/unbounded values), not a regression the line rule causes --
the line-rule divergence proper is the same 0-of-1227 latent shape as
every other deferred item.

Fetched and read the sibling branch's version of the file to confirm what
the merged tree will actually have: it carries its own fourth private
real-line/fence primitive (_split_keepends/_fenced_flags), a fence-aware
row-based _status_row/record_authorship pair replacing the LF-only re.M
reader/writer entirely, _declares_staged_status moved onto the same
primitive, and a new "FOURTH implementation" entry in
test_round_trip.py's shared-fixture fence agreement test. One stale spot
survives even there -- _declares_staged_status's docstring still points at
"families._scan_lines already tracks fences for the same reason" without
saying which aspect (fence-tracking, not the real-line split) is meant --
recorded as a one-line follow-up for after both branches merge, not fixed
on either branch now.

code_surface: the unqualified "EVERY reader of a governed document's
lifecycle header" replaced with the actual boundary the delta draws --
the deterministic pass and the dashboard readers scan real lines through
the shared primitive -- pointing at tasks.md 7 for the recorded
exceptions, so this archive-gate input stops overclaiming past what the
requirement's own title and purpose clause cover.

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.

Suppressed comments (3)

scripts/proposal-support.py:275

  • origin_errors joins origin.path into a filesystem path without guarding against absolute paths or .. traversal. A malicious or malformed .openspec.yaml could make staging_header_id probe outside the repo root (e.g. /etc on POSIX or C:\\... on Windows), which is unsafe for a gate check.
            # Same normalization as `generator._declared_origin_staging`, and for
            # the same reason: a backslash-spelled path recorded on a Windows
            # checkout joins to one nonexistent component here, so `is_dir()`
            # fails and this coherence check SKIPS instead of running. A check
            # that silently does not run is worse than one that fails.
            header = staging_header_id(root / str(opath).replace("\\", "/"))
            if header is not None and header != oid:
                errors.append(
                    f"{name}: staging folder {opath!r} exists but its "
                    f"`Staging ID:` ({header}) does not equal the declared "
                    f"origin id ({oid})")

scripts/ideation_dashboard/generator.py:305

  • _declared_origin_staging will treat malformed staged-origin paths that contain traversal segments (e.g. ideation/staging/topic/../other) or a leading / as valid and still resolve a topic. That contradicts the docstring’s “malformed declaration answers NOTHING” and can send demotions to the wrong topic.
    normalized = path.strip().replace("\\", "/")
    parts = [part for part in normalized.split("/") if part not in ("", ".")]
    if parts[:2] != ["ideation", "staging"] or len(parts) < 3:
        return None
    return parts[2]

scripts/ideation_dashboard/gate_console.py:428

  • _add_status_header only searches up to HEADER_SCAN_LINES for the closing --- delimiter. If a document has a longer (but valid) front-matter block, the function will fall through and insert Status: before the front matter, breaking the front-matter contract described in the docstring.
    if rows[0][0].strip() == "---":
        for i in range(1, min(len(rows), HEADER_SCAN_LINES)):
            if rows[i][0].strip() == "---":
                rows.insert(i, (f"Status: {new_status}", eol))
                return round_trip.join_rows(rows), True

brettheap pushed a commit that referenced this pull request Aug 21, 2026
6.1: README's Active row was stale (still named edit-apply as Q4's verb,
silent on sections 1-4 landing and the two follow-on changes task 4.2's
driven round trip spawned). Updated with the Amendment 1 correction,
sections-1-4-realized status, and the align-demote-to-round-trip-rule /
refine-demote-round-trip-mechanics / align-status-reader-to-real-lines
chain (PR #221, #222).

6.2: the staging fragment itself was already consumed by the 2026-08-15
forward transition (folder empty, supporting-docs copy already carries
Status: draft + Proposed by: + its own exit note) — that half discharges
by verification. INDEX.md's summary row and detail-section Q4 mention
were still stale; both corrected to name edit-document and record the
exit/ratified/realized status.

6.3: Amendment 1's Q4 correction (edit-document, not edit-apply, which
cannot reach a session branch) was never handed to doxbench-editing-model.
Phase A shipped without the upgrade and Phase B's tasks don't mention it
either, so — following the F2 carve-out precedent already in this corpus —
the handoff note lands on the staged topic's own fragment for a successor
change to find.

Co-Authored-By: Claude Fable 5 <[email protected]>
brettheap pushed a commit that referenced this pull request Aug 21, 2026
Copilot's review comment on PR #225 is right, and the false claim was mine —
introduced in `b6b2e16`, this branch's own 7.5 follow-up, not carried in from
PR #221. Confirmed by `git log -S "cannot import the primitive"`, which returns
that one commit.

WHAT WAS FALSE. The docstring said "this module cannot import the primitive",
which reads as a hard technical constraint. It is not one.
`scripts/bootstrap-ideation-cross-reference.py` is a standalone script living
directly under `scripts/` exactly as this one does, and it imports
`doc_health.lines` at module level on Python's own `sys.path[0]` insertion —
with its own comment recording that the reachability was verified rather than
assumed, during finding F5 on PR #222.

TWO CANDIDATE DISTINCTIONS CHECKED AND BOTH REJECTED, so the reword rests on
measurement rather than on preferring a nicer sentence:

* A copy-out script maintained byte-identical in a repo without this layout
  would genuinely be unable to import. DTN-019 in the neutralization register
  looks like exactly that case — it names
  `xFactories/codexFactory/scripts/proposal-support.py` as evidence. It is
  stale: that file does not exist, because DTN-019's own implementation note
  records the codexFactory SHED (`change/shed-neutral-utility-pack`,
  2026-08-03) that moved the tool here. No sibling copy remains.
* Even if one did, codexFactory carries `scripts/doc_health/`, so the import
  would resolve there too.

So nothing real separates this script's import situation from the bootstrap
twin's, and the honest reason for the local copy is a RULING, not a
limitation: finding F7 in `align-status-reader-to-real-lines` tasks.md 7.5
ruled conversion out of scope because the promoted requirement governs how the
deterministic pass reads a lifecycle header, and this is a standalone mover
that reports nothing to that pass. The docstring now says that, names the
sibling that proves the import is available, and points at what actually makes
the choice safe — the agreement tests
(`test_the_mover_agrees_with_the_other_fence_implementations`,
`test_the_movers_line_split_is_the_three_real_endings_and_nothing_else`) that
pin the local copy to the shared rule.

The script is NOT converted. That stays the recorded F7 boundary and would be a
code change beyond an archive branch.

Prose only, one docstring. `openspec validate --all --strict` exit 0 at 62/62;
`tests/proposal-support` plus `tests/ideation-dashboard/test_round_trip.py`
exit 0 at 103 passed.

ONE ADJACENT CLAIM LEFT ALONE, recorded rather than quietly fixed: the
block comment at lines 32-45 (PR #221's, not mine) says sharing the code "is
not available ... this file is a standalone script a human runs against a
checkout that may not have the dashboard package importable". That is hedged
("may not") and is a claim about a checkout state rather than an impossibility,
so it is not the same defect; it also names the dashboard package rather than
`doc_health`. Left for whoever revisits the F7 boundary, since this commit is
scoped to the one false sentence.

Co-Authored-By: Claude Fable 5 <[email protected]>
brettheap pushed a commit that referenced this pull request Aug 21, 2026
…ap green)

The release-realization archive gate is satisfied: the code is merged on the
implemented target as PR #221 (merged 2026-08-20T01:23:54Z, rebase-merge, so the
branch's five commits landed on main directly) and green there. Re-verified at
`7312c25` rather than taken from the PR run: `openspec validate --all --strict`
exit 0 at 64/64, `tests/ideation-dashboard` + `tests/proposal-support` exit 0 at
3729 passed / 14 skipped, `tests/doc-health` clean over 691 items. The
realization proof is the one this thread has earned twice over — a full LAP on a
scratch tree, forward then demote then forward again, with the origin resolved
from the change's own `.openspec.yaml` origin block and no operator workaround.

MECHANICS, following `align-demote-to-round-trip-rule`'s archive precedent:

* `OPENSPEC_TELEMETRY=0 openspec archive refine-demote-round-trip-mechanics
  --yes` from the openxFactory root — the bare CLI, not `proposal-support.py
  archive`. The wrapper packages `supporting-docs.tar.gz` + manifest, and this
  change owns no `supporting-docs/` (ad_hoc origin, born from driving both
  gates), so the wrapper would add a synthetic empty bundle for no benefit.
* Folder moved to `openspec/changes/archive/2026-08-21-refine-demote-round-trip-mechanics/`.
* Deltas promoted: one MODIFIED and two ADDED on `ideation-dashboard`, one ADDED
  on `document-lifecycle`. The returned-artifact carve-out text landed intact —
  the EXACTLY-ONE-addition paragraph carved out of the refresh's byte bound.
* `--all --strict` reads 62 items at the end of this branch where it read 64 at
  its base: the two changes leave the active set and their requirements land
  inside capabilities already counted, so the total drops by exactly two.
* No test broke on the archive MOVES, and that was checked rather than hoped:
  `tests/ideation-dashboard` reads 3700 passed / 14 skipped and
  `tests/proposal-support` 29 passed after both archives — 3729, the same total
  as the combined pre-archive run. Nothing in the suite is pinned to the
  active-changes count, so nothing needed updating.
* The origin-retention gate checked, not assumed: the archived `.openspec.yaml`
  diffs clean against its pre-archive bytes.
* Task 7.2 ticked with the evidence inline. 33 of 35 ticked; §8's two stay open
  BY RULING rather than as gaps, precedented by `add-client-identity-roster`
  archiving with fifteen.

THE BANNER is rewritten to state realization rather than carried through the
rename. That is now precedent rather than deviation — `align-demote-to-round-trip-rule`
established it 2026-08-19 for the same reason: archiving a record whose first
paragraph says "none of it is built" states something false about realized code.

ONE RECORDED CORRECTION, and it contradicts what this gate was told. Task 6.2
instructed its executor to enumerate "four known pre-existing
`test_client_identity_composition.py` failures" and assert the set unchanged.
Those four were never a defect. They fail from any checkout whose absolute path
carries a `.git` directory segment, because
`validate-client-identity-roster.py`'s `sweep_files` filters `.git` by path PART
and so sweeps out every fixture YAML, leaving no consent instrument to resolve.
Three measurements settle it: the same fixture bytes through the same validator
exit 0 from a clean path; the whole suite from a clean-path mirror exits 0 at 684
passed / 7 skipped, the skips being sibling-checkout-dependent tests a mirror
cannot reach; and decisively, the tree at `78f8e01~1` — before the only commit
since 2026-08-19 to touch the validator, the fixtures or the test, and that
commit edits one prose string — passes all 21 cases from a clean path. So no
commit fixed them and none had to. The gate instruction encoded a location
artifact as a property of the corpus, which would have excused a genuine
regression; it is recorded as WRONG in task 7.2 rather than as satisfied. Not a
defect claim against the validator: filtering `.git` is correct for a corpus
sweep, and a validator may assume it is not run from inside a git internal
directory.

Co-Authored-By: Claude Fable 5 <[email protected]>
brettheap pushed a commit that referenced this pull request Aug 21, 2026
…follow-up

Two pieces of bookkeeping that could only land once both parents had merged.

README "OpenSpec Records": `refine-demote-round-trip-mechanics` and
`align-status-reader-to-real-lines` move out of the "Active changes:" block into
"Archived changes:", ahead of `align-demote-to-round-trip-rule` so the three read
newest-first as the thread they are. Links repointed at the dated archive paths.
Each row keeps the RULINGS recorded on it rather than being trimmed to a
summary: refine's §8 pair stay visible as rulings and not gaps (the
shallowest-markdown selection arm deferred until a real topic reaches it, 0 of 31
do; the read-side half handed to the sibling), and align's wide-scope ruling
keeps both halves — the delta's every-reader clause governing over a narrower
first-draft `code_surface:`, and the four readers deliberately left unconverted
because none reads the six lifecycle header fields. Each row closes with the
realization and archive sentence the precedent row uses.

THE 7.5 FOLLOW-UP, which is the reason this waited. `align-status-reader-to-real-lines`
task 7.5 recorded one stale docstring line and explicitly deferred it: reword it
"after BOTH branches merge, whichever lands second — not on this branch, per an
explicit constraint: editing `scripts/proposal-support.py` here would manufacture
a merge conflict with work that already supersedes it." PR #221 merged at
2026-08-20T01:23:54Z and PR #222 twenty seconds later, so this archive branch is
the first place the edit cannot manufacture that conflict.

`_declares_staged_status`'s docstring claimed
"`doc_health.families._scan_lines` already tracks fences for the same reason;
this mirrors it rather than inventing a second convention." Written for
fence-tracking, before `families` was converted to real lines — so a reader could
not tell WHICH convention was being mirrored, and after the conversion both
readings were arguably true, which is worse than one being false. Now it says
which: what is mirrored is the FENCE-TRACKING convention alone, and the line
split underneath is a separate and shared rule — the three real endings — whose
agreement is held by
`test_the_mover_agrees_with_the_other_fence_implementations` and
`test_the_movers_line_split_is_the_three_real_endings_and_nothing_else` rather
than by the docstring's word.

Prose only. One docstring, no behavior change, no test change. F7's
out-of-scope-for-conversion ruling is untouched: this closes the STALE-CLAIM half
of the finding, not the conversion half, which stays ruled out. `tests/proposal-support`
exit 0 at 29 passed.

Co-Authored-By: Claude Fable 5 <[email protected]>
brettheap pushed a commit that referenced this pull request Aug 21, 2026
Copilot's review comment on PR #225 is right, and the false claim was mine —
introduced in `b6b2e16`, this branch's own 7.5 follow-up, not carried in from
PR #221. Confirmed by `git log -S "cannot import the primitive"`, which returns
that one commit.

WHAT WAS FALSE. The docstring said "this module cannot import the primitive",
which reads as a hard technical constraint. It is not one.
`scripts/bootstrap-ideation-cross-reference.py` is a standalone script living
directly under `scripts/` exactly as this one does, and it imports
`doc_health.lines` at module level on Python's own `sys.path[0]` insertion —
with its own comment recording that the reachability was verified rather than
assumed, during finding F5 on PR #222.

TWO CANDIDATE DISTINCTIONS CHECKED AND BOTH REJECTED, so the reword rests on
measurement rather than on preferring a nicer sentence:

* A copy-out script maintained byte-identical in a repo without this layout
  would genuinely be unable to import. DTN-019 in the neutralization register
  looks like exactly that case — it names
  `xFactories/codexFactory/scripts/proposal-support.py` as evidence. It is
  stale: that file does not exist, because DTN-019's own implementation note
  records the codexFactory SHED (`change/shed-neutral-utility-pack`,
  2026-08-03) that moved the tool here. No sibling copy remains.
* Even if one did, codexFactory carries `scripts/doc_health/`, so the import
  would resolve there too.

So nothing real separates this script's import situation from the bootstrap
twin's, and the honest reason for the local copy is a RULING, not a
limitation: finding F7 in `align-status-reader-to-real-lines` tasks.md 7.5
ruled conversion out of scope because the promoted requirement governs how the
deterministic pass reads a lifecycle header, and this is a standalone mover
that reports nothing to that pass. The docstring now says that, names the
sibling that proves the import is available, and points at what actually makes
the choice safe — the agreement tests
(`test_the_mover_agrees_with_the_other_fence_implementations`,
`test_the_movers_line_split_is_the_three_real_endings_and_nothing_else`) that
pin the local copy to the shared rule.

The script is NOT converted. That stays the recorded F7 boundary and would be a
code change beyond an archive branch.

Prose only, one docstring. `openspec validate --all --strict` exit 0 at 62/62;
`tests/proposal-support` plus `tests/ideation-dashboard/test_round_trip.py`
exit 0 at 103 passed.

ONE ADJACENT CLAIM LEFT ALONE, recorded rather than quietly fixed: the
block comment at lines 32-45 (PR #221's, not mine) says sharing the code "is
not available ... this file is a standalone script a human runs against a
checkout that may not have the dashboard package importable". That is hedged
("may not") and is a claim about a checkout state rather than an impossibility,
so it is not the same defect; it also names the dashboard package rather than
`doc_health`. Left for whoever revisits the F7 boundary, since this commit is
scoped to the one false sentence.

Co-Authored-By: Claude Fable 5 <[email protected]>
brettheap pushed a commit that referenced this pull request Aug 21, 2026
The README row and the PR description disagreed about which PRs realized this
change. Neither list was right, so neither was adopted: the answer was
re-derived mechanically from gh pr view --json files, asking of every
candidate whether it edits a file under
openspec/changes/add-staged-topic-outline-template/.

Eight PRs pass that test and are this change's own chain: #193, #195, #198,
#208, #211, #217, #224, #227. The PR description omitted the first three -
they predate the session handoff it was written from - and wrongly claimed
#215, #221 and #222, which fail the test: each touches only its own change's
documents and code, so each belongs to align-demote-to-round-trip-rule,
refine-demote-round-trip-mechanics and align-status-reader-to-real-lines
respectively, all three of which already have archive records carrying their
own evidence. What #217 contributes here is task 4.2 and the archiving of the
first of them, not the fix.

The README row, the proposal banner and the tasks.md evidence section now
state the two categories explicitly and name the test, so the chain can be
re-derived rather than trusted. One exception is recorded rather than left to
surprise a reader: #228 also edited this change's tasks.md, to repoint 5.3 and
6.3 after the doxbench topic exited staging - a cross-change bookkeeping
repoint that discharges no task here.

Co-Authored-By: Claude Fable 5 <[email protected]>
brettheap pushed a commit that referenced this pull request Aug 21, 2026
The README row and the PR description disagreed about which PRs realized this
change. Neither list was right, so neither was adopted: the answer was
re-derived mechanically from gh pr view --json files, asking of every
candidate whether it edits a file under
openspec/changes/add-staged-topic-outline-template/.

Eight PRs pass that test and are this change's own chain: #193, #195, #198,
#208, #211, #217, #224, #227. The PR description omitted the first three -
they predate the session handoff it was written from - and wrongly claimed
#215, #221 and #222, which fail the test: each touches only its own change's
documents and code, so each belongs to align-demote-to-round-trip-rule,
refine-demote-round-trip-mechanics and align-status-reader-to-real-lines
respectively, all three of which already have archive records carrying their
own evidence. What #217 contributes here is task 4.2 and the archiving of the
first of them, not the fix.

The README row, the proposal banner and the tasks.md evidence section now
state the two categories explicitly and name the test, so the chain can be
re-derived rather than trusted. One exception is recorded rather than left to
surprise a reader: #228 also edited this change's tasks.md, to repoint 5.3 and
6.3 after the doxbench topic exited staging - a cross-change bookkeeping
repoint that discharges no task here.

Co-Authored-By: Claude Fable 5 <[email protected]>
@brettheap
brettheap deleted the change/refine-demote-round-trip-mechanics branch August 21, 2026 23:57
brettheap pushed a commit that referenced this pull request Aug 22, 2026
…ne copy of the rule

The reader half PR #221 left behind, found while mapping the surface for the
commit before this one. #221 put the staged origin path into POSIX at the
writer and made two readers tolerant — `origin_errors` and
`generator._declared_origin_staging` — and cited doc-health's `proposal-origin`
family as a third reader that joins that path to a repo root. It fixed the
writer and never came back for that reader.

TWO SITES, and they fail differently. `check_change` resolves the recorded
`origin.path` twice: once through `_git_path_exists` against the manifest's
`source_revision`, and once through `_staging_header_matches` against the
working checkout. On a backslash-spelled record `git ls-tree` matches no entry,
so sound provenance reports as `staged origin path ... does not resolve at the
recorded source revision` — a false ERROR against a folder present in the very
commit named. And `Path(repo) / <that>` is not a directory, so
`_staging_header_matches` returns None and the staging-header linkage check
SKIPS. The false ERROR at least argues with you. The skip is silent, and a
change that really had lost its `Staging ID:` linkage would sail through it —
which is the failure mode #221 itself called worse than one that fails.

ONE NORMALIZATION, TWO USES: `opath_rel` is derived once and handed to both
checks, so they cannot reach different conclusions about the same recorded
path. The findings keep quoting `opath` AS RECORDED, because that is the text
an operator has to go and fix.

HELPER PLACEMENT. `recorded_rel` now lives in `doc_health/__init__.py` and
serves the whole package; `families._manifest_rel` (added in the previous
commit) is collapsed into it. The import direction settles this rather than
taste: `families` imports `proposal_origin`, so the reverse is a cycle, and
`__init__` — which imports no submodule — is the only shared home. The name
widened with the scope: this normalizes a proposal packet's `origin.path` as
well as a manifest's file paths, so `manifest_rel` would have been actively
wrong in `proposal_origin`. TWO copies of the rule remain, one per process
boundary, which is the floor and not an oversight: `proposal-support.py` is a
hyphenated standalone script and cannot be imported. They are pinned to each
other by `test_the_recorded_path_normalizations_agree`, because two readers of
one record that disagree about its alphabet would have one call it sound while
the other called it corrupt.

ONE FUNNEL PER MODULE, so the consolidation is real rather than nominal.
`origin_errors`' strict coherence check kept #221's inline
`str(opath).replace(...)`; it now goes through this module's own
`manifest_rel`, because a record's origin path and the file paths beside it in
the same manifest must not be normalized two different ways. That line also had
NO test — #221 added the normalization and never pinned it, and it has the same
silent-skip failure the family's linkage check has, so it is pinned now.

TESTS. Both spellings parametrized at each site: the linkage check RUNS and
fires on a real mismatch; it runs and stays CLEAN on intact linkage (running is
not the same as firing); a vanished staging folder stays legal history in
either spelling, so tolerance did not turn a correct skip into an accusation;
and the recorded-revision check resolves against a real git fixture rather than
reporting false unresolvable provenance. 7 mutations run, 7 killed — each
`proposal_origin` call site individually, the shared `opath_rel` derivation,
`recorded_rel` reduced to the identity, both families call sites, and
`origin_errors`' newly pinned one.

COMPATIBILITY. No behavior change on this corpus, measured rather than assumed:
the `proposal-origin` and `location-conformance` reports over this repo are
byte-identical before and after, and corpus-wide `proposal-support.py . verify`
remains byte-identical to the pre-change baseline, exit 0.

Gates: tests/doc-health 700 passed with exactly the four known
`test_client_identity_composition` location artifacts; tests/proposal-support 36
passed + 2 subtests exit 0; tests/ideation-dashboard 3875 passed / 14 skipped
exit 0; `openspec validate --all --strict` 65/65 exit 0.

Co-Authored-By: Claude Fable 5 <[email protected]>
brettheap pushed a commit that referenced this pull request Aug 22, 2026
…ling on the way in

The lap PR #221 named and deferred. Its fix put the staged origin path into
POSIX and made the readers tolerant; it closed by naming what it had not
touched — `files[].path`, `files[].source_path`, `files[].source_snapshot_path`
and `remaining_paths`, still `str(Path)` — as the same defect class needing its
own evidence, because those fields feed recorded sha256s and the archive verify
round trip. This is that evidence.

WHAT ACTUALLY BREAKS. Each of those fields is a KEY beside a content hash, and
only the keys are OS-dependent. `verify_active_support` joins `path` and
`source_snapshot_path` to the support folder; doc-health's
location-conformance family joins `path` to the same folder; `source_path`
becomes `<revision>:<path>` for `git show`. On a manifest written by
`str(PurePath)` on a Windows checkout every one of them carries backslashes,
and read anywhere else each is ONE filename that resolves to nothing —
`git blob_sha256` finds no blob (the failure the flag called out by name), the
snapshot lookup misses, and a sound bundle reports as missing files and an
unavailable source revision. The hashes stay correct throughout and can never
be reconciled with anything.

WRITER: one derivation per path. Three distinct paths, three `as_posix()`
values, each field the single value of its own path — and the committed-blob
check keeps reading `entry["source_path"]` back rather than deriving that path
a second time, so an entry cannot contradict itself. `remaining_paths` the
same.

READERS: normalized, because fixing a writer cannot reach a record already on
disk. `manifest_rel` is the one funnel, applied at the two support-folder
lookups, inside `git_blob_sha256` (before the traversal guard, which also stops
`a\..\b` slipping past a check that counts `..` components), and on the archive
manifest's inventory keys — bundle member names are POSIX on every platform, so
the manifest is the only half of that comparison that could arrive in the other
alphabet. doc-health's family gets the same normalization and a test pinning
its local copy to the original, because two readers of one record calling it
sound and corrupt respectively is the worst available outcome; the script is
hyphenated and not importable, which is why the copy exists at all.

THE TRADEOFF IS WIDER HERE than #221's, and saying so rather than reusing its
sentence: a POSIX filename may legally contain a backslash, and the
staged-origin id grammar that ruled the case out there governs an ID, not the
names of files inside a topic — `select_files` takes whatever is in the folder.
Such a file's entry would be read as a nested lookup that misses. The trade is
paid in a LOUD failure (`missing support file`), never a silent pass.

MEASURED, NOT ASSUMED: 53 manifests in this repo (3 active, 21 archived pairs,
9 loose under archive, 20 inside bundles) carry 0 backslash-spelled path
fields, and no tar member name carries one either. Corpus-wide
`proposal-support.py . verify` is byte-identical before and after, exit 0 both
— hashes are content hashes and paths are keys, so the reader normalization is
a no-op on everything that exists. Nothing pins the spelling: no schema, and
document-lifecycle's manifest requirements constrain the shape, not the
separator.

TESTS, and the mutation table that makes them worth having. `str(PurePath)`
and `as_posix()` return the same string on POSIX, so a reverted writer passes
every value assertion on every Linux run and fails only on the platform the
suite never executes. Proved rather than asserted: with the structural block
stripped, all five writer mutations SURVIVED 36 green tests; with it present
all five are killed. Reader mutations (drop the normalization at any of the
five sites, or make either `manifest_rel` the identity) die on the
backslash-spelled cases. 13 mutations run, 13 killed.

Round trip driven end to end on a scratch fixture with a nested topic:
transition, package, archived-pair verify all clean, every recorded field
POSIX, and the same pair still verifies after its manifest paths are rewritten
with backslashes.

Gates: tests/proposal-support 36 passed + 2 subtests exit 0;
tests/ideation-dashboard 3875 passed / 14 skipped exit 0; tests/doc-health 690
passed with exactly the four known `test_client_identity_composition` location
artifacts; `openspec validate --all --strict` 65/65 exit 0.

Co-Authored-By: Claude Fable 5 <[email protected]>
brettheap pushed a commit that referenced this pull request Aug 22, 2026
…ne copy of the rule

The reader half PR #221 left behind, found while mapping the surface for the
commit before this one. #221 put the staged origin path into POSIX at the
writer and made two readers tolerant — `origin_errors` and
`generator._declared_origin_staging` — and cited doc-health's `proposal-origin`
family as a third reader that joins that path to a repo root. It fixed the
writer and never came back for that reader.

TWO SITES, and they fail differently. `check_change` resolves the recorded
`origin.path` twice: once through `_git_path_exists` against the manifest's
`source_revision`, and once through `_staging_header_matches` against the
working checkout. On a backslash-spelled record `git ls-tree` matches no entry,
so sound provenance reports as `staged origin path ... does not resolve at the
recorded source revision` — a false ERROR against a folder present in the very
commit named. And `Path(repo) / <that>` is not a directory, so
`_staging_header_matches` returns None and the staging-header linkage check
SKIPS. The false ERROR at least argues with you. The skip is silent, and a
change that really had lost its `Staging ID:` linkage would sail through it —
which is the failure mode #221 itself called worse than one that fails.

ONE NORMALIZATION, TWO USES: `opath_rel` is derived once and handed to both
checks, so they cannot reach different conclusions about the same recorded
path. The findings keep quoting `opath` AS RECORDED, because that is the text
an operator has to go and fix.

HELPER PLACEMENT. `recorded_rel` now lives in `doc_health/__init__.py` and
serves the whole package; `families._manifest_rel` (added in the previous
commit) is collapsed into it. The import direction settles this rather than
taste: `families` imports `proposal_origin`, so the reverse is a cycle, and
`__init__` — which imports no submodule — is the only shared home. The name
widened with the scope: this normalizes a proposal packet's `origin.path` as
well as a manifest's file paths, so `manifest_rel` would have been actively
wrong in `proposal_origin`. TWO copies of the rule remain, one per process
boundary, which is the floor and not an oversight: `proposal-support.py` is a
hyphenated standalone script and cannot be imported. They are pinned to each
other by `test_the_recorded_path_normalizations_agree`, because two readers of
one record that disagree about its alphabet would have one call it sound while
the other called it corrupt.

ONE FUNNEL PER MODULE, so the consolidation is real rather than nominal.
`origin_errors`' strict coherence check kept #221's inline
`str(opath).replace(...)`; it now goes through this module's own
`manifest_rel`, because a record's origin path and the file paths beside it in
the same manifest must not be normalized two different ways. That line also had
NO test — #221 added the normalization and never pinned it, and it has the same
silent-skip failure the family's linkage check has, so it is pinned now.

TESTS. Both spellings parametrized at each site: the linkage check RUNS and
fires on a real mismatch; it runs and stays CLEAN on intact linkage (running is
not the same as firing); a vanished staging folder stays legal history in
either spelling, so tolerance did not turn a correct skip into an accusation;
and the recorded-revision check resolves against a real git fixture rather than
reporting false unresolvable provenance. 7 mutations run, 7 killed — each
`proposal_origin` call site individually, the shared `opath_rel` derivation,
`recorded_rel` reduced to the identity, both families call sites, and
`origin_errors`' newly pinned one.

COMPATIBILITY. No behavior change on this corpus, measured rather than assumed:
the `proposal-origin` and `location-conformance` reports over this repo are
byte-identical before and after, and corpus-wide `proposal-support.py . verify`
remains byte-identical to the pre-change baseline, exit 0.

Gates: tests/doc-health 700 passed with exactly the four known
`test_client_identity_composition` location artifacts; tests/proposal-support 36
passed + 2 subtests exit 0; tests/ideation-dashboard 3875 passed / 14 skipped
exit 0; `openspec validate --all --strict` 65/65 exit 0.

Co-Authored-By: Claude Fable 5 <[email protected]>
brettheap pushed a commit that referenced this pull request Aug 22, 2026
The register `docs/archive-record-discrepancies.md` enumerated seven classes of
archived-record discrepancy and said each needed a Brett ruling or an OpenSpec
change to close it. Brett ruled every class in-session on 2026-08-22, a
multiple-choice round in which the recommended option was adopted on each. This
slice executes those rulings and records the per-item outcomes in the register.

C7 AND C3'S ACCOUNT-MENU HALF, closed on a fact Brett declared rather than one
found in the archive. He ratified add-dashboard-account-menu in-session on
2026-08-21, its authoring date. The proposal's Status flips draft -> ratified
with a `Ratified:` citation line, the change gains the `.openspec.yaml` it never
had (ad_hoc origin, approved_by Brett Heap, approved_on 2026-08-21), and the
tasks.md note that recorded the flip being DECLINED is kept word for word with a
resolution appended after it, per Brett's 2026-08-10 append discipline. Three
things are said plainly in all three places because they are easy to lose: the
fact is a declaration, not a discovery; re-reading the record still turns up no
contemporaneous trace; and the citation names this ruling round rather than the
new origin file, since citing a file written in the same act from the same
declaration would be circular. That is a deliberate departure from B1, whose
origin file predated its correction and was independent evidence.

C1, FOUR OF SIX FIXED AND THE TEMPLATE CORRECTED THREE TIMES. d9b80c1's spelling
does not transplant: its "cut as contract-v1.35" clause is specific to
add-roster-device-admission-surface, and three of the four fixed changes cut no
contract bundle at all, their surfaces being code-only. What was copied is the
shape, not the sentence. align-demote-to-round-trip-rule (PR #215),
align-status-reader-to-real-lines (PR #222) and refine-demote-round-trip-mechanics
(PR #221) each name their own merge-plus-green discharge in their own banner and
tasks.md and are rewritten from it. add-client-identity-roster is rewritten from
its archive commit and README row and NOT from its tasks.md, whose archive-gate
boxes are still unticked - recorded rather than papered over. Also recorded:
contract-v1.33 and contract-v1.35 are bundles, not git tags, so the rewritten
value says bundle and the register carries the tag gap.

Two of the six are untouched. split-ideation-book-per-repo is genuinely
ambiguous - its only realization statement is "discharged by the archive commit
itself", which is circular, since the archive is the act the token was gating.
add-worker-credential-by-reference is a different case and the one thing this
round needs a word back on: its evidence is adequate on its own terms, but the
same ruling round said "do not touch it" while closing C3, and two ruled
sentences point opposite ways over one file. The conservative reading was taken
because the cost of being wrong that way is one more sentence from Brett.

C2, TWO OF SEVEN BACKFILLED. add-governed-derived-model gets a date-only
citation in the spelling add-roster-device-admission-surface already uses; no
approver is named anywhere in its record and none is claimed, and the header is
added as bare lines because that proposal has no front-matter fences.
add-lens-gate-verbs gets an approver and a date from its 3.3 disposition, with
the caveat written into the citation itself that the record's own word is
"disposition" and never "ratified". Five are left headerless: the three
2026-07-25 changes carry origin-approval pairs that approve AUTHORING ad hoc and
are dated at creation, so reading them as ratification would date each
ratification to its proposal day; add-propose-verb has nothing; and
add-workbench-integrated-editor-chat must stay headerless because its own
archive commit records a decision against writing a status value.

C5 recorded as ruled legacy, no file touched. C6 annotates the four avatar
ledgers with a trailing section each, ticking nothing - the counts re-verified
at 8/0, 11/0, 4/0, 14/1, and the annotations able to say where the evidence
lives because the ticking happened in the Speckit ledgers (54/54, 65/65, 37/37)
and was never mirrored back. One of the four is named as not belonging to the
class as stated: clarify-avatar-revocation-client-enforced makes no realization
claim to disagree with.

TWO CORRECTIONS TO THE REGISTER'S OWN CLAIMS. A4 said each of six open boxes
carries its own reason; two of them, add-crystallizer-contracts 3.1 and
add-capability-steward 3.1, are bare. And the "Why this file exists" section
said a dispositions entry is a way to revise a record document - half wrong,
measured below.

THE RECORD-IMMUTABILITY COST, MEASURED IN-TREE RATHER THAN ASSUMED, because a
git archive export loses the git-dependent families and this register records
that trap. Before: 3 critical, this file not among them. After: 4 critical, the
fourth being this file, exactly as predicted. A health/dispositions.yaml entry
does NOT silence it - a run with the entry is BYTE-IDENTICAL to a run without,
because fam_record_immutability emits unconditionally and the dispositions set
feeds only report.uncited_resolutions. What it does buy was measured end to end:
against a previous report carrying the four contested findings, a run in which
they are absent emits 4 uncited-resolution ERRORs with an empty file and 0 with
the entries present. So no disposition is claimed as a mute button, and the
entry is not written here at all: it lives at the AGGREGATION root, is never
loaded on the --single-repo run a pull request self-gates with, and editing the
shared aggregation checkout carries the sweep hazard. The ready-to-paste entry
and the whole measurement are recorded in the register.

Gates, exit codes read directly and never through a pipe:
openspec validate --all --strict 67/67 exit 0, unchanged from baseline;
pytest tests/doc-health 704 passed exit 0, unchanged;
pytest tests/ideation-dashboard -k workbench 140 passed exit 0;
doc-health single-repo full run 4 critical / 6 error / 69 warning / 4 info
against a 3/7/69/4 baseline - the one new regression is this register's own
expected critical, and the error count FELL by one because the account-menu
origin declaration cleared a proposal-origin ERROR (2 error -> 1 error on that
family, 30 warnings unmoved);
presence sweep exact, 86 archived dirs to 86 README rows and 18 to 18.

Co-Authored-By: Claude Fable 5 <[email protected]>
brettheap added a commit that referenced this pull request Sep 7, 2026
…ndment revokes it

I read the hosting plan FILE's `status:` field (line 108,
`registered_awaiting_operations_domain_approval`) and the OpsxFactory README
line ("APPROVAL (task 4.2) NOT GIVEN") and concluded no approval existed to
revoke. That was wrong. Measured by lane hermes-wallet-exercise and verified on
OpsxFactory origin/main:
openspec/changes/host-codexfactory-mcp-contract-service/tasks.md carries

  - [x] 4.2 ... APPROVED 2026-09-05

Brett Heap, 2026-09-05T23:06Z, verbatim "approve 4.2, merge #221", over plan
digest 4e1a4b76..., recorded at OpsxFactory PR #229 comment 5555392080.

The plan file's `status:` stays unedited BY DESIGN, and the tick says why: "The
plan's bytes are NOT edited by this tick — editing them would move the approved
digest, which requirement 2 treats as a material amendment revoking this
approval." IN A DIGEST-APPROVAL REGIME THE APPROVAL CANNOT LIVE INSIDE THE
APPROVED BYTES. Read the tick and the ruling, never the plan's status field.

So the approve -> amend -> revoke -> re-approve cycle is REAL. The ordering
recommendation is unchanged and its reason is now the correct one: move first,
amend the plan's GITHUB references to codeXfactory/codexFactory, Brett
re-approves 4.2 over the new digest, then 4.4/4.5, then the 5.1 pin, then the
edge act. Moving first spends exactly one re-approval and no second acceptance.

This is the packet's SECOND error of the same class — reading a state off an
artifact the state deliberately cannot live in, after the README.md substring
match in the release-inventory count. Both are recorded in design.md rather than
quietly fixed, because a digest-approval regime makes this error attractive and
the next author deserves the warning.

The ACR finding STANDS and is restated more precisely: the plan's image path
(line 189) is acropensoftxfactoryqa.azurecr.io/opensoft/codexfactory-mcp, where
`opensoft/` is an ACR repository path segment and not a GitHub organization. It
does not move with a GitHub org transfer and is out of scope for OQ-4; only the
plan's GitHub references move.

Also flagged, not answered: the 4.2 tick names 4e1a4b76... as approved while
also naming 8abb0e96... as "the digest offered by codexFactory", and the plan
file's plan_digest block carries the latter after two post-registration
amendments. Which digest a re-approval is taken over is the OpsxFactory lane's
question.

openspec validate --strict green; --all --strict 98 passed / 1 failed
(unchanged); validate-sequenced-after.py green.

Lane: provenance-autonomous-merge
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