Skip to content

T052, declare the generator seam (5.4) and register openDox's own generator (plan 034) - #54

Merged
brettheap merged 7 commits into
mainfrom
build/034-p2g-t052-generator-seam
Sep 29, 2026
Merged

brettheap merged 7 commits into
mainfrom
build/034-p2g-t052-generator-seam

Conversation

@brettheap

@brettheap brettheap commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Authored ahead, as a phase-2 draft. Brett's RULING on openxFactory#656, comment 5857365170 ("Start phase 2's independent tasks"), names T052 among the phase-2 tasks authored as drafts. T049 has landed (openxFactory#1204 → 9d2e5bc3), so phase 2 is open. T052 is After: T049, T009, T053, and T053 has landed: openDox-spec#16 → f7ee3c76. This PR stays a draft until the holder un-drafts it.

Plan 034, T052 (5.4: declare the generator seam), phase-2 slice P2-G. The plan was read at openxFactory main 133e37d9 (specs/034-opendox-standalone-operation/tasks.md), and re-read at 9d2e5bc3, where T052's entry is unchanged. The slice is claimed on openxFactory#656, comment 5857453864. The branch was cut from openDox-code main 80acead1, and main 2d116415 (T036 #52, T037 #55) is merged in.

What it declares

Box 5.4 of #1144 reads "DECLARE THE GENERATOR SEAM — it does not exist and CorpusAdapter is not it", and asks for three things. The new module is src/opendox/generator_seam.py, beside domain_profile.py.

  • The operation handed over: generate(repo_root, repository, *, source_revision=None, generated_at=None, **inputs), which answers the snapshot, a dict.
    • These are the four arguments openDox's generate verbs already hand a generator.
    • A governed generator's own extras, such as project_register_source and possibles_source, travel as declared inputs. So the seam neither drops them nor names them.
  • The registration point, beside domain_profile.register(). A host calls opendox.generator_seam.register(<SnapshotGenerator>) once, at process start. Entry points call register_default(...), which registers only where nothing is registered. current(), is_registered() and unregister() complete the registry, in domain_profile's shape.
  • The conformance a contributed generator must meet. SnapshotGenerator(contract, generate, inputs=()) declares it, and generate() enforces it:
    1. It declares the contract it writes, which is the kind of every snapshot it answers.
    2. Its operation takes the seam's call, and each declared input is optional, because the seam passes an input only when the caller has a value for it. The seam checks this against the signature when the declaration is made. It binds the call once with every declared input given and once with none given, and every call the seam can make lies between the two.
    3. It declares every further input it reads. An undeclared input is refused before the generator is called (GeneratorInputRefused), and an input given as None is simply not passed.
    4. It answers a dict whose kind is its declared contract and whose schema_version is an integer. Anything else is refused (GeneratorNotConformant) and not handed on. So two generators that write two contracts can never both claim to be the one conformant implementation, which is the failure 5.4 was raised against.
    5. It is deterministic over its inputs. That is declared, and each generator's own suite proves it.
  • The conformance clause names T053's neutral kind for openDox's own generator. NEUTRAL_SNAPSHOT_KIND = "opendox-snapshot" equals the kind const of openDox-spec#16's contracts/schemas/opendox-snapshot.schema.yaml. It was read at bcff47d4, and it is unchanged at § 3.4 S6: /source becomes openDox's own fixed core arm (RULED Q4) #16's last head cd49eb25 and in the landed f7ee3c76 ("kind": {"x-rule": "kind-is-opendox-snapshot", "const": "opendox-snapshot"}). register_default() refuses a declaration that writes any other contract. A contributor declares its own contract, as openXdox's governed generator will.
  • The entry points register openDox's own generator where no host has (R1Q10 (a), 5850003126, in R1Q3 (a)'s pattern). cli.build_parser(), cli.main(), serve.build_server() and serve.main() each gain one line, generator_seam.register_default(default_generator.GENERATOR), beside their registrations of the default profile and the default home corpus. As for the profile:
    • a bare process that builds nothing still meets GeneratorNotRegistered, which names the seam and the call;
    • a host registration made before anything has been generated from the default replaces it;
    • one made after a snapshot has been generated from it is refused (GeneratorAlreadyRegistered), for the reason RN-1 (a) gives for the profile;
    • one made while a snapshot is being generated from it is refused too, because that snapshot would come back after the swap;
    • a generation that fails, or whose answer the seam refuses, wrote nothing. So it records nothing, and a host still replaces the default after it.
  • Each registration keeps its own records. Every change of registration goes through one helper that moves a registration serial on and starts the records afresh: register(), register_default() where it registers, and unregister(). A generation carries the serial it began under. So one that outlives its registration records nothing against the next one, even a later registration of the same declaration, and its caller still gets its snapshot.
  • One lock. The registry's bookkeeping is kept under one threading.Lock, because serve.py's ThreadingHTTPServer answers each request on a thread of its own. generate() holds it only to resolve and mark, and to record the end, and never across the generator's own call. So a generator may register, unregister or generate from inside its own call.
  • CorpusAdapter stays closed at six members. A test pins OPERATIONS to the six and the protocol to OPERATIONS.

Why openDox's own generator refuses until T054

src/opendox/default_generator.py declares openDox's own generator: contract opendox-snapshot, and no inputs. Its generate() raises NeutralProjectionNotBuilt, which names itself and T054, and it generates nothing. It never answers an empty snapshot. Because that refusal writes nothing, it shuts no host out.

That follows from the plan's order:

  • T054, the neutral projection, is After: T050, T052, T053.
  • T054 edits neither cli.py nor serve.py, whose single-writer chains run T052, then T055 (plan.md; W2-14 put T052 in both chains).
  • So the registration calls are this task's, and the projection behind them is T054's.

No verb reaches the seam yet. The generate verbs still call the consumer's generator through consumer_reach (cli.py:90) until T055 routes them, and T055 is after T054. The refusal is therefore reachable only by a library caller that uses the seam directly.

Files

file change
src/opendox/generator_seam.py new: the seam, its declaration type and its refusals
src/opendox/default_generator.py new: openDox's own generator's declaration
tests/test_generator_seam.py new: the seam tests (71 cases)
src/opendox/cli.py +9: one import, and one registration line in each of build_parser() and main()
src/opendox/serve.py +9: one import, and one registration line in each of build_server() and main()

The PR stays out of conftest.py, pyproject.toml, validate.yml, README.md and every pin.

Review round 1: Copilot at 834f8ead, two findings, both taken

Commit 4ca45d27 addresses both findings.

  • r4116122374, a declared input the operation cannot do without. The declaration bound the call with every declared input given. But generate() drops a None input, so an operation that requires a declared input was accepted, and then failed with a raw TypeError whenever the option was unset. The declaration now binds the call a second time with none of the declared inputs given, and refuses such an operation when it is declared. The regression case is test_a_declared_input_the_operation_cannot_do_without_is_refused, which covers the input required by keyword and by position. openXdox's generate_snapshot takes both of its extras with a default of None, so T059's declaration passes both binds. test_a_governed_generators_shape_is_declarable now also generates through that shape with its inputs unset, and with one of them set.
  • r4116122388, the default's window closed before its operation ran. The generation from the default was recorded before the call. So a failed generation, openDox's own pre-T054 refusal included, shut every host out although it wrote nothing. That contradicted the documented rule. The record is now made only once a conformant snapshot comes back. The property the early record gave, that no registration slips in during a first generation, is kept by a count of the generations from the default that are under way. That count and the record are updated under one lock, never held across the call.
    • The regression cases:
      • test_openDoxs_own_generator_refuses_until_its_projection_lands is Copilot's exact scenario: the real default refuses, then a host registers.
      • test_a_generation_from_the_default_that_wrote_nothing_is_not_a_generation runs twice: once for an operation that raises, and once for an answer the seam refuses.
      • test_a_host_is_refused_while_a_generation_from_the_default_is_under_way runs three times: the generation answers, raises, or answers another kind. It runs on a thread, and the host is refused during the generation every time. Afterwards the host is refused only after the conformant answer.
      • test_a_generator_may_register_or_generate_from_inside_its_own_call covers nesting, registering from inside the call, and a default swapped out from inside its own call.
    • The concurrency and re-entrancy cases run in a process of their own with a time limit. So a lock held across a call fails them, rather than hanging the suite.

The new cases pin the findings. The new test file was run against 834f8ead's seam logic. A one-line shim adds the counter attribute, so that the fixture can save it, and the old logic never reads it. 8 of the 66 go red: the declared-input case, the pre-T054 default case, the two wrote-nothing cases, the three under-way cases and the re-entrant case.

Review round 2: the seam finding in Copilot's overview of openDox-code#57

T054's branch (#57) stacks on this one. Copilot's overview of #57 at c0747e96 said that "replacement-generator tracking can reject valid registrations". It opened no thread, so there was no scenario to answer. The claim is real. There are two cases, and both were reproduced at 4ca45d27:

  1. The count of generations under way was global, not tied to the registration it counted. unregister() drops a default while a generation from it still runs. Then a fresh default is registered, and a host over it is refused with "a snapshot is being generated from it now", although nothing is.
  2. A generation that outlived its registration recorded its late answer against a fresh registration of the same declaration. That shut the fresh window, against unregister()'s own promise that the record goes with the registration.

Commit bce09c50 addresses both, in the form described under Each registration keeps its own records above. Commit 97b5b01f moves one new docstring sentence so that #57 takes this head without a conflict. A trial merge of this head into #57's head 5a6fe637 is clean, and 94 seam and projection cases pass in the merged tree.

  • The regression case is test_a_generation_that_outlives_its_registration_touches_no_later_one. It runs in four variants, in a process of its own. The follower is another default or the same declaration, and the host registers either while the generation runs or after it answers.
    • Against 4ca45d27's seam logic, with a one-line shim for the new serial, 3 of the 4 go red.
    • The fourth (a host after the answer, over another default) was already right there, and it guards the new scoping. M12 turns all four red.
  • test_unregister_clears_the_default_and_its_generation now registers the same default afresh before the host tries. So it also catches a helper that forgets to reset the record (M15).

Review round 3: Copilot at bce09c50, one finding, taken

  • r4117421102: current() read _registered twice, once for its None check and once for its answer. A thread that unregistered between the two reads made it answer None after passing the check.
    • generate() calls it while holding the seam's lock, so that path was safe, but a bare caller was not.
    • Commit 8d507c5b makes it read the registration into a local once and answer that local. It takes no lock of its own, because generate() holds the seam's lock, which is not re-entrant, when it calls it.
  • The regression case is test_current_answers_the_registration_it_checked. A line tracer forces the interleaving deterministically: it drops the registration before every line of current() after its first. Against 97b5b01f's seam logic it is red, with "current() answered None after passing its check". Mutation M16 is caught by it.
  • T054, openDox's small neutral projection (5.1-5.3) (plan 034) #57 still takes this head with no conflict. In a trial merge into T054, openDox's small neutral projection (5.1-5.3) (plan 034) #57's head 5a6fe637, 95 seam and projection cases pass.

The falsifier: the seam tests

T052's falsifier is "seam tests; F5.2 through T059 and T061", so F5.2 is quoted in T059's and T061's PRs, not here. These runs used Python 3.12.3 and pytest 8.4.2, in a venv installed exactly as validate installs: --only-binary :all: -c constraints-cpython312-linux.txt -e ".[runtime,test]".

$ python -m pytest -q tests/test_generator_seam.py                 # root conftest
71 passed in 1.09s
$ python -m pytest -q tests/test_generator_seam.py --noconftest    # the file stands alone too
71 passed in 0.86s

Red at main. This test file dropped into a git archive of main 2d116415 fails to collect. The seam does not exist there, which is 5.4's own first line.

E   ImportError: cannot import name 'default_generator' from 'opendox' (…/src/opendox/__init__.py)
1 error in 0.24s

The tests bite. Each of sixteen mutations of the seam or an entry point, run in a throwaway copy of this branch, turns at least one case red:

mutation red
M1 serve.build_server() loses its registration 2
M2 cli.build_parser() loses its registration 2
M3 current() falls back to openDox's own generator 3
M4 generate() drops the kind check 4
M5 generate() passes an undeclared input through 2
M6 register() always overwrites, as register_home does 7
M7 register_default() drops the neutral-contract clause 1
M8 a generation from the default is not recorded 3
M9 the default's generation is recorded before its call (r4116122388) 5
M10 a generation from the default is never marked under way 7
M11 declared inputs are bound only as given (r4116122374) 1
M12 a generation's end ignores which registration it began under (#57's overview) 5
M13 a generation under way does not refuse a host 4
M14 a change of registration keeps the count of generations under way 5
M15 a change of registration keeps the record of a generation 2
M16 current() reads the registration again to answer (r4117421102) 1

The repository's own checks

validate, as it now runs. Since T036 (#52), validate runs the whole suite in one python -m pytest -q --junitxml=…, then pins the triple. It was run that way here, at main 2d116415 and at this head, in venvs installed by its own install line, and the JUnit reports were diffed test by test. This machine has no Postgres, so the database-backed cases skip here where CI runs them. The local skip count is therefore 177 at both, where CI pins 11.

main 2d116415:  2302 passed, 177 skipped   (selected 2479, failures 0, errors 0)
this head:      2373 passed, 177 skipped   (selected 2550, failures 0, errors 0)
added: 71 (tests.test_generator_seam, all passed) · removed: 0 · changed outcome: 0

The skip count does not move, so CI's exact pin of 11 holds. The number selected rises by the 71 cases, above the floor of 2476.

F4.1's scan (scan_deferred_reaches.py, sha256 fe116203…, byte-identical to research.md's appendix). It prints 19 deferred reaches at main 2d116415 and at this head. The two listings are identical apart from the line numbers the added lines shift. The two new modules make no reach, late or not, and a test asserts that too. threading is the standard library's.

What the later tasks need from the seam

  • T054 (the neutral projection) replaces default_generator.generate()'s refusal with the projection, and keeps its signature (repo_root, repository, *, source_revision=None, generated_at=None). It returns {"schema_version": 1, "kind": "opendox-snapshot", …}, and its inputs stay () unless it declares one, which must then be optional. It also retires NeutralProjectionNotBuilt and test_openDoxs_own_generator_refuses_until_its_projection_lands. The stand-in cases keep the "a generation that wrote nothing shuts no host out" rule covered. Its in-process test can generate through generator_seam.generate(...) with default_generator.GENERATOR registered. T054, openDox's small neutral projection (5.1-5.3) (plan 034) #57 takes this head (8d507c5b) with no conflict, and it needs no change for review rounds 2 and 3. A suite that generates from the default should unregister() between cases, as T054, openDox's small neutral projection (5.1-5.3) (plan 034) #57's tests/test_neutral_projection.py does, because each registration keeps its own window.

  • T055 (serve and generate standalone):

    • It routes cli.py's two generate_snapshot calls (_generate_and_write, _gate_snapshot) through generator_seam.generate(repo_root, repository, source_revision=…, generated_at=…, project_register_source=…, possibles_source=…), and resolves per call rather than holding current().
    • A None option is not passed. A given option the registered generator does not declare is refused, as GeneratorInputRefused, a GeneratorSeamError that main() can report.
    • Its openDox-default snapshot registry's regenerate goes through the same call. The seam's own bookkeeping is safe to call from the server's request threads.
    • Its validator lookup picks the schema by the snapshot's kind, which is the registered generator's contract.
    • Two reaches are not the generator's operation, and the seam deliberately does not carry them:
      • branch_session.py:1568 reads iter_changes and declared_origin_state, governed change-enumeration helpers;
      • cli.py's is_rfc3339_datetime is a date-time shape check.
        T055 routes both elsewhere.
    • Once a verb generates through the seam, a suite that runs the verb gets openDox's own generator, unless a host registers one first.
  • T059 (openXdox contributes) registers openXdox's governed generator:

    generator_seam.register(SnapshotGenerator(contract="ideation-dashboard-snapshot",
                            generate=generate_snapshot,
                            inputs=("project_register_source", "possibles_source")))
    
    • generate_snapshot's signature takes the seam's call as it stands. Both declared inputs default to None, so the declaration passes both binds, and a test declares and generates through that shape.
    • Its test-only keywords (git, generator_version, excluded_documents) stay undeclared, so the seam never passes them.
    • The registration must come before the first generation in any process that uses openDox's entry points, and not during one, or it is refused.
    • T059's own seam test is current() is that declaration.
  • T064 (host wiring). The seam needs one explicit registration. openxFactory's register_openxfactory() makes only the profile registration today, and the seam does not read the profile. So openxFactory gets openXdox's generator only if something calls register(...) in its process: either a one-line host registration in T064, or a hook T059 gives openXdox that openxFactory already calls. T064's line "It composes openXdox's profile, so none is expected" should be re-read against this. The holder decided it (2026-09-27): T059 registers openXdox's generator from openXdox's own profile-registration path, the hook openxFactory already calls. So T064's line stays true, and T064 needs no host line. The next phase-2 bookkeeping round records it in T059's and T064's text.

  • T057, once it packages opendox-snapshot.schema.yaml, can hold NEUTRAL_SNAPSHOT_KIND to the packaged copy's kind const.

Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)

