Repository navigation
Broker-path credential hardening (follows T080): a minted token keeps a built-in credential's rules (plan 034) - #64
Conversation
`openai-chat-v1` joins doxbench_binding.DIALECTS as the second member,
after `xfactory-prompt-v1`, which stays first. Its request is the
chat-completions grammar (`model`, `messages`, the assembled prompt as
one message in the user role), and its answer is read at
`choices[0].message.content`. Both are spoken by one arm in
doxbench_provider.py alone (`_DIALECT_ARMS`), beside the prompt
grammar's arm, which sends the bytes it always sent. An unknown dialect
is still refused when a binding is declared, and a test holds the arm
table's keys equal to the vocabulary.
Falsifier: F16.1's dialect assertion, `"openai-chat-v1" in b.DIALECTS`.
Ruled: R1Q22 (a), openxFactory#656 comment 5817152735. doxbench_binding.py
is a moved_verbatim row, and editing it needs no declared-edit act.
Drafted ahead of T063 under Brett's phase-3 word ("Only the independent
ones"). It does not land before T063.
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 binding record gains `model`, the model name the provider receives
as the request's model, in either dialect. It sits after `dialect`, with
the route it belongs to, so BINDING_FIELDS grows from nine to ten, and
still no field can hold a secret. `model-binding add|edit --model` sets
it, and `model-binding list` shows it.
A binding that declares no model keeps the meaning it had: the request
names the catalog handle, the binding's `id`, byte for byte. So `model`
is keyword-only and defaults to None, and a stored record may leave it
out (OPTIONAL_BINDING_FIELDS). Every construction written before the
field existed builds the binding it built, and every nine-field document
reads. The console's intake route in serve_workbench.py builds a binding
without a model, and it keeps working unedited. The catalog handle stays
the binding's id, and `model` is not an argv placeholder.
Falsifier: F16.1's field assertion, `"model" in b.BINDING_FIELDS`.
Ruled: R1Q22 (a), openxFactory#656 comment 5817152735.
Drafted ahead of T063 under Brett's phase-3 word ("Only the independent
ones"). It does not land before T063.
Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…lan 034)
A key inside the endpoint URL is refused when a binding is declared, by
the product's own detector, runtime/local_git_adapter's
carries_a_credential. It runs before the scheme check, so no refusal
repeats the URL. The refusal is one fixed sentence. A key in an extra
field is refused as an unknown key, as it always was.
Each record now has ONE resolver, and credential_source() says which:
- a BROKER, for any other reference, as before;
- the BUILT-IN RESOLVER, for `env:NAME` and `keyring:SERVICE/USERNAME`
references (R1Q17 (b)). doxbench_provider reads the reference at call
time, once per request, and keeps nothing: no mint, no ledger event,
no retry on a 401. Such a record needs no broker, and a broker_argv
given beside it is refused. That refusal is the plan's fail-closed
reading (analyze round 2, V2-21), recorded as standing in
openxFactory#656 comment 5851950767; no answer rules it. The OS
keyring is read through the `keyring` package, imported at call time.
It is not a dependency: without it, a keyring reference refuses with a
fixed sentence. Two fixed diagnostics join (eight to ten);
- NONE, for an endpoint that takes no credential: the auth kind `none`
(R1Q18 (a)), under which credential_ref and broker_argv are forbidden.
It joins AUTH_KINDS after api_key and oauth, so AUTH_KINDS[0] is
unchanged, and its requests carry no authorization header.
The record parses a reference's form, once, for both sides, and never
reads what it names. A stored record may leave out the fields its
resolver forbids or does not need. Each read-back and each removal
states the custody sentence that is true of its resolver. The operator
door takes `--auth-kind none`, an omitted `--credential-ref` and an
empty broker invocation, and `set-credential` refuses a binding no
broker answers without reading its standard input.
Falsifier: F16.1's three refusals and its control, plus tests of the
resolver and of `none`.
Ruled: R1Q22 (a), openxFactory#656 comment 5817152735; R1Q17 (b) and
R1Q18 (a), comment 5850003126.
After: T079, and T007 (batch H), which has NOT landed on openxFactory
main (e369cb25): #1144's 16.3 has no addendum yet. This is built to plan
034's text.
Drafted ahead of T063 under Brett's phase-3 word ("Only the independent
ones"). It does not land before T063.
Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…arCloud) SonarCloud's analysis of openDox-code#61 flagged five of T078's new test lines: four `pytest.raises` blocks whose envelope was built inside the block (S5778), and one composite assertion (S9073). The envelope is now built before each block and the assertion is split in two. No assertion changes meaning, and the case count is unchanged. Arc: neutral-product-standalone-operability Lane: openxfactory-4 (openXfactory-4-openDox_extraction) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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#62 noted that doxbench_intake.py's module docstring still called the binding a "closed nine-field record" and the intake declaration "not a tenth field on it". T079 made the record ten fields, so both phrases were false. The paragraph now names each count by its tuple, as it already did for the catalog entry, and records that the binding grew once, by `model` (#1144 box 16.2). The declaration is "not a field on it". This is a docstring only: no code, no test and no behaviour 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>
…o T080'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>
…rer can carry Two remarks in Copilot's overview of openDox-code#63, both measured here. The endpoint reached the credential detector unbounded. The detector is quadratic in a parameter name's length, and an endpoint arrives from the command line or from the console's intake route. The binding now refuses an endpoint longer than runtime/config.MAX_REMOTE_URL_CHARS before the detector is asked. That is the product's own URL bound, which the repository act applies to a remote for the same reason. It is read when the binding is declared, and the refusal is a fixed sentence that repeats nothing of the endpoint. A resolved credential could be one no header carries. The resolver checked only for CR, LF and NUL. Measured against urllib: - a character outside latin-1 failed while the header was encoded, as DIAG_PROVIDER_UNREACHABLE, which names the wrong party, and the UnicodeEncodeError it chained held the whole header, credential included; - any other non-ASCII character, or an embedded space, was sent. A resolved value must now be non-empty printable ASCII with no whitespace, or it refuses with DIAG_REFERENCE_UNRESOLVED before any provider is contacted. SonarCloud's findings on the same PR: - built_in_reference_parts returns one shape for both forms, a BuiltInReference named tuple (S8495); - the variable-name pattern reads [A-Za-z_]\w* under re.ASCII (S6353); - the broad except carries a bare noqa code, with its reason on the line above (S7632); - each pytest.raises block in T080's tests holds one throwing call (S5778), and two composite assertions are split (S9073). Sixteen new cases: the bound (past it, at it, read from config), six unpresentable values and a printable-ASCII control, a real-socket case for a value outside latin-1, three unusable keyring answers, and two non-ASCII variable names. Five mutants of the fix were each killed. Arc: neutral-product-standalone-operability Lane: openxfactory-4 (openXfactory-4-openDox_extraction) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…rCloud) SonarCloud's analysis of openDox-code#63 at f92fca4 flagged one line of the new real-socket test: it reset the stand-in handler's class-level record by assignment (S8997). The test now takes monkeypatch, so the record is restored when the test ends. The test file's four new non-ASCII literals are written as \u escapes, so the source shows which code point each case uses. The string values are unchanged, and the case count is unchanged. Arc: neutral-product-standalone-operability Lane: openxfactory-4 (openXfactory-4-openDox_extraction) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… pinned With `none` in AUTH_KINDS, the console's intake flow offers a subset of the vocabulary: api_key and oauth, the kinds a broker enrols. A `none` binding holds no credential, so the flow, which exists to hand one to a broker, has nothing to collect for it. The operator declares one with `model-binding add --auth-kind none` instead. doxbench_intake.auth_kind_disclosure's docstring now says so, and a new test pins the relationship, in the vocabulary's order. The disclosure's code is unchanged. The docstring sits outside P3-B's row; the PR body flags it. The test named "this_processs_own_environment" is renamed to "the_serving_process_environment". Arc: neutral-product-standalone-operability Lane: openxfactory-4 (openXfactory-4-openDox_extraction) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Brett Heap ruled on the question openDox-code#63 raised, on 2026-09-28, choosing "Refuse unless loopback (Recommended)"; the lane's holder relayed the ruling. A credential the built-in resolver reads (an env: or keyring: reference) is a long-lived key, so it is sent only over https://, or over http:// to 127.0.0.1, ::1 or localhost. Any other http:// endpoint is refused before resolution. - doxbench_binding.is_a_private_route is the one predicate. It matches the endpoint as written, case-blind, against https:// or http:// to one of LOOPBACK_HOSTS with an optional port. A URL parser's reading is not used, because it and the HTTP client read "http://evil.example\@localhost/" as two different hosts. - The record refuses a built-in reference on any other route when it is declared, from the command line or a stored record, with one fixed sentence, ENDPOINT_NOT_PRIVATE, that repeats nothing of the endpoint. - The built-in resolver asks the same predicate before it reads anything. No declared binding reaches that check, so what does is a programming error, raised as an AssertionError with nothing read, as the resolver already does for a broker's reference. - The broker path is left as it is, as the ruling says: a minted token may still be declared over plain http:// to any host. The auth kind none presents no credential and keeps its route too. 32 new cases, including IPv6 loopback, the lookalike host "localhost.evil.com" and mixed-case schemes. Seven mutants of the rule were each killed. Arc: neutral-product-standalone-operability Lane: openxfactory-4 (openXfactory-4-openDox_extraction) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…helpers (SonarCloud) SonarCloud's analysis of openDox-code#63 at 4abc6d4 measured the binding's __post_init__ at a cognitive complexity of 17, over the 15 allowed (S3776). The endpoint's own checks (the length bound, the key detector and the scheme, in that order) move into _require_a_declarable_endpoint, and the loopback rule into _require_a_private_route. The order of every check is unchanged, and so is every refusal. The whole suite and the seven mutants of the rule give the same results as at 4abc6d4. 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 openDox-code#63 at 4abc6d4 (high severity): the default urllib opener follows redirects, and it re-sends every header but the content ones to the Location. Measured with two loopback servers: a POST answered 301, 302 or 303 reached the redirect's target as a GET that still carried "Authorization: Bearer ...". So a private endpoint could hand a long-lived key to any host and any scheme, which the loopback ruling of 2026-09-28 forbids. A request that carries a credential the built-in resolver read now uses _open_without_redirects. Its _DeclineRedirects handler closes the redirect's answer unread and declines, and the port answers with a new fixed diagnostic, DIAG_PROVIDER_REDIRECTED. FIXED_DIAGNOSTICS goes from ten to eleven. An injected opener is still used as given. The auth kind none sends no credential, and the broker path keeps the default opener, as the ruling leaves that path. Five new cases over real sockets (301, 302, 303, 307 and 308). The second server hears nothing. Two mutants were each killed: the opener swap removed, and the redirect declined silently. 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 openDox-code#63 at d240fd5 (high severity): _post_to_provider took the credential as a raw string. At main the provider-call frame held a MintedToken, whose repr redacts. A traceback keeps its frames, and an error reporter that records a frame's locals records them by their repr, so the raw string was one repr away from a log. - The credential now travels as _PresentedCredential, whose repr and str say nothing, on both paths. The minted token is wrapped at its two call sites and the built-in value as it is read. So every frame of this module that carries a credential to the provider holds only the wrapper, as it held a MintedToken at main. - A refusal of a request that carried a built-in credential is raised afresh, outside every handler, with no cause and no context. Measured with a refused connection: urllib's own frames (do_open.headers, _send_request.headers, send.data and others) hold the bearer in their locals, and a chained cause keeps those frames. - A value refused as unpresentable is deleted from the reading frame before the refusal is raised. It can still be most of a key. The broker path keeps its chained cause, and so keeps urllib's frames, as the 2026-09-28 ruling leaves that path. The PR body records that. Three new cases: over a real refused socket, for an unpresentable value, and for the broker path's frame. Each walks every frame the refusal keeps, through its causes and contexts. Three mutants were each killed: the wrapper's repr disclosing, the chained cause kept, and the unpresentable value kept. 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 openDox-code#63 at 1b0fb3f: the opener for a built-in credential still installed urllib's ProxyHandler, which reads the environment's proxies. Measured: with http_proxy set, a request addressed to 127.0.0.1 went to the proxy, credential header and all. A plain-http route is private only because it stays on this host, so the loopback ruling of 2026-09-28 is broken by any proxy. _open_without_redirects becomes _open_for_a_built_in_credential. It still declines every redirect, and a plain-http request now goes direct through ProxyHandler({}), whatever the environment names. An https:// request may still use the environment's proxy, because a proxy reaches it only by CONNECT and the credential stays inside TLS. The broker path keeps the default opener, as the ruling leaves that path. One new case over real sockets, with a stand-in proxy that hears nothing. With the bypass removed, the stand-in proxy answered the turn, so the mutant was killed. Arc: neutral-product-standalone-operability Lane: openxfactory-4 (openXfactory-4-openDox_extraction) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ures keep no context Two remarks in Copilot's overview of openDox-code#63 at 286655f. Its threads were none. - "Broker-returned reserved references can raise uncaught errors." T080 reserves the env: and keyring: forms for the built-in resolver. A broker whose intake answer carried a reference in one of them would make the next declaration of the record see two resolvers. The console's intake route replaces the reference outside the handler that catches a refused binding, so there it would be an uncaught error. hand_off_credential now refuses such an answer as malformed (DIAG_BROKER_MALFORMED), which both entry points already catch. serve_workbench.py is left alone. - "Keyring failures retain exception context." The resolver raised its keyring refusal inside the handler, "from None", which hides the backend's error but keeps it as __context__, together with the backend's frames. The refusal is now raised after the handler, with no context. One new case with two real broker scripts, and one assertion added to the failing-backend case. Two mutants were each killed. Arc: neutral-product-standalone-operability Lane: openxfactory-4 (openXfactory-4-openDox_extraction) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…T080) A broker binding over plain http:// to any host but this one is now refused when it is declared, with the one ENDPOINT_NOT_PRIVATE sentence a built-in credential earns on the same route. `mint` asks the same predicate before it asks the broker for anything, as the built-in resolver does before it reads, so a binding forced past the record still mints nothing. Only the auth kind `none`, which presents no credential, keeps a route that is not private. This is the first of the four broker-path gaps openDox-code#63 listed for Brett. His word of 2026-09-29, given in-session on #63's closing question: "Yes, separate phase-3 draft (Recommended)". The T080 ruling it extends is recorded at openxFactory#656 comment 5880893901. ENDPOINT_NOT_PRIVATE now names both credentials. T080's two route lists become shared parametrize marks, so the broker cases reuse them and T080's node ids do not change. T080's case that pinned the old scope (a broker binding declared on these routes) keeps only its `none` half, over all nine. Tests: 17 broker cases and 9 `none` cases added, 2 removed. With T080's head 3f14bb9 as the source, the 11 gap cases fail (DID NOT RAISE) and the 15 controls pass. Arc: neutral-product-standalone-operability Lane: openxfactory-4 (openXfactory-4-openDox_extraction) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…hains nothing Gaps 2 and 3 of the four broker-path gaps openDox-code#63 listed for Brett, closed with T080's own rules for a built-in credential (his word of 2026-09-29, given in-session). One port method, `_call_provider`, now makes every provider request, on both paths. A request that carries a credential (a broker's minted token, or what the built-in resolver read) goes through `_open_with_a_credential`, which is T080's opener renamed. It declines every redirect, and over plain http:// it uses no proxy. Its refusal is raised afresh, with no cause and no context. The auth kind `none` presents nothing, so it keeps the default opener and its refusal's chain, 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. DIAG_PROVIDER_REDIRECTED and the redirect handler now name both credentials. Measured at T080's head 3f14bb9, over real sockets and a real broker child: - a POST answered 301, 302 or 303 reached the redirect's target as a GET that carried the token; - with http_proxy set, a request to 127.0.0.1 went to the proxy with it; - 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. Tests: 12 broker cases. With 3f14bb9 as the source all 12 fail, and T080's two refactored cases pass. T080's redirect and proxy cases now share their scaffolds with the broker's (`_a_provider_that_redirects`, `_an_environment_proxy`). The proxy scaffold drops urlopen's cached global opener, so the proxy environment is read the way a process started with it reads it. The ENDPOINT_NOT_PRIVATE sentence is rewrapped, with the same text. Arc: neutral-product-standalone-operability Lane: openxfactory-4 (openXfactory-4-openDox_extraction) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…keeps it Gap 4 of the four broker-path gaps openDox-code#63 listed for Brett, closed with T080's own rule for a built-in credential (his word of 2026-09-29, given in-session). `mint` now asks `_presentable`, the built-in resolver's own test, of the token: non-empty printable ASCII with no whitespace. Any other token is a malformed answer (DIAG_BROKER_MALFORMED). It is refused before the port holds it or any provider is contacted, so the catalog reads unavailable and no mint is recorded. At T080's head 3f14bb9: - a token outside latin-1 failed inside urllib as DIAG_PROVIDER_UNREACHABLE, which names the wrong party, with do_open.headers and putheader.values holding it; - one with a space or another non-ASCII character was sent as it was. The refusal keeps no frame that holds the token, as the built-in resolver's refusal of an unpresentable value keeps none. `mint` reads the answer through `_minted_token` and raises any refusal again, afresh, after the answer has left its frame. That covers every refusal of the mint answer, which goes one step past the fourth gap's letter: a malformed answer beside a good token also kept it at 3f14bb9 (mint.answer, mint.document, _answer_document.text and _answer_document.document). Not changed: the broker runner's own refusals (a non-zero exit, an answer past the bound, a timeout) still keep what a misbehaving broker wrote. The runner is shared by all four broker operations and sits outside the provider call the ruling names. The PR flags it for Brett. Tests: 15 cases. With 3f14bb9 as the source the 13 gap cases fail, and the 2 controls pass (every printable ASCII character but the space is presented unchanged; the declared answer mints). 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 two unpresentable-token literals outside ASCII are written as backslash-u escapes, as the rest of this module writes them, so the source adds no non-ASCII character. The gap-1 control and the operator door's case each gain a line saying what they hold. The `none` case says how T080 once pinned its scope there (two routes, with a broker binding). No test changes what it runs. Arc: neutral-product-standalone-operability Lane: openxfactory-4 (openXfactory-4-openDox_extraction) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Reviewer's GuideHardens broker-minted credentials by extending T080’s private-route, redirect, proxy, token-presentability, and clean-refusal rules from built-in credentials to the broker path, centralizing provider dispatch and adding comprehensive regression and traceback-hygiene tests. Sequence diagram for broker token minting and protected provider dispatchsequenceDiagram
participant Binding as ModelProviderBinding
participant Port as BrokeredProviderPort
participant Broker as Broker
participant Provider as Provider
Binding->>Binding: is_a_private_route(endpoint)
alt route is not private
Binding-->>Port: BindingRefused(ENDPOINT_NOT_PRIVATE)
else private route
Port->>Broker: mint(binding)
Broker-->>Port: minted token
Port->>Port: _minted_token(answer, binding)
alt token is not presentable
Port-->>Port: BrokerRefused(DIAG_BROKER_MALFORMED)
else token is presentable
Port->>Provider: _call_provider(token, model, prompt)
alt redirect or refusal
Port-->>Port: BrokerRefused(DIAG_PROVIDER_REDIRECTED or refusal)
else provider response
Provider-->>Port: prose
end
end
end
State diagram for broker token lifecyclestateDiagram-v2
[*] --> RouteChecked
RouteChecked --> RefusedRoute: not private
RouteChecked --> BrokerAsked: private route
BrokerAsked --> AnswerValidated: mint answer received
AnswerValidated --> RefusedMalformed: token not presentable
AnswerValidated --> TokenHeld: valid token
TokenHeld --> ProviderCalled: _call_provider
ProviderCalled --> RefusedRequest: redirect or credential refusal
ProviderCalled --> TokenExpired: _TokenExpired
TokenExpired --> BrokerAsked: re-mint
TokenExpired --> RefusedExpiredTwice: retry token expired
ProviderCalled --> [*]: prose returned
RefusedRoute --> [*]
RefusedMalformed --> [*]
RefusedRequest --> [*]
RefusedExpiredTwice --> [*]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
Security-sensitive credential handling and unlanded stacked dependencies require final human review.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Hardens broker-minted credentials to match built-in credential protections.
Changes:
- Enforces private routes for credential-bearing bindings.
- Blocks redirects/proxies and removes exception chains containing credentials.
- Validates minted tokens and expands regression coverage.
| File | Description |
|---|---|
src/opendox/doxbench_binding.py |
Applies private-route rules to broker bindings. |
src/opendox/doxbench_provider.py |
Secures token minting and provider requests. |
tests/test_model_provider_broker.py |
Adds route, transport, validation, and leakage tests. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Copilot's review of openDox-code#64 at af457e6 (thread 4133295457): the docstring's "301, 302 or 303" wrapped so that it read as repeating 303, and "a 307 or 308 read as the provider refusing" was hard to parse. It now says that at T080's head urllib followed only the 301, 302 and 303 codes, with a GET that still carried the token, and refused a 307 or a 308 with DIAG_PROVIDER_REFUSED, as the base probe measured. No test changes what it runs. 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 openDox-code#64 at a2c838a (thread 4133360345): `_parse_expires_at` let an integer past a float's range escape as an OverflowError, and took NaN and the infinities as an expiry. `mint` re-raises only a BrokerRefused afresh, so the OverflowError escaped with the answer still in its frames. That defeats this PR's rule that no refusal of a mint keeps the answer. A NaN or infinite expiry also minted a token that would never expire, or would always have expired. An expiry must now be a finite number, or an ISO-8601 instant as before. Anything else is a malformed answer (DIAG_BROKER_MALFORMED), which `mint` raises again holding nothing. The same measurement found one more escape of the same class: arrays nested past the recursion limit fit inside the 64 KiB answer bound (30,000 of them in 60 KB), and json.loads' RecursionError escaped `_answer_document`. That is now malformed too, for all four broker operations. Tests: 5 cases join the malformed-answer case (an expiry past a float, NaN, Infinity, -Infinity, and an answer nested past the limit), and each answer is held inside the runner's bound. With 3f14bb9 as the source all 8 of that case's params fail. Three mutants are killed: the finite check removed (4 fail), the overflow left to float() (1), and RecursionError not caught (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>
|
|
READY at 04bcb68 — phase 3 is open (T063 landed, #1218 → a883bbf6); T080 landed (#63 → 1130e99); T072 landed (#69 → 5e7ab00). The holder merged main 5e7ab00 into the branch with update-branch (04bcb68, parents e313437 and 5e7ab00) because SonarCloud never analysed e313437; at 04bcb68 validate and SonarCloud are green, Copilot's latest review at exactly 04bcb68 has no "Changes recommended", 0 unresolved threads, and no closing keywords in the body or any commit. Stack B's rounds: the broker path keeps a built-in credential's rules (L4 fresh raise, no key or token in kept frames; Q2 a refused answer kills the broker's group while it is unreaped; Q3 not refactored). Dependent #82 (T100) is retargeted to main and is not READY. Brett: draft phase 3 ahead, land in plan order when green. Lane: openxfactory-4 (openXfactory-4-openDox_extraction) |
There was a problem hiding this comment.
Sorry @brettheap, you've used your own review budget of 250,000 diff characters for the last 7 days.
You can request another review in 4 days and 3 hours by commenting @sourcery-ai review. Upgrade to get a review now.
Brings in #69 (T072, the bundled PostgreSQL server and the `local` extra), #73 (T075) and #64 (broker-path credential hardening). No file this branch edits changed on main; the merge is clean. Arc: neutral-product-standalone-operability Lane: openxfactory-4 (openXfactory-4-openDox_extraction) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
main 90ac703 is #72's squash over 8e37782, which brings #73 (T075, the served bundle) and #64 (broker-path credential hardening). The tree is written with `git merge-tree --write-tree --merge-base 93f77dc`, #72's final pre-squash head and already merged here, so the squash's copy of T073 is not merged a second time. Both parents are recorded. 90ac703's tree equals 93f77dc merged onto 8e37782 over 5e7ab00, so the squash carries T073 exactly. Merged, never rebased. Lane: openxfactory-4 (openXfactory-4-openDox_extraction) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…kflow Arc: neutral-product-standalone-operability Lane: openxfactory-4 (openXfactory-4-openDox_extraction) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
#77 moved from ebe0a35 to d556c3f. The move brings main 90ac703, where T073 (#72) landed as a squash, together with #64 and #73. #77 now bases on main. The move touches no file under src/opendox/web/ and not the census, so the merge is clean. Merged, never rebased. Arc: neutral-product-standalone-operability Lane: openxfactory-4 (openXfactory-4-openDox_extraction) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ith #69) Merged, not rebased. 04bcb68 is #64's last head before it landed as 8e37782: stack B's e313437, and the holder's update-branch merge of main 5e7ab00, which carries #69 (T072). The one conflict is _broker_operation's docstring, where each side added a paragraph. Both are kept, #64's on the subprocess runner's in-place read and then T100's on the trust verdict, and the trust check stays FIRST, before `argv = broker_operation_argv(...)` and before either runner's branch. #69's config.state_dir is now on the base, so the case that reads the setting runs and passes: its strict xfail is dropped, and .github/workflows/validate.yml's EXPECT_SKIPPED steps back from 13 to 12, with its reason. #77's case is the one that remains. 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 base #64 landed as the squash 8e37782, so main's history no longer contains the pre-squash commits this branch merged. The merge is computed with #64's final pre-squash head as its base, `git merge-tree --write-tree --merge-base 04bcb68 HEAD 8e37782`, so only what main added after that head arrives (#73, T075), and #64's own lines are not offered twice. Both parents are recorded. It merges cleanly. After it, this branch's diff against main is T100's own files only. Arc: neutral-product-standalone-operability Lane: openxfactory-4 (openXfactory-4-openDox_extraction) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…_reach retired (plan 034) (#77) 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` `2140f5a7`), phase 3: - **T084, the last deferred reaches** (#1144's 4.3, with T007's batch G and batch L addenda). - **Realizes:** 4.3. - **Falsifiers:** - F4.1 whole; - `tests/test_capability_honesty.py` (new); - `tests/test_rejection_report.py` (new). - **After:** T073 (openDox-code#72, landed as `90ac7033`), for `serve.py`'s single-writer order T055 → T073 → T084, and T070 for `cli.py`'s, T070 → T084. - **Based on `main`**, retargeted by the holder once T073 landed, so this diff is T084 alone: its own 28 files, the same list as `93f77dc1..7536bfe`. - While it was stacked on #72's branch, #72 was merged in at each of its moves, never rebased: `620bee27` at `b333bf16`, then #72's final pre-squash head `93f77dc1` at `7536bfe2`. That head carries #69's final pre-squash head `c04690f8` and openDox-code `main` `5e7ab003` (#69's squash). Through stack A it also carries T085 (#71), T088 (#65), T071 (#60), T078 (#61), T070 (#67), T079 (#62) and T081 (#74). - After #72 landed as the squash `90ac7033`, `main` was merged at `d556c3fb` with `git merge-tree --merge-base 93f77dc`, recording both parents, so the squash's copy of T073 is not merged twice. `90ac7033`'s tree equals `93f77dc1` merged onto `8e377823` over `5e7ab003`. Through `main` this branch also takes T075 (#73) and the broker-path hardening (#64). **Ruled:** - R1Q1 (a), R1Q22 (a), `5817152735`; - R1Q10 (a), `5850003126`; - items 1 and 3 of `5920216845`; - the model approval: Brett Heap, 2026-10-02, "Refuse by name, hide intake (Recommended)", confirmed at `5961364221`, item 1; - the chat scope: `5961651355`, "Tile's own documents editable (Recommended)"; - drafted now: `5960162524`. Claimed on openxFactory#656 in [`5960235138`](opensoft/openXfactory#656 (comment)). T063 has landed (openxFactory#1218 → `a883bbf6`), and T073 has landed (openDox-code#72 → `90ac7033`). The holder posts READY and the landers merge. ## F4.1 whole At this branch's base (T073's `bb05e3d7`, before T084), the scan lists eleven reaches: ``` AssertionError: 11 deferred reach(es) still name the consumer or the publisher: src/opendox/branch_session.py:1592: openxdox.register src/opendox/branch_session.py:2010: openxdox src/opendox/serve_project.py:271: openxdox.gate_console src/opendox/serve_project.py:272: openxdox.kickoff src/opendox/serve_workbench.py:1219: openxdox src/opendox/serve_workbench.py:1669: openxdox src/opendox/serve_workbench.py:2611: openxdox src/opendox/serve_workbench.py:351: openxdox src/opendox/serve_workbench.py:411: openxdox src/opendox/serve_workbench.py:412: openxdox src/opendox/serve_workbench.py:548: openxdox ``` `src/opendox/consumer_reach.py` was present. At `b333bf16`, and again at `d556c3fb` after the merge of `main`: ``` no deferred reach names the consumer or the publisher ``` `src/opendox/consumer_reach.py` is absent. `tests/test_projection_seams.py::test_the_stand_ins_module_is_retired` holds the absence. ## What it does, commit by commit 1. **Every broken rule, once** (`5920216845` item 3). `cli._report_non_conformance` prints each broken rule id once, with its count and up to five of the places it is broken, then the validator's other lines. - `tests/test_rejection_report.py` (new) covers a snapshot that breaks one rule several times and a second rule once. - Before: 3 failed, 1 passed. After: 6 passed. - Mutants killed: always prints `1` (5 failed), never groups (5 failed), drops the places (3 failed). 2. **Capability honesty** (`5920216845` item 1). `compute_capabilities(route_bindings=)` sets `gate` true only where a contributed binding answers `POST /actions/gate/<verb>`, and `refresh` true only where one answers `POST /actions/refresh`. A standalone server reads both false. - Before, at `047bb4fa`: a standalone server with an identity answered `gate` and `refresh` true, and both routes answered `404 unknown_action`. The module's 20 cases then: 20 failed. After: 20 passed. - Mutants killed: - gate ignores the routes: 4 failed; - refresh ignores the routes: 4 failed; - a predicate that is always true: 5 failed; - every flag off: 6 failed; - gate drops the actor: 1 failed. 3. **The consumer columns' seams.** `opendox.column_seams` declares four seams in `projection_seams`' discipline: `gate`, `scope`, `kickoff` and `register`. `opendox.default_columns` holds openDox's own default for each (R1Q10 (a)). The four entry points register them where no host has, beside `projection_seams`' defaults. - The gate default carries the vocabulary-free primitives as real code. - The governed record functions refuse BY NAME (`GateRecordsNotRegistered`, naming `opendox.column_seams.gate` and its registration call). openDox writes no governed shape it does not own. This is the holder's reading (B). 4. **The routing.** Every reach above now reads its seam: - the chat turn's and the document abstract's scope authority (the abstract's reach moves below its step-1 check); - the thread read's live-session question; - the first-edit Save gate; - model approval; - the project register's prefix and kickoff readers; - `branch_session`'s gate, register and kickoff; - `cli`'s `gate_mod`. The scope value types are openDox's own (`doxbench_scope_types`). 5. **A tile's own documents are editable** (`5961651355`). This supersedes the holder's read-only reading. The neutral scope marks each section a tile projects as owned, as openXdox's authority marks its owned sections: a group's members, a selection's files, and a candidate's claiming groups' members. The set is ONE named function, `default_columns.editable_paths`. Nothing outside the tile is editable, an unresolved row is not, and neither is a created path. 6. **`opendox --help` names the installed command and openDox only.** This is the holder's addition, found by T099's PyPI writer. T084 is `cli.py`'s last phase-3 writer. - The installed help printed `usage: ideation-dashboard` and `cli.py`'s module docstring, which is openxFactory's pre-carve history ("validates it against the pinned openxFactory validator", `python3 -m ideation_dashboard.cli`). - `cli.PROG = "opendox"`, and `PARSER_DESCRIPTION` and `PARSER_EPILOG` are neutral. - Two subcommand help lines in the same listing lose their internal words: `create` ("ideation doc" becomes "document") and `runtime` (drops "(split-opendox § 3.5)"). - `tests/test_installed_help.py` (new) runs the INSTALLED console script, after checking that its entry point is `opendox.cli:main`. It asserts `usage: opendox` and no openxFactory, xFactory, ideation-dashboard, split-opendox or `scripts/` wording. - Before: 3 failed. Mutants killed: the prog reverted, 3 failed; the description back to `__doc__`, 3 failed. 7. **The static bundle's content types are pinned.** This is **the holder's addition**: T084 is `serve.py`'s last phase-3 writer. It comes from T075's finding on openDox-code#73 and realizes 10.2, "reachable in a browser from an openDox-only install". - The static route's `guess_type` reads `extensions_map` first, and the platform's `mimetypes` table only after it. A host whose table maps `.js` to `text/plain` serves every ES module as text, and a browser refuses to run it. Windows reads its table from the registry. - `serve.STATIC_CONTENT_TYPES` pins every extension the bundle ships, measured from a built wheel: 41 files under `opendox/web/`, 39 `.js`, one `.html` and one `.css`. It also pins `.mjs`, `.json`, `.svg`, `.png`, `.ico` and `.woff2`. - Each value is the standard library's built-in one. `.woff2`, which that table lacks, takes its registered type (RFC 8081). - Any other extension falls back to the platform table. 8. **`consumer_reach` is retired.** `LateGateRoutes` and `LateProjectionRoutes` leave `DashboardHandler`'s bases. The gate and projection columns are a host's, composed in through the handler-contribution facet beside the bindings that name their methods (R1Q1 (a)). A host that contributes a binding without its column is refused at wiring, before a socket. openXdox contributes both columns that way at T086. ## The three crash sites, and a fourth `tests/test_capability_honesty.py` runs a standalone `python -m opendox.serve` child with neither sibling importable. Each site gets a structured answer, never `RemoteDisconnected`: - the document abstract: `model_capability_unavailable` at step 1, now that `gate` reads false; - model approval: `approval_refused`, with the sentence naming the gate seam (see below); - `GET /project-register.json`: today's 404 "no project register", from openDox's own kickoff default; - the chat rail's **thread read**, with the exact query the rail sends on opening a document (`repository=fixture&ref=main&tile_kind=cluster&tile_id=barrel-rain&document=<member>`, `views/staging-workbench.js` `loadThread`): the stated no-session absence. T095's AT-R1 harness found this site on openDox-code#75. A query-less GET stops at the 400 check first, which is why batch L's measurement missed it. Composed in-process hosts take the chat turn and the document abstract past their early checks, to the scope step that dropped the connection. The answer is a refusal in the released envelope. **Before** (`a39e0201`, the routing files at their pre-routing state), each of these fails with `http.client.RemoteDisconnected: Remote end closed connection without response`: - the crash sites; - the composed chat turn; - the composed abstract; - the host approval; - the thread read. Before, too, the standalone intake surface read `offered: true`. It now reads `offered: false`, with the reason (next section). ## Model intake and approval (Brett Heap, 2026-10-02; `5961364221` item 1) The enrolment ends in a recorded approval, a governed gate-action record that only a HOST's gate writes. With no host's gate registered (`column_seams.gate_records_writable()`): - `GET /workbench/model-intake` answers `offered: false` with `column_seams.GATE_RECORDS_REFUSAL` as its reason, even beside a hand-written broker block; - the intake act refuses with that sentence, before a broker is spawned or a declaration is written; - so does the approval, before a record is built; - each drains the body it was sent, so the refusal survives its transport. The order is: no gate-record writer first, then no broker. A composed host that registers its gate is offered the flow, and its approval is recorded before the declarations document moves. Mutants of the predicate killed: always true, 3 failed; always false, 2 failed. **Known, and out of this PR's scope:** - `declared_model_port_factory` serves only the FIRST approved binding (`approved[0]`). - An approval's `expires_at` is recorded and not enforced. ## The chat scope (`5961651355`) `tests/test_neutral_turn_scope.py` (new) runs over a composed host: the plain fixture, a loopback bind, an authenticated actor, the binding `opendox model-binding add` declares, and the port the entry points declare over it. The host also has the released validators, as a plane with a readable contract has them. - A turn over cluster `barrel-rain`'s own document passes the guard and reaches the model step. It answers `model_unavailable`, because it names a model the catalog lacks, so nothing is spawned or contacted. - A turn over a corpus document outside the tile is refused `turn_scope_refused`. - Save is still the gate's: `POST /actions/gate/first-edit` answers `unknown_action`, and the record a Save writes is refused naming `opendox.column_seams.gate`. - **Standalone** (case 4, a `python -m opendox.serve` child with a binding configured): the same turn passes the guard and reaches the model step, `model_unavailable`, with openDox's own validators (T085, merged in at `3387293e`) and no stand-in. Until that merge the case asserted only a structured answer, as the holder accepted, and the merge commit narrowed it. `tests/test_capability_honesty.py`'s standalone turn with a binding configured likewise now asserts the scope step's `turn_scope_refused`. Before (the read-only default): 9 failed. The own-document turn answered 403 `turn_scope_refused`. Mutants killed: - widen the editable set to every corpus document: 7 failed; - empty it: 9 failed; - widen the tile itself to the corpus: 2 failed, including the outside-tile turn. ## The content types `tests/test_static_content_types.py` (new): - under a hostile table (every guess `text/plain`), every bundle file keeps its pinned type; - an extension outside the pin still reads the platform table; - the pinned types are the standard library's built-in ones; - every extension the bundle ships is pinned. Mutant killed: drop the pin, 2 failed. Under the hostile table, `index.html` and every `.js` were served `text/plain`. ## The suite **The whole suite, locally** (`LANG=C.UTF-8`), at `213344ad`: `tests/` `3026 passed, 11 skipped`, and `tests_runtime/` `632 passed, 166 skipped`. The skip count is unchanged from T073's. The database-backed cases skip locally without `OPENDOX_TEST_DATABASE_URL`. No new case skips, so `EXPECT_SKIPPED` does not move. As #67, #69 and #72 did, this PR does not edit `validate.yml`. `tests/test_consumer_reach.py` keeps its direction census. Its `CONVERTED_SITES` guard is retired into `tests/test_projection_seams.py`'s import-time rule, which now holds the column seams' proxies. `opendox.consumer_reach` leaves `NEUTRAL_MODULES`, the census "a removal from which has to be argued for". The argument: the module no longer exists. ## Fix round 1 (`b1db1965`, Copilot's review at `897029d8`) - **A seam registration with the names but not their shape is refused at registration** (r4170607959, r4170608011). `projection_seams._Seam` gains an optional `shape` check, run after the name probe in `register()` and `register_default()`. - `column_seams.gate` requires `GateRefused` to be an exception class, because openDox's verbs catch it. - `column_seams.register` requires `CrossReferenceIndexAdapter` to carry a callable `discover`, because `branch_session` calls it. - Mutant killed: skip the shape check, 2 failed. - **`tests/test_column_seams.py`'s docstring** now describes the scope default as the ruling made it (r4170608087). - **This body's crash-sites section** now states the intake surface's before and after (r4170608052). ## Fix round 2 (`ff70ac1e`, Copilot's review at `3387293e`) - **A gate verb on the default gate is refused, not a traceback** (r4170914922). openDox's own gate default refuses the governed `GateConsole` at construction, and `cli._commission_cli` built the console before its `try`. A contributed gate verb that reached the default with no host's gate registered therefore ended in an uncaught traceback. The console is now built inside the refusal boundary. - `tests/test_column_seams.py::test_a_gate_verb_on_the_default_gate_is_refused_not_a_traceback` asserts exit status 1 and `propose refused: ...`, naming `opendox.column_seams.gate.register(`. Before (`3387293e`): an uncaught `GateRecordsNotRegistered`. ## Fix round 3 (`ebe0a35f`, Copilot's review at `1d6a4f19`) - **A group's edges name documents by id, and the scope projects them by path** (r4171136778). - A group's `document_edges[].document` names a document by ID, and a selection's `files` by PATH (the snapshot schema's `$defs/id` and `$defs/path`). openDox's default scope looked every reference up as a path. - So a valid snapshot with id `notes/soil-test` and path `notes/soil-test.md` left every group and candidate member unresolved, with empty editable and context sets, and valid turns were refused. - The fix: `default_columns._document_index` maps each listed document's id, then its path, to the document's path, as openXdox's authority does. `_section` looks each reference up there, carries the document's path (confined to the root as before) and keeps the reference as the row's id. - A reference that no listed document answers stays unresolved under its own spelling, which must still be a safe path, so the confinement cases are unchanged. - `tests/test_column_seams.py::test_a_group_edge_names_its_document_by_id` covers a snapshot whose ids differ from its paths. Before (`b333bf16`): failed, with `editable_paths` `()` where `('a.md', 'b.md')` was expected. Mutant killed: references looked up as paths only, 1 failed. ## Fix round 4 (`1fb81cbd`, Copilot's review at `d556c3fb`, the holder's ruling: ACCEPT both) - **A selection's files are paths and a group's edges are ids, looked up apart** (r4173844321). - Fix round 3's index answered every reference id first, and it also served a selection's `files`, which are PATHS. The contract does not forbid one document's path from spelling another document's id. - `_document_index` now returns `_DocumentIndex(ids, paths)`. `ids` (id first, then path) serves group edges and a candidate's claiming groups. `paths` (path only) serves a selection's files. - `tests/test_column_seams.py::test_a_selection_file_is_a_path_where_it_spells_another_documents_id`. Before (`d556c3fb`): failed, resolving to `a.md` where `sel.md` was expected. Mutants killed: the files looked up as ids (1 failed); the edges looked up as paths (2 failed). - openXdox's authority (`openxdox/doxbench_scope.py`) still answers a selection's files from its one id-first map. Whether it follows is outside this PR. - **The server's help names loopback as the default, not a promise** (r4173844338): "on a loopback address unless --host names another", with no "locally". `tests/test_installed_help.py::test_the_servers_help_states_loopback_as_the_default_bind`. Before: failed. Mutant killed: the `--host` clause dropped, 1 failed. ## Fix round 5 (`213344ad`, Copilot's review at `1fb81cbd`, the holder's ruling: ACCEPT both) - **An in-root alias of a settings document is the settings document** (r4173903232). - `resolve_within` follows a symlink to the canonical file, but a scope row keeps the spelling it was named by. So `alias.md -> ideation/dashboard/model-provider-bindings.yaml`, or a directory link on the way to one, stayed owned and editable, bypassing M1. - `default_columns._settings_test(root)` now compares the file a row REACHES with the files the settings documents reach. `_without_settings` moves such an alias, under its own name, into the `settings` section that nothing owns: readable, never editable. - `tests/test_column_seams.py::test_an_in_root_alias_of_a_settings_document_is_never_editable` tests a file alias and a directory alias. Before (`1fb81cbd`): 2 failed, e.g. `('a.md', 'b.md', 'alias.md')` where `('a.md', 'b.md')` was expected. Mutants killed: the target comparison dropped (2 failed); the alias compared by spelling (2 failed). - **The typeless package marker is set aside by its reason** (the review's "previously missed" note on `tests/test_static_content_types.py`). - `UNSHIPPED` claimed the wheel leaves `.gitkeep` out, but since T075 it ships (`web/**/.*`). It is renamed `TYPELESS_MARKERS`: the shipped, empty, extensionless marker has no content type to pin. - `test_the_set_aside_markers_are_empty_and_extensionless` holds that reason. Mutant killed: the set widened to `index.html` (2 failed). ## Adversarial review 2 (at `b1db1965`), folded in Each item has a case that failed before its fix, and a mutant that fails it. - **M1, openDox's own settings documents are never a tile's editable material** (`5a3b51ee`). - The model-provider bindings (`doxbench_binding.DEFAULT_BINDINGS_RELPATH`) and the model declarations (`doxbench_intake.DEFAULT_DECLARATIONS_RELPATH`) live in the checkout, so a tile can name them. Under `5961651355` a group listing one made it editable, and a turn's proposal could then rewrite which provider a chat talks to. - `default_columns.SETTINGS_DOCUMENTS` holds both. `resolve_scope` moves them out of every owned section into a trailing `settings` section that nothing owns, so they stay readable. `editable_paths` refuses them whatever section carries them. - The corpus scan's own exclusion (openDox-code#76) is a second layer, not the only one. - Before (`1d6a4f19`): 3 failed. Mutants killed: the function admits settings (1 failed); settings left in owned sections (2 failed). - **L1, an unknown `tile_kind` is a malformed request, never a dropped connection** (`278855d4`). `ScopeKey` refuses one with a `ValueError`, which escaped three routes. Each now answers its fixed code: - the thread read: `invalid_turn_request`; - the document abstract: `invalid_abstract_request`; - the chat turn: `invalid_turn_request`, in the released envelope. - Before (`5a3b51ee`): 3 failed, each `RemoteDisconnected`. - **G7, `generate-and-open` removes the run directory it minted** (`5a9cb0d8`). - With no `--run-dir` it minted `ideation-dashboard-*` and never removed it. Now it mints `opendox-*` (`cli.RUN_DIR_PREFIX`) and removes it when the run ends: a served run stopped by an interrupt (and, in a local install, by SIGTERM), a `--no-serve` run, a refusal, a failure. - A `--run-dir` the caller names is kept. - `tests/test_run_dir_lifetime.py` (new). Before (`278855d4`): 2 failed. Mutant killed: the minted directory kept, 2 failed. - **Known Release 1 limit, accepted by the holder:** a HOSTED run killed by SIGTERM leaves its `opendox-*` directory, because hosted mode installs no SIGTERM handler. A local run reads SIGTERM as an interrupt and cleans up. - **`python -m opendox.serve --help` names openDox only** (`6519660e`). This is the same fix as `opendox --help`, for the server entry point's parser. - `serve.SERVE_PROG = "python -m opendox.serve"`, and `SERVE_DESCRIPTION` is neutral. - Before (`278855d4`): 1 failed. Mutant killed: the prog reverted, 1 failed. - **Not here:** M4 and L2, the DNS-rebinding Host check on every route, belong to **T103**, a new writer stacked on this PR. M2 is #74's writer's, and M3 is covered by the turn patch below. ## Merges, done and ahead - **T085 (#71), merged at `3387293e`.** It conflicted only where measured: `cli.py` and `serve.py`, at the four `register_defaults()` call sites and one import. Both sides are kept, T085's `doxbench_defaults` first and T084's `column_seams` after. - T084's own turn tests needed T082's patch, checked and not taken blind: the turns carry the schema-required `last_assistant_turn_id`, and `_structured()` reads the released failure envelope. Without it, both standalone turns failed with 400 `invalid_turn_request`. - **T088 (#65), merged at `3387293e`,** with the ruled one-line edit in `tests/test_lens_seed_actions.py`: `capabilities["actions"]["gate"] is False` in both runs, with the identity asserted on the resolved `actor` field. - **T070 (#67), T079 (#62) and T081 (#74), merged at `b333bf16`** through stack A's merges of main and #72's merges of #69. - T081's hoisted no-model refusal and this task's scope seam sit two unchanged lines apart in the chat turn, and both are kept. - T082's second patch, which moves `tests/test_chat_model_configuration.py`'s `openxdox` stand-in to a scope authority registered at `opendox.column_seams.scope` (restoring the seam's state exactly), no longer applied once the landed file had moved. It is applied by hand and checked: before, 4 failed and 45 passed; after, 49 passed. - **T073 (#72), its final pre-squash head `93f77dc1`, merged at `7536bfe2`,** a plain merge with no conflict. It brings #69's final rounds (17, 18a and 18b, through `bc85f214`), `main` `5e7ab003` (#69's squash, merged on #72 with `merge-tree --merge-base c04690f`), and #72's Copilot fix round (`BundledServer.report()` reads the process once). - **`main` `90ac7033` (#72's squash), merged at `d556c3fb`** with `git merge-tree --write-tree --merge-base 93f77dc`, recording both parents (`7536bfe2`, `90ac7033`), with no conflict. It brings T075 (#73) and the broker-path hardening (#64), whose `doxbench_binding.py` and `doxbench_provider.py` changes merge clean with T084's. The F4.1 scan stays clean. ## Holder readings in this PR (Brett may overrule) - **The gate default:** primitives as real code, governed record functions refused by name, (B). - **kickoff and register:** answer nothing, and `/project-register.json` keeps its 404. - `hosted_ref_refused` stays `serve.py`'s own. - **The content-type pin** is the holder's addition for 10.2. - **The neutral `opendox --help`** is the holder's addition, from T099's finding. 🤖 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>
…plan 034) (#82) Lane: openxfactory-4 (openXfactory-4-openDox_extraction) Arc: neutral-product-standalone-operability **Plan 034 T100. #1144 box 16.3a: a served repository's bindings are trusted per machine.** RULED by Brett Heap on 2026-10-02 in openxFactory#656 comment `5962785556`, item 2: *"Trust per machine (Recommended)"*. The text this conforms to is T007 batch M (openxFactory#1219, merged as `cc775fea`): box 16.3a and F16.1's batch M block. What openxFactory registers when it hosts openDox was RULED on `5970369724`; that registration is T094's (below). Phase 3. The base is `main`. T100's After line (T080, openDox-code#64 and T084) is met: #64 landed as `8e377823`, and #77 (T084) as `e49b17c3`. - This branch merged #64's final pre-squash head `04bcb68e`. - It then merged `main` `8e377823` with `git merge-tree --merge-base 04bcb68`, both parents recorded. - It then merged `main` `e49b17c3` (#77), `390e2c28` (#80), `0116293a` (#81), `c4b55cc4` (#85) and `ca9e1bd5` (#76) with ordinary merge commits. The branch held none of #81's, #85's or #76's commits. Nothing was rebased. The diff against `main` is T100's 12 files only. ## The defect The entry points read the bindings document of the repository they SERVE (`declared_model_port_factory` over `bindings_path(checkout_root)`). A binding written into that file by hand, or arriving with a clone, needed no approval. The adversarial review of 2026-10-02 showed two things: - A committed `broker_argv` of `["/bin/sh", "-c", "id > $PWD/pwned"]` ran on the first chat turn. - A committed `env:` reference sent an unrelated secret of the operator's to the file's endpoint as a bearer token (`repo_binding_exfil.py`). The first two cases of `tests/test_model_binding_trust.py` are those two findings, run as the review ran them. On `main` `8e377823` without this change, they fail for the defect's own reasons: ``` AssertionError: the endpoint was contacted, and was sent ['Bearer cloud-secret-NOT-A-MODEL-KEY-7d41e9a2c0b85f36'] AssertionError: the repository's program ran: uid=1000(brett) gid=1000(brett) groups=1000(brett),1001(docker-host) ``` ## The rule, and where it is enforced A binding read from the served repository runs a broker, resolves a credential reference (`env:`, `keyring:` or a broker's), or contacts its endpoint ONLY after the operator has trusted THAT EXACT binding on THIS machine. The auth kind `none` is included, because it still sends chat content to the endpoint the file chose. - **`src/opendox/doxbench_trust.py` (new, standard library only).** - **The key** is (the repository root's resolved path, the binding id, `sha256` of the binding's canonical full record). The canonical record is `as_record()`, every field, sorted, compact, ASCII. So any edit untrusts the binding, and so does the same file under another root. - **The store** is one private file, `model-binding-trust.json`, in openDox's state directory (`OPENDOX_STATE_DIR`, through #69's `config.state_dir`). It holds no credential and is written owner-only, through an exclusive, no-follow temporary file and a rename. - **Its checks.** It is read only once it passes the checks #69's bundle makes of its own tree: no symbolic link, owned by this user, writable by no one else, and every directory above it this user's or root's, sticky where another user can write it. A store that fails a check trusts nothing, and the refusal names it. The store and its lock file are opened without waiting (`O_NONBLOCK`), so a FIFO in either place is refused by the type check on the opened descriptor rather than waited on. - **Its size.** The store writes nothing larger than it reads (`MAX_TRUST_STORE_BYTES`). A record that would outgrow it is refused before anything is replaced, so every trust already held stays held. - **Its lock.** Every record holds an exclusive lock on `model-binding-trust.lock`, beside the store, across its read, its change and its replace. So two processes recording at once keep both trusts, and neither restores a form the other replaced. The lock file gets the same link and permission checks as the store, and is then set to exactly 0600, whatever the umask. Where no lock can be taken, the record is refused by name and nothing is written. Readers take no lock: the replace is atomic. - A state directory equal to the served root, or nested under it, is refused naming `OPENDOX_STATE_DIR`, before anything is written. So is one that cannot be resolved, such as a link loop. - **A platform without the primitives the store needs** has nothing trusted, with a refusal that names the platform and the gaps (`unsupported_platform()`, following #69's form). The primitives are `os.getuid`, `O_DIRECTORY`, `O_NOFOLLOW`, `O_NONBLOCK`, `fchmod`, `mkdir` with `dir_fd`, and `fcntl.flock`. So every verdict reads untrusted rather than raising. - **A link to nothing** on the way to the store, whoever owns it, is refused by name. So is any `OSError` the store's tree raises that no check named: it becomes a `TrustStoreRefused` naming the store and the system's short word for it, in `record` and in `verdict`. - **A binding the model catalog refuses is never trusted** (`unservable_because`). Its id or its label is one the catalog cannot list, so no turn could use it. The check builds the same catalog the factory declares (`brokered_catalog`), and it runs BEFORE any policy is asked: - `verdict_for` refuses such a binding, even under a host policy that trusts every binding or with a store entry recorded earlier. The start declares the refusing port over an empty catalog and never fails. - `recorded_for` refuses such a binding, so `add`, `edit` and `trust` record nothing and write nothing. - Its refusals print no trust command, because trust cannot repair it. They name the actual remedy instead (`REMEDY_UNSERVABLE`): correct the binding with `opendox model-binding edit` (to keep the id) or `remove` then `add` (to change the id). Each of those records trust for the binding it writes. - **Every answer a policy gives is held to the binding AND the root asked about.** - `verdict_for` passes on a verdict for this root that admits exactly this binding, or an untrusted one for exactly this record at this root. Anything else becomes an untrusted verdict for THIS binding at THIS root: - a verdict for another binding, trusted or not; - another form of this one; - a verdict minted for another repository root; - a non-verdict; - a policy that raised. So every refusal names the right binding, root and command, and the per-repository key holds against a host policy too. - `recorded_for` refuses by name (`TrustNotRecorded`) a policy that declines to record, records another binding or root, or raises. It names what a policy raised, never its words. Only openDox's own store's `TrustStoreRefused` passes through as written, and only from exactly `MachineTrust`, not a host's subclass. A host policy's refusal of any class, `BindingRefused` included, is named by its class alone. - **`doxbench_install`.** The factory asks `verdict_for` about the first approved binding (`trust_gated_model_port_factory`). - Trusted: the brokered port, handed the verdict. - Untrusted: `UntrustedBindingPort`. Its catalog lists the binding `available: false`, every dispatch is refused by name, and the factory writes a notice on stderr naming the id and the command that trusts it. - A checkout with no bindings never asks the policy, so it never touches the state directory. - **In depth, `doxbench_provider`.** These all refuse a binding that no verdict covers: - every broker operation (`mint`, `hand_off_credential`, `revoke`, `list_references`), in `_broker_operation`, before the argv is built and before either runner's branch; - the built-in resolver, after its two route assertions and before its first read; - the port's `dispatch` and `catalog`. A verdict covers only the id and digest it was given for. - **`cli_model_binding`.** - `add` and `edit` record trust for the binding they write. They record it FIRST, so a store or a policy that refuses leaves nothing written and nothing printed as "trusted". - `trust <id>` (positional, no `--yes`) prints what it trusts, then records trust for exactly that record: the broker argv it would run, the endpoint, the auth kind and the credential REFERENCE, never the credential. It resolves no reference, spawns nothing and contacts nothing. - **The command every refusal, notice and `list` prints** is `opendox model-binding trust --repo-root ROOT [--bindings DOCUMENT] ID`. It is printed only from operands a POSIX shell reads back exactly (`trust_command`): - an id the catalog accepts: ASCII letters, digits, `.`, `_` and `-`, beginning with a letter or a digit, so no shell expands it and no option parser reads it as an option; - paths quoted by `shlex.quote`, and only where every character is printable. A root that is not printable is never printed: the command names it `.`, to be run from that repository's root. `--bindings` appears where the binding was read from a document given by one (`list --bindings`, or the factory's `bindings_path`). Run as printed, the command trusts exactly the binding it names. - `set-credential` is refused before its broker spawns when the binding is untrusted, and it leaves the binding untrusted. It re-trusts a TRUSTED binding after rewriting its reference. - `list` reads the bindings document ONCE, and derives everything it prints from that reading. It adds two lines per binding: - **trust:** trusted, or why not and the command that trusts it; - **console:** the one binding a console serving this repository declares, by the factory's own rule. A pending declaration is passed over, an unreadable declarations document declares nothing pending, and the console declares the first of the rest. Where `list` was given another document, the line says the console does not read it. - Every value a repository wrote is printed in a JSON string's form, by `list`, `trust`, the refusals and the notice. A newline or `\x1b[2J` in a field cannot forge or hide a line. - **`serve_workbench`.** - A turn on an untrusted binding is refused `model_unavailable` with a FIXED sentence (`UNTRUSTED_TURN_MESSAGE`) saying how to trust it. The catalog's shape is closed, so the reason travels in the refusal, the notice and `list`. Where the catalog cannot list the binding, the sentence is `UNSERVABLE_TURN_MESSAGE` instead, which names the remedy and no command that trusts (`turn_message_for`). Both fit within the released failure envelope's 500-character `message` bound. - **The console's model approval** answers `APPROVAL_NOTICE` ("becomes an available catalog entry") only where the registered trust policy admits the binding it approved. That is a governed host's approval, or a binding this machine trusts. Otherwise it answers `APPROVED_UNTRUSTED_NOTICE`, a fixed sentence saying the binding is not yet trusted and how to trust it. A binding the catalog cannot list is checked first, under any policy and without reading a store, and answers `APPROVED_UNSERVABLE_NOTICE`, which names the remedy and no command that trusts. Approval asks only a policy that is already registered, so where nothing is registered it registers nothing and reads no store. It reads the registration once, under the seam's lock (`registered_verdict_for`), so a host that unregisters meanwhile never has the default installed in its place. - **The console intake follows batch M.** Its hand-off runs a broker the served repository's `ideation/dashboard/model-declarations.yaml` names, and that broker belongs to no binding. So it asks the registered policy its OWN question, `intake_verdict_for`, which no binding's trust can answer. - openDox's strict default (`MachineTrust.intake_verdict`) always says no, refused by name (`intake_refused`, reason `INTAKE_BROKER_UNTRUSTED`, a fixed sentence). That happens before any byte of the body is read, and the body is drained unread. - A host admits the intake only through its own `intake_verdict`, an optional third callable on the seam. A policy without one admits no intake. - So a repository that declares a binding with the intake's exact fields, and gets it trusted, gains nothing. No command trusts an intake declaration's broker. - **The chat rail (`web/views/doxbench-chat.js`).** It has its own visible line, `UNTRUSTED_BINDING_REMEDY` (Python twin `doxbench_trust.UNTRUSTED_BINDING_REMEDY`), beside #74's no-model line. - It shows when the catalog has answered, is not empty, and offers nothing available, and it is announced once. - It names `"opendox model-binding list --repo-root <repository>"`, which shows whether each binding is trusted, and `"opendox model-binding trust --repo-root <repository> <id>"`. It also says that a binding already trusted, which a provider's refusal also leaves unavailable, is unavailable for the reason the console printed when its provider refused. - **`--repo-root` is in every quoted command.** `--repo-root` is required by every `model-binding` verb. Each command a fixed sentence quotes (the refused turn's, the rail's and the approval's) is parsed by the real parser in a test, with its placeholders filled in. - #74's no-model line stays hidden, because a model IS configured. - The sentence says "where it would connect" rather than naming a credential, because `test_doxbench_privacy.py` bans that word from both chat modules. - **Bindings stay committable.** The bindings document is unchanged, and no trust is ever read from it. ## Whose rule: the neutral default, and the seam `doxbench_trust` is a policy seam (`register` / `register_default` / `current` / `policy` / `unregister`), with the same window rule as `projection_seams`: the default is replaceable until it is read, a host over a host is refused, and the same registration again is a no-op. A policy carries `verdict` and `record`, and optionally `intake_verdict`. openDox's strict per-machine store is the NEUTRAL default. **Why the default is registered lazily, which departs from R1Q10 (a)'s entry-point registration** (accepted by the holder): the CONSUMERS register it, the first time one asks and only where nothing is registered yet. Those consumers are `declared_model_port_factory`, the `model-binding` verbs and the intake hand-off. The console's approval is not one of them: it asks only a policy that is already registered. So this PR adds no hunk to `cli.py` or `serve.py`, which stay out of the phase-3 single-writer order. It also fails closed: a bare process is held to the strict default too. A host's registration at process start wins. **How this relates to 4.2's seam tests.** Each seam module's tests enumerate and test that module's own seams: `tests/test_projection_seams.py`, `tests/test_doxbench_seams.py` (the doxBench validators and rail), and #77's `tests/test_column_seams.py` (`SEAMS = (cs.gate, cs.scope, cs.kickoff, cs.register)`). No test enumerates every seam of the package, so none needs this one added. `doxbench_trust.current()` refuses by naming its own seam and the registration call (`TrustPolicyNotRegistered`), as 4.2's discipline asks, and `tests/test_model_binding_trust.py` holds that. `tests/test_consumer_reach.py` derives its record over the whole package and passes with the new module, which imports no sibling. ## What T094 must register RULED by Brett Heap on openxFactory#656 comment `5970369724`, *"Governance approval (Recommended)"*: openxFactory registers its own policy, `GovernedBindingTrust`, as a sixth `seams()` entry with an undo. Under it: 1. A binding whose declaration the governance flow APPROVED is trusted. 2. A binding a repository declared that is still PENDING is refused. 3. A binding with NO declaration is trusted: the operator's own, or the console intake's new binding while its broker runs. 4. Where the declarations document cannot be read, nothing is admitted. 5. `record()` writes nothing. 6. **`intake_verdict` must answer too**, as the policy answers for a binding with no declaration. The console intake asks that question and no other, so without it the governed host's intake would be refused. With it, the intake stays as it is today, which the ruling keeps. `_GovernedHostPolicy` in `tests/test_model_binding_trust.py` is that policy as a test-local stand-in. The tests that compose it in process: - `test_a_governed_host_policy_keeps_the_governed_flow[approved|undeclared]`: the factory resolves the brokered port, and a turn reaches the listener, exactly as before this change. - `test_a_governed_host_policy_keeps_the_console_intake`: the governed intake runs its broker. - `test_a_governed_host_policy_refuses_a_pending_declaration`: the pending and unreadable cases, and `recorded_for` refusing a policy that declines. In the same checkout, the strict default refuses each of these until `trust`, and always refuses the intake. ## Evidence | Run | Tree | Result | |---|---|---| | Red: the final test file with no other change | `main` `8e377823` | 14 failed, 1 passed (`test_the_edits_cover_every_field_of_the_record`), 1 xfailed, 56 errors (`ImportError: cannot import name 'doxbench_trust'`). The two defect cases fail as quoted above. | | Red: each Copilot round's new cases, before their fixes | the code before each fix | Round 1: 8 failed. Round 2: 7 failed. Round 3: 3 failed. Round 4: the 4 new cases failed. One example: the two-process case kept only `first-binding`. | | Red: round 8's cases, before their fix | `42c98f9d` | 2 failed, 1 passed. The store's verdict waited on a FIFO, and the platform check did not name `O_NONBLOCK`. The lock file's FIFO case passes there too, because Linux opens a FIFO read-write without waiting. | | Red: round 7's cases, before their fix | `735d0c14` | 2 failed. Under umask 0777 the second record was refused ("the lock file cannot be opened"). The approval installed `MachineTrust` after a host's teardown and answered `APPROVAL_NOTICE` from its store. | | Red: round 6's cases, before their fix | `e05c475c` | 7 failed, 9 passed. Both sites the thread named told the operator to trust a binding past the catalog's bounds: the approval's availability, and a served turn's message. | | Red: round 5's cases and the self-pass's, before their fixes | `7012cda3` | 32 failed, 5 passed. Three hostile repository names made `CANARY` when `sh` ran their printed command: a newline, a terminal escape and a non-ASCII character, each followed by `$(touch CANARY)`. The factory raised `InvalidCatalogEntryError` on a trusted binding past the catalog's bounds, and `record` raised `FileNotFoundError` through a link to nothing. | | Green: the trust module, with the census, chat-configuration and deploy-shape modules | `735d0c14` (the merge's tree, run just before it was committed); the trust module alone again at `adb19f1e` | 336 passed, nothing skipped or xfailed; 135 passed at `adb19f1e` | | Whole suite (`tests` + `tests_runtime`), in a venv installed by CI's own command (`pip install --only-binary :all: -c constraints-cpython312-linux.txt -e ".[runtime,test]"`) | head `adb19f1e` | **3945 passed, 177 skipped, 0 failed.** The 177 are the database-backed runtime cases, which need CI's PostgreSQL service (`OPENDOX_TEST_DATABASE_URL`). #76 reads the same skips on its own local run. | | The 10 local reds of earlier rounds | `a6c2a844` (the 10 alone), then the head (in the whole suite above) | They were this machine's first venv: it was installed without the `test` extra, so it lacked the `local` extra's `pixeltable-pgserver`, and generate-and-open with `--local` refused ("the local install's PostgreSQL server is not installed"). In the CI-command venv, all 10 pass, with a short TMPDIR (`~/.local/state/t1`) and with the long one (`~/.local/state/t100-tmp`) alike. The socket-path length was not the cause here. | | Mutants (`mutate_t100.py`, one textual edit each) | head `adb19f1e` | **94 of 94 killed**, in one run (`mutants-run-17`). | | openxFactory's existing tests (`tests/ideation-dashboard -m "not postgres"`, in a clone named `openxFactory`, TMPDIR holding the basetemp) | openxFactory `main` `1f670bc3`, openDox code leg at `main` `8e377823`, then at T100 `7a04590d` | 4 failed, 1477 passed both times; the failure sets diff IDENTICAL (all 4 pre-existing). openxFactory injects its own `model_port_factory` and commits no bindings document, so its governed flow never reaches the gate before T094. The later rounds change only the store, how verdicts are held, and the rail's sentence. | The mutants killed: - **The digest:** each of the ten fields, each by its own hand-edit case. - **The root key:** ignored, or not resolved. - **The factory gate:** by-passed, or accepting a verdict for another binding. - **The in-depth refusals:** the broker operations, the resolver, `dispatch` and `catalog`; and a verdict admitting by id alone. - **The store:** - accepting a writable file; - following a link to its file; - skipping the link check or the tree check; - being written with mode 0666; - following a temporary-file link planted in the race window. - **The CLI:** - `add` and `edit` recording no trust, or writing before recording; - `set-credential` skipping the gate, or not re-trusting what it rewrote; - `trust` recording nothing or printing nothing; - `list`, the disclosure and the refusals printing raw values; - `list` saying nothing of trust. - **The intake and the state directory:** the intake gate; the state-directory check, skipped or blind to nesting. - **The default and the notice:** the lazy default never registered; a silent factory notice. - **The rail line:** shown beside an available model, for an empty catalog, or where a host offers intake; or never announced. - **Copilot round 1:** - recording without the cross-process lock, or never taking it; - the lock file opened through a link, or its owner and mode unchecked; - a declined record taken as trust; - a policy's failure to record escaping; - an untrusted verdict for another binding passed through; - the intake asking the binding question; - the per-machine store admitting the intake. - **Copilot rounds 2 and 3:** - the platform check skipped, or forgetting the file lock; - an unresolvable state directory escaping; - the rail line still claiming `list` says why; - a verdict for another root passed through; - a host policy's refusal text passing through, of either class; - openDox's own store's refusal sanitized too. - **Copilot round 4:** - a host's `MachineTrust` subclass passing its refusal text; - the writer outgrowing the read bound. - Round 4's "a dashed id printed where an option is read" is RETIRED with the `--` it mutated: no id the catalog accepts begins with `-`, and no command is printed for one that does. - **Copilot round 5 and the self-pass:** - a printed path not shell-quoted; - an unprintable path printed in a command; - an id the catalog refuses printed in a command; - a binding trust cannot repair told to trust; - a verdict trusting, or a record recording, a binding the catalog refuses; - servability judged by the id alone; - `list` judging a second reading; - `list`'s command, the factory's notice and the refusing port each omitting the document read; - a link to nothing gone through; - a system refusal escaping `record` or `verdict` raw; - the console line ignoring pending declarations or the document listed, or naming the last approved binding; - an approval always saying available, or registering and reading the default; - the turn message's `list` command or the rail's `trust` command dropping `--repo-root`. - **Copilot round 6:** - an approval of a binding the catalog refuses saying to trust it; - a turn on such a binding saying to trust it; - a refused turn naming no cause. - **Copilot round 7:** - the lock file keeping the umask's mode; - an approval reading the seam twice; - the registered verdict registering the default. - **Copilot round 8:** - the store waiting on a FIFO in its place; - the platform check forgetting the nonblocking open. The F16.1 batch M cases each serve a fresh `git init` with a fresh `OPENDOX_STATE_DIR`. They run over three bindings in turn: - a broker that writes a marker file; - an `env:` reference whose environment records every name read; - a `keyring:` reference whose stand-in backend records every lookup. The listener records every request. One test per case of the block. **`set-credential` on an `env:` or `keyring:` binding** is refused by the refusal it already had, "names no broker", which also comes before any read or spawn. Naming `trust` there would point at a command that cannot make the verb work. ## Review Every Copilot finding was accepted and fixed with a case that failed first and its mutant, then answered on its thread and resolved: - **Round 1, at `1ef4c71d`, fixed in `7a04590d`:** - `r4173513738`: a policy that declines to record; - `r4173513761`: the lock across processes; - `r4173513782`: the intake's own question; - `r4173513795`: a verdict for another binding. - **Round 2, at `7a04590d`, fixed in `e4b145d1`:** - `r4173876800`: a platform without the store's primitives; - `r4173876823`: an unresolvable state directory; - `r4173876849`: what the rail line says `list` shows. - **Round 3, at `8270dffc`, fixed in `e4b145d1`:** - `r4174310794`: a verdict for another root; - review `5402101086`'s "previously missed" item: a host policy's refusal text. - **Round 4, at `cb691b18`, fixed in `24a1c25e`:** - `r4174632006`: only the exact `MachineTrust` passes its refusal; - `r4174632060`: the printed trust command runs as printed; - `r4174632086`: the write bound. - **Round 5, at `7012cda3`, fixed in `db77c4ea`:** - `r4174783197`: a printed command a shell reads back exactly; - `r4174783250`: `list` reads its bindings once; - `r4174783280`: a binding the catalog refuses is never trusted, and never fails the start; - `r4174783301`: a link to nothing, and any unnamed `OSError`, refused by name. - **Round 6, at `e05c475c`, fixed in `a6c2a844`:** - `r4175203889`: a binding the catalog cannot list is told its remedy, at the approval and in a refused turn, and never to trust it. - **Round 7, at `735d0c14`, fixed in `42c98f9d`:** - `r4177946237`: the lock file is 0600 whatever the umask; - `r4177946288`: the approval reads the trust seam once. - **Round 8, at `42c98f9d`, fixed in `adb19f1e`:** - `r4178064601`: the store and its lock file are opened without waiting on a FIFO. **The adversarial self-pass, in the same commit.** It covered two things: - **Every command printed for a human to paste.** That is each refusal, the notice and `list`, plus each command a fixed sentence quotes. Hostile values in every interpolated operand were run through `sh`, `bash` and `zsh`. - **The trust-state machine,** for whether what is printed, what is stored and what is enforced agree: pending, approved, undeclared, unreadable declarations, and a stale record. It found three gaps, each now fixed with its case and mutant: - `list` did not say which binding a console declares; - an approval said "available" for a binding the strict default still refuses; - the fixed sentences quoted `model-binding` commands without the required `--repo-root`. **SonarCloud.** The quality gate's one failure was `python:S5332`: the trust disclosure spelled a plain-HTTP URL scheme, and now says "plain HTTP". The two functions over the cognitive-complexity bound (`_unsafe_because`, `_refuse_an_unsafe_tree`) are split into named parts, with the same rules. The gate passes from `7a04590d` on. ## CI's triple `EXPECT_SKIPPED` is 11, `main`'s own value. It moved to 14 for three strict-xfail cases, each waiting on a draft and naming it: - the store's default home (#69); - the rail's trust line (#74); - a served turn that reaches its model step standalone (#77). It stepped back by one, with its reason in the workflow, as each draft reached this branch (`1ef4c71d`, `32646871`, `78d1e904`). All three cases now run and pass. The floors are not moved. **The web census's class-A total is re-derived from the merged tree at every merge of `main`.** It is 18526 at the head: `main`'s 18486 plus this change's 40 lines in `views/doxbench-chat.js` (1890 to 1930). Round 5 changed that file within one line, so its count holds, and #76 touched no web file. **The floors** are #76's re-pin (3977 / 3966, T082). T100 moves neither, since it only adds cases. The merge kept both reasons for `EXPECT_SKIPPED` holding at 11, T082's and T100's. #84 (T104) also moves `EXPECT_SKIPPED` and class A. Whichever of the two lands second re-derives both values from its own merged tree. ## #77, and other notes - **#77 refuses the console intake standalone** when no gate-record writer is registered (`5961364221` item 1). So this file's intake cases use a stand-in host that registers a host gate at `opendox.column_seams.gate`, as #77's own tests do. - **#77's host fixture** runs `model-binding add` in a CHILD with a private `OPENDOX_STATE_DIR`. The parent's factory reads its own store, so a turn there still reads the binding untrusted until that store trusts it. - **#69's tree checks are DUPLICATED here, not imported.** `runtime/bundle.py`'s helpers take a different signature, raise `BundleRefused` with the bundle's wording, and the module imports heavier modules. They are kept in step by rule, and the tests hold both. ## Gates - `pyflakes` is clean over the changed modules. - `tests/test_provider_boundary.py` passes. No module outside `doxbench_provider` spells its banned needles. - No closing keyword appears in any commit message on this branch or in this body. 🤖 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>
…(plan 034) (#84) Lane: openxfactory-4 (openXfactory-4-openDox_extraction) Arc: neutral-product-standalone-operability Plan 034 (`specs/034-opendox-standalone-operation/`), phase 3: - **T104, the console token travels in the opened URL, not `/capabilities`.** RULED on openxFactory#656 in [`5963851934`](https://github.com/opensoft/openxFactory/issues/656#issuecomment-5963851934) (Brett, 2026-10-03, *"Token via the opened URL (Recommended)"*). Its plan entry landed with openxFactory#1220 (`ec9308c8`). - **From adversarial review 2's M5 (pre-existing).** A standalone openDox served its per-serve console token from `/capabilities` to any loopback caller, other OS users on the same machine included. Nothing checks which local user connects. The token lets a page edit documents and run chat turns that spend the operator's model credential. - **The holder's ruling on openxFactory#1220's review** (Copilot `r4171166321`): the private copy refuses an `OPENDOX_STATE_DIR` that is, or lies inside, a served root. This mirrors T100's served-repository boundary. - **After:** T103 (#80, landed as `390e2c28`) and T102 (#81, landed as `0116293a`; its follow-on #85 landed as `c4b55cc4`). `serve.py`'s single-writer order is T084 (#77) → T103 (#80) → T104. Every After line is met. - **Base `main`.** The holder retargeted #84 when #80 landed, and the diff is still T104 alone. It was built on #77's `3387293e` and merged forward as its base moved, never rebased: - #80's `d0f1efcb` at `6db50b03`; - #80's final pre-squash head `b9025b6c` at `c1e7d8d8`; - main `390e2c28`, #80's squash, at `60bace00`. That merge's tree came from `git merge-tree --write-tree --merge-base b9025b6c`, with both parents recorded. The squash has `b9025b6c`'s tree, so the merge changed no file; - main `0116293a` (#81) at `d4b99436`, main `c4b55cc4` (#85) at `182cac76`, main `ca9e1bd5` (#76, T082) at `ddb26c34`, and main `38d3350e` (#82, T100) at `021944a6`. All are plain merges, because this branch held none of those PRs' own commits. Each time, the census's class-A total was re-derived from the rows of the merged tree, now 18621: #82 moved `doxbench-chat.js` 1890 → 1930, and T104 moves `notebook.js` 109 → 204. `validate.yml` merged cleanly each time; T104 adds no skip, so `EXPECT_SKIPPED` stays 11. The `ca9e1bd5` merge applies F2 from the holder's T096 dry run: #76's new postures fixture read a standalone child's token from `/capabilities`, and now reads the private copy (`child.console_token(base[1])`). - **Fix round 1** (`cb899546`, Copilot `r4173806506`, `r4173806552`, `r4173806590`, `r4173806621`): every served root is in the boundary, removal is exact under a race, a plain `kill` removes the copy, and the shutdown cases look before cleanup. See "Fix round 1" below. - **Fix round 2** (`c979747a`, Copilot `r4173889265`, `r4173889294`): the copy is judged by its own path, and no static link serves it. See "Fix round 2" below. - **The reverse boundary** (`36ff6103`): the holder's ruling on batch N's Copilot review, openxFactory#1222 [`r4174345203`](https://github.com/opensoft/openxFactory/pull/1222#discussion_r4174345203). The state directory and every served root may not overlap in EITHER direction. See "The reverse boundary" below. - **Fix round 3** (`219d7cf9`, Copilot `r4174674625`, `r4174674702`): a directory's index page is judged, and a FIFO never blocks a read. See "Fix round 3" below. - **12.4a, clause by clause** (`a13857ad`): openxFactory#1222 (T007 batch N) landed as `bdd0f586`, and its amended 12.4a is the normative text for T104. Every clause is checked and its gaps are closed; the opener file's lifecycle is self-reviewed in the same commit. See "12.4a, clause by clause" below. - **One walk of the state directory** (fix round 4, `14285fbb`, Copilot `r4174785933`): every directory and link the walk passes through is judged, and the write is anchored to that walk. See "One walk of the state directory" below. - **Fix round 5** (`9f328892`, Copilot `r4175213798`, `r4175213842`, `r4175213864`, and `r4177975845` at `ddb26c34`): the snapshot files are served roots, publication and removal take one lock, and a stop is held through publication. See "Fix round 5" below. - **Fix round 6** (`9dcc9bb5`, Copilot `r4177975898`): an operating-system error during the walk is a refusal by name, for the writer and the reader. See "Fix round 6" below. - **Fix round 7** (`fb8a1cc4`, Copilot `r4178041022`): Ctrl-C is held like SIGTERM while a copy is written or removed. See "Fix round 7" below. - **Fix round 8** (`66cffdb8`, Copilot `r4178133814`, `r4178133842`): a running console's copy is reserved for its server's life, and every read that serves a file without the console check judges the file it opened. See "Fix round 8" below. - **The holder's adversarial review** (fix round 9, `45958bf3`; findings B1-B10 on `fb8a1cc4` and round 8): every standalone plane keeps the boundary, token or not; a platform without the POSIX primitives is refused by name; a browser that cannot open the copy is told how to move it (B3, ruled by Brett); a second spelling of a directory is judged by its identity; only the first stop is raised; `--no-serve` publishes nothing; and a publication sweeps the copies of consoles that died. See "The adversarial review" below. - **Fix round 10** (`af2a2efb`, Copilot `r4179091592`, `r4179091624`): the tokenless plane's guard walks the state directory once, as the writer does, and refuses an unsupported platform first. See "Fix round 10" below. - **Fix round 11** (`ed6e4769`, Copilot `r4179239380`, `r4179239411`, `r4179239424`, and a finding its review at `af2a2efb` lists as previously missed): a copy is known by what it holds, in any state directory and mid-removal; a check that cannot be made denies; an entry's in-memory payload comes before its guarded file. See "Fix round 11" below. - **Fix round 12** (`a2e36652`, Copilot `r4179793524`): a copy is written from a marker, so a part-written or growing copy is known by its first bytes; every reader judges the bytes it sends. See "Fix round 12" below. - **Fix round 13** (`c5fcdfa4`, Copilot `r4180089809`): the console page's URL is judged as a browser reads it: an exact loopback authority, and no backslash or control character. See "Fix round 13" below. Claimed on openxFactory#656 in [`5963979413`](https://github.com/opensoft/openxFactory/issues/656#issuecomment-5963979413). The holder posts READY, and the landers merge. ## What changes: the delivery only **Standalone means openDox's own default profile.** A plane is standalone when the profile `build_server` builds from IS `opendox.default_profile`, the one an entry point registers where no host has (`console_access.delivery_for`). - On a standalone plane, the token is minted exactly as before, and `/capabilities` no longer carries it. - A HOST's plane (openxFactory's `opendox_host.register_openxfactory()`, and this suite's own `_SuiteProfile`) keeps the `/capabilities` delivery, unchanged. See "The governed path" below. **`generate-and-open` and `python -m opendox.serve` write a private copy** at `<OPENDOX_STATE_DIR>/console/<port>.html`: - it is an HTML page that forwards to `http://127.0.0.1:<port>/index.html#console_token=<token>`. The token is in the **fragment**, never the query string, so it never reaches a request line, a server log or a `Referer`; - it begins with a marker comment (`COPY_MARKER`), before any byte of the token, so any part of a copy that holds a token byte is known for a copy (fix round 12); - it embeds the same record as JSON, escaped so that no value can end its `<script>` element; - **the browser is handed the copy's `file://` path, never the tokenized URL.** A URL given to `webbrowser.open` sits on a command line (`xdg-open`, the browser), and every user of the machine can read `/proc/<pid>/cmdline`. This is Jupyter's own redirect file, for the same reason; - the start prints the copy's path (` console file://…`) and **never the token**, with or without `--no-open`. To re-open the page, open that file again. Beside the path, one line with no token tells a user whose browser cannot open that file how to move the state directory (B3, ruled; see "Known limits"). There is no new verb, so the governed `--help` golden is unchanged; - the copy is removed when the server stops, BEFORE the listening socket closes. Only the file this process wrote is removed, so a later serve on the same port keeps its own. Another serve's copy is put back by a hard link, or by a rename where links fail. Every writer and remover holds the console directory's lock, so the put-back can never overwrite a newer copy. SIGTERM and SIGHUP are read as Ctrl-C from before the copy is written to after it is removed. So a plain `kill` or a closed terminal removes it too. A stop that arrives while the copy is written or removed, Ctrl-C included, is held until that is done, and only the first stop is raised (fix round 9). A SIGHUP the process was started ignoring (`nohup`), an ignored SIGINT, and a host's own handler are left as they were; - **a copy is reserved for its server's life** (fix round 8): the writer holds an exclusive `flock` on the file it wrote, on its own descriptor, until the copy is removed. A second console on the same port number and state directory (one on 127.0.0.1, one on ::1) is refused by name and never replaces it. A copy whose console died holds no lock, and the next publication sweeps it, whatever its port (fix round 9); - `--no-serve` writes no copy, opens none and prints no console line, since it closes the server before anything could use one (fix round 9); - if no safe copy can be written, the start is refused by name (`generate-and-open refused: …` / `serve refused: …`, exit 1), and the listening socket is closed. A platform without the POSIX primitives the copy rests on (Windows) is refused by name as well (fix round 9). An operating-system refusal, such as a directory this user cannot make or a full disk, is refused by name too. A write that fails part way leaves no partial file, and a copy whose read-back fails is removed. A console nobody can be handed is not served as if it could be. **The copy is checked as #69's bundle checks its tree, and by T100's trust-file rules.** `src/opendox/console_access.py` copies the rules (it does not import `runtime/bundle.py`'s private helpers): - the state directory and `console/` must be real directories, owned by this user and writable by no one else. `console/` must also be exactly 0700: its permission bits are judged, so a setgid bit inherited from a parent is accepted; - the state directory is resolved ONCE, by one walk. Every directory the walk passes through must be this user's or root's, and sticky if others can write it, including a directory reached only through a link's target. Every symbolic link it follows must be this user's or root's. The served-root boundary, the tree rules, the write and the read all work on the walked path, never on the configured one again; - a missing directory is made relative to its parent's descriptor, born 0700 under a 077 umask, and opened with `O_NOFOLLOW` before anything is made beneath it; - the file is created with `O_CREAT|O_EXCL|O_NOFOLLOW`, `fchmod`ed to 0600 on its descriptor, fsynced, then renamed into place; - if a name already at the target is anything other than this user's own regular file of mode 0600 with one link, it is **refused by name and never followed or replaced**, and the start is refused. That covers a link, a dangling link, a directory, a FIFO, another user's file, a hard link and a loosened copy; - **the served-root boundary** (the #1220 ruling, made two-way by the reverse ruling): the state directory and every root the plane serves may not overlap in either direction. A state directory that IS a served root, lies inside one, or HOLDS one is refused by name before anything is created (`OPENDOX_STATE_DIR (…) lies inside the served repository (…)`, or `… holds …, a root this plane serves`). The served roots (fix round 1) are: - the checkout; - the static bundle's `--web-dir`; - each declared `--source-root`; - each registry entry's root; - on a loopback plane, the sessions container; - the snapshot files `/snapshot.json` reads directly: the configured snapshot, each registered entry's, and, on a loopback plane, the session snapshots' container (fix round 5). Paths are compared after resolving, so a link from outside into a served root counts, and so does a served root named through a link into the state directory. Every directory on either path is also compared by its identity, `(st_dev, st_ino)`, so a second spelling of one directory, as a case-insensitive filesystem allows, is the same directory (fix round 9); - **every standalone plane keeps that boundary, token or not** (fix round 9). A plane with no git identity mints no token and writes no copy, but it shares the state directory with the planes that do. It still refuses a state directory that overlaps its served roots, and still marks the copies' directory private; - fix round 2 judged the copy's own path, so a served root that holds `console/` refused the write. The reverse rule covers that case and every other served root inside the state directory. That separate check is gone, and its case still passes; - the static handler never serves a copy: `publish` marks the private-copy directory on the server, and `DashboardHandler.send_head` answers 404 for any static target whose resolved path is that directory or inside it (fix round 2), by name or by the directory's identity (fix round 9). For a directory request, the index page the handler would serve (`index.html`, then `index.htm`) is judged too (fix round 3). The file it would serve is judged by its own identity before it is opened, and the file the handler opened is judged again, so a hard link or a link swapped in between is never sent (fix round 8). The body sent is bounded by the length judged, and its first bytes are judged as they are read (fix round 12). Links in `--web-dir` are still followed, since a governed host's composed web root is made of them; - `/source`, `/snapshot.json` and each registered entry's snapshot read through `serve.read_unless_private`, which judges the file it opened by its identity: a root re-pointed at the state directory after publication, or a hard link to the copy, is a 404 (fix round 8). Every such check also judges the opened file by what it holds, so a copy in another plane's state directory, or one removed mid-read, is refused, and a check that cannot be made denies (fix round 11). The bytes read are judged too, so a copy part-written or growing in another state directory is refused (fix round 12); - a read (`read_private_copy`, which the tests and T095's harness use) asks all of it again. The file is opened without blocking, so a FIFO is refused at once (fix round 3). It is checked on its descriptor: a regular file, this user's, exactly 0600, one link. **The page** (`web/views/notebook.js`, its only web file): - it takes `#console_token=` from `location.hash` at import, before the shell's first fetch; - it keeps the token in `sessionStorage` for this tab, or in memory where storage is blocked; - it strips the fragment with `history.replaceState(state, "", pathname + search)`, and a malformed token is stripped too; - `probeCapabilities()` fills the token into a payload that carries none, so every view keeps reading `caps.console_token` unchanged. A host's published token always wins. The query string is never read; - `app.js`, `edit.js` and the staging workbench's JS are untouched (T102 edits the workbench). `notebook.js` stays import-free, so its census row is re-measured (109 → 204) and class A's total is re-derived. **Every route that requires the token still requires it.** `_not_the_human_console`, the catalog, the thread read, the chat turn, the abstract, `/actions/edit` and the gate verbs are unchanged. ## Fix round 1 (`cb899546`) Copilot's review at `6db50b03`, four threads: - **`r4173806506`, served roots.** `build_server` reports every root the plane serves files from: the checkout; the static bundle's `--web-dir`, whose handler would serve a copy under it to anyone, 0600 notwithstanding, since the server reads it as its owner; each declared source root; each registry entry's root, which includes the bootstrapped session worktrees; and on a loopback plane the sessions container, where every later session worktree is made. Cases: a state directory under the static bundle and under the sessions container is refused and nothing is written; the reported set is asserted. - **`r4173806552`, a removal race.** `remove_private_copy` takes the name with an atomic rename to a name only this process uses, then judges what it took. Its own file is removed; anything else is linked back under the name, never over a still newer copy. Both entry points also remove the copy BEFORE closing the listening socket. Case: a replacement written at the instant of removal survives whole. - **`r4173806590`, SIGTERM.** While a copy exists, `python -m opendox.serve` and `generate-and-open` (local and hosted) read SIGTERM as Ctrl-C (`console_access.terminate_as_interrupt`) and restore the previous handler afterwards. A plane that wrote no copy keeps SIGTERM's default, so the governed and hosted images are unchanged. Cases: the context manager; a plain kill of each of the three entry points exits 0 with the copy gone. - **`r4173806621`, the shutdown assertions.** They now signal and wait (`_stop`), assert while the state directory still exists, and leave cleanup to the case's `finally`. ## Fix round 2 (`c979747a`) Copilot's review at `cb899546`, two threads. Each case failed first at `cb899546`, then passed: - **`r4173889265`, a served root holding `console/`.** The boundary judged the state directory only, so `--web-dir` equal to `<state>/console` (state directory outside every served root) let `GET /<port>.html` serve the copy. The copy's own resolved path is now judged as well: a served root that holds it refuses the write by name. Case: `test_a_served_root_equal_to_the_console_directory_is_refused` (it failed first: DID NOT RAISE). - **`r4173889294`, an outward link in the bundle.** The static handler follows links inside `--web-dir`, so `web/state-alias -> <state>` served the copy. Links are not refused wholesale: openxFactory's `scripts/ideation-dashboard-serve.py` composes its web root from links out of the bundle (`_composed_web_root`), and confining to the resolved root would 404 the governed bundle. Instead `publish` marks the private-copy directory (`httpd.private_roots`), and `DashboardHandler.send_head` answers 404 for any static target whose resolved path is that directory or inside it, for GET and HEAD, files and listings, every port's copy included. A server with no copy marks nothing. Case: `test_a_static_link_out_of_the_bundle_never_serves_a_private_copy` (it failed first: GET answered 200). ## The reverse boundary (`36ff6103`) The holder's ruling, from batch N's Copilot review ([`r4174345203`](https://github.com/opensoft/openxFactory/pull/1222#discussion_r4174345203)). `_refuse_a_served_state_dir` checked one direction only: a state directory in a served root. A served root INSIDE the state directory would let the plane serve what the state directory keeps, the copy among it. Such a root could be `<state>/console` itself, the bundled PostgreSQL's `postgres/run`, or any deeper path. Fix round 2's copy-path check caught only the root that holds `console/`. - **The fix.** The two may not overlap in either direction. A state directory equal to a served root, inside one, or holding one is refused by name before any write. - **Case:** `test_a_served_root_inside_the_state_directory_is_refused`, for `console`, `postgres/run`, `anything/else/deep` and `.` (the state directory itself). It failed first (DID NOT RAISE). At `cb899546`, 3 cases failed: `console`, `postgres/run` and `anything/else/deep`. At `c979747a`, 2 failed, because fix round 2 already covered `console`. - **Pin:** `test_a_source_link_into_the_state_directory_never_serves_the_copy`. A link inside a declared source root that points at the state directory gets 404 from `/source`, which never follows a link out of its root. It passed before the change. It is pinned here and held by mutant M13. ## Fix round 3 (`219d7cf9`) Copilot's review at `60bace00`, two threads. Each case failed first at `60bace00`: - **`r4174674625`, a directory's index page.** For `/sub/`, the stdlib handler serves the first of `index_pages` that is a file, and `send_head` judged only the directory. So `web/sub/index.html`, linked to a copy, was served at `/sub/` while `/sub/index.html` answered 404. The index page the handler would pick is judged too. The case is `test_a_directory_index_linked_to_a_private_copy_is_never_served`, run for `index.html` and `index.htm`. It covers GET and HEAD of `/sub/`, `/sub/<index>` and `/sub/?x=1`, and checks that the bare `/sub` redirect carries nothing. A directory whose index page is the bundle's own still answers 200. Before the fix, GET `/sub/` answered 200. - **`r4174674702`, a FIFO.** `read_private_copy`'s read-only `open` of a FIFO with no writer blocked forever, before the descriptor check could refuse it. It opens with `O_NONBLOCK` now. The case is `test_a_fifo_at_the_copy_is_refused_without_blocking`, which runs the read and the write on threads with a bounded join, so a failure fails and never hangs. Before the fix, "the read blocked on a FIFO". ## 12.4a, clause by clause (`a13857ad`) openxFactory#1222 (T007 batch N) landed as `bdd0f586`, and its amended 12.4a is the normative text for T104. Every clause was checked against `d4b99436`. Batch N's gaps (c), the non-blocking reader, and (d), the automatic index file, closed in fix round 3. This commit closes the rest. Each case failed first at `d4b99436` unless it is marked as a pin. - **(a) "Replaced only when it is this user's own regular file of mode 0600 with one link."** The writer checked the type, the owner and the link count, but not the mode, so a loosened own copy was replaced. It now applies the reader's own rule, so a loosened copy is refused by name and left as it is. This also answers Copilot's `r4174785965` at `d4b99436`. - **"In a directory of mode 0700."** A `console/` loosened after it was made (0755, 0750, 0711) was accepted wherever no one else could write it. The writer and the reader now refuse it by name. A setgid bit inherited from a parent is accepted (a pin). - **(b) The writer's and the entry points' regressions.** One is another user's file at the name (a pin). The other runs through `generate-and-open` and through `python -m opendox.serve`: each of a symbolic link, a directory, a FIFO, a hard-linked copy and a loosened copy refuses the START by name. That means exit 1, nothing printed that serves, no browser, the planted thing untouched and the socket closed. The loosened copy failed first; the other kinds are pins. - **(e) A served root named through a symbolic link** that leads to the state directory or into it (`console`, `postgres/run`, the directory itself) is judged where it leads. Through the entry point, the case is a `--web-dir` link to `<state>/console` (pins, held by mutant M24). **The opener file's lifecycle, self-reviewed** (write, replace, read, remove at stop, refuse before writing). Each finding below has a case that failed first at `d4b99436`, and a mutant: - an operating-system refusal on the way, such as a parent that will not let this user make the state directory or a full disk, escaped as a raw `OSError` with a traceback and no refusal by name. It is now a `ConsoleAccessRefused` naming the copy, through both entry points; - a write that fails part way removes its temporary file; - a copy whose read-back fails is removed with the refusal; - removal put another serve's copy back by a hard link only. Where links fail (EPERM: a filesystem without them, or a directory), that copy was deleted. It is now renamed back where the name is free; - SIGHUP, which a closed terminal sends, ended the process with the copy left behind. While a copy exists it is read as Ctrl-C, as SIGTERM is, unless the process was started ignoring it (`nohup`); - the signal handling covered only the serve loop. A SIGTERM while the browser opener ran, which can take seconds, took SIGTERM's default action on a hosted standalone plane and left the copy behind. It now covers the whole window from the write to the stop, in both entry points. ## One walk of the state directory (fix round 4, `14285fbb`) Copilot's review at `d4b99436`, `r4174785933`. Copilot's probe reproduced here. With `OPENDOX_STATE_DIR=alias/state`, `alias -> shared/hop` and `hop -> private`, the tree rules judged the configured path's components and the directories above the resolved path. `shared`, reached only through a link's target, was neither, so at mode 0777 and not sticky it went unjudged. The write also walked the configured path again after the served-root check. So a `hop` re-pointed in between put the token's copy in a served root, at `served/state/console/8080.html`, where `/source` serves it. `_walked` resolves the state directory once, component by component as the kernel walks it. Every directory it passes through is judged by the rule for directories above the state directory, and every link it follows by the rule for a link. The served-root boundary, the tree rules, the write and the read all work on the walked path. Both cases failed first at `182cac76`: - `test_a_directory_passed_through_by_an_intermediate_link_is_judged`: Copilot's layout with `shared` at 0777. The write and the read are both refused by name. Before the fix: DID NOT RAISE; - `test_a_link_swapped_after_the_checks_never_redirects_the_write`: `hop` is swapped to a served root right after the served-root check. The copy lands where the checks saw the state directory, and the served root gains nothing. Before the fix, the copy landed in the served root. ## Fix round 5 (`9f328892`) Copilot's review at `182cac76`, three threads. Each case failed first at `ddb26c34`: - **`r4175213798`, the snapshot files.** `/snapshot.json` reads its file directly, not through the static handler. So a `--snapshot` named at an earlier copy, `<state>/console/<port>.html`, would have been replaced by the new copy and served to anyone. The served roots now hold the configured snapshot, each registered entry's snapshot, and, on a loopback plane, the session snapshots' container. The reverse boundary therefore refuses that start by name, through a link as well. Cases: - `test_a_snapshot_inside_the_state_directory_refuses_the_start`, which before the fix reported "the server served"; - `test_the_plane_reports_its_snapshot_files_as_served_roots`. - **`r4175213842`, the rename-back race.** Where a hard link fails, another serve's copy is renamed back where the name is free. A newer copy published between that check and the rename was overwritten. Every writer and remover of `console/` now takes the directory's exclusive `flock`, so publication and removal are serialized. The case is `test_a_copy_published_during_a_rename_back_is_never_overwritten`: a third copy is published at exactly that moment, waits, and stands. Before the fix, "an older copy overwrote the newest". - **`r4175213864`, a stop during publication.** SIGTERM was read as Ctrl-C only after `publish()` returned. Both entry points now install the handler BEFORE publication, on any plane that writes a copy, and keep it through removal. A stop that arrives while the copy is written or removed is held (`deferred_termination`): publication raises it once the copy is in hand, and removal lets it go. Cases: - `test_a_stop_during_publication_removes_the_copy`, for both entry points; - `test_a_stop_during_removal_lets_the_removal_finish`; - `test_deferred_termination_holds_a_stop_until_the_block_ends`. Copilot's review at `ddb26c34` raised the same stop for `generate-and-open` (`r4177975845`), and `9f328892` answers it. ## Fix round 6 (`9dcc9bb5`) Copilot's review at `ddb26c34`, `r4177975898`. The walk and the served-root check ran outside the writer's conversion of `OSError`. So an overlong state-path component (ENAMETOOLONG) or an unsearchable parent (EACCES) escaped as a raw `OSError`, and both entry points ended in a traceback instead of a named refusal. Both are inside the conversion now, and the reader converts the same way. The cases failed first at `9f328892`: - `test_a_state_path_the_walk_cannot_take_is_refused_by_name`, for both kinds of path, through the writer and the reader; - `test_a_state_path_the_walk_cannot_take_refuses_the_start`, for both kinds through `serve` and through `generate-and-open`. Each exits 1 with the refusal named, prints nothing that serves, and closes the socket. ## Fix round 7 (`fb8a1cc4`) Copilot's review at `9f328892`, `r4178041022`. SIGINT kept Python's immediate handler, so `deferred_termination` never held it. A Ctrl-C just after publication's rename raised before the caller held the copy, and the copy was left behind. A second Ctrl-C just after a removal's take left a `.removing-*` file holding the token. `terminate_as_interrupt` now takes SIGINT too, still raised as a `KeyboardInterrupt`, but only where it has Python's own handler; an ignored SIGINT, or a host's own handler, is left as it was. The cases failed first at `9dcc9bb5`. Each one checks for the handler before it sends SIGINT, so a raw interrupt never aborts the test session: - `test_ctrl_c_just_after_the_copys_rename_leaves_no_copy`, for both entry points; - `test_a_second_ctrl_c_after_the_removal_rename_leaves_nothing`; - `test_terminate_as_interrupt_takes_ctrl_c_only_from_its_default`. ## Fix round 8 (`66cffdb8`) Copilot's review at `fb8a1cc4`, two threads. Each case failed first at `fb8a1cc4`: - **`r4178133814`, two consoles on one port number.** The copy's name is per port, so a console on 127.0.0.1 and one on ::1, sharing a state directory, replaced each other's copy, and the first console's printed path opened the second. The writer now takes an exclusive `flock` on the file it wrote, before the rename, on its own descriptor (`_Reservation`, held in `PrivateCopy.reservation`), and keeps it until the copy is removed. A later publication on that port asks for the lock without waiting. A held lock is a running console's, refused by name (`… belongs to a console that is still running (pid N)`), and its copy is left as it was. A free lock is a stale copy's, and it is replaced. Cases: - `test_two_consoles_on_one_port_number_never_share_a_copy`, with real IPv4 and IPv6 planes (failed first: DID NOT RAISE); - `test_a_running_consoles_copy_is_never_replaced` (failed first: DID NOT RAISE); - `test_a_copy_whose_console_died_is_replaced`, a pin: a subprocess writes a copy and exits, and the kernel releases its lock. - **`r4178133842`, a root retargeted after publication.** `/source` resolves a declared root again on every request, so a root re-pointed at the state directory after publication served the copy. Every read that serves a file to any caller without the console check now judges the file it OPENED, by `(st_dev, st_ino)`, against every name in the copies' directory (`console_access.is_private_file`). `/source` and `/snapshot.json` read through `serve.read_unless_private`. The static handler judges the file it would serve before the stdlib opens it, and judges what the stdlib opened; a file swapped in between is closed unsent and the connection closed. The identity also stops a hard link to the copy, which a path cannot tell apart. Cases, each answered 200 with the copy before the fix: - `test_a_source_root_retargeted_after_publication_never_serves_the_copy`, Copilot's layout; - `test_a_snapshot_retargeted_after_publication_never_serves_the_copy`; - `test_a_hard_link_to_the_copy_is_never_served`, for the static bundle and the served checkout; - `test_the_static_backstop_never_sends_a_copy_swapped_in_after_the_check`, which blinds the first check and reads the raw response: the copy's bytes are never sent. ## The adversarial review (fix round 9, `45958bf3`) The holder had an independent adversarial review of `fb8a1cc4` and of round 8 run ahead of Copilot: 1 high, 3 medium and 6 low findings. It confirmed that round 8 answers both of Copilot's threads, and it found what follows. The reviewer's own cases are kept as written, under their ids (`test_b1_…`, `test_b2_…`, `test_b3_…`, `test_b6a_…` to `test_b6c_…`). The cases that pin B1, B2, B3, B4, B5, B8 and B9 failed first at the merged pre-fix tree. - **B1 (high), a tokenless sibling plane.** A standalone plane that minted no token (no git identity, so no session verbs) wrote no copy, so it asked no boundary and marked no private root. A root of its that held the shared state directory served a sibling plane's copy, token and all, to any local caller. The delivery is now the plane's, token or not (`build_server`), and `publish` on every standalone plane asks the boundary and marks the copies' directory private (`console_access.guard_private_roots`). Only the writing still needs a token. Cases: the reviewer's two real planes, where the tokenless plane now refuses its start by name; the same refusal in the process; and a tokenless plane whose `--web-dir` links into the state directory and whose checkout holds a hard link to the sibling's copy, which answers 404 for the copy, the listing and `/source`. - **B2, a platform without the POSIX primitives.** On Windows the standalone start ended in an `AttributeError` traceback. `console_access.unsupported_platform()` names what is missing, and the writer and the reader refuse by name before anything else, as `bundle.unsupported_platform()` does for #69's bundle (holder's ruling). Cases: the reviewer's child with `os.getuid`, `O_NOFOLLOW` and `O_DIRECTORY` removed, which now exits 1 with `serve refused: …`; and the writer and the reader without `O_NOFOLLOW`, and without calls relative to a directory's descriptor. - **B3, a browser that cannot open the copy.** Ubuntu's default snap browser cannot read a file under a hidden directory such as `~/.local/state`, and a Windows browser under WSL may not open a Linux path. There was no way past it, because the token is never printed. RULED by Brett (2026-10-04, *"Hint line, accepted limit (Recommended)"*): beside the copy's path, the start prints ONE line with no token, saying to set `OPENDOX_STATE_DIR` to a folder that is not hidden and start again (`console_access.UNOPENABLE_HINT`). The case runs both entry points, finds the line once, right after the copy's path, and finds the token in no line printed. The README's side is openDox#17's (T076). See "Known limits" below. - **B4, a second spelling.** The served-root overlap and the static handler's guard compared spellings. On a case-insensitive filesystem (macOS's default), `<root>/STATE` is `<root>/state` and `/state-alias/CONSOLE/` lists `console/`, while resolving a path keeps the case it was given. Both checks now also compare the directories' `(st_dev, st_ino)`, the copies' directory's own included (`within_private_roots`). Linux cannot spell one directory two ways without root, so the cases simulate a case-insensitive filesystem by telling `os.stat` and `os.listdir` that the second spelling is the first: the boundary for the state directory, a root inside it and a root holding it, and the static listing. The reviewer's macOS reading is derived from the code, not observed on a Mac, and the same holds here. - **B5, a second stop.** A double Ctrl-C, or a SIGTERM and then a closing terminal's SIGHUP, could land its second signal after the first had unwound the serve loop and before the cleanup's hold. That second interrupt escaped the `finally` and left the copy. The first stop is now latched, and every later one is only recorded. Cases: the reviewer's child, which delivers the second stop at exactly that point and now exits 0 with no copy and no traceback; and the latch in the process. - **B6, three rules no case pinned.** The walk's link-owner check, the reader's re-judging of the tree, and the `fchmod` under a umask that strips owner write each had a mutant the suite let live. The reviewer's three cases kill them (M46, M47, M48). - **B7, browser history.** Accepted by the holder as a limit within the ruled design. See "Known limits" below. - **B8, `--no-serve`.** It opened a copy for a server it then closed, and deleted the copy on return. It now publishes, opens and prints no copy. The page's URL is still printed and opened, as before T104, and carries no token. The cases that read a copy now serve once and stop at a Ctrl-C (`stopped_once_serving`), and each refusal case asserts that it never served. - **B9, a copy left by a crash.** A SIGKILLed serve's copy stayed until a later serve took its port. A publication now sweeps, under the console directory's lock, every copy whose reservation is free, and every temporary or taken name that a dead writer or remover left. Nothing else is touched: not a running console's copy, not a loosened copy (which 12.4a refuses and never replaces), not a link, and no file of another name. Cases: the sweep's rules in the process, and the reviewer's SIGKILL across two real serves. - **B10, the body.** This body was rebuilt from the evidence at the head: the suite, every mutant, the browser and the governed run. Mutant run 16 at `fb8a1cc4` also left one mutant alive: M32, where the configured snapshot is not a served root. Every case named the snapshot at a copy that already existed, so the registered entry's own snapshot (M32b's line) refused it either way. `9fe57dff` adds a snapshot named at `<state>/console/<port>.html` before that copy exists, which only the configured snapshot's own served root refuses. Two follow-ups after round 9. `c4e6c01b` adds B3's hint line, once Brett had ruled it. `0539f8c0` answers mutant run 18 at `45958bf3`, whose one survivor was M36c: the removal never closed the descriptor that reserved the copy, and nothing asked about it. `test_a_removal_releases_the_copys_reservation` now asks that, after a removal and where the directory is gone already, no descriptor of this process is the copy's file. That case's first failure printed the copy's `repr`, and with it the token. So `opened_url` is kept out of `PrivateCopy`'s `repr`, and `test_a_copys_repr_never_carries_its_token` pins it. ## Fix round 10 (`af2a2efb`) Copilot's review at `0539f8c0`, two threads, both on round 9's tokenless guard. Each case failed first at `0539f8c0`: - **`r4179091592`, one walk for the tokenless plane.** The boundary check and the marking each resolved the configured state path for themselves. A link on that path re-pointed between the two left the boundary judging the real state directory and the marking naming a decoy, and an outward static link then served a sibling plane's copy. `guard_private_roots` now walks the state directory once (`_walked`), judging every directory and link on the way as the writer does, and the boundary and the marking both use that walk's path. Cases: - `test_a_tokenless_planes_state_link_retargeted_mid_guard_marks_the_real_directory`, Copilot's layout. The sibling's copy and the listing stay 404; - `test_a_tokenless_planes_unsafe_state_path_refuses_its_start`: a world-writable, non-sticky directory on the way refuses the tokenless start by name. - **`r4179091624`, the platform first.** A tokenless plane skipped the platform check, started, and marked a private root that its handlers then judged with the missing `O_NONBLOCK`. `publish` and the guard now refuse an unsupported platform by name before anything else, token or not. Cases: - `test_a_tokenless_plane_refuses_a_platform_without_the_primitives`, in the process; - `test_a_tokenless_start_without_the_posix_primitives_refuses_by_name`, the no-identity variant of B2's child. ## Fix round 11 (`ed6e4769`) Copilot's review at `af2a2efb`, three threads and one finding in the review's body. Each case failed first at `af2a2efb`: - **`r4179239380`, another state directory.** Two standalone planes of one user can have different `OPENDOX_STATE_DIR` values. The guard knew only its own plane's copies, so if plane A's web root linked to plane B's state directory, A served B's copy. `is_private_file` now first judges the file it was given by what that file holds. A regular file whose head carries a console record is a copy, wherever it lies (`_carries_a_console_record`); the head is read with `pread` from the descriptor already open. Case: `test_another_state_directorys_copy_is_never_served`, through a static link and through a hard link under `/source`. - **`r4179239411`, a removal mid-read.** A copy removed after a read opened it, and before the scan could stat its name, matched nothing in the directory. The open file still holds its record, so it is refused. Case: `test_a_copy_removed_during_the_scan_is_never_served`. - **`r4179239424`, a check that cannot be made.** These used to let the file through, and each now denies it: - a private directory that exists but cannot be listed (`EMFILE`, `EACCES`); - a name in it whose status cannot be read, for any reason but its removal; - a regular file whose head cannot be read. A private directory that does not exist still holds no copy. Cases: - `test_a_private_directory_that_cannot_be_scanned_denies_the_read`, with `EMFILE` simulated, and with `EACCES`; - `test_a_name_whose_status_cannot_be_read_denies_the_read`; - `test_a_file_whose_head_cannot_be_read_is_denied`. - **Previously missed, an entry's payload.** On a standalone plane, an entry with both an in-memory payload and a snapshot file served the file, and a 404 where the file was missing. That broke `SnapshotEntry.read_bytes`' payload-first contract. The payload comes first again, and only the file fallback is guarded. Case: `test_an_entrys_payload_comes_before_its_guarded_file`, with the file missing, present, and a private copy. ## Fix round 12 (`a2e36652`) Copilot's review at `1e114a19`, `r4179793524`. Round 11 recognized a copy in another state directory only by its whole record. So another plane's temporary file, part-written with the token in its meta refresh and no record yet, passed the static handler, `/source` and `/snapshot.json`. A file that grew after it was judged passed too, because the stdlib copies a static file to its end as it is when read. - **A marker first.** The writer now begins every copy with `COPY_MARKER`, an HTML comment, ahead of any byte of the token. A copy is written from its start, so any part of it that holds a byte of the token already holds the whole marker. `is_copy_bytes` recognizes a copy by that marker, or by its whole record. - **What is read is judged.** `read_unless_private` reads first, then judges what it read, as well as the file by its descriptor. - **What is sent is bounded and judged.** The static handler's `copyfile` sends at most the length the file had when it was judged. It reads the body's first bytes before sending anything and judges them, so a copy's bytes are never sent. Cases, each failing first at `1e114a19`: - `test_another_state_directorys_partial_copy_is_never_served`, Copilot's layout, through all three readers, GET and HEAD; - `test_a_file_that_grows_after_its_static_check_never_sends_a_token`; - `test_a_file_that_grows_after_its_read_check_never_returns_a_token`; - `test_a_copy_starts_with_its_marker_before_any_token_byte`; - `test_a_copy_replaced_after_its_read_is_never_returned`, which pins the read-first design. The identity match against this plane's own `console/` remains as defence in depth. `1e114a19` had pinned it with a part-written copy (mutant run 23 left M38 alive); with the marker such a copy is known by its bytes, so `test_a_file_in_the_copies_directory_is_refused_by_its_place` now holds a token-bearing file there that the marker cannot recognize. ## Fix round 13 (`c5fcdfa4`) Copilot's review at `a2e36652`, `r4180089809`. `urlsplit` reads `http://evil.example\@127.0.0.1:8080/index.html` as user information at `127.0.0.1`. A browser takes the backslash for a slash and navigates to `evil.example`, whose page could then read the token's fragment. The entry points build their own URLs, but `write_private_copy` and `opened_url` are public. `_refuse_page_url` now requires the authority to be exactly a loopback host, spelled as `serve.server_url` spells it, with an optional port of at most 65535. A backslash or a control character anywhere in the URL is refused. Cases: - `test_a_page_url_a_browser_reads_as_another_host_is_refused`, eight URLs, Copilot's first. Seven failed first at `a2e36652`; - `test_every_loopback_page_url_a_plane_announces_is_accepted`. ## No test server outlives its run (`d466c1d2`) The holder found orphaned `python -m opendox.serve` children of these cases on the machine, hours old. Each was plane B of the B1 case, left by a mutant run: where a mutant made B serve instead of refusing, the case failed, and its `finally` stopped plane A only. Every server child the cases start now runs in its own session, and is reaped with its process group at teardown, pass or fail: SIGTERM, a bounded wait, then SIGKILL. On Linux it also gets SIGTERM from the kernel if the test process dies first (`PR_SET_PDEATHSIG`), since a killed run runs no teardown. Cases: `test_a_server_left_running_is_reaped_with_its_group` and `test_a_server_outlives_no_killed_run`. Re-run under mutant M44, the B1 case fails as it must, and no server from that run survives. ## Known limits, accepted for release 1 After a serve restart, a tab opened against the old serve holds a stale token in its `sessionStorage`. The fixed "reload the page" messages (`doxbench-chat.js`, `staging-workbench-model.js`, T102's area) then name the wrong remedy on a standalone plane: a reload keeps the stale token. The remedy is the new tab the restart opened, or the new console file. The holder ACCEPTED this for release 1 and passes the copy change to T102's writer. **Some browsers cannot open the copy** (adversarial review B3). Ubuntu's default snap browser, and Flatpak browsers, are kept out of hidden directories such as `~/.local/state`, and a Windows browser under WSL may not open a Linux path. Brett ruled this an accepted limit for release 1, with a hint (*"Hint line, accepted limit (Recommended)"*, 2026-10-04): the start prints one line, with no token, saying to set `OPENDOX_STATE_DIR` to a folder that is not hidden and start again. The README's side is openDox#17's (T076). **The browser's persistent history keeps the fragment** (adversarial review B7). `history.replaceState` strips the token from the address bar and from the tab's session history, but the browser's own history store (Chromium's `Default/History`) has already recorded the opened URL, fragment included. The holder ruled this a limit within the ruled design: the history file is this same user's data, as the 0600 copy is, and it is not served or sent anywhere. ## Tests `tests/test_console_token_delivery.py` (new): - a standalone plane carries no token on `/capabilities`, under no key and in no byte; - a host's plane keeps it there and writes no copy; - **a second OS user cannot obtain it.** First, by asking: 102 GET and HEAD requests (51 paths: the whole bundle of 42 files, `/`, `/capabilities`, the snapshots, the project register, `/source`, the guarded reads without the token), and 8 POST routes. No body and no header carries it. Second, by the copy: the file is 0600 and the directories 0700, all this user's. A copy owned by another uid is refused by the reader (simulated through `getuid`); - the opened URL, the meta refresh and the link carry the token in the fragment only, with an empty query; a page URL that already has a query or a fragment, is not http, or is not loopback is refused; - the record cannot break out of its `<script>`: a hostile `</script><img …>` value stays inside, and the record round-trips; - `generate-and-open` hands the opener a `file://` path, prints the copy's path and never the token, and removes the copy; `--no-open` opens nothing and still prints the path. These cases serve once and stop at a Ctrl-C, since `--no-serve` writes no copy; - an unsafe state directory refuses the run, naming the directory; - the copy is born 0600 in a 0700 tree even under umask 0; - these are refused: a planted link, a dangling link (nothing is created at its target), a hard link, a loosened copy (0644), a planted directory, a linked `console/`, a group- or world-writable state directory, and a non-sticky shared parent (a sticky one is accepted); - a later copy replaces this user's earlier one, and removal is exact; - every guarded route refuses without the token, or with a wrong one, and passes the console check with the copy's token; - **the served-root boundary:** the state directory equal to the served root, under it, under a declared source root, through a link into it, and through `generate-and-open`. Each is refused by name, and nothing is written; - **the reverse boundary:** a served root that is `<state>/console`, `<state>/postgres/run`, a deeper path under the state directory, or the state directory itself. Each is refused by name, and nothing is written. Separately, a link in a source root that points at the state directory gets 404 from `/source`; - the plane reports its served roots: the checkout and each declared source root; - **fix round 3:** a directory's index page linked to a copy is never served, for either index name; a FIFO at the copy is refused at once by the reader and by the writer; - **12.4a:** the writer refuses a loosened own copy and another user's file, and leaves each as it was. Both entry points refuse their start by name for each of five planted kinds. A served root named through a link into the state directory is refused. A `console/` that is not 0700 is refused, and a setgid one is accepted; - **the lifecycle:** an unwritable state directory and a full disk are refusals by name, and no partial file is left. A failed read-back leaves no copy. Another serve's copy survives a removal where hard links fail. SIGHUP removes the copy at all three entry points, and a `nohup` SIGHUP stays ignored. A SIGTERM while the browser opens removes the copy, hosted and local; - **one walk:** a directory passed through by an intermediate link is judged, and a link swapped after the checks never redirects the write; - **fix round 5:** a snapshot inside the state directory refuses the start, through a link too. The snapshot files are reported as served roots. A copy published during a rename-back is never overwritten. A stop during publication, at either entry point, or during removal leaves no copy; - **fix round 6:** an overlong or unsearchable state path is a refusal by name, for the writer, the reader and both entry points; - **fix round 7:** Ctrl-C right after the copy's rename, or right after a removal's take, leaves nothing behind. Ctrl-C is taken only from Python's own handler; - **fix round 8:** a running console's copy is never replaced, by a second publication or by a real IPv6 plane on the same port number, and a dead console's copy is. A source root or a snapshot retargeted after publication, a hard link to the copy in the bundle or the checkout, and a link swapped after the static check never serve the copy; - **fix round 9 (the adversarial review):** a tokenless standalone plane refuses a state directory inside its checkout, as a real second plane and in the process, and never serves a sibling's copy through a link or a hard link. A platform without the POSIX primitives is refused by name, through `serve` and by the writer and the reader. A second spelling of the state directory, of a root inside it, of a root holding it, or of `console/` is judged by its identity. Only the first stop is raised, so a second one never leaves a copy. The walk's link-owner rule, the reader's re-judging of the tree and the `fchmod` under umask 0o277 are pinned. `--no-serve` writes, opens and prints no copy. A dead console's copy, temporary file or taken name is swept, and nothing else is. A snapshot named at a copy not yet written refuses the start. Both entry points print the hint line once, right after the copy's path, and no line they print carries the token. A removal releases the copy's reservation, and a copy's `repr` never carries its token; - **fix round 10:** a tokenless plane whose state link is re-pointed mid-guard marks the real directory, and the sibling's copy stays 404. A tokenless plane refuses an unsafe state path, and a platform without the POSIX primitives, by name, in the process and as a user starts it; - **fix round 11:** another state directory's copy is never served, through a static link or a hard link. A copy removed mid-read is still refused. A private directory that cannot be listed, a name whose status cannot be read, and a head that cannot be read each deny. An entry's payload comes before its guarded file; - **fix round 12:** a copy begins with its marker, before any token byte. Another state directory's part-written copy is refused by the static handler, `/source` and `/snapshot.json`. A file that grows after its checks, or is emptied after its read, never hands out a token.; - **fix round 13:** a page URL whose authority a browser reads as another host (a backslash, user information, a bad port) is refused, and nothing is written; every loopback spelling a plane announces is accepted; - **no test server outlives its run:** a server left running is reaped with its process group, and a child outlives no killed run; - end to end, as a user runs it: `python -m opendox.cli generate-and-open --local --no-open` and `python -m opendox.serve`, each in a child process with neither sibling importable. `tests/test_console_token_view.py` (new, node): fragment taken, kept and stripped; a host's token wins; the degraded probes; a reload keeps the token from storage; the query string is never read; a malformed token is stripped and not kept; blocked storage keeps the token in memory. These standalone children read the token from the private copy (`standalone_child.Child.console_token`), because they used to read it from `/capabilities`: - `test_capability_honesty.py`, its 4 standalone cases and the unknown-tile-kind thread read; - `test_neutral_turn_scope.py`; - `test_doxbench_defaults.py`; - `test_chat_model_configuration.py`'s standalone fixture; - T103's `test_loopback_host_gate.py` real local serve, which now asserts that no token is on `/capabilities` and that the copy exists exactly when a token is minted. **Mutants, 90 of 90 killed** (each applied alone, both new test files run, in a throwaway worktree of `c5fcdfa4`): | mutant | failed | |---|---| | M1 token back in /capabilities | 4 | | M2 query string instead of fragment (server) | 6 | | M2b page reads the query string instead of the fragment | 4 | | M3 the file at 0644 (one constant) | 8 | | M3b the file written 0644, reader unchanged | 89 | | M4 no link check at all | 18 | | M4b no planted-target check on write | 15 | | M4c the read follows a link | 1 | | M5 the page never strips the fragment | 3 | | M6 no served-root boundary | 19 | | M6b the boundary checks equality only | 8 | | M6c the plane reports no served root | 9 | | M7 removal puts no replacement back | 3 | | M8 a plain kill is not read as Ctrl-C | its own SIGTERM ended the run (rc -15), after 5 failures | | M9 the static bundle is not a served root | 3 | | M9b the sessions container is not a served root | 2 | | M11 the static handler serves a private copy | 4 | | M12 no reverse check (a served root inside the state dir) | 9 | | M13 /source follows a link out of its root | 1 | | M14 a directory request serves its index page unjudged | 2 | | M15 the read blocks on a FIFO | 1 | | M16 the writer replaces a loosened own copy (12.4a) | 3 | | M17 the console directory's mode is not judged (12.4a) | 3 | | M17b the setgid bit counts as a loosened mode | 1 | | M18 an operating-system refusal escapes raw | 8 | | M19 a failed read-back leaves the copy | 1 | | M20 no rename-back where a hard link fails | 2 | | M21 a hangup is not read as Ctrl-C | 4 | | M21b nohup's ignored hangup is overridden | 1 | | M22 cli: the handler covers only the serve loop | 3 | | M23 a partial temporary file is left | 1 | | M24 a served root is not judged where its link leads | 2 | | M25 the walk judges no directory it passes through | 2 | | M26 the write is not anchored to the walk | 1 | | M30 serve: the handler is installed only after publication | 5 | | M31 a stop is never held | 1 | | M32 the snapshot file is not a served root | 1 | | M32b a registered entry's snapshot is not a served root | 1 | | M32c the session snapshots' container is not a served root | 1 | | M33 a removal takes no lock | 1 | | M33b a publication takes no lock | 1 | | M34 the walk runs outside the writer's conversion of OS errors | 6 | | M34b the reader converts no OS error | 2 | | M35 Ctrl-C is not held | 5 | | M35b a host's own Ctrl-C handler is overridden | 1 | | M36 a running console's copy is replaced | 2 | | M36b the copy is never reserved | 3 | | M36c removal keeps the reservation | 1 | | M36d removal keeps the reservation where nothing is left to remove | 1 | | M37 /source reads unguarded | 5 | | M37b a registered snapshot reads unguarded | 3 | | M37c the static handler judges no identity before it opens | 4 | | M37d the static backstop sends what the stdlib opened | 1 | | M38 is_private_file matches no identity | 1 | | M39 the boundary ignores identity (B4) | 3 | | M40 the static guard ignores identity (B4) | 1 | | M41 the first stop is not latched (B5) | 2 | | M41b a held stop is raised after the first (B5) | 1 | | M42 no sweep (B9) | 2 | | M42b the sweep ignores reservations (B9) | 1 | | M42c the sweep removes what is not this user's own copy (B9) | 1 | | M43 --no-serve publishes (B8) | 1 | | M44 a tokenless plane guards nothing (B1) | 5 | | M44b the delivery depends on the token (B1) | 7 | | M44c a tokenless plane marks no private root (B1) | 2 | | M44d a tokenless plane asks no boundary (B1) | 3 | | M45 the writer refuses no platform (B2) | 1 | | M45b the reader refuses no platform (B2) | 2 | | M46 (reviewer m2) the walk never judges a link's owner (B6a) | 1 | | M47 (reviewer MA) the reader never re-judges the tree (B6b) | 1 | | M48 (reviewer m1) no fchmod (B6c) | 1 | | M49 (reviewer MC) the page keeps the token in localStorage | 2 | | M50 generate-and-open prints no hint line (B3) | 1 | | M50b serve prints no hint line (B3) | 1 | | M51 a copy's repr carries its token | 1 | | M52 the tokenless guard resolves the state path again to mark it | 1 | | M52b the tokenless guard does not walk | 1 | | M53 a tokenless plane skips the platform check | 2 | | M54 a copy is not known by what it holds | 3 | | M54b a head that cannot be read is allowed | 1 | | M55 a directory that cannot be listed allows | 2 | | M55b a name whose status cannot be read allows | 1 | | M56 an entry's file comes before its payload | 3 | | M57 a copy is written without its marker first | 4 | | M57b a copy's marker is not recognized | 4 | | M58 the reader judges none of the bytes it read | 1 | | M58b the reader judges the file before it reads it | 2 | | M59 the static body is copied as the stdlib copies it | 1 | | M61 the page URL's authority is not judged exactly | 4 | | M61b a backslash or a control character passes | 2 | M10 (the copy's own path not judged) is retired with the check it mutated: the reverse rule replaced that check, and M12 is the mutant that removes the reverse rule. **The browser, end to end.** Chromium (Playwright 1.61.0, the T096 prep harness's driver) ran `opendox generate-and-open --local --no-open` from a fresh install. The first run was on a LOCAL, never-pushed integration of this branch with #77 and `main`. It was re-run at `60bace00`, at `182cac76` and at `c5fcdfa4`, which carry both. 18 of 18 checks passed every time: - the private copy (0600) forwards to `/index.html`; - the address bar and the tab's session-history entry carry no fragment. The browser's persistent history still records the opened URL; see "Known limits" above; - `sessionStorage` holds the token, and `probeCapabilities` fills it; - the page's own `/capabilities` has none; - the catalog answers 200 with the token and `console_required` without it; - a reload keeps the token, and a new tab at the bare URL has none; - no request URL or `Referer` carries the token, and there was zero `pageerror`; - nothing the server printed carries the token; - the copy is gone after SIGTERM, and no bundled PostgreSQL is left. **The whole suite, locally** (`tests` and `tests_runtime`, with `--basetemp` and `TMPDIR` outside the tree): | commit | passed | skipped | |---|---|---| | `6db50b03` | 3415 | 177 | | `cb899546` | 3422 | 177 | | `c979747a` | 3424 | 177 | | `60bace00` | 3774 | 177 | | `d4b99436` | 3821 | 177 | | `a13857ad` | 3851 | 177 | | `182cac76` | 3858 | 177 | | `14285fbb` | 3860 | 177 | | `ddb26c34` | 3894 | 177 | | `9f328892` | 3901 | 177 | | `9dcc9bb5` | 3907 | 177 | | `fb8a1cc4` | 3911 | 177 | | `0539f8c0` | 4078 | 177 | | `af2a2efb` | 4082 | 177 | | `ed6e4769` | 4091 | 177 | | `d466c1d2` | 4093 | 177 | | `1e114a19` | 4094 | 177 | | `a2e36652` | 4099 | 177 | | `c5fcdfa4`, the head | 4111 | 177 | At the head, 0 failed. The count grew with the merges: #80's final head carried main's landings since `d0f1efcb` (#63, #69, #73, #64, #72 and #77), and then #81, #85, #76 and #82 landed. CI's own reading at `c5fcdfa4` is `selected=4288 passed=4277 skipped=11`, against `validate.yml`'s floors 3977 / 3966 and its exact 11. ## The governed path openxFactory's existing token-reading suites were run twice, locally only. First against the pinned openDox-code `047bb4fa`, then against `047bb4fa` with T104's commits applied. The last such run applied every server-side change through `c5fcdfa4`, at local `f18e3342`. That is the head's whole server side, rounds 8 to 13 included. `cli.py`'s hunks are left out there: the governed host serves through `opendox.serve`, and the pin's `cli.py` predates T084's refactor. The suites are `tests/ideation-dashboard/test_doxbench_routes.py`, `test_gate_routes.py`, `test_shared_identity.py` and `test_staging_seed.py`, and they read `caps["console_token"]` through `_console_token`. The result is identical: **239 passed, 1 failed at both**. The one failure is the same pre-existing case (`test_lens_add_as_cluster_lands_manifest_pending_and_record`, 409). Nothing in openxFactory changes, so there is nothing for T094. **For T086 (openXdox-code), recorded with the holder.** openXdox-code `6a3b93b9`'s route harnesses (`tests/doxbench_routes_harness.py:290`, `tests/gate_routes_harness.py:139-149`) build the server with no host profile registered, so by this PR's rule their plane is standalone, and they read `caps["console_token"]`. Composed with openxFactory's `scripts/` for `doc_health`, 90 cases there fail with `KeyError: 'console_token'`. All 90 are in 6 files that its `tests/declared_exclusion.yaml` already excludes (`doc_health`), so its CI does not run them. When its openDox pin passes this PR, those harnesses read `httpd.console_token`, or register openXdox's profile as a host. ## Batch N, and T095 T007's batch N landed in openxFactory#1222 (`bdd0f586`): #1144 12.4a's amendment is the normative text this PR realizes (see "12.4a, clause by clause" above). F10.1, F13.1, F16.1 and F12.x are unaffected. Plan 034's quickstart § 3 and § 4 step 1, and AT-R1 step 4, read the private copy. T095's harness (openDox-code#75, not edited here) reads the private copy at `<state_dir>/console/<port>.html` instead of `/capabilities`. The holder has its proposed helper and the three line changes. The helper never opens a copy that failed its checks, so a FIFO cannot block it. 🤖 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>
…h no database service (plan 034) (#75) Plan 034, task **T095**, slice `acceptance` (AT-R1, the HTTP half), phase 3. The plan is `specs/034-opendox-standalone-operation/tasks.md` at opensoft/openxFactory `main` `596a9a90`, § "Acceptance: AT-R1", as T007 batch N (`bdd0f586`) amends it. It realizes **FR-011's HTTP half**. Arc: neutral-product-standalone-operability Lane: openxfactory-4 (openXfactory-4-openDox_extraction) - **Claim:** openxFactory#656 comment [`5961416730`](https://github.com/opensoft/openxFactory/issues/656#issuecomment-5961416730). - **Rulings:** - [`5961364221`](https://github.com/opensoft/openxFactory/issues/656#issuecomment-5961364221) item 2: T095 is drafted now, and does not go READY before T063 lands. - [`5850003126`](https://github.com/opensoft/openxFactory/issues/656#issuecomment-5850003126): R1Q10 (a), R1Q12 (a), R1Q13 (a) with (c), R1Q15 (b), and R1Q16 (iii) and (iv). - [`5963851934`](https://github.com/opensoft/openxFactory/issues/656#issuecomment-5963851934): the console token travels in the opened URL, and the harness reads the private copy. - [`5973854291`](https://github.com/opensoft/openxFactory/issues/656#issuecomment-5973854291), F1 (i): the chat rail reads a thread only with a branch session (openDox-code#85). - **State: DRAFT.** Its `After` line is T089, T076, T104 and T007 batch N. Batch N (openxFactory `bdd0f586`), T104 (openDox-code#84, `32943cbf`) and T076 (openDox#17, `504324de`) have landed. Its READY waits only on T089, lane openXfactory-3's phase-3 checkpoint. The holder posts READY and the landers merge; this writer does neither. - **Release 1, for T096's evidence:** - **P** = `dede32b4b6f3d0f147d599776f83628c5af8ff3d`, the openDox-code commit T087 pins in the openDox root (`e1e3a3c3`). - **X** = this PR's landing commit, RELEASE1_TIP, which lane openXfactory-3's T096 evidence fills in. - **Build inputs: this PR changes none; it changes only CI and tests.** It touches `.github/workflows/validate.yml`, `acceptance/at_r1_http.py`, `tests/test_at_r1_http_harness.py` and `tests_runtime/test_deploy_shape.py`. It does not touch `pyproject.toml` or anything under `src/`. To check, both distributions were built locally the way `release.yml` builds them: the hash-locked release tools, `python -m build --no-isolation`, and `SOURCE_DATE_EPOCH` set to the commit's time. That was done at P and at `d29e68ca`. The two **wheels** hold the same 129 files, each with the same bytes. Built at P's `SOURCE_DATE_EPOCH`, `d29e68ca`'s wheel is byte-identical to P's (`sha256 8ecea00d…`). With each commit's own time they differ only in the archive's timestamps. The **sdist** at `d29e68ca` holds one file more, `tests/test_at_r1_http_harness.py`, because setuptools' default sdist takes `tests/test*.py`; its `SOURCES.txt` lists that file. So what installs at X is what installs at P, and the source archive differs by that one test file. - **Convergence:** the lexer's and the resolver's residual misreadings are accepted limits of the harness, under the holder's ruling. They are listed, with the checks showing that no shipped file uses them, in "Accepted limits" below. ## On this PR, `acceptance` and `validate` are both green The stack the harness drives has landed. `main` `dede32b4` (2026-10-05), which is P, carries: - #60 (T071), #65 (T088), #67 (T070) and #69 (T072, the bundled server and the `local` extra); - #71 (T085), #72 (T073), #73 (T075) and #74 (T081); - #64, #77 (T084) and #80 (T103); - #81 (T102), #85 (the T102 follow-on), #76 (T082) and #82 (T100); - **#84 (T104, the console token via the opened URL)**, which landed on 2026-10-05; - #86 (the T100 follow-on, the trust store's review findings), #78 (T099, the release workflow) and #79 (version 0.1.0). The harness reads the console token the way T104 delivers it (step 6 below). Until T104 landed, this PR's `acceptance` job failed **by design**, at `[a.capabilities carries no console token]`. This branch now merges `main` `dede32b4` (P), so its own job runs the harness against the delivery it was written for, #86's trust store included. At this head `d29e68ca` it printed `AT-R1 HTTP half: PASS (314 assertions held)` (run 37316440405, job 111784259300). The `validate` job runs the whole suite and is green: `triple: selected=5379 passed=5368 skipped=11 failures=0 errors=0` (run 37316440405, job 111784258794). **Making `acceptance` a required check is a ruleset change for the repository's owner** (`docs/branch-protection.md`). This PR does not touch the ruleset. ## What changes (four files, nothing else) | file | change | |---|---| | `acceptance/at_r1_http.py` | NEW. The harness. Standard library only. Not a pytest module: it sits outside `tests/` and `tests_runtime/`, so `testpaths` never collects it and #1144's F9.1 is unchanged (FR-006's "no exclusion" holds). | | `.github/workflows/validate.yml` | A new `acceptance` job, appended after the last line. It has **no services**, runs no pytest and installs nothing itself: one step, `python3 acceptance/at_r1_http.py`. The `validate` job and its triple are untouched. T082 (#76) re-pinned the triple's floors on `main` (3977 / 3966), and T100 (#82) changed only the `validate` job's comments; this PR merged both cleanly. | | `tests_runtime/test_deploy_shape.py` | Required, because `test_the_workflow_declares_the_required_job_and_its_steps` pinned `sorted(jobs) == ["validate"]`. It now admits `["acceptance", "validate"]`. A new case holds `acceptance` to no service or container, no pytest run, no `pip install` step, and one harness step outside `testpaths`. And `test_every_install_of_this_package_reads_one_dependency_lock` now also requires that the harness passes the lock to pip. | | `tests/test_at_r1_http_harness.py` | NEW. It tests the harness's DECISIONS in process, as `tests/test_smoke_signals.py` tests the browser half's oracle: it loads the harness from its file, against an in-process loopback server, so nothing is installed or started. **564 cases.** Every decision below has its cases, and 221 mutants of those decisions are each killed (below). | The two test changes add cases to SELECTED and PASSED, and none skips; the floors permit a rise, and no floor is edited. ## The documented command, and how the harness runs it T007 batch H's 10.3 addendum (`openspec/changes/add-neutral-product-standalone-operability/tasks.md`, 10.3, "AMENDED — T007 Batch H (`5850003126`; Ruled R1Q15 (b), R1Q16 (iii))"), verbatim: > The command the root's `README.md` documents is the standalone install and its one start: `pip install "opendox[local]"`, then `opendox generate-and-open --local …`. The flag selects the local mode explicitly (13.4 as this batch amends it), and the `local` extra carries the bundled server that mode starts (13.1 as this batch amends it). After the install, that start is the single command requirement 10's second scenario has a user run. The entry point is still the code leg's console script, and no `Makefile` target is added, for the reason above. Carried out by T070 and T076. The harness holds both lines as constants (`DOCUMENTED_INSTALL`, `DOCUMENTED_START`, the `…` being U+2026 after one space). Compared mechanically with T076's README (opensoft/openDox#17 at `7eef03b4`): ``` DOCUMENTED_INSTALL = 'pip install "opendox[local]"' (6f63616c5d22 tail bytes): README lines [32] DOCUMENTED_START = 'opendox generate-and-open --local …' (616c20e280a6 tail bytes): README lines [33] ``` - **The start line.** The harness runs `opendox generate-and-open --local --repo-root <repo> --repository fixture --no-open --port <free port>`. That is quickstart.md § 3's filled form, with `--port` given a port found free at run time and checked free on 127.0.0.1 and ::1 just before the start. Before it starts anything, it asserts that its argv begins with exactly the tokens of `DOCUMENTED_START` before the `…` (`start.documented-command`). The `…` is the verb's own arguments, as the README says, and every flag above is one the README names. `opendox` is the fresh venv's console script, resolved on the child's PATH and asserted to lie inside that venv; argv[0] stays the literal `opendox`. - **The install line.** No release of `opendox` is published (PyPI answers 404 for `opendox`; the release-channel question is with Brett). So the harness installs the same distribution with the same extra from the checkout: `pip install "<checkout>[local]"`, from a copy of this checkout's tracked files. That is exactly the substitution the README makes for its first line (`pip install "./code[local]"`, run from the root). It installs through `constraints-cpython312-linux.txt` where the lock's own interpreter runs it (CPython 3.12 on Linux, as in the job). The lock pins versions and adds no package, so the install is still `opendox[local]` and nothing else (AT-R1 step 2). ## What the harness asserts, in order (AT-R1 steps 1-4, and the route answers behind 5-8) Each assertion has an id. The run stops at the first that fails and prints `AT-R1 HTTP half: FAIL [<id>]: <why>`, then exits 1. `--keep-going` reports every failure instead, and still exits 1. A harness that breaks before a verdict exits 2, never 0. 1. **Install.** A fresh venv, then `opendox[local]` (R1Q16 (iii)). Then `install declares the local extra`, read from the installed distribution's metadata. 2. **The clean machine, ASSERTED** (`clean.*`), in a fresh `OPENDOX_STATE_DIR` created empty for the run: - none of `openxdox`, `ideation_dashboard`, `doc_health` and `corpus_adapter_openxfactory` is importable in the venv (`python -I`, from an empty directory); - `omp` is not on the PATH, nor is the product's own `doxbench_bridge.HARNESS_COMMAND`; - no identity broker (`openprofiler-broker`) is on the PATH, and no issuer setting is set; - nothing listens on 127.0.0.1:5432 or [::1]:5432; - no PostgreSQL Unix socket answers in a shared directory. The harness reads every listening `.s.PGSQL.*` socket the kernel lists in `/proc/net/unix`, plus the distribution sockets as a fallback; - no DSN or `PG*` setting reaches a child; - neither repository holds a binding at the product's own `doxbench_binding.DEFAULT_BINDINGS_RELPATH`; - no bundled-server process exists before the start. Every child runs with `GIT_*`, `XF_*`, `OPENDOX_*`, `PG*`, `DATABASE_URL` and `PYTHONPATH` dropped, a fresh `HOME`, and `TMPDIR` inside the scratch directory. Before anything is installed, the harness also refuses a `TMPDIR` that another user could change (exit 2, by T104's own rules for the state tree; step 6), so its verdict on that tree judges what the product made of it. 3. **Two plain repositories**, each a fresh `git init` (spec.md AT-R1 step 3): (a) `tests/fixtures/plain-documents`, and (b) quickstart.md § 2's three notes, byte for byte, with no front matter. Each gets `git config user.name`/`user.email`, which the served actor is read from. 4. **The documented start**, once per repository (`start.*`): the port is free, the argv matches, the console script lies in the venv, the server is ready within 120 s, and the process that answered is still the one it launched. 5. **Fetches.** - `/` must be HTML by its type's essence (`text/html`, parameters aside), with an `<html>` element. It must also be UTF-8, as the harness reads it: a UTF-16 BOM, or a `charset` naming anything but a UTF-8 label, in its `Content-Type` or anywhere in the page, fails `[x.http / is UTF-8]`. - `/snapshot.json` must be a JSON object, non-empty, every document an object with a non-empty string `path`, and neutral per F5.3: none of #1144's fourteen declared words (5.5's falsifier list, verbatim) in any string value. - The grouping station, named by `/capabilities`' own display facet, must hold a tile with an id and a member document, so a grouping tile can open the chat pane (R1Q13 (a) with (c); this fails, and does not skip). - `/capabilities` must give `install.mode == "local"`. As quickstart § 3 asserts it (T007 batch N), its **raw** payload carries the console token **by name nowhere**: `console_token` is in neither the raw text nor any key of the parsed payload, however deep or however escaped (`[x.capabilities carries no console token]`). The by-VALUE half runs once step 6 has the token. 6. **The console token, as the user's browser is handed it** (T104). The start prints `console <file URL>`, the PATH of a private opener, and never the token. The harness reads that opener itself, with the standard library, and imports nothing from the product. The checks: - the start printed the opener, at `<OPENDOX_STATE_DIR>/console/<port>.html`, outside the served repository; - it is private: this user's regular file, mode exactly 0600, one link, in `console/` of mode exactly 0700 (as quickstart § 3 checks it). Its whole path is judged by T104's own rules for that tree: the state directory is this user's, and no one else can write it; every directory above it, as written and as resolved, is this user's or root's, and sticky where others can write it; every symbolic link on the way is this user's or root's; - it is opened with `O_NOFOLLOW | O_NONBLOCK`, read only if `fstat` calls it a regular file, and read WHOLE: a file past 64 KiB is refused by name, never judged by a truncated prefix; - it is a page the harness reads as the browser does: UTF-8 by the same rule as `/`, and holding no SVG, MathML, `frameset`, or refresh or script inside a `select`. Otherwise it forwards nothing, by name; - it has exactly one LIVE meta-refresh, as a browser that runs scripts parses the page. None inside a `<template>`, a `<noscript>`, a raw-text or escapable raw-text element, a `select`, or after a `frameset` counts. The first of a repeated attribute is read, `http-equiv` is `refresh` exactly, and `/>` closes only a void element. A tag that holds a named character reference with no `;` is not followed: `html.unescape` decodes it, and a browser's attribute rule does not; - that refresh is one a browser follows (the HTML standard's declarative refresh steps). It goes to this plane's console page (`/` or `/index.html`), on a loopback host the launched plane answers on, with no backslash, whitespace, control character or user information. `#console_token=<token>` is in the FRAGMENT, and never in the query or the path, raw or in any percent-decoding; - that token is one the page accepts: `[A-Za-z0-9_-]{16,512}`, read as T104's `takeDeliveredConsoleToken` reads it (`URLSearchParams` over the fragment); - its JSON record (`<script type="application/json" id="opendox-console">`, kind `opendox-console-access` v1, live, parsed as `JSON.parse` parses it) describes that same forward: its port, its token, its `opened_url` and its `page_url`; - the PAGE that forward opens is asked as the browser asks it: of the forward's own host (in `Host`, which the plane's loopback gate reads), with its path and query, and without its fragment. It must answer 200 as HTML (`[x.console page is HTML]`) and be UTF-8 (`[x.console page is UTF-8]`). Steps 7 and 8 read that page and its origin, never `/` in its place. T104's forward is `/index.html` on `127.0.0.1`; - and, BY VALUE (T007 batch N): the token is nowhere in `/capabilities`' raw payload, nor in any key or string value of the parsed one, under whatever name (`[x.capabilities carries the opener's token nowhere]`). 7. **The model catalog.** `/workbench/model-catalog` must refuse a caller with no token (4xx). With the opener's token in `X-XF-Console-Token`, it must answer 200 in the envelope the chat rail adopts (`views/doxbench-chat-model.js`, `adoptCatalog`): - `schema_version` is any JSON number equal to 1, never `true` and never `"1"`; - `kind` is `workbench-model-catalog`; - `models` is an array with no entry the rail would offer: none whose `available` is exactly `true`, as the rail reads it (16.4). The harness also asserts that the served bundle names both this route and this kind, so neither constant can drift from the bundle. 8. **Every route the panes can request**, asked at the console page's origin, answers, and none answers 5xx or drops the connection (derivation below). And the chat rail reads no thread: it reads `/workbench/thread` only through a branch-session column (`gate.workbench.session`, openDox-code#85), and the plane must contribute none (`[x.chat rail reads no thread (no branch session)]`). 9. **Stop and look.** SIGTERM to the entry point alone, as `kill` would, and a wait of up to 90 s. Then: - the entry point must exit 0; - no live process whose executable lies in the venv's `pixeltable_pgserver` package, or whose command line names the fresh state directory (R1Q16 (iv)), checked at the operating system; - the opener must be gone; - the token must appear nowhere in either output stream of the whole serve. Cleanup runs however the run ends, but only AFTER the verdict is taken, so a leftover still fails the run. **No line the harness prints quotes a console token.** Every token the run has seen is blanked out of every id, reason, note and the report (`Verdict.redact`), as it is and inside any run of `%XX` escapes that decodes to it, partly encoded or encoded twice: the tokens the opener carries, delivered or refused, and its record's; and one `/capabilities` publishes, under its name at any depth. `serve_one` reads the opener's tokens as soon as the start answers, before step 5 quotes anything (T104 writes the opener before it serves). No reason quotes the server's own bytes either: not the entry point's output, a `/capabilities` payload, a catalog body or its envelope's values or an available entry's id, the snapshot's documents or its grouping field, the opener record's values, a `<base href>`, a peer's error text, a printed opener path other than the expected one, or a `Content-Type` that is not a plain MIME type. Every printed line escapes what is not printable (a control, a newline, a bidirectional override, a lone surrogate), so no text a server sends can forge a line of the log or break one. **Every parser reads as the browser reads, or refuses by name what it does not model:** - JSON is parsed as `response.json()` parses it: a BOM dropped, an invalid byte read as U+FFFD, and `NaN` and `Infinity` refused. A body nested past the parser's depth is a named failure, never exit 2. - JavaScript is lexed by its own whitespace (U+FEFF and every space separator) and line terminators, a hashbang line is a comment, and its strings are decoded with its escapes. An escape a module refuses is a named failure. - HTML is read with the first of a repeated attribute, and live elements only. A script is what its `type` and `language` make it. SVG, MathML, a `frameset`, a script, link or base in a `select`, and one whose attributes hold a named reference with no `;` (`©=2`, which `html.unescape` decodes and a browser does not) are refused by name. A page is read as UTF-8, and refused by name where a browser might read it otherwise. - URLs are resolved against the running server's origin. A reference a browser reads differently is refused by name: a backslash, a tab or newline, whitespace or a control at an end, user information, or a percent-encoded dot segment. So are a `<base>` other than `/` and an import map. - A string from JavaScript or JSON is read in Unicode scalar values, as a browser reads a URL from it: a surrogate pair joined, and a lone surrogate read as U+FFFD. - Request targets are percent-encoded as a browser encodes them. A `Content-Type` is parsed as the MIME Sniffing standard parses it, and one with more than one value is refused by name. A redirect is refused by name, because a browser follows it. ## How the route list is derived (from the served JS, not by hand) `derive_bundle` reads the bundle **from the running server**, resolving against its origin (`http://127.0.0.1:<port>`): 1. It fetches `/`, then follows the page's LIVE module scripts (`<script type="module" src>`, `type` and `language` read as the HTML standard reads them) and `rel~=stylesheet` links. Both resolve against the page's base URL: its `<base href>`, which must be `/`, or the page's own. A view module `/capabilities` declares is walked too, but it is no entry: - a page with no live module script is `[bundle.entry]`; - a classic script, by `src` or inline, is `[bundle.classic-script <src>]`, unless it is marked `nomodule`; - an inline module script is `[bundle.inline-module]`; - markup the harness does not model is `[bundle.unmodeled]`. 2. In every module, a small JS lexer strips comments and regular-expression literals, decodes JavaScript's string escapes, and yields each string literal, in Unicode scalar values, with the code before it. Every run of JavaScript whitespace, and every comment, reads as one space there, so no run is too long. A template's `${…}` is read as code, starting an expression, so an import or a route inside one is found. A `/` divides after an operand (a name, a literal, a call, a group, a postfix `++` or `--`), and opens a regular expression after a prefix operator or the `)` of an `if`, `while`, `for` or `with` condition. After a `}` it does either, by whether the `}` ends a block or an expression, which a lexer cannot tell: a module with a `/` right after a `}` is `[bundle.ambiguous-slash <path>]`. A keyword is read as one only where it is no member's name (`obj.return`, `obj?.of`) and no part of a longer or a private name (`ñreturn`, `this.#if`); after a spread's `...` or a decimal point (`1. in`) it still is. `of` is a keyword only as a `for` head's separator, after its binding or target (`for await (` opens a head too), and a name elsewhere, a classic loop's initializer, condition and update included; a `/` after a spread's `...`, a division's own `/`, `export default`, `extends`, or `break`, `continue` or `debugger` and a line break opens a regular expression. So does one after a line break that ends a statement by automatic semicolon insertion: before a `++` or `--` (then a prefix), and after a labelled `break` or `continue`, a declaration's lone binding, or a static import's specifier. That code tells an `import … from "x"`, an `export … from "x"` or an `import "x"` from an ordinary string, and from a method named `import` (`loader.import("x")`). A module holding an escape a module refuses (a legacy octal escape, `\8`, `\9`, or a malformed `\x` or `\u`, outside a tagged template) is `[bundle.syntax <path>]`. 3. It follows every static specifier, every literal dynamic `import("x")`, and every view-binding module `/capabilities` declares, transitively. Each module is fetched once, and judged once per way it is imported: - A static import must answer 200, even of a path another module imports dynamically. A failed one is a module-load `pageerror`, which AT-R1 step 8 forbids. - A dynamic import may be refused, but not with a 5xx. Standalone, `/views/intent-feed.js` answers 404 (10.2a, not owed), and its importer degrades. - A served module must be JavaScript by its type's essence, and a linked stylesheet `text/css`. A redirect is refused by name, never judged by its status. - A BARE specifier is `[bundle.bare <specifier>]`. A module or stylesheet from another origin (another host, port or scheme, `data:`) is `[bundle.external <url>]`, and is never fetched from loopback by its path. A same-origin absolute URL (`http://127.0.0.1:<port>/x.js`) is a path of this plane. 4. In every module of that graph, every string literal that is a same-origin path (`/` or `./` followed by a letter, not a `.js`/`.css` path) is a route the bundle can request. At the integration below, that is **38 modules and 18 routes**. A static read cannot tell a load-time request from an on-click one, so the harness requests ALL of them, a superset of the wheel's, the lens's and the chat rail's load-time reads. T096's browser run observes the load-time set itself. The nine `/actions/…` routes get a GET too; a GET there finds no handler (404), so it never executes an action. A prefix ending in `/` (`/source/`) is completed with each document the snapshot lists, plain and keyed by the workbench's key (`/source/fixture%40main/<doc>`), as the panes complete it. The thread read (`/workbench/thread`) is asked as its bare literal only, as every literal is. Since openDox-code#85, a standalone plane's rail sends no thread read at all, and the harness no longer completes it with the query it once claimed the rail sends (the holder's T096 dry run, F4). Every request carries the console token the opener delivered, as the doxBench transports do, so a guarded read answers from its handler and not from the console check. ## Accepted limits (the holder's convergence ruling) The harness reads the bundle with a lexer, not a parser. The holder ruled, under the rule of openxFactory#656 comment [`5988818366`](https://github.com/opensoft/openxFactory/issues/656#issuecomment-5988818366) (written for #86 and applied to this PR), that misreadings only a parser could fix are recorded as accepted limits of the acceptance harness, not chased round after round. A form is fixed now only if a shipped openDox web file contains it, or if the fix is one line with a test. The limits are recorded in `JsStrings`'s docstring and in `_resolve`'s. **The lexer** (`JsStrings`): - A `/` right after a `}` divides after an expression's `}` and opens a regular expression after a block's. Such a module is refused by name (`[bundle.ambiguous-slash <path>]`). - In one form, the `/` is read wrongly. After a declaration list's last binding with no initializer, then a line break (`let x, y` [line break] `/re/`), automatic semicolon insertion ends the declaration, so the `/` opens a regular expression. The lexer reads a division, and an import after it on that line can be missed. Telling that comma from an expression's comma takes knowing that it lies in a declaration. **URL resolution** (`_resolve`). `urllib.parse` reads a few references differently from the URL standard, and these are not refused: - `///a.js` and `http:///127.0.0.1:<port>/a.js`; - an empty path segment (`.//a.js`); - a dot segment or an empty path in an absolute same-origin URL; - an unencoded `^`; - a loopback host that the URL standard rewrites (`127.1`, `0x7f.0.0.1`, `2130706433`, `127.0.0.1.`), which is judged an external host. **No shipped file uses any of them.** These checks ran locally at `d29e68ca` over the 42 files the build packages (`web/**`, `web/**/.*`): 39 modules, the page, its sheet and `vendor/.gitkeep`. - The lexer against acorn 8.18's exact token stream (a full module parse): they agree on all 205 `/` decisions, 132 regular expressions and 73 divisions. They agree on all 82 static imports and export-froms. No module is ambiguous or malformed. No regular expression follows a name, a literal, a `)`, a `]` or a `}` (3 follow `return`), so the residual form, which needs a binding name and then a line break before the `/`, occurs nowhere. - The resolution against node's WHATWG `URL`: all 84 of the shipped modules' import specifiers, static and dynamic, resolve alike. **How the limits were found.** A differential check of the lexer against node's own module parser, the static module requests of a `vm.SourceTextModule`. It covers 196 contexts, each a regular expression or a division before a static import, with five kinds of separator: 1960 snippets, 978 of them valid modules. In those, the lexer hid the import in 195 at `ff04e015`, in 85 at `09d9d632`, and now in the 10 of the residual form. It has no false failure at any of these heads, and refuses the same 10 by name at each. A second check, of 81 contrived references against node's WHATWG `URL`, finds 13 differences: the 12 that the URL list above records, and `//a.js`, which is an external URL either way. The overview at `e4f81d48` named identifier-parsing errors; that class was a one-line fix with a test, so it is fixed in `d698c6ea`. ## Falsifier: the harness itself ### At this branch, `main` `32943cbf` plus the harness (what this PR's own `acceptance` job runs): PASS The job at `d29e68ca` (run 37316440405, job 111784259300): ``` AT-R1 HTTP half: PASS (314 assertions held) ``` Locally, the same tree, run as that job runs it (`python3 acceptance/at_r1_http.py` from the checkout's root, with no database service; `r83`, at `d29e68ca`, which merges `main` `dede32b4`): ``` AT-R1 HTTP half: PASS (314 assertions held) ``` Its log is line for line the same as `r82`'s (`d698c6ea`, before `dede32b4`) and `r76`'s (`ff04e015`, the first head with `main` `32943cbf`), apart from ports, process ids and scratch paths. That includes `[a.capabilities carries no console token]` and every console-opener check. The `validate` job's suite, run locally at `d29e68ca` with the job's install line and a PostgreSQL 16 standing in for its service, printed `triple: selected=5379 passed=5368 skipped=11 failures=0 errors=0`. So no change since then moved a module, a route or an assertion. Neither log holds a token-shaped run. The first green `acceptance` job ran at `d50e8cef`, once #84 had landed. Its merge ref with `main` `32943cbf` (`ff68275a`) gave `PASS (314 assertions held)`, and so did `r75`, locally, on a merge of the same two commits whose tree is identical to CI's. ### Before T104 landed: FAIL, named At `main` `38d3350e` plus the harness (`d50e8cef`, `r74`, `--keep-going`), the harness failed only where T104 was missing, in both repositories. In CI it stopped at the first of these: `1 failed, 34 held`. ``` == r74-r27-pr-tree-keepgoing rc=1 held=282 AT-R1 HTTP half: FAIL [a.capabilities carries no console token]: … also FAIL [a.console opener printed]: the start printed no `console <file URL>` line naming the opener, … also FAIL [a.catalog answers]: /workbench/model-catalog with no console token to present (step 6 found none) answers HTTP 403 (its body is not quoted) also FAIL [b.capabilities carries no console token]: … also FAIL [b.console opener printed]: … also FAIL [b.catalog answers]: … 6 failed, 282 held ``` No token-shaped string appears anywhere in that log, though that tree's `/capabilities` published the token. The expected red moved as the stack landed: - at `main` `047bb4fa` and `66ff7257`, it was `[install declares the local extra]`; - once #69 landed, it was `[a.capabilities install.mode == local]`; - from #72, it was the token delivery above, which only T104 supplies; - since #84 landed (`32943cbf`), it is green. ### Against T104 before it landed (local integrations, never pushed): PASS **#84 `fb8a1cc4` with `main` `38d3350e` merged in** (`fc9b39b5`, local only). #84 already merges `main` `ca9e1bd5`. The merge's one conflict was the web census's class-A total, resolved as base plus both deltas (18486 + 40 + 95 = 18621). With `b7b9b843`'s harness, `--keep-going` (`r71`): ``` == r71-r26-on-live15-t104-keepgoing rc=0 held=314 AT-R1 HTTP half: PASS (314 assertions held) ``` Each earlier head of this round passed at the integration of its day: - `r73` (`d50e8cef`'s harness) and `r69` (`0717f72f`'s): the same integration, 314 held; - `r67` (`3392f934`'s), `r65` (`9229c659`'s) and `r63` (`ba216f84`'s): the same integration, 310 held, before the console page checks; - `r61` (`4bdb41fb`'s) and `r59`: #84 `fb8a1cc4`, 306 held, before the UTF-8 and entry checks; - `r57` and `r58`: #84 `182cac76` plus `main` `ca9e1bd5`; - `r53`: #84 `d4b99436` plus `main` `c4b55cc4`, after #85; - `r49`: #84 `d4b99436`. **Verdict at `main` `32943cbf` with this branch: AT-R1's HTTP half passes, with 314 assertions held.** That covers: - the install, the clean machine and both repositories; - the documented start: ready, with the process the harness launched; - `/` as HTML, and UTF-8; - the neutral, non-empty snapshot with a grouping tile: repository (a) has 8 documents, and repository (b), with no front matter, has 3; - `install.mode == local`, and the token on `/capabilities` neither by name nor by value; - the opener: printed, at `<OPENDOX_STATE_DIR>/console/<port>.html`, private down its whole path, a page the harness reads as the browser does, forwarding with the token in its fragment, and with a record that agrees; - the page it opens, `/index.html` on `127.0.0.1`: 200, HTML and UTF-8, and the page whose bundle, routes and catalog the rest of the run reads; - the catalog: it refuses a caller with no token, and with the token answers in the envelope the chat rail adopts, with no available entry; - one live module script as the entry, and 38 modules, none bare, divergent, malformed or from outside the plane, every one served as JavaScript and every static import 200; `/views/intent-feed.js` refused as 10.2a's not-owed dynamic import; `/styles.css` served as `text/css`; no `<base>`, no import map, no classic or inline script, and nothing unmodeled; - all 18 derived routes and every document's `/source/` form below 500, none a redirect, and no branch-session column, so no thread read; - the stop: exit status 0 within the bound, no bundled PostgreSQL process left, the opener removed, and the token in neither output stream. Pass (a)'s route answers (`r76`): ``` /actions/{dtn-seed,edit,notebook,refresh,staging-seed} HTTP 404 /actions/workbench/{chat-turn,document-abstract,model-approval,model-intake} HTTP 404 /capabilities HTTP 200 /logout HTTP 404 /snapshot-index.json HTTP 404 /snapshot.json HTTP 200 /source/ HTTP 404 /source/<each of 8 documents> HTTP 200 /source/fixture%40main/<each of 8 documents> HTTP 200 /project-register.json HTTP 404 /workbench/model-catalog HTTP 200 /workbench/model-intake HTTP 200 /workbench/thread HTTP 400 ``` ### Before T084: two product gaps, both T084's, both removed by #77 The same harness against the integration without #77 (`e7187f06`: main + #69 `f66e5f82`, #72 `1b0c3a63`, #73 `71d24af6`, #71 `83213eb2`, #74 `9061b22a`, #65 `c0a97648`) held 198 and failed 4. The 4 were these two gaps, each hit in both repositories: ``` == r6-integ-keepgoing rc=1 held=198 AT-R1 HTTP half: FAIL [a.route /project-register.json]: GET /project-register.json answers no answer (RemoteDisconnected: ...) also FAIL [a.route /workbench/thread?repository=fixture&ref=main&tile_kind=cluster&tile_id=grouping-compost-corner&document=grouping-compost-corner.md]: ... no answer (RemoteDisconnected: ...) also FAIL [b.route /project-register.json]: ... no answer (RemoteDisconnected: ...) also FAIL [b.route /workbench/thread?repository=fixture&ref=main&tile_kind=cluster&tile_id=budget-roadmap&document=budget.md]: ... no answer (RemoteDisconnected: ...) 4 failed, 198 held ``` 1. **`GET /project-register.json` dropped the connection.** `src/opendox/serve_project.py:271` (at `main` `047bb4fa`) did `from openxdox.gate_console import DEFAULT_RECORDS_DIR` (and `:272`, `from openxdox.kickoff import …`), so it raised `ModuleNotFoundError: No module named 'openxdox'`. The page requests this route on every load (`app.js:1004` → `views/repo-selector.js:138-139`). It is batch L's named crash site (`5920216845`). **Removed by #77.** The handler now reads `column_seams.gate` and `column_seams.kickoff`. openDox's default discovers no register, so the route answers the existing structured `404 "no project register"`, and the picker hides. 2. **The chat rail's thread read dropped the connection.** `src/opendox/serve_workbench.py:560` at the pre-T084 integration (`:548` at `main`) did `from openxdox import doxbench_scope`, which is reached once the five query fields are present. The rail requests it when it opens on a document (`views/staging-workbench.js:2925`). It was **not** among batch L's three named crash sites; the holder relayed it to T084's writer. **Removed by #77.** The handler now uses openDox's own scope type. With no live session on that scope, it answers `403` with the no-live-session absence body. No `from openxdox` import is left in either file at `d05c266e`, now that #77 has landed on `main`, and the runs with #77 found **no new gap**. ### The assertions bite: twelve product mutants, four workflow mutants and 221 decision mutants, all killed Product mutants, each run through the full harness: m1, m2, m4 and m5 at `b4fc637f`, and m3 again at `b440d12b`. The only harness change since `b4fc637f` is `main()`'s handling of an error while preparing. m1 and m2 were merged from `main` when #69 was at `fedfa75d` and #72 at `20032d02`. m3 to m5 are working-tree edits of the integration as it was then, `8e4203d8` (before T084): | mutant | tree | killed at | |---|---|---| | m1, no T081 | integration without #74 (`25f1f6af`) | `[a.catalog offers no available entry]`: "no model is configured, yet the catalog offers ['omp-local']" | | m2, no T073 | integration without #72 (`f3957515`) | `[a.capabilities install.mode == local]`: "the served install block is None" | | m3, the server is never stopped | `bundle.BundledServer.stop()` returns at once, and no parent-death signal | `[a.stop leaves no bundled PostgreSQL process]`: "still running after the entry point stopped: pid 599656: …/pixeltable_pgserver/pginstall/bin/postgres -D …" (and the harness's cleanup then removed it) | | m4, a governance word in the fixture | `title: A slow leak at the rain barrel, ratified` | `[a.snapshot neutral (F5.3)]`: "openxFactory's vocabulary leaked into the neutral snapshot: ['ratified']" | | m5, a missing module | `src/opendox/web/views/lens-model.js` deleted | `[a.bundle.module /views/lens-model.js]`: "imported statically by /app.js, answers HTTP 404" | T104's delivery, each a working-tree edit of the integration WITH #84, `a945ef01`, run through the full harness at `d53a7378` (`r33`): | mutant | edit | killed at | |---|---|---| | m6, a readable opener | `console_access.PRIVATE_MODE = 0o644` | `[a.console opener is private]`: "… has mode 644, not 600" | | m7, the token in the query | `opened_url` joins with `?` instead of `#` | `[a.console opener forwards with the token in its fragment]`: "the opener's forward carries the token in its QUERY …" | | m8, the opener outlives the server | `remove_private_copy` returns at once | `[a.stop removes the console opener]`: "… is still there after the server stopped …" | | m9, the token back on `/capabilities` | `build_server` publishes it on every plane | `[a.capabilities carries no console token]` | | m10, the token printed | `generate-and-open` prints `token <token>` | `[a.console token never printed]` | | m11, an unguarded catalog | the catalog's console check removed | `[a.catalog refuses a caller without the console token]`: "… answers HTTP 200 …" | | m12, the token on `/capabilities` under another name | `build_server` adds `capabilities["session_hint"] = console_token`, at #84 `d4b99436` (`r51`) | `[a.capabilities carries the opener's token nowhere]`, and no token in the log | The harness's own decisions: **221 mutants**, each a one-line edit of `acceptance/at_r1_http.py` at this head, run against `tests/test_at_r1_http_harness.py`. **All 221 are killed**, each at a named case. By family: - the inert content of a page (`lv1`-`lv9`); - the state tree's rules and the `TMPDIR` refusal (`tr1`-`tr8`), and `console/` at 0700 exactly (`dm1`); - the redaction (`rd1`-`rd9`), the published token at any depth (`nv1`), the payloads never quoted (`fo1`, `im1`), and the tokens learned before step 5 (`pk1`); - the raw payload by name and by value (`rp1`-`rp6`), and the by-value check run (`rw1`); - the chat rail's thread read (`th1`-`th3`); - the opener read whole (`ol1`, `ol2`), the bodies and peer text never quoted (`cb1`, `cb2`, `en1`), and the `Content-Type` shown only as a plain type (`ct1`); - the plane's own origin (`og1`-`og5`); - JSON as the browser parses it (`js1`, `jc1`, `bj1`, `bj2`); - divergent references (`dv1`-`dv4`, `ui1`), and encoded dot segments only (`ed1`-`ed5`); JavaScript escapes (`le1`-`le4`), line comments and a hashbang (`le5`, `le6`), and escapes a module refuses (`ms1`-`ms8`); the page's links (`ht1`, `il1`, `il2`, `bs1`, `im2`); encoded targets (`bt1`); unterminated references (`ur1`); and availability as the rail reads it (`av1`); - only a live module script is an entry (`sr1`-`sr10`), and markup the harness does not model refused (`um1`-`um6`, `um6` an attribute's unterminated reference); - the page walked is the one the opener opens, asked of its own host with its query, as HTML and UTF-8, with its modules, sheets, routes and catalog at its origin (`cp1`-`cp12`), an IPv6 host bracketed (`og6`), and the page's links resolved against its base URL (`bd1`, `bd2`); - Unicode scalar values (`su1`-`su4`), and every printed line escaped (`pr1`-`pr5`); - JavaScript's whitespace, collapsed, and a method named `import` (`ws1`-`ws4`, `ff1`); a template's `${…}` read as code, starting an expression (`tp1`-`tp3`); a `/` read as division or a regular expression by what ends before it (`rg1`-`rg6`), and one right after a `}` refused (`am1`, `am2`); a member's name never a keyword (`km1`-`km4`), a spread's and a decimal literal's `.` no member access, and a name read whole, a private one with its `#` (`km5`-`km16`); every keyword read by where it stands, `of` only in a `for` head, `for await (` a condition, a spread before an expression (`kw1`-`kw15`), and `of` the separator only after a `for` head's binding or target (`os1`-`os10`); a regular expression after a division's `/` (`pu1`) and after a line break that ends a statement (`lb1`-`lb12`); and every character of a name read as the name's (`id1`); - a redirect refused (`rx1`, `rx2`), a repeated header joined (`hj1`), and `Content-Type` parsed as a browser parses it (`mt1`-`mt3`); - UTF-8 pages (`cs1`-`cs7`); - redaction through percent-encoding (`re1`, `re2`), and no reason quoting a value the catalog, the snapshot, the record or `/` sent (`cq1`, `cq2`, `sq1`, `gq1`, `rq1`, `rq2`, `bq1`). Earlier heads' decision mutants (64, from `d53a7378` to `64dc06f5`) were each killed at their own head; their decisions stand, and their cases still pass. Workflow mutants, against the three affected cases of `tests_runtime/test_deploy_shape.py`: | mutant | killed by | |---|---| | `acceptance` gains a `postgres` service | `test_the_acceptance_job_runs_the_harness_on_a_clean_machine` | | the harness drops `-c <lock>` | `test_every_install_of_this_package_reads_one_dependency_lock` | | `acceptance` chains `&& python -m pytest -q` | `test_the_acceptance_job_runs_the_harness_on_a_clean_machine` | | `acceptance` gains its own `pip install .` step | both cases | Restored: `3 passed`. Locally, `tests_runtime/test_deploy_shape.py` and `tests/test_triple_pin.py` give `115 passed`. ### How the harness is run, and where the bundled server's state lives The harness takes **no path and no port** (only `--keep` and `--keep-going`). It installs the checkout its own file is in, and its scratch and `OPENDOX_STATE_DIR` are fresh `tempfile` directories under `TMPDIR`. To measure an integration or a product mutant, this writer copied the harness, untracked, into that tree's `acceptance/` and ran it there. - **In CI**, they sit in the runner's temporary directory, `/tmp`, which is sticky and root's. - **The socket path is capped.** The bundled server's socket is `<OPENDOX_STATE_DIR>/postgres/run/.s.PGSQL.5432`, and Linux takes at most 107 bytes. A run whose socket could not fit is refused with exit 2, before anything is installed. - **The local runs above** used `TMPDIR=~/.local/state/t095-tmp`, a 0700 directory whose every ancestor is this user's or root's. It was empty after every run, and no bundled PostgreSQL started by these runs was left running. ## Review rounds - **SonarCloud** (advisory; the gate failed at `1c064bb3` on Security Rating D, and at `0717f72f` on Security Rating B, and passes at every other head since `bbdeb9ec`). At `0717f72f`, four `python:S5332` at `plane_origin`, which built an `http://` literal around the forward's host: fixed in `b7b9b843`, which builds the origin with `urlunsplit`. Fixed in `bbdeb9ec`: - `pythonsecurity:S8703`, `S8705`, `S8707`: the `--port`, `--scratch`, `--state-base` and `--checkout` options flowed into a socket, the server's argv and the filesystem. They are gone. - `python:S5443`: the `/tmp/.s.PGSQL.5432` probe is replaced by the distribution sockets. - `python:S3776`: the lexer is a class, and the long functions are split one per step. - `python:S9073`: the acceptance job's two assertions are split. - **Copilot**, 32 rounds. Every finding was real and was fixed with evidence, a case and a mutant; every thread is answered and resolved. Three overviews named a class with no finding: the line comments' (fixed), the identifiers' (fixed) and the URL resolution's (an accepted limit, see "Accepted limits"). - At `1c064bb3`, fixed in `32ef3e8c`: - `r4170450448`: a module refused as a dynamic import hid a later static import of the same path. - `r4170450491`: a malformed 200 catalog raised a harness error instead of a named failure. - At `bbdeb9ec`: `r4170537382`, the same static-after-dynamic case. Already covered by `32ef3e8c`, and answered there. - At `32ef3e8c`, fixed in `b4fc637f`: - `r4170537350`: a server on `/tmp`'s socket alone, with TCP off, passed the fixed socket list. - `r4170567257`: a non-list `documents` value passed as "non-empty". - A "previously missed" item: a grouping value with no tile holding an id and a member document passed, and silently dropped the rail's thread read. - At `b4fc637f`, "Needs a closer look" with no new finding. It noted that the PR needs integrated verification with the dependent product changes: that is the integration above, now including T084. Its "previously missed" item, fixed in `b440d12b`: an `OSError` in `prepare()` escaped `main()` with exit 1. This head returns 2; at `b4fc637f`, an `ENOSPC` from `tempfile.mkdtemp` escaped. - At `b440d12b`, "Needs a closer look" with no findings. Its "previously missed" item, fixed in `f0e0ffe1`: the module-graph verdict had no collected regression test, and on this branch the acceptance job stops before `derive_bundle`. The new `tests/test_at_r1_http_harness.py` above answers it. - At `f0e0ffe1`, "Needs a closer look" with no findings. Its "previously missed" item, fixed in `4dcb4221`: a 200 catalog of `{"models": []}` passed, though `adoptCatalog` adopts only `schema_version === 1` and `kind === "workbench-model-catalog"`, and shows any other catalog as unreadable. The envelope is now a named check, and the served bundle must name the kind. Seven refused envelopes are tested, and relaxing the int check fails the `true` case. - At `4dcb4221`, "Needs a closer look" with no findings. - At `1c0ff975`, fixed in `f29b4ddd`: `r4173473346`, the envelope check refused `"schema_version": 1.0` and `1e0`, which JavaScript's `=== 1` adopts. It now admits any JSON number equal to 1, and never `true` or `"1"`. - At `f29b4ddd` ("Changes recommended"), fixed in `de8b2274`: - `r4173769822`: a module served 200 as `text/plain` or `text/html` passed; - `r4173769844`: so did a stylesheet. Both now require their type. - At `d53a7378` ("Changes recommended"), fixed in `5636eb8d`: - `r4173842763`: a forward holding a backslash or user information passed, though a browser opens another host; - `r4173842794`: a refused destination's message quoted a URL that could hold the token; - `r4173842805` and `r4173842811`: an unparseable printed location or refresh URL raised a harness error instead of a named failure. - At `5636eb8d` ("Changes recommended"), fixed in `486e426e`: - `r4173894317`: a refresh whose delay a browser aborts (`invalid;url=`, `-1;url=`) still yielded a token; - `r4173894352`: a token that `takeDeliveredConsoleToken` discards (`short`) passed. - At `486e426e`, "Needs a closer look" with no findings. Its "previously missed" item, fixed in `142d1352`: with an agreeing record, a forward to `/missing.html` or `/snapshot.json` passed. The forward must now open `/` or `/index.html`. - At `142d1352` ("Changes recommended"), fixed in `27479495`: - `r4174355680`: a percent-encoded copy of the token in the query passed; - previously missed: a forward to `[::1]` passed, though the plane listens on 127.0.0.1 alone; - previously missed: an import from `https://…` was fetched as its local path and passed; - previously missed: any stop exit status passed. - At `27479495` ("Changes recommended"), fixed in `64dc06f5`: - `r4174411680`: a bare specifier (`import "child.js"`) passed when `/child.js` was served; - previously missed: a FIFO opener hung the harness under `--keep-going`. - At `33841d4a` ("Changes recommended"), fixed in `4809b3d2`: - `r4174621486`: a start or route failure quoted the tail of the entry point's output, which may hold the token; - `r4174621535`: `documents: [{}]` passed, while every document's source reads were skipped. - At `4809b3d2` ("Changes recommended"), fixed in `32fbb6dc`: - `r4174671390`: a refresh inside `<template>` or `<noscript>` counted as the opener's forward. Only a live refresh counts now, as a browser that runs scripts parses the page; - `r4174671426`: the privacy check stopped at `console/`. The opener's whole path is now judged by T104's own rules, and `prepare()` refuses an unsafe `TMPDIR`; - and, from the holder's brief, no line the harness prints quotes a token (`Verdict.redact`). - At `ec95f451` ("Changes recommended"), fixed in `4d0e6d10`: - `r4175016672`: a token nested in `/capabilities` was echoed by the install-mode reason. No step-5 reason quotes a payload now, a published token is kept secret at any depth, and the opener's tokens are learned before step 5; - `r4175016692`: a body nested past the JSON parser's depth was a harness ERROR (exit 2). It is a named failure now. - At `82869769` ("Changes recommended"), fixed in `2dcb98d3`: - `r4177924060`: an opener past 64 KiB was judged by its truncated prefix. It is read whole or refused; - `r4177924097`: the catalog's reasons quoted its body, where a `\u`-escaped token passed the literal redaction. No reason quotes the server's bytes now; - `r4177924129`: same-origin was `http://loopback`, so an absolute same-origin import was refused. It is the running server's origin now. - At `2dcb98d3` ("Changes recommended"), fixed in `4bdb41fb`: - `r4178069345`: `json.loads` admitted `NaN` and `Infinity`, which `response.json()` refuses; - `r4178069374`: a backslash URL resolved to a local file, where a browser goes elsewhere; - and, on the holder's word, one adversarial pass over every parser, closing the class: JSON decoding, JavaScript escapes, the page's links, `<base>` and import maps, user information, encoded dot segments, request-target encoding, unterminated character references, and availability as the rail reads it. - At `4bdb41fb` ("Changes recommended"), fixed in `ba216f84`: - `r4178395669`: every `<script src>` was a module root, whatever its type, and inside a `<template>` too. Only a live module script is an entry now; a classic or inline script is refused by name, and a page with no entry fails; - `r4178395690`: `\uD83D\uDE00` left two surrogates that no codec encodes. Every string from JavaScript or JSON is read in Unicode scalar values now; - and the pass that closed each class: markup the harness does not model, non-UTF-8 pages, escapes a module refuses, redirects, `Content-Type` parsing, and printed lines a server could forge. - At `ba216f84` ("Changes recommended"), fixed in `9229c659`: - `r4178913887`: U+FEFF after `import` hid the import, as Python's `\s` lacks it. The lexer reads JavaScript's own whitespace now, and every run as one space, so no run or comment hides an import either; - `r4178913911`: the catalog's reasons quoted its envelope values and available ids, where a percent-encoded token passed the redaction. No reason quotes a value the product sent now, and the redaction sees through percent-encoding; - `r4178913926`: an encoded dot inside a file name (`child%2Ejs`) was refused as a dot segment. Only a whole segment is one now. - At `9229c659`, "Needs a closer look" with no findings. Its overview, fixed in `3392f934`: a line comment ended only at LF, so one ended by CR, U+2028 or U+2029 hid the next line's import. A hashbang line is read as a comment too. - At `3392f934` ("Changes recommended"), fixed in `0717f72f`: - `r4179115282`: a template's `${…}` was skipped by counting braces, so an import or a route inside one was never seen. It is read as code now; - `r4179115311`: only `/` was checked and walked, though the opener opens `/index.html`. The page the forward opens is asked of the forward's own host, with its query, must be HTML and UTF-8, and is the page whose bundle, routes and catalog are read. - At `0717f72f` ("Changes recommended"), fixed in `b7b9b843`: - `r4179220628`: a `${` left the lexer after an expression, so a `/` opening a regular expression read as division, and the expression's `}` closed the interpolation early. An interpolation starts an expression now; - `r4179220641`: `html.unescape` read `©=2` in a page's `src` or `href`, which a browser keeps as text. Such a tag is refused by name, as the opener's refresh already was. - At `b7b9b843` ("Changes recommended"), fixed in `d50e8cef`: - `r4179348386`: after a postfix `++` or `--` (`n++ / 2`), a `/` was read as a regular expression, which swallowed the next import. The lexer now reads what ends before a `/`: a postfix operator, a call or a group divides, and a prefix operator or the `)` of an `if`, `while`, `for` or `with` condition opens a regular expression; - `r4179348414`: an accepted `<base href="/">` was ignored, so `src="?m=1"` on `/index.html` was asked as `/index.html?m=1`, not `/?m=1`. The page's scripts and stylesheets resolve against its base URL now. - At `d50e8cef` ("Changes recommended"), fixed in `04579fcd`: `r4180454790`, a `/` after a `}` that ends an expression (`{} / 2`, a function or class expression) divides, and was read as a regular expression. A lexer cannot tell such a `}` from a block's, so a module with a `/` right after a `}` is refused by name now (`[bundle.ambiguous-slash <path>]`). The real bundle has none (the lexer decides 213 `/` there, none after a `}`). `ff04e015` then merged `main` `32943cbf` (T104). - At `ff04e015` ("Changes recommended"), fixed in `1d581541`: `r4180554323`, a member named as a keyword (`obj.return / 2`, `obj.if(1) / 2`, `obj.of++ / 2`) was read as the keyword, so each `/` hid the import after it. A member's name is never a keyword now. The self-pass after it, in `ea4f7838`: the last `.` of a spread (`[...typeof /re/]`) and a decimal literal's own point (`1. in /re/`) are no member access, so the keyword after either is still one; and the last name is read whole, so `ñreturn` and `this.#return` are names. - At `ea4f7838`, "Needs a closer look" with no findings. Its overview named "a verified lexer error" that "can hide missing static dependencies". The pass that followed, in `bd50f405` (with a case in `234229d7` for a mutant that survived), found four, each hiding an import: `of` read as a keyword outside a `for` head (`const of = 4; of / 2`); no condition opened by `for await (`; a regular expression after a spread's `...` read as a division; and `default`, `extends`, and `break`, `continue` and `debugger` before a line break, after which an expression or a statement starts. - At `234229d7` ("Changes recommended"), fixed in `09d9d632`: `r4180899047`, `of` was a keyword anywhere in a `for` head, so in a classic loop's initializer, condition or update (`let of = 4; for (; of / 2; ) break;`) the `/` opened a regular expression that swallowed the import after it. `of` is a keyword only as the head's separator now, right after its binding or target. The self-pass after it, in `e4f81d48`, is a differential check of the lexer against node's own module parser, run locally (the static module requests of a `vm.SourceTextModule`). It covers 196 contexts, each a regular expression or a division before a static import, with five kinds of separator. Node accepts 978 of the snippets as modules. The lexer hid the import in 195 of them at `ff04e015`, and in 85 at `09d9d632`. It now hides it in 10, all one form: a declaration list's last binding with no initializer, then a line break and a regular expression (`let x, y` [line break] `/re/`), which would take a parser. It has no false failure, and the same 10 are refused by name throughout. The 85 were a regular expression after a division's own `/`, and after a line break that ends a statement by automatic semicolon insertion: before a `++` or `--`, after a labelled `break` or `continue`, a declaration's lone binding, or a static import's specifier. - At `e4f81d48`, "Needs a closer look" with no findings. Its overview named "URL-resolution and identifier-parsing errors". Under the holder's convergence ruling (see "Accepted limits"), the identifier class was a one-line fix with a test, made in `d698c6ea`: a ZWNJ, a ZWJ, a combining mark or another name character that Python's `\w` lacks split a name. The URL class is an accepted limit: it appears in contrived references only, and all 84 shipped specifiers resolve as the URL standard resolves them. - At `d698c6ea`, "Needs a closer look" with no findings. The overview says the harness's "custom browser parsing and database-process lifecycle checks warrant final integrated human verification", and names no form. It was the last push of the review rounds. - `d29e68ca` merges `main` `dede32b4` for the T095 refresh. The merge is clean (main and this branch share no file) and changes nothing of this PR's own. At `d29e68ca`: "Needs a closer look" with no findings and no thread. Its overview repeats `d698c6ea`'s: the browser modeling and the database-process lifecycle checks "warrant human sign-off despite reported green CI". It names no form, so there is nothing to classify. ## Plan changes this PR carries - **T007 batch N** (openxFactory `bdd0f586`, RULED `5963851934`): the raw `/capabilities` payload carries the console token neither by name, at any depth, nor by value, as quickstart § 3 asserts it; `console/` is 0700 exactly (`eb81b3d8`). The id CI's by-design failure names, `[a.capabilities carries no console token]`, is the by-name check. Product mutant m12 (the token under another key) is killed by the by-value check. - **The holder's T096 dry run, F4, after openDox-code#85** (the T102 follow-on, holder ruling F1 (i)): a standalone plane's rail sends no thread read, so the harness asks none with a query, and asserts the condition, no branch-session column (`4d0e6d10`). ## Not done here - No ruleset change: making `acceptance` required is the owner's. - No fix to any other writer's PR; gaps found are reported. - No README edit: the openDox root's README is T076's (openDox#17). 🤖 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>





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 openxFactorymain2140f5a7and again, unchanged, atmaina883bbf6, 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 comment5880893901and 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 is5916000030, item 1: "Yes, amendment batch K (Recommended)".tasks.mdpoints to it after 16.3's batch H addendum.5890601202) takes the rule that a credential the built-in resolver resolves takes (5880893901). Each is sent only overhttps://, or overhttp://to127.0.0.1,[::1]orlocalhost.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 plainhttp://it takes no proxy.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 tomainwhen #63 landed. T100 (#82, another writer's PR) is stacked on this branch, so retarget #82 tomainbefore this branch is deleted, because a merge with--delete-branchcloses the PR stacked on it.What changes
At
main, and unchanged at #63's head3f14bb96, 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, atmain2d116415and at3f14bb96alike. Each is now closed by T080's own rule, reusing #63's helpers. #63's merge ofmain,4948e6dd, changes none of the stack's files, so the base reads the same there.3f14bb96http://to any host.is_a_private_route) and with the same fixedENDPOINT_NOT_PRIVATEsentence.mintasks the predicate again before it asks the broker for anything.http_proxyset, a request to127.0.0.1went to the proxy with it.DIAG_PROVIDER_REDIRECTED), and over plainhttp://it uses no proxy.URLError, anddo_open.headers,_send_request.headers,_send_output.msg,send.dataandrequest.headersheld the token.DIAG_PROVIDER_UNREACHABLE, which names the wrong party. One with a space or another non-ASCII character was sent as it was.mintasks_presentableof 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_routeasks the rule of every record that presents a credential. Only the auth kindnone, which presents nothing, keeps whatever route it declares.ENDPOINT_NOT_PRIVATEnow names both credentials.BrokeredProviderPort._call_providermakes every provider request, on both paths. With a credential, it uses_open_with_a_credential(T080, 16.3: the credential stays a reference, and a raw key is refused (plan 034) #63's opener, renamed) and raises any refusal afresh. T080, 16.3: the credential stays a reference, and a raw key is refused (plan 034) #63's_dispatch_without_a_brokeris rebuilt on it and behaves as before.The broker branch of
dispatchanswers 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.mintreads 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:
NaN,Infinityor-Infinity), in_parse_expires_at;_answer_document, for all four broker operations.Before, the first escaped
mintas anOverflowErrorand the last as aRecursionError, 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, asDIAG_PROVIDER_MALFORMED(da9e639a;a271d307then namesValueErroralone for the decode error, SonarCloud S5713)._post_to_providerserves every path, so a broker's token, the built-in resolver's key andnoneeach refuse.RecursionError, whose traceback kept the request with its authorization header. It did so at T080, 16.3: the credential stays a reference, and a raw key is refused (plan 034) #63's head and atmaintoo (measured; flag 12).DIAG_PROVIDER_REDIRECTED,_DeclineRedirects,_presentableand_PresentedCredentialnow name both credentials. The four gaps leftFIXED_DIAGNOSTICSat 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:788d764banswer, and the child's_fileobj2outputDIAG_BROKER_REFUSED, keeping nothingDIAG_BROKER_MALFORMED, like an answer of the wrong shapeDIAG_BROKER_OVERSIZE, a new sentence, keeping nothingTimeoutExpired, whoseoutput, and whose frames insidesubprocess, held the tokenDIAG_BROKER_TIMEOUT, with no cause and no contextUnicodeDecodeErrorescaped every operation, holding the token inobjectDIAG_BROKER_MALFORMED(orDIAG_BROKER_TIMEOUTif it then hangs), keeping nothingFileNotFoundErrorDIAG_BROKER_UNREACHABLE, with no cause and no context25788f91)DIAG_BROKER_OVERSIZEas soon as it passes the bound, and killedb847ef3danda603a032)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). Ata603a032, a descendant that left the group held the refusal for a 2 s grace and left a blocked reader thread, with its descriptor, behind.a603a032, the refusal waited past 10 s: the timeout began only once the credential was writtenb847ef3d, the broker was left running with its reader blocked, and the interpreter aborted at exit (Fatal Python error: _enter_buffered_busy)a271d307)a271d307, refused at once, but the descendant went on running, one more for each such call (measured: both still running a second later)At
788d764bno refusal named its operation either. Two of the sentences said "so no token could be minted", whichever operation had failed.How, in the code:
_run_broker, which returns an answer or a sentence and raises no refusal.subprocess_broker_runnerraises the refusal after it returns. So the refusal is outside every handler, in a frame that never held the child or its answer._answer_of) streams the credential to the broker inPIPE_BUFwrites and reads the answer, ascommunicatedoes on POSIX. There is no reader thread. One deadline covers both. At most one byte pastMAX_BROKER_ANSWER_BYTESis read, straight into one list, so no other name holds it. The child's exit is awaited within what is left of the timeout.process_group=0; the session and the terminal stay this process's)._reapkills 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.communicateused the locale's. An answer that is not UTF-8 is malformed._broker_operation, which replacesmint'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 refusedintake,revokeandlistanswers.BrokerRefusedtakesoperation=, fromOPERATIONSonly and only beside a broker's sentence (BROKER_DIAGNOSTICS). Its message readsbroker <operation>: <sentence>, for examplebroker intake: the credential broker exited non-zero, and its answer is withheld by design..diagnosticis still the sentence alone, so every caller that compares it is unchanged.FIXED_DIAGNOSTICShas twelve.bbcb565e, after Copilot ata271d307).os.waitid(…, WNOWAIT)(_exit_status_unreaped, inf8bc8aca, after Copilot atbbcb565e)._reapsignals the group._reapsignals a group only while the broker is unreaped._REAP_GRACE_SECONDS, 5 s, asruntime/local_git_adapterbounds its own. CPython reaps a broker that outlives that once itsPopenis collected.os.waitiddoes not exist, the exit is read with a reap, and no group is signalled._settled, which decodes the answer in place in the one list that holds it.Files:
src/opendox/doxbench_binding.py,src/opendox/doxbench_provider.pyandtests/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.ymlandpyproject.tomlare untouched.Merging #63, and then
main(63e534cb)63e534cbmergesmain1130e996, which is T080's squash (#63). This branch was stacked on #63's branch, so the merge takesmainwhole and replays none of #63's own commits. Its tree is the three-way merge of this branch andmainover their old base, #63's4948e6dd(git merge-tree --merge-base 4948e6dd f8bc8aca 1130e996), with three resolutions and nothing else:functoolshere,http.clientthere). Both are kept.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 thenonebinding alone.ENDPOINT_SCHEME_REFUSED's comment names both credentials thatENDPOINT_NOT_PRIVATEcovers 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 (T080, 16.3: the credential stays a reference, and a raw key is refused (plan 034) #63's M2).http.client.HTTPException(T080, 16.3: the credential stays a reference, and a raw key is refused (plan 034) #63's L4).mainalso 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,
e1a6cb0fmerged #63's head4948e6dd, which carriedmain047bb4fa(phase 2's nine landings). Copilot's reviews of that merge and of the heads after it found four things, each fixed here (da9e639a,bbcb565eandf8bc8aca), and SonarCloud two more kinds (f0d28a79anda271d307).After the merge, two commits answer the holder and the adversarial review:
b8323d01, the adversarial review's L4 for the broker path. T080, 16.3: the credential stays a reference, and a raw key is refused (plan 034) #63 maps anhttp.client.HTTPExceptionin 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
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
3f14bb96it did:mint.answer,mint.document,_answer_document.textand_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.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).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 editandremoveread the whole document first, so they refuse too, and the operator edits the file by hand to anhttps://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).T080's scope pin is replaced.
test_the_loopback_rule_is_the_built_in_resolvers_alonepinned T080's scope by declaring a broker binding on two plain-http://routes. That half is gone. The case is nowtest_a_none_binding_keeps_a_route_that_is_not_private, over all nine routes. T080, 16.3: the credential stays a reference, and a raw key is refused (plan 034) #63's body cites the old case among the broker path's pre-existing gaps, which this PR closes.A reading. An opener installed process-wide with
urllib.request.install_openerno longer serves a request that carries a credential. It already did not serve a built-in one. Nothing in openDox installs one.The operator reads new text.
model-binding set-credentialand the console's intake route both show a broker refusal'sstr(). That now readsbroker <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 T055, serve and generate standalone (5.5, 4.3 part) (plan 034) #59, which edited it, has landed.A twelfth sentence. An answer past the bound had
DIAG_BROKER_MALFORMED, and now hasDIAG_BROKER_OVERSIZE, so the refusal names that class. The provider's own bound stays onDIAG_PROVIDER_MALFORMED. Say so if you would rather keep eleven, and the old class.Two cases past the ruling's three.
788d764b. It escaped as aUnicodeDecodeErrorholding the token. It is the same runner and the same rule, so it is refused here too.25788f91found the bound was checked only after the whole answer was read. The bound now limits the read itself.Not changed: the input side of
intake. This was measured at25788f91and again atb847ef3d. Sincee3eec6b1the 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:UnicodeEncodeErrorwhoseobjectholds the credential.sys.stdincan yield one undersurrogateescape. The stand-in broker still received, and stored, the credential without that character.UnicodeDecodeError.This is the operator's input, not the broker's output, so it is outside the ruling. Should a follow-up refuse it?
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 withoutkillpgthe broker alone is killed. Nothing in this repository runs on Windows, and CI is Linux. Say so if the runner must also run there.Ruled: the operator's input stays without a time limit. Copilot at
e75900ffsaid a credential source whoseread()blocks (sys.stdinin 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 comment5916000030, item 5: "Leave unbounded (Recommended)". Operator input is outside the broker-runner ruling. No code changed for it.The nested provider answer is fixed here, for every path, and the holder decided it stays here (2026-10-02). T080, 16.3: the credential stays a reference, and a raw key is refused (plan 034) #63 and Broker-path credential hardening (follows T080): a minted token keeps a built-in credential's rules (plan 034) #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.
da9e639achanges the parse that T080, 16.3: the credential stays a reference, and a raw key is refused (plan 034) #63's built-in path andnoneshare. Measured at T080, 16.3: the credential stays a reference, and a raw key is refused (plan 034) #63's head4948e6dd, all three paths escape with aRecursionError, and so doesmain's broker path at047bb4fa. T080, 16.3: the credential stays a reference, and a raw key is refused (plan 034) #63's body says so.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 asDIAG_BROKER_MALFORMED, and the helper was still running a second later. Sincee313437b, the subprocess runner reads each operation's answer while the broker is a zombie, its exit read withWNOWAIT(_settled, givenread)._broker_operationhands 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.SonarCloud's S3776 on
_answer_ofis 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 beforef8bc8acamoved its tail into_settled. The quality gate passes, and the runner's mutants pin the code.e313437bonly passesreadthrough it, and its complexity is unchanged.For the holder, downstream:
tests/test_doxchat_model_intake.pybuilds its bindings onhttps://only, and asserts only that an intake refusal has a reason, not its text.BindingRefusedhandler (serve_workbench.py, left alone). So a posted broker binding on plainhttp://to another host is refused there with the fixed sentence.e313437b, the only other open openDox-code PR that touches these three files is T100 (T100, 16.3a: a served repository's bindings are trusted per machine (plan 034) #82), stacked on this branch at63e534cb. A trial merge of this head with T100, 16.3a: a served repository's bindings are trusted per machine (plan 034) #82's1ef4c71dconflicts in one place,_broker_operation's docstring, where each side added a paragraph, and T100, 16.3a: a served repository's bindings are trusted per machine (plan 034) #82's trust check, which goes before the argv is built. Both are kept by the obvious resolution.main1130e996.The tests
The four gaps' cases fail at
3f14bb96Each gap's cases ran with
3f14bb96'ssrc(the base, whose broker path ismain'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 anOverflowErrororRecursionErrorescaping. The controls beside them pass there too.3f14bb96mintasking no broker for a binding forced past the record; the operator door refusing one and storing nothingnoneroutes.NaN,Infinity,-Infinity, nesting past the recursion limit) keeping no frame, cause or contextThe proxy cases, T080's included, now drop
urlopen's cached global opener first (_an_environment_proxy).urlopenreads the proxy environment only when it builds that opener. Without the reset, the broker's proxy case passed at3f14bb96whenever 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
788d764bEach 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'ssrcand this branch's test module, 43 of the 44 cases fail, on the behaviour:UnicodeDecodeErrorescape;TimeoutExpired;FileNotFoundError;788d764b25788f91(5.1 s measured).set-credentialdoor, with a broker that wrote and exited non-zeroFive later cases answer Copilot and a finding of this PR's own, each measured at the head it answers:
e3eec6b1. The one that left the group takes 2.5 s ata603a032.a603a032it held the refusal past 10 s.b847ef3dit aborts, 3 of 3 runs.chunk, holding the answer, which is removed. Its two mutants are killed.This round's cases
b8323d01): T080, 16.3: the credential stays a reference, and a raw key is refused (plan 034) #63's sixhttp.client.HTTPExceptioncases, 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 T080, 16.3: the credential stays a reference, and a raw key is refused (plan 034) #63's transport (05cb1c70), where the broker path chains its cause, all six fail on that cause.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 at63e534cb, with[] == ['Z'].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 at63e534cbtoo.Copilot's rounds after the merge of
maine1a6cb0f), once for each credential source: a broker's token, the built-in resolver's key, andnone. All three fail ate1a6cb0f, with theRecursionError.a271d307). The broker leaves a descendant holding none of its pipes, then exits non-zero or answers in no UTF-8. Both cases fail ata271d307, with the descendant still running. Sincef8bc8aca, each also checks that the group is signalled once, while the broker is a zombie. Withbbcb565e's provider that reads[None].bbcb565e). Withos.waitidremoved, nokillpgcomes after the reap. Withbbcb565e's provider, one did.bbcb565e). The broker'swaitbehaves like that of a broker stuck in uninterruptible I/O. Withbbcb565e'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:mint's own route check removedtest_mint_asks_no_broker_for_a_token_on_a_route_that_is_not_privatenonetoononeroutes, and T080's operator-door caseNaNand both infinitiesfloat()RecursionErrorfrom the JSON reader not caught788d764bDIAG_BROKER_MALFORMED, as at788d764bRecursionError(da9e639a, and again ata271d307)ValueError(a271d307)test_a_refusal_of_a_turn_that_presented_a_token_chains_nothing[malformed], with aJSONDecodeErrorbbcb565e, and again atf8bc8aca)bbcb565e)f8bc8aca)waitidwithoutWNOWAIT, so reading the exit reaps (f8bc8aca)f8bc8aca)os.waitidf8bc8aca)b8323d01)e313437b)e313437b)e313437b)Review
Each inline thread is answered with evidence and resolved.
af457e66a2c838a0, the docstring onlya2c838a0mint, andNaNand the infinities were taken788d764b, which also closed theRecursionErrorof the same class788d764b25788f91b847ef3d, and this descriptionb847ef3d_reapwait forever; this description was stale (read before it was updated)a603a032, and this description.e3eec6b1between them reaps a broker whose credential source fails.a603a032e75900ffe75900ffread()blocks holds the loop past the deadlinee75900ff.e75900ff, asked againe1a6cb0f, the merge ofmain_post_to_provideras aRecursionError, its traceback keeping the requestda9e639af0d28a79a271d307bbcb565ebbcb565ef8bc8acaf8bc8acaf8bc8aca, asked again through the reviewer APIe75900ffas this head63e534cb, the merge ofmain1130e996e313437b, L4's broker cases and Q24173524883SonarCloud's check passed at each head, and its quality gate is OK. Its API read 0 issues at
af457e66and at788d764b. Ate1a6cb0fit read five, all from the runner's commits of 2026-09-30: four S5778 in the tests, fixed inf0d28a79, and one S3776. The catchda9e639atouched drew an S5713, fixed ina271d307. Atf8bc8acaone 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 fortests_runtimeandLANG=C.UTF-8:main1130e996(T080 landed)63e534cb, the merge ofmaine313437bmain1130e996's row is #63's last head05cb1c70's run, and its tree is1130e996's, byte for byte. Before this round, #63's4948e6ddread 3206,e1a6cb0f3309 andf8bc8aca3316. Before phase 2 landed, #63's3f14bb96read 2630,788d764b(before the runner ruling) 2686, ande75900ff2733.The +118 cases are all in
tests/test_model_provider_broker.py:os.waitid, and the bounded wait;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), andtests/test_provider_boundary.pypasses (24).CI's
validateat this head (run37129092647) readsselected=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 intomain5e7ab003, 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.ymlwas outside the draft-ahead scope, as it was for #61 to #63.🤖 Generated with Claude Code
Summary by Sourcery
Harden broker-minted credential handling and broker execution so credentials remain on private routes and every broker failure is bounded, redacted, and safely cleaned up.
New Features:
Bug Fixes:
Enhancements:
Tests: