Skip to content

T055, serve and generate standalone (5.5, 4.3 part) (plan 034) - #59

Merged
brettheap merged 51 commits into
mainfrom
build/034-p2r-t055-serve-and-generate-standalone
Sep 30, 2026
Merged

brettheap merged 51 commits into
mainfrom
build/034-p2r-t055-serve-and-generate-standalone

Conversation

@brettheap

@brettheap brettheap commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

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:

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

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 T054, openDox's small neutral projection (5.1-5.3) (plan 034) #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:

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:

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

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 T057, openDox's own validator and its input set (7.1, 7.1a, 7.1b, 7.2) (plan 034) #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 T057, openDox's own validator and its input set (7.1, 7.1a, 7.1b, 7.2) (plan 034) #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: T057, openDox's own validator and its input set (7.1, 7.1a, 7.1b, 7.2) (plan 034) #58 is not merged here (above).
  • T054's NEUTRAL_FIELDS default missed openDox's own scaffold (r4126022820): T054, openDox's small neutral projection (5.1-5.3) (plan 034) #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.
  • 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 T054, openDox's small neutral projection (5.1-5.3) (plan 034) #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: T054, openDox's small neutral projection (5.1-5.3) (plan 034) #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

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

🤖 Generated with Claude Code

brettheap and others added 19 commits September 27, 2026 16:06
…an 034)