🤖 Generated with Claude Code

Summary by Sourcery

Establish the snapshot generator seam and register openDox’s default generator while enforcing generator conformance and safe lifecycle management.

New Features:

  • Declare the snapshot generator seam with generator registration, default registration, lifecycle management, input declarations, and output conformance validation.
  • Add openDox’s default generator declaration for the neutral snapshot contract, currently refusing generation until the neutral projection is implemented.

Bug Fixes:

  • Prevent invalid generator registrations, undeclared inputs, mismatched snapshot contracts, invalid schema versions, and unsafe registration changes during or after generation.

Enhancements:

  • Register the default generator from CLI and server entry points without overriding host-provided generators.
  • Keep generator registration state isolated across replacements and support thread-safe, re-entrant generation and registration.

Tests:

  • Add comprehensive seam, default-generator, entry-point, concurrency, re-entrancy, and CorpusAdapter boundary coverage.

…erator (plan 034)

Box 5.4 of openxFactory's add-neutral-product-standalone-operability:
"DECLARE THE GENERATOR SEAM - it does not exist and CorpusAdapter is not
it." This declares it, in src/opendox/generator_seam.py, beside
domain_profile.register():

- the operation handed over: generate(repo_root, repository, *,
  source_revision=None, generated_at=None, **inputs) -> the snapshot;
- the registration point: register(<SnapshotGenerator>) for a host,
  and register_default(...) for an entry point, which registers only
  where nothing is registered;
- the conformance a contributed generator must meet. It declares the
  contract it writes and every further input it reads, its operation
  takes the seam's call, and it answers a snapshot whose kind is that
  contract and whose schema_version is an integer. The seam checks the
  declaration when it is made and each snapshot when it comes back,
  and it refuses, never drops, an undeclared input.

The conformance clause names T053's neutral snapshot kind,
"opendox-snapshot" (openDox-spec#16), for openDox's own generator:
src/opendox/default_generator.py's GENERATOR. The entry points
(cli.build_parser, cli.main, serve.build_server, serve.main) register
it where no host has (R1Q10 (a), openxFactory#656 comment 5850003126,
in R1Q3 (a)'s pattern). A bare process still refuses, naming the seam
and the call. A host replaces the default only before a snapshot has
been generated from it. CorpusAdapter stays closed at six members.

openDox's own generator refuses until T054 builds its projection. Plan
034 orders T052 before T054, and T054 edits neither cli.py nor serve.py
(their single-writer order runs T052, then T055). No verb reaches the
seam before T055 routes the generate verbs, which comes after T054.

Falsifier: the seam tests, tests/test_generator_seam.py (59 cases).
F5.2 is quoted by T059 and T061.

Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings September 27, 2026 16:40
@sourcery-ai

sourcery-ai Bot commented Sep 27, 2026

Copy link
Copy Markdown

Reviewer's Guide

This draft establishes the phase-2 generator seam as an independently registered, contract-declaring snapshot generator with strict input/output validation, wires openDox’s not-yet-built neutral generator into CLI and server entry points as a conditional default, and adds 59 tests covering the lifecycle and conformance rules.

Sequence diagram for generator registration and snapshot generation

sequenceDiagram
    participant Host
    participant EntryPoint
    participant Seam as generator_seam
    participant Generator

    alt Host registers before entry point default
        Host->>Seam: register(host_generator)
        EntryPoint->>Seam: register_default(GENERATOR)
        Seam-->>EntryPoint: keep host_generator
    else No host registration
        EntryPoint->>Seam: register_default(GENERATOR)
        Seam-->>EntryPoint: register default generator
    end
    Host->>Seam: generate(repo_root, repository, source_revision, generated_at, inputs)
    Seam->>Seam: current()
    Seam->>Seam: validate declared inputs
    Seam->>Generator: generate(repo_root, repository, source_revision, generated_at, inputs)
    Generator-->>Seam: snapshot dict
    Seam->>Seam: validate kind and schema_version
    Seam-->>Host: validated snapshot
Loading

File-Level Changes

Change Details Files
Introduces the generator seam contract, declaration model, registry, dispatch operation, and conformance refusals.
  • Defines SnapshotGenerator with contract, callable signature, and declared extra inputs.
  • Adds host/default registration lifecycle with explicit swap and unregistered-state errors.
  • Filters optional inputs, rejects undeclared values, invokes the registered generator, and validates snapshot kind and integer schema version.
  • Keeps resolution per generation and leaves CorpusAdapter unchanged.
src/opendox/generator_seam.py
Declares openDox's default generator while intentionally deferring neutral snapshot generation to T054.
  • Registers the neutral opendox-snapshot contract with no extra inputs.
  • Raises NeutralProjectionNotBuilt instead of returning an empty or placeholder snapshot.
  • Provides the generator declaration used by entry-point default registration.
src/opendox/default_generator.py
Adds default generator registration to all CLI and server entry points without registering at import time.
  • Calls register_default(default_generator.GENERATOR) in cli.build_parser(), cli.main(), serve.build_server(), and serve.main().
  • Preserves an earlier host registration through default-registration semantics.
src/opendox/cli.py
src/opendox/serve.py
Adds focused coverage for seam behavior, default lifecycle, entry-point wiring, import boundaries, and the closed corpus adapter protocol.
  • Tests declaration validation, dispatch arguments, optional/undeclared inputs, output conformance, and registration conflicts.
  • Verifies the default generator remains refusal-only until T054 and that entry points register it exactly once.
  • Checks no import-time registration or sibling/third-party reach and pins CorpusAdapter to six operations.
tests/test_generator_seam.py

Tips and commands

Interacting with Sourcery

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

Customizing Your Experience

Access your dashboard to:

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

Getting Help

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.

Copilot review overview

🟡 Changes recommended

Two moderate issues remain in generator state handling and declared-input validation.

Review effort: Lite
Findings: 2 Medium severity

Open (2)
What changed in this PR

Declares the snapshot generator seam, adds a deferred default generator, and wires registration into CLI/server entry points.

Changes:

  • Adds generator registration, dispatch, input, and snapshot validation.
  • Adds the neutral default generator pending T054.
  • Adds comprehensive seam and entry-point tests.
File Description
tests/​test_generator_seam.py Seam behavior and integration coverage
src/​opendox/​serve.py Server generator registration
src/​opendox/​generator_seam.py Generator registry and conformance rules
src/​opendox/​default_generator.py Deferred neutral default generator
src/​opendox/​cli.py CLI generator registration

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

Comment thread src/opendox/generator_seam.py Resolved
Comment thread src/opendox/generator_seam.py Resolved
…nce it answers

Copilot's review of this PR at 834f8ea raised two findings. Both are
addressed here.

1. A declared input the operation cannot do without was accepted when it
   was declared. SnapshotGenerator bound the seam's call with every
   declared input given. But generate() passes an input only when its
   caller has a value for it, so such an operation failed with a raw
   TypeError the first time the option was unset. The declaration now
   binds the call twice, once with every declared input given and once
   with none given, and every call the seam can make lies between the
   two. Conformance clause 2 now says that each declared input is
   optional.

2. The default's window closed before its operation ran. generate()
   recorded a generation from the entry point's default before the call.
   So a generation that failed shut every host out although it wrote
   nothing, and that included openDox's own refusal before T054. The
   record is now made once a conformant snapshot comes back. A
   generation that fails, or whose answer the seam refuses, records
   nothing. While a generation from the default is under way, a host's
   registration is refused, because that snapshot would come back after
   the swap. The early record gave that property. A count of the
   generations under way now holds it.

The registry's bookkeeping moves under one threading.Lock, because
serve.py's ThreadingHTTPServer answers each request on a thread of its
own. generate() holds the lock only to resolve and mark, and to record
the end, and never across the generator's call. So a generator may
register, unregister or generate from inside its own call.

Tests: 59 -> 66 cases. Against 834f8ea's seam logic, 8 of the 66 go
red: the new declared-input case, the pre-T054 default case, the two
wrote-nothing cases, the three under-way cases and the re-entrant case.
The concurrency and re-entrancy cases run in a process of their own with
a time limit, so a lock held across a call fails them rather than
hanging the suite. 13 of 13 mutations are caught.

Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings September 27, 2026 17:35

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.

Copilot review overview

🔵 Needs a closer look

The change involves broad generator lifecycle and integration behavior requiring final human review.

Review effort: Lite
Findings: None

Resolved since last review (2)

brettheap and others added 2 commits September 27, 2026 23:04
T052's branch was cut from main 80acead. main has since landed T036 (the
required check runs the whole suite) and T037 (the margin). This takes
main at 2d11641, so the PR is measured against the whole-suite check it
will be judged by. There is no conflict: T052's five files and main's
changes are disjoint.

Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Copilot's overview of openDox-code#57 at c0747e9 said that the
generator seam's "replacement-generator tracking can reject valid
registrations". It opened no thread. The claim is real, and there are
two cases, both reproduced at 4ca45d2:

1. The count of generations under way was global, not tied to the
   registration it counted. A generation from a default that
   unregister() had dropped kept counting against whatever default was
   registered next. So a host was refused over a fresh default with "a
   snapshot is being generated from it now", although nothing was.

2. A generation that outlived its registration recorded its late
   answer against a fresh registration of the same declaration. That
   shut the fresh window, against unregister()'s own promise that the
   record of a generation goes with the registration.

Now every change of registration goes through one helper: register(),
register_default() where it registers, and unregister(). The helper
moves a registration serial on and starts the two records afresh. A
generation carries the serial it began under. When it ends, it touches
the records only if that registration is still current. The generation
is not stopped, and its caller still gets its snapshot.

Tests: 66 -> 70 cases. The new case
test_a_generation_that_outlives_its_registration_touches_no_later_one
runs in four variants, in a process of its own. The follower is another
default or the same declaration, and the host registers either while
the generation runs or after it answers. Three variants are red against
4ca45d2's seam logic, and the fourth guards the new scoping.
test_unregister_clears_the_default_and_its_generation now registers the
same default afresh before the host tries. 15 of 15 mutations are
caught.

Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings September 27, 2026 23:15
T054's branch (openDox-code#57) stacks on this one and rewrites the last
sentence of point 6 of tests/test_generator_seam.py's docstring. The
previous commit re-wrapped that same paragraph, so taking this branch
would have conflicted there. Point 6 is restored to its 4ca45d2 text,
and the new sentence moves to point 5, ONE REGISTRATION, where it
belongs. A trial merge of this head into #57's head 5a6fe63 is clean,
and 94 seam and projection cases pass in the merged tree.

Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

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.

Copilot review overview

🟡 Changes recommended

Fix the critical current() registry race before approval.

Review effort: Lite
Findings: 1 High severity

Open (1)

Comment thread src/opendox/generator_seam.py Resolved
Copilot AI review requested due to automatic review settings September 27, 2026 23:18

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.

Copilot review overview

🔵 Needs a closer look

The generator lifecycle and concurrency behavior warrant final human review.

Review effort: Lite
Findings: 1 High severity

Open (1)

Copilot's review of this PR at bce09c5 (r4117421102) found that
current() read _registered twice: once for its None check, and once for
its answer. A thread that unregistered between the two reads made it
answer None after passing the check, against its SnapshotGenerator-or-
refusal contract. generate() calls it while holding the seam's lock, so
that path was safe, but a bare caller was not. current() now reads the
registration into a local once, and answers that local. It still takes
no lock of its own, because generate() holds the seam's lock, which is
not re-entrant, when it calls it.

Test: test_current_answers_the_registration_it_checked forces the
interleaving deterministically. A line tracer drops the registration
before every line of current() after its first. The test is red against
97b5b01's seam logic ("current() answered None after passing its
check") and green here. 16 of 16 mutations are caught, the new M16
among them.

Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings September 27, 2026 23:33

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.

Copilot review overview

🔵 Needs a closer look

The draft introduces a complex, concurrency-sensitive generator seam and depends on later tasks.

Review effort: Lite
Findings: None

Resolved since last review (1)

@brettheap brettheap changed the title DRAFT (phase 2, after T049): T052, declare the generator seam (5.4) and register openDox's own generator (plan 034) T052, declare the generator seam (5.4) and register openDox's own generator (plan 034) Sep 29, 2026
Phase 1 has closed (T049, openxFactory#1204 -> 9d2e5bc3), and T050 has
landed on main as dc3765d. This merge keeps T052's branch current. It
adds only #53's fixture and its test, which this branch does not touch.
T052 is After: T049, T009, T053, and T053 (openDox-spec#16) has not landed
yet, so this PR stays a draft.

Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings September 29, 2026 16:51
@sonarqubecloud

Copy link
Copy Markdown

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.

Copilot review overview

🔵 Needs a closer look

The changes require final human review because they are too complex or risky for automated approval.

Review effort: Lite
Findings: None

brettheap added a commit that referenced this pull request Sep 29, 2026
…d507c5) into T054's branch

This branch was cut from #54 at 4ca45d2, and #54 has moved since:
- bce09c5: each registration keeps its own records, taken from Copilot's
  overview of this PR;
- 97b5b01: one docstring sentence moved so that this branch merges clean;
- 8d507c5: current() reads the registration once.
#54's body records a clean trial merge of 8d507c5 into 5a6fe63. When #54
lands by squash, this branch must already carry its final head, so that
each add/add conflict resolves to this branch's side and nothing else.

Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
brettheap added a commit that referenced this pull request Sep 29, 2026
2f515c5 merges main dc3765d into #54, and changes none of #54's own
files. This branch already carries both parents, so the merge changes no
file. It keeps this branch carrying #54's final head, so that when #54
lands by squash each add/add conflict resolves to this branch's side by
construction.

Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
brettheap added a commit that referenced this pull request Sep 29, 2026
…tion 8e7da4a) into T057's branch

#57 is this PR's base, and it moved after T049 landed:
- it merged #54's final head (2f515c5), #53's (4ba410f) and #56's
  (44dcc3a);
- it merged main dc3765d, where #53 (T050) landed;
- 8e7da4a is the holder's scaffold decision (openDox's own scaffold carries
  NEUTRAL_FIELDS), with its four tests, plus the no-group assertion owed to
  #53's review.
None of those files is one this branch edits. This merge keeps T057's
branch on its base's head, so its checks run against what #57 will land.

Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
brettheap added a commit that referenced this pull request Sep 29, 2026
…tion 8e7da4a) into T055's branch

T055 is After: T054, T057. This branch was cut on #57 at 5a6fe63, and #57
moved after T049 landed:
- it merged #54's final head (2f515c5), #53's (4ba410f), #56's (44dcc3a)
  and main dc3765d, where #53 (T050) landed;
- 8e7da4a is the holder's scaffold decision: openDox's own scaffold carries
  NEUTRAL_FIELDS. That is the mismatch this PR's review raised on #57's
  line (r4126022820) and left to #57.
#58 (T057) is still NOT merged here (the holder, 2026-09-28): the
validator stand-in stays until T058 wires opendox.validator.

Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@brettheap
brettheap marked this pull request as ready for review September 29, 2026 18:39
@brettheap

Copy link
Copy Markdown
Contributor Author

READY at 2f515c5 — Lane: openxfactory-4 (openXfactory-4-openDox_extraction)

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sorry @brettheap, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 2 days and 19 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@brettheap
brettheap merged commit fa8862c into main Sep 29, 2026
4 checks passed
@brettheap

Copy link
Copy Markdown
Contributor Author

Lane: openxfactory-4 (openXfactory-4-openDox_extraction)

LANDED — lane openxfactory-4, 2026-09-29T18:41:27Z, PR #54 → fa8862c (opensoft/openDox-code main; plain gate)

Brett: land the phase 1 PRs when green

brettheap added a commit that referenced this pull request Sep 29, 2026
…anch

#56 landed by squash as 8664732, and #54 as fa8862c. This branch
already carries both final heads' content:
- #54's final head 2f515c5 is an ancestor here.
- #56's final head 3049dad is 44dcc3a plus the merge of main dc3765d,
  and both are ancestors here.

