Skip to content

Realize doxbench Phase B §10: staged-set knowledge service, bounded context packets, memory-gateway declaration - #216

Merged
brettheap merged 26 commits into
mainfrom
change/doxbench-b-s10-knowledge
Aug 19, 2026
Merged

brettheap merged 26 commits into
mainfrom
change/doxbench-b-s10-knowledge

Conversation

@brettheap

Copy link
Copy Markdown
Contributor

Realizes §10 of the ratified add-doxbench-editing-phase-b: the Staged-Set
Knowledge Service, the bounded context packet it assembles, and this surface's
memory-gateway conformance declaration. This slice cuts no contract
release
— nothing under contracts/ changes, no new wire envelope, and
doxbench-state.js / doxbench-save.js are untouched.

What landed

Tasks 10.1–10.8, plus task 5.4 closed (its packet half was waiting on
this slice), plus the memory-gateway declaration and the compression-stack
fidelity pins.

  • 10.1 the assembly port — four product-neutral members a retrieval backend
    implements, with a FORBIDDEN_ASSEMBLY_PORT_MEMBERS companion in the same
    shape WorkbenchModelPort's carries. Behind it, the v1 local-hybrid,
    graph-less
    profile: BM25 over the confined corpus, small embedded vectors
    from a deterministic stdlib hashed n-gram projection (hashlib.blake2b, never
    the per-process-randomized hash()), and the structured thread-states as a
    third signal. Stdlib only, in-process, no new dependency, no network, no
    credential, no model download.
  • 10.2 one tool boundary — search, get_source, promote_finding,
    reindex, with graph_query declared and RESERVED: it exists at the
    boundary and refuses with a fixed governance reason naming the graduation
    trigger — not a missing name, not a crash, and a different exception class
    from an undeclared name.
  • 10.3–10.5 the packet and its rails — confinement computed and handed to
    the provider (never left for it to respect, and re-filtered at the assembler
    anyway); the lifecycle-status exemption read from each item's own Status:
    header in the assembler; then a bounds rail that fits by selecting
    less
    and names every dropped ref. The packet declares purpose, sources with
    refs, bound scope and expiry, and the consuming surface revalidates the
    leash
    before rendering anything.
  • 10.6 install-time backend declaration — the ratified two-case principle
    enforced; build_backend's signature has exactly one parameter, so the
    runtime-selection path is proven absent by the missing parameter rather than
    by a comment.
  • 10.7 degraded posture — the reduced packet is the same pipeline with one
    input absent, not a second pipeline with the rails skipped. Independence is
    proven through the real serve: a live model with no knowledge service
    succeeds with a reduced packet; a live knowledge service with no model
    leaves the model-capability refusal byte-shape and gate order untouched.
  • 10.8 telemetry — content-free by construction (every field is a count, a
    closed-vocabulary label, a scope key, or a declared absence). Tokens are
    carried only when a provider reports them.

10.7 is deliberately half-open. The packet half is done; the reduced posture
being visible to the human on the surface is not, because
workbench-chat-turn-v2-success is a closed envelope with no field for a
context posture, and the delta forbids carrying it as a server-side value no
reader can consult. The task names its own future release — an additive
chat-turn-success growth carrying the posture and its reason, allocated at its
realization — in §11.7's pattern, and stays open.

The memory-gateway declaration

This change is the first consumer to declare formal per-requirement
conformance
to memory-gateway, and the first subject-free one —
installs/hermes-install's add-memory-gateway-binding (archived 2026-07-24)
is the prior, narrower, subject-bearing precedent, which is stated precisely in
the design and proposal per verification finding §3.7.

The declaration is a machine-readable artifact, not prose: the capability's
whole 21-requirement roster with its published tiers, a disposition and a
reason
for every one, and the reviewed act (create-document, carried to
review by the session pull request) that satisfies promotion where the target is
not a Hermes layer. Conformance validation reads it — assess_conformance(None)
refuses — an incomplete declaration is refused, and the three refusal conditions
are constructive: a consumer holding a provider credential, addressing a
customer subject, or routing to a networked provider never obtains a declaration
to annotate, and one that acquires any of them loses it.

Review provenance

Two adversarial-review rounds, both on this branch before it was pushed:

  • Round 1 — 17 findings. All fixed or adjudicated. The blocker: require_valid
    had zero production call sites, so a packet issued for another repository,
    another tile, or an expired turn rendered into the prompt unexamined. The
    consuming surface now revalidates purpose/scope/expiry before assembling any
    section text, on the same injected clock the packet was issued on; at the route
    a rejected packet makes the server request a new one, and only a second
    failure refuses.
  • Also from round 1: the bounds rail was reworked from refuse to fit.
    Server-selected evidence over the bound used to answer HTTP 413
    request_limit_exceeded — false twice over (the request was ~700 bytes; the
    oversize was evidence the server chose) and un-actionable, refusing every turn
    on that tile forever. Evidence now fits by selecting less, greedy by rank, with
    every dropped ref named; a genuine refusal remains only where the session's own
    threads exceed the bound alone, as context_packet_bound_exceeded (409) whose
    message names the compaction that fixes it.
  • Round 2 — 9 re-verify findings. All discharged: the F4 disposition is now
    pinned by name, the coverage line credits the index rather than retrieval,
    the shortfall branch got the route drive its test only claimed to have, the
    worktree caveat no longer vanishes when the snapshot declares no revision,
    dropped refs are named best-ranked first (matching the data beside them), and
    the packet_assembler seam — which carries the governance rails — is guarded
    the way knowledge_declaration is.

Every pin in this slice is revert-tested: 39 hunks reverted one at a time,
each required to make its named test fail. Three defects were found by that
process rather than by reading, including one test that passed only because two
sections shared a label.

Owed at §11

  • The stdio MCP server exposing these same four tools to the harness, and the
    xd://mcp__<server>__<tool> mount-name pin verification-findings.md §3.2
    asks for. The boundary here is in-process; the ratified delta asks for "exactly
    ONE tool boundary" and never says MCP, and §11 is the first slice with a
    harness to expose one to.
  • Thread wiring. Nothing mirrors a turn into a sidecar yet (tasks 9.2/9.5 are
    "route unwired" by design), so the route supplies no threads and the packet
    declares each loaded document's missing sidecar honestly rather than inventing
    an empty thread. The seam §11 fills is the thread mapping handed to
    assemble_packet.
  • The browser-visible reduced posture, against the release named in 10.7.

Stated warts

  • The 409 arm is synthetic-only until §11. With evidence now fitting by
    selection, the only path to a genuine bounds refusal is the session's own
    threads exceeding the bound — and nothing writes threads yet, so its route test
    drives it through an injected assembler rather than through real thread growth.
  • Telemetry is in-process only. It is measured and retained on the served
    process's meter and readable there; nothing emits it off-process, because the
    released envelope has no room and this slice may not touch contracts/. The
    tick says exactly that rather than claiming emission.
  • Evidence is the served checkout's bytes at the projection's revision, not
    the session worktree's — so a document saved in this session appears at its
    pre-session bytes, and one created in this session is not indexable at all. The
    packet declares both facts; session-aware retrieval belongs to the slice that
    owns it.
  • The promoted-findings set is empty at the route, deliberately: reading a
    register would mean building one, which is the parallel decision store the
    contract forbids.

Gates

All at the merged tip (this branch merges current origin/main, including
align-demote-to-round-trip-rule; clean auto-merge, no overlap):

  • pytest, separate invocations: tests/ideation-dashboard 3465 passed, 7
    skipped
    ; tests/ideation_dashboard 63 passed; tests/doc-health 665
    passed
    ; every other suite green per directory.
  • OPENSPEC_TELEMETRY=0 openspec validate --all --strict → 62 passed, 0 failed.
  • doc-health pre/post, same openxFactory slug, baseline at origin/main →
    zero new findings, headline identical.
  • validate-ideation-dashboard-contracts.py → 0 errors, 4 warnings (the four
    v1 deprecation warnings are by design).
  • git diff origin/main..HEAD -- contracts/ and -- scripts/ideation_dashboard/web/
    → 0 files each.

tests/hermes_runtime_contracts remains a pre-existing environmental failure on
this host (Docker: all predefined address pools have been fully subnetted); it
spins up Postgres containers and this slice touches nothing in it.

🤖 Generated with Claude Code

brettheap added 21 commits August 19, 2026 09:09
The `memory-gateway` delta's added requirement, realized as a machine-readable
artifact rather than as prose: the capability's whole requirement roster with
its published tiers, a disposition and a REASON for every one of them, the
reviewed act that satisfies promotion where the target is not a Hermes layer,
and the three refusal conditions expressed constructively — a consumer that
holds a provider credential, addresses a customer subject, or routes to a
networked provider never obtains a declaration to annotate, and one that
acquires any of them LOSES it.

Completeness is the point: conformance validation reads this object, and a
requirement nobody dispositioned is a refusal here rather than a silent pass.

Ref: add-doxbench-editing-phase-b design §7.1
The metering requirement's shape, honoured where this surface can and DECLARED
absent where it cannot: client, domain, bill-to and customer-subject have no
value on a self-hosted console, so each is a DeclaredAbsence carrying its
reason rather than a placeholder, and a token count is carried only when a
provider reports one — bytes are measured exactly, tokens are never estimated
from them.

Content-freedom is structural: every field is a count, a closed-vocabulary
label, a scope key, or a declared absence, so there is no field a caller could
put text in. The meter is bounded and per-instance, and emits nowhere itself.

Ref: add-doxbench-editing-phase-b task 10.8
…undary, backend declaration

The two layers kept apart: ONE tool boundary (search, get_source,
promote_finding, reindex, with graph_query DECLARED and RESERVED, refusing with
a fixed governance reason rather than crashing or being absent) in front of the
internal ASSEMBLY PORT (four product-neutral members a backend implements).

The v1 profile behind it is LOCAL-HYBRID and graph-less: BM25 over the confined
corpus, small embedded vectors from a deterministic stdlib hashed n-gram
projection (blake2b, never the randomized hash()), and the structured
thread-states as a third signal, fused on declared weights with a deterministic
tie-break. No graph engine, no model download, no service, no credential.

