Skip to content

doxBench: a commit the canvas could not adopt is never a tile success (#290) - #313

Merged
brettheap merged 4 commits into
mainfrom
change/fix-tile-save-verdict-adopt-failure
Aug 25, 2026
Merged

brettheap merged 4 commits into
mainfrom
change/fix-tile-save-verdict-adopt-failure

Conversation

@brettheap

Copy link
Copy Markdown
Contributor

Fixes #290 — the same defect class as #81 (a surface disagreeing with the per-buffer truth), one layer up; closed on all three surfaces it touches.

What was wrong

A Save whose reported content identity failed adoption yielded ok: true, status: "committed" on the tile while the buffer stayed dirty and its own status region said the canvas could not adopt the commit. Trigger: statedIdentity (save module) accepted any algorithm / any 64-hex; normalizedIdentity (state module) required sha256 + lowercase — so an uppercase-hex identity passed readVerdict and threw in adoptSavedBase. The adopt-failure branch had zero coverage.

The fix (3 commits)

  • bbcd4dc5 — (1) one identity rule: statedIdentity applies normalizedIdentity's constraints and returns the normalized object adoptSavedBase receives, so the identity-triggered adopt failure is structurally impossible; a malformed identity is now refused at readVerdict with the existing refused per-buffer status (vocabulary lives only in the two JS modules — no contract/schema change; the change moves toward xfactory-workbench-chat-turn.schema.yaml's ^[0-9a-f]{64}$ pin). (2) structural: save() records commits it could not adopt in outcome.unadopted; tileSaveVerdict treats them as a failing cause → ok:false, error = the buffer's own sentence. Row status is deliberately left committed — the server did commit; rewriting its verdict would be false the other way. The only renderer of tile Save results keys on ok.
  • 3fd74914 — third surface: the document-switch guard's reason (outcomeReasonFor) consults the shared unadoptedRowsOf first, so tile note, status region and guard answer from one list in one wording.
  • 7a86e299 — review fixes: sentence constants exported and shared with tests (unadoptedCommitReason, IDENTITY_NOT_STATED/IDENTITY_NOT_ADOPTABLE); unadopted == [] pinned on every answer; new pin that a throwing save seam is never a tile success (pre-existing gap — the status clause in ok was load-bearing and untested); Array.isArray guard closes a fourth (JSON-unreachable) divergence.

Re-spelled rather than imported because test_doxbench_mutation_boundary.py::test_the_save_module_has_no_import_statement pins both modules import-free; a ten-candidate cross-module agreement test pins committed ⟺ adoptable.

Evidence

RED-first on every pin (4 new view tests, 1 new save test). Mutations: the issue's drop-adopt-lead, revert-unification, verdict-ignores-unadopted, revert-guard-consult, drop-status-clause, conditional-unadopted, drop-array-guard — 7 applied, 7 caught; a consistent reword of the sentences now survives (by design, after finding 1). Adversarial review: 16 findings, 0 blockers, 4 fixed here. Full ideation-dashboard suite on the reviewed tree: 4021 passed / 13 skipped (+1 test since).

Left for rulings / follow-ups (not defects, not widened here)

  • Honesty axis, for Brett: a refused row for a malformed identity renders "Save refused…" though the server did commit (pre-existing pattern for missing ref/revision; unreachable in production — the sole server emitter is doxbench_hash.content_identity, lowercase sha256 by construction).
  • resolveGuard("save") inspects only the reserved document buffer; an unadopted outline still returns a bare committed status to a fire-and-forget caller.
  • The adopt try also wraps replaceBuffer, so a client-side keyed-set violation would be reported as "a commit this canvas could not adopt" (pre-existing scope).

🤖 Generated with Claude Code