tests/fixtures/plain-documents/ carries eight .md documents: three sources
(no `stage:` header, two sharing the phrase "rain barrel" so a future
topic-based grouping pass has a pair to find) and one document each
declaring `stage: grouping`, `stage: candidate`, `stage: selection`,
`stage: submission` and `stage: completion` (RULED R1Q13 (a) with (c),
openxFactory#656 comment 5850003126). Every document carries the small
neutral field set the default adapter will require regardless of station
(`title`, `summary`).

tests/test_plain_documents_fixture.py is the vocabulary test T050 names as
its falsifier: it asserts the fixture carries none of the eight controlled
`Status:` words or the change/spec/delta nouns, that it covers all six
stations with exactly one document per explicit station, and that at
least two (but not all) sources share the topic fixture code will need to
group on.

Not yet wired into .github/workflows/validate.yml's explicit pytest list:
phase2-ahead scope keeps this PR out of that file, the pin files and
conftest.py/pyproject.toml/README.md, which the phase-1 chain still edits.
This suite runs by node id today.

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

tests/fixtures/malformed/ carries two .md documents: notes-bee-boxes.md is
an ordinary valid source (non-empty title and summary), and
notes-empty-title.md declares `title:` with nothing after the colon --
present in the header, but an empty string once parsed -- while its
`summary:` stays ordinary. That is exactly one violation of the neutral
snapshot schema T053 adds (opensoft/openDox-spec#16 at cd49eb25):
`documents[].title` and `.summary` are each `type: ["string", "null"],
minLength: 1` (x-rule `title-and-summary-are-text`, "each non-empty text,
or null"). A document that declares no title/summary line at all yields
null, which is valid (openDox-spec's own no-front-matter example); an
empty string is the one value that is neither null nor non-empty text.
Holder decision: T054 copies title/summary verbatim, without coercing an
empty declared value to null or excluding the document, so the violation
survives unchanged into the generated snapshot.

tests/fixtures/malformed/EXPECTED_RULE holds the violated rule's
identifier verbatim, `title-and-summary-are-text`, for the future
`opendox generate --strict` to name (spec.md AT-R1 scenario 2).

T051 carries no falsifier of its own (tasks.md: "used by F7.2"); this PR
adds only the fixture and the sentinel file.

Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
T054's branch stacks on T052's (openDox-code#54, build/034-p2g-t052-generator-seam
at 4ca45d2), which was cut from main 80acead. main has since landed T036 (the
required check runs the whole suite) and T037 (the margin), so this takes main
at 2d11641, and the PR is measured against the whole-suite check it will be
judged by. 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>
…9560ee) into T054's branch

T054's falsifier runs the neutral projection over T050's
tests/fixtures/plain-documents, so this branch carries that fixture until
#53 lands on main. The merge adds only #53's files. Once #53 lands, they
drop out of this branch's diff against main.

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

The holder ruled that T054 copies title and summary without coercing or
excluding them, so T051's malformed fixture keeps its one
title-and-summary-are-text violation in the snapshot. T054 proves that
over T051's tests/fixtures/malformed, so this branch carries that fixture
until #56 lands on main. The merge adds only #56's three files.

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

A checkpoint commit, pushed on the coordinator's usage stop. It is not
the finished task: four node-harness cases in tests/test_display_facet.py
still carry the governed snapshot values in their fixtures and fail
against the new defaults, and T054's own test file is not written yet.

What this commit holds:
- src/opendox/neutral_projection.py (new): the projection. It writes
  T053's opendox-snapshot, places a document by its neutral stage: key
  (reading a value outside the six role keys as a source and reporting
  it), copies title and summary verbatim, and applies the topic rule and
  the group rule its docstring names.
- src/opendox/default_generator.py: generate() projects the home corpus
  instead of refusing. NeutralProjectionNotBuilt is retired, and so is
  its refusal case in tests/test_generator_seam.py.
- src/opendox/display_profile.py and web/views/display.js:
  SNAPSHOT_VALUES' defaults become the neutral snapshot's values.
  display.js keeps its line count, so the web census row is unchanged.
- src/opendox/runtime/local_git_adapter.py: leading_header() is public,
  NEUTRAL_FIELDS is declared, WorkingTreeCorpus defaults required_fields
  to it, and the suffix branch of classify reports missing fields when
  fields are required.

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

This finishes the work 25fe752 checkpointed.

The holder ruled on two of T054's open questions, relayed by the
coordinator:
- An entry the adapter cannot classify (a Makefile, an image) is not a
  document. The projection now leaves it out unread, and nothing mentions
  it.
- The wheel's grouping tile counts a group's edges, and the neutral schema
  is not widened with a tally. views/wheel-model.js now counts
  document_edges where a group carries no tallies.document_links, and
  uses the tally where one exists, as the governed snapshot's groups do.
  The file keeps its 1358 lines, so its census row is unchanged.

tests/test_neutral_projection.py (new) holds T054's falsifier:
- in a fresh process with every sibling blocked, the CLI entry point's
  defaults generate over T050's fixture through the seam, and the result
  validates against T053's schema with no F5.3 word;
- the topic rule groups a copy of AT-R1's repository (b), which has no
  front matter;
- a stage: value outside the six is reported, naming the document, the
  value and the six keys, and is read as a source.
Around them it tests:
- the holder's T051 rule (the malformed fixture breaks only its
  EXPECTED_RULE);
- what a document is, the stations, and the anchors;
- the default adapter's field set through the entry point;
- the neutral display values in Python and in display.js, and the
  wheel's edge count;
- that the projection makes no reach.
The schema is a byte-identical copy of openDox-spec#16's at cd49eb25,
held to its sha256, until T057 ships the packaged one.

tests/test_display_facet.py: four node-harness cases carried the
governed snapshot values in their fixtures. Each now reads the value
openDox ships (SNAPSHOT_VALUES), and the property each one tests is
unchanged. The canvas case's neutral assertion no longer compares
against a value the neutral install can never write. It now asserts
openDox's own word.

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

validate failed at 0f42f67 in one case,
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
the git this was written against (2.43.0) prints
`2026-09-27T12:00:00+00:00`. The projection was right: it records the
stamp exactly as git gives it, and the neutral schema admits both
spellings. The test compared that stamp against the fixture's date as a
string. It now compares the two as instants. The case's first assertion
still holds generated_at to the checkout's own `git show` output, so a
date read from anywhere else is still 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>
…what is true now (plan 034)

Copilot's review of 0f42f67 left three threads.

- r4117298988 (neutral_projection.py): a `topics:` header that listed
  nothing fell back to the derived topics, which contradicted the rule
  the module's own docstring states. The header is now a declaration
  even when it is empty. The document carries no topic, nothing is
  derived for it, and it joins no group. That follows the holder's
  literal-copy principle for title and summary. New case:
  test_an_empty_topics_header_declares_no_topic. With the old rule
  restored, it fails.
- r4117299013 and r4117299033 (tests/test_plain_documents_fixture.py,
  T050's file, merged here from #53): its docstring said T052 and T054
  had not landed. It also said the suite was run by node id outside
  validate's explicit list. T054 makes the first false. The second has
  been false since T036 (#52), when validate began running the whole
  suite. Both paragraphs, and the two phrases beside them ("a future
  topic-based grouping pass", "will require"), now say what is true.
  Only the docstring changes.

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

Copilot's review of c0747e9 raised two points.

- Its overview said digit-adjacent topic names were tokenized wrongly,
  and they were. The docstring defines a word as a run of three or more
  letters, but the tokenizer took letter-and-digit runs and then dropped
  any run holding a digit, so `Q3planning` lost `planning`. Letter runs
  and digit runs are now separate tokens. New case:
  test_a_word_is_a_run_of_letters_even_beside_digits. With the old
  tokenizer restored, it fails.
- r4117331489 asks that a supplied source_revision be passed into the
  CorpusRef. That is not taken, and the answer is on the product's own
  contract:
  - the seam defines source_revision as the source anchor to pin, and
    the CLI's help for --source-revision says "pin the source_revision
    anchor";
  - openXdox's governed generator records a supplied revision and scans
    the tree it is handed;
  - the holder ruled for T054 that content comes from the working tree,
    per Brett's T022 ruling.
  default_generator's docstring now says so in a paragraph of its own.
  Only the docstring changes for it.

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

T055's branch stacks on T054's (openDox-code#57, build/034-p2p-t054-neutral-projection
at 5a6fe63), which stacks on T052's branch at 4ca45d2. T052 has since
moved on to 8d507c5: each registration keeps its own records (bce09c5),
the docstring point T054 edits (97b5b01), and current() reads the
registration once (8d507c5). T055 routes the generate verbs through that
seam, so this takes the seam as it now stands. T052's writer trial-merged
8d507c5 into 5a6fe63 without a conflict.

Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The snapshot registry and source, the corpus-root predicate, the snapshot
writer and the validator lookup each get a declared seam
(src/opendox/projection_seams.py) and an openDox default of their own
(default_registry.py, default_projection.py), per R1Q10 (a). The four entry
points register the defaults where no host has, in R1Q3 (a)'s pattern. With
nothing registered, a seam refuses and names itself and its call (4.2).
A host's registration replaces a default until a consumer has read it, and
is refused after that.

The generate verbs go through the seams. cli.py's _generate_and_write and
_gate_snapshot, and the default source's regenerate, call
generator_seam.generate() and look the generator up on each call. They write
through the registered writer. A snapshot is validated by the validator
registered for its own kind. The core /snapshot.json arm's four handlers
(_query_key, _read_snapshot, _serve_snapshot, _hosted_entry_refused) and
hosted_ref_refused are serve.py's own now, read over the registry seam, so a
lone openDox builds a server and answers /snapshot.json, /capabilities and
/source/. branch_session's _change_rows goes through the corpus-root seam,
and is_rfc3339_datetime is openDox's own (rfc3339.py). The seams do not carry
either of them.

consumer_reach retires snapshot_registry, snapshot, corpus_root, generator,
find_validator, corpus_root_refusal, generate_snapshot, is_rfc3339_datetime,
hosted_ref_refused, scanned_roots, and the function/constant stand-ins.
LateProjectionRoutes now forwards only _serve_index. workbench.validate_manifest
asks the validator lookup for 'ideation-workbench'. The _default_home_factory
docstrings in cli.py and serve.py now name NEUTRAL_FIELDS as the adapter's
default required_fields. _report prints the neutral kind in place of a
project that snapshot does not carry.

The validator lookup's default for openDox's own kinds is a stand-in that
concludes nothing and names T057. openDox-code#58 carries T057's validator;
T058 wires it in.

F4.1's scan falls from 19 deferred reaches to 11, all T084's. The census of
consumer_reach sites falls from 65 to 29. Whole suite: 2684 passed,
11 skipped.

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 28, 2026 18:08

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

Unresolved correctness issues remain in registry/data-source handling, hidden-path containment, and display fallback compatibility.

Review effort: Lite
Findings: 1 High severity · 1 Medium severity · 1 Low severity

Open (3)
What changed in this PR

Adds standalone openDox generation and serving through explicit projection seams and neutral defaults.

Changes:

  • Adds registry, corpus-root, writer, validator, and RFC3339 seams.
  • Routes CLI, server, workbench, and session flows through standalone implementations.
  • Updates display behavior, fixtures, and integration coverage.
File Review summary
tests/​test_source_core_arm.py Minor wording nit identified.
tests/​test_route_handler_contribution.py Reviewed; no final finding.
tests/​test_reach_sweep.py Reviewed; no final finding.
tests/​test_profile_registration.py Reviewed; no final finding.
tests/​test_plain_documents_fixture.py Two test-coverage nits identified.
tests/​test_doxbench_entrypoint.py Reviewed; no final finding.
tests/​test_display_facet.py Reviewed; no final finding.
tests/​test_consumer_reach.py Reviewed; no final finding.
tests/​test_authoring_seam.py Reviewed; no final finding.
tests/​fixtures/​plain-documents/​submission-shed-door-repair.md Reviewed; no final finding.
tests/​fixtures/​plain-documents/​selection-spring-planting-plan.md Reviewed; no final finding.
tests/​fixtures/​plain-documents/​notes-toolshed-inventory.md Reviewed; no final finding.
tests/​fixtures/​plain-documents/​notes-rain-barrel-overflow.md Reviewed; no final finding.
tests/​fixtures/​plain-documents/​notes-rain-barrel-leak.md Reviewed; no final finding.
tests/​fixtures/​plain-documents/​grouping-compost-corner.md Reviewed; no final finding.
tests/​fixtures/​plain-documents/​completion-path-resurfacing.md Reviewed; no final finding.
tests/​fixtures/​plain-documents/​candidate-toolshed-rebuild.md Reviewed; no final finding.
tests/​fixtures/​opendox-snapshot.schema.yaml Reviewed; no final finding.
tests/​fixtures/​malformed/​notes-empty-title.md Reviewed; no final finding.
tests/​fixtures/​malformed/​notes-bee-boxes.md Reviewed; no final finding.
tests/​fixtures/​malformed/​EXPECTED_RULE Reviewed; no final finding.
src/​opendox/​workbench.py Reviewed; no final finding.
src/​opendox/​web/​views/​wheel-model.js Reviewed; no final finding.
src/​opendox/​web/​views/​display.js Display fallback values may break governed cards before the host override lands.
src/​opendox/​serve.py Some explicit data-source options are silently ignored instead of refused.
src/​opendox/​serve_workbench.py Reviewed; no final finding.
src/​opendox/​serve_wire.py Reviewed; no final finding.
src/​opendox/​runtime/​local_git_adapter.py Reviewed; no final finding.
src/​opendox/​rfc3339.py Reviewed; no final finding.
src/​opendox/​neutral_projection.py Reviewed; no final finding.
src/​opendox/​display_profile.py Display fallback values may break governed cards before the host override lands.
src/​opendox/​default_registry.py Critical hidden-path containment issue and three moderate registry/data-source handling issues identified.
src/​opendox/​default_projection.py Reviewed; no final finding.
src/​opendox/​default_generator.py Reviewed; no final finding.
src/​opendox/​consumer_reach.py Reviewed; no final finding.
src/​opendox/​cli.py Reviewed; no final finding.
src/​opendox/​cli_project.py Reviewed; no final finding.
src/​opendox/​branch_session.py Reviewed; no final finding.

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

Comment thread src/opendox/default_registry.py Resolved
Comment thread src/opendox/default_registry.py Resolved
Comment thread tests/test_source_core_arm.py Resolved
… is a declaration

Taken from Copilot's review of c27eac3:

- r4125556296. resolve_within read the dot-directory and dot-file rule
  only from the URL's spelling. A symlink inside the root that led to a
  dot-directory, or to a dot-file with no document extension, got past it:
  link -> .git served /source/link/config, which is .git/config, and a
  symlink named alias.md served .env. The same rule now also runs on the
  canonical path, relative to the root, once symlinks are resolved. A
  symlink to a document is still served. Five cases are added, and
  dropping the new check makes them fail. openXdox's governed
  resolve_within has the same gap, and it is flagged to the holder.
- r4125556360. data_source_from_options ignored token_env, so
  --data-source-token-env on its own was dropped in silence. Any declared
  option is now refused by name, an explicitly empty one included
  (is not None). The CLI's refusal names the flag.
- r4125556420. An extra "by" is gone from the sentence in
  test_source_core_arm.py, and from the same sentence in
  resolve_source_path's docstring and in one assertion message.

Whole suite: 2689 passed, 11 skipped.

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 28, 2026 18:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Five unresolved moderate findings remain in CLI handling, validator diagnostics, registry cleanup, and serving source options.

Review effort: Lite
Findings: 1 Medium severity

Open (1)
Resolved since last review (3)
Previously missed (1)

In code that hasn't changed since last review

Medium severity Clear active key when removing the active registry entry

src/​opendox/​default_registry.py:380

Dropping the active entry leaves _active pointing at its removed key. If a caller then registers another entry without active=True, register() sees a non-None _active and does not select the new entry, so active/ref-less resolution remains None even though the registry contains entries. Clear or reselect the active key when the removed entry is the active one.

Comment thread src/opendox/serve.py Resolved
…g the active entry clears its key

Taken from Copilot's review of ea49c42:

- r4125666251. serve.main computed `url=args.data_source_url or (...)`,
  which turned an explicitly empty --data-source-url into None, and
  `if args.data_source_github` did the same to an empty GitHub slug. So
  the registry never saw either. Each option is now tested against None.
  A GitHub source is composed into the URL only when no URL was given. A
  slug that cannot be composed, such as an empty one, is refused as
  "serve refused: --data-source-github: ..." rather than raising
  ValueError. openDox's own registry then refuses every one by name, and
  new cases cover the empty URL, a GitHub slug and an empty slug.
- The same review's overview (no thread) notes that
  SnapshotRegistry.drop left the active key pointing at a removed entry.
  In that state no later register() became active, and a ref-less
  request met a key with nothing behind it. Dropping the active entry now
  clears the key. A new case covers it, and removing the clear makes it
  fail. openXdox's governed registry drops the same way, and that is
  flagged to the holder.

Whole suite: 2690 passed, 11 skipped.

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 28, 2026 18:34

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

Moderate issues remain in data-source refusal handling and validator identity preservation; the unavailable-validator warning also needs correction.

Review effort: Lite
Findings: None

Resolved since last review (1)
Previously missed (1)

In code that hasn't changed since last review

Low severity Clarify missing-validator warning to reference registry registration

src/​opendox/​cli.py:371

This warning still describes a filesystem search, but _validate_by_kind() selects validators only from the process-wide kind registry; when no validator is registered, neither written.parent nor repo_root can make one reachable. The current text falsely suggests moving the output or checkout could fix the problem, whereas a host must register a validator for this kind.

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

Unresolved critical and moderate issues remain in regeneration, option refusal, refresh consistency, and test fixture isolation.

Review effort: Lite
Findings: 1 High severity

Open (1)

Comment thread src/opendox/default_registry.py Resolved
brettheap added a commit that referenced this pull request Sep 30, 2026
#59 took main 8ec08e9 (T057 landed, #58). T056 is stacked on #59, so it
carries #59's current head.

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 at c2a8ad9 (r4146219833) is right. SnapshotSource._regenerate
always passed project_register_source to the generator, even when no
register was configured. So an injected generator that takes only the
core arguments raised TypeError before a refresh could write. The input
is now passed only when it is set, as the generator seam omits an unset
input. A generator given a register still receives it.

The regression case is test_an_injected_generator_is_handed_the_register_only_when_one_is_set.
It fails against c2a8ad9's registry. The whole suite: selected=2988
passed=2977 skipped=11, which is +1.

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 30, 2026 15:21

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

A critical refresh activation issue and moderate registry and serving consistency issues remain unresolved.

Review effort: Lite
Findings: 1 High severity

Open (1)
Resolved since last review (1)

Comment thread src/opendox/default_registry.py Resolved
brettheap added a commit that referenced this pull request Sep 30, 2026
#66 carries #59's head c2a8ad9, which took main 8ec08e9 (T057 landed,
#58). This branch carried #58's head 753ffa1, whose content the squash
8ec08e9 repeats, so the merge adds nothing of T057's.

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

Copilot at 183b40f (r4146370161) reads _regenerate's docstring as "main
is always active afterwards", and asks for main to be restored after a
session that was already active is regenerated. That is not taken. FR-014a
forbids PROMOTING a session. An entry that was active already, set there
on purpose, is not promoted by its own refresh, and moving the active key
off it would be a change the refresh was never asked for.
branch_session._preserving_active keeps the same key for the same reason.

The docstring now says exactly that, and a case pins both halves:
test_a_regenerate_promotes_no_session_and_moves_no_active_key. A
regenerated session is not promoted while main is active, and an
already-active session stays active. The whole suite: selected=2989
passed=2978 skipped=11, which is +1.

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 30, 2026 15:41
@sonarqubecloud

Copy link
Copy Markdown

brettheap added a commit that referenced this pull request Sep 30, 2026
T056 is stacked on #59, so it carries #59's current head.

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

🔵 Needs a closer look

Four unresolved moderate findings need to be addressed before approval.

Review effort: Lite
Findings: None

Resolved since last review (1)
Previously missed (1)

In code that hasn't changed since last review

Medium severity Avoid unstable second lookup during source path confinement

src/​opendox/​default_registry.py:444

resolve_source() performs a second lookup by (repository, ref) after the caller has already resolved an entry. A concurrent refresh can replace that key between the two operations, so the returned path can be confined under a different entry's source_root than the entry whose metadata/listed paths the caller is using (for example, serve_project._resolved_listed_edit_entry). Expose an entry-based confinement operation or make the caller pass the resolved entry so lookup, validation, and path confinement use one stable entry.

brettheap added a commit that referenced this pull request Sep 30, 2026
#66 now reads the serving line while the server runs (Copilot at #66,
r4146289331), and carries #59's head 183b40f.

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 30, 2026 17:10
@brettheap

Copy link
Copy Markdown
Contributor Author

READY at 0c946f4 — 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, your pull request is larger than the review limit of 150,000 diff characters

@brettheap
brettheap merged commit fa14087 into main Sep 30, 2026
4 checks passed
@brettheap

Copy link
Copy Markdown
Contributor Author

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

LANDED — lane openxfactory-4, 2026-09-30T17:12:50Z, PR #59 → fa14087 (opensoft/openDox-code main; plain gate)

Brett: land the phase 1 PRs when green

brettheap added a commit that referenced this pull request Sep 30, 2026
#59 landed as a squash of 0c946f4, and fa14087's tree equals 0c946f4's
(empty `git diff 0c946f4 fa14087`). This branch had last merged #59 at
183b40f, and #59 moved after that only in default_registry.py and
tests/test_projection_seams.py (`git diff --stat 183b40f 0c946f4`). T056
never touches either file, so the two add/add conflicts take main's side.

Proof that the merge carries exactly T056's delta: the stable patch-id of
`git diff 183b40f 38761c7` equals the patch-id of `git diff origin/main`
against this merge (eee3f01c both times). That delta is four files:
cli.py, serve.py, tests/standalone_child.py and
tests/test_standalone_generate_path.py.

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
…ult_registry.resolve_source) (#70)

## What this is

A small follow-up to T055 (#59, landed as `fa140875`). It takes the one finding Copilot's review of #59 at `0c946f4e` raised as "previously missed", after the last push that could take it.

### The finding, quoted

Copilot review overview on #59 at `0c946f4e` (review `5368674478`), medium, "Avoid unstable second lookup during source path confinement", `src/opendox/default_registry.py:444`:

> `resolve_source()` performs a second lookup by `(repository, ref)` after the caller has already resolved an entry. A concurrent refresh can replace that key between the two operations, so the returned path can be confined under a different entry's `source_root` than the entry whose metadata/listed paths the caller is using (for example, `serve_project._resolved_listed_edit_entry`). Expose an entry-based confinement operation or make the caller pass the resolved entry so lookup, validation, and path confinement use one stable entry.

It is real. #59 already closed the same pattern in `serve.py`'s `/source` arm (Copilot r4136585695 and r4136863569): that arm resolves the entry once and confines to that entry's own root with `resolve_source_path(Path(root), rest)`. `serve_project._resolved_listed_edit_entry` was the one caller left.

## What changed

- `src/opendox/serve_project.py`: `_resolved_listed_edit_entry` resolves the entry ONCE and confines the path to THAT entry's own root through the registry seam's declared `resolve_within` (read as `projection_seams.registry.current()` inside the function). The listed-path check already read the entry in hand, and the editor is launched over `entry.source_root`, so the lookup, the validation and the confinement are now one entry. An entry with no root serves nothing, as before.
- The caller needs no method the seam does not declare. `resolve_source` is on no seam's list (`REGISTRY_CALLABLES`), so a contributed registry is never asked for one. That is why the fix confines the entry in hand rather than adding an entry-based method to openDox's own registry: a host's registry would not carry it.
- `src/opendox/default_registry.py`: `SnapshotRegistry.resolve_source` keeps its behaviour (one lookup, confined to that entry). Its docstring now says it is for a caller that holds only a pair, and why a caller that already holds an entry must not ask again by its pair.
- `tests/test_edit_action_one_entry.py` (new, 8 cases).

No module-level proxy is bound in `serve_project.py`: `tests/test_projection_seams.py::test_no_proxy_over_a_seam_is_read_at_import_time` pins the exact set of modules that bind one (`serve.py`, `serve_workbench.py`), and this PR does not edit that file.

## Every caller of the two-step path

`git grep resolve_source -- src` at `fa140875` finds the definition and exactly one production caller, `serve_project.py:111`. The other registry lookups in `src/` are one resolution each: `serve.py` `_serve_snapshot` and `_serve_source` (already one entry), `serve_workbench.py` (`resolve` then `resolve_within(entry.source_root, ...)`, three sites), and `branch_session.py` (stamping an entry after a register, no confinement). `_keyed_source`'s `registry.get(*parsed)` is a parse-time existence check whose result is a key, and `_serve_source` then resolves that key once.

The new test `test_no_module_asks_a_registry_for_a_path_by_a_pair` holds that set empty, so a future caller has to be argued for.

## Evidence

**Red at main, green after.** The new module against `fa140875`'s sources (`serve_project.py` and `default_registry.py` as on main):

```
FAILED test_the_edit_arm_asks_the_registry_once_and_never_for_a_path_by_a_pair
FAILED test_no_module_asks_a_registry_for_a_path_by_a_pair
FAILED test_a_host_registry_needs_only_what_the_seam_declares
FAILED test_a_refresh_that_replaces_the_key_cannot_take_the_file_the_route_refuses
FAILED test_a_refresh_that_replaces_the_key_cannot_take_the_file_the_route_accepts
5 failed, 3 passed
```

With this PR: `8 passed`. The three that pass at main are the control (a listed file opens with no refresh), confinement kept, and "no root serves nothing", which pin what must NOT change.

The race is tested at the ROUTE, both ways, with a real server, a real `POST /actions/edit` and the console token. A registry whose key is replaced right after the route's first `resolve` (as a refresh on another thread would) lands the replacement between the resolution and the confinement (asserted):

- Entry's root has NO file, the replacement's root has it. At main the route took the file from the replacement's root, read the first entry's listing, and started the editor over the first entry's root: `200` and an editor over a file that is not there. Now: `404 document_unavailable`, no editor.
- Entry's root has the file, the replacement's root has none. At main the route refused a file its own entry holds (`404`). Now: `200`, and the editor is started over that entry's root.

**Mutants of the fix, all killed** (the new module only, `serve_project.py` restored after each):

| mutant | killed by |
|---|---|
| M1 the second lookup again (`registry.resolve_source(repository, ref, path)`, i.e. main) | one-lookup count, the no-module-asks scan, the host registry, both race cases |
| M2 confine by `Path(root) / path`, no containment rule | `test_the_entrys_own_root_still_confines_what_the_route_accepts` |
| M3 the no-root check dropped | host-registry and no-root cases |
| M4 the listed-path check dropped | the confinement case (an unlisted file inside the root) |
| M5 the listing read through a second lookup | the one-lookup count (the race cases cannot see it, as both entries share a snapshot) |

**T056's module against this fix.** Fetched #66's head `38761c76` read-only into a scratch worktree, merged main (`fa140875`; the two add/add conflicts, `default_registry.py` and `tests/test_projection_seams.py`, resolved to main's blobs, as T056's own diff does not touch either), cherry-picked this commit on top, and ran `tests/test_standalone_generate_path.py` (its children run from that worktree's `src` via `PYTHONPATH`):

```
tests/test_standalone_generate_path.py + tests/test_edit_action_one_entry.py: 14 passed
control, this commit reverted: tests/test_standalone_generate_path.py: 6 passed
```

That module's requests are `GET /source/notes-toolshed-inventory.md` (200, byte-equal) and `GET /source/.git/config` (404). They go through `serve.py`'s `/source` arm (`resolve_source_path`), which #59 already moved off `resolve_source`, not through `serve_project`, so this PR leaves them as they were. The module passes identically with and without this commit.

**Whole suite** at `5666505b`, `LANG=C.UTF-8`, run in the foreground with a throwaway `postgres:16` and `OPENDOX_TEST_DATABASE_URL` set as CI sets it:

```
python -m pytest -q tests          2379 passed, 11 skipped
python -m pytest -q tests_runtime   607 passed
total                              2986 passed, 11 skipped, 0 failed
```

#59's CI at `0c946f4e` was `selected=2989 passed=2978 skipped=11`. This PR adds 8 cases: 2997 selected, 2986 passed, 11 skipped.

## Overlap with open PRs

None. `gh pr diff --name-only` on #60 to #69, read against each PR's own merge-base (#66 and #68 carry #59's commits, which lists `default_registry.py` spuriously): their own diffs touch neither `serve_project.py` nor `default_registry.py`. #66's own `serve.py` change is one flushed `print` near line 2216, outside the `/source` arm.

## Review rounds

- **Copilot at `0471f8c7`**: "Approval recommended", no findings, 0 threads. The SonarCloud quality gate failed there on 4.9% duplication on new code (required at most 3%): the new test module carried a copy of `test_projection_seams.py`'s autouse isolation fixture and `git` helper.
- **`5666505b`**: imports both instead of copying them (the `tests/test_doxbench_*.py` precedent), a test-only change. The autouse fixture still applies to all eight cases (eight SETUPs under `--setup-show`), the eight cases pass, and M1 to M5 are still killed.
- **Copilot at `5666505b`**: "Approval recommended", no findings, 0 threads. `validate` and SonarCloud ("Quality Gate passed") green at `5666505b`.

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
…66)

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

Plan 034 **T056** [US2] [oDc], **the standalone generate path, end to end** (#1144's 5.1, in part), from `specs/034-opendox-standalone-operation/tasks.md` at openxFactory `main` `91e4685f`:

> `python -m opendox.cli generate` and `generate-and-open --no-open` run on the fixture with neither sibling importable, and the server STARTS (the limit measured in research R7 is lifted).
> - **Falsifier**: F5.3; F10.1's `generate-and-open` run through `python -m opendox.cli`, with a plain install and no `--local`, which arrives in phase 3 (T070); and the verb's half of spec.md's `stage:` edge case. `python -m opendox.cli generate`, over a copy of T050's fixture in which one document declares a `stage:` value outside the six role keys, reports it, naming the document, the value and the six keys, and the snapshot it writes reads that document as a source. T054 tests the projection's half in process. F10.1 as batch H amends it is T077's.
> - **Ruled**: R1Q22 (a), `5817152735`.
> - **After**: T055.

Claimed on openxFactory#656 in comment `5901343950`.

## Was stacked on #59 (T055), and is now on `main`

- The PR was cut at #59's head `e3ef506a`. #59's heads `814516b7`, `c2a8ad9f` and `183b40fc` were merged in at `5a26532e`, `e3574774` and `38761c76`.
- **#59 has landed** as `fa140875`, a squash of `0c946f4e`, whose tree `fa140875` equals. The base is now `main`, and `main` is merged in at `a6e953ce`.
- #59 had moved after `183b40fc` only in `default_registry.py` and `tests/test_projection_seams.py`. T056 touches neither, so the two add/add conflicts took main's side.
- **The merge carries exactly T056's delta.** The stable patch-id of `git diff 183b40f 38761c7` equals the patch-id of `git diff main a6e953c`: `eee3f01c` both times.
- This PR's diff is T056's alone, four files. #57 (`a691e4e4`), #58 (`8ec08e91`) and #59 (`fa140875`) have all landed, so nothing gates it but its own review.
- F10.1's plain-install run is **not** here. It needs the console script with no `--local`, which arrives in phase 3 (T070, and T077 as batch H amends it).

## What T056 found, and the one fix it needed

At #59's head the verbs already run standalone. T055's writer measured the verb's half of F5.3 there, and this PR confirms it. The server also starts. **But on a pipe, it never says where it started.**

- `cli.cmd_generate_and_open` and `serve.serve` print the URL and then block in `serve_forever()`. Neither flushed first.
- When standard output is a pipe or a file, Python buffers it by block. So a wrapper reading the URL never sees it while the server runs. It cannot learn an ephemeral port, or tell that the server started.
- Measured at `e3ef506a`, with the siblings blocked and `--port 0`:

  | entry point | stdout on a pipe, default buffering | with `PYTHONUNBUFFERED=1` |
  |---|---|---|
  | `python -m opendox.cli generate-and-open --no-open` | 0 lines in 20 s | 8 lines, the URL in 0.4 s |
  | `python -m opendox.serve --snapshot … --checkout-root …` | 0 lines in 15 s | the URL in 0.2 s |

- **The fix** is `flush=True` on the URL line and on "serving until interrupted" in `cli.py`, and on `serve.serve`'s announcement in `serve.py`. Each carries a comment saying why.

## The tests: `tests/test_standalone_generate_path.py` (new)

Each case runs a real child process, `python -m …`, the way F5.3 is written. The child is built by `tests/standalone_child.py`, a new helper module that holds no case. T058's F7.2 case uses the same helper.

**How "neither sibling is importable" is made true.** A `sitecustomize` sits on a directory put first on `PYTHONPATH`.
- It installs a meta-path finder that refuses `openxdox`, `ideation_dashboard`, `doc_health` and `corpus_adapter_openxfactory`, whatever is installed. It also drops any of them that a `.pth` file imported before it ran.
- It logs every name it refuses, and **each case asserts that the log is empty**. A refused import that an `except ImportError` swallowed would otherwise pass as a degraded run.

**The child's stdout is a pipe with default buffering.** `PYTHONUNBUFFERED` is taken out of its environment on purpose, because that is what a wrapper sees.

| case | what it holds |
|---|---|
| `test_F5_3_generate_through_the_module_writes_the_neutral_snapshot` | #1144's F5.3: `generate` over a fresh copy of T050's fixture. The snapshot is non-empty and of kind `opendox-snapshot`, and none of F5.3's 14 declared words is in a string value. |
| `test_the_verb_reports_a_stage_outside_the_six_and_reads_it_as_a_source` | `candidate-toolshed-rebuild.md` is edited to `stage: someday`. There is exactly one `notice:`, naming the document and `'someday'`, and carrying the six keys as one rendered list, `(source, grouping, candidate, selection, submission, completion)`. The document's entry is `stage: source`, and no string value in the snapshot contains `someday`. |
| `test_the_unedited_fixture_declares_that_document_a_candidate` | The control: as T050 ships it, the same document is a `candidate` and draws no notice. |
| `test_generate_and_open_starts_a_server_that_answers_with_no_sibling` | `generate-and-open --no-open --port 0`, with no `--no-serve`. The URL is read off the pipe while the child runs. `/index.html` is 200 and HTML. `/snapshot.json` is 200 and equals the written file. `/capabilities` is 200, with the regenerate binding. `/source/notes-toolshed-inventory.md` is 200, byte-equal to the document. `/source/.git/config` is 404. SIGINT exits 0, and the port is closed afterwards. |
| `test_serve_main_starts_a_server_that_answers_with_no_sibling` | The same checks for `python -m opendox.serve`, over a snapshot `generate` wrote. |
| `test_a_child_that_ignores_the_interrupt_is_killed_at_the_deadline` | The harness itself: a child that ignores SIGINT is killed at the deadline, and the timeout is raised, so a server that will not stop is reported rather than waited out. |
| `test_a_child_stops_on_the_interrupt_even_when_the_runner_ignores_it` | The harness itself: a child stops on the interrupt with status 0 **even when the runner ignores SIGINT**, as a suite started with `nohup … &` does. The parent's handler is back afterwards. See the section below. |

## What the merge of `main` exposed: the runner's ignored SIGINT

After merging `main`, I ran the whole suite as `nohup pytest … &`. **Cases 3 and 4 failed** with `TimeoutExpired` at the interrupt. Run in the foreground, the same module passed 6 of 6.

The cause is the runner, not the server:
- POSIX starts an asynchronous command with SIGINT ignored when job control is off. Under `nohup … &`, a probe reads `signal.getsignal(SIGINT) == 1`, which is `SIG_IGN`. In the foreground it reads `default_int_handler`.
- An ignored signal survives `exec`, and Python installs its KeyboardInterrupt handler only where SIGINT was not ignored. So every server the harness started ignored the interrupt, and the two cases reported how the suite had been launched.
- The estate runs long suites exactly this way. Any lane running this module under `nohup` would have read a false red.

**The fix is in the harness, not the product.** A program started with SIGINT ignored should keep it ignored. The child's `sitecustomize` in `tests/standalone_child.py` now sets SIGINT back to `signal.default_int_handler`. That models what the cases claim, a Ctrl-C at a terminal. A child that ignores SIGINT itself, after startup, still does, and case 5 still kills it at the deadline.

**The falsifier** is `test_a_child_stops_on_the_interrupt_even_when_the_runner_ignores_it`. It builds that runner in process: it ignores SIGINT while the child starts, and restores it at once.
- Before the fix it is **red** (`TimeoutExpired` at 10 s), and that is in a foreground run.
- After the fix it is **green**.
- The module under `nohup … &` went from **2 failed, 4 passed** to **7 passed**.
- Mutant M14, the reset removed, is killed by it.

## The falsifiers, failing before and passing after

**F5.3, verbatim from #1144** (a fresh venv, `pip install ".[test]"`, the sibling-absence assertion, `python -m opendox.cli generate`, then the vocabulary scan):

- At openDox-code `main` `fa8862cc`, before T055 routed the verb, it exits **1**:
  `opendox.consumer_reach.ConsumerReachUnavailable: 'openxdox.corpus_root' belongs to openXdox, the layer that PINS this one, …`
- At this head it exits **0**:
  ```
  wrote …/snap.json
    repository=fixture kind=opendox-snapshot
    documents=8 clusters=2 possibles=1 staged_topics=1 changes=2 keywords=28
  documents: 8
  ```

**The verb's half of the `stage:` edge case**, over a copy of the fixture with one document edited to `stage: someday`:
```
notice: candidate-toolshed-rebuild.md: its stage: value 'someday' 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 `['source']`.

**This file**:
- At `main` `fa8862cc`: **5 failed**. Every verb refuses with `ModuleNotFoundError: No module named 'openxdox'`.
- At #59's head `e3ef506a`, without the two flushes: **2 failed, 3 passed**. The two server-start cases fail with `python -m opendox.cli generate-and-open never printed a line matching '^(http://…)/index\.html$' on its (buffered) standard output while it ran: exit status None, standard output ''`, and the same for `opendox.serve`.
- At `38761c76`: **6 passed** (3.4 s). It also passes under `--noconftest`.
- At `149d7295`, and at this head `a7bda066`: **7 passed**, both in the foreground and under `nohup … &` (4.6 s).

**Copilot:**
- At `65c943ff`, approval recommended, with no findings.
- At `1597511d`, one finding, r4139607689: an interrupt the child ignores held the caller while its pipe readers were joined. Fixed in `42a08a3a`: the child is killed before the join. The new case fails without the fix and passes with it. The thread is answered with that evidence and resolved.
- At `5a26532e`, one finding, r4139809410: the `stage:` case rejected only a string EQUAL to `someday`, not one containing it. Fixed in `e939c315`. A mutant that sets the summary to `stage: someday` passes the old check and fails the new one. Answered and resolved.
- At `e3574774`, one finding, r4146289331: "serving until interrupted" was checked only after the interrupt, when Python's exit flush delivers it anyway. Fixed in `caa01ca7`: the case reads the line while the child runs. Mutant M11, that line unflushed, now fails. Answered and resolved.
- At `38761c76`, approval recommended, with no findings.
- At `149d7295`, one finding, r4147767447: the `stage:` case checked each role key as a word anywhere in the notice. But `candidate` is in the document's name and `source` is in "read as a source", so a list that left both out still passed. Mutant M15, that list, SURVIVED the old case. Fixed in `a7bda066`: the whole rendered list is one substring. M15 is now killed. Answered and resolved.
- At this head `a7bda066`, a review is re-requested through the reviewer API.

## Mutation check: 15 of 15 killed, re-run at this head

Each mutant was applied to the source, the named cases were run, and the sources were restored and checked by sha256.

| mutant | killed by |
|---|---|
| M1: `generate-and-open` flushes neither line (the pre-T056 code) | the `generate-and-open` case |
| M2: `serve.serve`'s URL line is not flushed | the `serve` case |
| M3: `/source` serves a hidden path (both hidden-name checks dropped) | both server cases |
| M4: a sibling probe is swallowed on the generate path (`try: import openxdox / except ImportError: pass`) | F5.3, `stage:`, `generate-and-open` (the refused-import log) |
| M5: an out-of-six `stage:` is read as a candidate | `stage:` |
| M6: the notice omits the six keys | `stage:` |
| M7: the verb does not print the notice | `stage:` |
| M8: a governed word (`draft`) leaks into a title | F5.3 |
| M9: no `stage:` value is a declaration | the control |
| M10: `generate-and-open` exits non-zero on an interrupt | `generate-and-open` |
| M11: the serving line is not flushed (the URL line still is) | `generate-and-open`, which reads that line while the child runs |
| M12: the undeclared `stage:` value is carried inside a larger string | `stage:` |
| M13: an ignored interrupt is joined before the child is killed (the harness) | the ignored-interrupt case |
| M14: the child inherits the runner's ignored SIGINT (the `sitecustomize` reset removed) | the runner-ignores-SIGINT case |
| M15: the notice's key list leaves out `candidate` and `source`, which both appear elsewhere in the notice | `stage:` (survived the word-by-word check, which is why that check was replaced) |

Two first spellings were **equivalent**, and each was re-expressed as the real regression:
- Dropping only the URL line's flush is covered by the flush on the next line under `--no-open`.
- Dropping only the first hidden-name check is covered by the second, which still refuses `.git/config`.

## The repository's own checks

The whole suite ran locally as CI runs it: `CI=true`, `LANG=C.UTF-8`, PostgreSQL 16, `-e ".[runtime,test]"` with the constraints file, at the committed head, with a clean tree.

| tree | passed | skipped |
|---|---|---|
| #59's head `e3ef506a` | 2724 | 11 |
| `65c943ff` | 2729 | 11 |
| `1597511d` (the harness moved into `tests/standalone_child.py`) | 2729 | 11 |
| `42a08a3a` (an ignored interrupt is killed before the pipes are joined) | 2730 | 11 |
| `5a26532e` (#59's `814516b7` merged in) | 2753 | 11 |
| `e939c315` (the `stage:` case looks inside every string) | 2753 | 11 |
| `e3574774` (#59's `c2a8ad9f`, with #58's landing, merged in) | 2982 | 11 |
| `38761c76` (the serving line read while running; #59's `183b40fc` merged in) | 2983 | 11 |
| `a6e953ce` (`main` merged in, #59 landed), run under `nohup … &` | 2982, **2 failed** | 11 |
| `149d7295` (the harness resets SIGINT), run under `nohup … &` | 2985 | 11 |
| this head `a7bda066` (the six keys checked as one rendered list), run under `nohup … &` | **2985** | **11** |

At each head, the case-by-case junit diff against the base shows only this file's cases added, **0 removed** and **0 changed** outcomes, and the same 11 skips. Against `38761c76`, this head adds exactly two cases, both passing. One is `test_a_child_stops_on_the_interrupt_even_when_the_runner_ignores_it`. The other is `test_a_regenerate_promotes_no_session_and_moves_no_active_key`, which #59 gained after `183b40fc`. pyflakes finds nothing in the two new files. No floor, workflow, `pyproject.toml`, `conftest.py` or pin is touched.

## Files

- `src/opendox/cli.py`: `flush=True` on the URL line and on "serving until interrupted" in `cmd_generate_and_open`.
- `src/opendox/serve.py`: `flush=True` on `serve.serve`'s announcement.
- `tests/test_standalone_generate_path.py`: new, the seven cases.
- `tests/standalone_child.py`: new, the child-process harness (a helper module, no case). Its `sitecustomize` refuses the siblings and sets SIGINT back to Python's handler.

Both are created files, with no carve-manifest row (RULED OQ-C).

## For the holder

- **The overlap.** With #59 landed, this PR's edits in `cli.py` and `serve.py` are three `print` calls in two functions. It does not touch `default_registry.py` or `serve_project.py`. But cases 3 and 4 GET `/source/notes-toolshed-inventory.md`, expecting 200 and byte-equal, and `/source/.git/config`, expecting 404, and both requests run through `serve_project` and `default_registry.resolve_source`. So the follow-up to #59 on `resolve_source`'s second lookup should run this module.
- **An observation, not changed here.** Standalone, `/capabilities` answers `actions.gate: true`: it is `local_human`, meaning a resolved actor, a real checkout and loopback. I did not check whether any gate route answers without openXdox's contributed verbs.

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
#66 now carries main fa14087 (T055 landed as #59), the harness's SIGINT
reset (149d729) and the whole-list stage-notice check (a7bda06). This
branch last merged #66 at 38761c7, the merge-base, and the merge is clean.
T058's F7.2 case builds its child through tests/standalone_child.py, so it
takes the reset too.

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
…n 034) (#68)

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

Plan 034 **T058** [US2] [oDc], **the post-render validator in the generate verbs** (#1144's 7.2, in part), from `specs/034-opendox-standalone-operation/tasks.md` at openxFactory `main` `91e4685f`:

> It validates the neutral snapshot against T053's schema, read from T057's packaged copy. `--strict` makes a validator that cannot run fatal, and `--no-validate` skips validation.
> - **Realizes**: 7.2 (part).
> - **Falsifier**: F7.2. The good fixture exits 0; the malformed one exits non-zero, naming `EXPECTED_RULE`, with no `No such file or directory`.
> - **Ruled**: R1Q22 (a), `5817152735`; R1Q11 (a), R1Q12 (a), `5850003126`.
> - **After**: T051, T056, T057.

Claimed on openxFactory#656 in comment `5901343950`, with T056.

## Was stacked on #66, and is now on `main`, with its predecessors landed

- **It was stacked on T056's branch** (#66), which was itself stacked on #59 (T055). Each new #66 head was merged in here, the last being `a7bda066` at `923f30d8`.
- **#66 has landed** as `a23e4224`, after #70 (`75bd8703`, the `resolve_source` follow-up to #59). `main` is merged in at `5322efee`. It brought only #70's three files, `default_registry.py`, `serve_project.py` and `tests/test_edit_action_one_entry.py`, and T058 touches none of them.
- **The merge carries exactly T058's delta.** The stable patch-id of `git diff a7bda06 923f30d` equals the patch-id of `git diff main 5322efe`: `f302a8aa` both times. The same id held at `cd6b33cb` against `38761c76`.
- **#58 (T057) was merged in**, at `e94ab323`, `3351f6a7` and `753ffa19`, because T058 wires the `opendox.validator` that #58 ships. **#58 has since landed** as `8ec08e91`, which reaches this branch through #59 and #66 (`03825eb5`, no content change: T057's files here equal `main`'s byte for byte).
  - So this PR's diff is now **T058's own seven files**. Until #58 landed, it also showed #58's delta.
  - **T058's own changes are six commits**: `3d0b6d66` (six files, listed below), and `28241a4b`, `69ca0e2e`, `1ec7d2c9`, `c7768ed5` and `cd6b33cb` (Copilot's findings, below).
  - #58 and #59 fork from #57 at the same commit, `8e7da4a2`, so the merge was clean and brought only #58's own 55 files.
- **Gated on nothing but its own review.** #57 (`a691e4e4`), #58 (`8ec08e91`), #59 (`fa140875`) and #66 (`a23e4224`) have all landed.
- **The base is `main`.** It was retargeted before #66 landed, since a `--delete-branch` landing of #66 would have closed it. The diff against `main` is T058's own seven files again.

## What T058 changes

**`src/opendox/default_projection.py`: openDox's own validator takes the stand-in's place.** The stand-in, `OwnValidatorNotBuilt`, answered every validation "unavailable, T057 is not here".

- **One adapter per own kind.** `OwnValidator(kind)` keeps the lookup's protocol, `validate(path, *, strict, search_from)` → `projection_seams.ValidationResult`.
  - The seam registers one validator per kind and hands it only a path. So the adapter knows its kind from where it is registered.
  - `VALIDATORS` holds one for each of `OWN_KINDS`: `opendox-snapshot` and `ideation-workbench`.
  - `projection_seams.register_defaults()` registers each under its kind (a one-line change).
  - `OWN_KINDS` is not widened. The doxBench wire kinds reach `opendox.validator` through their own seam (T085).
- **It reads the document as its kind is written.**
  - The snapshot is read as JSON, strictly: NaN, the infinities and a key given twice are refused.
  - The manifest is read as YAML with `safe_load`, as `workbench.py` reads it.
  - Then `opendox.validator.validator_for(kind)` judges the document against the packaged copy, which `opendox.contracts` proves against its recorded digest on every call.
- **Three outcomes**, which `cli._validate` already turns into consequences:

  | the adapter meets | outcome | what the verb does |
  |---|---|---|
  | no violation | `validated` | prints `validation: opendox-snapshot: 0 violations, by opendox.validator, over its packaged copy opendox-snapshot (sha256 f9e3e111af1d)`, exit 0 |
  | any violation | `not-conformant`, rc 1; stdout is one `[<rule>] <where>: <detail>` line per violation, then a count | "validation FAILED … This is the SNAPSHOT", relays the lines on **stderr**, exit 1 (with or without `--strict`) |
  | a document that cannot be read as JSON (or YAML) | `not-conformant`, rule `document-syntax` | as above |
  | a readable document holding a number that cannot be read as written (an infinity, a NaN, one binary64 would round, or an unprovable spelling) | `not-conformant`, rule `document-number` | as above |
  | `ValidatorUnavailable` (a copy failing its identity check, or not evaluable), `UnknownKind`, or a document that cannot be read | `validator-unavailable`, with the reason | "validation SKIPPED … could not run: <reason>", exit 0; **exit 1 under `--strict`** |

- **`strict` and `search_from` change nothing** in the adapter. openDox's validator has no warnings to harden, and it searches for nothing, since its schemas are package data. `dependency_remedy` is `None`: no subprocess runs.
  - So F7.2's "no `No such file or directory`" holds by construction.
  - `--strict` still means what the verb's help says, through `cli._validate`.

**The workbench manifest's two validator rules, carried (for the holder).**
- The manifest schema says of two rules that it cannot state them, and leaves them to the validator:
  - every `recipe.pinned` keyword is also in `recipe.checked`;
  - no `recipe.new_candidates` document is already a member or excluded.
- The consumer's script (`validate-ideation-dashboard-contracts.py`, `check_workbench_rules`) checked both. `opendox.validator` checks the schema only, as #58's body says.
- The holder decided (2026-09-28, "To T055: carry two workbench rules") that routing `validate_manifest` to openDox's validator must not drop them. T055 routed it to the stand-in, so they fall due here.
- The adapter carries them for `ideation-workbench`, under the script's identifiers, `workbench-pinned-not-checked` and `workbench-candidate-overlap`. They are judged beside the schema, and are total over any shape.
- If the holder prefers them in `opendox.validator` itself, that is a move within #58's module, and the ids stay.

**The schema copy.**
- `tests/test_neutral_projection.py` reads the neutral contract from the packaged copy, through `opendox.contracts.verified_bytes("opendox-snapshot")`.
- T054's `tests/fixtures/opendox-snapshot.schema.yaml` and its `SCHEMA_SHA256` are removed. The bytes were identical (`f9e3e111…584a` both), so no case's verdict moved.
- The digest case now asserts that the bytes read are the recorded ones, that a strict JSON read equals `contracts.load()`'s YAML read, and that the tree carries one copy.

**The stand-in's cases in `tests/test_projection_seams.py`**, as T055's hand-off listed them:

| before | after |
|---|---|
| `test_the_validator_stand_in_concludes_nothing_and_names_T057` | `test_openDoxs_own_validator_is_bound_to_each_own_kind` |
| `test_openDoxs_own_kind_meets_the_stand_in_and_strict_makes_it_fatal` | `test_openDoxs_own_kind_meets_openDoxs_own_validator` (a bare snapshot is now REJECTED, naming `[envelope-keys]`), and `test_openDoxs_own_validator_unavailable_is_skipped_and_strict_makes_it_fatal` (a copy refused by `opendox.contracts`: skipped, then fatal under `--strict`) |
| the stand-in half of `test_a_manifest_is_validated_by_the_validator_for_its_kind` | a bare manifest is now judged, naming `[required]` |

Two identity asserts also move from `default_projection.VALIDATOR` to `VALIDATORS[kind]`.

**`tests/test_post_render_validator.py` (new, 29 cases):**
- F7.2 through `python -m opendox.cli generate --strict`, with the siblings refused by T056's `tests/standalone_child.py`;
- `generate-and-open --no-open --no-serve --strict` over both fixtures;
- `--no-validate`;
- the three outcomes, including five not-JSON documents, an unreadable path, `ValidatorUnavailable`/`SchemaNotEvaluable`, and a copy tampered below `opendox.contracts`;
- `strict`/`search_from` inert;
- each validator reading as its own kind;
- the two workbench rules, their bounded detail, and `workbench.save(validate=True)` keeping a valid manifest and unwinding a broken one.

## F7.2, failing before and passing after

**#1144's F7.2, verbatim**: a fresh venv, `pip install .` (package data on disk, a non-editable install), both fixtures as fresh repositories, `generate --strict` twice, the rule grep, and the negative grep asserted as exit status 1.

- **Before**, at this branch's base (`3b13f141`: #59 + #66 + #58, with the stand-in), it exits **1** on the good fixture's `--strict` run:
  ```
    validation SKIPPED — this snapshot was NOT checked against the pinned schema
      the validator registered for kind 'opendox-snapshot' reached no verdict. …
      openDox's own validator is plan 034's T057, and this build does not carry it yet, so nothing of openDox's own kinds is checked
      --strict was given and it means what it says: a run that COULD NOT be validated FAILS rather than continuing unchecked
  ```
- **After**, at `cd6b33cb`, and again at `5322efee`, after `main` was merged in, it exits **0**. The malformed run's stderr:
  ```
    validation FAILED — the pinned validator REJECTED …/bad.json. This is the SNAPSHOT, not the environment: the validator ran fine and found the data non-conformant.
      [title-and-summary-are-text] /documents/1/title: '' is shorter than 1
      1 violation(s) of the opendox-snapshot contract, by opendox.validator, over its packaged copy opendox-snapshot (sha256 f9e3e111af1d)
  ```
  `EXPECTED_RULE` is `title-and-summary-are-text`, and no `No such file or directory` appears.

**`tests/test_post_render_validator.py`**: at the base, with the stand-in, **26 failed and 2 passed**. The two that pass hold what T058 does not change: `--no-validate`, and `EXPECTED_RULE` being one of the contract's rules. At `3d0b6d66`, **29 passed**. At this head `1678ccd0`, with Copilot's later rounds, **50 passed**, and also 50 under `--noconftest`.

## Mutation check: 29 of 29 killed, re-run at this head

Each mutant was applied, the named cases were run, and the sources were restored and checked by sha256.

| mutant | killed by |
|---|---|
| M1 violations answer `validated` | 17 cases |
| M2 violations answer `unavailable` | 12 |
| M3 the rule lines are dropped from stdout | 17 |
| M4 `ValidatorUnavailable` read as a pass | 4, including the `--strict` case |
| M5 NaN admitted as JSON | 1 |
| M6 a repeated key admitted | 1 |
| M7 the pinned rule dropped | 4 |
| M8 the overlap rule dropped | 1 |
| M9 the overlap ignores `excluded` | 1 |
| M10 the validator reads the document's `kind`, not its own | 1 |
| M11 the entry points register only the snapshot's validator | 2 |
| M12 the rules compare unhashable entries | 1 |
| M13 an unreadable document reads as valid | 1 |
| M14 `--strict` does not make an unavailable validator fatal (`cli.py`) | 1 |
| M15 `--no-validate` does not skip (`cli.py`) | 4 |
| M16 T054's fixture copy of the schema comes back (a tree mutant) | 1 |
| M17 a rule's detail quotes every name | 1 |
| M18 name membership tested against the list again (quadratic) | the linear-time case, at 17.0 s |
| M19 an `OSError` from the lookup escapes | the unreadable-file case |
| M20 a quoted name is not cut | the long-name case |
| M21 a key given twice picks the last `kind` again (`cli.py`) | the doubled-kind case |
| M22 a non-finite number is read as JSON | the `1e999` and YAML `.inf`/`.nan` cases |
| M23 a rounded number is read as written | the `1.0000000000000001` and `1.5e-400` cases |
| M24 every inexact binary fraction refused (over-strict) | the controls (`0.1`, `2.50`, …) |
| M25 the manifest's floats are read unproved | the four manifest-number cases |
| M26 the JSON read proves no float | the snapshot number cases |
| M27 an unprovable number spelling keeps its float | the two base-60 manifest cases |
| M28 a refused number is reported as a syntax error | the number-rule cases |
| M29 the syntax message names the kind as an adjective again ("a 'opendox-snapshot' document") | the two exact-message syntax cases (6 failed) |

## The repository's own checks

The whole suite ran locally as CI runs it: `CI=true`, `LANG=C.UTF-8`, PostgreSQL 16, `-e ".[runtime,test]"` with the constraints file, at the committed head, with a clean tree.

| tree | passed | skipped |
|---|---|---|
| base `3b13f141` | 2948 | 11 |
| `3d0b6d66` (T058's commit) | 2978 | 11 |
| `09cd1e8a` (#66's `42a08a31` merged in) | 2979 | 11 |
| `28241a4b` (Copilot's two findings) | 2981 | 11 |
| `21e4723f` (#66's `5a26532e` and #58's `3351f6a7` merged in) | 3010 | 11 |
| `69ca0e2e` (#66's `e939c31f` merged in, and Copilot's second round) | 3014 | 11 |
| `80153754` (Copilot's third round, and #58's `753ffa19` merged in) | 3031 | 11 |
| `c7768ed5` (#66's `e3574774` merged in, and Copilot's fourth round) | 3033 | 11 |
| `cd6b33cb` (#66's `38761c76` merged in, and Copilot's fifth round) | 3034 | 11 |
| `923f30d8` (#66's final head `a7bda066` merged in), run under `nohup … &` | 3036 | 11 |
| `5322efee` (`main` merged in, with #66 and #70 landed), run under `nohup … &` | 3044 | 11 |
| this head `1678ccd0` (Copilot's sixth round: the syntax message's wording), run under `nohup … &` | **3044** | **11** |

- The junit diff at `3d0b6d66` shows **+32 added** (29 in the new file, 3 in `test_projection_seams.py`) and **2 removed** (the two stand-in cases above, replaced). At `09cd1e8a` it shows +33: the extra case is #66's own.
- At `923f30d8`, against `cd6b33cb`, it shows **+2**: #66's `test_a_child_stops_on_the_interrupt_even_when_the_runner_ignores_it` and #59's `test_a_regenerate_promotes_no_session_and_moves_no_active_key`. At `5322efee`, against `923f30d8`, it shows **+8**, all from #70's `tests/test_edit_action_one_entry.py`. At this head, against `5322efee`, it shows 0 added, 0 removed and 0 changed.
- **0 changed** outcomes, and the same 11 skips.
- The mutation check was re-run at `923f30d8` and `5322efee` (28 of 28 killed both times), and at this head, where it is **29 of 29**.
- **F4.1's deferred-reach scan**: 11 at the base and 11 here, the same list. The adapter imports `opendox.validator` and PyYAML when a validation runs, and names no sibling.
- No floor, workflow, `conftest.py`, `pyproject.toml` or pin is touched.

## Files (T058's own commits)

- `src/opendox/default_projection.py`: `OwnValidator`, `VALIDATORS`, `SYNTAX_RULE`, `NUMBER_RULE`, `WORKBENCH_RULES`. The stand-in is removed and the docstring rewritten.
- `src/opendox/projection_seams.py`: `register_defaults()` registers `VALIDATORS[kind]`.
- `src/opendox/cli.py` (`69ca0e2e`): `_written_kind` refuses a key given twice, and `_validate` fails on it.

These seven files are the whole of the PR's diff now that #58 has landed.
- `tests/test_projection_seams.py`: the stand-in cases above.
- `tests/test_neutral_projection.py`: it reads the packaged copy.
- `tests/fixtures/opendox-snapshot.schema.yaml`: removed.
- `tests/test_post_render_validator.py`: new. It is a created file, with no carve-manifest row (RULED OQ-C).

## Copilot

- At `3d0b6d66`, "Needs a closer look", with two findings. Both are fixed in `28241a4b`, answered with evidence, and resolved:
  - **r4139734412**: an unreadable packaged record or copy escaped `validator_for()` as a `PermissionError` traceback. `opendox.contracts` converts only a missing file.
    - Measured with `copies.yaml` at mode 000: `generate --strict` exited 1 with the traceback.
    - The adapter now reports an `OSError` from the lookup as validator-unavailable, and the verb warns, or fails under `--strict`, in its own words.
    - The root conversion is #58's file, and it has been relayed to #58's owner.
    - New case: `test_a_packaged_file_that_cannot_be_read_is_unavailable_not_a_traceback`.
  - **r4139734444**: `_names()` was quadratic, and the schema bounds none of the three lists. Membership is now a set's. New case: `test_the_rules_read_a_long_list_in_linear_time`, which took 17.5 s before the fix and 0.01 s after.
- At `21e4723f`, "Needs a closer look", with four findings, each answered with evidence and resolved:
  - **r4139769819**: the verb chose a validator by `kind` with plain `json.loads`, which keeps the last of two keys. So `"kind": "opendox-snapshot", "kind": "unknown"` found no validator, and an ordinary run exited 0.
    - Fixed in `69ca0e2e`: `cli._written_kind` refuses a key given twice, and the verb fails whatever `--strict` says. New case: `test_a_kind_given_twice_chooses_no_validator_and_fails`.
    - NaN and the infinities are left to the chosen validator, since they do not make the kind ambiguous.
  - **r4139840593**: `1e999` reads as `inf` without `parse_constant`. Fixed in `69ca0e2e` (`parse_float=_finite`), with two new not-JSON cases.
  - **r4139769791**: a quoted name was not cut. Fixed in `69ca0e2e`: each is cut at 80 characters. New case: `test_a_rules_detail_cuts_a_long_name`.
  - **r4139769759** (`validator.py`, #58's file): `_close` consuming earlier siblings' canons at `count == 0`. **Not reproduced**: the slice is `done[len(done) - count:]`, which is empty at 0, and `_canon([1, []])` and `_canon([[], 1])` are distinct (`a2:n1:1a0:`, `a2:a0:n1:1`). No change here; the note went to #58's owner.
  - (r4139734412's root, `opendox.contracts` refusing an unreadable file, has since landed in #58 as `2b8ad24`, merged in here. With it, a record at mode 000 gives `could not run: opendox.contracts has copies.yaml, and it cannot be read (PermissionError: Permission denied)` and no traceback. The adapter's own `OSError` guard stays as defense in depth.)
- At `69ca0e2e`, one finding, answered with evidence and resolved:
  - **r4139937566**: `float()` rounds `1.0000000000000001` to `1.0`, which meets `const: 1`. A manifest so written read as "0 violations", and jsonschema 4.26 reads the snapshot case the same way.
    - The contract has no `number` type, so rather than carry decimals through #58's validator, `1ec7d2c9` refuses a float literal that is not finite, or not equal to the shortest spelling of the float read from it, under `document-syntax`. The same proof applies to the manifest's YAML floats.
    - `0.1`, `2.50`, `1E2` and every float openDox's writer writes read as written.
    - Six new cases fail without the fix, and seven controls pass either way.
- At `80153754`, one finding, answered with evidence and resolved:
  - **r4146201125**: a YAML base-60 float (`0:1.0000000000000001`) is read and rounded by PyYAML, but `Decimal` cannot parse it, so the proof let it through, and the manifest read as "0 violations".
    - Fixed in `c7768ed5`: a spelling the proof cannot compare is refused, under `document-syntax`.
    - Two new cases fail without the fix, and mutant M27 is killed.
- At `c7768ed5`, one finding, answered with evidence and resolved:
  - **r4146428769**: a valid document refused for a number was reported as "cannot be read as YAML/JSON".
    - Fixed in `cd6b33cb`: such a number breaks a rule of its own, `document-number`. `document-syntax` stays for a document that cannot be read at all.
    - Ten cases fail without the change, and mutant M28 is killed.
- At `cd6b33cb`, "Needs a closer look", with nothing open.
- At `5322efee`, "Needs a closer look", with one finding, answered with evidence and resolved:
  - **r4148179148**: `document-syntax`'s message read "a 'opendox-snapshot' document", which takes the wrong article.
    - Fixed in `1678ccd0`: it now reads "a document of kind 'opendox-snapshot'".
    - The two exact-message cases, updated first, failed against the old wording (6 of 6 runs), and mutant M29 is killed.
- At this head `1678ccd0`, a review is re-requested through the reviewer API.

## For the holder

1. **The two workbench rules** (above): carried in the adapter, under the consumer script's ids. Tell me if they belong in `opendox.validator` instead.
2. **The verb relays at most the last 20 lines** of a rejection (`cli._report_non_conformance`, T055's, unchanged). A snapshot breaking more than 19 rules shows the count line and the last 19. That is enough for F7.2's single rule, and not changed here.

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 2, 2026
…swers them (R1Q19 (a)) (plan 034) (#65)

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

Arc: neutral-product-standalone-operability

**T063 (the phase-2 checkpoint) has landed** (openxFactory#1218 to `a883bbf6`), so the condition this draft was authored under is met. It was authored ahead under Brett's phase-3 draft-ahead word, "Install chain + lens (Recommended)" (openxFactory#656 comment [5901112350](opensoft/openXfactory#656 (comment)), 2026-09-29). Claim: [5901192386](opensoft/openXfactory#656 (comment)). The holder posts READY; this PR does not.

## T088 (plan 034, slice P3-L): the lens's two seed actions

The task, from `specs/034-opendox-standalone-operation/tasks.md` at openxFactory `main` `91e4685f`:

> **The lens's two seed actions** are offered only where a binding answers them (R1Q19 (a)). Standalone, no binding answers `/actions/dtn-seed` or `/actions/staging-seed`, so neither control is offered. `lens.js` stays the web census's one declared `?` row. Moving the two controls into a view extension that openxFactory contributes, which retires the row, is R1Q19's (b), for later and outside release 1.

- **Realizes**: none of the 69; this is the precondition for AT-R1 step 6.
- **Falsifier**: AT-R1 step 6 (`spec.md`): "`#tab-lens` renders the bullseye with the corpus's documents as dots, and not the text 'nothing on the radar'. Neither of its two openxFactory seed actions is offered, since no binding answers them (R1Q19 (a))."
- **Ruled**: R1Q22 (a), `5817152735`; R1Q19 (a), `5850003126`. No #1144 line changes (R1Q19 amends none), so there is no batch amendment to carry.
- **After**: T063, T069. Both are done: T069 earlier, and T063 as openxFactory#1218 to `a883bbf6`.

## What changed

`src/opendox/web/views/lens.js`, and the census's own bookkeeping for that file. Nothing else in `src/`.

- **The capability that says a binding answers is not new server code.** `/capabilities` already carries `views.contributed_routes`, which `serve.build_server()` builds from the very `route_bindings` table its POST dispatch consults (`route_extension.match(self.route_bindings, "POST", path)`). The lens reads its answer off the payload the shell has already fetched, so there is no second fetch and no new field, and nothing that can drift from the dispatcher.
- **`bindingAnswers(capabilities, method, path)`** (exported) mirrors `RouteBinding.matches`: method, then path, exact or under a prefix, a GET binding answering HEAD too. It fails closed on anything it cannot read (no payload, the probe's fallback, no `views`), and on the WHOLE manifest, as `manifestRoutes()` does: every entry is first held to what `RouteBinding.__post_init__` accepts (a known method, a pattern rooted at a slash with no query or fragment, a boolean `is_prefix`, a prefix ending in a slash), and one malformed entry leaves every route unanswered (Copilot's round-1 finding, taken in d716ded). Unlike `manifestRoutes()` it never throws, because it gates a control.
- **The register seed** (`draft seed`, a drill row on a set two or more repositories share): `ctx.onSeed` is null unless the DTN route is answered.
- **The staging seed** (`draft staging seed`, the pick bar): `ctx.pickDoc` is null unless the staging route is answered. Every selection site (the matrix's checkbox column and select-all, the clickable dots, the `picked` mark, the pick bar) was already guarded by `ctx.pickDoc`, and `test_the_matrix_selection_is_the_seeds_only_input` says the column "exists to feed ONE action". So the selection goes with the button, and a standalone lens never says "tick documents to draft from them". The matrix then draws no empty gutter (and its empty-row `colspan` follows), and the drill note stops naming a seed that is not there.
- Both controls carry a `data-seed-action` hook (`dtn-seed`, `staging-seed`) for the browser half (T096) to assert absence by, without matching on a label that changes (`re-draft`).
- **Census**: `views/lens.js` `loc` 1495 to 1577 and the `?` class total. The row stays `?` (the two route literals and their `route_ownership_exceptions` entry are untouched). The two `until` lines named "a future ruling"; that ruling has now been made in part, so they name R1Q19 (b).
- `tests/test_display_facet.py`'s lens render test drove the lens with no capability payload and read the pick bar's words. It now asks the lens as a host that answers both routes (5 added lines plus 1 changed). The standalone lens is the new file's.

## Round 2: phase 2 has landed (main `047bb4fa`)

- **Main merged into this branch** as a merge commit (`239ebf8e`, no rebase, no force-push), with no conflict. `lens.js`, the census rows and the `test_display_facet.py` respell were not touched by main, so there was nothing to resolve in them. `bindingAnswers` and `lens.js` are unchanged since `d716dedf`.
- **The standalone half now reads the real thing.** A lone openDox can build and serve since T055, so the new `test_the_lens_of_a_real_standalone_serve_offers_neither_seed_action` generates and serves the `plain-documents` fixture (AT-R1 step 3 (a)) in a fresh process with nothing registered, over HTTP, and hands the lens that serve's own `/capabilities` and `/snapshot.json`. The radar draws one dot per document that declares the checked keyword, and no seed control, pick bar, checkbox, clickable dot or word "seed" is on the page.
- **Batch L (openxFactory#1212) and `actions.gate`.** T084 will turn `actions.gate` false on a standalone serve where no gate route answers (measured at `047bb4fa`: a standalone serve with a git identity says `gate: true` while every gate POST answers 404). This lens reads the routes a binding answers (`views.contributed_routes`), not `actions.gate`, so the answer does not move with T084. The falsifier now holds that, rather than assuming it: the standalone cases run with `actions.gate` ON and OFF (hand-built payloads), the real-serve case runs with and without a git identity (which is what sets the serve's own gate verdict today, so both answers are real), and the bound cases run with it ON and OFF too (a read-only project view has no gate and still offers the seeds). Two new mutants make the lens follow `actions.gate` instead of the binding, one per control, and both are killed.
- The child process drops `GIT_*` and `XF_*` from its environment. The suite exports `XF_GATE_PRINCIPALS` (a roster of several names, which is ambiguous with no claim), and that alone resolved no actor whatever the repository's own identity said.

## The falsifier, before and after

`tests/test_lens_seed_actions.py` (new, 13 cases) drives the REAL `views/lens.js` under node. Payloads are built with the real `route_extension.collect_bindings` and `view_extension.view_manifest`, or, in the real-serve case, read from a real serve. Both vocabularies are read, because the two controls live in different ones.

**Before** (the new file against `main` `047bb4fa`'s `lens.js`): 12 failed, 1 passed. The AT-R1 step 6 cases fail on the behaviour, not on a missing symbol, including the real-serve ones:

```
AssertionError: ('keywords', 'a seed action is offered where no binding answers it')
AssertionError: ('real serve', 'a seed action is offered where no binding answers it')
FAILED ...::test_a_standalone_lens_draws_its_radar_and_offers_neither_seed_action[gate-on]
FAILED ...::test_a_standalone_lens_draws_its_radar_and_offers_neither_seed_action[gate-off]
FAILED ...::test_the_lens_of_a_real_standalone_serve_offers_neither_seed_action[actor]
FAILED ...::test_the_lens_of_a_real_standalone_serve_offers_neither_seed_action[no-actor]
FAILED ...::test_the_same_lens_offers_both_where_a_host_contributes_both_routes[gate-on]
FAILED ...::test_the_same_lens_offers_both_where_a_host_contributes_both_routes[gate-off]
FAILED ...::test_each_seed_action_is_offered_on_its_own_route_alone[contributed0-True-False]
FAILED ...::test_each_seed_action_is_offered_on_its_own_route_alone[contributed1-False-True]
FAILED ...::test_a_payload_that_cannot_say_a_binding_answers_reads_as_none_answering
FAILED ...::test_a_manifest_entry_is_trusted_only_if_the_server_would_have_accepted_it
FAILED ...::test_a_binding_answers_only_the_method_and_the_path_it_declared
FAILED ...::test_the_lens_answers_exactly_what_the_servers_dispatcher_answers
12 failed, 1 passed
```

(The one that passes is the source ratchet that the manifest and the dispatcher name the same table.)

**After** (this branch, `c0a97648`): `13 passed`.

What the cases assert:

1. Standalone, with `actions.gate` on and off: the radar draws its documents as dots, "nothing on the radar" is absent, no seed control is offered by label OR by hook, and no pick bar, checkbox, clickable dot, pick column or word "seed" survives, in both vocabularies.
2. The same, over a real standalone serve of the `plain-documents` fixture, with and without a git identity.
3. A host contributing both routes gets both controls (register seed only on the shared row), with `actions.gate` on and off, so "never offer them" cannot pass.
4. Each control is offered on its own route alone.
5. Fail closed on every unreadable payload shape, including one bad entry beside a good one (either order).
6. Method and path exactness, and prefixes.
7. `bindingAnswers` over the published manifest equals `route_extension.match()` across GET, HEAD and POST and exact and prefix routes.
8. The lens's notion of a well-formed manifest entry is `RouteBinding`'s own: over 21 candidate entries, on both sides of every clause and including JSON shapes that were never constructed, a list holding one beside a good seed route answers yes exactly when `RouteBinding` accepts it.
9. `serve.py` names the same table for the manifest and the POST arm (read as text; the real serve in case 2 now exercises it end to end).

**Mutants killed** (each applied to `lens.js` alone, the new file run, then restored): staging gate removed; register gate removed; fail open on a payload with no manifest; method ignored; prefix and exact inverted; register seed asking the staging route; GET no longer answering HEAD; pick column drawn with no selection; drill note always naming the seed; `is_prefix` boolean check dropped; gate reading the wrong caps object; one bad entry no longer poisoning the list; each of the rooted-pattern, no-query-or-fragment and prefix-ends-in-slash clauses dropped; the methods table widened; the staging seed following `actions.gate`; the register seed following `actions.gate`. 18 of 18 killed, 0 survivors.

## Measured

`LANG=C.UTF-8`, the whole suite, in the foreground: `main` `047bb4fa` 2878 passed, 177 skipped; this branch (`c0a97648`) 2891 passed, 177 skipped. The skip sets are identical node for node. The 177 are the database-backed cases that CI runs against its PostgreSQL service. Neighbours (`test_web_boundary.py`, `test_display_facet.py`, `test_bullseye_widget.py`, `test_lens_labels_at_scale.py`, `test_view_registry.py`) pass unchanged apart from the one respell above.

## Overlap, and what this deliberately does not touch

- Re-checked `gh pr diff --name-only` against every open openDox-code draft (#60 to #64, #67, #69) at this round: none touches `views/lens.js`, the census fixture, `tests/test_display_facet.py` or any file under `web/views/`. #57, #58 and #59 have landed, and the merge was clean. No `serve.py` edit.
- `.github/workflows/validate.yml` is untouched: its pinned floors are `>=` and permit the rise of +13 collected, and re-pinning them is a cross-draft hotspot better done once, with the phase's bookkeeping.
- T096 (the browser half that observes the absence), T087 and T084 are not this PR.
- **Expected follow-on, not a defect:** when T084 (openDox-code#77) merges main after this lands, it changes `test_the_lens_of_a_real_standalone_serve_offers_neither_seed_action`'s `capabilities["actions"]["gate"] is actor` assertion to `is False`, because of batch L's capability honesty (a standalone serve says `gate` false even with a git identity). The lens reads `views.contributed_routes`, not `actions.gate`, so the rest of the case, the dots and the absent seed controls, holds either way, and the gate-on and gate-off standalone cases already run both ways.

🤖 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
…plan 034) (#67)

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

Arc: neutral-product-standalone-operability

Plan 034 (`specs/034-opendox-standalone-operation/tasks.md`, read at openxFactory `main` `91e4685f`, after T007 batch H landed as openxFactory#1206 → `f99a2097`), phase-3 slice **P3-I, install mode and the bundle**:

- **T070** (#1144's 13.4, 13.5 and 13.6): `OPENDOX_INSTALL_MODE`, and the `--local` flag.
- **Falsifier:** F13.1's refusals, plus a test of the disagreeing pair.
- **After:** T071 (openDox-code#60, landed as `7ff434d9`) and T007 batch H (landed). It was stacked on #60's branch; the holder has retargeted it to `main`, and `25262459` merges main `7ff434d9`, so this diff is T070 alone.

**Ruled:**
- R1Q22 (a), `5817152735`;
- R1Q15 (b), `5850003126` (as batch H's 13.4 addendum reads);
- the phase-3 draft-ahead widening, `5901112350` (*"Install chain + lens (Recommended)"*).

Claimed on openxFactory#656 in [`5901575394`](opensoft/openXfactory#656 (comment)). **Authored ahead as a DRAFT**, which did not go READY before T063 landed and the holder said so. **T063 has landed** (openxFactory#1218 → `a883bbf6`, 2026-10-02 23:37:43Z), which closes phase 2, so phase 3 is open, and #60 ahead of it has landed.

## What it does

- **The selector** (13.4): `OPENDOX_INSTALL_MODE`, values `local` and `hosted`, defaulting to `hosted`. It is a `SETTINGS` entry read in `runtime/config.py`, placed immediately beside `OPENDOX_OIDC_ISSUER`. A blank value reads as unset, which means hosted: *"It is UNSET, not `local`, that must be safe."*
- **The flag** (R1Q15 (b)): `generate-and-open --local` selects local exactly as `OPENDOX_INSTALL_MODE=local` does. With neither, the install is hosted (13.5). The flag belongs to the verb and follows it (10.1).
- **A flag and a setting that disagree are refused, naming both.** Example: `--local` beside `OPENDOX_INSTALL_MODE=hosted`. No explicit selection is silently overridden. **This is plan 034's fail-closed reading (Principle VII), not #1144's text.** No answer rules the pair, batch H does not write it into #1144, and `evidence/analyze-round-2.md` (U2-1, V2-6) records it for Brett.
- **Local needs no broker.** `RuntimeSettings.oidc_issuer` and `oidc_audience` are empty, and `oidc_jwks_url` is `None`. `jwks_url()` and `discovery_url()` return `""` rather than a path glued onto nothing.
- **Local binds loopback only, with no opt-in** (13.4). A non-loopback `--host` on `generate-and-open`, or `OPENDOX_BIND_HOST` for the runtime's own listener, is refused, naming the loopback rule.
  - The set is `serve.py`'s own `LOOPBACK_HOSTS` (`127.0.0.1`, `::1`, `localhost`). 13.4 asks for *"the same judgement at the mode's own boundary"*.
  - `config` cannot import `serve`, so it spells the set, and a test holds the two equal. `127.0.0.2` is therefore refused, because the document server does not treat it as loopback either.
- **Hosted, or unset, with no issuer refuses, naming `OPENDOX_OIDC_ISSUER`** (13.5).
  - `generate-and-open` asks for the issuer first (`require_the_hosted_issuer`), and then loads the whole runtime configuration. The serving process is the one whose settings are the install's (13.4a; R1Q16 (i)).
  - So a hosted run with nothing configured names the issuer and `--local`, not the `OPENDOX_DATABASE_URL` that `load_settings` happens to ask for first (plan 034's requirement-13 scenario 2).
  - `load_settings` keeps its own order for every verb that relies on it.
- **Hosted is otherwise unchanged** (13.6): same broker, same pinned issuer, same order of refusals, and a hosted bind may still be `0.0.0.0`.
- **The shape is resolved first.** `generate-and-open` resolves it before it scans, mints or binds anything, so each refusal exits 1 at once. That covers F13.1's `test "$rc" -ne 124`.

### Holder readings (coordinator, 2026-09-30, on openxFactory#656; Brett may overrule)

1. **`opendox-runtime runtime serve` refuses under `local`** (`refusal: local-mode-has-no-broker`). Every `/api/v1` route verifies a broker-signed token, and a local install is served by `generate-and-open --local`. In release 1 its document surface reads nothing from the store (R1Q16 (ii)).
2. **`runtime status` under `local`** reports `broker_keys: "not configured (local mode)"` and `broker_discovery: null`. It never builds a verifier, and its exit code is the database's verdict alone, so F13.1's `set -e` survives.
3. **A broker setting beside `local` is refused, naming each one**: `OPENDOX_OIDC_ISSUER`, `OPENDOX_OIDC_AUDIENCE` and `OPENDOX_OIDC_JWKS_URL`. The values are never repeated. T072 adds the two DSNs to the list.
4. **An unrecognised value** (`Local`, `single-user` …) **is refused, naming `local` and `hosted`**, and matching is case-sensitive.

### Deliberately NOT here

- **T070 is the identity half; T072 is the datastore half.** Under `local`, `load_settings` still takes the DSNs from the environment, and `generate-and-open --local` loads no database setting. T072 supplies both DSNs from the bundled server (13.1) and refuses operator DSNs beside `local`.
- T073's `install` block is not here. `serve.py` and `pyproject.toml` are untouched.

### Outside `src/` and `tests/`

- **`deploy/` — one line, and the task requires it.** `deploy/compose/.env.example` gains `OPENDOX_INSTALL_MODE=hosted` with its comment. `config.py`'s header makes `.env.example` the place every setting is named, and `tests_runtime/test_deploy_shape.py::test_every_runtime_setting_is_documented_in_env_example` is parametrized over `SETTINGS`, so a new setting without the line is red. Neither the compose file nor the Kubernetes base changes: the default is already hosted.
- **`docs/`: untouched.** 10.3's README line belongs to T076, in the openDox root.
- **One existing test changes, `tests/test_doxbench_entrypoint.py`'s fixture.** It drives `cmd_generate_and_open` with no settings, and the unset default is now hosted, which refuses without an issuer. So it passes `--local` and scrubs the runtime settings first.

## The falsifier

**F13.1's refusal probes**, verbatim from `# LOCAL mode REFUSES a non-loopback bind` to the end of the block, plus T070's own disagreeing pair. Two deviations are forced by the base, and neither weakens a check:
- the install is the working venv's `-e ".[runtime,test]"`;
- the corpus is a two-file stand-in, because `tests/fixtures/plain-documents` arrives with T050 (#53), which this stack's base (`main` `2d116415`) predates.

Each probe on its own. BEFORE is #60's head `f097fd8`; AFTER is this branch:

```
=== BEFORE (f097fd8)
FAIL local-refuses-non-loopback-bind (rc=1): Traceback (most recent call last):   File ".../src/opendox/consumer_reach.py" …
FAIL hosted-no-issuer-names-it (rc=1): Traceback (most recent call last): …
FAIL unset-default-refuses-identically (rc=1): Traceback (most recent call last): …
FAIL disagreeing-flag-and-setting-names-both (rc=2): usage: ideation-dashboard [-h] … (argparse: no --local)
=== AFTER (this branch)
PASS local-refuses-non-loopback-bind (rc=1)
PASS hosted-no-issuer-names-it (rc=1)
PASS unset-default-refuses-identically (rc=1)
PASS disagreeing-flag-and-setting-names-both (rc=1)
```

The whole sequence under `set -euo pipefail` (F13.1's own form), AFTER:

```
probe 1: local refuses a non-loopback bind
  rc=1; stderr: generate-and-open refused: --host '0.0.0.0' is not a loopback address, and a LOCAL install binds LOOPBACK ONLY (127.0.0.1, ::1, localhost). … There is no opt-in: …
probe 2: load_settings (T071's block, unchanged)
probe 3: hosted with no issuer refuses naming it
  rc=1; stderr: generate-and-open refused: OPENDOX_OIDC_ISSUER is required and is not set, and this install is HOSTED …
probe 4: the unset default refuses identically
  rc=1; stderr: generate-and-open refused: OPENDOX_OIDC_ISSUER is required and is not set, and this install is HOSTED (OPENDOX_INSTALL_MODE is unset, and unset means hosted) …
probe 5 (T070's own, not F13.1's): a disagreeing flag and setting are refused naming both
  rc=1; stderr: generate-and-open refused: --local selects the LOCAL install and OPENDOX_INSTALL_MODE=hosted selects the HOSTED one. …
F13.1 REFUSALS + T070 PAIR: ALL PASSED
```

In the suite, the same probes run as bounded child processes of `python -m opendox.cli` (`timeout=30`, and a `TimeoutExpired` fails as "a server that STARTED") in `tests/test_install_mode_entrypoint.py`. The loader-level cases are in `tests_runtime/test_install_mode.py`.

## A mutant of each new refusal, killed

Each mutant was applied alone and the three T070 test files run with `-x`, with a 240 s bound so a hang could not pass for a kill:

| mutant | killed by |
|---|---|
| M1 the disagreeing pair accepted (flag wins) | `test_a_flag_and_a_setting_that_disagree_are_refused_naming_both` |
| M2 an unknown value read as hosted | `test_an_unrecognised_value_is_refused_naming_the_two[Local]` |
| M3 unknown values matched case-insensitively | same, `[Local]` |
| M4 the default flipped to local (the safety) | `test_the_selector_has_two_values_and_its_default_is_hosted` |
| M5 the hosted issuer-first check a no-op | `test_a_hosted_install_with_no_issuer_refuses_naming_it[None]` |
| M6 the local loopback refusal a no-op | `test_a_local_install_refuses_a_non_loopback_bind_naming_the_rule[0.0.0.0]` |
| M7 broker settings beside local accepted | `test_a_broker_setting_beside_the_local_mode_is_refused_by_name[OPENDOX_OIDC_ISSUER]` |
| M8 the local bind set widened (`127.0.0.2`) | `test_a_local_install_refuses_a_non_loopback_bind_naming_the_rule[127.0.0.2]` |
| M9 local still requires the issuer | `test_a_local_install_needs_no_broker[setting]` |
| M10 `runtime serve` serves under local | `test_runtime_serve_refuses_under_the_local_mode` |
| M11 `runtime status` probes a broker under local | `test_runtime_status_under_the_local_mode_probes_no_broker` |
| M12 `generate-and-open` ignores `--local` | `test_the_flag_refuses_a_non_loopback_bind_exactly_as_the_setting_does` |
| M13 `generate-and-open` skips the install shape | `test_local_mode_refuses_a_non_loopback_bind_naming_the_rule` |

M10 at first HUNG rather than failed: the un-stubbed case started a real uvicorn listener. That case now stubs uvicorn and the app, so the mutant fails at once. The table above is the re-run.

## Fix round: the fixture's repository ignores the user's git config (`32683e8`)

Copilot's review at `b50e3b1` ([finding](#67 (comment))) was real. `tests/test_install_mode_entrypoint.py`'s `corpus` fixture ran `git commit` under the caller's global git configuration, so a global `commit.gpgsign=true` failed the setup before any probe ran.

It now sets `GIT_CONFIG_GLOBAL=/dev/null` and `GIT_CONFIG_NOSYSTEM=1`, as `tests/test_checkout_head.py` does. Measured with a hostile global config (`commit.gpgsign = true`, `gpg.program = /bin/false`):
- at `b50e3b1`: `7 passed, 7 errors`;
- at `32683e8`: `14 passed`.

[Replied](#67 (comment)). The probes are unchanged.

## Fix round 2: `runtime migrate` and `reset` refuse what a local install cannot be (`525f61c`)

Copilot's second review, at `32683e8`, raised two points in its overview, with no inline thread. Both are [answered on the PR](#67 (comment)).

1. **Real, and fixed.** `load_migration_settings` recorded `local` but never asked `refuse_what_a_local_install_cannot_be`. So `runtime migrate` and a confirmed `runtime reset` accepted a broker setting, or a non-loopback `OPENDOX_BIND_HOST`, beside `OPENDOX_INSTALL_MODE=local`. They now refuse at configuration, before any database is reached.
   - Seven new cases in `tests_runtime/test_install_mode.py`: the three broker settings × {`migrate`, `reset --confirm …`}, plus the bind.
   - Against `32683e8`'s config they give `7 failed`; here they pass.
2. **Pre-existing, and not changed here: `::1` passes the loopback rule, but the server cannot bind it.** `serve.build_server` is IPv4-only (`ThreadingHTTPServer`), while `serve.LOOPBACK_HOSTS` lists `::1`.
   - Measured at #60's head `f097fd8`, before this PR: `127.0.0.1` binds, and `::1` fails with `gaierror [Errno -9] Address family for hostname not supported`.
   - This PR's rule is `serve.LOOPBACK_HOSTS` itself (13.4's *"same judgement"*). So `::1` is classified exactly as the document server already classifies it, and then fails at the bind exactly as it does in hosted mode today.
   - The fix is a `serve.py` change (address family, and `server_url`'s brackets), outside T070's file set. It is listed below for the holder.

## Fix round 3: `status` reports a local install's broker on its early return too (`02dadc5`)

Copilot's review at `525f61c` raised one point in its overview, with no inline thread. It is real, and it is [answered on the PR](#67 (comment)).
- With the runtime extra absent, `runtime status` returns early, and that return said `broker_keys: "not probed"` for every install.
- Local now gets the full report's answer there: `"not configured (local mode)"`, with `broker_discovery: null`. Both returns write it through one helper.
- Hosted still says `"not probed"` (13.6).
- The new case runs with `opendox.runtime.db` absent from `sys.modules`. `[local]` fails against `525f61c`'s `runtime/cli.py` and passes here; `[hosted]` passes in both.
- Four mutants of the fix are killed.

## Fix round 4: a healthy local `status` is proven to exit 0; `RuntimeSettings`' invariants are scoped (`859b37b6`)

Copilot's review at `02dadc55` opened two threads, both real. Both are answered and resolved.
- [r4139922962](#67 (comment)): both local `status` cases forced a database fault, so nothing proved exit 0.
  - A DB-backed case now runs local `status` against a migrated schema on the suite's server and asserts `ok`, exit 0, and a broker that is not configured and never probed.
  - With the local return mutated to `ok=False`, the new case fails and the module's other 40 pass. Before this commit, that mutant survived.
- [r4139922999](#67 (comment)): the docstring's broker statements hold for `load_settings` only, so they are now scoped to their loader. `load_migration_settings` carries the migration sentinels in either shape. This is documentation only.

## The repo's own suite

Full `python -m pytest -q`, `LANG=C.UTF-8`, `CI=true`, against a `postgres:16` like `validate.yml`'s:

| | selected | passed | skipped | failed | errors |
|---|---|---|---|---|---|
| #60's head `f097fd8` | 2485 | 2474 | 11 | 0 | 0 |
| `b50e3b1` (T070) | 2531 | 2520 | 11 | 0 | 0 |
| `525f61c` (fix round 2) | 2538 | 2527 | 11 | 0 | 0 |
| `02dadc5` (fix round 3) | 2540 | 2529 | 11 | 0 | 0 |
| `859b37b6` (fix round 4) | 2541 | 2530 | 11 | 0 | 0 |
| `3185e7d` (merges #60's `adeb6fed`, which carries main `047bb4fa`), before the callers' edit | 3117 | 3102 | 11 | **4** | 0 |
| `c8fac05e` (the four callers say `--local`) | 3117 | 3106 | 11 | 0 | 0 |
| `cdf7382b` (merges #60's `c39d960e`; the callers inherit no runtime setting) | 3126 | 3115 | 11 | 0 | 0 |
| `d1de1fd9` (the healthy-local status case sets its schema with `make_conninfo`) | 3126 | 3115 | 11 | 0 | 0 |
| `105f2f12` (no exported runtime setting reaches a `tests_runtime` case), clean and with `OPENDOX_INSTALL_MODE=local` exported | 3126 | 3115 | 11 | 0 | 0 |
| this branch, `25262459` (merges main `7ff434d9`: #60, #65 and #71; #71's generate-and-open child gains `--local`) | 3185 | 3174 | 11 | 0 | 0 |

`026f00ea` (fix round 5) is a docstring change. The install-mode module now names its one DB-backed case ([r4146171212](#67 (comment)), resolved), and the module runs 41 passed.

That is +56 cases: this PR's two new files, plus the `.env.example` census's new parameter (+46 at `b50e3b1`), fix round 2's seven, fix round 3's two, and fix round 4's one. `EXPECT_SKIPPED=11` holds exactly, and the floors (`MIN_SELECTED=2476`, `MIN_PASSED=2465`) allow the rise unchanged.

## Merge-from-main round, and what T070 owed once T056 landed (`3185e7d`, `c8fac05e`; 2026-10-02)

Phase 2 has landed. #60 (T071) merged main `047bb4fa` as `adeb6fed`, and `3185e7d` merges that head here.
- **The merge itself.** Git auto-merges `src/opendox/cli.py` and `tests/test_doxbench_entrypoint.py` without a conflict. Main's `_refuse_empty_source_options` sits after the install shape is resolved, and `--local` still precedes `--host`.
- **The edits T070 owed.** Since this PR, an unflagged `generate-and-open` is HOSTED and refuses without its broker's issuer. Four cases that landed with phase 2 relied on the old default, and all four failed on the merged tree with that refusal. Each runs the single-user install, so each now passes `--local` (`c8fac05e`). None means hosted, so none takes a hosted fixture.
  1. **`tests/test_standalone_generate_path.py`** (T056), case 3, `test_generate_and_open_starts_a_server_that_answers_with_no_sibling`. Its module docstring now names the change and moves F10.1's plain-install run to T077.
  2. **`tests/test_post_render_validator.py`** (T058), `test_generate_and_open_gives_the_same_verdicts`, both fixtures.
  3. **`tests/test_projection_seams.py`** (T055), `test_generate_and_open_refuses_an_empty_source_option_before_its_run_dir`.
- **The stand-ins in `tests_runtime/local_entrypoint_driver.py`** go too, but that driver is T072's file and does not exist on this branch. Its edit is named in #69's merge round.
- **Mutants** of the local path, each failing all four cases: `--local` ignored; local refusing its own loopback default; local also asking for the hosted issuer.
- **Full suite:** `3117 selected, 3106 passed, 11 skipped, 0 failed`.

## Fix round: the `--local` callers inherit none of the runner's runtime settings (`9ae5e72`, `cdf7382b`)

`9ae5e72` merges #60's fix round `c39d960e` (a PostgreSQL scheme libpq would not read as a URI is refused), cleanly.

Copilot's review at `c8fac05e` opened three threads, all real and all now answered and resolved. A `--local` caller took the runner's environment along, so an exported `OPENDOX_INSTALL_MODE=hosted` or broker issuer made it refuse before it reached what it tests.
- **`tests/standalone_child.py`:** every child's environment drops each name in `opendox.runtime.config.SETTING_NAMES`.
- **`tests/test_projection_seams.py`:** the in-process empty-option case scrubs them first, as the doxBench entrypoint fixture does.
- **A harness case** exports a hosted install's four settings and asserts that a child sees none of them.

Evidence:
- Under exported hosted settings, all 5 cases fail against `9ae5e72` and pass here.
- Both mutants are killed.
- Full suite: `3126 selected, 3115 passed, 11 skipped, 0 failed`.

## Fix round: the healthy-local status case reads either DSN form (`d1de1fd9`)

Copilot's review at `cdf7382b` opened one thread, which is real and is now answered and resolved.

`OPENDOX_TEST_DATABASE_URL` may be libpq's keyword/value form as well as a URI. `test_runtime_status_of_a_healthy_local_install_exits_zero` appended `?options=…` to it. On the keyword/value form that suffix becomes part of `dbname`, so the case failed while the fixtures connected (measured). The case now sets `options` with `psycopg.conninfo.make_conninfo`, which works on either form. The runtime's `schema_selected_by` reads the schema back out of the result on both forms.

Evidence:
- **Both forms:** `tests_runtime/test_install_mode.py` passes whole under each.
- **Mutant:** dropping the `search_path` option is killed on both forms.
- **Full suite:** `3126 selected, 3115 passed, 11 skipped, 0 failed`.

The same suffix spelling already exists in main's `tests_runtime/test_migrations_apply.py`. It is not this PR's code, so it is left out of scope.

## Fix round: no runtime setting the runner exports reaches a `tests_runtime` case (`105f2f12`)

Copilot's review at `d1de1fd9` opened one thread, which is real and is now answered and resolved. Since this PR the runtime reads `OPENDOX_INSTALL_MODE`. A runner that exported `local` made every hosted case that leaves it unset a configuration refusal: 20 cases, measured. `tests_runtime/conftest.py` gains an autouse fixture that clears every `SETTING_NAMES` entry before each case; `OPENDOX_TEST_DATABASE_URL` is kept, and the production refusal is unchanged.

Evidence:
- **Full suite**, with a local mode and a broker issuer and audience exported and in a clean environment alike: `3126 selected, 3115 passed, 11 skipped, 0 failed`.
- **Mutant:** a scrub that clears nothing is killed.

## Merge of main after #60 landed (`25262459`; 2026-10-02)

#60 (T071) landed as `7ff434d9`, after #65 (T088) and #71 (T085). `25262459` merges that main.
- **`src/opendox/runtime/config.py`'s four conflicts.** Main's side of each is #60's squash, whose `config.py` is byte-identical to `c39d960e`, which this branch already carried (`git diff c39d960 origin/main` on that file is empty). So each resolves to this branch's side: T071 plus T070's install mode.
- **One edit inside the merge commit, because of T070.** #71's `tests/test_doxbench_defaults.py::test_the_served_catalog_route_answers_from_generate_and_open` runs `python -m opendox.cli generate-and-open` as a child. Unflagged, that is now HOSTED, and with no issuer it refused: `generate-and-open refused: OPENDOX_OIDC_ISSUER is required and is not set, and this install is HOSTED`. It now passes `--local`, the single-user install the case means, with a comment saying why.
- **#65's real-serve lens test needs nothing.** `tests/test_lens_seed_actions.py` runs `cli.main(["generate", …])` and `serve.build_server`, never `generate-and-open`, so T070 does not reach it. It passes unchanged.
- **#74 is not on main yet.** Its `tests/test_chat_model_configuration.py` fixtures will need the same `--local` when it lands after this PR.
- **Full suite:** `3185 selected, 3174 passed, 11 skipped, 0 failed`.

## Downstream, for the holder

- **`serve.py` cannot bind `::1`** (pre-existing, measured at `f097fd8`; fix round 2, item 2). `LOOPBACK_HOSTS` lists `::1`, so `--local --host ::1` passes the loopback rule and then fails at the bind with `gaierror`, as `--host ::1` already does in hosted mode. The fix makes the serve path IPv6-aware, which is a follow-up in `serve.py`'s single-writer order. Until then, `::1` could instead be dropped from `LOOPBACK_HOSTS`. That is the holder's call; this PR does neither.
- **The help-tree golden in openxFactory changes at the phase-3 pin.** `tests/ideation-dashboard/fixtures/cli-help-tree.golden.txt` (read by `test_extension_point_parity.py`) snapshots `generate-and-open`'s options, and `--local` is a new one. T094's consumer-pin PR regenerates it. openXdox-code's help-tree case (T042/T008) may need the same.
- **T056 landed before T070**, as the holder ordered. Its edits are done and named in the merge round above.
- **Overlap** (`gh pr diff -R opensoft/openDox-code`): `src/opendox/cli.py` is also rewritten by #59 (T055, +260/−112), in `cmd_generate_and_open` and `build_parser`. `cli.py`'s single-writer order is T055 → T058 → T070. #57, #58 and #59 have landed, and this stack took its merge-from-main round after them. #57 and #61–#64 do not touch these files.

🤖 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
…ild (plan 034) (#69)

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

Arc: neutral-product-standalone-operability

Plan 034 (`specs/034-opendox-standalone-operation/tasks.md`, read at openxFactory `main` `91e4685f`), phase-3 slice **P3-I, install mode and the bundle**:

- **T072** (#1144's 13.1): the bundled PostgreSQL server, as T007 batch H's 13.1 addendum reads (openxFactory#1206 → `f99a2097`).
- **Falsifier:** F13.1's TCP-listener block, which reads the kernel's socket table at run time, and its `runtime status` block.
- **After:** T070 (openDox-code#67, landed as `66ff7257`). It was stacked on #67's branch; the holder has retargeted it to `main`, and `57b7ed8f` merges main `66ff7257`, so this diff is T072 alone.

**Ruled:**
- R1Q22 (a), `5817152735`;
- R1Q16 (i)–(iv), `5850003126`;
- the phase-3 draft-ahead widening, `5901112350`.

Claimed on openxFactory#656 in [`5901575394`](opensoft/openXfactory#656 (comment)). **Authored ahead as a DRAFT**, which did not go READY before T063 landed and the holder said so. **T063 has landed** (openxFactory#1218 → `a883bbf6`, 2026-10-02 23:37:43Z), which closes phase 2, so phase 3 is open. #60 (`7ff434d9`) and #67 (`66ff7257`) ahead of it have landed.

## What it does, by R1Q16's four parts

- **(i) The document server starts it as its own child, and reports it.**
  - `opendox generate-and-open --local` (or `OPENDOX_INSTALL_MODE=local`) starts `postgres` as a **direct child** of the process serving the document surface. It uses `subprocess.Popen` and never `pg_ctl`, which would re-parent it.
  - It prints the socket, the pid and what it migrated.
  - `runtime status` reports `database_bundle` (`data_dir`, `socket_dir`, `pid`). It reads the pid from the server's own `postmaster.pid` and believes it only while a postgres runs there.
- **(ii) Started and migrated, and nothing more.**
  - `initdb` runs once per data directory.
  - An idempotent bootstrap makes the database and the SERVED role. Its grants are the compose stack's (`init-runtime-role.sh`): CONNECT, USAGE on `public`, and DML on what the owner creates, by default privileges.
  - Then `migrations.MigrationRunner` runs as the owner, with the served role and database declared. The run narrows the ledger to SELECT for the served role and verifies its access, exactly as a hosted `runtime migrate` does.
  - `runtime migrate` under `local` migrates the bundle too.
- **(iii) It ships as the `opendox[local]` extra**, which is `opendox[runtime]` plus `pixeltable-pgserver>=0.6.0` (RULED, openxFactory#656 `5916000030` item 2). **The `test` extra joins it**, so F9.1's `.[test]` install still runs every case.
- **(iv) It stops with the entry point.**
  - SIGTERM is read as the Ctrl-C the serve loop already stops on, followed by a PostgreSQL fast shutdown (then an immediate one, then SIGKILL, each bounded).
  - The backstop is `PR_SET_PDEATHSIG` on Linux, so a SIGKILLed entry point still takes its server with it.
  - The server runs in its own session, so a terminal's Ctrl-C reaches the entry point, and the stop happens in order.

### 13.1's fixed identity

- **The data and socket directories live under `OPENDOX_STATE_DIR`**, at `<state>/postgres/data` and `<state>/postgres/run`.
  - The setting is new. It defaults to `$XDG_STATE_HOME/opendox`, else `~/.local/state/opendox`, and must be absolute, because the server's process and a `runtime status` run from elsewhere must derive the same socket.
  - A state directory too long for the kernel's `sun_path` is refused, naming the setting.
- **No TCP listener:** `listen_addresses` is empty, and the socket directory is narrowed to 0700.
- **Peer authentication** (RULED, openxFactory#656 `5916000030` item 3, *"Peer auth + accept (Recommended)"*):
  - `initdb` runs with `--auth-local=peer --auth-host=reject`.
  - Before every launch the bundle rewrites `pg_hba.conf` and `pg_ident.conf` (atomically, mode 0600). `pg_hba.conf` holds one rule, `local all all peer map=opendox`, plus `host … reject` for IPv4 and IPv6. `pg_ident.conf` maps the running OS user, and nobody else, to `opendox` and `opendox_runtime`.
  - The kernel reports the connecting uid, so the DSNs carry no password because there is none. A cluster an older build left as `trust` is put back to peer on its next start.
- **Both DSNs are supplied:** two users (owner `opendox` for migrations, `opendox_runtime` for serving) over the one socket, with `port` spelled so a stray `PGPORT` cannot redirect libpq. They pass T071's three checks for the reason those exist: one dialect, one database, and never one credential in both settings.
  - **An operator DSN given beside `local` is refused by name.** It is added to T070's `HOSTED_ONLY_SETTINGS`, a holder reading on openxFactory#656 that Brett may overrule.
- **A second entry point on the same state directory is refused**, naming the running pid. One install's database belongs to one entry point at a time.

### The migrations gap (assigned to T072 by the holder)

- The migrations were not package data. `migrations/` sits at the repository root, and only the image copies it (`WORKDIR /app`), so `pip install "opendox[local]"` run outside a checkout had nothing to apply.
- Now `pyproject.toml`'s `[tool.setuptools.data-files]` maps `migrations/*.sql` into the wheel's data directory (`share/opendox/migrations`). **The root `migrations/` does not move.**
- `config.migrations_dir` resolves an unset `OPENDOX_MIGRATIONS_DIR` in this order:
  1. `migrations` wherever the working directory has one (a checkout, or the image's `/app`), which is **today's default, unchanged**;
  2. otherwise the copy the installed distribution's `RECORD` lists (`packaged_migrations_dir`);
  3. for an editable install, which installs no data files, the source tree's own `migrations/`.
- The canonical digest gate is what proves any copy found is the pinned one.
- `test_a_wheel_install_migrates_its_bundled_server_outside_a_checkout`:
  - builds this package's wheel offline (`--no-build-isolation`, `--no-index`);
  - installs it under a `--prefix` outside the checkout;
  - runs from a directory with **no** `migrations/`, asserting that `opendox` is the wheel's copy and that the migrations dir is under the prefix's `share/opendox`;
  - migrates the bundled server there (`applied == ["0001", "0002"]`).

### The server package (RULED, openxFactory#656 `5916000030` item 2: *"pixeltable-pgserver (Recommended)"*)

- **`pixeltable-pgserver` 0.6.0**, the maintained fork of `pgserver`, uploaded 2026-07-14. Apache-2.0, as its dist-info `LICENSE` and OSI classifier say. It carries **PostgreSQL 16.14** under the PostgreSQL License (`initdb --version` and `postgres --version` from `pixeltable_pgserver/pginstall/bin`). It also carries an 18.4 under `pginstall18/`, which this package does not use.
- **Only its binaries are used**, found with `importlib.util.find_spec("pixeltable_pgserver")` without importing it. Its own manager is not used, because:
  - it daemonizes through `pg_ctl`, against (i);
  - it stops from `atexit`, which SIGTERM never runs, against (iv);
  - it may put the socket under the user's runtime directory, opened to 0777, against 13.1.
- **Linkage, re-verified on the installed wheel** (`readelf -d`, `ldd`):
  - `postgres` needs `libz`, `libpthread`, `librt`, `libdl`, `libm`, `libc`;
  - `initdb` needs those less `libz` and `libdl`, plus the wheel's own vendored `libpq`. That libpq resolves through `RPATH $ORIGIN/../../../pixeltable_pgserver.libs` and itself needs only `libc`, `libm` and `libpthread`;
  - the server's loadable modules need `libc`, and one needs the vendored libpq.
  So the system libraries are the C library and libz only: no system PostgreSQL, no ICU.
- **Its floor and its size:**
  - Wheels exist for **cp310 to cp314**, on Linux x86_64 and aarch64, macOS and Windows.
  - The Linux wheels are tagged `manylinux_2_27` and `manylinux_2_28`, so they need **glibc 2.27 or later**. That is the tag's floor. The highest GLIBC symbol any binary or module needs is 2.25, by `objdump -T`.
  - Each wheel is about **24.7 MB** (the cp312 x86_64 wheel is 24,704,230 bytes), because it carries two server majors.
- It pulls in `fasteners`, `platformdirs`, `psutil` and `typing-extensions`, which nothing here imports. All four were already pinned.
- **Superseded:** `pgserver` 0.1.4 carried PostgreSQL 16.2 and had no wheel after cp312 (Copilot r4139811507 and r4139811528, both now resolved with this ruling cited). Also rejected: `postgresql-binaries`, which links the system's ICU and untars at first use, and `pgembed`, which is PostgreSQL 17.

### Outside `src/` and `tests/`

- **`pyproject.toml`:** the `local` extra, the `test` extra joining it, `setuptools>=70.1` in `test` (the wheel test's offline build; 70.1 is the first release that builds a wheel with no `wheel` package), and the data-files map. It is a single-writer file (T057 → T072). #58 (T057) adds package data there, and the merge-from-main round takes it.
- **`constraints-cpython312-linux.txt`,** in its own commit as its header asks. It was extended under its own pins in a clean 3.12.3 venv (`psutil==7.2.2`, `platformdirs==4.12.2`, `fasteners==0.20` and `setuptools==84.0.0` new). At `84a6c041` it was re-resolved in a clean environment under the pins less `pgserver`. The one line that moved is `pgserver==0.1.4` → `pixeltable-pgserver==0.6.0`.
- **`deploy/` — one line, and the task requires it.** `deploy/compose/.env.example` gains `OPENDOX_STATE_DIR=`, because `test_every_runtime_setting_is_documented_in_env_example` requires every `SETTINGS` entry there. The compose stack is hosted and never reads it. **`docs/`: untouched.**
- **Not touched:** `serve.py` (T073 adds the `install` block) and `validate.yml`. It already installs `.[runtime,test]`, and `test` now carries `local`.
- **Existing tests changed:**
  - `tests/test_doxbench_entrypoint.py` stands the bundle in, with a tripwire. Its cases test the model port, which reads nothing from the store (R1Q16 (ii)).
  - T070's `test_install_mode.py` and `test_install_mode_entrypoint.py` stop passing DSNs beside `local`.
  - `test_runtime_surface.py` declares `opendox.runtime.bundle` stdlib-only at import, because `opendox.cli` imports it and `opendox --help` runs with no extra installed.

## The falsifier

F13.1's `runtime status` block and its TCP-listener block, verbatim in their assertions (`f13-1-local.sh`), against a server `generate-and-open --local` started **in the background**, with no broker and no operator database, under `set -euo pipefail`.

**Since the merge round (`19e32f0c`), the start is the REAL entry point.** It is `python -m opendox.cli generate-and-open --local`, with the validator on, over T050's `tests/fixtures/plain-documents` copied into a fresh repository, as F13.1's preamble does. The stand-in driver is deleted. One deviation remains, and it does not weaken a check:
- ~~**Generation is stood in.**~~ Retired at `19e32f0c`. Until then the start went through `tests_runtime/local_entrypoint_driver.py`, because this stack's base predated T055/T056's standalone generate.
- **The pid comes from `runtime status`.** The TCP-listener block reads the server's pid from `runtime status`'s `database_bundle`, not from `caps.json`. `/capabilities`' `install` block is T073's, so F13.1's `caps.json` block is T073's to run.
- ~~**The corpus is a one-file stand-in.**~~ Retired at `19e32f0c`: it is T050's fixture now.

BEFORE is #67's head `b50e3b1`; AFTER is this branch:

```
=== BEFORE (b50e3b1)
ready=1
runtime status rc=1
AssertionError: no bundled database answered: None OPENDOX_DATABASE_URL is required and is not set: …
FAIL status-block
AssertionError: the bundle reports no server pid: None
FAIL tcp-listener-block
=== AFTER (this branch, set -euo pipefail, exit 0)
ready=1
runtime status rc=0
PASS status-block
  server pid 638810, sockets ['3692911'], TCP LISTEN rows: none
PASS tcp-listener-block
PASS stops-with-entry-point (pid 638810 gone)
--- server stdout:
  database /tmp/tmp.v0wydKm5Zm/postgres/run (bundled, pid 638810, migrations applied now: ['0001', '0002'])
```

T070's F13.1 refusal probes and F13.1's `load_settings` block still pass on this branch (`F13.1 REFUSALS + T070 PAIR: ALL PASSED`).

In the suite, `tests_runtime/test_bundled_postgres.py` runs the same two blocks on the same background launch, and adds three checks: the server's `PPid` is the entry point's pid (i), the socket directory is 0700, and SIGTERM ends the entry point with exit 0 and the server gone (iv). Beside that it has a SIGKILL case (the parent-death backstop), the second-server refusal, `runtime migrate` under `local`, the wheel case above, and the layout and refusal cases. **Under `CI` it fails rather than skips** if the server is missing, because `validate.yml` pins `EXPECT_SKIPPED=11` exactly.

## A mutant of each new refusal and guarantee, killed

Each mutant was applied alone, and `test_bundled_postgres.py` plus `test_install_mode.py` were run with `-x`, with a 240 s bound so a hang could not pass for a kill:

| mutant | killed by |
|---|---|
| M1 an operator DSN accepted beside local | `test_migrate_under_the_local_mode_uses_the_bundle_and_refuses_a_dsn` |
| M2 a socket path too long accepted | `test_a_state_dir_too_long_for_a_unix_socket_is_refused_naming_it` |
| M3 a relative state dir accepted | `test_a_relative_state_dir_is_refused_naming_it` |
| M4 the server opens a TCP listener (`listen_addresses=127.0.0.1`) | `test_the_entry_point_owns_a_migrated_server_with_no_tcp_listener` |
| M5 the server is not the entry point's child (`setsid -f`) | same |
| M6 `stop()` a no-op | `test_a_second_entry_point_on_the_same_state_dir_is_refused` |
| M7 no parent-death signal | `test_the_server_stops_even_when_the_entry_point_is_killed_outright` |
| M8 SIGTERM not read as an interrupt | `test_the_entry_point_owns_a_migrated_server_with_no_tcp_listener` |
| M9 started but not migrated | same |
| M10 the served DSN is the owner's (a collapse) | `test_the_two_dsns_are_two_users_over_the_one_socket` |
| M11 no packaged migrations found | `test_a_wheel_install_migrates_its_bundled_server_outside_a_checkout` |
| M12 the socket directory left 0755 | `test_the_entry_point_owns_a_migrated_server_with_no_tcp_listener` |
| M13 a second server on one state dir not refused | `test_a_second_entry_point_on_the_same_state_dir_is_refused` |

**A defect this PR's own test found in itself.** The first cut of the wheel case ran `pip install --prefix` without `--ignore-installed`. pip then read the suite's own editable `opendox` as the installed copy of the same project and **uninstalled it**, emptying the environment the suite runs in (measured: `pip list` lost `opendox` and both console scripts). The flag is now there, with a comment, and the case asserts afterwards that the suite's own `opendox` still resolves.

## The repo's own suite

Full `python -m pytest -q`, `LANG=C.UTF-8`, `CI=true`, against a `postgres:16` like `validate.yml`'s:

| | selected | passed | skipped | failed | errors |
|---|---|---|---|---|---|
| #60's head `f097fd8` | 2485 | 2474 | 11 | 0 | 0 |
| #67 (T070) `b50e3b1` | 2531 | 2520 | 11 | 0 | 0 |
| #67 (T070) `525f61c`, its fix round 2 | 2538 | 2527 | 11 | 0 | 0 |
| this branch before the merge, `c3a70a2` | 2545 | 2534 | 11 | 0 | 0 |
| `32db5d8` (merges `525f61c`) | 2552 | 2541 | 11 | 0 | 0 |
| `ac61596` (merges `02dadc5`) | 2554 | 2543 | 11 | 0 | 0 |
| `28bdccd` (fix round 4, and merges `859b37b6`) | 2580 | 2569 | 11 | 0 | 0 |
| `96b2699f` (fix round 5) | 2584 | 2573 | 11 | 0 | 0 |
| `a0fb7c8d` (merges `026f00ea`; fix round 6) | 2584 | 2573 | 11 | 0 | 0 |
| `0f77d5c1` (fix round 7) | 2595 | 2584 | 11 | 0 | 0 |
| `379fbb14` (fix round 8) | 2601 | 2590 | 11 | 0 | 0 |
| `84a6c041` (the carrier and peer authentication, as ruled) | 2613 | 2602 | 11 | 0 | 0 |
| `f8e6e9e9` (fix round 10) | 2619 | 2608 | 11 | 0 | 0 |
| `fe232fe` (merges #67's `c8fac05e`, carrying main `047bb4fa`), before its edits | — | — | — | 3 (the bundled background cases) | — |
| `19e32f0c` (the merge round's edits) | 3195 | 3184 | 11 | 0 | 0 |
| `6eb0bbdb` (merges #67's `cdf7382b`; the env probe expects the child's own state dir) | 3204 | 3193 | 11 | 0 | 0 |
| `fedfa75d` (fix round 11, `0488f5bd`, then merges #67's `d1de1fd9` with no file change) | 3210 | 3199 | 11 | 0 | 0 |
| `f66e5f82` (fix round 12, `3426c753`, then merges #67's `105f2f12`) | 3215 | 3204 | 11 | 0 | 0 |
| `a9854078` (in-process local cases get their own state dir), with local and broker settings, a runner `OPENDOX_STATE_DIR` and a 90-character `XDG_STATE_HOME` exported | 3215 | 3204 | 11 | 0 | 0 |
| `21bde1af` (the adversarial review's M1, L1, L2, L3 and replication note) | 3236 | 3225 | 11 | 0 | 0 |
| `28e195b9` (fix round 13: the carrier is found as the installed distribution's own files) | 3240 | 3229 | 11 | 0 | 0 |
| `57b7ed8f` (fix round 14, `bf9bcb08`, then merges main `66ff7257`) | 3327 | 3316 | 11 | 0 | 0 |
| `058d96ef` (fix round 15) | 3328 | 3317 | 11 | 0 | 0 |
| `085ba0b0` (merges main `2fc714d2`, #62 T079) | 3346 | 3335 | 11 | 0 | 0 |
| `3ebccb3c` (fix round 16) | 3350 | 3339 | 11 | 0 | 0 |
| `52a2b8dc` (merges main `9a490405`, #74 T081) | 3399 | 3388 | 11 | 0 | 0 |
| `4a9dbe95` (fix round 17) | 3402 | 3391 | 11 | 0 | 0 |
| this branch, `c04690f8` (fix round 18, `8986158e` and `c04690f8`) | 3404 | 3393 | 11 | 0 | 0 |

`EXPECT_SKIPPED=11` holds exactly, and the floors allow the rise unchanged. The new module adds about 32 s to the run (ten cases, each server start about 1.5 s).

**Merging #67's fix rounds.** `95fe16f` merges `32683e8`, and `32db5d8` merges `525f61c`: `runtime migrate` and `reset` refuse what a local install cannot be.
- `525f61c` and this PR both rewrite `load_migration_settings`. The conflict resolves to this PR's structure: under `local`, the refusal is asked first, and only then is the bundle's migration DSN read. T070's reason is carried into the comment.
- The two merged cases set the local shape as this PR defines it, with the mode and the state dir and no operator DSN. Beside `local` a DSN is itself refused here, so a case that set one would have tested the DSN refusal instead of the broker or bind refusal it names.
- A mutant that drops the refusal from the migration loader fails all 7 merged cases.
- `ac61596` merges `02dadc5`, cleanly. With the runtime extra absent, `status`'s early return now reports a local install's broker as not configured. The merged case uses this PR's local shape and also asserts that `database_bundle` is reported on that return: present for local, `null` for hosted.

## Fix rounds 4 and 5: Copilot's twelve threads (`5e52872`, `96b2699f`)

Copilot reviewed `95fe16f`, `32db5d8` and `ac61596a` and opened twelve threads. **Ten are fixed, answered and resolved.** The new cases are in `tests_runtime/test_local_lifecycle.py` (new, hermetic), plus two in `test_bundled_postgres.py`.
- **Migrations** (r4139811473, r4139880241).
  - An explicit `OPENDOX_MIGRATIONS_DIR` is used as given.
  - Unset, a **local** install uses only its own installation's copy, never the working directory's. That copy is the source tree `__file__` came from first, then the `RECORD` of the distribution that holds the running module. Where there is none, it is refused.
  - A **hosted** install's default is unchanged (13.6).
- **The pid** (r4139811555, r4139938402).
  - A pid is believed only when `/proc` proves it is an executable named `postgres` running in this data directory. A proven-stale lock is removed before the launch.
  - Where there is no `/proc`, nothing is believed, and PostgreSQL's own interlocks stand. The price is a `status` with no pid on macOS and the BSDs, recorded in the thread.
- **initdb** (r4139880213): it runs into an attempt directory that is renamed into place only on success. Abandoned attempts are removed. A non-cluster `data/` is refused and left alone.
- **start()** (r4139880279): every phase is one guarded operation, and every failure is the one named refusal, with its phase and class.
- **Interrupts** (r4139880267): SIGTERM or Ctrl-C anywhere in the local lifecycle is a clean stop, exiting 128 + the signal number. A served run still exits 0.
- **Refusal wording** (r4139880298): broker settings and DSNs are two classes, each with its own reason.
- **State dir** (r4139938444): an unknown `~user`, or no home, refuses naming `OPENDOX_STATE_DIR`.
- **Test helper** (r4139811584): bounded by a selector. With a silent 8 s child and a 1 s deadline, it returned after 1.0 s where the old loop took 8.0 s.

Evidence:
- Against `ac61596`'s source, 17 of round 4's first 18 cases fail; the one that passes is the unchanged hosted default. Round 5's cases fail against `28bdccd`.
- Mutants: 23 of round 4 and 5 of round 5, all killed (`runs/mutants-t072-r4.txt`, `-r5.txt` in the writer's workdir).

**Round 6** (`a0fb7c8d`): Copilot's review at `28bdccd9` opened two more threads.
- The unknown-`_serves` point was already fixed at `96b2699f`; it is answered and resolved.
- The pyproject note named a function that no longer exists. It now names `installation_migrations_dir`, and the packaging case checks every `opendox.runtime.config.<name>` pyproject names.
- `4aed6278` merges T070's `026f00ea`, a docstring change.

**Round 7** (`0f77d5c1`): Copilot's review at `a0fb7c8d` opened three threads, all fixed and resolved. SonarCloud raised one reliability finding.
- **libpq's environment.** Every `PG*` variable is lifted out of `os.environ` for the duration and put back afterwards, around `generate-and-open --local`'s lifecycle and the runtime verbs under `local`. `PGHOSTADDR`, `PGSERVICE` and `PGOPTIONS` can no longer redirect the bundle's connections. The real entry point and `status` are proven with all three set.
- **The socket's path.** The resolved state tree must be this user's own and writable by no one else. Every ancestor must be owned by the user or root, and sticky where others can write it; a group-writable ancestor of the user's own group is allowed. Symlinks inside the tree are refused before any chmod.
- **A relative HOME** is refused for the default state directory.
- **SonarCloud S6466** (reliability): `server_binaries` no longer indexes a list.
- Evidence: 8 new cases fail against `a0fb7c8d`, and 11 mutants are killed.

**Round 8** (`379fbb14`): Copilot's review at `0f77d5c1` opened two threads, both fixed and resolved.
- A group-writable ancestor is refused whatever its group, because a primary group can have other members.
- The configured path is checked as configured, as well as resolved: both chains' ancestors, every link's owner, and no `..` anywhere.
- Evidence: 5 new cases fail against `0f77d5c1`, and 5 mutants are killed.

**Round 9** (`84a6c041`) applies Brett's two rulings, openxFactory#656 [`5916000030`](opensoft/openXfactory#656 (comment)) items 2 and 3: the carrier and peer authentication, as described above.
- **The server confirms it**, in its own views:
  - `pg_hba_file_rules` has exactly the one peer rule (with `map=opendox`) and the two rejects;
  - `pg_ident_file_mappings` has exactly the two mappings, for this OS user;
  - `system_user` is `peer:<os user>` for both roles.
- **The map decides.** The same OS user asking for a role outside the map is refused (`peer authentication failed`). A non-root suite cannot connect as a second OS user, so for that case the map, read back from the server, stands: it names no other user.
- **Evidence:** 13 new cases fail against `379fbb14`. 9 mutants are killed:
  - initdb trust;
  - no map;
  - a trust rule;
  - a wildcard system user;
  - a third role;
  - no re-assertion;
  - any name admitted;
  - files 0644;
  - the old carrier.
  The auth mutants are also killed by the real-server cases alone.

**Round 10** (`f8e6e9e9`): Copilot's review at `84a6c041` raised three points, all fixed.
- An existing `postgres/data` joins the tree check, a broken link included (r4147680113, resolved).
- Missing parent directories are created exactly 0700 whatever the umask. `mkdir(parents=True)` under umask 0002 made them group-writable.
- Readiness requires the data directory's lock file to name the launched child, so a racing loser cannot adopt the winner's socket.
- Evidence: 6 new cases fail against `84a6c041`, and 4 mutants are killed.

**SonarCloud S2115, ACCEPTED, as ruled.**
- **Issue:** `AaDvyyOCiqwq-gAw53M3`, python:S2115, "Add password protection to this database", on `src/opendox/runtime/config.py` `DatabaseBundle.dsn`.
- **New status:** `accept` (SonarCloud now reports it `RESOLVED`). Set with the SonarQube tool on openxFactory#656 `5916000030` item 3's authority.
- **Rationale:** the DSN has no password because the server authenticates Unix-socket connections by PEER. The kernel verifies the connecting uid (`SO_PEERCRED`), and `pg_ident.conf` maps only this install's OS user to the two roles. The socket directory is 0700, the server has no TCP listener (`listen_addresses` is empty), and every host connection is rejected. The same rationale is in the DSN's docstring.
- **Gate:** after the change, SonarCloud reports the PR's quality gate `OK` on every condition.

## Merge-from-main round (`fe232fe`, `19e32f0c`; 2026-10-02)

Phase 2 has landed. This branch now carries #67's `c8fac05e`, which carries #60's `adeb6fed` and main `047bb4fa` (T054 to T058, T055's follow-up #70 and T056's standalone test). Git auto-merges `pyproject.toml` (main's validator package data beside this PR's local extra and data files), `src/opendox/cli.py` and `tests/test_doxbench_entrypoint.py` without a conflict. Four edits followed, all in `19e32f0c`:
1. **The stand-ins in `tests_runtime/local_entrypoint_driver.py` go.** The driver is deleted. Its stand-ins patched names T055 has since replaced, so on the merged tree they stood in for nothing, and all three background cases failed: the real corpus-root check refused the stand-in corpus. `test_bundled_postgres.py` now runs the real entry point over T050's fixture, with the validator on.
2. **Every cheap refusal comes before the database start.** Main's T055 added `_refuse_empty_source_options`, so the local path asks it before it builds the bundled server. `tests/test_projection_seams.py`'s empty-option case carries a tripwire bundle, so a regression neither starts a server nor passes.
3. **No child touches the user's state directory.** T070 gave four phase-2 callers `--local`, and here `--local` starts the bundled server, whose `OPENDOX_STATE_DIR` defaults to the user's `~/.local/state/opendox`. `tests/standalone_child.py` now gives every child a fresh, short, private state directory under `/tmp` and removes it when the child stops. Measured before: three children of T056 and T058 initialized a cluster in the (sandboxed) default state home.
4. **T056's case 3 asserts it:** while serving, its bundled server's data directory is under the child's own state directory, and the directory is gone after the stop.
- **Mutants**, all four killed: the refusal dropped; no private state dir; the dir not removed; the fixture not a repository.
- **Full suite:** `3195 selected, 3184 passed, 11 skipped, 0 failed`. Nothing is left under `~/.local/state/opendox` or `/tmp/odx-child-*`.

## Merge of #67's fix rounds (`94254b18`, `6eb0bbdb`; 2026-10-02)

`94254b18` merges #67's `cdf7382b`, which carries #60's `c39d960e` (a PostgreSQL scheme libpq would not read as a URI is refused). `cdf7382b` itself means a `--local` caller inherits none of the runner's runtime settings. There were two docstring and setup conflicts, and both were resolved by keeping both sides:
- **`tests/standalone_child.py`:** the code merged cleanly in the needed order. The child's environment first drops every `SETTING_NAMES` entry, and only then is `OPENDOX_STATE_DIR` set to the child's own directory.
- **`tests/test_projection_seams.py`:** the empty-option case scrubs the settings and keeps this PR's bundled-server tripwire.

`6eb0bbdb` changes #67's harness probe. On #67 it asserted that a child sees no runtime setting. Here every child is given exactly one, its private state directory. The probe now also exports a runner state directory, and asserts three things:
- the child sees exactly `OPENDOX_STATE_DIR` among the runtime settings;
- its value is the child's own `Child.state_dir`, not the runner's;
- the directory is gone once the child has exited.

Evidence:
- **Mutants**, all four killed, under an exported hosted install's settings:
  - the child keeps the runner's settings;
  - the scrub runs after the state dir is set;
  - the runner's own state dir is passed through;
  - the in-process case does not scrub.
- **Exported settings:** the child-driven modules (`tests/test_standalone_generate_path.py`, `tests/test_post_render_validator.py`) pass whole with a hosted install's settings and a runner `OPENDOX_STATE_DIR` exported.
- **Full suite:** `3204 selected, 3193 passed, 11 skipped, 0 failed`. Nothing is left under `~/.local/state/opendox` or `/tmp/odx-child-*`.

## Fix round 11: nothing is made through a path the tree check would refuse (`0488f5bd`, then `fedfa75d`)

Copilot's review at `19e32f0c` opened one thread, which is real (reproduced) and is now answered and resolved. `_prepare_directories` made the missing `postgres/run` before the tree check judged the path, so a component it refuses had already been written through: another user's link, or a 0777 directory. In a sticky parent such as `/tmp`, another user could also plant the state directory's name between the check and the `mkdir`. The fix:
- **What exists is judged before any write.** `_refuse_an_unsafe_tree(existing_only=True)` runs the link-ownership loop first, so even a broken foreign link is named. The whole tree is judged again afterwards, before the socket directory's `chmod`.
- **Missing components are made by descriptor.** `_make_private_directories` makes each one relative to its parent's descriptor and opens it with `O_NOFOLLOW`. `fstat` must show it is this user's alone before anything is made beneath it. A planted link, non-directory or foreign directory is the named refusal: never followed, never re-moded.
- **No `mkdir`/`chmod` window.** Each component is born 0700 under a umask of 077, and the umask is put back afterwards.

Evidence:
- **New cases:** six, in `tests_runtime/test_local_lifecycle.py`. All fail against `19e32f0c`'s `bundle.py` and pass here.
- **Mutants:** seven, all killed.
- **Full suite:** `3210 selected, 3199 passed, 11 skipped, 0 failed`.

`fedfa75d` merges #67's `d1de1fd9` (its healthy-local status case reads either DSN form). On this branch that case uses the bundled server, so the conflict resolves to this side and changes no file.

## Fix round 12: the auth files are exactly 0600, and the cluster runs on its own files (`3426c753`, then `f66e5f82`)

Copilot's reviews at `6eb0bbdb` and `fedfa75d` opened two threads, both real and now answered and resolved.
- **`write_authentication`'s 0600 was only a creation request.** The umask filtered it, and a stale temporary from an interrupted start kept its own mode or was written through as a link. Now the stale temporary is unlinked, the new one is opened `O_CREAT | O_EXCL | O_NOFOLLOW`, and its descriptor is `fchmod`-ed to exactly 0600 before anything is written. A link raced in after the unlink is a refusal, never followed.
- **A reused cluster's `postgresql.conf` could redirect `data_directory`, `hba_file` and `ident_file`**, for example to an outside `trust` file. The launch now pins all three on the command line, which outranks every configuration file.

Evidence:
- **New cases:** four in `tests_runtime/test_local_lifecycle.py` (umask, stale 0644, stale link, raced link) and one real-cluster case in `tests_runtime/test_bundled_postgres.py`. All but the raced-link case fail against `fedfa75d`.
- **Mutants:** six, all killed.
- **Full suite:** `3215 selected, 3204 passed, 11 skipped, 0 failed`.

`f66e5f82` merges #67's `105f2f12` cleanly. It adds an autouse fixture in `tests_runtime/conftest.py` that clears every runtime setting before each case, so a case wanting `OPENDOX_STATE_DIR` sets its own, as every one here already does.

## The adversarial review of `f66e5f82` (`a9854078` to `21bde1af`; 2026-10-02)

An adversarial review of `f66e5f82` found nothing high. It found one medium, three lows and a note. Each is fixed in its own commit, each with a new case that fails without it and mutants that are killed. One more hermeticity fix came first.

- **`a9854078`: the in-process local cases give themselves a short state directory.** The doxBench entrypoint fixture and the empty-option case in `test_projection_seams.py` scrubbed the settings, and so fell back to the runner's default state directory. When that is too long for a Unix socket, configuration refuses it before the case is reached. Measured with a 90-character `XDG_STATE_HOME`: 4 errors and 1 failure. Each now sets its own short `OPENDOX_STATE_DIR` and removes it afterwards. Nothing is made in it, because the database is stood in. Both mutants are killed.
- **M1, medium (`e214477d`): a comma in the state directory is refused.** PostgreSQL splits `-k` on commas, and libpq splits a decoded `host` on them. The review reproduced sockets in two unchecked directories, one of them 0777, while the checked 0700 directory stayed empty. `config.database_bundle` (every bundle's one derivation) now refuses a `,` from `OPENDOX_STATE_DIR`, `XDG_STATE_HOME` or `HOME`, without repeating the value.
- **L1 (`c4f5df3c`): the carrier is pinned to `pixeltable-pgserver>=0.6.0,<0.7`, and another major is refused by name.** Before an existing cluster is used, the server's own `postgres --version` is asked against its `PG_VERSION`. Another major, or a server that does not say, is a named refusal, before anything is written. 4 mutants are killed.
- **L3 (`b2d80e94`): the directory creation starts from is judged by its descriptor.** `_make_private_directories` now `fstat`-judges the base it opens with `_unsafe_because` before the first `mkdir`. That is the install's own rule for the state directory and below, and the ancestors' rule above it. This makes round 11's rule hold inside the function itself. 2 mutants are killed.
- **L2 (`9e2f3030`): the local verbs judge their socket before connecting to it.** `runtime status`, `migrate` and `reset` connected to whatever answered at the bundle's socket path. Reproduced here: `status` on a 0777 tree whose `run` linked to another bundle's socket reported that bundle's applied migrations and exited 0. The fix:
  - `bundle.refusal_before_connecting` asks the start's tree check (now `bundle.refuse_an_unsafe_tree`) of what exists. It then asks for a live server of THIS data directory: its own `postmaster.pid` must name a live `postgres` whose working directory is this data directory, listening at this socket directory.
  - **Status's `database` reads `"not probed: <reason>"`** for a local install that fails this check, including one with no server running. It used to read `"unreachable: …"`, found by connecting.
  - **`migrate` and `reset` refuse as `local-bundle-unverified`.** Hosted is unchanged.
  - The status database block is re-indented under the new branch; `git diff -w` shows only the branch.
  - 7 mutants are killed.
- **The note (`21bde1af`): no replication connection, logical or physical. Fixed, not only reworded.** `authentication_files`' docstring said a replication connection is refused. A physical one was refused, but a logical one (`replication=database`) was accepted as `peer:<user>`, and `IDENTIFY_SYSTEM` answered (measured). No `pg_hba.conf` rule can tell it from an ordinary connection. So the launch sets `max_wal_senders=0`, and the docstring now says both kinds are refused by the server. The mutant is killed.

**Full suite:** `3236 selected, 3225 passed, 11 skipped, 0 failed`. Nothing is left under `~/.local/state/opendox` or `/tmp/odx-*`.

## Fix round 13: the server is found as the installed distribution's own files (`28e195b9`)

Copilot's review at `f66e5f82` opened one thread, which is real and is now answered and resolved. `server_binaries` used `importlib.util.find_spec`, which follows `sys.path`. Under `python -m opendox.cli` that starts with the working directory, and a corpus checkout is where it runs. So a checkout holding an executable `pixeltable_pgserver/pginstall/bin/postgres` was run as the database server.

The carrier is now looked up by distribution name (`importlib.metadata`), on `sys.path` without the working directory. Both binaries must be files its RECORD lists, inside it and executable.

Evidence:
- **New case:** the working directory holds an importable package and a forged `.dist-info`, and the server is not taken from it.
- **Reworked lookup case:** four refusal shapes.
- **Before:** 6 of the 8 fail against `find_spec`.
- **Mutants:** 4 killed, 1 equivalent.
- **Full suite:** `3240 selected, 3229 passed, 11 skipped, 0 failed`.

## Fix round 14: a named platform gate, resolution failures as reasons, no pid behind a refused tree (`bf9bcb08`)

Copilot's review at `21bde1af` opened three threads, all real and now answered and resolved.
- **A named platform gate.** The bundle is a POSIX design, but the carrier ships Windows wheels, where a start failed as an `AttributeError`. `bundle.unsupported_platform()` names the missing primitives (`os.getuid`, `O_DIRECTORY`, `O_NOFOLLOW`, `os.fchmod`, `mkdir` with `dir_fd`, `socket.AF_UNIX`). A start and the local verbs' socket check ask it first.
- **Resolution failures are reasons.** `refusal_before_connecting()` names a symlink loop (`RuntimeError`) and an embedded NUL (`ValueError`) as reasons, beside `OSError`.
- **No pid behind a refused tree.** `bundle.report()` reports a pid only behind a verified tree. A `postgres/data` linked to another live bundle had reported that server's pid.

Evidence:
- **New cases:** three hermetic ones, and a `linked-data` shape with null-pid assertions in the real verbs case.
- **Mutants:** eight, all killed.

## Merge of main after #67 landed (`57b7ed8f`; 2026-10-03)

#67 (T070) landed as a squash, `66ff7257`, after #61 (T078, `8a98e317`). Main thus holds T070's content as one commit this branch's history never saw, and a plain merge against the old base `047bb4fa` conflicted in ten files where both sides carry the same T070 text.

So the merge is computed against the T070 state this branch already held, #67's `105f2f12`: `git merge-tree --write-tree --merge-base=105f2f12 HEAD origin/main`. It is recorded with both parents. The base is sound because `git diff 2526245 66ff725` (#67's last branch head against its squash) names only #61's three files. Against it the merge is clean:
- **18 files** take main's changes since `105f2f12`: #65 T088, #71 T085, #61 T078, and #67's `--local` in #71's test.
- **17 of them are byte-identical to main's.** `src/opendox/cli.py` is the one merged file: main's two `doxbench_defaults` registrations sit beside this branch's local path.
- **No standalone `generate-and-open` child main brought in lacks `--local`.** #71's case gained it in #67's merge. #65's lens test runs `generate` and `serve.build_server`. #61 runs no entry point. Under T072, #71's `--local` child starts a bundled server in `tests/standalone_child.py`'s private state directory.
- **Full suite:** `3327 selected, 3316 passed, 11 skipped, 0 failed`.

## Fix round 15: on Linux the parent-death signal is armed, or the server is not started (`058d96ef`)

Copilot's review at `57b7ed8f` opened one thread, which is real and is now answered and resolved. `ctypes` reports a failed `prctl()` by returning `-1`, never by raising (a seccomp denial, say), and the child ignored it. A killed entry point could then orphan the server, against R1Q16 (iv).

The fix:
- **A failed `prctl` is a refusal.** The child now raises on a nonzero return. `subprocess` re-raises that as `SubprocessError`, which `_launch` names as the refusal "could not be given its parent-death signal", with no server process left.
- **A Linux C library with no `prctl` is the same refusal**, where it used to fall back silently. Other platforms are unchanged.

Evidence:
- **New case (Linux):** a stand-in `prctl` that returns `-1`. The start refuses by name, and the stand-in server never runs.
- **Mutants:** both killed.
- **Full suite:** `3328 selected, 3317 passed, 11 skipped, 0 failed`.

## Merge of main after #62 landed (`085ba0b0`; 2026-10-03)

`085ba0b0` merges main `2fc714d2` (#62, T079). #62 changes only `doxbench_binding.py`, `doxbench_intake.py`, `doxbench_provider.py` and `test_model_provider_broker.py`, none of which this branch touches, so the merge is clean. It runs no `generate-and-open` child, so it needs no `--local`. Full suite: `3346 selected, 3335 passed, 11 skipped, 0 failed`.

## Fix round 16: a local install's served role and database are the bundle's own (`3ebccb3c`)

Copilot's review at `085ba0b0` opened one thread, which is real and is now answered and resolved. Under `local`, `OPENDOX_RUNTIME_PG_ROLE` could replace the bundle's served role in the settings. The migration run narrows the ledger privileges of exactly that configured role, while the bundle bootstraps `opendox_runtime` with the default DML and its served DSN connects as `opendox_runtime`. So `OPENDOX_RUNTIME_PG_ROLE=pg_read_all_data` left `opendox_runtime` able to rewrite `opendox_schema_migrations`.

`refuse_what_a_local_install_cannot_be` (asked by both loaders and by `generate-and-open --local`) now accepts two settings only unset or naming the bundle's own:
- `OPENDOX_RUNTIME_PG_ROLE` must be `opendox_runtime`;
- `OPENDOX_SERVED_DATABASE` must be `opendox`, since it declares the same identity.

Hosted is unchanged.

Evidence:
- **New case:** both settings, through both loaders.
- **Mutants:** both killed.
- **Full suite:** `3350 selected, 3339 passed, 11 skipped, 0 failed`.

## Merge of main after #74 landed (`52a2b8dc`; 2026-10-03)

`52a2b8dc` merges main `9a490405` (#74, T081), with no overlap. #74's standalone `generate-and-open` fixture already passes `--local`, since it landed after #67. Under T072 that child now starts a bundled server in the harness's private state directory.
- **`tests/test_chat_model_configuration.py`:** 49 passed.
- **Full suite:** `3399 selected, 3388 passed, 11 skipped, 0 failed`.

## Fix round 17: the `/proc` falsifier is gated, and a backslash in the map is pinned literal (`4a9dbe95`)

Copilot's review at `52a2b8dc` opened two threads, both now answered and resolved.
- **The `/proc` falsifier is gated.** `test_the_entry_point_owns_a_migrated_server_with_no_tcp_listener` reads Linux's `/proc`, so it now skips where `/proc` is absent, as the other `/proc` and PDEATHSIG cases do. On Linux, and in CI, nothing changes.
- **Backslashes are pinned literal, not escaped.** The thread suggested escaping backslashes in `pg_ident.conf`. Measured against the bundled PostgreSQL 16.14, `pg_ident_file_mappings` reads `"DOMAIN\alice"`, `"alice\"` and `"a\\b"` back as exactly those names, without error. The tokenizer treats a backslash specially only at the end of a line, never inside quotes, so escaping would map a different name.
  - The code is unchanged.
  - A real-server read-back case and a hermetic verbatim assertion pin the behaviour.
  - The escaping mutant is killed.

**Full suite:** `3402 selected, 3391 passed, 11 skipped, 0 failed`.

main has since taken #63 (T080, `1130e996`), whose five files (the doxbench model-provider family) do not overlap this branch. The PR stays MERGEABLE, and CI's merge ref includes it.

## Fix round 18: one schema for both DSNs, and an uninspectable live pid fails closed (`8986158e`, `c04690f8`)

Copilot's review at `4a9dbe95` opened two threads. The holder accepted both, and both are now answered and resolved.
- **`8986158e`: both bundle DSNs name `search_path=public`.** Left implicit, PostgreSQL's `"$user", public` let a reused cluster with a schema named `opendox` or `opendox_runtime` split the owner's ledger from the served role's reads.
  - **New real-server case:** both role-named schemas are created, then the bundle restarts. Both roles' `current_schema()` is `public`, they read one ledger, nothing is re-applied, and `status` is reachable with nothing pending.
  - **Before:** without the pin, the restart fails with `RuntimeAccessMissingError`.
  - **Mutants:** 2 killed.
- **`c04690f8`: a live pid `/proc` will not describe is unknown, not "not ours".** `_identity` raises `_Withheld` for anything but a vanished entry, and `_remove_a_proven_stale_lock` keeps the lock and refuses the start by name rather than unlinking a possibly live server's lock. With no `/proc` at all, PostgreSQL still judges.
  - **New case:** a live pid whose `/proc` links are withheld. It fails against `4a9dbe95`.
  - **Mutants:** 2 killed.

**Full suite:** `3404 selected, 3393 passed, 11 skipped, 0 failed`, run with `LANG=C.UTF-8` and no `GIT_*`/`XF_*`.

## Downstream, for the holder

- **Out of scope, and not T072's: `serve.py` cannot bind `::1`.** This is pre-existing, measured at #60's head `f097fd8`: `gaierror [Errno -9] Address family for hostname not supported`. `serve.LOOPBACK_HOSTS` lists `::1`, but `ThreadingHTTPServer` is IPv4. Recorded on #67 (T070) for a `serve.py` follow-up in that file's single-writer order. This PR does not touch `serve.py`.
- **Done at the merge round:** the driver's stand-ins are gone, and the probe runs the real entry point on `tests/fixtures/plain-documents`.
- **For T073 and T075, which stack on this PR:** a `--local` child built with `tests/standalone_child.py` gets its own state directory automatically. Any other `--local` caller must set `OPENDOX_STATE_DIR` itself.
- **T073** reads `database_bundle` from the server object the entry point keeps (`args.database_bundle`) for `/capabilities`' `install` block.
- **T074** runs F13.1 whole, `caps.json` block included.
- **Overlap** (`gh pr diff -R opensoft/openDox-code`): `pyproject.toml` (#58) and `cli.py` (#59, and the T058 writer after it). They have landed, and this stack took its merge-from-main round after them. `serve.py` is not touched here.

🤖 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
… a built-in credential's rules (plan 034) (#64)

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

Arc: neutral-product-standalone-operability

Plan 034, phase 3. This PR is not one of the plan's tasks. It follows T080 (#63), and gives the broker path the rules T080 gave a built-in credential. It is claimed on openxFactory#656, comment `5889279351`. Plan 034's T080 entry, read at openxFactory `main` `2140f5a7` and again, unchanged, at `main` `a883bbf6`, names this PR as the broker path's own draft, outside T080's scope.

**Ruled.** Brett Heap answered #63's closing question, *"Should the broker path follow it?"*, on 2026-09-29: *"Yes, separate phase-3 draft (Recommended)"*. It is recorded at openxFactory#656 comment `5890601202`: *"The broker token path gets T080's protections in openDox-code#64 (stacked after #63). T080's scope is unchanged."* It extends the T080 ruling *"Refuse unless loopback (Recommended)"*, which is recorded at openxFactory#656 comment `5880893901` and ends "The broker path is unchanged in this task". This is the separate draft.

**Ruled, for the runner.** Brett Heap answered this PR's second flag on 2026-09-29: *"Yes, add to #64 (Recommended)"*. It is recorded at openxFactory#656 comment `5901112350`, the lane's latest RULED comment, as item 2. When a broker misbehaves (non-zero exit, oversize answer, or timeout after writing), the shared runner's refusal carries no broker output, no cause and no context. This PR now does that for all four broker operations. To keep the diagnostics useful, each refusal names the operation and the failure class, and never the bytes. See *The broker runner* below.

**Batch K records the route rule in #1144** (openxFactory#1210 → `39f19145`). Brett Heap's word for the batch is `5916000030`, item 1: *"Yes, amendment batch K (Recommended)"*.
- The amendment is a dated note in requirement 17's body in #1144's spec delta, after its SHALL paragraph and above its scenarios. #1144's `tasks.md` points to it after 16.3's batch H addendum.
- The note narrows requirement 17's and scenario 17.1's *"any endpoint"* in one respect only: the route a credential travels by. A token a broker mints (`5890601202`) takes the rule that a credential the built-in resolver resolves takes (`5880893901`). Each is sent only over `https://`, or over `http://` to `127.0.0.1`, `[::1]` or `localhost`.
- A binding that would present either over `http://` to another host is refused when it is declared (`ENDPOINT_NOT_PRIVATE`), before anything is resolved or minted. The request that presents it follows no redirect, and over plain `http://` it takes no proxy.
- The note names this PR as the broker path's half, and #63 as the built-in resolver's. It rewrites no ratified text, and it says the runner ruling (`5901112350`, item 2) does not bear on the route.

**This was drafted ahead, and what it waited for has landed.** T063 has landed (openxFactory#1218 → `a883bbf6`), and T080 has landed (#63 → `1130e996`), after T078 (#61) and T079 (#62). So this PR may go READY. Its READY line is the holder's to post.

**Based on `main`.** The holder retargeted this PR to `main` when #63 landed. T100 (#82, another writer's PR) is stacked on this branch, so retarget #82 to `main` before this branch is deleted, because a merge with `--delete-branch` closes the PR stacked on it.

## What changes

At `main`, and unchanged at #63's head `3f14bb96`, the broker path had the four gaps #63's body listed for Brett. Each was measured over real sockets and a real broker child before it was closed, at `main` `2d116415` and at `3f14bb96` alike. Each is now closed by T080's own rule, reusing #63's helpers. #63's merge of `main`, `4948e6dd`, changes none of the stack's files, so the base reads the same there.

| the gap at `3f14bb96` | now |
|---|---|
| 1. A minted token could be declared over plain `http://` to any host. | Refused when the binding is declared, by the same predicate (`is_a_private_route`) and with the same fixed `ENDPOINT_NOT_PRIVATE` sentence. `mint` asks the predicate again before it asks the broker for anything. |
| 2. A POST answered 301, 302 or 303 reached the redirect's target as a GET carrying the token. With `http_proxy` set, a request to `127.0.0.1` went to the proxy with it. | The request follows no redirect (`DIAG_PROVIDER_REDIRECTED`), and over plain `http://` it uses no proxy. |
| 3. A refused connection chained urllib's `URLError`, and `do_open.headers`, `_send_request.headers`, `_send_output.msg`, `send.data` and `request.headers` held the token. | Every refusal of a turn that presented a token chains nothing: no cause and no context. |
| 4. The token was not checked. One outside latin-1 failed inside urllib as `DIAG_PROVIDER_UNREACHABLE`, which names the wrong party. One with a space or another non-ASCII character was sent as it was. | `mint` asks `_presentable` of it. Any other token is a malformed answer (`DIAG_BROKER_MALFORMED`), refused before the port holds it or any provider is contacted. |

**How, in the code:**
- `doxbench_binding._require_a_private_route` asks the rule of every record that presents a credential. Only the auth kind `none`, which presents nothing, keeps whatever route it declares. `ENDPOINT_NOT_PRIVATE` now names both credentials.
- `BrokeredProviderPort._call_provider` makes every provider request, on both paths. With a credential, it uses `_open_with_a_credential` (#63's opener, renamed) and raises any refusal afresh. #63's `_dispatch_without_a_broker` is rebuilt on it and behaves as before.
- The broker branch of `dispatch` answers an expiry outside every handler. The one re-mint and the one paid retry of the 2026-08-26 ruling do what they did, and a refusal raised by either keeps no context.
- `mint` reads the answer through `_minted_token`. Any refusal of it is raised again, afresh, after the answer has left the frame that read it. So the refusal of an unpresentable token keeps no frame that holds it, as the built-in resolver's refusal of an unpresentable value keeps none. The first flag below says what else this covers. Since the runner ruling, the wrapper that does this is `_broker_operation`, shared by all four operations.
- After Copilot's second review, an answer that could not be read at all is refused too, with the same fixed sentence:
  - an expiry that is no finite number (an integer past a float's range, `NaN`, `Infinity` or `-Infinity`), in `_parse_expires_at`;
  - an answer nested past the recursion limit, in `_answer_document`, for all four broker operations.

  Before, the first escaped `mint` as an `OverflowError` and the last as a `RecursionError`, each with the answer still in its frames. The three non-finite expiries minted a token that would never expire, or would always have expired.
- After Copilot's review at `e1a6cb0f`, a provider answer nested past the recursion limit is refused the same way, as `DIAG_PROVIDER_MALFORMED` (`da9e639a`; `a271d307` then names `ValueError` alone for the decode error, SonarCloud S5713).
  - The parse in `_post_to_provider` serves every path, so a broker's token, the built-in resolver's key and `none` each refuse.
  - Before, the parse escaped as a `RecursionError`, whose traceback kept the request with its authorization header. It did so at #63's head and at `main` too (measured; flag 12).
- `DIAG_PROVIDER_REDIRECTED`, `_DeclineRedirects`, `_presentable` and `_PresentedCredential` now name both credentials. The four gaps left `FIXED_DIAGNOSTICS` at eleven. The runner ruling adds a twelfth (below).

## The broker runner (the second ruling)

Measured at `788d764b`, this PR's head before the ruling, with a stand-in broker that wrote a fake token first:

| the broker | at `788d764b` | now |
|---|---|---|
| exits non-zero | refused, but the token stayed in the runner's frame: `answer`, and the child's `_fileobj2output` | `DIAG_BROKER_REFUSED`, keeping nothing |
| answers past the 64 KiB bound | the same, and refused as `DIAG_BROKER_MALFORMED`, like an answer of the wrong shape | `DIAG_BROKER_OVERSIZE`, a new sentence, keeping nothing |
| times out, with its output open or closed | the refusal chained the `TimeoutExpired`, whose `output`, and whose frames inside `subprocess`, held the token | `DIAG_BROKER_TIMEOUT`, with no cause and no context |
| answers in bytes that are not UTF-8 | no refusal at all: a `UnicodeDecodeError` escaped every operation, holding the token in `object` | `DIAG_BROKER_MALFORMED` (or `DIAG_BROKER_TIMEOUT` if it then hangs), keeping nothing |
| cannot be started | refused, chaining the `FileNotFoundError` | `DIAG_BROKER_UNREACHABLE`, with no cause and no context |
| writes without end (Copilot at `25788f91`) | read in full until the timeout, then refused as a timeout: the bound limited what was accepted, not what was read | refused with `DIAG_BROKER_OVERSIZE` as soon as it passes the bound, and killed |
| has a descendant holding its output open (Copilot at `b847ef3d` and `a603a032`) | at `e3eec6b1`, never refused: the reader waited on the pipe after the broker was killed (still waiting after 10 s, with a 0.5 s timeout). At `a603a032`, a descendant that left the group held the refusal for a 2 s grace and left a blocked reader thread, with its descriptor, behind. | refused at the timeout. The broker's process group is killed whole, and this process's ends of both pipes are closed, so no thread or descriptor is left behind. |
| never reads a credential larger than its pipe | at `a603a032`, the refusal waited past 10 s: the timeout began only once the credential was written | refused at the timeout, which now covers the credential's streaming too |
| its credential source fails mid-copy (the operator's input) | at `b847ef3d`, the broker was left running with its reader blocked, and the interpreter aborted at exit (`Fatal Python error: _enter_buffered_busy`) | the broker is reaped before the error goes on, and what it wrote is dropped. The error itself is unchanged (flag 9). |
| leaves a descendant in its group, holding none of its pipes, then exits non-zero or answers in no UTF-8 (Copilot at `a271d307`) | at `a271d307`, refused at once, but the descendant went on running, one more for each such call (measured: both still running a second later) | refused, and what is left of its group is killed while the broker is a zombie, so the group's id cannot have been reused |

At `788d764b` no refusal named its operation either. Two of the sentences said "so no token could be minted", whichever operation had failed.

**How, in the code:**
- The runner's work moves to `_run_broker`, which returns an answer or a sentence and raises no refusal. `subprocess_broker_runner` raises the refusal after it returns. So the refusal is outside every handler, in a frame that never held the child or its answer.
- One selector loop in the calling thread (`_answer_of`) streams the credential to the broker in `PIPE_BUF` writes and reads the answer, as `communicate` does on POSIX. There is no reader thread. One deadline covers both. At most one byte past `MAX_BROKER_ANSWER_BYTES` is read, straight into one list, so no other name holds it. The child's exit is awaited within what is left of the timeout.
- The broker starts in its own process group (`process_group=0`; the session and the terminal stay this process's). `_reap` kills that group, waits for the broker, and closes this process's ends of both pipes. Anything else that escapes the runner, such as a failing credential source, is reaped the same way before it goes on, and what the broker wrote is dropped.
- The answer is decoded as UTF-8, JSON's own encoding, where `communicate` used the locale's. An answer that is not UTF-8 is malformed.
- The four operations ask through one wrapper, `_broker_operation`, which replaces `mint`'s own. It raises every refusal again, afresh, with the operation named, after the answer has left its frame. So a runner that was injected is covered too, as are refused `intake`, `revoke` and `list` answers.
- `BrokerRefused` takes `operation=`, from `OPERATIONS` only and only beside a broker's sentence (`BROKER_DIAGNOSTICS`). Its message reads `broker <operation>: <sentence>`, for example `broker intake: the credential broker exited non-zero, and its answer is withheld by design`. `.diagnostic` is still the sentence alone, so every caller that compares it is unchanged.
- The broker's five sentences now name a failure class and no operation. `FIXED_DIAGNOSTICS` has twelve.
- Every refusal of the runner kills what is left of the broker's group: at the timeout, at the bound, after a non-zero exit, and after an answer that is not UTF-8 (`bbcb565e`, after Copilot at `a271d307`).
- The broker's exit is read with `os.waitid(…, WNOWAIT)` (`_exit_status_unreaped`, in `f8bc8aca`, after Copilot at `bbcb565e`).
  - This leaves the broker a zombie, so its pid, which is its group's id, cannot be reused before `_reap` signals the group.
  - `_reap` signals a group only while the broker is unreaped.
  - Its wait is bounded by `_REAP_GRACE_SECONDS`, 5 s, as `runtime/local_git_adapter` bounds its own. CPython reaps a broker that outlives that once its `Popen` is collected.
  - Where `os.waitid` does not exist, the exit is read with a reap, and no group is signalled.
- The runner's tail moves to `_settled`, which decodes the answer in place in the one list that holds it.

Files: `src/opendox/doxbench_binding.py`, `src/opendox/doxbench_provider.py` and `tests/test_model_provider_broker.py`, all in P3-B's row. The runner's five commits touch the last two only. `cli_model_binding.py`, `serve_workbench.py`, `validate.yml` and `pyproject.toml` are untouched.

## Merging #63, and then `main` (`63e534cb`)

`63e534cb` merges `main` `1130e996`, which is T080's squash (#63). This branch was stacked on #63's branch, so the merge takes `main` whole and replays none of #63's own commits. Its tree is the three-way merge of this branch and `main` over their old base, #63's `4948e6dd` (`git merge-tree --merge-base 4948e6d f8bc8ac 1130e99`), with three resolutions and nothing else:
- The test module's imports conflicted, each side adding one (`functools` here, `http.client` there). Both are kept.
- T080's route-neutral case declares an `http://` endpoint on another host for a broker's binding. Here a broker's minted token is held to a private route too, so the case declares that endpoint for the `none` binding alone.
- `ENDPOINT_SCHEME_REFUSED`'s comment names both credentials that `ENDPOINT_NOT_PRIVATE` covers on this branch.

The provider merged with no conflict:
- `_intake_reference`, where this branch reads an intake answer, holds a broker's reference to the record's rule (#63's M2).
- The shared transport maps `http.client.HTTPException` (#63's L4).

`main` also brought T078 (#61), T079 (#62), T070 (#67), T081 (#74), T085 (#71), T088 (#65) and T071 (#60). None of them changes this PR's code, and T081's changes to the test module are at cases this PR does not change.

Before that, `e1a6cb0f` merged #63's head `4948e6dd`, which carried `main` `047bb4fa` (phase 2's nine landings). Copilot's reviews of that merge and of the heads after it found four things, each fixed here (`da9e639a`, `bbcb565e` and `f8bc8aca`), and SonarCloud two more kinds (`f0d28a79` and `a271d307`).

**After the merge, two commits answer the holder and the adversarial review:**
- `b8323d01`, the adversarial review's L4 for the broker path. #63 maps an `http.client.HTTPException` in the shared transport to the unreachable sentence, and its case runs a broker's turn too, pinning that sentence only. Here every refusal of a request that carried a credential is raised afresh by `_call_provider`, so for a broker's turn the case also pins no cause, no context, and neither the key nor the token in any frame the refusal keeps.
- `e313437b`, the holder's Q2 (flag 13).

## Flags, for Brett and the holder

1. **One step past the fourth gap's letter.** The wrapper that keeps gap 4's own refusal clean covers every refusal of the mint answer. So a malformed answer beside a good token no longer keeps the token either. At `3f14bb96` it did: `mint.answer`, `mint.document`, `_answer_document.text` and `_answer_document.document`. Copilot's second review took the same rule to answers that raised something other than a refusal (see *How* above). This is T080's rule, that no frame a refusal keeps holds the raw credential, applied in the same function. The runner ruling then took it to all four operations. Narrowing it would need a separate cleanup for gap 4's refusal alone; say so if you would rather have that.
2. **Closed: the broker runner's own refusals.** This was the open question at `788d764b`. It is ruled (see *Ruled, for the runner*) and done (see *The broker runner*).
3. **A stored record can stop reading.** A broker binding already stored with plain `http://` to another host now refuses when the document is read. The entry point falls back to the harness declaration and says so. `model-binding edit` and `remove` read the whole document first, so they refuse too, and the operator edits the file by hand to an `https://` or loopback endpoint. T080's refusal of a key in a stored URL set the precedent (`test_a_stored_document_whose_endpoint_carries_a_key_does_not_read`).
4. **T080's scope pin is replaced.** `test_the_loopback_rule_is_the_built_in_resolvers_alone` pinned T080's scope by declaring a broker binding on two plain-`http://` routes. That half is gone. The case is now `test_a_none_binding_keeps_a_route_that_is_not_private`, over all nine routes. #63's body cites the old case among the broker path's pre-existing gaps, which this PR closes.
5. **A reading.** An opener installed process-wide with `urllib.request.install_opener` no longer serves a request that carries a credential. It already did not serve a built-in one. Nothing in openDox installs one.
6. **The operator reads new text.** `model-binding set-credential` and the console's intake route both show a broker refusal's `str()`. That now reads `broker <operation>: <sentence>`, and the broker's sentences are reworded. No test here or in openXdox-code compares the old text; every test compares the constants. `serve_workbench.py`'s intake comment still says a refusal carries "one of FIXED_DIAGNOSTICS and nothing else". The operation it now names comes from a closed vocabulary. The file is left alone: T084 owns it, and #59, which edited it, has landed.
7. **A twelfth sentence.** An answer past the bound had `DIAG_BROKER_MALFORMED`, and now has `DIAG_BROKER_OVERSIZE`, so the refusal names that class. The provider's own bound stays on `DIAG_PROVIDER_MALFORMED`. Say so if you would rather keep eleven, and the old class.
8. **Two cases past the ruling's three.**
   - An answer that is not UTF-8 was not a refusal at all at `788d764b`. It escaped as a `UnicodeDecodeError` holding the token. It is the same runner and the same rule, so it is refused here too.
   - Copilot's review at `25788f91` found the bound was checked only after the whole answer was read. The bound now limits the read itself.
9. **Not changed: the input side of `intake`.** This was measured at `25788f91` and again at `b847ef3d`. Since `e3eec6b1` the broker is reaped first, and the error is otherwise unchanged. When the credential's own source fails while it is copied to the broker, the error escapes the runner and is not refused:
   - A lone surrogate in the credential escapes as a `UnicodeEncodeError` whose `object` holds the credential. `sys.stdin` can yield one under `surrogateescape`. The stand-in broker still received, and stored, the credential without that character.
   - A source that fails to decode mid-copy escapes as a `UnicodeDecodeError`.

   This is the operator's input, not the broker's output, so it is outside the ruling. Should a follow-up refuse it?
10. **The runner is POSIX-only now.** The selector loop reads and writes pipes, which Windows' selectors cannot watch, and the process group needs `os.killpg`. On a platform without `killpg` the broker alone is killed. Nothing in this repository runs on Windows, and CI is Linux. Say so if the runner must also run there.
11. **Ruled: the operator's input stays without a time limit.** Copilot at `e75900ff` said a credential source whose `read()` blocks (`sys.stdin` in the CLI, the request body at the console) holds the loop, and the broker, past the deadline. That is an operator or a client still sending the credential, not a broker that misbehaves. Brett Heap ruled on 2026-09-30, openxFactory#656 comment `5916000030`, item 5: *"Leave unbounded (Recommended)"*. Operator input is outside the broker-runner ruling. No code changed for it.
12. **The nested provider answer is fixed here, for every path, and the holder decided it stays here** (2026-10-02). #63 and #64 land back to back after T063, so the window is short, and the fix changes the broker path's failure too, which T080's ruling leaves to this PR. `da9e639a` changes the parse that #63's built-in path and `none` share. Measured at #63's head `4948e6dd`, all three paths escape with a `RecursionError`, and so does `main`'s broker path at `047bb4fa`. #63's body says so.
13. **Every refusal kills what is left of the group, a refused answer included** (the holder's answer, 2026-10-02). Measured at `f8bc8aca`, a broker that left a helper in its group and exited 0 with an undeclared answer was refused as `DIAG_BROKER_MALFORMED`, and the helper was still running a second later. Since `e313437b`, the subprocess runner reads each operation's answer while the broker is a zombie, its exit read with `WNOWAIT` (`_settled`, given `read`).
    - A refusal of the answer kills the group, and then reaps the broker.
    - A successful answer reaps the broker alone and leaves the group, since a broker may leave a helper running on purpose.
    - `_broker_operation` hands its reader to the subprocess runner, and raises a refusal afresh, naming the operation, as before. A runner injected in its place, such as a test's, is given the argv alone, as before.
14. **SonarCloud's S3776 on `_answer_of` is known, and stays** (the holder's answer, 2026-10-02: no refactor in this PR). The runner's selector loop has a cognitive complexity of 28, where 15 is allowed. It was 31 before `f8bc8aca` moved its tail into `_settled`. The quality gate passes, and the runner's mutants pin the code. `e313437b` only passes `read` through it, and its complexity is unchanged.

For the holder, downstream:
- No downstream file changes. openXdox-code's `tests/test_doxchat_model_intake.py` builds its bindings on `https://` only, and asserts only that an intake refusal has a reason, not its text.
- The console's intake route builds its binding inside its existing `BindingRefused` handler (`serve_workbench.py`, left alone). So a posted broker binding on plain `http://` to another host is refused there with the fixed sentence.
- At `e313437b`, the only other open openDox-code PR that touches these three files is T100 (#82), stacked on this branch at `63e534cb`. A trial merge of this head with #82's `1ef4c71d` conflicts in one place, `_broker_operation`'s docstring, where each side added a paragraph, and #82's trust check, which goes before the argv is built. Both are kept by the obvious resolution.
- T081 (#74) has landed, and this branch carries it through `main` `1130e996`.

## The tests

### The four gaps' cases fail at `3f14bb96`

Each gap's cases ran with `3f14bb96`'s `src` (the base, whose broker path is `main`'s) and this branch's test module. They fail there on the behaviour itself, never on a missing name: `DID NOT RAISE`, the wrong sentence, a cause or a context set, a frame holding the token, or an `OverflowError` or `RecursionError` escaping. The controls beside them pass there too.

| gap | its cases | at `3f14bb96` |
|---|---|---|
| 1 | a broker binding refused on nine routes, by the constructor and from a stored record; `mint` asking no broker for a binding forced past the record; the operator door refusing one and storing nothing | 11 fail. 15 controls pass: six private routes, and nine `none` routes. |
| 2 and 3 | five redirect codes declined over real sockets, with nothing heard elsewhere; a stand-in proxy hearing nothing; a real refused connection keeping no frame that holds the token; four refusals (unreachable, refused, malformed, expired twice) and a refused re-mint, each with no cause and no context | 12 fail. T080's refactored redirect and proxy cases (6) pass. |
| 4 | eight unpresentable tokens refused before any request, with the catalog unavailable and nothing recorded; one outside latin-1, over a real socket; an unpresentable token kept in no frame; eight malformed answers (a bad instant, an undeclared key, JSON cut short, an expiry past a float, `NaN`, `Infinity`, `-Infinity`, nesting past the recursion limit) keeping no frame, cause or context | 18 fail. 2 controls pass: every printable ASCII character but the space is presented unchanged, and the declared answer mints. |

The proxy cases, T080's included, now drop `urlopen`'s cached global opener first (`_an_environment_proxy`). `urlopen` reads the proxy environment only when it builds that opener. Without the reset, the broker's proxy case passed at `3f14bb96` whenever an earlier test had built it.

T080's redirect and proxy scaffolds are shared with the broker's cases (`_a_provider_that_redirects`, `_an_environment_proxy`). T080's two route lists are shared parametrize marks (`ON_A_PRIVATE_ROUTE`, `NOT_ON_A_PRIVATE_ROUTE`). T080's node ids do not change.

### The runner's cases fail at `788d764b`

Each stand-in broker writes a fake token and marks that it did, then misbehaves. Each case checks the mark, so a slow start cannot pass it vacuously. Then it checks three things, in this order: no cause and no context; nothing kept (no frame local, no attribute of one, and nothing in the refusal itself holds the token); and the sentence, the operation and the message. With `788d764b`'s `src` and this branch's test module, 43 of the 44 cases fail, on the behaviour:
- 10 hold the token in a frame;
- 10 let a `UnicodeDecodeError` escape;
- 10 chain a `TimeoutExpired`;
- 4 chain a `FileNotFoundError`;
- 1 reads until the timeout;
- 5 name no operation;
- 1 prints the old text;
- 2 are the two updated counts.

| the runner's cases | cases | at `788d764b` |
|---|---|---|
| the shared runner, called directly, for six misbehaviours: exits non-zero, answers past the bound, times out, closes its output and times out, answers in no UTF-8, and answers in no UTF-8 and times out | 6 | 6 fail |
| each of the four operations, through the real runner, for the same six | 24 | 24 fail |
| a broker that writes without end, refused at the bound well inside a 5 s timeout | 1 | fails. It is also the one case that fails at `25788f91` (5.1 s measured). |
| a broker that cannot be started, by the runner and by each operation | 4 | 4 fail |
| an injected runner's refusal, named by each operation | 4 | 4 fail |
| the operation vocabulary, and a provider's sentence refused an operation | 1 | fails |
| the operator's `set-credential` door, with a broker that wrote and exited non-zero | 1 | fails |
| updated: twelve sentences; the bound's own sentence, with an answer at the bound as its control | 2 | 2 fail |
| a guard that the cases ask every declared operation | 1 | passes |

Five later cases answer Copilot and a finding of this PR's own, each measured at the head it answers:
- a descendant holding the broker's output, in its group and out of it (2). Each is refused at the timeout, leaves no thread and no descriptor, and an in-group descendant is killed. Both hang at `e3eec6b1`. The one that left the group takes 2.5 s at `a603a032`.
- a broker that reads 5000 bytes of a 1 MB credential and stops is refused at its 0.5 s timeout. At `a603a032` it held the refusal past 10 s.
- a credential source that fails mid-copy, in a child interpreter, exits 1 with its own error. At `b847ef3d` it aborts, 3 of 3 runs.
- the same in this process, after the answer has been read: what escapes keeps nothing the broker wrote, and the broker is not left running. It found a local, `chunk`, holding the answer, which is removed. Its two mutants are killed.

### This round's cases

- **The adversarial review's L4, for a broker's turn** (`b8323d01`): #63's six `http.client.HTTPException` cases, run for a broker's turn, now pin a fresh raise with no cause, no context, and no key and no token in a kept frame. With #63's transport (`05cb1c70`), where the broker path chains its cause, all six fail on that cause.
- **A refused answer kills what is left of the group** (`e313437b`), by each operation. A broker starts a helper in its group, holding none of its pipes, and exits 0 with an answer of no declared kind that carries the token. The refusal names the operation and keeps nothing, the group is signalled once while the broker is a zombie, and the helper is killed. All four fail at `63e534cb`, with `[] == ['Z']`.
- **A successful answer leaves the group alone** (`e313437b`), by each operation, as a control. A broker starts a helper and then becomes the fake broker in the same process. No group is signalled, and the helper still runs. All four pass at `63e534cb` too.

### Copilot's rounds after the merge of `main`

- **A provider answer nested past the recursion limit** (Copilot at `e1a6cb0f`), once for each credential source: a broker's token, the built-in resolver's key, and `none`. All three fail at `e1a6cb0f`, with the `RecursionError`.
- **A refusal kills what is left of the group** (Copilot at `a271d307`). The broker leaves a descendant holding none of its pipes, then exits non-zero or answers in no UTF-8. Both cases fail at `a271d307`, with the descendant still running. Since `f8bc8aca`, each also checks that the group is signalled once, while the broker is a zombie. With `bbcb565e`'s provider that reads `[None]`.
- **Where the exit cannot be read unreaped, no group is signalled** (Copilot at `bbcb565e`). With `os.waitid` removed, no `killpg` comes after the reap. With `bbcb565e`'s provider, one did.
- **A refusal waits on a killed broker only so long** (Copilot at `bbcb565e`). The broker's `wait` behaves like that of a broker stuck in uninterruptible I/O. With `bbcb565e`'s provider the case fails: `an unbounded wait`.

**Forty-seven mutants**, each run against the whole module, and each killed. The first thirty-five were run at `e75900ff`, and the last twelve at the heads named:

| mutant | tests that fail |
|---|---|
| the declaration's rule back to the built-in resolver alone | 10: the nine broker routes, and the operator door |
| `mint`'s own route check removed | 1: `test_mint_asks_no_broker_for_a_token_on_a_route_that_is_not_private` |
| the rule asked of `none` too | 10: the nine `none` routes, and T080's operator-door case |
| the credential opener kept for the built-in resolver alone | 6: the five broker redirects, and the broker's proxy case |
| the redirect-declining handler dropped | 10: every redirect, on both paths |
| the proxy bypass removed | 2: the proxy case, on both paths |
| a refusal re-raised with its chain, whatever was presented | 5: three chain cases, and both refused-connection cases |
| the expiry answered inside its handler, as at the base | 2: expired twice, and the refused re-mint |
| the token's check back to non-blank text | 10: the eight tokens, the real socket, and the frame case |
| each operation's refusals raised where they happen (no wrapper) | 42 |
| the answer kept in the operation's frame | 9: the eight malformed answers, and the unpresentable token's frames |
| the operation's refusal raised inside its handler | 43 |
| the finite check on an expiry removed | 4: an expiry past a float, `NaN` and both infinities |
| an integer past a float's range left to `float()` | 1: an expiry past a float |
| a `RecursionError` from the JSON reader not caught | 1: the answer nested past the limit |
| runner: the non-zero exit's answer handed back beside the refusal | 1: the runner's exit case |
| runner: the non-zero exit refused where it is seen, as at `788d764b` | 1: the same |
| runner: past the bound refused as `DIAG_BROKER_MALFORMED`, as at `788d764b` | 7 |
| runner: past the bound refused where it is seen | 2 |
| runner: the bound's check removed, so the whole output is read | 7 |
| runner: a timeout on the exit refused inside its handler | 1: the runner's closed-output case |
| runner: a timeout in the loop refused where it is seen | 2: the runner's two open-output timeouts |
| runner: no deadline on the child's exit | 5: the closed-output case, by the runner and by each operation |
| runner: the credential written whole, blocking past the deadline | 1: the broker that never reads the credential |
| runner: the decode error not caught | 5: no UTF-8, by the runner and by each operation |
| runner: a broker that cannot be started refused inside the handler | 4 |
| runner: anything else escaping, the broker not reaped | 1: the failing source, in this process |
| runner: anything else escaping, what the broker wrote kept | 1: the same |
| runner: a descendant, the broker killed alone | 1: the descendant in its group |
| runner: a descendant, the broker given no group of its own | 1: the same |
| the refusal names no operation | 34 |
| an undeclared operation accepted | 1: the vocabulary case |
| an operation named beside a provider's sentence | 1: the same |
| the message does not name the operation | 30 |
| (control) the presentability test too strict | 2: the printable-ASCII cases, on both paths |
| the provider's parse without `RecursionError` (`da9e639a`, and again at `a271d307`) | 3: the nested provider answer, on every path |
| the provider's parse without `ValueError` (`a271d307`) | 1: `test_a_refusal_of_a_turn_that_presented_a_token_chains_nothing[malformed]`, with a `JSONDecodeError` |
| runner: no reap after a non-zero exit (`bbcb565e`, and again at `f8bc8aca`) | 1: its own group case |
| runner: no reap after an answer in no UTF-8 (`bbcb565e`) | 1: its own group case |
| runner: the broker reaped before its group is signalled (`f8bc8aca`) | 2: both group cases |
| runner: `waitid` without `WNOWAIT`, so reading the exit reaps (`f8bc8aca`) | 2: both group cases |
| runner: the group signalled after a reap (`f8bc8aca`) | 1: the case without `os.waitid` |
| runner: the reap's wait unbounded (`f8bc8aca`) | 1: the bounded-wait case |
| a refusal of a credentialed request re-raised with its cause (`b8323d01`) | 19, among them the six broker L4 cases |
| runner: a refused answer reaped without the group kill (`e313437b`) | 4: the refused answer, by each operation |
| runner: a successful answer kills the group (`e313437b`) | 4: the control, by each operation |
| runner: the in-place read unused (`e313437b`) | 4: the refused answer, by each operation |

## Review

Each inline thread is answered with evidence and resolved.

| Copilot at | verdict | threads | answered in |
|---|---|---|---|
| `af457e66` | Needs a closer look | the redirect case's docstring read as repeating 303 | `a2c838a0`, the docstring only |
| `a2c838a0` | Changes recommended | an expiry past a float's range escaped `mint`, and `NaN` and the infinities were taken | `788d764b`, which also closed the `RecursionError` of the same class |
| `788d764b` | Needs a closer look | none. Its summary names the stacked prerequisites, which are the draft flag at the top. | |
| `25788f91` | Changes recommended | the answer's bound limited what was accepted, not what was read (high); this description was stale (low) | `b847ef3d`, and this description |
| `b847ef3d` | Changes recommended | a descendant holding the broker's output made `_reap` wait forever; this description was stale (read before it was updated) | `a603a032`, and this description. `e3eec6b1` between them reaps a broker whose credential source fails. |
| `a603a032` | Changes recommended | a descendant that left the group left a blocked reader thread and its descriptor behind each refusal; that reader could add to the answer after it was dropped | `e75900ff` |
| `e75900ff` | Changes recommended | a credential source whose `read()` blocks holds the loop past the deadline | ruled: left unbounded (flag 11). The thread is answered with the ruling and resolved, and Copilot was asked again at `e75900ff`. |
| `e75900ff`, asked again | Needs a closer look | none. Its summary asks for a final human review of the subprocess rewrite, and names the stacked prerequisite, which is the draft flag at the top. | |
| `e1a6cb0f`, the merge of `main` | Changes recommended | a provider answer nested past the recursion limit escaped `_post_to_provider` as a `RecursionError`, its traceback keeping the request | `da9e639a` |
| `f0d28a79` | Needs a closer look | none | |
| `a271d307` | Needs a closer look | none, and a note it had missed before: a non-zero or non-UTF-8 refusal left the broker's descendants running | `bbcb565e` |
| `bbcb565e` | Changes recommended | the group was signalled after the broker was reaped, so a reused pid could name another group; the reap's wait was unbounded | `f8bc8aca` |
| `f8bc8aca` | Needs a closer look | none. Its summary asks for a final human review once the stacked prerequisites land. | |
| `f8bc8aca`, asked again through the reviewer API | Needs a closer look | this description was stale: it still named `e75900ff` as this head | this description |
| `63e534cb`, the merge of `main` `1130e996` | Needs a closer look | none. Its summary asks for a final human review of the subprocess rewrite, and names the stacked draft dependencies, which have now landed. | |
| `e313437b`, L4's broker cases and Q2 | Changes recommended | this description was stale: it still said only the runner's refusals kill the group, and its head, totals and mutant count stopped before this round (moderate) | this description, pushed after the review; reply `4173524883` |

SonarCloud's check passed at each head, and its quality gate is OK. Its API read 0 issues at `af457e66` and at `788d764b`. At `e1a6cb0f` it read five, all from the runner's commits of 2026-09-30: four S5778 in the tests, fixed in `f0d28a79`, and one S3776. The catch `da9e639a` touched drew an S5713, fixed in `a271d307`. At `f8bc8aca` one remains, the S3776 on `_answer_of`, and at this head it is the same one, known and kept (flag 14). Its analysis of this head is pending.

## 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`:

| tree | passed | skipped | failed |
|---|---|---|---|
| `main` `1130e996` (T080 landed) | 3475 | 11 | 0 |
| `63e534cb`, the merge of `main` | 3585 | 11 | 0 |
| this head `e313437b` | 3593 | 11 | 0 |

`main` `1130e996`'s row is #63's last head `05cb1c70`'s run, and its tree is `1130e996`'s, byte for byte. Before this round, #63's `4948e6dd` read 3206, `e1a6cb0f` 3309 and `f8bc8aca` 3316. Before phase 2 landed, #63's `3f14bb96` read 2630, `788d764b` (before the runner ruling) 2686, and `e75900ff` 2733.

The +118 cases are all in `tests/test_model_provider_broker.py`:
- 24 for gap 1 (26 added, and T080's two-route scope case removed);
- 12 for gaps 2 and 3;
- 20 for gap 4, with the malformed answers;
- 47 for the runner;
- 3 for the nested provider answer, and 4 for the runner's later rounds: the two group cases, the case without `os.waitid`, and the bounded wait;
- 8 for the holder's Q2: the refused answer and its control, by each operation.

None skips, and skipped stays at the pinned 11. F16.1's record block still passes (`dialect and model declared; a raw key is refused in a field and in the URL`), and `tests/test_provider_boundary.py` passes (24).

CI's `validate` at this head (run `37129092647`) reads `selected=3735 passed=3724 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` `5e7ab003`, where T072 (#69) landed after this round's merge. T072 changes none of this PR's files, and the merge is clean, so CI's count includes T072's cases. The floors are not raised here: `validate.yml` was outside the draft-ahead scope, as it was for #61 to #63.

🤖 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