The two conflicts are add/add, in files #54 added and T054 edits:
src/opendox/default_generator.py and tests/test_generator_seam.py. Both
are resolved to this branch's side.
- In each file, main's blob is #54's final blob (f2b9cb6 and 7b32ef1).
- So `git diff fa8862c <pre-merge head> -- <file>` is byte-identical to
  `git diff 2f515c5 <pre-merge head> -- <file>`. Only T054's own lines
  differ, and nothing of #54's landed file is lost.

The merged tree is the pre-merge head's tree, 45ddf9e. Main brings
nothing this branch lacks, and the merge records main's ancestry.

Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
brettheap added a commit that referenced this pull request Sep 30, 2026
**Authored ahead, as a phase-2 draft.** Brett ruled on openxFactory#656, comment `5857365170` ("Start phase 2's independent tasks"), that phase-2 tasks are authored as drafts. **T049 has landed** (openxFactory#1204 → `9d2e5bc3`), so phase 2 is open. T054 is `After: T050, T052, T053`:
- T050 has landed, as `dc3765dd` (#53);
- T052 has landed, as `fa8862cc` (#54);
- T053 has landed, as openDox-spec `f7ee3c76` (#16), and the openDox root pins it (opensoft/openDox#14).

#56 (T051), which this branch also carried, has landed as `86647320`. This PR stays a draft until the holder un-drafts it.

This is plan 034's **T054 (5.1–5.3: openDox's small neutral projection)**, phase-2 slice **P2-P**. I read the plan at openxFactory `main` `d90df42d` (`specs/034-opendox-standalone-operation/tasks.md`), and re-read it at `9d2e5bc3`: T054's entry is unchanged. The slice is claimed on openxFactory#656, comment `5859496321`.

## What this branch carries

- It is **built on #54's branch**, `build/034-p2g-t052-generator-seam` (T052, the generator seam). It was cut at `4ca45d27`, and it now carries #54's final head, `2f515c57`. T054 replaces that seam's placeholder default with the projection.
- **#53 (T050) has landed as `dc3765dd`.** Its tree equals #53's final head, `4ba410ff`, which this branch had merged first. So `main`'s merge (`d97a4aa`) had one add/add conflict, in `tests/test_plain_documents_fixture.py`, resolved to this branch's side. That file differs from `dc3765dd` by T054's three docstring corrections and nothing else. `git diff dc3765d -- <file>` after the merge is byte-identical to `git diff 4ba410f <pre-merge head> -- <file>`.
- **#56 (T051)** is merged at `44dcc3a1`. It adds `tests/fixtures/malformed`, which the holder's T051 rule reads.
- **#56 and #54 have landed** (`86647320`, `fa8862cc`), and `main` `fa8862cc` is merged here as `1a603677`. Its two add/add conflicts, `src/opendox/default_generator.py` and `tests/test_generator_seam.py`, are resolved to this branch's side: in each, main's blob is #54's final blob, so `git diff fa8862c <pre-merge head> -- <file>` equals `git diff 2f515c5 <pre-merge head> -- <file>`. The merged tree is the pre-merge head's, `45ddf9ec`.
- So the diff against `main` is now T054's alone: its commits `25fe7526` through `5a6fe637`, `8e7da4a`, `03e06ccd`, `50b0d42b` and `d7954fc6` (below).

## What it builds

`src/opendox/neutral_projection.py` is new code over `CorpusAdapter`, written to openDox's own needs. It is not openXdox's generator re-expressed, and it imports nothing of openXdox's or openxFactory's.

`default_generator.generate()` keeps its signature. It resolves the home corpus through the home-corpus seam and projects it. Standalone, that corpus is T022's `WorkingTreeCorpus`, a `LocalGitCorpus` (5.2). `NeutralProjectionNotBuilt` and its refusal case in `tests/test_generator_seam.py` are retired, as the brief asks.

The projection writes T053's neutral snapshot, `opendox-snapshot`. The rules it follows:

- **What is a document.** A document is an entry the adapter lists AND classifies.
  - An entry it cannot classify, such as a `Makefile` or an image, is left out unread (holder ruling).
  - An entry whose path the schema's `path-is-repo-relative` rule cannot carry is also left out, and it is reported. Examples are a backslash or a control character in the name.
- **Where a document lands (R1Q13 (a) with (c)).**
  - The station is the one its neutral `stage:` key names. That key is the first line of the leading `Name: value` block. `local_git_adapter.leading_header` reads the block, and it is the same reader the default adapter's `classify` uses.
  - A document that declares no `stage:` is a source.
  - A value outside the six role keys is not a declaration. That includes the empty value and another casing such as `Grouping`. The generator reads the document as a source and reports it on standard error. For example: `notice: grouping-compost-corner.md: its stage: value 'shelved' is not one of the six station role keys (source, grouping, candidate, selection, submission, completion), so it is not a declaration; the document is read as a source`.
- **`title` and `summary`** are copied exactly as the header gives them, the empty value included. They are `null` only where the key is absent. Nothing is coerced, and no document is dropped for lacking them. This is the holder's rule on T051.
- **The topic rule** (named here, as the task asks). A document with a `topics:` header carries exactly the topics it lists: split on commas, whitespace collapsed, and case-folded. It carries none where the header lists none, because an empty header is still a declaration. A document without the header carries:
  - the **words of its name**, where the name is its `title:`, else its first `#` heading, else its file name without the suffix;
  - plus the **words of the name of every other document it mentions**, where mentioning means its text holds that document's name, or its file name, as a run of whole words.
  - A word is a run of three or more letters, case-folded, that is not in `STOPWORDS`. Letters and digits are split apart, so `Q3planning` holds the word `planning`. So the rule needs no front matter at all.
- **Groups.** A group forms wherever **two or more sources share a topic**, and topics shared by the same sources form one group, named `a · b`. A document that declares `stage: grouping` is a group of its own: it gathers itself and every source that shares one of its topics. Each group has **one edge per member document**, naming the topics that matched.
- **The other stations.**
  - A declared candidate is `unselected`. It is claimed by each group it shares a topic with, and its `claim` is its summary.
  - A declared selection is a `staged_topics` entry.
  - A declared submission or completion is a `changes` entry, `active` or `archived`.
  - Each of these lists the document as its file. Ids are unique within each section.
- **`keyword_index`** is written, and it counts exactly the documents that carry each topic.
- **The anchors.**
  - `source_revision` is the revision the caller pins, else the corpus HEAD (holder ruling 5). With neither, `ProjectionRefused`, a `GeneratorSeamError`, is raised.
  - `generated_at` is the caller's value, else that revision's own committer date. It is looked up only for a revision spelled as a hexadecimal object id, so git never reads a revision as an option. Nothing reads the clock.
  - A pin labels the snapshot; it does not choose the bytes. The content is the working tree's, as openXdox's governed generator also records a supplied revision and scans the tree it is handed.

It also changes these files:
- **`display_profile.py`, in one place (batch G's 5.3).** `SNAPSHOT_VALUES`' defaults become the neutral snapshot's values:
  - `document_stage`: `captured` is `source`, and `organized` is `grouping` (holder ruling 1);
  - `register_state`: `unselected`, `selected`, `declined` and `replaced`, which are `NEUTRAL_DISPLAY`'s own candidate words, role for role, so no word is re-authored.
  - `display.js`'s mirror moves with it and keeps its line count, so the web census is unchanged. The governed values move to openXdox's facet in T060 (holder ruling 4: T060's block lands before openXdox moves its openDox pin past T054).
- **The default adapter's field set (R1Q13 (a)).**
  - `local_git_adapter.NEUTRAL_FIELDS = ("title", "summary")`, and `WorkingTreeCorpus` defaults to it. `LocalGitCorpus()` still defaults to `()`.
  - The suffix branch of `classify` reports a field as missing when it is absent or empty, but only when fields are required. So `authoring.required_header_fields()` answers `("title", "summary")` through the entry point.
  - A document without those fields is still read, as a source.
- **The wheel (holder ruling 3).** The grouping tile counts a group's edges. `views/wheel-model.js` uses `tallies.document_links` where a group carries one, as the governed snapshot's groups do, and counts `document_edges` otherwise. The schema is not widened, and the file keeps its line count.

What the fixtures project to:

| repository | documents | groups |
|---|---|---|
| T050's `plain-documents` | 8, all six stations | `barrel · rain` (the two rain-barrel notes), and the declared `Compost corner ideas, gathered in one place` |
| AT-R1's repository (b), no front matter | 3 sources | `budget · roadmap` (all three notes), `meeting · notes` (two) |
| T051's `malformed` | 2 (`EXPECTED_RULE` is not a document) | none |

## After T049: openDox's own scaffold carries the small neutral field set (`8e7da4a`)

**The holder's decision of 2026-09-28.** `render_scaffold()`'s output read as missing `title` and `summary` under `NEUTRAL_FIELDS`, for two reasons: the H1 comes first, so `leading_header()` stops at the blank line after it, and its field is the capitalized `Summary:`. So standalone `agent_capture` refused a document `create` had written, and the projection lost the supplied summary. Copilot raised it on #59 as r4126022820 and reproduced it there. It is fixed here.

**What changed.**
- `authoring.SCAFFOLD_LEAD_FIELDS = ("title", "summary")`. These are the fields a scaffold can lead with, filled from the create's own input. The neutral title drops the family suffix, which stays on the H1.
- `render_scaffold(..., lead_fields=())` writes those fields first, as `name: value` lines, then a blank line, then the governed block unchanged. It refuses a field it has no value for. With `()`, the default, its output is byte-identical to before.
- `create_scaffold()` passes `scaffold_lead_fields()`: the fields of `SCAFFOLD_LEAD_FIELDS` that `required_header_fields()` answers. Under openDox's own default adapter, that is both.

**Why it follows the corpus rather than always leading.** openxFactory's gated create and openXdox's authoring suite pin the governed layout with the H1 on the first line:
- `tests/ideation-dashboard/test_gate_routes.py::test_create_document_lands_the_scaffold_and_the_record` asserts `text.startswith("# Lens launch session — Brainstorm\n")`;
- `tests/test_authoring_agent.py` asserts the same for its own title.

openxFactory's adapter obliges only the governed block's own fields (`Status`, `Kind`, `Summary`, …), which it reads over a 15-line window (`STATUS_SCAN_LINES`). So there the answer is `()`, and the created bytes do not change. That adapter's readers (`classify`, `ideation_readiness._parse_header`, `families._h1`) would read a scaffold with the lead block correctly anyway, since they scan the window and `_FIELD_RE` needs a capital letter. The lead is still left out there, because those pins hold the exact bytes.

**One behaviour change.** `create_scaffold` asks the corpus as `agent_capture` does, so with no home registered it now refuses (`CorpusRefused`, `ADAPTER_NOT_REGISTERED`), naming the seam (4.2). Every create path runs after an entry point registers one. No running test in openDox-code, openXdox-code or openxFactory calls it in a bare process. openXdox's `tests/test_authoring_agent.py` does, but it is in openXdox-code's declared exclusion (`doc_health`), so it runs nowhere today. Its `agent_capture` cases already need a registered home, through `missing_required_headers`.

**Also in `8e7da4a`, the half of openDox-code#53's review that needs T054's rule.** T054's falsifier case now also asserts that `notes-toolshed-inventory.md`, the source outside the rain-barrel pair, lands in no group. T050's own test pins what the topics are derived from, and this pins the projection's reading of them.

**Tests** (`tests/test_neutral_projection.py`, 25 → 29 cases):
- `test_openDoxs_own_scaffold_carries_the_small_neutral_field_set`: under openDox's default, `leading_header()` of the created text is exactly `{title, summary}` and `missing_required_headers()` is `[]`. `agent_capture` accepts the same text, and the projection keeps both documents' title and summary.
- `test_a_scaffold_keeps_the_governed_layout_where_the_corpus_obliges_neither`: under a corpus that obliges the governed fields, `scaffold_lead_fields() == ()`, and the created bytes equal `render_scaffold()`'s default, H1 first.
- `test_the_lead_block_is_the_neutral_fields_in_order_then_a_blank_line`: the order is `SCAFFOLD_LEAD_FIELDS`' whatever the request's, the suffix is dropped, an unknown field is refused, and `NEUTRAL_FIELDS ⊆ SCAFFOLD_LEAD_FIELDS`.
- `test_a_scaffold_with_no_corpus_registered_refuses_and_writes_nothing`.

**Mutations: 8 of 8 killed.**

| mutant | cases red |
|---|---|
| `create_scaffold` passes no lead | 2 |
| `render_scaffold` always leads with both | 3 |
| the neutral title keeps the suffix | 1 |
| the lead is chosen without asking the corpus | 2 |
| an unregistered corpus is read as obliging nothing | 1 |
| the lead order follows the request | 1 |
| an unknown lead field is ignored | 1 |
| the projection keeps its stopwords (a group `the` then absorbs the toolshed note) | 1, the new no-group assertion; the pre-change case passes it |

**The whole suite at `8e7da4a`**, as CI runs it (`CI=true`, `LANG=C.UTF-8`, PostgreSQL 16, `-e ".[runtime,test]"` under the lock):
- `2587 passed, 11 skipped`, triple `selected=2598 passed=2587 skipped=11`;
- that is +9 over `5a6fe637`'s 2589: #54's review rounds after `4ca45d27` added 5 seam cases, and this change adds 4;
- F4.1's scan (`scan_deferred_reaches.py`, sha256 `fe116203…`) is 19 before and after, with the same reaches.

## The falsifier

From T054's entry in tasks.md:

> **Falsifier**: an in-process test that the projection over T050's fixture, with neither sibling importable, validates against T053's schema and carries none of F5.3's declared words; the topic-rule test over a copy of repository (b); and a test that a `stage:` value outside the six is reported and read as a source.

All three are in `tests/test_neutral_projection.py`, first, in that order:

- The first runs in a fresh process with `openxdox`, `ideation_dashboard`, `doc_health` and `corpus_adapter_openxfactory` blocked. The process asserts each one fails to import. `cli.build_parser()` registers openDox's own defaults, and the process generates through `generator_seam.generate()` over a fresh git repository of T050's fixture.
- The schema is `tests/fixtures/opendox-snapshot.schema.yaml`. It is a byte-identical copy of openDox-spec#16's file at `cd49eb25`, held to its sha256 `f9e3e111…584a`, until T057 ships the packaged copy.
- The evaluator ports openDox-spec's own: the keywords the contract uses and its seven reference rules. The leg installs no `jsonschema`.

Python 3.12.3, pytest 8.4.2, in a venv installed with `-c constraints-cpython312-linux.txt -e ".[runtime,test]"`:

```text
test_the_schema_copy_is_openDox_specs_contract_and_matches_the_product PASSED
test_the_projection_over_the_plain_documents_fixture_is_a_neutral_snapshot PASSED
test_the_topic_rule_groups_repository_b_which_has_no_front_matter PASSED
test_a_stage_value_outside_the_six_is_reported_and_read_as_a_source[shelved] PASSED
test_a_stage_value_outside_the_six_is_reported_and_read_as_a_source[Grouping] PASSED
test_a_stage_value_outside_the_six_is_reported_and_read_as_a_source[] PASSED
test_the_malformed_fixture_keeps_its_one_violation PASSED
test_title_and_summary_are_copied_exactly_and_null_only_when_absent PASSED
test_an_entry_the_adapter_cannot_classify_is_not_a_document PASSED
test_a_path_the_schema_cannot_carry_is_left_out_and_reported[back\\slash.md-backslash] PASSED
test_a_path_the_schema_cannot_carry_is_left_out_and_reported[tab\tin-name.md-control character] PASSED
test_declared_topics_replace_the_derived_ones PASSED
test_an_empty_topics_header_declares_no_topic PASSED
test_a_word_is_a_run_of_letters_even_beside_digits PASSED
test_a_declared_group_gathers_the_sources_that_share_its_topics PASSED
test_a_declared_group_with_no_topic_forms_no_group_and_is_reported PASSED
test_station_ids_are_unique_within_a_section PASSED
test_the_anchors_come_from_the_source_revision_and_the_bytes_repeat PASSED
test_a_repository_with_no_commit_needs_a_pinned_revision PASSED
test_the_default_adapter_obliges_the_small_neutral_field_set PASSED
test_required_header_fields_answers_the_neutral_set_through_the_entry_point PASSED
test_the_header_reader_keeps_an_empty_value_and_stops_at_a_blank_line PASSED
test_the_display_defaults_are_the_neutral_snapshots_values PASSED
test_the_wheel_counts_a_groups_edges_where_it_carries_no_tally PASSED
test_the_projection_imports_with_no_sibling_and_no_third_party_module PASSED
25 passed in 5.26s
```

The file also passes under `--noconftest`. F5.3 itself runs `python -m opendox.cli generate`, whose verb reaches the consumer's generator until T055 routes it (`cli.py:90`). So T056 and T063 quote F5.3, and T056 tests the verb's own report of a `stage:` value outside the six.

**Cross-checks.** The snapshots were checked outside this suite in two ways: with `jsonschema` 4.26.0 (Draft 2020-12, format checker and `rfc3339-validator` installed), and with openDox-spec's own `tests/test_opendox_snapshot_contract.py` evaluator. Both agree:
- T050's snapshot has no error, and neither does repository (b)'s;
- T051's has exactly one, `title-and-summary-are-text` at `/documents/1/title`.

## The repository's own checks

- **The whole suite, against a `postgres:16` container** (CI's service and DSN shape), so the database-backed cases run:

  | run | passed | skipped |
  |---|---|---|
  | base `b1946db` (the branch before T054's commits) | 2554 | 11 |
  | head `5a6fe637` | 2578 | 11 |

  The test-by-test JUnit diff has **25 added** (all of `tests/test_neutral_projection.py`, all passing) and **1 removed** (the retired `test_openDoxs_own_generator_refuses_until_its_projection_lands`). **0** outcomes changed.
- **The triple pin** reads: selected 2589 (floor 2476), passed 2578 (floor 2465), skipped 11 (pinned exactly 11).
- **F4.1's scan** (`scan_deferred_reaches.py` over `src/opendox`) finds 19 deferred reaches at `main` and 19 at head. The only difference is line numbers, so T054 adds no reach. The projection imports with every sibling blocked and pulls in no third-party module.
- **Mutations: 18 of 18 killed.**
  - Coerce an empty title to null.
  - Drop the out-of-six notice.
  - Admit any `stage:` value.
  - Map `organized` to `selection`.
  - Turn off mention scanning.
  - List unclassifiable entries.
  - Carry any path.
  - Miscount `keyword_index`.
  - Let a declared group gather non-sources.
  - Read `generated_at` from the clock.
  - Make the default adapter oblige nothing.
  - Count an empty field as present.
  - Make the wheel ignore edges.
  - Start candidates `selected`.
  - Let one source form a group.
  - Ignore the heading for a document's name.
  - Treat an empty `topics:` header as absent.
  - Drop a letter run that sits beside a digit.
- **`tests/test_display_facet.py`: four node-harness cases edited.** Their fixtures carried the governed snapshot values:
  - the partial-override collision;
  - the board's stripe classes;
  - the explorer's stage word;
  - the funnel's search haystack.

  Each now reads the value openDox ships (`SNAPSHOT_VALUES`), and each still tests what it tested. The canvas case's neutral assertion now compares against openDox's own word instead of a value the neutral install can never write.

The PR stays out of `conftest.py`, `pyproject.toml`, `validate.yml`, `README.md` and every pin, and it edits neither `cli.py` nor `serve.py` (T055's single-writer chains).

## Files (T054's own commits)

| file | change |
|---|---|
| `src/opendox/neutral_projection.py` | new: the projection |
| `src/opendox/default_generator.py` | `generate()` projects the home corpus; `NeutralProjectionNotBuilt` is retired |
| `src/opendox/display_profile.py` | `SNAPSHOT_VALUES`' defaults become the neutral values |
| `src/opendox/web/views/display.js` | the mirror of the same defaults (line count unchanged) |
| `src/opendox/web/views/wheel-model.js` | the grouping tile counts edges where no tally exists (line count unchanged) |
| `src/opendox/runtime/local_git_adapter.py` | `leading_header()` made public, `NEUTRAL_FIELDS` added, `WorkingTreeCorpus`'s default field set, missing fields reported in the suffix branch |
| `src/opendox/authoring.py` | `8e7da4a`: `SCAFFOLD_LEAD_FIELDS`, `render_scaffold(lead_fields=)`, `scaffold_lead_fields()`, and `create_scaffold` leading with what the corpus obliges |
| `tests/test_neutral_projection.py` | new: 25 cases, then 29 at `8e7da4a` |
| `tests/fixtures/opendox-snapshot.schema.yaml` | new: T053's schema, digest-pinned |
| `tests/test_generator_seam.py` | the refusal case retired, and its docstring point updated |
| `tests/test_display_facet.py` | four fixtures read the shipped values; one assertion made positive |
| `tests/test_plain_documents_fixture.py` | T050's docstring (merged from #53) says what is true once T054 and T036 are in |

## CI and review rounds

- **CI at `0f42f678` failed one case, and `b2f92226` repairs the test.** The case was `test_the_anchors_come_from_the_source_revision_and_the_bytes_repeat`.
  - CI's git prints `%cI` for a zero offset as `2026-09-27T12:00:00Z`, and git 2.43.0 prints `2026-09-27T12:00:00+00:00`.
  - The projection records the stamp exactly as git spells it, and the schema admits both spellings.
  - The test compared the stamp to the fixture's date as a string. It now compares them as instants. Its first assertion still holds `generated_at` to the checkout's own `git show` output.
- **Copilot at `0f42f678`: three threads, all taken in `c0747e96`, answered and resolved.**
  - `r4117298988`: an empty `topics:` header fell back to derived topics, which contradicted the rule the module states. It is now a declaration that carries no topic. The new case is `test_an_empty_topics_header_declares_no_topic`, and it fails under the old rule.
  - `r4117299013` and `r4117299033`: T050's test docstring said T054 had not landed, which T054 makes false. It also said the suite ran outside `validate`'s explicit list, which has been false since T036 (#52). It now says what is true. Only the docstring changes.
- **Copilot at `c0747e96`: one thread, answered and resolved, plus one overview remark taken in `5a6fe637`.**
  - `r4117331489` asked that a supplied `source_revision` be passed into the `CorpusRef`. That is not taken, on the product's own contract:
    - the seam and the CLI define the value as an anchor to pin, and openXdox's governed generator records it and scans the tree it is handed;
    - the holder ruled that content comes from the working tree, per Brett's T022 ruling.
    - `default_generator`'s docstring now states the rule in its own paragraph.
  - The overview's remark that digit-adjacent names were tokenized wrongly was right. Letter runs and digit runs are now separate tokens, as the docstring's "a run of three or more letters" says. The new case is `test_a_word_is_a_run_of_letters_even_beside_digits`, and it fails under the old tokenizer.
  - The same overview says the seam's "replacement-generator tracking can reject valid registrations". That is `generator_seam.py`, which is #54's (T052's) code, with no thread here. It is flagged to the holder, not changed here.
- **Copilot at `1a603677` (the merge of `main`): 1 thread, taken in `03e06ccd`.**
  - r4139383472: the lead block interpolated `title` and `summary` as given, so `summary="ok\nstage: completion"` wrote a line `leading_header()` reads as the document's own `stage:`.
  - `render_scaffold()` now refuses a lead value carrying a control character (`Cc`) or a line or paragraph separator (`Zl`, `Zp`), before anything is rendered, so `create_scaffold` writes nothing. With no lead block nothing new is refused.
  - `test_a_lead_value_that_is_not_one_header_line_is_refused`: 20 cases, all red against `1a603677`. Local whole suite: `selected=2618 passed=2607 skipped=11`.
- **Copilot at `03e06ccd`: 2 threads, both taken in `50b0d42b`.**
  - r4139523226: the `kind_field` vocabulary counted a field with an empty value as present. `_classify_by_header` now uses the suffix path's test, so an empty value is no field in both. `test_an_empty_field_is_missing_whichever_vocabulary_is_in_force`, red against `03e06ccd`.
  - r4139523258: `_commit_date` ran a bare `git`. `LocalGitCorpus` exposes its `executable`, and the date is read with the home corpus's own git. `test_the_commit_date_is_read_by_the_home_corpus_s_own_git`, red against `03e06ccd`.
- **Copilot at `50b0d42b`: 2 threads.**
  - r4139607560, taken in `d7954fc6`: a `DocumentId.key` is opaque to the adapter interface, and the projection read every key as a path. An adapter now declares `document_keys_are_paths = True` (`neutral_projection.PATH_KEYS`), `LocalGitCorpus` does, and `project()` refuses any other with `ProjectionRefused`. `test_an_adapter_whose_keys_are_not_declared_paths_is_refused`, red against `50b0d42b`.
  - r4139607585, not taken: it does not reproduce. A path reaches the invalid-stage notice only after `_unwritable()` refuses every control character, so such a path is named by its `repr` and left out first.
- **Copilot at `d7954fc6`: "Needs a closer look", no findings, 0 threads.** CI is green, with `selected=2621 passed=2610 skipped=11 failures=0 errors=0`.

## What the later tasks need

- **T055** (`cli.py`/`serve.py` single writer):
  - The scaffold mismatch #59 raised (r4126022820) is fixed here, in `8e7da4a`. #59 takes it with this branch's head.
  - Route the generate verbs through `generator_seam.generate()`.
  - `_default_home_factory`'s docstring in `cli.py` (around line 877) and `serve.py` (around line 1520) still says the default adapter has bare defaults and that "T054 sets the neutral fields". `WorkingTreeCorpus()` now carries `NEUTRAL_FIELDS`, so that sentence needs correcting.
  - `_report` prints `project=` from a field that the neutral kind does not have. It reads the field with `.get`, so it shows `<ungrouped>`.
- **T056**:
  - The verb's report of a `stage:` value outside the six is the `notice:` line that `default_generator.generate()` writes to standard error. Once T055 routes the verb, it needs no further plumbing.
  - The F5.3 sweep over T050's snapshot is clean in process.
- **T057**: this PR's schema copy is replaced by the packaged copy once T057 ships it.
- **T058**: the malformed fixture yields exactly one violation, `title-and-summary-are-text` at `/documents/1/title`, and `EXPECTED_RULE` is not a document.
- **T060**: the governed `values` block, as T053's writer listed it.

Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)

🤖 Generated with [Claude Code](https://claude.com/claude-code)


Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
brettheap added a commit that referenced this pull request Sep 30, 2026
…) (plan 034) (#58)

Plan 034 (`specs/034-opendox-standalone-operation/tasks.md`, read at openxFactory `main` `6b97c601`), phase-2 slice **P2-V**, its one task: **T057** (#1144's 7.1, 7.1a, 7.1b and 7.2, with 7.1 as T007's batch G amends it). Claimed on openxFactory#656 in `5873510118`.

**Authored ahead, as a phase-2 draft** (Brett 2026-09-27: "Start phase 2's independent tasks"). **T049 has landed** (openxFactory#1204 → `9d2e5bc3`), so phase 2 is open. Both steps it waited on are done:
- **T053 has landed**: openDox-spec#16 → `f7ee3c76`;
- **the openDox root pins that commit**: opensoft/openDox#14 (dox-v1.1) → `52005213`. `e94ab323` moves the record and `SPEC_COMMIT` to it (below).

#57 (T054) has landed too, as `a691e4e4`, and `main` is merged here. This PR stays a draft until the holder un-drafts it.

- **Ruled**: R1Q22 (a), `5817152735`; R1Q12 (a), `5850003126`.
- **After**: T049, T009, T053.

## The stack

This PR was **stacked on #57** (T054), and is now based on `main`: it was retargeted before #57 landed, and #57 landed as `a691e4e4`. The diff below is T057's alone. #57's head `8e7da4a2` was merged here as `27bcefc`, after T049 landed. #57 has since merged `main` `fa8862cc` as `1a603677`, which has `8e7da4a2`'s tree.

- #53 (T050), #56 (T051) and #54 (T052) have landed, as `dc3765dd`, `86647320` and `fa8862cc`. #57's branch carried their final heads' content before they landed.
- T057 needs the seam: the validator's neutral kind is held to T052's `generator_seam.NEUTRAL_SNAPSHOT_KIND`, and the in-process checks run openDox's own projection over T050's and T051's fixtures.
- **Before #57's branch is deleted at its landing, retarget this PR to `main`.** A `--delete-branch` on #57 would close this PR. Then merge `main` in.

## What it does

- **`src/opendox/contracts/`: the input set (7.1, 7.1b).** It holds the four packaged copies, which are openDox's own spec leg's four: `ideation-workbench`, `opendox-snapshot`, `xfactory-workbench-chat-turn` and `xfactory-workbench-model-catalog`.
  - Each copy is byte for byte openDox-spec's file at `f7ee3c76`, T053 as landed and the spec commit the openDox root pins. That commit carries all four. It has the tree of #16's last head, `cd49eb25`, where the copies were first taken. Its three older files are the blobs of the root's previous spec pin, `8fe8c4c7`.
  - `copies.yaml` is the record: the spec-leg commit, and each copy's path and sha256. A copy is read only after its sha256 is proved against the record. A changed, absent or unpinned copy is refused before a byte of it is parsed (`neutral-product-pin`'s rule for a vendored contract).
  - `gate-intent` and `ideation-possibles-register` are not in the set, and neither are the other four schemas of the family. A record that names any copy other than the four, or leaves one out, is refused (`COPY_IDS`), so no edit to the record lets one in.
  - The record and the four copies ship as package data, under a new `opendox.contracts` key in `pyproject.toml` (below).
- **`src/opendox/validator.py`: the validator, new surface at the code leg (7.2).**
  - It evaluates JSON Schema 2020-12, exactly the keywords the four copies use. `format: date-time` is asserted, as the consumer's validator asserts it.
  - A copy that uses a keyword, format, dialect or reference it does not evaluate is refused when its validator is built, never evaluated with that keyword left out.
  - So is a keyword holding a value of another shape, an embedded resource, a subschema that contains itself, and a reference cycle that never moves into the instance. A malformed copy is refused as unavailable, never a crash (below). An instance whose keys are not text, which YAML allows, is judged and never crashed on, and so is a value of any size or depth.
  - A refusal names its rule: `[<x-rule>] <where>: <detail>`.
  - It implements the neutral snapshot's seven reference rules. A snapshot validator is refused if the contract's catalog and the implemented rules differ.
  - `validators()` answers one validator per wire kind, with the jsonschema-shaped `iter_errors()` that the doxBench seam's readers use, built as openxFactory's `doxbench_contracts` builds its own (T085).
  - Its docstring records why the consumer's script cannot be reused (7.1a), measured at openXdox-code `4610bca5` (below).
- **`tests/test_validator_input_set.py`** is the falsifier (28 cases). **`tests/test_validator.py`** tests the evaluator (185 cases).
  - `tests/fixtures/spec-examples/` is its corpus, openDox-spec's own examples at `cd49eb25`. It holds 13 positives of three kinds (2 `opendox-snapshot`, 5 chat-turn and 6 model-catalog) and the neutral contract's 32 negatives, one per rule. All 45 are verified as the spec leg's exact blobs.
  - **The spec leg's two `ideation-workbench` examples are not carried.** This leg's committed-manifest guard (`workbench.committed_manifests`, held by `tests/test_workbench.py::test_no_workbench_manifest_is_tracked_in_this_repo`) refuses a workbench manifest tracked anywhere but the root's `examples/` and `contracts/schemas/`. CI went red on them at `97b314a` (run `36450791192`), and `69f2040` removes them.
  - The kind is held instead over the manifests openDox's own `workbench.Workbench` writes: one per seed kind, each with every member route, an exclusion, every action and a notebook binding. An override with no recorded reason is refused as `[required]` at its member. The cross-check below still covers the two examples, read from the spec leg's own tree.

No skip is added, since `EXPECT_SKIPPED` is exactly 11. It touches no `openspec/changes/` path, no `conftest.py`, no workflow, no `README.md` and no pin. Its one `pyproject.toml` change is the package-data key, on the holder's decision (below).

## The falsifier

T057's falsifier is *"the packaged-copy digest test and the 7.1b test"*. At `80b5f9e`:

```
tests/test_validator_input_set.py::test_each_packaged_copy_is_the_spec_legs_file_at_the_pinned_commit PASSED [ 50%]
tests/test_validator_input_set.py::test_gate_intent_and_the_possibles_register_are_not_in_the_set PASSED [100%]
============================== 2 passed in 0.16s ===============================
```

Both go red when they should. In a scratch clone of `ca52182` I changed one byte of the neutral copy (byte 10181, `i` to `I`) and planted a `gate-intent` copy beside the four:

```
E           AssertionError: src/opendox/contracts/schemas/opendox-snapshot.schema.yaml is b9f3074a6d7d7670289e2a6d048169550a8571820dd8dba72acf4cd52ee9b72b, and the record pins f9e3e111af1d4bd4c377c933027d81b582ae2b0a395b66f4e4621992454a584a. A copy is never edited in place
E           AssertionError: a copy of gate-intent is carried under src/opendox/contracts/schemas/, which 7.1b refuses: requirement 1 keeps it with openxFactory
FAILED tests/test_validator_input_set.py::test_each_packaged_copy_is_the_spec_legs_file_at_the_pinned_commit
FAILED tests/test_validator_input_set.py::test_gate_intent_and_the_possibles_register_are_not_in_the_set
2 failed in 0.46s
```

The two tests' assertions that went red there are unchanged since. `9d2cda1` adds one assertion to the 7.1b test: `COPY_IDS` names neither schema.

**The digest test holds each copy to the spec-leg commit the openDox root pins.** The test states the root's digests apart from the record, so a copy and its recorded digest cannot move together unseen.

- All four are the digests the root's `contracts/manifest.yaml` records at its spec pin `f7ee3c76` (the root's `main` at `52005213`, opensoft/openDox#14).
- The three older ones are unchanged from the previous spec pin, `8fe8c4c7` (the root's `main` at `663ac683`).

Read with `git show <commit>:contracts/schemas/<file> | sha256sum` in openDox-spec:

| copy | sha256 at `8fe8c4c7`, `cd49eb25` and `f7ee3c76` | the root's manifest at `52005213` |
|---|---|---|
| ideation-workbench | `d30438491119…faafc` | same |
| xfactory-workbench-chat-turn | `350bfedc0269…1dc1d` | same |
| xfactory-workbench-model-catalog | `e563cc9fc6ed…21635` | same |
| opendox-snapshot | absent at `8fe8c4c7`; `f9e3e111af1d…4a584a` at `cd49eb25` and `f7ee3c76` | same |

## The package-data line (on the holder's decision)

7.1 ships the four as **package data**. `pyproject.toml` used to package only `web/**`. On the holder's decision, this PR now carries the new key: openDox-code's phase-1 work has landed, so no phase-1 writer edits `pyproject.toml` any more. It is its own key beside the bundle's line, which `test_gate_loop_contributed` holds verbatim:

```toml
opendox = ["web/**"]
"opendox.contracts" = ["copies.yaml", "schemas/*.schema.yaml"]
```

`test_the_package_data_ships_the_record_and_every_copy` lands with it. It holds the table to the record: the patterns under `opendox.contracts` ship exactly the record and every copy the record pins. At `ca52182`, where the line landed (the test is unchanged since):

- It passes.
- With only the key line removed, it fails (`KeyError: 'opendox.contracts'`).
- With a stray schema planted under `schemas/`, it fails, because the patterns would ship a file the record does not pin.

The test parses `pyproject.toml` and builds no wheel. The install-level evidence is real wheels: each built with `pip wheel . --no-deps` from a clean clone, installed into a separate venv and probed from outside any source tree. The two module digests are the head's own files. The probe's `opendox from:` lines are left out; each showed the run importing from its venv's site-packages.

```
== wheel built from 80b5f9e
opendox/contracts/__init__.py  sha256 5b85edfe427e
opendox/contracts/copies.yaml
opendox/contracts/schemas/ideation-workbench.schema.yaml
opendox/contracts/schemas/opendox-snapshot.schema.yaml
opendox/contracts/schemas/xfactory-workbench-chat-turn.schema.yaml
opendox/contracts/schemas/xfactory-workbench-model-catalog.schema.yaml
opendox/validator.py  sha256 9e6fc2974398
kinds: ['ideation-workbench', 'opendox-snapshot', 'workbench-chat-turn-v2', 'workbench-chat-turn-v2-failure', 'workbench-chat-turn-v2-success', 'workbench-model-catalog']
six-stations: no violation
title negative: ["[title-and-summary-are-text] /documents/2/title: '' is shorter than 1"]
rc=0
```

Compared with a wheel built without the line, it adds exactly those five data files and removes nothing: 106 entries outside `dist-info` become 111, and the 41 `opendox/web/` entries are unchanged. Without the line, an installed validator refused. That was measured at `69f2040`, before the line landed:

```
== wheel without the held line
opendox/contracts/__init__.py  sha256 b264a03b6f5b
opendox/validator.py  sha256 f620194b0b4f
UNAVAILABLE: opendox.contracts has no copies.yaml: the package was built or installed without it (FileNotFoundError)
rc=3
```

Copilot's two findings, at `97b314a` and again at `69f2040`, were this line. Both threads were answered twice, with the held measurement and then with `ca52182`, and both are resolved.

## The fail-closed build (Copilot's findings at `ca52182`, `bc3470b`, `2b32cbf`, `9d2cda1` and `4474514`)

The module promises that a copy it cannot evaluate is refused when its validator is built, as `SchemaNotEvaluable` (a `ValidatorUnavailable`). Copilot's review at `ca52182` found a hole in that promise, in code unchanged since `d89f252a`: `type: {}` made `set(names)` raise `TypeError` during the build. I probed the same class with 40 malformed values. At `ca52182`:

- 5 crashed the build: `type: {}`, `type: [["string"]]`, `format: {}`, `allOf: 5`, and two non-text unknown keys (a mixed sort). A pattern with an unbounded repetition crashed it too (`OverflowError`).
- 30 built. Of those, 20 then crashed on an instance. The other 10 judged instances by a value draft 2020-12 does not allow: `uniqueItems: "yes"` read as true, `maxLength: -1` refused every string, and `maximum: nan` passed everything.
- 5 were refused.

`bc3470b`'s commit message says twenty-three of them built. The probe's count is thirty.

At `80b5f9e` all 40 are refused, and so are these:

- Every evaluated keyword's value is checked against the shape draft 2020-12's metaschema gives it (`_SHAPES`). A test holds `_SHAPES` to `KEYWORDS`, so no evaluated keyword goes unchecked.
- Every reference's target, and the kind's entry, is walked like the document. A reference can reach a node no walk of the subschemas passes, such as one inside an `enum`.
- An embedded resource (`$id` or `$schema` below the root) is refused, since it would move where its references resolve.
- A subschema that contains itself, which a YAML alias can build, is refused where it loops.
- A JSON-pointer index that is not a plain decimal (`-1`, `01`) names nothing. Python's `int()` would read another element.
- **From Copilot's review at `bc3470b`:** a reference cycle that never moves into the instance, such as `$ref: "#"` or two `$defs` that refer to each other, is refused, naming the cycle. jsonschema 4.26.0 recurses on those until Python's limit. A recursive schema that moves into the instance before it recurs, such as a tree whose children are items, is still evaluated. A copy nested deeper than Python's recursion limit is refused too.
- **From Copilot's review at `2b32cbf`:** a JSON-pointer token whose `~` is not `~0` or `~1` makes no pointer (RFC 6901). A `$ref` carrying `%` is refused as a percent-encoded fragment this module does not decode. At `2b32cbf`, `#/$defs/a%20b` read the literal key `a%20b` and passed `5`, where jsonschema decodes it to `a b` and fails `5`. The same review's record finding is under the input set above.
- **From Copilot's review at `9d2cda1`:** the record's key refusal ran `sorted()` over a record's keys, so a key that is not text raised `TypeError`. It now orders keys by their `repr`. An instance fuzz of the same class found worse at evaluation: under `additionalProperties: false`, the report ran `sorted()` over an instance's extra keys, and 115 of 3,000 odd instances crashed a validator. Those keys are ordered by `repr` too. YAML nested past Python's recursion limit escaped the three YAML reads (the record's, `contracts.load()` and `validator_for()`) as `RecursionError`, and each now refuses it.
- **From Copilot's review at `4474514`:** a bound past a float's range, such as a 400-digit YAML integer, crashed the build in `math.isfinite()`, and every int is now finite. A `const` or `enum` that contains itself is refused. On the instance side, equality was judged on nested tuples, which CPython compares recursively, so an instance value 5000 deep crashed its judgement. The canon is now text, built without recursing and compared as text, and it keeps JSON equality. A violation's detail always shows something, and PyYAML's `ValueError` (an integer past 4300 digits, an impossible date) is refused by all three YAML reads.
- `bc3470b`'s review also found that `enum: []` and `required: []` should be refused. Those two findings are not taken. Both are valid 2020-12 schemas. The metaschema gives `enum` no `minItems` and gives `required` `default: []`; the `minItems: 1` was draft-04's. jsonschema treats both as this validator does, and their threads carry the evidence.

The four copies use none of the refused forms: they have no anchors or aliases, no nested `$id` or `$schema`, only integer counts, and references only into `$defs`. All six kinds build as before. Of the 58 new cases through `2b32cbf`, 57 fail against `ca52182`'s validator and pass here. The 58th, the recursive tree, passes on both, as the guard against over-refusing. `9d2cda1`'s four new refusal cases fail against `2b32cbf`'s code, and its escape case passes on both, as the same kind of guard. `4474514`'s four new cases fail against `9d2cda1`'s code. `80b5f9e`'s six new refusal and depth cases fail against `4474514`'s code. Its canon-equality case passes on both, as the guard that JSON equality is unchanged.

## After T049: Copilot at `27bcefc0`, one thread, taken in `bf51a30a`

- **r4136329332: an instance deeper than the walk raised `RecursionError`.** A recursive schema that moves into the instance (a tree whose children are items of the node) recurs once per level of the instance, and the build accepts such a schema. Measured at `27bcefc0` with this module's own tree schema, at the default limit of 1000: 100 levels judged, and 200, 300, 400, 1000 and 5000 levels raised.
- **Now judged, not crashed on.** `KindValidator.iter_errors()` catches the `RecursionError` from the walk, once the walk's frames have unwound, and yields one violation, `[evaluation-depth] <root>: …`. Its rule, `DEPTH_RULE`, is exported. So the instance is never valid, which fails closed.
  - What the walk found before the limit stands, and the reference rules still run.
  - `violations()`, `is_valid()` and `validate()` all go through it.
  - The evaluator stays recursive, because rewriting it on an explicit stack would put the 0-disagreement cross-check at risk. A tree the walk reaches is judged as before.
- **The regression case** is `test_an_instance_deeper_than_the_walk_is_judged_not_crashed_on`.
  - A 50-level tree is valid.
  - A 5000-level one yields exactly the depth violation, at the root.
  - With a node near the top broken, both `("required", "/children/0")` and the depth violation are named.
  - Against `27bcefc0`'s validator the case raises `RecursionError`. A mutant that swallows the error silently fails it too.
- **The whole suite at `bf51a30a`:** `selected=2812 passed=2801 skipped=11`, which is +1. F4.1 reads 19.

## Copilot at `bf51a30a` ("Needs a closer look", no thread): taken in `6b68e32a`

- **"Previously missed": a bound of any size crashed the violation's detail.** `_is_bound()` admits an integer of any size, so a schema with `minimum: 10**5000` builds. But eight details (`minimum`, `maximum`, `minLength`, `maxLength`, `minItems`, `maxItems`, `minProperties`, `maxProperties`) put the bound into the text directly. So validating `0` against that schema raised `ValueError`, Python's 4300-digit limit on int-to-text, while the violation was being written.
  - Reproduced for `minimum`, `maximum` (at `-10**5000`), `minLength`, `minItems` and `minProperties`. The three max counts cannot fire at such a size.
- **Now each bound is shown through `_brief()`**, as the instance's value already was, so a huge one reads `<an int of 16610 bits>`. An ordinary bound reads exactly as before, since `_brief(5)` is `"5"`.
- **The regression case** is `test_a_violations_detail_shows_a_bound_of_any_size`, five cases, which all fail against `bf51a30a`'s validator, plus an ordinary-bound check.
- **CI at `6b68e32a`:** `validate` and SonarCloud are green, with `selected=2817 passed=2806 skipped=11 failures=0 errors=0`, which is +5.

## Copilot at `6b68e32a`: "Needs a closer look", no findings, 0 threads

- The overview's one line reads *"Require `audit_ref` whenever the `provider_retry` object is present."* It is **not taken, on the holder's ruling** (2026-09-29), and answered in [this comment](#58 (comment)). The note opened no thread.
  - `provider_retry` is in `xfactory-workbench-chat-turn.schema.yaml`, one of the four packaged copies. That copy must stay byte for byte the spec leg's file, now the file at `f7ee3c76`. Its sha256 (`350bfedc…`) is the one `copies.yaml` and the root's manifest record. Requiring `audit_ref` in the copy alone would break the falsifier this PR exists for.
  - `audit_ref` is optional by the contract (`required: [retried, at_most_once]`), and `serve_wire.py` writes it only when it has one. Making it required is a contract change for the spec leg and its owner, not for T057.

## After the root step: `e94ab323`

- **T053 landed** as openDox-spec `f7ee3c76`, a squash of #16 whose tree is `cd49eb25`'s (`7b00d19e`). **opensoft/openDox#14 moved the root's spec pin to it.** The root's `spec` gitlink and `contracts/spec-pin.yaml` name `f7ee3c76`, and its `contracts/manifest.yaml` records the four files at that commit, with the four digests above.
- **`e94ab323` moves `copies.yaml`'s `commit` and the falsifier's `SPEC_COMMIT` from `cd49eb25` to `f7ee3c76`, together**, on the holder's word. No digest moves. Each of the four copies is `cmp`-identical to the file at `f7ee3c76`. The comments that say what the root pins now say it, and `tests/test_validator.py`'s corpus note names the landed commit.
- Moving `SPEC_COMMIT` back alone fails 2 of the falsifier's 28 cases, so the two still move together or not at all.
- The whole suite at `e94ab323`: `selected=2817 passed=2806 skipped=11`, unchanged.

## After #57 landed: `1433234`, `cb40b977` and three review rounds

- **`1433234` merges #57's final head `d7954fc6`**, with no conflict. T057's own diff against it is byte-identical to its diff against `8e7da4a2`: 55 files, +6320. **`cb40b977` merges `main` `a691e4e4`**, whose tree is `d7954fc6`'s, so it adds no content.
- **Copilot at `cb40b977`: 2 threads.**
  - r4139739110, taken in `3351f6a7`: YAML builds values JSON has not (sets, bytes, dates, non-text keys, non-finite numbers), and `const`/`enum` were checked only for self-containment. `_first_non_json()` now refuses them at build. `test_a_const_or_enum_that_holds_a_value_json_has_not_is_refused`, 6 cases, red against `cb40b977`.
  - r4139739167, not taken: four documents in the six-stations example carry `water`, so its count of 4 is right, the validator finds no violation there, and the file is byte for byte openDox-spec's at `f7ee3c76`.
- **The T058 writer's measurement (openDox-code#68, r4139734412), taken in `2b8ad245`:** a packaged record or copy that is present but unreadable raised `PermissionError` out of `validator_for()`. Every `OSError` in `_read_package_file` is now a `CopyRefused`, and a missing file keeps its message. `test_a_present_file_that_cannot_be_read_is_refused_not_raised`, over the record and the snapshot copy at mode 000 (skipped as root), red against `3351f6a7`.
- **Copilot at `2b8ad245`: 3 threads.**
  - r4139823704 and r4139823779, taken in `753ffa19`: an instance key of `10**5000` has no decimal text, so a pointer beneath it, and the unexpected-properties report, raised `ValueError`. Pointer parts fall back to `_shown`, and extra keys are ordered and shown item by item (`_brief_items`). `test_an_instance_key_of_any_size_is_named_not_crashed_on`, red against `2b8ad245`.
  - r4139823750, not taken: a tuple key canonicalizes as an opaque value, and `enum` and `uniqueItems` judge it without crashing. `test_a_non_text_key_that_is_not_a_scalar_is_judged_as_itself` guards it.
- **Copilot at `753ffa19`: "Needs a closer look", no findings, 0 threads.** CI is green, with `selected=2850 passed=2839 skipped=11 failures=0 errors=0`.

## 7.1a, measured

The consumer's `scripts/validate-ideation-dashboard-contracts.py`, run at openXdox-code `4610bca5`:

```
== no CONTRACTS_DIR, one openDox snapshot example
ERROR harness failure: .../contracts/schemas carries none of the family's 10 schemas (this tree carries no contracts/ and CONTRACTS_DIR is not set; export it as the spec leg's contracts directory), so nothing can be validated and no mode may report success
rc=2
== CONTRACTS_DIR = openDox-spec's contracts (all four there), the same example
ERROR [kind] .../opendox-snapshot-six-stations.example.yaml: unrecognized document (no known kind, no 'possibles_register' section)
rc=1
```

The docstring's six reasons are: it finds its schemas from its own position; it names ten schemas of three owners; it is the consumer's file; it needs `jsonschema`, `referencing` and `rfc3339-validator`; it knows no `opendox-snapshot`; and it is a subprocess script, where openDox-code has no `scripts/`.

## Verification

- **CI at `80b5f9e`**: `validate` (run `36471401716`) and SonarCloud are green.
- **The whole suite**, locally, as CI runs it (`CI=true`, `LANG=C.UTF-8`, PostgreSQL 16, `-e ".[runtime,test]"`), at the committed head with a clean tree. The base is #57's head, `5a6fe637`: **2578 passed, 11 skipped**. At `80b5f9e` it is **2791 passed, 11 skipped**. At `27bcefc`, after #57's head `8e7da4a2` was merged in, it is **2800 passed, 11 skipped** (`selected=2811`). That is #57's own 2598 plus these 213.
  - The case-by-case junit diff shows **+213 added** (185 and 28), all passed and all in the two new files. It shows **0 removed and 0 changed outcomes**, and the same 11 skips.
  - `--noconftest` passes too (213).
  - CI was red at `97b314a` on one case: the committed-manifest guard, over the two workbench examples then carried (above). My earlier local whole-suite run had passed because it ran before those files were committed, so these runs are at the committed head.
  - `LANG=C.UTF-8` is set because CI's runner sets it. In a shell with no locale, `test_model_provider_broker::test_the_broker_child_inherits_no_credential_shaped_environment` fails at `ca52182` and here alike, because Python's C-locale coercion (PEP 538) puts `LC_CTYPE` in the broker child's environment. That is the shell, not this PR.
- The cross-check, both fuzzes, the scan and the mutation check below all ran on `80b5f9e`'s committed source.
- **Against jsonschema and the spec leg's own evaluator**, over every one of openDox-spec's 86 examples at `cd49eb25`, all kinds, positives and negatives: **0 disagreements**.
  - jsonschema 4.26.0 ran with its format checker, per kind as openxFactory builds its validators.
  - For the neutral kind, the rules found equal the spec leg's `tests/test_opendox_snapshot_contract.py` evaluator's (rule, place) exactly, and equal jsonschema's read through `error.schema`'s `x-rule`.
  - The two examples whose kind is not openDox's raise `UnknownKind`.
- **Mutation fuzz**: 12,000 seeded random edits of the positive examples, compared as (keyword, place) against jsonschema, gave **0 disagreements** beyond one deliberate divergence, met 26 times. `rfc3339-validator` anchors with `$`, so it admits `...Z` followed by a newline, and this validator refuses it. That divergence is documented in `_is_date_time`, and the snapshot contract's own patterns guard the same tail.
- **Instance fuzz**: 6,000 instances over two seeds, each a positive example with an odd value planted somewhere. The values are non-text keys, sets, timestamps, bytes, NaN and infinity, lists 5000 deep, self-containing lists and mappings, and 5000-digit ints. All six validators gave **0 crashes**, where 115 of the first seed's 3,000 crashed at `9d2cda1`.
- **Mutation check**: 77 mutations of the two new modules, each killed by the new tests (77/77), with the sources restored and verified by sha256. One mutant, the cycle search blind to its own trail, loops allocating. The run caps each mutant at 4 GiB, and that one failed there.
- **F4.1's deferred-reach scan**: 19 at the base and 19 here, with the same list. The two new modules reach nothing. With every sibling blocked, the validator imports and validates, and it adds no third-party module beyond PyYAML.

## For the later tasks

- **T058** (the post-render validator in the generate verbs):
  - call `opendox.validator.validate(snapshot, kind=<the generator's declared contract>)`, and print `validator.report(...)` on stderr;
  - `ValidatorUnavailable` is the "could not run" case, which `--strict` makes fatal;
  - T051's fixture reports `[title-and-summary-are-text] /documents/1/title`;
  - `tests/test_neutral_projection.py` should read this packaged copy (`opendox.contracts`) in place of T054's `tests/fixtures/opendox-snapshot.schema.yaml`.
- **T055** (`validate_manifest` for `ideation-workbench`):
  - This validator checks the manifest against its schema. It does not check the old script's two workbench rules (pinned ⊆ checked, the schema's own VALIDATOR RULE comment; `new_candidates` disjoint from members ∪ excluded), nor its committed-manifest guard. So routing `validate_manifest` here drops those rules unless T055 carries them.
  - `test_every_manifest_openDox_own_workbench_writes_validates` holds the manifests `workbench.Workbench` writes to pass here: every seed kind, every member route and every action, with an exclusion and a notebook binding.
- **T085** (doxBench defaults): register `opendox.validator.validators` at `serve_wire.register_doxbench_validators`. The semantic rules of the two wire kinds are still T085's.
- **T061**: nothing from T057 is needed. The consumer's three schemas stay out of this set.
- **The openDox root**:
  - its `contracts/manifest.yaml` says the code leg *"carries no `contracts/` path at all"*, which is no longer true of `src/opendox/contracts/`;
  - nothing at the root holds these copies to its spec pin, so T062's `make pins` could gain that check.

## Before READY (not this PR's act)

1. ~~T049 lands.~~ Done: openxFactory#1204 → `9d2e5bc3`.
2. ~~T053 lands, and its root step moves the openDox root's spec pin. Then `copies.yaml`'s `commit` and the test's `SPEC_COMMIT` move to that commit together.~~ Done: T053 → `f7ee3c76`, opensoft/openDox#14 → `52005213`, and `e94ab323` moves the two together, with no digest moved.
   - The holder's answer (2026-09-29) stood throughout: T057's falsifier says "the spec-leg commit the openDox root pins", so the record moved only once the root pinned T053's landed commit.
3. ~~#57 (T054) lands, with this PR retargeted to `main` first.~~ Done: retargeted, #57 → `a691e4e4`, and `main` merged in as `cb40b977`.

Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)

🤖 Generated with [Claude Code](https://claude.com/claude-code)


Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
brettheap added a commit that referenced this pull request Sep 30, 2026
**Authored ahead, as a phase-2 draft.** Brett ruled on openxFactory#656, comment `5857365170` ("Start phase 2's independent tasks"), that phase-2 tasks are authored as drafts. **T049 has landed** (openxFactory#1204 → `9d2e5bc3`), so phase 2 is open. This PR stays a draft until the two tasks below have landed and the holder un-drafts it.

T055 is `After: T054, T057, T022, T038`, and all four have landed (#57 `a691e4e4`, #58 `8ec08e91`, #45, #48). Before they landed:
- T054 is #57, a clean draft. It waits on #54, #56 and T053 (openDox-spec#16).
- T057 is #58, a clean draft. It also waits on the openDox root pinning T053's landed spec commit. See "T057 and the validator default" below.
- T022 (#45) and T038 (#48) have landed.

This is plan 034's **T055 (serve and generate standalone: 5.5, and 4.3 in part)**, phase-2 slice **P2-R**. I read the plan at openxFactory `main` `6b97c60` (`specs/034-opendox-standalone-operation/tasks.md`). The slice is claimed on openxFactory#656, comment `5873583149`.

## What this branch carries

- It is **built on #57's branch**, `build/034-p2p-t054-neutral-projection` (T054, the neutral projection), which is itself built on #54 (T052, the generator seam). It was cut at `5a6fe637`, with #54's head `8d507c5b` merged in as `e8a733d`.
- After T049 landed, **#57's head `8e7da4a2` is merged in as `8cbb1ea`**, clean. That head carries:
  - #54's final head, `2f515c57`;
  - #56's head, `44dcc3a1`;
  - `main` `dc3765dd`, where #53 (T050) landed;
  - the holder's scaffold decision (`8e7da4a`), which answers r4126022820 below.
- **#58 (T057) is not merged in**, on the holder's decision (below).
- Until #54, #56 and #57 land, the diff against `main` carries their changes as well. T055's own change is:
  - its commits `c27eac35` through `f4ef63d3`: the first builds T055, and the other six take Copilot's review rounds;
  - `d7aa9d8c` (the holder's decision on empty source options), and `687d37bf`, `96f18c45` and `e3ef506a` (the next three review rounds), all after T049.

## What it builds

### Four seams, each with an openDox default of its own (R1Q10 (a))

`src/opendox/projection_seams.py` is new and uses the standard library only. It declares four seams:

| seam | what a registration carries | openDox's default |
|---|---|---|
| `registry` | the entry, registry and source types; the key, containment and publishable-ref rules; the data-source readers; the refresh bindings and defaults | `opendox.default_registry` |
| `corpus_root` | `corpus_scan_defect`, `corpus_root_refusal`, `change_rows`, `SCANNED_ROOTS` | `default_projection.CORPUS_ROOT` |
| `writer` | `write_snapshot(snapshot, path, boundary)` | `default_projection.WRITER` |
| `validators` | one validator per KIND: `validate(path, *, strict, search_from)`, answering a `ValidationResult` | `default_projection.VALIDATOR`, for `opendox-snapshot` and `ideation-workbench` |

The rules are the ones the profile and generator seams keep (R1Q3 (a) and (ii); RN-1 (a)):
- **Nothing registered refuses** (4.2). The refusal names the seam, its call and the four entry points. There is never a silent fallback.
- **The entry points register the defaults where no host has.** They are `cli.build_parser()`, `cli.main()`, `serve.build_server()` and `serve.main()`. `register_defaults()` reads nothing.
- **A host's registration replaces a default until a consumer has read it**, and is refused (`SeamAlreadyRegistered`) after that. A host over a host is refused. The same object again is a no-op. `unregister()` makes a swap explicit.
- **Each registration is probed for its names when it is made.** A missing or non-callable name is a `TypeError` naming what is missing. A lookup that raises is chained as the cause (T027's rule).
- **A consumer resolves the seam at each use.** `serve.py` and `serve_workbench.py` bind `registry_mod = projection_seams.registry.proxy`, which resolves on every attribute read. No proxy is read at import time, and a test walks the AST to hold that.

The defaults are new code, not openXdox's modules moved.
- **`default_registry`** is one in-memory registry keyed `(repository, ref)`, with `ref` defaulting to `main`.
  - It keeps `/source`'s containment rule (`resolve_within`).
  - Its `SnapshotSource` serves the snapshot it was handed, and it regenerates that snapshot.
  - It reads **no data source and no index**, because openDox has no index kind (T053). A declared `--data-source-*` or `--local-index` is **refused**, naming the seam, rather than ignored.
  - `compose_view` composes nothing.
- **`CORPUS_ROOT`** asks, structurally, for a git repository's root: a directory holding `.git`, and a worktree's `.git` file counts. Its `SCANNED_ROOTS` is empty, and `change_rows` answers no row.
- **`WRITER`** writes canonical JSON (sorted keys, indent 2, ASCII, a trailing newline) through the interactivity boundary.
- **`VALIDATOR`** is a stand-in until T057 is in this tree. It answers `validator-unavailable`, naming T057, and never answers `validated`.

### The verbs go through the seams (4.3, in part)

- **Generation.** `cli._generate_and_write` and `cli._gate_snapshot` call `generator_seam.generate(...)`, which looks the generator up on each call.
  - Both write through the registered writer.
  - An unset `--project-register` or `--possibles` is not passed.
  - A set one that the registered generator does not declare is refused (`generate refused: …`) before anything is written.
- **The validator is chosen by the written snapshot's `kind`** (`cli._validate_by_kind`). `_locate_validator` is gone.
  - The three outcomes keep their meaning, and so do `--strict` and `--no-validate`.
  - A kind with no validator is *unavailable*. It is never given another kind's validator.
  - A snapshot that declares no kind fails.
  - The remedy line prints only when the validator declares a `dependency_remedy`.
- **The workbench manifest.** `workbench.validate_manifest` asks the lookup for `ideation-workbench`, and no longer calls `consumer_reach.find_validator`. An explicit validator script still runs as before.
- **The regenerate.** The default source's regenerate (`SnapshotSource.refresh`) generates through the seam and writes through the registered writer. It keeps `main` active and never promotes a session ref (FR-014a).
- **`branch_session`.**
  - `session_entry`, `register_session_entry`, `refresh_session_snapshot` and `refresh_main_view` use the registered registry's types.
  - `_change_rows` (the brief's `:1568`) asks the corpus-root seam's `change_rows`, because the generator seam does not carry it.
- **The RFC 3339 check.** `is_rfc3339_datetime` is openDox's own (`src/opendox/rfc3339.py`). It implements the neutral contract's `generated-at-is-rfc3339` rule, which no seam carries, and it agrees with openXdox's check over 20 vectors.
- **The core `/snapshot.json` arm is `serve.py`'s own.**
  - `_query_key`, `_read_snapshot`, `_serve_snapshot` and `_hosted_entry_refused` are now defined on `DashboardHandler`.
  - `hosted_ref_refused` is a function in `serve.py`, over the registry seam's `is_publishable_ref`.
  - While they were forwarded to openXdox, a standalone server refused every `/snapshot.json`, and `_divergence_headers` asks `hosted_ref_refused` on every response.
  - `_checkout_real` and `_refuse_impossible_checkout_root` ask the registered predicate.
- **`_report`** prints `repository=… kind=opendox-snapshot` for the neutral kind, which carries no project. Every other kind's line is unchanged.
- **The empty-projection warning** reads the registered predicate's `SCANNED_ROOTS`. With none, as openDox's own predicate has, it says "it was accepted as a corpus checkout, but nothing in it was read as a document". The governed wording is unchanged.
- **The `_default_home_factory` docstrings** in `cli.py` and `serve.py` now say that the adapter's default `required_fields` is `NEUTRAL_FIELDS` (`title` and `summary`, since T054), as #57 asked. The two copies stay identical apart from each naming the other.
- **`serve.main()` registers the defaults before building its parser**, because its option defaults read the registry.
  - So `--help` now runs in a lone checkout, which research R7 found it could not.
  - `--data-source-path`'s help reads `(default: the source root)`.
  - A seam's refusal prints `serve refused: …` and exits 1.

### Retired from `consumer_reach`

- **The stand-ins.** `snapshot_registry`, `snapshot`, `corpus_root`, `generator`, `find_validator`, `corpus_root_refusal`, `generate_snapshot`, `is_rfc3339_datetime`, `hosted_ref_refused` and `scanned_roots` are gone.
- **The helpers.** The `function` and `constant` stand-in helpers are gone too, since nothing binds through them any more.
- **The projection column.** `LateProjectionRoutes` now forwards ONE method, `_serve_index`, for the column's own `/snapshot-index.json` binding. That binding is T084's.

## The falsifier

From T055's entry in tasks.md:

> **Falsifier**: F4.1's scan, down by these reaches.

The scan is `scan_deferred_reaches.py` from research.md's appendix (sha256 `fe116203…`, as in the remeasure table), run over `src/opendox`. At `e8a733d`, the branch before T055's commit:

```text
src/opendox/branch_session.py:1568: openxdox  [in _change_rows]
src/opendox/branch_session.py:1587: openxdox.register  [in _active_pick_fallbacks]
src/opendox/branch_session.py:2005: openxdox  [in proposal_state_for]
src/opendox/branch_session.py:2105: openxdox.snapshot_registry  [in session_entry]
src/opendox/branch_session.py:2151: openxdox.snapshot_registry  [in register_session_entry]
src/opendox/branch_session.py:2228: openxdox.snapshot_registry  [in refresh_session_snapshot]
src/opendox/branch_session.py:3573: openxdox.snapshot_registry  [in refresh_main_view]
src/opendox/cli.py:632: openxdox.snapshot_registry  [in _session_registry]
src/opendox/serve.py:652: openxdox.corpus_root  [in _checkout_real]
src/opendox/serve.py:2125: openxdox.corpus_root  [in _refuse_impossible_checkout_root]
src/opendox/serve_project.py:246: openxdox.gate_console  [in _serve_project_register]
src/opendox/serve_project.py:247: openxdox.kickoff  [in _serve_project_register]
src/opendox/serve_workbench.py:347: openxdox  [in _is_live_session_ref]
src/opendox/serve_workbench.py:407: openxdox  [in _thread_gate]
src/opendox/serve_workbench.py:408: openxdox  [in _thread_gate]
src/opendox/serve_workbench.py:544: openxdox  [in _handle_workbench_thread]
src/opendox/serve_workbench.py:1215: openxdox  [in _handle_workbench_model_approval]
src/opendox/serve_workbench.py:1665: openxdox  [in _handle_workbench_chat_turn]
src/opendox/serve_workbench.py:2607: openxdox  [in _handle_workbench_document_abstract]
19 deferred reaches
```

At `c27eac35`:

```text
src/opendox/branch_session.py:1592: openxdox.register  [in _active_pick_fallbacks]
src/opendox/branch_session.py:2010: openxdox  [in proposal_state_for]
src/opendox/serve_project.py:246: openxdox.gate_console  [in _serve_project_register]
src/opendox/serve_project.py:247: openxdox.kickoff  [in _serve_project_register]
src/opendox/serve_workbench.py:351: openxdox  [in _is_live_session_ref]
src/opendox/serve_workbench.py:411: openxdox  [in _thread_gate]
src/opendox/serve_workbench.py:412: openxdox  [in _thread_gate]
src/opendox/serve_workbench.py:548: openxdox  [in _handle_workbench_thread]
src/opendox/serve_workbench.py:1219: openxdox  [in _handle_workbench_model_approval]
src/opendox/serve_workbench.py:1669: openxdox  [in _handle_workbench_chat_turn]
src/opendox/serve_workbench.py:2611: openxdox  [in _handle_workbench_document_abstract]
11 deferred reaches
```

- **The eight reaches that are gone** are the ones T055 names:
  - `branch_session`'s `_change_rows`, `session_entry`, `register_session_entry`, `refresh_session_snapshot` and `refresh_main_view`;
  - `cli`'s `_session_registry`;
  - `serve`'s `_checkout_real` and `_refuse_impossible_checkout_root`.
- **The eleven that remain** are all T084's.
- **The census of `consumer_reach` sites** (`census_consumer_reach.py`, sha256 `7f36b848…`) falls from 65 to 29: `gate_console` 27, `LateGateRoutes` 1 and `LateProjectionRoutes` 1. No projection name remains.

**Standalone, end to end:** `tests/test_projection_seams.py::test_generate_and_serve_run_with_no_sibling_importable` runs in a process where `openxdox`, `ideation_dashboard`, `doc_health` and `corpus_adapter_openxfactory` cannot be imported.
- `generate` exits 0 and writes `kind: opendox-snapshot`.
- `serve.build_server` builds.
- The server answers `GET /snapshot.json` 200 (the neutral kind), `/capabilities` 200, `/source/notes-toolshed-inventory.md` 200 and `/source/.git/config` 404.
- No sibling module is loaded.

## The repository's own checks

- **The whole suite, against a `postgres:16` container** (CI's service and DSN shape), on Python 3.12.3 with pytest 8.4.2. The venv was installed with `-c constraints-cpython312-linux.txt -e ".[runtime,test]"`, and `LANG=C.UTF-8`, as the runner sets it.

  | run | passed | skipped |
  |---|---|---|
  | base `e8a733d` (the branch before T055's commit) | 2583 | 11 |
  | head `f4ef63d3` | 2701 | 11 |

  The test-by-test JUnit diff shows **127 added**, all passing:
  - 117 in the new `tests/test_projection_seams.py`;
  - 4 new `NEUTRAL_MODULES` parameters in `test_consumer_reach.py`;
  - 6 in `test_source_core_arm.py`.

  It shows **9 removed**. Each subject is retired or replaced:
  - Four tests exercised `consumer_reach.constant()`, which is retired: `test_a_constant_does_not_forward_attribute_reads`, `test_constructing_a_constant_resolves_nothing`, `test_the_sequence_operations_a_re_exported_constant_meets` and `test_an_unavailable_consumer_refuses_at_the_operation_not_at_the_binding`.
  - `test_a_converted_name_is_never_used_at_import_time[serve.py|serve_workbench.py|workbench.py]`: those modules bind no `consumer_reach` name any more. The import-time property of the proxies they bind instead is held by `test_no_proxy_over_a_seam_is_read_at_import_time`.
  - `test_the_column_keeps_the_rules_the_ruling_did_not_move` asserted that `_serve_snapshot` and `_hosted_entry_refused` stay forwarded, which T055 reverses. It is replaced by `test_the_column_keeps_only_its_own_contributed_route` and `test_the_snapshot_arms_handlers_are_defined_on_this_handler` (four cases).
  - `test_hosted_ref_refused_is_still_reached_through_the_late_seam` is replaced by `test_hosted_ref_refused_asks_the_registered_registrys_rule`.

  **0** outcomes changed.
- **The triple pin** reads: selected 2712 (floor 2476), passed 2701 (floor 2465), skipped 11 (pinned exactly 11). No test ships skipped. CI's own line at `f4ef63d3` reads `triple: selected=2712 passed=2701 skipped=11 failures=0 errors=0`.
- **One environment note.** In a shell with no `LANG`, `test_model_provider_broker.py::test_the_broker_child_inherits_no_credential_shaped_environment` fails. The child Python's PEP 538 locale coercion adds `LC_CTYPE`, which is not in the bridge's allowlist. With `LANG=C.UTF-8` it passes. T055 touches neither the broker nor the bridge, so this predates it.
- **Mutations: 34 of 34 killed.** Twenty-three were run at `c27eac35`:
  - Seams:
    - a host replaces a default after it was read;
    - reading a default does not close its window;
    - `register_defaults` skips the writer;
    - a proxy resolves dunders;
    - a missing kind answers another kind's validator.
  - Validation:
    - the validator is chosen by a fixed kind;
    - the manifest is validated by another kind's validator.
  - Serving:
    - the hosted plane never refuses a session ref;
    - an active session entry is served hosted;
    - the checkout is never real.
  - Containment: files below a dot-directory are served.
  - Regenerate:
    - it promotes a session ref;
    - it bypasses the registered writer.
  - Registry:
    - the neutral source ignores a declared data source;
    - the session entry type is not the registered registry's;
    - the CLI's session registry is not the registered registry's.
  - Routed sites:
    - `_report` prints the governed line for the neutral kind;
    - `_change_rows` ignores the registered predicate;
    - the predicate accepts a directory with no `.git`;
    - `generate` skips the corpus-root guard;
    - the gate snapshot bypasses the seam.
  - RFC 3339:
    - it admits a space for the `T`;
    - it refuses a lower-case `t`.

  One more mutation, admitting second 60, is equivalent, because `datetime` refuses it too.

  Eleven more were run in the review rounds, one or two for each change:
  - a symlink leads to what a name cannot;
  - a declared token variable is dropped;
  - dropping the active entry leaves its key;
  - an explicitly empty URL is dropped for being falsy;
  - an unregistered kind is described as a search;
  - the lookup's refusal is cut before its remedy;
  - the writer writes NaN and Infinity;
  - the snapshot body re-resolves the active entry;
  - the source arm resolves the entry twice;
  - the writer rewrites the snapshot in place;
  - a failed move leaves its temporary sibling.
- **pyflakes over the touched files** finds nothing new: 104 findings at base and 104 at head, all pre-existing re-export F401s.

## T057 and the validator default

- **What T055 asks for.** T055's text makes the lookup's default openDox's own validator (T057).
- **Where T057 is.** When this branch was cut, T057 had no PR. It now has one, #58 (a draft at `ca52182f`, stacked on #57's branch). This PR does **not** merge it, for two reasons:
  - #58 edits `pyproject.toml`, which phase-2 drafts in this lane stay out of;
  - #58 is still in review.
- **What happens meanwhile.** The default for openDox's two kinds is the stand-in, `OwnValidatorNotBuilt`, which names T057.
  - A generate verb warns "validation SKIPPED" and exits 0, or 1 under `--strict`.
  - A manifest saved with `validate=True` is refused as unvalidated. That is what a lone openDox answered before T055 whenever no validator was reachable, except that `validate_manifest` no longer reaches the consumer.
- **The swap is one registration** (see T058 below).
- **The holder's decision (2026-09-28): do NOT merge #58 into #59.** The validator stand-in stays until T058 wires `opendox.validator`. This branch takes #58's code only through `main`, once #58 has landed, and still keeps the stand-in until T058.

## Beyond the task's list: `hosted_ref_refused`

- **Where the plan put it.** T084's list names `hosted_ref_refused` (2 sites).
- **Why T055 routes it.** The core `/snapshot.json` handlers that T055 makes `serve.py`'s own call it, and so does `_divergence_headers`, on every response. Without it, a standalone server could not answer `/snapshot.json` or `/capabilities`.
- **So T084's list is one name shorter.**

## Files (T055's own commits)

- **New:**
  - `src/opendox/projection_seams.py`
  - `src/opendox/default_registry.py`
  - `src/opendox/default_projection.py`
  - `src/opendox/rfc3339.py`
  - `tests/test_projection_seams.py`
- **Changed:**
  - Source: `src/opendox/cli.py`, `serve.py`, `serve_workbench.py`, `workbench.py` and `branch_session.py`.
  - `consumer_reach.py`.
  - Docstrings only: `serve_wire.py`, `generator_seam.py`, `default_generator.py` and `cli_project.py`.
  - Tests: `test_consumer_reach.py`, `test_source_core_arm.py`, `test_route_handler_contribution.py`, `test_doxbench_entrypoint.py`, `test_generator_seam.py`, `test_profile_registration.py`, `test_authoring_seam.py`, `test_reach_sweep.py` and `test_neutral_projection.py`.
- **Not touched:** `conftest.py`, `pyproject.toml`, `.github/workflows/validate.yml`, `README.md`, and every pin. The new modules are created files, with no carve-manifest row (RULED OQ-C).

## What the later tasks need

- **T056** (the standalone generate path, end to end). I probed this at `c27eac35`, with the four siblings blocked by a meta-path blocker, over a copy of T050's fixture. In that copy, `candidate-toolshed-rebuild.md`'s `stage:` is `brainstorming`.
  - `python -m opendox.cli generate` exits 0 and writes the neutral snapshot. It prints `notice: candidate-toolshed-rebuild.md: its stage: value 'brainstorming' is not one of the six station role keys (source, grouping, candidate, selection, submission, completion), so it is not a declaration; the document is read as a source`. The snapshot reads that document as `stage: source`. So the verb's half of F5.3's `stage:` case needs no further plumbing.
  - `generate-and-open --no-open --no-serve` exits 0, builds the server and prints its URL.
  - What remains is T056's own:
    - a test that the server STARTS and answers, run as `generate-and-open` without `--no-serve` (or `serve.main`) in a subprocess with the siblings blocked, polling the printed URL and then stopping the server;
    - F10.1's plain-install run, which is T070's.
- **T058** (the post-render validator in the generate verbs).
  - Replace `default_projection.VALIDATOR` with an adapter over #58's `opendox.validator` that keeps T055's protocol: `validate(path, *, strict=False, search_from=())` answers a `projection_seams.ValidationResult`.
  - How the adapter should work:
    - It reads the file: JSON for `opendox-snapshot`, and YAML for the `ideation-workbench` manifest, which `workbench.py` already parses with PyYAML.
    - It calls `validator_for(kind)`, or `validate(instance, kind=…)`.
  - How its answers should map:
    - No violation is ok, with return code 0.
    - Violations are `not-conformant`, with return code 1 and `report(violations)` on stdout, so each rule id is named. F7.2 needs `EXPECTED_RULE`.
    - `ValidatorUnavailable` and `SchemaNotEvaluable` are `validator-unavailable`, with the reason.
    - `dependency_remedy = None`. No subprocess runs, so F7.2's "no `No such file or directory`" holds by construction.
  - `OWN_KINDS` stays `(opendox-snapshot, ideation-workbench)` unless T058 widens it to #58's `KINDS`. The doxBench wire kinds keep their own path (`serve_wire.register_doxbench_validators`).
  - The stand-in's cases in `tests/test_projection_seams.py` change with it:
    - `test_the_validator_stand_in_concludes_nothing_and_names_T057`;
    - `test_openDoxs_own_kind_meets_the_stand_in_and_strict_makes_it_fatal`;
    - the stand-in half of `test_a_manifest_is_validated_by_the_validator_for_its_kind`.
  - `--strict` and `--no-validate` already mean what T058 says.
- **T059** (openXdox registers its governed mechanisms). It registers everything below at process start, before any entry point reads a default, because a default is sealed once read.
  - `openxdox.snapshot_registry` at `projection_seams.registry`. The module already carries every required name.
  - An adapter at `corpus_root`. It takes `openxdox.corpus_root`'s `corpus_scan_defect`, `corpus_root_refusal` and `SCANNED_ROOTS`, plus a `change_rows` built from `generator.iter_changes` and `declared_origin_state`, which is what `branch_session._change_rows` computed before T055.
  - `openxdox.snapshot` at `writer`.
  - A validator adapter for each governed kind, such as `ideation-dashboard-snapshot`. Its `dependency_remedy` is `snapshot.DEPENDENCY_REMEDY`, and it names `VALIDATOR_RELPATH` in `unavailable_reason`.
  - It lowers `OPENDOX_BACK_IMPORTS` in `tests/test_dependency_direction.py`. `cli.py` and `serve.py` leave the table, and `branch_session.py` goes from `(0, 7)` to `(0, 2)`. `serve_project.py` stays at `(0, 2)` and `serve_workbench.py` at `(0, 7)`.
  - `tests/test_generated_at_anchor.py:223` patches `cli_mod._locate_validator`, which T055 removed. The seam to patch now is `_validate_by_kind`, or a validator registered for the kind.
  - Four gaps that the review rounds closed in openDox's own defaults are still open in the governed mechanisms T059 registers. They are openXdox-code's to close, ideally before T059 registers them:
    - `snapshot_registry.resolve_within` checks the hidden-name rule only against the URL's spelling, so `link -> .git` serves `/source/link/config`, which is `.git/config` (r4125556296).
    - `SnapshotRegistry.drop` leaves the active key pointing at a dropped entry.
    - `snapshot.write_snapshot` writes in place through `write_output`, so a request can read a truncated snapshot (r4126138808). Its `canonical_json` also writes NaN and Infinity (r4125900060).
    - `SnapshotRegistry` reads `active`, `get`, `entries()`, `keys()` and `len()` without its lock, so a reader can answer from the middle of a block `atomically()` holds (r4136863481).
- **T084**: its list no longer includes `hosted_ref_refused`. The eleven reaches the scan still finds are all T084's.

## For the holder

All three earlier items are now decided:
- **The validator default**: #58 is not merged here (above).
- **T054's `NEUTRAL_FIELDS` default missed openDox's own scaffold** (r4126022820): #57's commit `8e7da4a` takes it, and this branch now carries that commit. openDox's own scaffold leads with `title:`/`summary:` where the registered corpus obliges them, and keeps the governed layout where it obliges neither.
- **Empty generator inputs**: the holder ruled that an empty `--project-register`/`--possibles` is REFUSED, fail closed. It is neither dropped nor read as `Path("")`. Taken in `d7aa9d8c`:
  - `cli.SourceOptionRefused`, raised by one helper, `_source_option()`, which both call sites use: `_generate_and_write` for `generate` and `generate-and-open`, and `_gate_snapshot` for the gate verbs. It answers `None` for an option not given, refuses an empty one, and resolves anything else.
  - The guard runs beside the other two, before any generation or write. In `generate-and-open` it runs early too, so a refused run mints no run directory. `main()` prints `<verb> refused: …` and exits 1.
  - `serve.main` refuses an empty `--project-register` the same way, before a socket is bound.
  - Seven new cases. Mutations: 8 of 9 killed. The ninth removes the explicit guard in `_generate_and_write`, and it is equivalent: the argument expression refuses before `generate()` is called. The guard is kept beside the other two, so the order does not rest on argument evaluation.

## CI and review rounds

`validate` is green at every head below, and SonarCloud passed its quality gate. Every thread was answered and resolved, and each change carries a case that its mutation fails.

- **`c27eac35`: 3 threads, all taken in `ea49c424`.**
  - r4125556296: symlinks inside the root could lead into a dot-directory. The canonical path now meets the hidden-name rule too.
  - r4125556360: `token_env` was ignored. Every declared data-source option is now refused by name, an empty one included.
  - r4125556420: an extra "by", in three places.
  - The overview's remarks on `display.js` and the plain-documents fixture test are #57's and #53's files. They have no threads here and are flagged, not changed.
- **`ea49c424`: 1 thread, taken in `bfb9c479`.**
  - r4125666251: `serve.main`'s `or` turned an explicitly empty `--data-source-url`/`--data-source-github` into `None`. Each option is now handed over as given, and a slug that cannot be composed is refused.
  - The overview (no thread) found that `drop` left the active key dangling. That is taken in the same commit.
- **`bfb9c479`: no findings.** The overview (no thread) noted that the unavailable-validator warning described a filesystem search even when nothing is registered for the kind. It is taken in `244d7b7f`: the warning now says which of its two cases happened, and gives the lookup's whole refusal, remedy included.
- **`244d7b7f`: 2 threads, taken in `19c26782`.**
  - r4125900060: the writer wrote NaN and Infinity. It now refuses what JSON cannot carry, with `SnapshotNotWritable`, before writing.
  - r4125900164: the snapshot arm's query-less path read the active entry twice, for the refusal and for the body. It now resolves the entry once. This race came from openXdox's handlers unchanged.
- **`19c26782`: 2 threads.**
  - r4126022918: the source arm resolved its entry twice. It now resolves the entry once and asks for the path by that entry's own pair. Taken in `8c09d74c`.
  - r4126022820: T054's `NEUTRAL_FIELDS` default. It is answered with a reproduction, not changed here, and flagged above.
- **`8c09d74c`: 1 thread, taken in `f4ef63d3`.**
  - r4126138808: the writer wrote in place, so a concurrent read could see a truncated snapshot. It now writes a temporary sibling and moves it over the target with one `os.replace`, and the boundary still decides the destination.
- **`f4ef63d3`**: `validate` is green, with `selected=2712 passed=2701 skipped=11 failures=0 errors=0`. Copilot's review run there ended with "Copilot encountered an error and was unable to review this pull request", so it posted no verdict.
- **After T049: `8cbb1ea` merges #57's head, and `d7aa9d8c` takes the holder's decision on empty source options** (above). CI is green at `d7aa9d8c`, with `selected=2723 passed=2712 skipped=11`: #57's 4 scaffold cases and these 7.
- **Copilot at `d7aa9d8c`: 1 thread, taken in `687d37bf`.**
  - r4136439187: a refresh widened a restricted snapshot. `os.replace` carries the sibling's mode over the target, and the sibling had a new file's ordinary mode.
  - Now, where the target exists, its permission bits go onto the sibling (`os.fchmod`) before a byte is written. A new target keeps the ordinary mode.
  - If the bits cannot be copied, the write fails and nothing is widened. The copy runs inside the stream's `with`, so the descriptor cannot leak.
  - Four new cases, all red against `f4ef63d3`'s writer. Local whole suite: `selected=2727 passed=2716 skipped=11`.
- **Copilot at `687d37bf`: "Changes recommended", 2 threads.** CI is green there, with `selected=2727 passed=2716 skipped=11`.
  - r4136585695, taken in `96f18c45`, and taken again without a lock in `e3ef506a` (next round). The source arm asked `resolve_source` for the path by the entry's pair, and `resolve_source` looks the pair up again. So a refresh that re-registered the same key between the two lookups could put another root behind the path.
    - `96f18c45` ran both lookups under the registry's own lock, `self.source.registry.atomically()`, the lock `register` and `drop` take.
    - Its case ran the refresh on another thread. It was red against `687d37bf`'s arm, and red with the hold removed.
  - r4136585637, not taken: it does not reproduce. `_register_baked` sets `baked_repository` (line 560) before it asks `_source_root_for` (line 561), and has done since `c27eac35`.
    - Measured with `--repository` omitted: the entry is confined to the served checkout, and `/source/notes-toolshed-inventory.md` answers 200, keyed or not.
    - Two existing tests pin the order, and both are red with the two lines swapped: `test_the_source_registers_the_snapshot_it_was_handed` and `test_generate_and_serve_run_with_no_sibling_importable`.
  - Local whole suite at `96f18c45`: `selected=2729 passed=2718 skipped=11`, which is +2.
- **Copilot at `96f18c45`: "Changes recommended", 3 threads, all taken in `e3ef506a`.** CI is green there, with `selected=2729 passed=2718 skipped=11`.
  - r4136863569: the seam does not declare `atomically()`, so a registry that passes the seam's probe could fail every `/source` request.
    - The arm now asks nothing of the registry beyond the one resolution. It confines the path to the resolved entry's own root through `resolve_source_path`, its single entry point and the one the no-registry path already used. That applies the declared per-entry rule, `resolve_within`, as `serve_workbench.py` does for the roots it holds.
    - There is no second lookup, so r4136585695's race stays closed with no lock.
    - `tests/test_source_core_arm.py` pins the shape: one `resolve`, the entry's own root through `resolve_source_path`, and no `resolve_source` or `atomically` call in the arm. It fails against `687d37bf`'s arm and `96f18c45`'s.
    - The race case, now `test_a_refresh_that_replaces_the_key_cannot_move_the_source_arms_root[unkeyed|keyed]`, shows the replacement lands before the path is confined, and the body is still the first entry's file. It is red against `687d37bf`'s arm.
  - r4136863481: `get`, `active` and `len()` read without the registry's lock, so a reader could answer from the middle of a block `atomically()` holds.
    - All three now read under the lock, as `entries()` and `keys()` already did.
    - `test_a_read_waits_for_a_held_read_modify_write[active|resolve|get|len]`: a read on another thread starts while a held block has a session promoted, and it must answer as the block left the registry. Each case is red with its own lock removed.
    - openXdox's registry has the same gap, listed for T059 above.
  - r4136863311: a registered generator owes the seam only `kind` and an integer `schema_version`, and `_report` indexed `repository` and `generation`, so such a snapshot raised `KeyError` after it was written.
    - The report now shows a lacking field, or one in another shape, as `<absent>`. `_stats` counts only a list or a mapping. The verb then goes on to the kind's validator.
    - `test_generate_reports_a_snapshot_whatever_else_its_contract_carries`, over a minimal snapshot and one with other shapes. Both are red against `96f18c45`'s report, with `KeyError`.
  - Local whole suite at `e3ef506a`: `selected=2735 passed=2724 skipped=11`, which is +6. F4.1's scan is unchanged, at 12.

## After #57 and #58 landed

- `92a9167` merges #57's final head `d7954fc6`, and `814516b7` merges `main` `a691e4e4` (#57), resolving its two add/add conflicts to ours: main's blob is `d7954fc6`'s in each. `c2a8ad9f` merges `main` `8ec08e91` (#58) with no conflict, and what it brings is exactly #58's squash. The validator stand-in stays until T058.
- **Copilot at `c2a8ad9f`: 1 thread, taken in `183b40fc`.** r4146219833: `_regenerate` passed `project_register_source` even when unset. It is now passed only when set, as the seam omits an unset input. `test_an_injected_generator_is_handed_the_register_only_when_one_is_set`, red against `c2a8ad9f`.
- **Copilot at `183b40fc`: 1 thread, not taken, made explicit in `0c946f4e`.** r4146370161 asked for `main` to be restored after an already-active session is regenerated. FR-014a forbids promoting a session, and an entry that was already active is not promoted by its own refresh. The docstring now says so, and `test_a_regenerate_promotes_no_session_and_moves_no_active_key` pins both halves.
- **Copilot at `0c946f4e`: "Needs a closer look", no findings, 0 threads.** CI is green, with `selected=2989 passed=2978 skipped=11 failures=0 errors=0`.

Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)

🤖 Generated with [Claude Code](https://claude.com/claude-code)


Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
brettheap added a commit that referenced this pull request Oct 3, 2026
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)

Arc: neutral-product-standalone-operability

Plan 034, phase-3 slice **P3-B**, task **T079**. The plan was read at openxFactory `main` `e369cb25`, from `specs/034-opendox-standalone-operation/tasks.md`, and read again at `main` `2140f5a7` and, after T063 landed, at `main` `a883bbf6`: T079's entry is unchanged at both. The slice is claimed on openxFactory#656, comment `5875729625`.

**This was drafted ahead, and T063 has now landed.** Brett's phase-3 word, as the holder recorded it (2026-09-28, ~18:00Z), was *"Only the independent ones (Recommended)"*. T079 is `After: T078`, and every phase-3 task comes after T063. T063 landed as openxFactory#1218 → `a883bbf6`, which closes phase 2, and T078 landed as #61 → `8a98e317`. So this PR may go READY. Its READY line is the holder's to post.

**One PR per task, stacked.** T078 (#61) has landed, and the holder retargeted this PR to `main`. T080 is based on this one (#63 (`build/034-p3b-t080-raw-key-refusal`)). Land this, then T080. Retarget #63 to `main` before this branch is deleted, because a merge with `--delete-branch` closes the PR stacked on it.

## What changes

- The binding record gains **`model`**: the model name the provider receives as the request's `model`, in either dialect. It sits after `dialect`, with the route it belongs to, so `BINDING_FIELDS` grows from nine fields to ten. Still no field can hold a secret.
- `model-binding add|edit --model` sets it, and `model-binding list` shows it.
- The catalog handle stays the binding's `id`, so a chosen menu entry still resolves back to its binding. `model` is not an argv placeholder, and `ARGV_PLACEHOLDERS` is unchanged.

Files: `src/opendox/doxbench_binding.py`, `src/opendox/doxbench_provider.py`, `src/opendox/cli_model_binding.py` and `tests/test_model_provider_broker.py`, all inside P3-B's row. One docstring outside the row, `src/opendox/doxbench_intake.py`'s, is corrected and flagged below.

**Realizes**: 16.2. **Ruled**: R1Q22 (a), `5817152735`.

## One choice the plan's text leaves open, which Brett let stand

Brett's word, relayed by the holder on 2026-09-28: `model` stays optional.

**`model` is keyword-only, and it defaults to None, meaning "none declared".** A binding that declares none keeps the meaning it had: the request names the catalog handle, the binding's `id`. Tests pin it: the prompt grammar's request bytes (T078's test, unchanged here), and the handle as the model in both grammars. A stored record may leave `model` out (`OPTIONAL_BINDING_FIELDS`), and every other field stays required. Three things decided it:

1. `serve_workbench.py`'s console intake route builds a `ModelProviderBinding` by keyword, with no model. A required field would break it, and that file belongs to T055 (openDox-code#59, since landed) and T084, not to P3-B. It keeps working unedited. Every existing test in this file builds its binding the same way, by keyword with no model, and all of them pass.
2. Every stored nine-field document still reads, and a test holds it.
3. openXdox-code's `tests/test_doxchat_model_intake.py:1234` builds a nine-field binding by keyword. It keeps working at T086's pin.

A **required** model would have had to move `serve_workbench.py`'s intake route, and a field in its view, in the same act. That would have needed a plan note, not a quiet widening of this slice.

**A consequence, flagged for the owner of `serve_workbench.py`**: the console's intake flow cannot set a model yet, because its closed `INTAKE_QUERY_FIELDS` has no `model`. So an `openai-chat-v1` binding enrolled through the console names its id as the model until that flow learns the field. `model-binding add --model` is the door that sets it today.

## The falsifier: F16.1's `BINDING_FIELDS` assertion

This is F16.1's record block, verbatim from #1144 (the same extract as T078's PR, sha256 `8af3001b5f5fb885…`, unchanged at openxFactory `main` `2140f5a7`):

```python
assert "openai-chat-v1" in b.DIALECTS, f"no OpenAI-compatible dialect: {b.DIALECTS}"
assert "model" in b.BINDING_FIELDS, f"the record names no model: {b.BINDING_FIELDS}"
rec = {f: "stand-in" for f in b.BINDING_FIELDS}
...
b.ModelProviderBinding.from_record(rec)               # the control: a clean record is accepted
```

At T078's head `d07b9371` it stops at the `BINDING_FIELDS` assertion (`the record names no model: (… 'dialect', 'broker_argv')`). At this head `e7f3a7b3` both assertions pass, and so does the control record (ten fields, `model: "stand-in"`). The block then stops at its first keyed URL, which is T080's to refuse:

```
FAIL: a raw key was accepted in ['endpoint']
```

The named test `test_f16_1_the_record_names_a_model` asserts it as #1144 writes it, and pins the ten-field order.

## The repository's own suite

Local runs of the whole suite, as CI runs it (`python -m pytest -q`), use a PostgreSQL 16 service for `tests_runtime` and `LANG=C.UTF-8`, as on the runner:

| tree | passed | skipped | failed |
|---|---|---|---|
| `main` `8a98e317` (T078 landed) | 3138 | 11 | 0 |
| this head `e7f3a7b3` | 3156 | 11 | 0 |

`main` `8a98e317`'s row was run on a trial merge of T078's head `d07b9371` into `main` `7ff434d9`, and that merge's tree is `8a98e317`'s, byte for byte. Before this round, `main` `047bb4fa`, T078's `d07b9371` and this branch's `b04a3a95` read 3044, 3065 and 3083. Before phase 2 landed, the same three read 2468 (`2d116415`), 2489 (`6e1b8942`) and 2507 (`053e207a`).

CI's `validate` at this head (run `37081644588`) reads `selected=3224 passed=3213 skipped=11 failures=0 errors=0`, against the pins 2476, 2465 and exactly 11. That run checked out GitHub's merge of this head into `main` `66ff7257`. T070 (#67) landed there after this round's merge, so the run counts T070's cases too. At the merge `cb059d5d` (run `37080549094`) it read `selected=3167 passed=3156 skipped=11 failures=0 errors=0`.

- The +18 cases are in `tests/test_model_provider_broker.py`. Skipped stays at the pinned 11.
- `tests/test_provider_boundary.py`: 24 passed.
- `validate.yml` is outside this slice, and its floors permit the rise.

## Merging `main` (`cb059d5d`)

`cb059d5d` merges openDox-code `main` `8a98e317`. That is T078's squash (#61), on top of T085 (#71), T088 (#65) and T071 (#60), which landed just before it. This branch carried T078's own commits, so the three files T078 changed met its squash on `main`:

- `main`'s copy of each equals T078's head `d07b9371`.
- Two of them, `src/opendox/doxbench_provider.py` and `tests/test_model_provider_broker.py`, conflicted only where this branch changes T078's lines. Each is resolved to this branch's side.
- So the merge adds exactly what `main` gained beyond T078. `git diff b04a3a9 cb059d5` is `git diff d07b937 8a98e31`: 17 files, none of them this PR's.

The suite above is this merge's, with `e7f3a7b3`'s docstring fix on top. Since then, `main` has moved to `66ff7257` (T070, #67). This head merges into it cleanly, and CI's run above is that merge. Before this round, `b04a3a95` merged T078's head `d07b9371`, which merged `main` `047bb4fa` (phase 2's nine landings), with no conflict.

## Review remarks, answered at `b04a3a95`

- **Copilot's overview** (review `5343385726`, at `7c83c2cd`) noted that *"intake documentation still contradicts the expanded binding contract"*. It did. `doxbench_intake.py`'s module docstring called the binding a *"closed nine-field record"* and its declaration *"not a tenth field on it"*. `053e207a` names each count by its tuple, records that the binding grew once, by `model`, and reads *"not a field on it"*. It is a docstring only.
  - **Flagged**: `src/opendox/doxbench_intake.py` is outside P3-B's row. No plan-034 task names the file. When it was checked, no open PR touched it: #53, #54 and #56 to #60 then, and #60, #65, #67 and #69 again at `b04a3a95`, and phase 2's landings did not touch it either. At `cb059d5d`, `main`'s later landings do not touch it, and two open PRs do: #63, stacked on this one, and T082's #76, which adds 14 lines to it. A trial merge of this head with #76's head `dcdb7554` is clean. If the holder wants that edit made elsewhere, reverting its two commits, `053e207a` and `e7f3a7b3`, changes no behaviour.
- **SonarCloud** reported no findings on this PR.
- **Copilot's re-review run at `053e207a`** (Actions run `36473415338`) finished without posting a review, and its log records no stored comment.
- `a63dcb8b` merges T078's SonarCloud test fix into this branch, so the stack stays one line.
- **Copilot at `b04a3a95`**, the merge of `main`: two reviews, both *Needs a closer look* with `Findings: None` and no thread.
  - The first came with the push (review `5396324583`).
  - The second was asked for through the reviewer API (review `5396377423`).
  - Both summaries ask for a final human review of a change across persistence, provider behaviour and the CLI. The second also names the stacked dependencies, which are the draft flag at the top.
- **SonarCloud at `b04a3a95`**: 0 issues, quality gate OK.
- **Copilot at `cb059d5d`**, the merge of `main` `8a98e317` (review `5398043432`, asked for through the reviewer API): *Needs a closer look*, one low-severity finding. The docstring's *"the catalog's grew"* and *"the binding's grew"* read as possessives used as verbs. Each stood for the shape it named, and the review shows that a reader can miss that, so `e7f3a7b3` names the noun: *"the catalog entry's shape"* and *"the binding's record"*. It is a docstring only. The thread is answered (`4170880327`) and resolved.
- **Copilot at `e7f3a7b3`** (review `5398096928`, asked for through the reviewer API): *Needs a closer look*, `Findings: None`, and no thread. Its summary names the change's reach across persistence, provider behaviour, the CLI and the stacked dependencies.
- **SonarCloud at `e7f3a7b3`**: 0 issues, quality gate OK.

## For the holder

- **Downstream, not edited here**: openxFactory's `cli-help-tree.golden.txt` gains `[--model MODEL]` in the `model-binding add|edit` usage at T094's pin.

🤖 Generated with [Claude Code](https://claude.com/claude-code)


Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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