brettheap and others added 3 commits August 24, 2026 20:54
…ccess (#290)

Two defects one layer apart, and closing either alone leaves the other
reachable, so both halves land together.

THE TRIGGER was a validator divergence. `doxbench-save.js`'s `statedIdentity`
accepted ANY non-empty algorithm and ANY 64 characters, while the rule applied
where an identity is WRITTEN into working state (`doxbench-state.js`'s
`normalizedIdentity`, reached through `adoptSavedBase`) accepts only a lowercase
SHA-256 one. The two read the same field of the same answer one step apart, so
an uppercase-hex or `sha512` identity passed `readVerdict` as `committed` and
then threw in the adopting module -- two differently strict judges of one value
is not defence in depth, it is a gap. The reader now applies the writer's rule:
a stated identity nothing can adopt is not a landing. It is refused in the row
vocabulary that already exists (`refused`, `SAVE_BUFFER_STATUSES`; no contract
or schema constrains these rows, so nothing outside the module had to move), and
the message distinguishes an identity never stated from one stated in a form
nothing can verify later -- "…without naming the content identity it committed
as a lowercase SHA-256 identity, so this buffer's base was not advanced". The
rule is re-spelled rather than imported because both modules are pinned
import-free (test_doxbench_mutation_boundary.py::
test_the_save_module_has_no_import_statement), exactly as the document-order
rule is -- and, like it, the two spellings are now pinned EQUAL by a companion
test that asks both modules the same nine candidate identities, rather than
trusted to stay equal.

THE STRUCTURE was the deeper half, and the reason the fix is not just the
validator: `tileSaveVerdict` computed `ok` from the outcome ROWS alone, and no
row can carry an adoption failure -- the row says `committed`, because the
SERVER committed. So the tile answered `ok: true, error: null,
status: "committed"` while the buffer's own status region beside it said "Save
reported a commit this canvas could not adopt … this buffer keeps its unsaved
text". `save()` now carries the commits it could not adopt out with the outcome
(`unadopted`, an array on every answer a seam returned, each row carrying the
SAME sentence the buffer's region shows) and the verdict consumes it, choosing
its one line by the same first-failing-cause-in-save-order rule the single
visible line follows (#81). The tile can no longer claim a success the buffer
beside it contradicts, whatever future trigger reaches that branch. What
deliberately does NOT change: the row still reads `committed` and
`outcome.status` is untouched, because rewriting the governed action's own
verdict would be a false statement in the other direction.

RED first, on the pre-fix tree:

  test_the_reader_and_the_writer_judge_a_content_identity_identically
    AssertionError: ('uppercaseHex', {'status': 'committed', 'message': None,
                     'adopted': False, 'dirty': False})
  test_an_identity_the_canvas_cannot_adopt_is_refused_before_it_is_committed
    AssertionError: {…'ok': True, 'error': None, 'rows': [… {'key':
                     'ideation/staging/topic-x/detail.md', 'status':
                     'committed', 'message': None}]…}  /  assert True is False
  test_a_commit_the_canvas_cannot_adopt_never_reads_as_a_tile_success
    AssertionError: {'seen': [['ideation/staging/topic-x/detail.md']],
                     'ok': True, 'error': None, 'status': 'committed', …}

GREEN after -- and the adopt-failure branch, which had NO coverage at all, is
now measured from both sides: through the REAL orchestrator (the identity
trigger) and directly, with an injected seam handing the canvas a `committed`
row it cannot adopt, which is the shape that stays reachable however the
orchestrator judges identities.

Mutation round, each applied to the fixed tree and reverted:

  drop-adopt-lead (the issue's own)   -> …cannot_adopt_never_reads_as_a_tile_success
  revert the validator unification    -> …judge_a_content_identity_identically
                                         + …refused_before_it_is_committed
  verdict ignores the adopt outcome   -> …cannot_adopt_never_reads_as_a_tile_success
  outcome drops `unadopted`           -> …cannot_adopt_never_reads_as_a_tile_success
  the adopt failure is never recorded -> …cannot_adopt_never_reads_as_a_tile_success

Five applied, five caught, none survived.

tests/ideation-dashboard: 4020 passed, 13 skipped (4017 before; +3, one test
per behaviour pinned). One comment in the first draft cost a run of its own --
prose reading `from "never said"` matched test_renderer.py's static
import-specifier sweep of doxbench-editor.js, which is the sweep doing its job.

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

The third surface of the same defect, on Brett's ruling that #290's class is "a
surface disagreeing with the per-buffer truth" and that leaving a known one
lying would be half a fix.

`resolveGuard("save")` asks exactly one question -- why is the Document buffer
STILL dirty? -- and `outcomeReasonFor` answered it from the outcome ROW. For a
commit this canvas could not adopt that row says `committed`, because the server
did commit, so the guard printed "Save did not land the Document buffer: saved
as edit-document on draft/topic-x. It still has unsaved changes…" -- a sentence
that contradicts itself, and the buffer's own status region beside it, in one
breath. Its BEHAVIOUR was never wrong: it keys off `dirty`, so it correctly
stayed open and correctly refused the switch. That is precisely why the wrong
sentence could survive -- nothing that moves was broken, so no test that watched
things move could see it.

The reason now comes from the SAME unadopted list the tile verdict reads, via
one shared `unadoptedRowsOf` reader rather than a second inline unpacking of the
field, so the three surfaces -- tile note, buffer status region, guard -- state
one fact in one wording. The row is still consulted for every other buffer and
every other verdict; only a commit that was NOT adopted is answered ahead of it.

RED first, on the tree of bcc21a45:

  test_the_guard_says_the_commit_was_not_adopted_not_that_it_was_saved
    >   assert "could not adopt" in reason, reason
    E   AssertionError: saved as edit-document on draft/topic-x.
    E   assert 'could not adopt' in 'saved as edit-document on draft/topic-x.'

GREEN after, with the guard reading "Save did not land the Document buffer:
Save reported a commit this canvas could not adopt -- content identity must be a
lowercase SHA-256 identity; this buffer keeps its unsaved text. It still has
unsaved changes -- choose Discard to drop them, or Cancel to keep editing." The
pin asserts that the guard's reason IS the buffer's own durable sentence (a
substring of its status region), that it does not report a landing, and that the
guard is still open over a buffer that kept its text and its base. Two of its
clauses match PHRASES rather than the modules' own constants, and adversarial
review showed a consistent reword defeats them: the follow-up commit exports
those sentences and asserts against them, so the copies go away.

Mutation: revert the unadopted consult in `outcomeReasonFor` (the row answers
again) -> caught by that test alone, which is the right shape for a behaviour
nothing else claims. 1 failed, 132 passed.

test_doxbench_view.py 133 passed, test_doxbench_save.py 51 passed,
test_doxbench_mutation_boundary.py + test_renderer.py green alongside them
(314 in the four files, +1 for the new pin).

Co-Authored-By: Claude Fable 5 <[email protected]>
…gaps close (#290)

Adversarial review of the two commits above (READY-AFTER-FIXES, no blockers).
Four findings, all four taken.

1. THE PINS WERE MATCHING PHRASES, NOT THE MODULES' WORDS. The claim in the
   commit above -- "the pin asserts the semantic, not that wording" -- was not
   true: a CONSISTENT reword of the adopt-failure sentence still failed two
   asserts (`"could not adopt" in reason`, `"lowercase SHA-256" in malformed`),
   because those asserts carried their own copies of sentences the modules
   build. A test that copies a sentence pins the copy: reword the module and the
   copy describes nothing while going on passing, which is how a pin quietly
   becomes decoration. The sentences are now built in ONE place each and
   exported for the tests to assert against -- `unadoptedCommitReason(detail)`
   in doxbench-editor.js, `IDENTITY_NOT_STATED` / `IDENTITY_NOT_ADOPTABLE` in
   doxbench-save.js -- the same move `boundReachedReason` already makes. The
   canvas and guard scenarios now ASK the adopting module for the very refusal
   the canvas caught and wrap it in the canvas's own exported reason, so the
   expectation moves with the code; the guard's negative ("this is not a
   landing") is asserted as DATA -- the reason carries neither the session ref
   nor the action a commit would have named -- rather than as the absence of the
   phrase "saved as". Measured: the consistent reword that failed two tests
   before now passes, and every earlier mutation is still caught, M6 included.

2. `unadopted` IS AN ARRAY ON EVERY SEAM ANSWER -- stated in the code and
   pinned nowhere: making it conditional on there being something to report
   passed all 314. The fully-adopted save now asserts `unadopted == []`, so
   "adopted everything" and "an answer that never said" stay distinguishable.

3. THE `ok` STATUS CLAUSE WAS LOAD-BEARING AND UNPINNED. `ok = !failed &&
   (status is committed|unchanged)` -- and the second clause is the only thing
   answering for a ROWLESS outcome. `save()` returns `{status: "refused",
   reason}` with no buffers at all when the seam throws (also when the canvas is
   destroyed, or nothing is loaded), so "no failing rows" is trivially true
   there: dropping the clause turns every one of those into `ok: true` on the
   tile, and the suite stayed green. Pinned now at the shape a human meets
   first -- a save seam that threw -- asserting not-ok, the reason carried
   through to the buffer's own region, and the text kept.

4. A FOURTH IDENTITY DIVERGENCE. `typeof [] === "object"`, so `statedIdentity`
   admitted an ARRAY carrying `algorithm`/`hex` while the adopting module's
   `plainObject` refuses it. Unreachable through JSON, but the companion test
   asserts the two modules AGREE, which is a claim about every value they can
   both be handed -- so the divergence falsified the test's own invariant.
   Guarded, and `arrayWithProps` joins the candidate matrix (now ten).

Mutations, each applied and reverted (view + save files):

  drop the status clause          -> …a_save_seam_that_threw_is_never_a_tile_success
  unadopted only when non-empty   -> …a_save_with_nothing_withheld_leaves_the_visible_line_alone
  drop the array guard            -> …the_reader_and_the_writer_judge_a_content_identity_identically
  consistent reword of BOTH       -> SURVIVES, which is the point of finding 1
  revert validator unification    -> …judge_a_content_identity_identically + …refused_before_it_is_committed
  verdict ignores adopt outcome   -> …cannot_adopt_never_reads_as_a_tile_success
  revert the unadopted consult    -> …guard_says_the_commit_was_not_adopted_not_that_it_was_saved
  drop-adopt-lead                 -> …cannot_adopt_never_reads_as_a_tile_success

test_doxbench_view.py 134 + test_doxbench_save.py 51 = 185 passed;
test_doxbench_mutation_boundary.py + test_renderer.py 130 passed.

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

@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

This PR fixes doxBench save-reporting inconsistencies where the tile could report ok: true even when the canvas could not adopt the reported commit (leaving the buffer dirty). It aligns identity validation between the “reader” (save module) and the “writer” (state adoption), and propagates adoption failures into a shared, consistent surface-level verdict/reason across tile, per-buffer status region, and the document-switch guard.

Changes:

  • Unifies content identity validation in doxbench-save.js to match the adopting rule (sha256 + lowercase 64-hex), refusing malformed identities at readVerdict.
  • Records adoption failures as outcome.unadopted and makes tileSaveVerdict treat unadopted commits as a failing cause (ok: false) while preserving row status: "committed".
  • Adds/extends view + save tests to pin: (1) reader/writer identity agreement, (2) unadopted commits are never tile successes, (3) throwing save seam is never a tile success, (4) guard reason uses the same unadopted wording as other surfaces.

Reviewed changes

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

File Description
tests/ideation-dashboard/test_doxbench_view.py Adds guard-focused scenario to ensure guard wording matches the buffer’s unadopted-commit sentence.
tests/ideation-dashboard/test_doxbench_save.py Adds identity-agreement matrix test to prevent reader/writer validator drift and pins shared wording via exported constants.
scripts/ideation_dashboard/web/views/doxbench-save.js Tightens statedIdentity to match adoption constraints; exports refusal-clause constants and uses them in readVerdict.
scripts/ideation_dashboard/web/views/doxbench-editor.js Introduces shared unadoptedCommitReason, annotates outcomes with unadopted, and updates tile/guard reasoning to consume it.

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

Copilot AI review requested due to automatic review settings August 25, 2026 02:37

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 4 out of 4 changed files in this pull request and generated 1 comment.

Comment on lines +2192 to +2193
const unadopted = new Map(
unadoptedRowsOf(outcome).map((row) => [row.key, row.message]));
@brettheap
brettheap merged commit cbf2368 into main Aug 25, 2026
3 checks passed
brettheap pushed a commit that referenced this pull request Aug 25, 2026
…drift-gate

One upstream commit (#313, the doxBench canvas-adoption fix): doxbench-editor.js,
doxbench-save.js and their two test files. ZERO overlap with this branch, which
touches governance documents and a change packet and no dashboard code at all --
verified by intersecting the two changed-file sets, not just by git merging
cleanly.
@brettheap
brettheap deleted the change/fix-tile-save-verdict-adopt-failure branch September 2, 2026 18:55
brettheap added a commit that referenced this pull request Sep 9, 2026
…1/5.2 ticked on the D-2 evidence) (#832)

Path A PR-5, the last of the 2026-09-06 plan memo's sequence, on Brett Heap's word "merge pr-5 when green" (2026-09-09). Authority: his ruling of 2026-09-05T23:38Z "rule path A, 4.5 is a deferred successor" (#656) and ruling D-2 (the live exercise).

- tasks.md: § 4.4 / § 5.1 / § 5.2 ticked on the D-2 evidence (three `- [ ]` heads removed, every ratified sentence kept byte-identical); § 4.5 untouched as a DEFERRED SUCCESSOR (#714 → 3d1b8cc).
- Archived WITH promotion via `scripts/proposal-support.py . archive --date 2026-09-09` under the pinned @fission-ai/[email protected] (never a bare `openspec archive`); origin retained (declaration unchanged since da1b0e9); six frozen files R100.
- Promoted: `openspec/specs/ideation-intent-plane/spec.md` NEW (7 requirements / 11 scenarios, every block byte-identical to the archived delta) and `openspec/specs/document-lifecycle/spec.md` 18 → 19 requirements ("Gates happen on main"); the new capability's `## Purpose` written by this act (no SHALL; replaces the CLI's TBD stub). openspec/specs 60 → 61; floor regeneration OWED (GRACED covered-pending 1, `created_by_candidate`), `contracts/review-lane-floor-snapshot.yaml` deliberately not edited here.
- README OpenSpec Records row → archived; sweep-ledger row re-seeded with the tool (`--seed-ledger --moved-by '#832'`, one line moved); no thirteenth archive-date disposition.
- Evidence (merged + green): #718 d179cc0, #727 07624d5, #735 6d3237e, xFactory #304 b2db7e47, #313 ddd19650, #345 90435875, #781 450bb60, #808 2ef7d8c, #814 c991c0f, #816 8924230, xFactory #362 119280a8, #830 202c170, xFactory #369 c2313277; D-2 live exercise: act B refusal 36d07ec, act A apply e970dfe, first autonomous merge #176 → 7681e40 (codexfactory[bot] APPROVED 2026-09-09T06:37:22Z).
- Copilot round 1: one factual finding taken (a missing "where" in Purpose); two wording findings answered and resolved.

Refs #656 (stays OPEN). Rule 6 LANDING window observed.

Lane: openxfactory-4-opendox-extraction
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_012LiNG5Ume1boEfxSNeCmpu
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.

doxBench: tileSaveVerdict reports ok:true over a commit the canvas could not adopt

2 participants