The backend is an INSTALL-TIME declaration enforcing the ratified two-case
principle; build_backend takes a declaration and structurally cannot take a
turn, a prompt, or a heuristic. Retrieval and source fetch are both confined to
a caller-computed ref set, and retrieval re-filters its own answers against it.

promote_finding writes nothing: it returns a request naming the reviewed act
read from this surface's own memory-gateway declaration.

Ref: add-doxbench-editing-phase-b design §3.3 D10/D11, tasks 10.1/10.2/10.5/10.6
The pipeline design §3.1 fixes, in order: confinement (computed before any
retrieval provider is reached and handed to it, never left for it to respect),
selection (layer one, lossless by reference — selected thread in full, other
loaded threads' state headers, confined evidence), the lifecycle-status
exemption rail reading each item's own Status: header IN THE ASSEMBLER, then
the bounds check that refuses with the measured dimension and truncates
nothing, then deterministic assembly.

The packet declares purpose, sources with refs, bound scope and expiry, and
require_valid refuses it on all three axes. With no knowledge service the same
pipeline yields the DECLARED reduced packet with its posture stated — the rails
still run, nothing unbounded is substituted, and a document with no sidecar
yet is named as absent rather than given an invented empty thread.

The three-layer compression stack is declared as data with a checker, so
describing selection as lossy is a refusal rather than a review note, and the
watch-listed candidate is recorded with its gates and cannot be adopted.

Ref: add-doxbench-editing-phase-b design §3.1-§3.4, tasks 10.3/10.4/10.5/10.7
…t's sections

The declared constant gains the packet's four groups in design §3.1 step 5's
own order — the packet's declaration, the selected thread, the other threads'
state headers, the evidence with refs — ahead of the outline and document
buffers. Two of them EXPAND per item exactly as document_buffers does, and
prompt_section_keys now takes the packet as a REQUIRED keyword: every turn
carries one, because an absent knowledge service yields the DECLARED reduced
packet rather than a packet-less prompt, and a default of None would invent a
second prompt shape no requirement sanctions.

build_prompt_envelope assembles the reduced packet itself when none is
supplied, and emits the content-free usage event where both the packet's byte
count and the prompt's are real measurements.

The turn suite's POSITIONAL section lookups are re-pinned to key lookups with
the reason stated: an index pinned a section's identity to a count, and had
already gone quietly wrong once — sections[6] named the outline while a test
about the document buffer still passed on a label they happened to share. The
declared order is still asserted whole against prompt_section_keys.

Ref: add-doxbench-editing-phase-b task 5.4, design §3.1
…ll-time only

build_server takes the INSTALL-TIME retrieval-backend declaration; the two
production entrypoints declare the self-hosted local-embedded profile
explicitly, exactly as they declare the real notebook adapter and for the same
reason — an operator must be able to read what their install talks to. The
library default is absence, and absence is the DECLARED reduced-packet posture
rather than an error.

The backend INSTANCE is built per request from that declaration and from
nothing else: the declaration is process-wide, the derived index is not,
because the server is threaded and one tile's index must never be visible to
another tile's turn. The corpus is read through snapshot_registry.resolve_within
— the single containment authority /source already uses — and an unreadable
document is skipped rather than failing a turn.

The turn route assembles the packet before the prompt and before any provider,
and a packet bounds refusal reaches the wire as the existing
request_limit_exceeded envelope carrying the measured dimension, the
measurement and the maximum — three integers and one label this module
computed, with nothing truncated to fit.

Ref: add-doxbench-editing-phase-b D11, tasks 10.6/10.7/10.3
Every scenario of the delta's added requirement, three of them constructive: a
consumer holding a credential, addressing a subject, or routing to a networked
provider never obtains a declaration, and one that acquires any of them loses
it. The roster is asserted against the promoted spec itself, so a requirement
added upstream fails here rather than becoming a silent gap; incompleteness is
a refusal; and the seven requirements that always bind cannot be declared away.

The declaration is cross-examined against the REALIZATION rather than its own
prose: the promotion act the tool boundary routes to, the v1 profile's
credential-free/non-networked/graph-less facts, the four metering absences, and
the assembler's actual rails.

Ref: add-doxbench-editing-phase-b design §7.1
The negatives asserted constructively: graph_query EXISTS at the boundary and
refuses with a fixed governance reason (not a missing name, not a crash, not a
NotImplementedError, and a different verdict from an undeclared name); a
profile declaring a graph capability is refused where a graph would have to be
declared to exist; no graph engine or watch-listed candidate is spelled
anywhere; build_backend's signature has exactly one parameter, so the runtime
selection path is proven absent by the missing parameter rather than by a
comment; and confinement governs source fetch as well as search.

The three retrieval signals are each shown doing work — including the one that
needed a genuinely null query to demonstrate, since 'obviously unrelated' prose
still scores on the vector leg through shared character n-grams, which is that
leg working rather than a defect.

Ref: add-doxbench-editing-phase-b tasks 10.1/10.2/10.5/10.6
…n-fidelity pins

Every packet scenario of the delta, with the rail ORDER observed rather than
described: a recording boundary reports the confinement it was HANDED, and a
backend answering outside it has that answer dropped and never even fetched.
The bounds refusal is checked for what it does not say — no content, no ref,
just the dimension and two integers — and the no-truncation rule is proven by
the text surviving whole.

The lifecycle-status read is cross-checked against the repository's own
doc-health corpus reader over real documents, because the same rule living in
two places is how two places drift.

The compression stack's three fidelity contracts are executable: claiming
another layer's fidelity raises, layer two names doxbench_threads.compact_thread
as its real owner, layer three declares itself UNREALIZED and names §11, and
the watch-listed candidate cannot be constructed as adopted.

Ref: add-doxbench-editing-phase-b tasks 10.3/10.4/10.5/10.7
The install-time declaration, the two capabilities' independence and the
content-free telemetry are all WIRING claims — each passes trivially against a
stubbed assembler and can only fail against a serve — so they are driven
through a real ephemeral server, with the harness IMPORTED from the route suite
rather than copied.

Proven live: the library default is absence and yields the reduced packet; a
declared backend names itself in the packet; a live model with no knowledge
service SUCCEEDS with a reduced packet rather than refusing; a live knowledge
service with no model leaves the route's model-capability refusal byte-shape
and gate order untouched and leaks no evidence into it; evidence comes from the
tile's own staged set and never becomes a buffer section; and one turn records
one content-free usage event whose four unfillable fields are declared absent.

The telemetry unit file pins the shape itself: no field a caller could put text
in, tokens only when a provider reports one, and a bounded per-process meter.

Ref: add-doxbench-editing-phase-b tasks 10.6/10.7/10.8, design §3.4
…packet supplied

The route always assembles a packet, so the assembler's own 'none supplied
means the DECLARED reduced one' branch had no covering test: reverting it left
every route test green. This is that pin, found by revert-testing rather than
by reading.

Ref: add-doxbench-editing-phase-b task 5.4
…sely

Tasks 10.1-10.8 and 5.4 ticked in the house realized-note style, with every
judgement call flagged in the task line rather than left in a commit message:
the bounds refusal's wire code, the exempt-status set widened to cover
'standard', the reduced posture's surface-visibility obligation recorded
against a future release, transcript's position, and the packet's declaration
section.

Task 3.7's recommended precision correction is applied to design §7.1,
proposal.md and tasks 2.1, citing verification-findings.md: Phase B is the
first FORMAL PER-REQUIREMENT and first SUBJECT-FREE memory-gateway consumer,
not the first to reference the contract at all — hermes-install's
add-memory-gateway-binding precedes it, and that strengthens the delta's case.

Ref: add-doxbench-editing-phase-b tasks 10.1-10.8, 5.4, 2.1, 3.7
A test asserting a dataclass's field set should import dataclasses itself, not
borrow the import from the module it is examining.

Ref: add-doxbench-editing-phase-b task 10.1
… what it stood on

F2: an oversized packet no longer refuses the turn forever. The bounds rail
now FITS by selecting less — evidence is walked best-ranked first and kept
while it fits the remaining budget — and NAMES every ref it selected out, which
is layer one's lossless-by-reference rather than truncation. Nothing is
shortened: a source is carried whole or not at all. Dropping strictly from the
tail was the obvious alternative and is worse, because one oversized top hit
would evict every smaller item behind it. A genuine refusal remains only when
the NON-EVIDENCE sources — the session's own threads, which nothing selected
and nothing else carries — exceed the bound alone; that refusal is actionable,
because layer two exists to compact a thread.

F5: the packet carries the revision its evidence bytes were read at and states
plainly that they are the SERVED CHECKOUT's, not the session worktree's, so a
document saved or created in this session appears at pre-session bytes or not
at all.

F6: the packet states retrieval COVERAGE (indexed of confined). A shortfall is
declared as not-retrievable-this-turn instead of being silently absent, and the
lossless note no longer overrides the lines that qualify it.

Optional, both taken: a retrieval backend that REFUSES degrades to the declared
reduced posture instead of killing the turn (the delta already rules on 'the
knowledge service cannot answer'), and the exemption tolerates a DECORATED
Status value, since this corpus already carries 'record · …' forms and a
decorated 'ratified (…)' would otherwise lose its exemption silently.

Also records that 'approved' is foreign-corpus tolerance: zero corpus hits, not
a status this repository issues.

Ref: add-doxbench-editing-phase-b tasks 10.3/10.5/10.7
…ntence names the packet

F1 (BLOCKER): require_valid had zero production call sites — a packet issued
for another repository, another tile, or an expired turn was rendered into the
prompt unexamined. build_prompt_envelope now revalidates the packet it was
handed BEFORE assembling any section text, on the SAME injected clock the
packet was issued on, so a rejected packet discloses none of its own content
and a freshly assembled one can never fail its own expiry check by reading two
clocks. One test per axis: purpose, scope, expiry.

F8: SYSTEM_CONTRACT_TEXT's grounding sentence listed only the buffers, the
scope metadata and the transcript — excluding every section §10 added and
contradicting the source-ranking hierarchy sitting directly beneath it. It now
names the packet declaration, the thread and thread-state sections, and the
evidence with its refs.

Also re-pins the three bounds tests to F2's two arms with the reason stated,
and adds the decorated-Status and retrieval-refusal cases.

Ref: add-doxbench-editing-phase-b tasks 10.3/10.4/10.7, 5.5
…ed coverage

The released failure envelope's `error` is a free-form pattern string, not an
enum, so a server-side condition can be named honestly with no contract change.
Two recorded judgement-call spellings replace one false reuse:

  * context_packet_bound_exceeded (409) — the session's own THREADS exceed the
    bound alone. 413 'the request exceeds the allowed size for this route' was
    false twice over and refused every turn on that tile forever; this message
    names the act that fixes it, and carries the measured dimension.
  * context_packet_invalid (500) — the packet failed its leash twice. No
    request the caller could send would fix it, so a 4xx would misdirect.

The route now REJECTS a packet that fails its leash and REQUESTS A NEW ONE,
exactly as the delta words it; only a second failure refuses, and nothing is
dispatched in between. The packet assembler is injected like every other
collaborator this route reaches, which is what makes the leash testable end to
end — six route tests, three axes x reject-then-refuse and reject-then-serve.

F2's fit arm and its genuine-refusal arm now each have a route test, the fit
arm driven by the review's own repro (a real tile with an oversized document).
F6's coverage and F5's revision line are asserted on a real route too.

Re-pins, with reasons stated: the closed error-code set gains a _PACKET_CODES
category, and 'only the limit code carries a limit block' becomes 'only the
limit-BEARING codes' — the rule was always about dimension-bearing refusals,
and for a long time exactly one refusal was.

Ref: add-doxbench-editing-phase-b tasks 10.3/10.4/10.5
…no phantom protocol

F4: 'Gateway Conformance Is Testable' drops from REALIZED to NARROWED. Its
scenarios are about a DomainxFactory's stack.yaml block checked by the
domain-factory validator; doxBench is not a domain factory, and nothing outside
this repository's own test run reads the declaration today. What it realizes is
the RULE — a conformance claim that executes rather than asserts — and claiming
the requirement whole would have been the unchecked assertion it exists to
prevent.

F7: the tier column was invented for one requirement (declared M0 where the
spec's tier block never tiers it) and FLATTENED for another (M4 where the spec
says in as many words that it follows the tier of the operation it mirrors).
Both are transcribed now, with TIER_UNTIERED and TIER_MIRRORS_OPERATION, and
the roster test — which checked names only — now asserts every value against
the spec's own tier block.

F9: an evicted scope answered None, byte-identical to a session that never ran,
so 500 metered turns and zero read the same. session() now has three distinct
answers, eviction is counted, and eviction is least-recently-RECORDED rather
than first-opened so the busiest live conversation is not dropped first.

F10: the boundary is IN-PROCESS. The ratified delta never says MCP and nothing
here speaks that protocol; the docstring now says so, and records that the
stdio MCP server plus the xd://mcp__<server>__<tool> mount-name pin belong to
§11, the first slice with a harness to expose them to.

Ref: add-doxbench-editing-phase-b tasks 10.2/10.8, design §7.1
…notes the review falsified

F3: 10.7 is re-opened in 5.4's half-open shape. The packet half is done; the
SURFACE half is not, and the earlier note claimed an obligation was 'recorded
against the release that will carry it' while naming no release — and both
cited precedents failed (§13 is closed and carries nothing; §11.7 records by
naming its OWN future release and staying open). It now names one: an additive
chat-turn-success growth carrying the context posture and its reason, allocated
at its own realization, because the success envelope is closed and has no room
for it today.

F5: 10.5's promoted-findings note justified the empty set with a claim that is
false for the case that matters — a session-CREATED finding is
confined-but-unindexable, because creates land in the session worktree and the
corpus is read from the served checkout. The empty set is right for the other
reason recorded there (no register may be built), and the boundary is now
stated in full.

Also records F1's leash fix, F2's two arms and their two honest wire codes,
F6's stated index bound, F9's honest restatement of 'emitted', F10's in-process
boundary and what §11 owes, and F4/F7's corrected disposition and tier column.

Ref: add-doxbench-editing-phase-b tasks 10.2-10.8
A prompt that RANKS material it also forbids is a prompt that cannot be
followed: ranks 2-4 of the source hierarchy all arrive in sections the old
grounding sentence did not admit. The pin asserts both halves of the constant
agree.

Ref: add-doxbench-editing-phase-b task 5.5
NF1: the F4 disposition is pinned BY NAME — flipping 'Gateway Conformance Is
Testable' back to REALIZED failed nothing, because no test named it, and a
claim about what this surface does NOT do is exactly the kind that rots
silently.

NF2: the coverage line says 'the index covered', not 'retrieval covered'. The
number is about what was INDEXED, and under the reduced-retrieval posture no
retrieval happened at all — the two sentences contradicted each other on the
same packet.

NF3: the route test that claimed to assert the shortfall was asserting FULL
coverage; renamed truthfully, and the shortfall branch now has its own route
drive (squeezing the index bound on the live handler, the reviewer's own way).

NF4: the F5 worktree caveat is no longer gated on the revision string it warns
about — a snapshot declaring no revision dropped the whole disclosure exactly
where the reader had least information. The condition is now 'does this packet
stand on retrieved bytes at all', and a missing revision is SAID ('revision
unknown'). Also emitted when every evidence item was dropped, since the dropped
refs point at the same served-checkout bytes.

NF5: dropped refs are named 'best-ranked first' — bounds_rail walks best-first
and appends what does not fit, so the first name printed is the HIGHEST-ranked
drop and the sentence said the opposite of the data beside it.

NF6: the packet_assembler seam carries the governance rails, so it gets the
guard knowledge_declaration has — a server built with no kwarg binds the real
assembler, and neither entrypoint may pass the argument, asserted against the
build_server call sites' own AST rather than a grep.

NF7 (taken): the fit CAN drop ratified or standard canon by byte size while
carrying a draft that fits. Stated in the rail and pinned: the exemption
governs compression, not selection, and the dropped ref is named either way.

NF8 (taken): task 10.2's heading itself now reads 'The ONE tool boundary'
rather than leaving the note to contradict the line above it.

Ref: add-doxbench-editing-phase-b tasks 10.2/10.3/10.5/10.6, design §7.1
Copilot AI lite review requested due to automatic review settings August 19, 2026 18:04

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

@brettheap

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9db01973bb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

backend = doxbench_knowledge.build_backend(declaration)
boundary = doxbench_knowledge.KnowledgeToolBoundary(backend)
sources = self._indexed_sources(projection)
boundary.reindex(sources)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Run packet rails before invoking the retrieval backend

On every knowledge-enabled turn, boundary.reindex(sources) reaches the retrieval provider before _new_packet() invokes any packet rail; inside assemble_packet, knowledge.search() and get_source() likewise run before selection_rail, exemption_rail, and bounds_rail. This contradicts the governing requirement in openspec/changes/add-doxbench-editing-phase-b/specs/ideation-dashboard/spec.md:440 and design lines 253–256 that selection and lifecycle exemption run before any retrieval provider is reached, while the new memory-gateway declaration incorrectly reports that invariant as realized. Reorder the boundary so these rails actually precede provider access, or do not claim conformance.

AGENTS.md reference: AGENTS.md:L9-L10

Useful? React with 👍 / 👎.

Comment on lines +956 to +957
*(PromptSection(key=key, text=text)
for key, text in doxbench_packet.packet_sections(packet)),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Enforce the model limit after adding packet sections

When the selected model has a small input limit, or the request is already near its limit, these newly appended sections can add up to 256 KB of evidence after serve.py:1988-1997 has validated only the request-body fields. Nothing rechecks PromptEnvelope.rendered() against effective_input_limit, so an otherwise accepted turn can dispatch a prompt larger than the catalog's declared model capacity and fail at the provider instead of returning the measured limit refusal. Fit the packet to the remaining input budget or validate the complete rendered prompt before dispatch.

AGENTS.md reference: AGENTS.md:L9-L10

Useful? React with 👍 / 👎.

Comment thread scripts/ideation_dashboard/serve.py Outdated
identity-verified, so nothing is read twice from two places."""

sources = []
for ref in projection.context_paths[:self.MAX_INDEXED_SOURCES]:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Fill the index bound after skipping unreadable sources

When any of the first 200 context paths is missing, non-file, or non-UTF-8, slicing before filtering leaves unused index capacity while later readable documents are never considered. For example, 100 unreadable entries followed by 200 readable entries produce only a 100-source index rather than the declared maximum of 200, reducing retrieval based solely on snapshot order; the resulting coverage text also incorrectly says every omitted document was beyond the index bound. Iterate until 200 successfully indexed sources, and distinguish unreadable omissions in coverage.

AGENTS.md reference: AGENTS.md:L9-L10

Useful? React with 👍 / 👎.

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 implements doxBench Phase B §10 by introducing a staged-set knowledge service, a bounded context packet (including reduced posture behavior), content-free usage telemetry, and a machine-readable memory-gateway conformance declaration; it wires these into the doxBench server route and pins the behavior via extensive tests.

Changes:

  • Adds the bounded context packet pipeline (doxbench_packet) and integrates packet assembly + leash revalidation into prompt assembly and the serve route.
  • Introduces a stdlib-only local-hybrid staged-set retrieval backend and tool boundary (doxbench_knowledge), plus install-time backend declaration wiring in serve.py/cli.py.
  • Adds content-free usage metering (doxbench_telemetry) and a subject-free local consumer memory-gateway conformance declaration (doxbench_memory_gateway), with new/updated tests across the route and modules.

Reviewed changes

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

Show a summary per file
File Description
tests/ideation-dashboard/test_doxbench_turns.py Updates prompt-section keying, packet integration, and leash revalidation tests at the prompt assembler.
tests/ideation-dashboard/test_doxbench_telemetry.py Adds tests pinning telemetry content-freedom, declared absences, and bounded meter semantics.
tests/ideation-dashboard/test_doxbench_routes.py Extends serving harness to inject knowledge declaration and packet assembler seams and inspect handler state.
tests/ideation-dashboard/test_doxbench_request_handling.py Pins new packet-era error codes and the set of limit-bearing error responses.
tests/ideation-dashboard/test_doxbench_memory_gateway.py Adds executable tests asserting memory-gateway declaration completeness and its constructive refusal/loss rules.
tests/ideation-dashboard/test_doxbench_knowledge.py Adds tests for the knowledge service boundary, port, local-hybrid retrieval, confinement, and install-time declaration rules.
tests/ideation-dashboard/test_doxbench_knowledge_service.py End-to-end server tests for knowledge service wiring, degraded posture, leash enforcement, bounds behavior, and telemetry retention.
scripts/ideation_dashboard/serve.py Wires install-time knowledge backend declaration, packet assembly + leash behavior, telemetry meter, and new refusal codes into the server route.
scripts/ideation_dashboard/doxbench_turns.py Adds packet integration to prompt construction and emits content-free telemetry during prompt assembly.
scripts/ideation_dashboard/doxbench_telemetry.py Introduces content-free per-turn/per-session usage event shape and a bounded in-process meter.
scripts/ideation_dashboard/doxbench_packet.py Implements bounded context packet rails (confinement, selection, exemption, bounds fitting/refusal), leash validation, and prompt-section rendering.
scripts/ideation_dashboard/doxbench_memory_gateway.py Adds a machine-readable subject-free local consumer conformance declaration with validation/reading helpers.
scripts/ideation_dashboard/doxbench_knowledge.py Adds the staged-set knowledge service v1 tool boundary, assembly port, local-hybrid backend, and install-time declaration enforcement.
scripts/ideation_dashboard/cli.py Ensures the CLI entrypoint declares the self-hosted knowledge backend at server construction.
openspec/changes/add-doxbench-editing-phase-b/tasks.md Updates the tracked task checklist and rationale notes for §10 and related pins.
openspec/changes/add-doxbench-editing-phase-b/proposal.md Adds the precise “first consumer” framing clarification for memory-gateway conformance.
openspec/changes/add-doxbench-editing-phase-b/design.md Adds the precise “first consumer” framing clarification for memory-gateway conformance.

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


for token in tokens:
yield token
if len(token) > CHARACTER_NGRAM:
brettheap added 3 commits August 19, 2026 14:18
…ightened

CODEX-B (confirmed): the request bytes are measured against the catalog's
effective input limit BEFORE the packet exists, and the packet's sections are
appended after -- so an accepted turn could dispatch a prompt past the model's
declared capacity and fail at the provider instead of at a measured bound. The
packet's bound now COMPOSES with the model's: the route passes the remaining
budget (limit minus measured request minus a declared scaffold reserve) and the
F2 fit machinery carries what fits, naming what it dropped. Refusing instead
would have resurrected the un-actionable-refusal class the fit removed; the
genuinely-unfittable case -- non-evidence sources over the remaining budget --
still refuses through the 409 arm with the measured dimension. The reserve's
adequacy is MEASURED against real rendered prompts at three ceilings, not
asserted.

CODEX-C (confirmed by repro: bound 2, three paths, ONE indexed): the slice ran
before the readability filter, so an unreadable entry consumed index capacity
and readable documents behind it were never considered -- and the coverage line
then blamed "the declared index bound" for omissions the bound had nothing to
do with. The bound is now on what is INDEXED, and CorpusCoverage keeps the two
omission classes apart: unreadable-at-this-revision versus beyond-the-bound.

COPILOT-D (confirmed): the strict length comparison skipped the single n-gram
of a token exactly CHARACTER_NGRAM long, so every three-letter token
contributed no n-gram while four-letter tokens contributed two -- contradicting
the docstring and weakening the vector leg precisely where the lexical leg
generalizes worst. Fixed, and pinned on the feature ENUMERATION rather than on
a score. Both score-coupled scenarios re-derived and re-verified: the null
query still yields zero on both textual legs, and the vector-leg case still
fires with lexical == 0.

CODEX-A (refuted, honesty checks done): design section 3.1's step 2 CONTAINS
the evidence search while its prose says steps 2-3 precede every provider, so
the two cannot both be literal. The implementation takes the coherent reading
and now SAYS so where the claim is made -- the rails disposition and the module
docstring both state that the rail governing the retrieval provider is the
confinement, handed to it rather than applied afterwards, and that the index it
searches is a subset of the confinement by construction. That last claim is now
asserted by a test rather than argued.

Ref: add-doxbench-editing-phase-b tasks 10.1/10.3/10.5/10.6
CODEX-B's input-limit composition, CODEX-C's indexed-not-attempted bound and
the two omission classes, COPILOT-D's n-gram off-by-one with its re-derivation
note, and CODEX-A's refutation with the coherent reading stated where the claim
is made.

Ref: add-doxbench-editing-phase-b tasks 10.1/10.3/10.6
The input-limit composition test was built on the fat checkout, whose ~344 KB
documents exceed the packet's OWN 256 KB bound — so they dropped with or without
the composition and the test passed either way. Reverting the composition left
it green, which is how this surfaced.

It now uses a mid-sized checkout (~60 KB per document): affordable under the
packet bound, unaffordable under a narrowed model ceiling. That gap is what the
pin is about. The scaffold-reserve test additionally asserts the generous
ceiling really did carry evidence, so the reserve cannot be "proved adequate"
by a packet that spent nothing.
Copilot AI review requested due to automatic review settings August 19, 2026 18:30
@brettheap

Copy link
Copy Markdown
Contributor Author

Thanks — reproduced each before touching anything. Three fixed, one refuted with the record. New tip c137c5a.


CODEX-A — rails before provider I/O · refuted, and the claim tightened

Not reordering, because the reorder is not a stricter reading of the requirement — it is an incoherent one. Design §3.1's step 2 box itself contains evidence: knowledge service search, and the prose beneath it says steps 2–3 run "before any retrieval provider or model provider is reached". Both cannot be literally true. Selecting evidence before consulting retrieval would mean selecting from a set we have not yet asked about.

The implementation takes the reading that preserves what the rails are for:

  • the rail that governs the retrieval provider is the confinement — computed first and handed to the provider, not applied to its answers afterwards;
  • selection, the lifecycle-status exemption and the bounds fit all complete before the MODEL provider is reached;
  • a refusal at any of them discloses no packet content.

You were right that the declaration overstated it, though — it asserted the invariant flatly without the reading that makes it true. Both honesty checks done:

  1. The Rails Run Before Provider I/O disposition now states the reading explicitly rather than the bare claim, and doxbench_packet's module docstring records why §3.1 needs a reading at all (quoting the contradiction).
  2. Confirmed reindex receives only confined sources: _indexed_sources reads projection.context_paths, which is the tile's staged set and is exactly what confined_refs derives the admissible set from — so the index is a subset of the confinement by construction. That was previously only true, not asserted; now test_the_index_is_built_only_from_CONFINED_sources asserts it, and revert-testing confirms it fails when an out-of-confinement path is spliced in.

CODEX-B — model input limit · confirmed and fixed

Verified: the byte check at serve.py:1990 measures request_body_bytes (outline + documents + message + working subject + transcript) against effective_input_limit; the packet's sections are appended later in build_prompt_envelope, and nothing rechecked the rendered prompt. Real gap.

Fixed by fitting, not refusing, as you suggested — the route passes the remaining budget as the packet's bound:

packet_budget_for(input_limit_bytes, request_bytes)
  = max(0, min(MAX_PACKET_BYTES,
               limit - request_bytes - PROMPT_SCAFFOLD_RESERVE_BYTES))

The reserve covers what the prompt spends outside both the packet and the measured request (the fixed system-contract/response-instruction constants, data-handling and scope sections, section labels, and the packet's own declaration). Its adequacy is measured, not asserted: a test renders real turns at three ceilings and checks the assembled prompt against each.

A budget of zero is a legal answer — the turn is served carrying no evidence and naming what it dropped, rather than refused. The genuinely-unfittable case (non-evidence sources over the remaining budget) still refuses through the existing 409 context_packet_bound_exceeded arm with the measured dimension. Both arms have route tests under a narrowed catalog ceiling.

One note worth recording: the first version of the fit test passed with the fix reverted, because it was built on documents (~344 KB) larger than the packet's own 256 KB bound — so they dropped either way. Revert-testing caught it; the test now uses ~60 KB documents, affordable under the packet bound and unaffordable under the narrowed ceiling, which is the gap the pin is actually about.


CODEX-C — index bound underfill · confirmed by repro and fixed

Repro, before the fix — bound 2, three paths, first one missing:

MAX_INDEXED_SOURCES = 2
attempted paths     = 3
indexed             = ['ideation/brainstorm/doc-health-checks.md']
UNDERFILL?          = True

The readable dtn-register.md was never considered. Fixed: the loop now iterates all of context_paths and breaks on len(sources) >= MAX_INDEXED_SOURCES — the bound counts what is indexed, not what is attempted.

And you were right that the coverage sentence then lied. CorpusCoverage(indexed, unreadable, total) keeps the two omission classes apart, because they mean different things to a reader: an unreadable document stays absent until someone fixes it, while a beyond-bound one would return under a larger bound. The declaration now reads e.g. "the index covered 5 of 9 documents in this tile's staged set: 2 could not be read at this revision and 2 were beyond the declared index bound", and an unreadable-only shortfall no longer mentions the bound at all.


COPILOT-D — n-gram off-by-one · confirmed and fixed

Verified directly:

'the'  (len 3): ['the']            <- no n-gram
'abcd' (len 4): ['abcd', '#abc', '#bcd']

Not deliberate — a plain off-by-one contradicting _features' own docstring, and it weakened the vector leg precisely for the short tokens the lexical leg generalizes over worst. Changed to >=.

On the score-coupling warning: re-derived rather than tuned. The two score-dependent pins were re-verified to still discriminate — the null query (xqxqxq) still returns zero hits with both textual legs at zero, and the vector-leg case still fires with lexical == 0. The new pin is on the feature enumeration, not on a score, so it states the rule directly and cannot drift with the hash.


Gates (at c137c5a, merged with current origin/main)

  • pytest, separate invocations: tests/ideation-dashboard 3479 passed, 7 skipped; tests/ideation_dashboard 63; tests/doc-health 665; all other suites green per directory.
  • openspec validate --all --strict → 62 passed, 0 failed.
  • doc-health pre/post, same slug, baseline at origin/main → zero new findings, headline identical.
  • validate-ideation-dashboard-contracts.py → 0 errors / 4 warnings (the four v1 deprecation warnings are by design).
  • contracts/ and scripts/ideation_dashboard/web/ → 0 files changed vs origin/main.
  • Every new pin revert-tested: 13/13 this round (44 across the branch), each hunk reverted individually and required to fail its named test.

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 18 out of 18 changed files in this pull request and generated no new comments.

Suppressed comments (1)

scripts/ideation_dashboard/doxbench_packet.py:1019

  • declaration_text() appends _LOSSLESS_NOTE unconditionally, which states omitted corpus material is "one retrieval call away". In reduced posture the packet explicitly has provider_id == PROVIDER_NONE (no retrieval provider was reached), so this sentence becomes misleading/false for the reduced case and can contradict the reduced-posture declaration.
    lines.append(_LOSSLESS_NOTE)

brettheap added 2 commits August 19, 2026 14:53
…erve breach

NF-B: corpus_coverage was the one ContextPacket field with no constructor
validation, so a caller still passing the old (indexed, total) tuple
constructed fine and then raised AttributeError deep inside declaration_text --
the T104 F4 class, where a handler dies mid-turn and drops the connection
instead of refusing. Refused at construction now, where the wrong shape
arrives, with one test.

NF-A: the flat PROMPT_SCAFFOLD_RESERVE_BYTES is adequate for the shape this
slice ships -- evidence, no threads, measured against real prompts at three
ceilings -- and is BREACHED by the shape section 11 creates: 24 thread-state
sections plus 6 evidence sections at 120-character refs spend ~19.7 KB of
uncounted section scaffolding, and the 48-source bound ~31.2 KB, both past
16384. Recorded against task 11.5 -- the slice that creates the shape which
breaches it -- rather than in section 10's ticks, so it survives this change's
archive the way task 10.7's release obligation does. Both fix options are
named (charge rendered section bytes, or scale the reserve with the source
bound) and the re-measure method is the one the existing reserve test already
uses, extended to thread sections.

Ref: add-doxbench-editing-phase-b tasks 10.3/11.5
Copilot AI review requested due to automatic review settings August 19, 2026 19:01
@brettheap
brettheap merged commit ece236a into main Aug 19, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

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

@brettheap
brettheap deleted the change/doxbench-b-s10-knowledge branch August 21, 2026 23:57
brettheap added a commit that referenced this pull request Aug 22, 2026
…ve contract-v1.40) (#256)

* WIP 10.7: the assembled context's posture, on the schema and in the record

Additive on `$defs/success_v2`: ONE optional property, `context_packet`, a
closed object carrying the packet's own `posture` (`full | reduced`) and its
`reduced_reason`, with two conditionals refusing each half of the truth-pairing
`ContextPacket` enforces at construction -- reduced-without-reason and
reason-on-full. Nothing previously valid becomes invalid: the key is OPTIONAL and
its ABSENCE is not a posture claim.

ONE OBJECT rather than two sibling keys, on the `selected_model` precedent in
the same file: one fact about one thing, the present-iff rule stays local to the
object that owns it, and the ENVELOPE's key set is identical for a full turn and
a reduced one.

`serve.doxbench_context_packet` is the ONE derivation, beside
`doxbench_selected_model`, reading the packet the turn actually ran under --
never re-deriving from "was there a knowledge service?", which would be a second
authority (the packet also reduces when a live backend REFUSES a retrieval). It
is called INSIDE the route's packet boundary, so a lying injected assembler is a
`PacketError` mapped to the fixed `invalid_turn_request` rather than a guessed
posture. The builder takes two named scalars, not a dict, and the posture is
REQUIRED of it.

The v1 lane is untouched and its second limitation is recorded at the arm.

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

* WIP 10.7: the surface states the reduced posture

The browser half the release exists for. `settleTurnSuccess` adopts the record's
`context_packet` instead of projecting it away (the adopter is total by refusal
and FAILS CLOSED on a contradiction -- a `reduced` with no readable reason drops
to null rather than showing the silent degradation with a badge on it), and
`beginTurn` and `adoptThreadTranscript` clear it, so the note only ever
describes the answer currently on screen.

`reducedContextNote` is the one pure selector, and `div.doxchat-context` is one
aria-live note under the transcript. A FULL turn shows nothing new: a standing
"full context" badge is a line operators learn to stop reading, which is how the
reduced one would stop being noticed.

Deliberately a rail-level fact about the LAST ANSWER, not a per-turn badge: a
transcript restored from the server's thread sidecar carries no posture, so
per-turn badges would be present on a lived-through turn and absent on the
identical restored one.

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

* WIP 10.7: the delegated validator, the packaged corpus, and the repin

The validator learns `check_context_packet`: the PAIRING (restated on purpose --
the v1.38 F2 finding was a file gate that had grown weaker than the type gate
while claiming parity, and three gates now assert this one rule) plus the
credential/endpoint spelling scan over the reason, which is the release's one new
free-prose field and the only rule here the shape cannot express. A third rule
was considered and rejected in the docstring: prose-matching the reason.

Packaged: TWO positives (reduced-with-its-reason, explicitly-full) beside the
unchanged pre-release record whose continued validity IS the additive claim, and
FOUR negatives -- reduced-without-reason, reason-on-full, an unknown posture, and
a fourth fact on the closed object. Validator stays 0 errors / 4 warnings;
examples 39 -> 41 valid, 61 -> 65 negative.

Repin: CONTRACT_TAG -> contract-v1.39 with the `unpublished:` sentinel for the
ref, the CHAT-TURN digest moved (the catalog's unmoved -- the mirror image of the
v1.38 repin), the manifest row digest + rewritten consumption_rule, and the
test-side RELEASED_* mirror plus the packaged-positive count 11 -> 13.

The route fixture schema declares `context_packet` and does NOT require it,
mirroring the release: that fixture's job is discriminators and closedness, and
the released bytes hold the value rules.

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

* WIP 10.7: pin the release from four sides

CONTRACTS: the additive-class block against the REAL released bytes -- the
pre-release record still valid with no posture at all, four conformant postures,
eleven refusals (including the reason at its exact 500-byte ceiling and one byte
past it), the S1-vs-S3 read on this shape (each conditional guards a case the
other does not, and the unknown posture is refused by the enum NEITHER touches),
and the blast radius: the v1 success and the v2 failure both refuse the key, so
"one optional property on one shape" is checkable rather than described.

THREE GATES, ONE RULE, asserted: each packaged pairing negative is refused by the
shape, by the delegated validator with the `context-packet` finding code, AND by
`ContextPacket.__post_init__`. The other two negatives are the shape's alone and
the table says so -- the validator does not restate an enum or a closure.

ROUTE: the reduced and full scenarios end to end on the widened lane; the record
and the packet's own declaration pinned equal; a REFUSING backend recording its
own reason (the case a "re-derive from whether a knowledge service existed"
implementation would get exactly backwards); the v1 lane still succeeding and
still unable to say so; and every shipped reduction reason checked against the
released ceiling, because an over-long one would turn a degraded turn into a
`response_invalid` refusal on the one path nobody exercises by hand.

FAIL-CLOSED: four lying-assembler cases through the injected seam, each refused
with the fixed `invalid_turn_request` and nothing dispatched.

SURFACE: a node probe over the SHIPPED bytes -- reduced renders the note and the
reason, full renders nothing, an older record renders no phantom badge, both
self-contradicting records render silence rather than half a statement, and a
new flight clears the note.

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

* contract-v1.39: the doxBench chat-turn's assembled-context posture (additive)

Completes the release surface for tasks.md §10.7 of add-doxbench-editing-phase-b:
the CHANGELOG entry and the release DIGEST INVENTORY. The schema growth, the
manifest row (recomputed digest + rewritten consumption_rule), the bundle bump
and the consuming runtime repin are the preceding commits on this branch; the
branch squashes to one unit, exactly as §11.7's and §13's releases did.

ALLOCATED v1.39, CHECKED AT ALLOCATION. At the branch base 6614061 the
CHANGELOG's newest heading was contract-v1.38 and the bundle read
contract-v1.38, so v1.39 was the next available number. CHANGELOG presence is
the availability test -- the habit the v1.37/v1.38 episode earned.

THE PRECEDING RELEASE SURFACE IS GREEN, checked rather than assumed:
verify-commit --commit origin/main PASSES at 6614061 against
contracts/releases/contract-v1.38.digests.yaml. The v1.37 lane's
HGR-RELEASE-DIGEST-MISMATCH no longer applies now the bundle has moved.
Recorded in the entry, because the two preceding releases both found the
surface broken when they got there.

INVENTORY BUILT AFTER THE BUNDLE BUMP (v1.36's first tag failed on exactly
this): 190 entries, and exactly four digests move -- CHANGELOG, README,
manifest, and the chat-turn schema, which are precisely this cut's
inventory-member files.

A FIFTH PACKAGED NEGATIVE lands with the entry: a reduction reason leaking a
raw endpoint and a bearer credential. It is the ONE case the shape cannot
refuse, which is why it is the one this release delegates -- and the negative
table now records which gate owns each case rather than settling for
"something refused it".

* Tick 10.7 and 13.8: the last release is cut, and the build is closed

10.7 is CHECKED because the ratified `The knowledge service is unavailable`
scenario is claimable in full: the record carries `context_packet` and the rail
states the reduced posture to the HUMAN, which is the half the task stayed open
for. The tick records the release, the one derivation and its four
lying-assembler refusals, the two delegated rules and the third that was
rejected, the five packaged negatives and which gate owns each, the fail-closed
ceiling hazard, and SIX flagged judgement calls: one nested object with the
packet's own names, always stating the posture (the OPPOSITE of 11.7's
disclosure call, and why), omission is not a posture claim, no
`dependentRequired` and why that is not a weakening, the rail-level note rather
than per-turn badges, and the THREAD SIDECAR GAP -- flagged as a gap, refused on
the parser's fixed arity rather than on merit, and named as F3's honest
counterpart.

13.8 is CHECKED because the set it waits on is empty. Its stale sentence
claiming 11.7 owes a model-catalog release is CORRECTED with the citation
(contract-v1.38, PR #244 / 0f50b35, pin resolved at 58e4aec) -- 11.7's own
tick deliberately left that to this task's owner, and this is the owner
arriving. What the tick does NOT claim is spelled out: the squash sha, the
published tag and the sentinel resolution are the post-land step, with a blank
line for the follow-up to fill in.

Ledger: both remaining rows struck with attribution, TWO open rows became ZERO,
and the note says plainly that the archive gate's mechanical refusal no longer
standing is a statement about the gate rather than permission to walk through
it. Nothing archived.

proposal.md `contract_release:` goes THREE releases -> FOUR across three schemas
(the chat-turn schema carries two), and owes none.

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

* 10.7: guard the thread-switch clear, which revert-testing found unguarded

R24 came back GREEN: deleting adoptThreadTranscript's posture clear broke no
test. The probe now asserts it -- switching documents replaces the transcript
with the SERVER's thread record, which carries no posture, so a note left
standing captions one conversation with a fact about another (the same defect
class P2-9 found for the transcript itself).

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

* 10.7: record what revert-testing actually found, and rebuild the inventory

TWO honest corrections to the record, both from the 26-case revert pass:

* the delegated validator's RESTATED pairing arms are a DIAGNOSTIC, not an
  independent guard -- disabling both leaves the validator's own self-test
  green, because the shape refuses the same instances anyway. Same class as
  11.7's separator-collision and self-reference arms, handled the same way
  (pinned on the finding CODE, which is the only guard that fails). Said in
  both the CHANGELOG and the tick rather than left implying a second refusal.
* the tick now carries the revert-test summary, including the ONE case that
  came back GREEN and the test added for it.

The CHANGELOG is a v1.39 INVENTORY MEMBER, so the inventory is REBUILT with it
-- the habit the v1.37 lane's PR #242 miss earned. Still 190 entries, still the
same four moved digests.

* 10.7: state the revert-test count exactly (29 runs, 27 mutations, two GREEN)

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

* 10.7: tighten six claims the record was overstating, and repin

An adversarial reader would have caught every one of these, so they are fixed
before one has to:

* the key-set-equality argument cited "an existing route-level test still passes
  UNCHANGED". The pre-existing test is on the DEPRECATED v1 lane, where the key
  does not exist at all and which therefore says nothing about the nesting. The
  claim now names the NEW widened-lane test that actually carries it -- and says
  why two sibling keys would have made that test unwritable.
* "the packet half shipped at contract-v1.34's slice" -> it shipped with §10
  itself (PR #216). v1.34 was §13.
* "the inventory ships inside this cut, as contract-v1.34 through v1.38 all did"
  -> v1.37 did NOT, which is the defect this very file records against it.
* "the two preceding releases both found the surface broken" -> ONE preceding
  release found it broken, twice.
* the codexFactory chat-turn consumer doc is NOT in this checkout and was NOT
  read. The entry now states the OBLIGATION rather than asserting a finding.
* "1..500 bytes" -> JSON Schema counts `maxLength` in CODE POINTS. The producer's
  guard checks the stricter UTF-8 BYTE count against the same number, which is
  now what both the schema comment and the entry say.

Also: the unchanged pre-release example is unchanged in its INSTANCE (its header
comment grew), the pin-drift revert wording says three surfaces drifted once
rather than "both directions", `check_context_packet`'s own docstring now carries
the diagnostic finding, and 13.8's green numbers are re-measured AFTER the
origin/main merge with the fifteenth skip explained as a checkout-layout artifact.

The CHANGELOG and the SCHEMA both moved, so the digest is repinned on all three
surfaces and the inventory REBUILT after it.

* Review round 1: four should-fixes and three notes, each reproduced first

S1 — THE NOTE WAS WRITTEN WHILE HIDDEN, so "live-announced" was nearly false.
A `hidden` node is out of the accessibility tree; the text mutation landed in a
node no live region observed, and `aria-live` read `polite` either way, which is
why an attribute assertion could not catch it. Order now matches the failure
note beside it (un-hide, then write), and the probe pins the ORDER by recording
`hidden` AT THE MOMENT of the write.

S2 — THE SCHEMA COMMENT CLAIMED A BYTE GUARD THAT DID NOT EXIST, in released
bytes. Reproduced against the RELEASED validators: a 500-code-point CJK reason
(1,500 bytes) SERVED 200; a 501-code-point reason 502 `response_invalid` with
dispatch ALREADY COUNTED. Three fixes: the comment now says CODE POINTS and what
that means for a consumer sizing a buffer; the constants test's docstring names
its unit and why it uses the stricter one; and `doxbench_context_packet` gained
the bound itself, in code points, pre-dispatch -- so it refuses exactly what the
shape refuses and no conformant record more (the CJK case is still served, and a
test says so). The constant is pinned to the released `maxLength`.

S3 — 13.8 ASSERTED "MERGED" PRE-MERGE. The three pending facts (squash sha, tag,
sentinel) are lifted to the HEAD of the block so a reader meets them before any
claim they qualify, and the gate's verb is stated exactly: BUILT AND GATED now,
MERGED at the landing squash.

S4 — A FAILED FOLLOW-UP STRIPPED THE REDUCED ANSWER'S DISCLOSURE. Reproduced
(reduced -> note; FAILED follow-up -> no note, transcript unchanged). Took the
reviewer's SECOND shape: delete the `beginTurn` clear, because a flight starting
replaces no answer and every path that replaces one already replaces the posture
beside it. Restoring in `settleTurnFailure` was rejected -- it would need a stash
plus the same restore in `abortTurn` and `recordLocalFailure`, re-implementing
one invariant at three sites. Both directions probed and revert-tested.

N1 the redaction scan is a LINT with misses in both directions, not a guard --
kept, reworded in the validator docstring, the CHANGELOG and the tick.
N3 one route test drives a reduced turn through the RELEASED schema with the
default validator seam, closing the fixture-schema gap on the posture rules.
N6 `TurnStore` is per-process, in-memory and bounded; nothing durably stores a
v2 body. The durable record is the thread sidecar, which does not carry it.

The schema and the CHANGELOG both moved: digest repinned on all three surfaces,
inventory REBUILT after it.

* S1: assert the order over EVERY write, not the last one

The R27 revert-test came back GREEN with the defect restored. Cause: under the
wrong order a reduced turn produces TWO non-empty writes -- the settling render
writes the text while the node is still hidden (the announcement is lost there)
and a LATER re-render writes the identical text with it already visible. The
probe read writes[length-1] and saw only the benign second one.

Now asserted over every non-empty write: none may happen while hidden, and the
FIRST one is checked explicitly. Exactly the trap the reviewer warned about when
they said attribute assertions cannot catch this.

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

* 10.7: record the review round's nine revert runs, including the third GREEN

The S1 probe itself came back GREEN with the defect restored -- the most useful
result in the table, and the reviewer's own predicted failure mode one level up.
Recorded beside the other two.

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

* 10.7: re-measure 13.8's green numbers after the review round (3896 -> 3903)

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

* Review round 2: the ledger verb, the fourth answer-replacing path, and the snapshot

S3 RESIDUAL — the ledger summary paragraph, which a reader reaches BEFORE the
tick block, still said the release had "landed" and that the archive gate's
sentence "is true ... and it now is". Same overclaim, same correction: built and
gated now; merged and landed become true at the landing squash.

NEW-1 — `restoreChatState` is a FOURTH answer-replacing path and kept a stale
posture. Reproduced: restore a different conversation's snapshot over a reduced
state and the note survives, captioning "a DIFFERENT, un-described answer".
Reachability nil (the sole caller restores onto a freshly mounted rail) but
three enumerations claimed completeness at three paths. Named as the fourth in
all three, probed, revert-tested.

NEW-2 TAKEN AS (a), CLOSE IT, NO VERSION BUMP. `CHAT_SNAPSHOT_VERSION` is a
fail-closed gate -- restoreChatState keeps the FRESH state on an unrecognized
version -- so bumping would discard every stored blob on the first reopen:
composer text, subject, model choice and proposals, spent to add a caption. An
OPTIONAL field invalidates nothing: an old blob restores to posture-unknown (no
note, the pre-release behaviour), and a new blob read by an older build is
ignored because the restore reads named fields and never enumerates. Same
additive reasoning the wire contracts use, applied to a blob. The stored field
is named `context_packet` and carries the released object whole, so ONE
validator serves both readers and a contradictory blob fails closed.

An explicit `full` IS persisted. The first probe called that an oversight; it is
the doctrine -- absent and `full` are different facts everywhere else in this
release, so dropping `full` would restore "unknown" over a posture somebody
checked.

NEW-3 the live region is written only when its text CHANGES (the reviewer
measured seven re-announcements of the same 227-char sentence from composer
keystrokes); probe pins the write count across seven keystrokes.
NEW-4 the CJK conformance test now runs @released_only through _UNSET, so
"conformant" is a claim about the released bytes rather than about the fixture.
Its over-long sibling needs no such treatment: the producer guard fires before
any validator is consulted.

Also corrected: a tick sentence still saying `beginTurn` clears the note.
The CHANGELOG moved, so the inventory is REBUILT with it (the schema did not).

* NEW-2: pin the stored-posture guard on the ADOPTED STATE, not the rendered note

R39 came back GREEN twice. Cause: reducedContextNote holds its own second guard
on the same rule, so a note-level assertion is satisfied even when
restoreChatState trusts the blob whole. The probe now reads the adopted state
across five contradictions and also asserts the honest blob still adopts, so the
guard is shown to be discriminating rather than merely refusing.

(The second GREEN was a process error of mine, not a second defect: revert.py
restores with , which reverted this strengthening because I
had not committed it before running the drive. Committing first from here.)

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

* 10.7: record round 2's eight revert runs and the fourth GREEN

Twice now a probe has been satisfied by a downstream guard rather than by the
thing it names (S1's later re-render, NEW-2's selector second-guard). Recorded
as a habit to check. Also records the harness process note: commit before
revert-testing, because restore() is git checkout -- .

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

* 10.7: re-measure 13.8's green numbers after review round 2 (3903 -> 3908)

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

* Fold the reviewer's last two notes: soften a comment, name a follow-up

The adopter NORMALIZES (drops an unknown key and still adopts) where the
released shape's closure REFUSES the instance. "Exactly the rule a malformed
wire record does" was a shade strong for the closure case, so the comment now
says the PAIRING rule is shared and the verdicts differ -- and why each is right
where it sits. It lives in doxbench-chat-model.js, which is not released bytes,
so the correction lands at the source rather than in a frozen entry.

Recorded, NOT coded: adoptContextPacket applies no length bound to a RESTORED
reason (a tampered browser-local blob renders an arbitrarily long muted note;
browser-local, self-tamper only, nothing reaches the wire, the server or another
viewer). One line is the fix and it belongs to the slice that touches the
function next.

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

* 10.7: re-measure at the final merge (origin/main 0f9e14b, 3930 passed)

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

* Copilot #256: presence is not truthiness — fixed at four gates, not two

BOTH FINDINGS CONFIRMED, reproduced across all five gates before anything was
touched. The released shape forbids `reduced_reason`'s KEY on a `full` posture
(`not: {required: [reduced_reason]}`). Three other gates forbade only a USEFUL
value, so `{posture: "full", reduced_reason: ""}` passed them:

  instance            shape   delegated  ContextPacket  serve    adopter
  key absent            ok       ok           ok          ok       ok
  reduced_reason ""  REFUSES  REFUSES      ACCEPTS*    ACCEPTS*  ACCEPTS*
  reduced_reason null REFUSES ACCEPTS*       n/a         n/a     ACCEPTS*
  a real reason      REFUSES  REFUSES      REFUSES     REFUSES   REFUSES

Copilot 1 (serve.py) and Copilot 2 (doxbench-chat-model.js) are the third and
fifth columns. Fixing them surfaced two more of the same class: the CONSTRUCTION
gate `ContextPacket.__post_init__` had it too — and the release claims in writing
that the type, the shape and the validator "assert this one rule", which was
false at the blank — and the DELEGATED VALIDATOR read `reason is not None` where
the shape reads the key, so `.get()` could not tell a `null` from an absent one.
Copilot named two gates; there were four.

FIXED at each, with the unit matched to what the reader can see: `is not None`
at the type and the derivation (a Python attribute has no key/value distinction,
so that IS presence there), own-key presence in the validator and the adopter,
which read JSON and do.

THE REDUCED ARM IS UNCHANGED, deliberately, and the asymmetry is the shape's
own: `full` refuses the field for BEING THERE, `reduced` refuses it for being
UNUSABLE (`required` plus `minLength: 1`). Two rules, not one predicate — said
at each site, because collapsing them is how this comes back. Pinned both ways:
a blank still refuses on `reduced`, a real reason still passes, an absent key
still adopts on `full`.

Two packaged negatives, one per instance a different gate missed:
`-context-empty-reason-on-full` and `-context-null-reason-on-full`. Six
revert-tests, all RED, including two that loosen the reduced arm to prove the
fix tightened `full` without weakening it.

NO CONTRACT BYTE MOVES — the shape was right all along. Schema digest unchanged
at cc874fef…, inventory untouched, verify-commit passes; asserted rather than
assumed, and the two new examples confirmed NOT inventory members.

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

* 10.7: correct the bot round's revert count (7 runs) and note R43 is no fifth GREEN

The validator revert leaves its own self-test green because its pairing arms are
DIAGNOSTICS -- already recorded, and the finding-code pin that guards them went
RED. Predicted, then observed.

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

* Review N-1 and N-2: correct a "not rebuilt" claim, and make a per-stem table per-stem

N-1: two sites said the PACKET was not rebuilt and that `ContextPacket` is
byte-identical to what §10 shipped. False since the bot round, which tightened
the construction gate's full-arm predicate. Bounded and re-verified before
rewording: `assemble_packet` and both `REDUCED_*` constants have zero hits in
this branch's diff and `test_doxbench_packet.py` is unmodified, so the ASSEMBLY
claim stands as written -- one predicate moved, and it moved to keep the
three-gates-one-rule claim true rather than as a carve-out.

N-2: the type-gate parametrization mapped every non-reduced stem to
`(FULL, _REASON)`, so four parameterisations constructed TWO distinct packets
and the test reported per-stem coverage it did not provide -- the blank stem,
the exact instance the type used to accept, was never constructed there. Now a
per-stem table. The null stem asserts ACCEPTED against a stated representational
limit: a Python attribute has no key/value distinction, so `reduced_reason=None`
IS absence and the wire instance has no counterpart; the shape and the delegated
validator refuse it and are pinned doing so, and
`...agree_on_PRESENCE` is the faithful pin for the type.

A companion test requires every stem to have its OWN instance -- and it earned
itself on its first run, catching that `-reason-on-full` is a suffix of both new
stems, so the table is keyed on whole stems.

No contract byte moves.

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

* 10.7: re-measure 13.8 at the v1.40 re-cut (origin/main 1f45e42)

3940 passed / 15 skipped; doc-health 704 and openspec 66 both move because
#259's tests and its still-active change packet came in with the merge. Counted
fresh, not carried forward.

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

* Bot round 2 on the re-cut: three findings, all real, all from the renumber

Copilot and Codex INDEPENDENTLY caught the same miss, and it is the useful one.

1+2. styles.css:1881 still said contract-v1.39. A genuine miss: the file was not
in the renumber list, AND my own post-renumber audit could not have caught it --
the grep was scoped `--include="*.py" --include="*.md" --include="*.yaml"
--include="*.js"` with no `*.css`, so the one file that needed it was the one
class the audit was blind to. Re-swept with a content-only grep across ALL file
types: styles.css was the only hit, and it is now v1.40.

3. Codex, tasks.md:1085 -- the blanket renumber rewrote a HISTORICAL record into
a false one. That paragraph describes the allocation at branch base 6614061,
where the next available number was v1.39 and this cut took it; renumbering it
made it claim v1.40 "was available" there, which was never true. The CHANGELOG's
re-cut narrative had preserved the sequence correctly and the tick had not. The
paragraph now tells the sequence -- allocated v1.39 at the base, lost it to
PR #259 at landing, re-cut to v1.40 -- and says in as many words that an earlier
version of itself was the false one, rather than quietly correcting it. Swept
for siblings; this was the only historical claim the renumber corrupted.

4. Copilot, the credential-leak negative's header: "bounded at 500 bytes" is the
byte-vs-code-point confusion this release explicitly fixed elsewhere. Now
"`maxLength: 500` (code points, not bytes)".

No contract byte moves: none of the three touches contracts/, the schema digest
is unchanged at d8ee5624..., and the validator holds at 0 errors / 4 warnings
with 41 valid + 68 negative examples.

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

* Codex round 3: the same corrupted-history defect, in the pin comment

Codex found a SIBLING of its own previous finding: doxbench_contracts.py's pin
history carried the same mechanically renumbered historical claim -- "v1.40 WAS
AVAILABLE WHEN THIS SLICE ALLOCATED IT ... at the branch base (6614061)" --
which was never true. v1.39 was available there and this slice allocated it;
v1.40 came only after PR #259 took v1.39.

My previous sweep was scoped to tasks.md and the CHANGELOG. That is twice now
that a scoped sweep has been the thing that missed: first a grep with no *.css,
now a sweep of two files when the claim lives in four. The sweep is now
content-based across EVERY file for the historical phrases (branch base, was
available, next available, mid-flight, and each merge sha), and it finds only
the corrected paragraphs.

Fixed here:
* the pin history now tells the sequence -- allocated v1.39 at the base, lost it
  to #259 at landing, re-cut to v1.40 -- and says outright that a blanket
  renumber had left the false claim, rather than quietly restating the number;
* proposal.md's `contract_release:` frontmatter said only 11.7 had to move a
  number in flight. TWO of the four did: v1.37 -> v1.38 (#235) and v1.39 ->
  v1.40 (#259). Both re-cuts are the availability test working as written.

No contract byte moves; schema digest unchanged at d8ee5624...

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

* Codex round 4: a restored posture must not outlive the answer it describes

A NEW finding and a real one. `restoreChatState` drops malformed turns WHOLE
(P3-6(a)/(b)), so a perfectly valid stored `context_packet` can arrive with no
answer to describe. Three cases reproduced before fixing:

  empty transcript + valid posture      -> note rendered for NO answer
  assistant turn filtered, human kept   -> same
  NEWEST assistant turn dropped         -> the note captioned the OLDER answer
                                           with the NEWER answer's posture

The third is the wrong-answer caption this invariant exists to prevent, arriving
by a THIRD route after the failed follow-up (S4) and the cross-restore (NEW-1).

Fixed at the invariant rather than per-case: the posture is adopted only when
the restored transcript ENDS with an assistant turn, because that is the answer
a posture would be describing. A transcript ending in a human turn has no answer
on screen -- including the ordinary case of a tile closed mid-question. The
honest case still adopts, and the probe asserts that too, so this is a condition
and not a blanket refusal.

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

* Codex round 5: a reduction reason must be a STRING, not merely truthy

Reproduced, and worse than reported. `if not reason:` accepted any truthy value
and `str(reason)` then MANUFACTURED a reason from it:

  123          -> "123"
  ["a","b"]    -> "['a', 'b']"
  {"why": "x"} -> "{'why': 'x'}"
  object()     -> "<object object at 0x71c078978c90>"

A heap address, in a durable record, on the degraded path. Same
silent-normalisation class as the presence findings: malformed collaborator
output turned into a conformant-LOOKING posture instead of a refusal.

Fixed at BOTH gates, as the presence rule was -- the derivation and
`ContextPacket.__post_init__` -- because the released shape says
`type: string` and a truthy non-string is not a reason. The reason is now
carried VERBATIM rather than coerced: `str(reason)` is gone from the return and
from the ceiling measurement.

NOT restated in the delegated validator, deliberately and consistently: that
gate restates the PAIRING and nothing the shape already expresses, exactly as it
restates neither the posture enum nor the object's closure. A type constraint is
the same category. The browser adopter already required `typeof === "string"`.

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

* Codex round 6: the released ceiling on the reading side, and a guard that could not see its own case

TWO findings, both reproduced, both real -- and one of them breaks a guard this
branch added two rounds ago.

F1 -- THE ADOPTER HAD NO CEILING. This was recorded in the tick as a named
follow-up, deliberately deferred, on the grounds that the blob is browser-local
and self-tamper only. That rationale covered the wrong half of the surface: the
same adopter also reads the WIRE, the dispatcher validates only `ok` and `kind`,
so a malformed transport's oversized reason reaches browser state, the live
region and from there the persisted snapshot. Reproduced at 5,000 code points.
The bound is now in, pinned to the released `maxLength` by its own test, with a
reason exactly AT the ceiling still adopting. The tick records this as a
REVERSAL of its own deferral rather than quietly doing it.

F2 -- MY ROUND-4 GUARD COULD NOT SEE ITS OWN CASE. It tested the FILTERED
transcript's tail, which cannot distinguish the original terminal answer from an
earlier retained one: `[human, assistant "older", assistant(malformed)]` filters
to a tail that IS an assistant turn, so the guard passed and captioned the older
answer with the newer answer's posture -- exactly the defect it was added to
prevent, one layer in. Reproduced.

The test is now THE SNAPSHOT'S OWN TERMINAL ROW: adoption asks whether the
answer the posture BELONGS TO survived, using the same well-formedness predicate
the transcript filter uses so the two cannot disagree about what "survived"
means.

THREE restatements of one ceiling now exist (schema, serve, browser) and each
pair has a pinning test, so they cannot drift into three ceilings.

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

* Codex round 7: count the reading-side ceiling in CODE POINTS, not UTF-16 units

Correct, subtle, and the same mistake this release argued against on the server
side -- arriving on the browser side in the other unit.

JavaScript's `String.length` counts UTF-16 code UNITS; JSON Schema's `maxLength`
counts CODE POINTS. Reproduced: a conformant reason of 300 emoji is 300 code
points and `.length === 600`, so the ceiling added one round ago DISCARDED a
record the released contract accepts -- hiding the very disclosure this release
exists to show. `[...reason].length` iterates code points.

This is precisely the reasoning the S2 fix used to reject a BYTE-counting guard
on the server ("a byte-counting guard would refuse a conformant 1,500-byte CJK
reason"); the unit discipline was right there and the browser side got it wrong
anyway, which is worth recording rather than just fixing.

Pinned: 300 code points / 600 UTF-16 units, adopted.

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

* Fix the broken escape my own round-7 test commit introduced

`\u{1F600}` inside the Python-hosted JS harness string is an invalid Python
unicode escape (`\u` wants exactly four hex digits), so the previous commit
left test_doxbench_chat_view.py failing to COLLECT -- caught immediately by the
targeted run, but it was committed broken. `String.fromCodePoint(0x1F600)`
needs no backslash and says the same thing.

Recorded rather than amended away: a commit that cannot be collected is worse
than the defect it was fixing, and the reason it happened is that I ran the
tests AFTER committing rather than before.

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

* Codex round 8: drop the stale byte-guard claim from the tick

The tick's shape description still said the producer's guard "shadows [the code
point bound] with the stricter UTF-8 byte count". That was true of a draft and
is not true of the code: `serve.doxbench_context_packet` counts `len(reason)`
(code points) and the browser adopter counts `[...reason].length`, both pinned
to the released bound; the BYTE count applies only to the shipped `REDUCED_*`
constants, in a test, as a rule about text this repository authors.

The same task already called that claim false 90 lines further down, so the
change packet was contradicting both the implementation AND its own correction.
Now it describes the runtime code-point guard and the separate constants test as
two different things.

The two remaining "500-byte ceiling" mentions are contract-v1.38's, about
`data_handling`, and are not this release's to restate.

No contract byte moves.

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

---------

Co-authored-by: brettheap <[email protected]>
Co-authored-by: Claude Fable 5 <[email protected]>
brettheap added a commit that referenced this pull request Sep 6, 2026
…ec-CLI pin (codexFactory #227) (#720)

Records the completion of task 6.1 through codexFactory #216 (06935a4a), openxFactory #697 (724a2a4), xFactory #275 (5deaf90) and codexFactory #227 (bb66d85c); narrows the bump change's 6.3 note to the three consumers still unwired; closes the disposition change's step-3 successor box. No change directory, ledger row or contract moved. Merged on Brett Heap's standing word to lane codexfactory-1, "merge the tick PR when green" (2026-09-06); all nine checks green on 73c4ac4.
brettheap added a commit that referenced this pull request Sep 9, 2026
…gs, one root

THE BENCH FOUND TWO THINGS AND THEY WERE ONE DEFECT. Codex raised (1) that a
citation with prose before its path — `the packet at openspec/changes/foo/tasks.md`
— was classified as ANOTHER REPOSITORY'S on the strength of having more than one
token, so `check_citations` never opened it and a rename under it exited 0; and
(2) that a single-key mapping does not round-trip through `f"{key}: {value}"`, so
the admitted line `openspec/missing.md: false` came back `openspec/missing.md:
False`, whose last token `False` read as prose while the dangling path passed at
exit 0. Both are real, both are reproduced below, and both were the LAST-TOKEN
RULE — an arm that took one token of a citation as its referent, and took it from
`yaml.safe_load`'s VALUE where the pin's grammar, its own reader and its own
printed report all carry the LINE.

AND THE ROOT RAN DEEPER THAN EITHER REPORT. Measured on the live pin: a lossless
reconstruction would NOT have closed (2) — `openspec/gone.md: gone` rejoins byte
for byte and its last token is still `gone`, so the path still went unopened; and
the parser loses referents on this corpus in a second way nobody had named, since
a ` #` is a YAML COMMENT and three live citations (`PR #444`, `codexFactory PR
#216` twice) come back TRUNCATED to `'PR'` / `'codexFactory PR'` with the referent
cut off. A citation whose path sat after a `#` would never have been opened at
all. So the fix is not a better reconstruction; it is to stop reading the parser's
value.

WHAT NOW HAPPENS, AND ITS GROUND IN THE FIELD'S OWN GRAMMAR. The pin's header
says of `cited_to:` exactly that it "is required and must be non-empty"; the whole
of the rest is its own reader's production — `^      - (\S.*)$`, the remainder of
the line, verbatim, one citation per line, whose members it deliberately never
parses because flattening them "would make the reader guess a delimiter that a
citation could itself contain" — and that line is what its disposition report
prints for a human to open. So:

  * `citation_lines_in` reads the `cited_to:` LINES from the pin's bytes.
  * `check_citations` ALIGNS them one-to-one, in file order, against the citations
    `yaml.safe_load` parsed, so a finding still names the entry and item it
    belongs to. The alignment is PROVED, not assumed: if the two counts disagree
    the whole field is refused with one finding instead of classified, because an
    off-by-one would attach every finding to the wrong item and a flow sequence or
    a two-line citation is a form the pin's own reader does not admit either.
  * `read_citation` reads EVERY token of the line's referent region and decides
    the kind by FORM, in order: `://` is a URL, `#` is a forge reference (tested
    first, because `owner/repo#12` carries a slash too), `/` is a repo-relative
    path. A token with no `/` names no directory and is not read as one.
  * A QUALIFIER IS A DECLARED REPOSITORY NAME AND NOTHING ELSE, which is the
    bench's first finding answered at its root. `repository_qualifiers` reads the
    vocabulary out of the pin's own `repo:` fields — the field its verifier
    matches against a tree identity read from `git config --get remote.origin.url`
    — and only such a name, IMMEDIATELY before a path, makes that path another
    tree's. A name meaning THIS repository (`OWN_REPOSITORY_SPELLINGS`, restated
    from `scripts/doc_health/pin_class.py` and pinned equal to it by a test)
    qualifies nothing away. Two boundaries are stated rather than hidden: a
    non-adjacent qualifier is not read as one, and a repository the pin never
    declares is not in the vocabulary, so its path is resolved here and reported
    missing — a loud finding a reader answers by declaring the repository, over a
    silent pass on a path nobody opened.
  * The readers' DISAGREEMENT is still measured and named for a successor
    (`WARN`, exit code untouched: 5 lines truncated at a `#`, 2 read as single-key
    mappings), because quoting those scalars changes what the pin's line reader
    CAPTURES in a file vendored byte-identical into three sibling repositories —
    a governed repair with a re-vendor cost. But no verdict rests on it any more.

The gloss after the em dash is still not scanned, and the reason is now written
down where the cost falls: prose carries slashes that are not paths (`and/or`, a
date, `§5.1/§12.0`, the quoted `Totals: 23 passed, 2 failed (25 items)`), and no
citation in this corpus writes its referent after the dash.

MEASURED. `validate-pin-registrations.py` on this tree: exit 0, 21 citations
naming 17 referents (9 in-tree paths, 3 forge references, 5 qualified to another
repository, 4 citations naming no machine referent), 7 WARN lines, every in-tree
path resolves. On the PRE-REPAIR pin: the same two named findings and exit 1 —
unchanged from the first author's measurement, with the classifier rewritten under
it. `pytest tests/pin_registrations tests/manifest_digests -q`: 53 passed (26 on
`main`, 41 as first written). The arm AS FIRST WRITTEN fails 17 of this file's
citation tests. Mutations, each red: the resolve check dropped (8 tests, and the
pre-repair tree exits 0 — the pre-#840 state exactly); the last-token rule
restored (8, including the live register); the parser's value classified instead
of the line (2); the qualifier rule dropped (5); the alignment proof dropped (2);
containment bypassed (2); the trailing-colon trim dropped (3).
`validate-openspec-cli-pin.py --all --no-cache`: `Totals: 102 passed, 2 failed
(104 items)`, exit 0 — unchanged. `validate-manifest-digests.py`: 189 digests
verify. `doc-health --single-repo .`: BYTE-IDENTICAL to before this commit — 10
critical, 9 error, 57 warning, 16 info, 0 new regressions.

The repair of the two dangling citations stands as the first author left it, and
its ground was re-measured here rather than inherited: the pin's header carries no
rule that a recorded disposition is never edited — searched for `immutable`,
`append-only`, `frozen`, `never edited`, `once recorded` — while it does say
entries are ADDED by a human reading, RE-DERIVED at every bump, and DELETED when
their finding goes stale. Only the pointer moved, because only the pointer's
referent moved. `scripts/validate-openspec-cli-pin.py` is still not edited; no
`openspec/` path is touched.

Refs #840 (closed by the pull request that carries this commit).

Continuation: the first author died on a rate limit mid-fix-round at c599c90,
having named both findings and their shared root; this commit is that rewrite.

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