Skip to content

T014: submission_factory and _submission_port, defaulting to LocalGitSubmissions (plan 038) - #93

Merged
brettheap merged 18 commits into
mainfrom
r2/t014-submission-factory
Oct 6, 2026
Merged

brettheap merged 18 commits into
mainfrom
r2/t014-submission-factory

Conversation

@brettheap

@brettheap brettheap commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

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

T014: submission_factory and _submission_port (plan 038, P4-B)

#92 (T011) has LANDED, as 09b8d44a. This branch was stacked on it and now merges main at 09b8d44a. Its diff against main is T014's three files alone, from commits 930875db and 41a2d6ea. The merge brought nothing new to the tree: main's tests/test_submission_default.py is T011's eb4976f6 copy, which this branch already carried, so the add/add conflict there resolved to this branch's copy. The tree at 7a86c8a7 is byte-identical to 96a6ca83's.

What it adds

  • serve.py: submission_factory, beside pull_request_factory but separate from it, in three places:
    • a class attribute on DashboardHandler;
    • a build_server(submission_factory=None) keyword, with its docstring paragraph;
    • its compose entry in the bound handler's attributes (staticmethod(f) if one is given, else None, as pull_request_factory has).
  • serve.py: the accessor, DashboardHandler._session_submissions().
    • With nothing injected, it builds LocalGitSubmissions(Path(self.checkout_root)), a plain git push that names no platform and uses no gh.
    • It answers only where the session capability is true, the same rule as _session_pull_requests. The push uses the invoking user's own git credentials, and a hosted plane never holds them.
    • An injected factory is the binding. This is the seam through which a governed host may contribute its own SubmissionPort; none does in release 2 (R2Q3 (a)).
    • A port that cannot be built leaves no port, rather than an error, exactly as for the pull-request port.
  • cli.py: _submission_port(repo_root), beside _pull_request_port. It returns LocalGitSubmissions(repo_root), a named seam as _pull_request_port is.
  • Unchanged (R2Q2 (a)): pull_request_factory and _pull_request_port keep GhPullRequests as their unset default and serve gate open-pr as before. _session_pull_requests and _pull_request_port are not edited.
  • The verb and the route are not here. T015 adds submit and POST /actions/session/submit; they take their port from these two bindings.

Files (T014's own commits, 930875db and 41a2d6ea)

  • src/opendox/serve.py: the first phase-4 edit of this file (T014 → T015 → T016 → T052 → T057).

  • src/opendox/cli.py: the first phase-4 edit of this file (T014 → T016 → T046 → T052).

  • tests/test_submission_default.py: the server node, and two nodes beside it, so each new branch has a case that fails without it:

    • test_server_unset_submission_factory_binds_the_neutral_default: F12.2's named node.
      • A server built with nothing injected binds LocalGitSubmissions for its own checkout. It is a SubmissionPort and not a PullRequestPort, and it pushes sess-1 to a local bare origin.
      • The unset pull_request_factory still builds GhPullRequests.
      • A hosted handler declares no submission port.
    • test_an_injected_submission_factory_is_the_servers_binding: an injected factory's port is the binding, and a factory that raises leaves None.
    • test_cli_unset_submission_port_binds_the_neutral_default: cli._submission_port(checkout) is the neutral class for that checkout and pushes there, and cli._pull_request_port is still GhPullRequests. F12.2's block asserts this inline too, but only once T015's submit verb exists, so the suite carries its own case.
  • SonarCloud's one finding, fixed. At 672107ab it raised python:S9073 on tests/test_submission_default.py:304, a composite assert ... and ... in the neutral-port helper. 41a2d6ea splits it into two asserts and changes no behaviour.

The falsifier, run (red first)

Red was measured at T011's 5e3ca9c2, with this PR's test file and no src change:

E       AttributeError: type object 'BoundDashboardHandler' has no attribute '_session_submissions'
E       TypeError: build_server() got an unexpected keyword argument 'submission_factory'
E       AttributeError: module 'opendox.cli' has no attribute '_submission_port'
FAILED tests/test_submission_default.py::test_server_unset_submission_factory_binds_the_neutral_default
FAILED tests/test_submission_default.py::test_an_injected_submission_factory_is_the_servers_binding
FAILED tests/test_submission_default.py::test_cli_unset_submission_port_binds_the_neutral_default
3 failed, 1 passed in 2.79s

(The 1 that passed is T011's credential node.)

Green was measured at 7a86c8a7, with gh hidden from PATH (CF-8) and CI=true. Two neighbours are included: tests/test_web_boundary.py (T025's change, now on main) and tests/test_provider_boundary.py (T011's last fix, now on main):

$ PATH=<venv>/bin:/usr/bin:/bin; command -v gh || echo 'gh: not found'
gh: not found
$ python -m pytest -q -rA tests/test_submission_default.py tests/test_submission_port.py tests/test_web_boundary.py tests/test_provider_boundary.py
PASSED tests/test_submission_default.py::test_a_credential_in_the_remote_url_never_reaches_the_report
PASSED tests/test_submission_default.py::test_server_unset_submission_factory_binds_the_neutral_default
PASSED tests/test_submission_default.py::test_an_injected_submission_factory_is_the_servers_binding
PASSED tests/test_submission_default.py::test_cli_unset_submission_port_binds_the_neutral_default
...
103 passed in 11.36s

Mutants: 12, all killed

Each mutant replaces one exact string in serve.py or cli.py, runs tests/test_submission_default.py, and restores the file byte for byte. They were run at 7a86c8a7:

KILLED   M1 session gate removed: 1 failed, 3 passed             (server node)
KILLED   M2 session gate inverted: 2 failed, 2 passed            (server node, injection node)
KILLED   M3 injected factory ignored: 1 failed, 3 passed         (injection node)
KILLED   M4 construction failure propagates (no try/except): 1 failed, 3 passed   (injection node)
KILLED   M5 unset default is GhPullRequests: 1 failed, 3 passed  (server node)
KILLED   M6 unset default bound to another root: 1 failed, 3 passed   (server node)
KILLED   M7 unset default is absence: 1 failed, 3 passed         (server node)
KILLED   M8 compose entry drops the factory: 1 failed, 3 passed  (injection node)
KILLED   M9 compose entry absent: 1 failed, 3 passed             (injection node)
KILLED   M10 CLI default is GhPullRequests: 1 failed, 3 passed   (CLI node)
KILLED   M11 CLI default bound to the cwd: 1 failed, 3 passed    (CLI node)
KILLED   M12 CLI default is absence: 1 failed, 3 passed          (CLI node)

test_session_snapshot.py:893-916, unchanged and green, composed

  • Where it lives. The protected node is openXdox-code's tests/test_session_snapshot.py::test_the_loopback_serve_declares_the_pull_request_port. It asserts that the server's unset port IS GhPullRequests.
  • Why it runs composed. The file is in openXdox-code's declared exclusion (it reaches openxFactory's doc_health), so it runs only with openxFactory's scripts/ on PYTHONPATH, as F12.1 runs (R2Q8 (a), CF-5).
  • How it was run.
    • openXdox-code at main c6d15b27, installed with its own .[test].
    • openxFactory at main 51456835, with its nested openDox initialised (dede32b4).
    • Then this branch's tree (T014's commit 930875db) installed over the pinned opendox.
    • A one-line session hook printed which opendox.serve the run imported.
  • Results.
pinned opendox (dede32b4):  tests/test_session_snapshot.py                    23 passed in 13.53s
this branch's opendox:      tests/test_session_snapshot.py                    23 passed in 24.56s
this branch's opendox:      ...::test_the_loopback_serve_declares_the_pull_request_port   1 passed in 1.60s
WHICH-OPENDOX serve=<xvenv>/site-packages/opendox/serve.py _session_submissions=True cli._submission_port=True

openXdox-code's tree was not edited.

The whole suite, as validate runs it

  • The run. It was measured locally over T014's commit 930875db, before T011's later heads (with main 84f8ed83) were merged in, with CI=true, OPENDOX_TEST_SANDBOX_REQUIRED=1 and a postgres:16 service: 5515 passed, 11 skipped, 2 warnings in 1478.33s, exit 0.
  • SKIPPED stays 11, which is EXPECT_SKIPPED.
  • CI over the same tree. validate at 96a6ca83, whose tree 7a86c8a7 keeps byte for byte, printed triple: selected=5535 passed=5524 skipped=11 failures=0 errors=0 (run 37515293136), with the sandbox proved live and a write outside its tmpfs refused.
  • The sandbox, not measured here. bubblewrap 0.9.0 is installed on the local host, but it cannot create user namespaces there, and no test reads the sandbox switch yet. So the live sandbox is proved by this PR's own validate run, not locally.

Copilot's one finding, an accepted limit

What is NOT done

  • The submit verb, its route and its control are T015. landing_factory and _landing_port are T016.
  • No governed host contributes a SubmissionPort in release 2 (R2Q2 (a) with R2Q3 (a)). The host-side proof that the governed flow is unchanged is T019 (openxFactory).
  • The CI floors are not moved here. MIN_SELECTED and MIN_PASSED are floors, and the three new nodes raise both counts. T017 re-pins phase 4's floors (.github/workflows/validate.yml is not T014's file).
  • No box is ticked. T082 ticks 12.4.

🤖 Generated with Claude Code

Summary by Sourcery

Provide neutral local-Git submission bindings for server and CLI session workflows while preserving the existing pull-request integration.

New Features:

  • Add server and CLI submission-port bindings that default to local Git submissions for the current checkout.
  • Allow hosted integrations to inject a custom submission port through the server factory.

Enhancements:

  • Keep submission capability gated to local session contexts and treat unavailable injected ports as absent.
  • Preserve the existing GitHub pull-request bindings independently from submission handling.

Tests:

  • Add coverage for default, injected, unavailable, hosted, and CLI submission-port bindings, including local branch pushes.

brettheap and others added 10 commits October 6, 2026 10:58
…rget (plan 038)

The neutral submit act, #1144 boxes 12.1, 12.1a, 12.2 and 12.3 (refs
opensoft/openXfactory#1144; plan 038 T011; ruled #656 6003486656 R2Q1, R2Q2,
R2Q5 and 6013547504, CF-7).

session_pr.py gains NEW names only, in one delimited block after the
existing classes: SubmissionPort (one operation, submit), Submission (remote,
ref, url redacted, branch, commit), SubmissionError with NoSubmissionTarget
and SubmissionRefused, and LocalGitSubmissions(checkout_root). PullRequestPort,
GhPullRequests and FakePullRequests are untouched.

submission_push.py is the submission's git half. It chooses origin, else the
sole remote (no remote, or several and none named origin, is
NoSubmissionTarget), refuses main, checks the branch as a ref name, requires
one push URL, and hands the push to the runtime's push core. The remote URL is
redacted everywhere: userinfo and every query and fragment value replaced,
scheme, host, port and path kept; foreign text is scrubbed of the URL's held
secrets.

repository_act.py: the push core is factored so it takes a plan. The
runtime's own checks become _mapped_push_plan (unchanged lines), the send
stays in _push_to_remote_with (two runtime tests read its source), now driven
by a PushPlan, and push_to_remote names a failed push exactly as before. The
repository-local command-config refusal is kept and applies to both callers.
_bound_local_destination gains contained=True; only the submission passes
False, because a checkout has no service root.

Tests: tests/test_submission_default.py holds F12.2's credential node, which
pushes for real to a loopback smart-HTTP remote whose URL carries a userinfo
secret and two query tokens; tests/test_submission_port.py covers every
refusal. Every remote is local or loopback, never the network.

Lane: openxfactory-4
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Copilot, both fix-now:
- r4194480639: a linked worktree's git and common directories are now held
  by descriptor for the whole submission (local_git_adapter's
  metadata_held_open), after the root check, which moved ahead of it because
  a bound GIT_DIR makes git read the working directory as the top level.
- r4194480699: the push URL is read exactly, git's terminating newline
  aside, and one with surrounding whitespace is refused rather than trimmed
  (a local path with a trailing space names another directory).

SonarCloud: the moved runtime comment no longer spells a credential-shaped
URL (secrets:S8136); the nested conditional in the query redaction is a
helper (python:S3358); the tests build the port outside pytest.raises
(python:S5778) and assert one thing per line (python:S9073).

Tests: two new cases, the whitespace refusal and the linked worktree; 27
mutants, all killed.

Lane: openxfactory-4
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… 038)

Copilot r4194631880, fix-now: the push URL's get-url lines are no longer
filtered. A URL holding a newline prints as two lines (measured on git
2.43.0), so it now counts as two destinations and is refused, instead of
being pushed to the pathname without the newline. An empty URL, or one
holding a control character, is refused with the whitespace-bearing one.

Copilot r4194631803, an accepted limit, answered on the thread: a network
destination is pushed by remote name, so git re-reads the checkout's own
config at push time, as the runtime's push already does. Changing the URL in
that window needs a concurrent writer to the user's own .git/config, who
already decides what every other git command the user runs will execute.

SonarCloud python:S3358: the held-secrets selection is an if/elif.

Tests: the newline URL, trailing and leading; 28 mutants, all killed.

Lane: openxfactory-4
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Both fix-now:
- r4195368599: no refusal raised after the remote URL is read chains its
  cause any more (from None). The cause's message is git's stderr, redacted
  by pattern only, so a query value under a name no pattern knows survived
  in it and a logged traceback printed it. The credential node now asserts
  the formatted traceback of each refusal, not only its message.
- r4195368695: an ssh userinfo is kept as a login name only when it is
  plainly one ([A-Za-z0-9._-]+). A percent-encoded colon (git%3As3cret), or
  any other character, makes it a credential, in the report and in the
  held-secrets scrub alike.

Tests: the encoded and twice-encoded ssh password; 30 mutants, all killed.

Lane: openxfactory-4
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…(plan 038)

Copilot r4195504431, fix-now: a push URL whose scheme git does not carry
itself (evil://...) is refused before the push. Measured on git 2.43.0, git
resolves and runs git-remote-<scheme> from PATH for it, the <name>:: hazard
under a second spelling. The test plants a marker-leaving git-remote-evil on
PATH and asserts the refusal and that it never ran. The guard is the
submission's own; the runtime's shared guard is unchanged.

Found in the same pass: a remote named like a git option ([remote
"--force"], listed by git remote) is refused by name, because a network push
names the remote on the command line.

Tests: both; 32 mutants, all killed.

Lane: openxfactory-4
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…92)

Copilot's review at 3ccf77b raised, as previously missed, that the
explicit refspec does not isolate the push from the checkout's own push
settings. MEASURED on git 2.43.0, exit 0 both times:

- push.followTags=true also sent an annotated tag the refspec never named;
- push.recurseSubmodules=only sent nothing at all, so submit() returned a
  Submission for a branch that never left.

The shared core now passes --no-follow-tags and --no-recurse-submodules,
which outrank both keys and submodule.recurse. The runtime's
push_to_remote goes through the same core and gains the same guard.

The new test runs both settings against a local bare origin and asserts the
origin holds exactly the branch at the reported commit; red first at
3ccf77b, and mutants M33 and M34 (each option dropped) are killed.

Lane: openxfactory-4
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Lane: openxfactory-4
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…26596 on #92)

Copilot's review at 5e3ca9c found that the push core binds a file://
destination through urlsplit, which drops ?... and #..., while git reads
both as part of the path. MEASURED on git 2.43.0, with both remote.git and
remote.git?x present:

- plain git push to file://.../remote.git?x landed in remote.git?x;
- submit() landed in remote.git and reported file://.../remote.git?<redacted>.

The same held for #x. The submission now refuses such a URL before any
push, names the remedy (the path without file://), and does not echo it.

The new test runs both suffixes with both repositories present and
asserts that neither moves, then pushes the same path without file:// and
asserts it lands in the literal repository. It was red first at 5e3ca9c
(DID NOT RAISE). Mutants M35 (the refusal dropped) and M36 (# not checked)
are killed.

Lane: openxfactory-4
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…Submissions (plan 038)

serve.py: `submission_factory`, beside `pull_request_factory` and never
it, as a class attribute, a `build_server` keyword and its compose entry,
with the accessor `_session_submissions`. It is declared under the
`session` capability as `_session_pull_requests` is, since the push uses
the invoking user's own git credentials. Unset, it builds
`LocalGitSubmissions` for the served checkout.

cli.py: `_submission_port`, beside `_pull_request_port`, the same default.

`pull_request_factory` and `_pull_request_port` keep `GhPullRequests`,
serving `gate open-pr` unchanged (R2Q2 (a)).

tests/test_submission_default.py: F12.2's server node,
`test_server_unset_submission_factory_binds_the_neutral_default`, and
two nodes beside it, so each new branch has a case that fails without
it: an injected factory is the server's binding and an unbuildable one
is absence; the CLI's unset port is the neutral class.

Realizes 12.4 of opensoft/openXfactory#1144. Ruled R2Q2 (a).

Lane: openxfactory-4
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…mission-factory

Lane: openxfactory-4
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@brettheap
brettheap requested a balanced review from Copilot October 6, 2026 17:28
@sourcery-ai

sourcery-ai Bot commented Oct 6, 2026

Copy link
Copy Markdown

Reviewer's Guide

This PR adds an independently injectable submission capability whose server and CLI defaults use LocalGitSubmissions, then routes local submissions and existing mapped pushes through a shared hardened PushPlan execution core. It preserves the existing GhPullRequests behavior while enforcing explicit destination, branch, refspec, credential-redaction, transport, hook, and containment rules, with extensive tests covering bindings, functionality, security, and regression behavior.

Sequence diagram for local submission through the shared push core

sequenceDiagram
    participant Caller
    participant LocalGitSubmissions
    participant SubmissionPush as submission_push
    participant PushCore as repository_act._push_to_remote_with
    participant Git

    Caller->>LocalGitSubmissions: submit(branch)
    LocalGitSubmissions->>SubmissionPush: submit_branch(checkout_root, branch)
    SubmissionPush->>SubmissionPush: _chosen_remote
    SubmissionPush->>SubmissionPush: _branch_tip
    SubmissionPush->>PushCore: _push_to_remote_with(git, PushPlan)
    PushCore->>Git: git push --no-follow-tags --no-recurse-submodules
    Git-->>PushCore: success or GitCommandFailed
    PushCore-->>SubmissionPush: push result
    SubmissionPush-->>LocalGitSubmissions: Submission or SubmissionRefused
    LocalGitSubmissions-->>Caller: Submission or error
Loading

File-Level Changes

Change Details Files
Introduces a neutral submission port and binds it independently from the existing pull-request port.
  • Adds the one-operation SubmissionPort, Submission result, and submission-specific errors.
  • Implements LocalGitSubmissions as a platform-free local-git default.
  • Adds server-side factory injection and capability-gated _session_submissions() resolution, with construction failures treated as absence.
  • Adds CLI _submission_port() defaulting to the checkout-local implementation.
  • Preserves GhPullRequests defaults and existing pull-request bindings.
src/opendox/session_pr.py
src/opendox/serve.py
src/opendox/cli.py
Builds a shared, hardened push execution path for both mapped repository pushes and local submissions.
  • Factors push inputs into PushPlan and reuses the runtime push core for submission pushes.
  • Carries destination identity, explicit refspecs, containment behavior, and descriptor-bound local destinations through execution.
  • Disables executable transports, configured receive-pack/hooks, tag following, recursive submodules, and interactive or unbounded pushes.
  • Adds submission-side remote and branch selection/refusal rules, including origin preference, default-branch rejection, and single push-URL enforcement.
  • Redacts credentials and query or fragment values from submission reports and failure messages.
src/opendox/runtime/repository_act.py
src/opendox/submission_push.py
Adds comprehensive tests for the submission protocol, default bindings, push behavior, and security invariants.
  • Verifies neutral server and CLI defaults, injected factory binding, session capability gating, and unchanged pull-request defaults.
  • Covers successful local submissions, remote selection, branch validation, refusal behavior, linked worktrees, and idempotence.
  • Exercises credential-bearing HTTP pushes, redaction, transport and command-injection defenses, hook suppression, and exact push semantics.
  • Confirms existing runtime containment and mapped-push behavior remain intact.
tests/test_submission_default.py
tests/test_submission_port.py

Tips and commands

Interacting with Sourcery

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

Customizing Your Experience

Access your dashboard to:

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

Getting Help

brettheap and others added 2 commits October 6, 2026 17:34
Lane: openxfactory-4
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… into r2/t014-submission-factory

Lane: openxfactory-4
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Short credential values can leak through submission failure messages.

Review effort: Balanced
Findings: 1 High severity

Open (1)
What changed in this PR

Adds a platform-neutral Git submission port, shared push hardening, and default server/CLI bindings.

Changes:

  • Introduces SubmissionPort and LocalGitSubmissions.
  • Shares hardened push planning with repository pushes.
  • Adds server/CLI seams and comprehensive tests.
File Description
src/​opendox/​session_pr.py Defines submission API and adapter.
src/​opendox/​submission_push.py Implements secure submission planning and redaction.
src/​opendox/​runtime/​repository_act.py Extracts shared hardened push core.
src/​opendox/​serve.py Adds the server submission factory.
src/​opendox/​cli.py Adds the CLI submission port seam.
tests/​test_submission_port.py Tests submission behavior and safeguards.
tests/​test_submission_default.py Tests default bindings and credential handling.

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

Comment thread src/opendox/submission_push.py Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

It is a draft stacked on #92 and includes security-sensitive remote-write and shared push-core changes requiring final human review.

Review effort: Balanced
Findings: None

Resolved since last review (1)

brettheap and others added 3 commits October 6, 2026 17:53
…tal/error lines; three tests)

Lane 3's read-only review R1 (opensoft/openXfactory#656 comment
6022010349) was a GO with 0 BLOCKER and 0 MAJOR. Two of its items change
code or tests, and they are folded here.

MINOR: a failed push's refusal embedded git's whole stderr. Under the
user's own GIT_TRACE_CURL=1 or GIT_CURL_VERBOSE=1, curl's trace of every
request header is part of that stderr, and a checkout's http.extraheader
secret rode the SubmissionRefused (git redacts Authorization: alone). R1
measured it against a loopback 403. The refusal now keeps only git's
fatal: and error: lines and the adapter's timeout line, then scrubs as
before. The new test reproduces R1's measurement: http.extraheader =
X-Api-Key: <secret>, GIT_TRACE_CURL=1, and a loopback server answering
403. It asserts the secret is absent from the message and from the
formatted traceback. It was red first (the secret was in the message).
Mutants M37 (the whole stderr) and M38 (every line kept) are killed.

NIT: three tests that kill R1's surviving mutants:
- X5: the except CorpusRefused around metadata_held_open, reached with
  the no-follow open's ELOOP. MEASURED on git 2.43.0: git hands back a
  worktree's canonical git and common directories even through a
  symlinked .git file or commondir, so a real link never reaches the
  open. Mutant M39 is killed.
- X4: a URL past MAX_REMOTE_URL_CHARS is shown as <redacted-url>, and one
  at the cap as it is. Mutant M40 is killed.
- X6: HTTPS:// is refused, and a planted git-remote-HTTPS does not run.
  MEASURED: plain git push to HTTPS://... ran it. Mutant M41 is killed.

Mutants M17 and M29 are re-targeted at the new refusal line. All 41
mutants are killed, 0 survive, and the falsifier reads 60 passed.

Lane: openxfactory-4
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… on #93)

`_assert_the_neutral_port` asserted the report's ref and URL in one
`assert ... and ...`. Two asserts now, so a failure names which half
failed. No behaviour changes.

Lane: openxfactory-4
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…mission-factory

Lane: openxfactory-4
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

Its prerequisite #92 remains draft and blocked, leaving this review coupled to an unresolved stacked implementation.

Review effort: Balanced
Findings: None

brettheap and others added 2 commits October 6, 2026 18:56
…all per pytest.raises (#92)

CI's validate failed at d186f6b (run 37507020596) on
tests/test_provider_boundary.py::test_the_generic_http_client_has_exactly_its_named_holders,
with ['submission_push.py: Authorization']. The comment above
_KEPT_PUSH_STDERR spelled the HTTP client's auth header by name, and that
test holds the name to its declared holders, which submission_push is not.
The comment is reworded, and the code is unchanged. The test was red
locally at d186f6b and is green now. Mutant M42 restores the word and is
killed.

SonarCloud python:S5778 at d186f6b, tests/test_submission_port.py:314
and :401: each LocalGitSubmissions is now constructed before its
pytest.raises block, so one call can throw inside it.

All 42 mutants are killed, 0 survive, and the falsifier reads 60 passed.

Lane: openxfactory-4
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…mission-factory

Lane: openxfactory-4
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

The draft still carries the large security-sensitive #92 prerequisite and explicitly awaits its landing.

Review effort: Balanced
Findings: None

…on-factory

main's tests/test_submission_default.py is T011's eb4976f copy, which
this branch already carried, so the add/add conflict there resolves to
this branch's copy: T011's nodes plus T014's three. The tree is
unchanged from 96a6ca8.

Lane: openxfactory-4
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Oct 6, 2026

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The implementation matches the ruled binding contract and provides focused coverage for each new branch.

Review effort: Balanced
Findings: None

@brettheap
brettheap marked this pull request as ready for review October 6, 2026 22:20
@sourcery-ai

sourcery-ai Bot commented Oct 6, 2026

Copy link
Copy Markdown

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 18 hours and 59 minutes by commenting @sourcery-ai review. Upgrade to get a review now.

@brettheap

Copy link
Copy Markdown
Contributor Author

READY at 7a86c8a

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

Holder, at READY: T014, submission_factory and _submission_port, defaulting to LocalGitSubmissions.

@brettheap
brettheap merged commit a7a1c4d into main Oct 6, 2026
5 checks passed
@brettheap

Copy link
Copy Markdown
Contributor Author

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

LANDED — lane openxfactory-4, 2026-10-06T22:23:13Z, PR #93 → a7a1c4d (opensoft/openDox-code main; plain gate)

Brett: plan 038 RULED incl. lane openxfactory-4 lands every PR (#656 6013547504); Start release 2 (#656 6001702967)

brettheap added a commit to opensoft/openXfactory that referenced this pull request Oct 7, 2026
…e identity response shape and the single-writer chains (plan 038) (#1257)

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

**T002, second bookkeeping batch, plan 038: T094 and the slice entries T095 to T104, the identity response shape, the single-writer chains, and the ticks.** Bookkeeping, so this PR carries no `Arc:` line. It touches no `openspec/changes/` path, so no Rule 6 window applies. It began stacked on #1251's head; #1251 has landed (`1837ea75`) and `main` is merged in (`543f6ce1`), so the diff against `main` is this batch alone.

## From plan 038's `tasks.md`, T002

- **Task**: T002, "Release-2 base, and the re-measure at the ruling" (landed in #1251; this is its second batch of bookkeeping, the brief of the holder's `T002b`).
- **Realizes**: none (bookkeeping; FR-025). **Falsifier**: T002 names none. Its gates are the brief's, quoted under "Review and gates".
- **Ruled / Decisions**: none of its own. Every item is a ruling already posted on `#656`, or a landing already merged, encoded as worded and cited by comment id or merge commit.

## The items

| # | Where | What changed | Record |
|---|---|---|---|
| 1 | tasks.md: T094, T095 to T104, T073 | T094 ticked, with its result quoted: 436 composed reds over 51 files, outside 12.5's set (Base 2; 533 at Base 1). The `T095+` placeholder becomes ten entries, T095 to T104, each with its slice name, Files, After and Falsifier from R2-INV-R9's outline and the holder's rulings, `Lane: 3 (openXfactory-3)`. T073's After and Files name them. The map's means, the rulings (R9-R1 (a), R9-R2 (a), W1 to W7) and the OQ defaults are recorded once, above the entries | map `R2-INV-R9.md`; `6021830607`; claim `6021862323`; rulings `6021830531` |
| 2 | T095, T101, T104, T097 | T095: the two confirmed departures from OQ-R9-1 (`plane_host_for` untouched, an autouse fixture registers the declared host; `DECLARED_HOST_SUITES` guarded structurally). T101: `tests/declared_exclusion.yaml` for ONE entry (reasons `[doc_health]`, note dropped, the `only` list loses the file, count stays 66). T104: `tests/test_binding_stylesheets.py`, the pin 572 to 574. T097: its served-display respelling is R9-R1 (a) applied | `6022291206`; the T097 line is `6023517122` (the holder confirmed the citation, `6026622117`) |
| 3 | plan.md: the single-writer table; tasks.md Files and After lines | W7's chains: `tests/conftest.py` T020, then T021 and T026 in landing order, then T095, T073, T074; `tests/test_host_plane.py` T020, T026, T095; `declared_exclusion.yaml` T101, T073, T074; the four T074 test files T103 then T074; the census T025, T104, T015, T016, T057 (the row splits, so `test_web_boundary.py` keeps its own chain). T015's and T074's After gain T104 and T103 | `6021830531`, `6022291206` |
| 4 | tasks.md: T072, T074, T075 falsifiers | The four folds of #1253, in the arc change's own wording: T072 asserts that ONLY CR, LF and CRLF split rows; T074's seam tests assert that an empty-seam read names the seam AND its registrar; T075's host-wiring test shows a leg declaring only SOME of the four seams refused, and a leg declaring the six and none of the four accepted; T074's protected-suite oracle computes 12.5's set as 12.5 does (`git grep -l -e 'open-pr' -e 'open_pr' -e 'FakePullRequests'`), from the pre-arc and the final tree, the floor of 16 on each, and takes the union | openxFactory#1253 to `fc4fa0ff`; Copilot `5427373153` |
| 5 | spec.md FR-011; tasks.md T041 | FR-011's JSON shape gains `identity`, emitted and bounded as openDox-spec's finding schema bounds it (no `excerpt`, `text`, `content` or `quote` key, no number, strings of at most 200 characters, `{category, entry}` for a pathless finding, `{collided_id}` for a collision). T041's falsifier gains a response-shape test asserting exactly that bound. The coverage row for FR-011 names T041. The serialized-size cap was already T041's at the base (T041's text says so, and T042 "stores what T041 bounds"), so nothing moved | holder `6018624750` |
| 6 | tasks.md ticks | T011, T014, T021, T023, T025, T026 and T060 ticked, T070's tick gains #1253, and T002's own landing is recorded. Each merge commit was verified with `gh pr view <n> -R <repo> --json mergeCommit` (listed below) | the landings |
| 7 | tasks.md: T072 | A Files line (`src/opendox/lines.py`, `tests/test_lines.py`); the Ruled line gains `6023517122`: `head_sha` (a), its own public `head_sha` parity-tested against `serve._head_of`, `serve.py` untouched; the line split (a), `doxbench_defaults.py` untouched. Folding either private helper is recorded as unscheduled and optional, and is not scheduled | holder `6023517122` |
| 8 | contracts/health-finding.md:91 | The sentence reads: a stored `identity` makes a cross-run collision between STORED findings detectable; an exception-only finding is never stored; whether the engine reports it remains T046's concern. Nothing else on the line changed | holder `6018624750`; Copilot `5433292692` |
| 9 | plan.md; tasks.md | Copilot's three items at #1251's head `1eb8e9eb`, accepted by the holder at its landing: (a) the pin and landing-order row for T073 names T005 and T095 to T104 as prerequisites, and `T095+` reads T095 to T104 at the critical path, the lane table and the revision note; (b) the combined `conftest.py` and `test_host_plane.py` row splits, and the cross-lane summary gains T026 (and the other chains of item 3); (c) the same split in T020's, T021's and T026's Files lines | holder replies `4201056969`, `4201057311`, `4201057577`; READY note `6026651962` |

### The ticks, verified

| task | pull request | merge commit | merged |
|---|---|---|---|
| T011 | opensoft/openDox-code#92 | `09b8d44a` | 2026-10-06T19:15:55Z |
| T014 | opensoft/openDox-code#93 | `a7a1c4d3` | 2026-10-06T22:23:06Z |
| T021 | opensoft/openXdox-code#40 | `f70bc9c3` | 2026-10-06T19:07:10Z |
| T023 | opensoft/openXdox-code#42 | `d45a0939` | 2026-10-06T17:45:33Z |
| T025 | opensoft/openDox-code#91 | `84f8ed83` | 2026-10-06T17:33:31Z |
| T026 | opensoft/openXdox-code#43 | `36bbef79` | 2026-10-06T22:35:40Z |
| T060 | opensoft/openDox#20, the tag `dox-v1.2` (tag object `58538ff3`, on `6a9f4902`), opensoft/openDox#21 | `6a9f4902`, `c7f75845` | 17:46:59Z, tag 17:58:45Z, 19:02:39Z |
| T070 | openxFactory#1253 (T070b, added to its tick) | `fc4fa0ff` | 2026-10-06T18:56:42Z |
| T002 | openxFactory#1251 (its own landing) | `1837ea75` | 2026-10-06T22:31:42Z |

- **T021** landed with Copilot r4199337845 an ACCEPTED LIMIT (holder READY note `6023492215`); T021's entry records it.
- **T025's** entry says its 34 nodes are "quoted at T029"; that stays T029's, and the entry says so.
- **T011's** server node is T014's, as its own Falsifier says.

**Skipped, because already present at the base:** T020's and T024's ticks (#1251 item 13) and T004's tick (#1245, `260234b5`), all confirmed with `git show <commit>:<tasks.md> | grep`.

**T071 is NOT ticked.** Brett's word, "Ratify it (Recommended)" (`#656` `6023375303`), is recorded on T071's entry, but the change's ratification-record PR has not landed (no such PR is open or merged on `opensoft/openxFactory` at this writing). The box stays open.

## Readings the holder accepted (`6026622117`), disclosed as the brief requires

- **W7 omits T026 from the openXdox-code chains.** The single-writer table keeps T026 where its own ruling (`6016648451`) puts it, and lane 3's claim (`6021862323`) says T026's PR lands before T095. So the conftest chain reads T020, then T021 and T026 in landing order, then T095, T073, T074; and `test_host_plane.py` reads T020, T026, T095, as W7 gives it with T026 added.
- **R9-R2's last sentence** ("If the re-scoped test runs alone, it leaves the declaration, and the count moves with it, as the declaration's own rules require") is recorded in T100 as worded. `declared_exclusion.yaml` is NOT added to T100's Files: the holder's file list at `6022291206` names it for T101 only.
- **Edits outside tasks.md**, ruled in scope as each item names its place: plan.md (items 3, 9), spec.md FR-011 (item 5) and `contracts/health-finding.md:91` (item 8).

## Other notes on where an item needed a reading

- **Counting.** The task count reads 90 rows: the placeholder `T095+` is replaced by T095 to T104 (81 - 1 + 10).
- **Plan 034's task numbers.** The entries cite plan 034's T103 (#80, in T099's `Host` header) and plan 034's T086 (W2, in the rulings) as "plan 034's", because plan 038 now has its own T103.
- **OQ-R9-3.** The map did not measure the respelled gate-console and wheel-model skips; T097 and T103 say so, and the map's 127 passed and 5 skipped is quoted as the measurement.
- **Counts of slices** are copied in the map's own form (for example "16 nodes, and +5 on R9-R1 (a)"), not summed.
- **T095's chain after T026.** T095's After names T021 and T026, both landed.
- **Not mirrored from the arc's 4.1:** T075's falsifier gains the some-of-four refusal and the six-and-none acceptance, which #1253 folded. The arc's two older refusals (part-way through the seams; at the column call) are not in T075, since #1253 did not add them.
- **T046 and T057** carry no response-shape falsifier for `identity`: item 5 names T041's.

## Review and gates

- **`python3 scripts/validate-openspec-cli-pin.py --all`**, in the clone named `openxFactory`, at `691648c6`: exit 0, `Totals: 113 passed, 1 failed (114 items)`, `0 UNDISPOSITIONED failures`. The one failure is the dispositioned `add-chain-attestation` finding, the same on `main`.
- **openxFactory pytest.** The full local run was stopped at about 44% at a coordinator drain, so it is NOT a result and is not claimed. The repository's own gate, `pytest-suite` in CI at `691648c6`, completed `SUCCESS` (2026-10-06T23:32:38Z to 23:58:56Z).
- **Doc-health**, `scripts/doc-health.py --single-repo . --as-of 2026-10-07`, branch `691648c6` against `origin/main` `0992369a` in the same clone: the two reports are byte-identical (sha256 `ce17aadd6d96e484170e2ec4784e44972e33c7d1a6c65830ea14a1035f2ae976`; `Findings: 31 critical, 26 error, 69 warning, 20 info. New regressions vs previous report: 0.`). So no new error.
- **CI at `691648c6`**: all 14 check runs are `SUCCESS` (rollup `SUCCESS`): `pytest-suite`, `merge-master-approval` (the red inherited from `main` since #1252 was cleared by #1138), `openspec-cli-pin`, `doc-health-py314`, `openxdox-consumer-gate`, `wallet-validation`, `clearing-dispatch-gate`, `signed-execution-chain-gate`, `former-id-arrival-gate`, `release-tag-gate`, `openreposhape-pin`, the two `lane-line` runs and SonarCloud.
- **`main`** has moved to `0992369a` since the last merge (`543f6ce1`). GitHub reports this PR `MERGEABLE`, and the ruleset is not strict, so `main` is not merged in again (a merge would restart the 27-minute gate).

| Copilot at | verdict | findings | answered |
|---|---|---|---|
| `691648c6` (final; review `5435686665`) | Changes recommended | 1 (thread `4201443690`): T041's falsifier cannot verify what T046's `health list --json` and T057's HTTP route emit; the review summary adds that the new T095 to T104 collide with plan 034's task numbers cited unqualified at `spec.md:662`, `spec.md:1222` and `clarify-questions.md:437` | accepted limit (#656 `5988818366`): plan-record accuracy, not a bypass, and the T041 placement is the holder's own instruction (item 5). Answered (`4201487553`) and resolved |

1 thread, 0 unresolved. The holder ruled both points YES at `6027706377` and has them encoded in a THIRD batch, not here: the `identity` falsifier split across T041, T046 and T057, and the plan 034 references qualified. This PR therefore carries T041's wording as the brief gave it.

## Files changed

- `specs/038-opendox-document-tool-self-maintenance/tasks.md`, `plan.md`, `spec.md`
- `specs/038-opendox-document-tool-self-maintenance/contracts/health-finding.md`

## What is NOT done

- T071 stays open (its ratification record has not landed). No box of #1144 is ticked, and no task other than those listed is ticked.
- No scenario or spec delta beyond FR-011's JSON-shape bullet is touched, and nothing is under `openspec/changes/`. `README.md` is untouched.
- The T095 to T104 entries record the slices; none of their work is done here.

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


Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
brettheap added a commit that referenced this pull request Oct 7, 2026
… realize-doc-health-direction-arc) (#95)

Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Arc: realize-doc-health-direction-arc

## T072: `opendox.lines`, openDox's own line rule and HEAD read (plan 038)

Refs opensoft/openXfactory#656 (stays OPEN).

- **Realizes**: step 2.1 of the OpenSpec change `realize-doc-health-direction-arc` ("Re-author the generic slice"; its `design.md` § 3). This is a realization landing of that change (`design.md` § 8), so it carries that change's `Arc:` line and no `Arc: neutral-product-standalone-operability` line. It realizes no #1144 box.
- **Falsifier** (`tasks.md` 2.1): the module's own tests, including the round trip over CR, LF, CRLF, no final newline, mixed endings, form feed and U+2028, AND explicit boundary assertions that ONLY CR, LF and CRLF split rows; openDox-code's whole suite as its required `validate` job runs it, green.
- **Ruled**: ARC-Q1, ARC-Q3 (opensoft/openXfactory#656 comment `6003918488`). **Decisions**: ARC-6 (`6013547504`). **Ratified**: T071, Brett Heap's word "Ratify it (Recommended)" (`6023375303`). **Holder rulings** on this task's two scope questions: `6023517122` (`head_sha` (a), the line split (a), Files).

### What it adds

**`src/opendox/lines.py` (new), standard library only (`os`, `re`, `subprocess`).**
- `split_keepends(text) -> [(body, ending)]` and `join_rows(rows)`, with the behaviour of openxFactory's `scripts/doc_health/lines.py:111` and `:132`:
  - only CR, LF and CRLF end a row, and CRLF is ONE ending;
  - `join_rows(split_keepends(t)) == t` for every `t`;
  - empty text is no rows, and the last row's ending is empty only when the text does not end in a line ending.
- `head_sha(repo)`, the one read openXdox-code's `generator.py:128` takes from `RealGit`, mirroring `RealGit.head_sha` exactly (`scripts/doc_health/corpus.py:417`, `:424-431`, `:739-741` at openxFactory `9171d14a`):
  - the argv is `["git", "-C", str(repo), "rev-parse", "HEAD"]`, and the call is `capture_output=True, text=True, timeout=30`;
  - a timeout or an `OSError` gives `None`, a non-zero exit gives `None`, and an empty answer gives `None`;
  - any other error propagates;
  - a blank answer reads as `""`, as `RealGit`'s `out.strip() if out else None` reads it. No git prints a blank answer for `rev-parse HEAD`; it is pinned so T074's retarget changes nothing.
- **A re-authoring, not a relocation**: nothing leaves openxFactory, openxFactory is unchanged, and the module imports nothing from it. A lone openDox-code checkout runs it.

**`tests/test_lines.py` (new), 123 cases, none skipped, `--noconftest` safe.**
1. **Only CR, LF and CRLF end a row.**
   - `a\rb`, `a\nb` and `a\r\nb` each give two rows.
   - The CRLF text's first row ends in ONE ending, never a CR row and then an LF row. LF then CR is two endings.
   - Every other separator `str.splitlines()` breaks on is named, and each leaves `a<sep>b` ONE row: VT `\v`, FF `\f`, FS `\x1c`, GS `\x1d`, RS `\x1e`, NEL `\x85`, U+2028 and U+2029.
   - The named list is checked against what `str.splitlines()` really breaks on, measured over every code point. One text holding every code point but CR and LF is one row.
2. **The round trip** over a corpus of row shapes, and `join_rows` on its own. A test also shows that the round trip alone cannot tell this rule from `str.splitlines(keepends=True)` (`design.md` § 3).
3. **The real-line rule as a property.** All 19,531 texts of up to six characters over {`a`, CR, LF, FF, U+2028} read as an independent character-by-character reading of the rule reads them. Each round-trips and has the rows' shape.
4. **`head_sha` on real temporary repositories**, and every way it degrades.
   - It reads HEAD: a second commit moves it, and a detached HEAD is read.
   - It answers `None` for a non-repository, an unborn HEAD (git prints `HEAD` and exits 128), a path that is not there, no `git` on `PATH`, a timeout, a git that cannot start, a non-zero exit, and an empty answer.
   - Its command and its bound are `RealGit`'s, and any other error propagates.
5. **Parity with `serve._head_of`** (`6023517122`): the two agree on a repository, an unborn HEAD and a non-repository. This is the drift guard while two copies exist.
6. **Import weight**: in a fresh interpreter, with openXdox and openxFactory's packages blocked, `import opendox.lines` loads the standard library and no other module of openDox, and its public names are the three.

### The falsifier, run (red first)

Red, with `src/` identical to `main` (the module moved out of the tree), and this branch's test file:

```text
$ python -m pytest -q tests/test_lines.py
E   ImportError: cannot import name 'lines' from 'opendox' (…/src/opendox/__init__.py)
ERROR tests/test_lines.py
1 error in 0.46s
```

Green, at the final head `2ab7c4ad`, `.[runtime,test]` under the constraints file, Python 3.12.3, `CI=true`:

```text
$ python -m pytest -q tests/test_lines.py
123 passed in 3.35s
$ python -m pytest -q --noconftest tests/test_lines.py
123 passed in 2.73s
```

**The round trip alone does not fail a `splitlines` rule; the boundaries do** (`design.md` § 3). This was measured with mutant M06 below applied, where the split is `str.splitlines(keepends=True)`:

```text
$ python -m pytest -q tests/test_lines.py -k "round_trip_returns or join_rows_writes"
77 passed, 46 deselected in 0.43s
$ python -m pytest -q tests/test_lines.py -k "no_other_separator or no_code_point or every_short_text"
10 failed, 113 deselected in 4.72s
```

### Mutants: 33, all killed

Each mutant replaces one exact string in `src/opendox/lines.py` (the needle occurs once), runs `tests/test_lines.py` with `-x`, records the first failing node, and restores the file byte for byte (sha256 `e11c714c…` before and after). The run below is against the final head's test file, `2ab7c4ad`; it is line for line the same as the run at `e4920717`.

```text
M01 the CRLF branch is dropped: KILLED by test_each_real_line_ending_splits_a_row[CRLF]
M02 CR is tried ahead of CRLF: KILLED by test_each_real_line_ending_splits_a_row[CRLF]
M03 a lone CR is no ending: KILLED by test_each_real_line_ending_splits_a_row[CR]
M04 a lone LF is no ending: KILLED by test_each_real_line_ending_splits_a_row[LF]
M05 splitlines' separators end a row too: KILLED by test_no_other_separator_splits_a_row[VT]
M06 the split is str.splitlines(keepends=True): KILLED by test_no_other_separator_splits_a_row[VT]
M07 the last row, with no ending, is dropped: KILLED by test_each_real_line_ending_splits_a_row[CR]
M08 the last row invents an LF: KILLED by test_each_real_line_ending_splits_a_row[CR]
M09 the next row starts one past the ending's start: KILLED by test_each_real_line_ending_splits_a_row[CRLF]
M10 the loop runs one past the end: KILLED by test_crlf_is_one_ending_never_a_cr_row_then_an_lf_row
M11 a body carries its ending: KILLED by test_each_real_line_ending_splits_a_row[CR]
M12 every ending is written as LF: KILLED by test_each_real_line_ending_splits_a_row[CR]
M13 the search skips an ending at the row's first character: KILLED by test_crlf_is_one_ending_never_a_cr_row_then_an_lf_row
M14 join_rows drops the endings: KILLED by test_the_round_trip_returns_the_text[a\n]
M15 join_rows writes the ending before the body: KILLED by test_the_round_trip_returns_the_text[a\n]
M16 join_rows puts an LF between rows: KILLED by test_the_round_trip_returns_the_text[\n\n]
M17 the branch tips are read, not HEAD: KILLED by test_the_head_moves_with_a_new_commit_and_a_detached_head_is_read
M18 no -C: the cwd's repository is read: KILLED by test_the_head_of_a_real_repository_is_read
M19 the read is unbounded: KILLED by test_the_read_is_realgits_command_and_bound
M20 the bound is 5 seconds, not RealGit's 30: KILLED by test_the_read_is_realgits_command_and_bound
M21 the output is not captured: KILLED by test_the_head_of_a_real_repository_is_read
M22 the output is bytes, not text: KILLED by test_the_head_of_a_real_repository_is_read
M23 a timeout escapes: KILLED by test_a_git_that_does_not_answer_in_time_is_no_head
M24 an error starting git escapes: KILLED by test_no_git_on_the_path_is_no_head
M25 every error is swallowed: KILLED by test_any_other_error_propagates_as_realgits_does
M26 the exit code is ignored: KILLED by test_an_unborn_head_is_no_head
M27 the answer is not stripped: KILLED by test_the_head_of_a_real_repository_is_read
M28 a blank answer is None (serve._CheckoutHead's reading): KILLED by test_a_blank_answer_is_read_as_realgit_reads_it
M29 an empty answer is the empty string: KILLED by test_an_empty_answer_is_no_head
M30 a non-zero exit raises (check=True): KILLED by test_a_directory_that_is_not_a_repository_has_no_head
M31 the module imports another module of openDox: KILLED by test_the_module_loads_the_standard_library_and_nothing_else_of_opendox
M32 the module imports a third-party package: KILLED by test_the_module_loads_the_standard_library_and_nothing_else_of_opendox
M33 head_sha leaves the public names: KILLED by test_the_module_loads_the_standard_library_and_nothing_else_of_opendox
mutants: 33, survivors: 0
```

### The whole suite, as CI runs it

CI's `validate` job at the final head `2ab7c4ad` (run 37552064211, job 112569631082). It ran on the merge ref `f0380f7`, which is `2ab7c4ad` merged into `main` `d616da3e`, so T104 was included:

```text
5647 passed, 11 skipped, 2 warnings in 828.74s (0:13:48)
triple: selected=5658 passed=5647 skipped=11 failures=0 errors=0
pins:   selected>=3977 (margin 1681) passed>=3966 (margin 1681) skipped==11
```

At `d1268f58` (run 37546933980, job 112553070043), CI read the same triple. This change adds 123 cases and no skip, so `EXPECT_SKIPPED` stays 11, and the floors are not moved. The local replicas of the job were stopped at the holder's word, because CI's triple answers the gate.

### How the head moved

- **`e4920717`**: T072, the module and its tests.
- **`d1268f58`**: merged `origin/main` `a7a1c4d3` (T014, #93), as a merge commit with no rebase. T014 changed `serve.py` and `tests/test_submission_default.py`. `serve._CheckoutHead` and `serve._head_of`, which the parity test reads, are byte-identical before and after it.
- **`2ab7c4ad`**: SonarCloud's four findings folded (below). `src/opendox/lines.py` is unchanged. The diff against `main` is still the two files.

### SonarCloud: 0 open new issues at the final head

At `d1268f58` SonarCloud reported four new MAJOR code smells, all in `tests/test_lines.py`, and `2ab7c4ad` fixes them:
- **`python:S9073`, twice:** two composite assertions joined with `and` are split into separate assertions.
- **`python:S8993`, twice:** the parity test no longer looks fixtures up with `request.getfixturevalue()`. Two plain functions build the repository and the unborn HEAD, and the fixtures and the parity cases both call them.

At `2ab7c4ad` all four read `CLOSED`, and the quality gate is `OK`: every new-code rating is 1, duplication is 0.0, hotspots reviewed is 100.0, and there are 0 hotspots.

### Copilot: three reviews, 0 threads

- **`e4920717`:** "Approval recommended", "Findings: None".
- **`d1268f58`:** "Approval recommended", "Findings: None".
- **`2ab7c4ad`** (review `5436081242`): "Needs a closer look", "Findings: None", 0 inline threads. Its body lists two "Previously missed" items in code unchanged since `e4920717`. Each has a proposed class under the convergence rule (opensoft/openXfactory#656 `5988818366`), for the holder to rule at READY. Neither is a bypass, so neither forced a push.
  1. **Medium: use `os.fspath(repo)` rather than `str(repo)`** (`lines.py:89`). The annotation admits any `os.PathLike[str]`, and `str()` of an `os.DirEntry` is not its path.
     - **Proposed class: accepted limit**, with a one-line fix available if the holder prefers it.
     - `str(repo)` is `RealGit._run`'s own spelling, which the holder's ruling `6023517122` says to mirror.
     - For the inputs `RealGit` and `serve._head_of` take (`str` and `pathlib.Path`), both spellings give the same argv. T074's retarget passes `Path(repo)`, and no caller in the estate passes another path-like.
     - The fix would change the argv only for other path-likes. It would also make a non-path argument raise `TypeError` where `RealGit` would run git on its `str()`.
  2. **Low: the docstring does not state the `""` return for a blank answer** (`lines.py:87`).
     - **Proposed class: accepted limit (documentation).**
     - The behaviour is deliberate, pinned by `test_a_blank_answer_is_read_as_realgit_reads_it`, and stated in that test's docstring and in "What it adds" above.
     - No git prints a blank answer for `rev-parse HEAD`.

### The module's name

`src/opendox/lines.py`, the brief's default, so T074's retarget of openXdox-code's `completeness.py`, `round_trip.py` and `generator.py` is a one-word import change. Measured free at `84f8ed83` and again at `09b8d44a`:
- no file, module or import named `lines` or `opendox.lines` in openDox-code;
- nothing in `src/opendox/__init__.py`;
- no open PR and no remote branch adds one;
- no module index or naming convention argues against it.

### Two existing private helpers stay as they are (`6023517122`)

- `serve._CheckoutHead.head_sha` (`src/opendox/serve.py:964-983`, plan 034 T012) makes the same read. `serve.py` is single-writer (T014 → T015 → T016 → T052 → T057) and is not edited here. The parity test above holds the two together. Folding `_CheckoutHead` onto `lines.head_sha` is an unscheduled, optional follow-on for a later owner of `serve.py`, and neither T072 nor the arc owes it.
- `doxbench_defaults._REAL_LINE_END` (`src/opendox/doxbench_defaults.py:67`) splits on CR, LF and CRLF for one `Status:` read, without endings. It is untouched. Moving it onto `split_keepends` is unscheduled and optional, owed by no one.

### No guard needed an entry

Every package guard scans the files on disk:
- `tests/test_consumer_reach.py`'s derived whole-package record;
- `tests/test_imports_standalone.py`;
- `tests/test_reach_sweep.py`;
- `tests/test_hermeticity.py`;
- `tests/test_provider_boundary.py`;
- `tests/test_projection_seams.py`;
- `tests/test_edit_action_one_entry.py`.

`tests/fixtures/web_boundary_census.yaml` covers only `web/`. No census, guard or boundary file is edited.

### Files changed

- `src/opendox/lines.py` (new).
- `tests/test_lines.py` (new).

### What is NOT done here

- **T074**, in openXdox-code: retargeting `completeness.py`, `round_trip.py` and `generator.py`'s generic half onto this module, and the seams.
- **The pin, tasks.md 2.2 (ARC-6).** If this lands before plan 038's T061, it rides T062's root pin and T063's `opendox @` pin, which are #1144's landings under #1144's trailer. Otherwise the arc brings its own. T061 never waits for it.
- **A test comparing this module with openxFactory's `lines.py`.** It would need openxFactory, so it belongs in the composed run, not in openDox-code's own suite (`design.md` § 3).
- **Folding either private helper** (above).

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


Arc: realize-doc-health-direction-arc
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
brettheap added a commit that referenced this pull request Oct 8, 2026
…al lander; feature 007's guard admits the landing's fast-forward (plan 038) (#90)

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

## T012 + T013 (plan 038, P4-D1): the landing seam, governance, confirmation and the neutral lander; feature 007's guard

One PR, as T012's "Lands with: T013" requires.

**Lane 3's review R2-DELTA gave GO at `4527432`** (openxFactory#656 `6068087981`; PR comment `6068087062`). The holder lands it.
- T008 has landed: codeXfactory/codeXfactory#515, merge `f1b019fe` (feature 007's FR-004a and C12).
- T010 (#89, `34c2064`), T025 (#91, `84f8ed8`), T011 (#92, `09b8d44`), T014 (#93, `a7a1c4d`) and T072 (#95, `9922088`) have landed, and this branch has merged all five (never a rebase).
- The two `session_pr` re-exports sit beside T011's names, after its submission-port block.
- Lane 3's R2-DELTA raised one new MINOR (`landing.py:836`), an accepted limit (openxFactory#656 `6069024568` item 1), stated below.
- Copilot's seventh review and Codex's review at `4527432` raised 4 findings. All four are accepted limits by holder ruling openxFactory#656 `6067853207` and are stated below; Copilot's "Changes recommended" at `4527432` stands for them.
- Copilot's sixth review (9 threads) and lane 3's review R2 (`6035652847`) are answered in `ff6f1cb`. R2's findings 1 to 5 are fixed and finding 6 is an accepted limit (holder ruling openxFactory#656 `6035797819`); the point-by-point answer is `6067643141`.

### T012: the landing seam

- **Realizes**: 12.6a (part: the seam, the query, the capability, the lander) and 12.6 (part).
- **Falsifier**:
  - F12.2's thirteen `tests/test_landing_guardrails.py` nodes, including the static issuer check;
  - named nodes beside them for R2Q7 (a)'s two refusals: `test_a_repository_with_no_main_is_unknown_and_refused_naming_it` and `test_no_declaration_refuses_naming_the_file_and_its_content` (lane 3's R2Q7 FIX);
  - ADV-08's named node: `test_a_dirty_served_checkout_on_main_is_refused_before_merging`;
  - the push URL's: `test_the_remote_check_reads_the_push_url_not_the_fetch_url` (a remote whose `pushurl` names a repository ahead of local `main` is refused; one with two push URLs is refused), and `test_the_push_url_never_reaches_git_argv`;
  - lane 3's review R2: `branch.HEAD.mergeOptions` in F12.2's configuration walk, `test_a_driver_named_like_one_of_git_s_own_states_cannot_resolve_a_conflict`, `test_an_ignored_file_the_landing_would_overwrite_is_refused`, `test_only_the_lander_issues_the_served_fast_forward` and `test_a_git_without_attr_source_is_refused_by_name`.
- **Ruled**: R2Q1, R2Q3, R2Q4, R2Q5, R2Q6 and R2Q7 (openxFactory#656 `6003486656`; the plan was ruled at `6013547504`).
- **Decisions**: CF-1, N-1, N-11, N-16, OQ-12-17 and OQ-038-1.

### T013: feature 007's guard, by R2Q6 (a)'s four exceptions

- **Realizes**: 12.6a (part).
- **Falsifier**: `tests/test_session_git.py` whole, quoted below.
- **Ruled**: R2Q6. **Text**: feature 007's FR-004a and SC-002, as T008 landed them (codeXfactory/codeXfactory#515, `f1b019fe`).

### The falsifiers, run at `4527432` with `gh` hidden from PATH (the full local suite in CI form there, with its Postgres and a live sandbox: 5795 passed, 11 skipped, in 39:51)

F12.2's command, verbatim (the thirteen nodes by name):

```text
$ python -m pytest -q "tests/test_landing_guardrails.py::test_land_requires_an_explicit_human_act" … "tests/test_landing_guardrails.py::test_only_the_interactive_layers_call_an_issuer"
.............                                                            [100%]
13 passed in 8.20s
```

T012's five named nodes:

```text
$ python -m pytest -q "tests/test_landing_guardrails.py::test_a_repository_with_no_main_is_unknown_and_refused_naming_it" "tests/test_landing_guardrails.py::test_no_declaration_refuses_naming_the_file_and_its_content" "tests/test_landing_guardrails.py::test_a_dirty_served_checkout_on_main_is_refused_before_merging" "tests/test_landing_guardrails.py::test_the_remote_check_reads_the_push_url_not_the_fetch_url" "tests/test_landing_guardrails.py::test_the_push_url_never_reaches_git_argv"
.....                                                                    [100%]
5 passed in 3.05s
```

`tests/test_session_git.py` whole (105 cases), and the new file whole (113 cases), at `4527432`:

```text
$ python -m pytest -q tests/test_landing_guardrails.py tests/test_session_git.py
218 passed in 80.84s (0:01:20)
```

**Red first.** The same two test files, run against `origin/main`'s code (`a7a1c4d`):
- `tests/test_landing_guardrails.py` does not collect (`ImportError: cannot import name 'landing' from 'opendox'`), so F12.2's command fails, as #1144 says it does today.
- `tests/test_session_git.py` reads `21 failed, 80 passed`. The failures are the moved pin, the admitted fast-forward and its refusals, the eight pinned-settings cases, the ambient-environment case, the NUL-field read, the lookalike `main`, the escaped refusal, and the exact `branch_sha`.
- `("merge", "other-branch")` at `:523` passes on both sides, as T013 requires.

**Mutants: 106 of 106 killed** (on `ff6f1cb`'s code, which `4527432` carries unchanged). There is one mutant per guard, each run against the tests that must catch it, and each was killed by a test failure: pytest exit 1, never an error or a missing node. They cover:
- **the capability** (C1–C12): branch binding, head binding, single use, a non-token, a non-TTY stdin, any answer at the terminal, direct construction, a third issuer, an issuer reached from a product module, any nonce, a non-ASCII nonce reaching `encode()`, and a discarded token's record kept;
- **the governance** (G1–G16): among them, the host never asked, a host without an instrument not outranking, a host that fails to load read as absent, the declaration read from the working tree, standalone without the local install, HEAD's branch read instead of `main`, a duplicate key, a linked declaration, the default profile taken as a host, a lander bound whatever governs, the instrument route skipping the confirmation, and the head not read again before the submission;
- **the lander** (L1–L22): rerere, no `--no-ff`, a dirty `main` checkout, no `ls-remote` check, N-16 reversed, one remote of several, a checkout on another branch fast-forwarded, `main` held elsewhere, a push, no remedy, a conflict reported as a failure, `.gitattributes` reaching the merge, no driver check, the strategy left to configuration, `main` moved by its ref alone, `merge.default` unpinned or pinned to a name a driver can hold, `merge.directoryRenames` unpinned, a named `text` driver taken as git's own, quoted conflict paths, `main` not compared with the merge's tip, and a `main` that did not land reported as landed;
- **the remote check and the messages** (R1–R5, S1, B1–B3, W1–W3): the redaction missing the fragment and spaced forms, the check reading the fetch URL, several push URLs not refused, the push URL riding in the argv, `get-url` without `--push`, a path shown as it is, the prompt, the dirty-checkout refusal and the fast-forward refusal showing raw names, the top's prefix check dropped, and the push URL and the holder's path read stripped;
- **the hooks** (H1–H4): the merge, the landing worktree's checkout, the `switch`, and the fast-forwards running hooks;
- **the byte reads** (N1–N3, X1): NUL-delimited fields read in text mode, the runner ignoring `binary`, text mode decoding strictly, and the served `HEAD` read stripped;
- **the audit** (A1);
- **the guard** (T1–T9, V1): any merge on a clean `main`, a dirty checkout, another branch, below the root, `merge` on the name list, a short id, the fast-forward's settings not pinned or not delivered, the pins back in the argv, the runner passing the ambient environment, and `branch_sha` suffix-matching;
- **Copilot's sixth review** (P1–P12), each of these guards removed:
  - the transport pre-check, and `GIT_ALLOW_PROTOCOL`;
  - scrubbing the URL's values by value, and keeping only git's own stderr lines;
  - the probe's time bound, batch-mode ssh, and the prompt switched off;
  - the escaped branch name in the conflict remedy and the already-landed refusal;
  - the binding's acceptance of a name a strip would change;
  - the bytes reader going through the funnel's pins;
  - the inside-a-work-tree check;
- **lane 3's review R2** (Q1–Q9), each of these broken:
  - `branch.HEAD.mergeOptions` left unpinned;
  - a driver named `set`, `unset` or `unspecified` able to answer (one mutant each);
  - an ignored file overwritten, and the file-where-a-directory-goes case not seen;
  - an older git escaping as a raw `GitError`, and the floor not named at the merge;
  - another module naming the served fast-forward.

### What this changes

**`src/opendox/landing.py` (new).**
- `LandingPort` has one operation, `land(branch, *, confirmation) -> Landed`.
- `Landed` carries `merge_commit` and `previous_main`. Its `served_checkout` is `fast-forwarded` or `left`, and `pushed` is always False.
- `MergeConflict` carries the paths, read NUL-delimited as bytes and so exactly as spelled, and the remedy: bring `main` into the branch and resolve there. Its message shows a path or a branch name that holds a control or format character escaped (`repr`), so neither can write to the terminal or reorder the message. Every refusal that names the branch does the same.
- `LandingRefused` carries a `code` for T016's routes.
- `repository_governance(checkout_root)` answers `standalone`, `governed` or `unknown`, failing closed, in this order:
  1. the checkout must be a working tree's top, with a branch `main` (R2Q7 (a)). The top is asked of git: the checkout must be inside a work tree, with an empty prefix. It is never compared as a path, so a directory name ending in a space or a newline reads;
  2. the install mode must resolve;
  3. a registered host profile decides, whatever any file says (R2Q4 (a));
  4. otherwise `.opendox/governance.yaml` decides, read from the blob at `main`'s tip (N-1). `standalone` needs `OPENDOX_INSTALL_MODE=local` or `--local` (FR-007; ADV-38).
- With no declaration, the refusal names the exact file and its content.
- `bound_lander` binds the neutral lander under `standalone` only.
- `request_landing` routes a landing:
  - under `governed` with an instrument, it submits the confirmed branch through the instrument, and nothing merges. The branch's head is read again immediately before `submit`, and a branch that moved is refused;
  - otherwise it refuses by name: `governed-without-an-instrument`, or why the governance is `unknown`.
- **The neutral lander**, in order:
  1. refuses `main` (R2Q5 (a));
  2. re-reads the governance at the moment of landing;
  3. spends the confirmation;
  4. reads `main` at the remote's PUSH URL first (`git remote get-url --push --all <remote>`; the fetch URL where no `pushurl` is set):
     - a remote with several push URLs is refused (`several-push-urls`). The URLs are read as bytes and no record is dropped, so a URL holding a newline reads as two and is refused, never trimmed;
     - a push URL whose transport is a program git would run is refused before anything runs (`remote-transport`). That covers `<name>::`, and a `<scheme>://` that git does not carry;
     - the URL is probed with `git ls-remote <transient remote> refs/heads/main`, where the transient remote is `remote.opendox-probe-<hex>.url` passed in the command's environment (`GIT_CONFIG_COUNT=1`). So the URL, and any credential in it, never reaches git's argv;
     - the probe admits only git's own transports (`GIT_ALLOW_PROTOCOL`), so a second `insteadOf` rewrite runs no helper;
     - the probe never waits on a human: no prompt, no askpass, and ssh in batch mode, which also outranks a repository's own `core.sshCommand`. It is bounded by `PROBE_TIMEOUT` (60 s);
     - a remote with no `main` passes (N-16);
     - every message is redacted:
       - every value the URL carries is removed BY VALUE (`submission_push._scrubbed`);
       - then the runtime's `redact_credentials` and 12.1a's patterns run, the fragment form (`#token=`) and a value after whitespace included;
       - a failed probe keeps only git's `fatal:` and `error:` lines, so curl's trace headers never reach a message;
  5. refuses a dirty served checkout on `main` before merging (ADV-08), and refuses where another working tree holds `main`;
  6. makes the `--no-ff` merge in its own detached worktree under `<repo>-worktrees/landing/`, with git's own strategy and drivers only:
     - `.gitattributes` and the global attributes file are out of the merge;
     - a driver this machine's attributes still select is refused, a named `text` or `binary` included;
     - `merge.default` is pinned to a fresh driver name, and `merge.directoryRenames` to `conflict`;
     - `branch.HEAD.mergeOptions` is pinned empty. The merge runs on a detached HEAD, where `-X theirs` answered a conflict and `-s ours` dropped the branch (lane 3's review R2);
     - drivers named `set`, `unset` and `unspecified` are pinned to fail. `check-attr` cannot tell those string values from git's own states;
     - a git without `--attr-source` (older than 2.42) is refused by name (`merge-failed`), never with a raw error;
     - rerere is off;
     - no hook runs (`core.hooksPath=/dev/null`) in the landing worktree's checkout, the merge, its `switch`, or either fast-forward. A hooks path inside the tree is the branch author's to write, and a hook that pushed would contradict `pushed=False`;
  7. then moves `main`:
     - where the served checkout holds `main` and is still clean, by `git merge --ff-only <merge commit>` there. First it refuses (`ignored-files-in-the-way`, naming the files and the remedy) when the checkout holds an IGNORED file where the landing writes. That covers the path itself, a file under it, and a file where it needs a directory. A fast-forward overwrites an ignored file with no word;
     - where it holds another branch, the landing worktree takes `main`, checks that it is still the merge's tip, and fast-forwards it there (`left`). git refuses `main` to the landing worktree while another working tree holds it, and refuses `main` to every other working tree while the landing worktree does. So `main` never moves by its ref alone.
- It pushes nothing (R2Q6 (a)), and every git command goes through `session_git.SessionGit`.

**`src/opendox/landing_confirm.py` (new).**
- The confirmation capability: opaque, bound to the branch and its head, and single-use.
- It has exactly two issuers:
  - `confirm_at_terminal`, the `/dev/tty` prompt. It refuses a stdin that is not a terminal, refuses when there is no controlling terminal, and mints only on the typed branch name (N-11);
  - `LandingNonces`, the server's per-branch nonce (OQ-12-13). A nonce that is not an ASCII string is a mismatch, never an exception.
- A token's record is dropped when the token itself is gone (`weakref.finalize`), so a long-running server keeps no record per confirmation. A spent token still held is still refused as spent.
- A token's binding refuses only an empty branch name. git decides what a branch name is, and a legal one may end in a no-break space.
- `INTERACTIVE_LAYERS` names the only modules that may call them: T015's and T016's `cli_branch_actions.py` and `serve_branch_actions.py`.

**`src/opendox/session_pr.py`.** It re-exports `LandingPort` and `repository_governance` (FR-007; ADV-23), beside T011's submission-port names. `PullRequestPort` keeps its three operations.

**`src/opendox/session_git.py` (T013).**
- The name-only allowlist at `:99` is restated, unchanged, and `merge` stays off it.
- An ARGUMENT check admits exactly the three arguments `merge --ff-only <commit>`, with `<commit>` a full object id and never a ref name (FR-004a exception 1). It admits them only at the served ROOT, and only while the served checkout holds `main` and `git status --porcelain` (untracked files included) is empty.
- The guard reads that state from git immediately before the move. `:93`'s stated rule names the exception (exception 2).
- `fast_forward_served(commit)` issues the move, then checks that the served checkout holds `main` at the commit. Otherwise it refuses, and never reports a move it did not make.
- The funnel pins `pull.twohead=ort` and an empty `branch.main.mergeOptions` in that one command's ENVIRONMENT (git's command-scope `GIT_CONFIG_COUNT`), never in its argv. Measured on git 2.43: `-s ours` made a new merge commit, and `--squash` changed the index and moved nothing.
- `SubprocessGitRunner` runs git with `local_git_adapter.sanitized_git_environment()`. So `GIT_DIR`, `GIT_WORK_TREE` and their relatives never redirect a command the guard approved.
- The fast-forward's environment pins `core.hooksPath` to no directory too, so no `post-merge` hook runs.
- `shown()` escapes, for a message, text that holds a control or format character (a bidi override included). The fast-forward refusal, `land`'s refusals and the confirmation prompt all use it.
- `branch_sha` reads the exact ref (`show-ref --verify`), and `checked_out_at` reads a working tree's path as spelled, a trailing space included.
- `git_nul(cwd, *args)` reads a NUL-delimited output as BYTES and decodes each field UTF-8 with `surrogateescape`, with no newline translation, so a carriage return or a non-UTF-8 name reaches a guard as git wrote it (Copilot 4195681954; openxFactory#656 `6026275158`). It runs through the funnel, so the fast-forward's pins apply to it too. Text mode decodes with `surrogateescape` too, so no git output raises.
- The served checkout's `HEAD` ref is read exactly: the legal branch `main\u00a0` is never taken for `main`.
- `ls_remote_url(cwd, url, ref)` probes one ref at a URL through a transient remote in the command's environment, for the landing's remote check. It runs with `PROBE_ENVIRONMENT` (non-interactive, git's own transports only) and `PROBE_TIMEOUT`. The runner takes an `env` overlay and a `timeout`, and a timeout answers exit 124.

**`tests/test_session_git.py` (T013).**
- `:523`'s `("merge", "other-branch")` still refuses, unchanged.
- `:563-564`'s pin moves to the admitted form. `merge` stays absent from the name list, the admitted argv is `("merge", "--ff-only")` plus a full id, and the pure guard admits it on a clean `main` and nothing else.
- New cases:
  - the admitted fast-forward;
  - every pinned setting, through all three entry points (the bytes reader included);
  - refusals: a dirty checkout (tracked and untracked), another branch, a subdirectory, every other merge spelling (the `-c`-pinned spelling included), and a short id;
  - a fast-forward that lands elsewhere;
  - the ambient-environment case.

**`tests/test_landing_guardrails.py` (new).**
- F12.2's thirteen nodes, by their ratified names.
- T012's three named nodes.
- The lander's mechanics, the merge's drivers and settings, the governance reading's edges, and the audit's two nodes.
- The regressions for Copilot's sixth review and lane 3's review R2.
- The host-side nodes run against a registered TEST host profile that declares an instrument (R2Q3 (a)).

### The repository-creation audit (named, as T012 asks)

Every place openDox's product code creates a repository:

| site | before | now |
|---|---|---|
| `src/opendox/conformance_corpus.py:322` (`transpose`, the populated state) | `git init -q`: `init.defaultBranch` decided | `--initial-branch=main` |
| `src/opendox/conformance_corpus.py:431` (`transpose`, the empty state) | `git init -q`: `init.defaultBranch` decided | `--initial-branch=main` |
| `src/opendox/authoring.py:508` | `--initial-branch=main` already | unchanged |
| `src/opendox/runtime/repository_act.py:982-983` (`init --bare`) | `--initial-branch={branch}`, `DEFAULT_BRANCH = "main"` | unchanged, so T011's file is not touched |

Two tests hold it:
- `test_every_repository_opendox_creates_names_its_initial_branch`, a static sweep of every `git init` in the package;
- `test_the_conformance_corpus_is_born_on_main_whatever_git_defaults_to`, run under an ambient `init.defaultBranch = trunk`.

Two places are outside the product and left as they are:
- `acceptance/at_r1_http.py:1774`'s `git init -q` is AT-R1's own fixture, not product code, and AT-R1 asserts nothing about the branch;
- `.github/workflows/release.yml` already uses `-b main`.

### Readings this PR takes, for the holder to rule on (inferred, not ruled)

1. **A registered host profile WITHOUT an instrument also outranks a declaration.** The repository is then `governed`, governed-without-an-instrument, and refused.
   - 12.6a's precedence runs "the host, then main's declaration".
   - T019 asserts "with the real host registered: no lander bound; the host outranks a declaration", and no production host declares an instrument in release 2.
   - So host presence decides, the fail-closed reading. The other reading would bind a lander under a host on the strength of a file.
2. **The instrument's facet is named `SUBMISSION_INSTRUMENT`.** It is a factory `(checkout_root: Path) -> SubmissionPort`. The plan names the instrument ("its contributed `SubmissionPort`, declared in its host profile", R2Q4 (a)) but not the facet. `request_landing` calls the instrument's `submit(branch)`, the operation of T011's `SubmissionPort`, now in `session_pr`.
3. **No `main` is `unknown` even under a host.** A flag/setting disagreement on the install mode is `unknown` in every mode. Both are checked before the host.
4. **"Clean" is git's own sense, untracked files included.**
   - With several remotes and none named `origin`, each remote's `main` is checked.
   - An `ls-remote` that fails is refused: it cannot be verified, so it fails closed.
5. **A confirmation is spent by the first presentation that finds it**, even if the landing then refuses. Under `governed` with an instrument, the routed submission still requires and spends one.
6. **FR-004a's "exactly those three arguments" is read as the argv the guard admits.** CONFIRMED by the holder (openxFactory#656 `6026275158`).
   - The two settings that could turn that fast-forward into a merge (`pull.twohead`, `branch.main.mergeOptions`) are pinned in the command's environment, not its arguments. The command git runs is still `git merge --ff-only <commit>`.
   - Unpinned, a repository's own configuration can make that command create a merge commit, or stage a squash and move nothing.

7. **`--attr-source` needs git 2.42, above the plan's stated floor of 2.31.** On an older git, `land` is refused by name (`merge-failed`, naming 2.42), as data-model.md § Landed says, and nothing is merged. Raised by lane 3's review R2; inferred, not ruled.

### Stated limits (Copilot's reviews and lane 3's R2; for the holder)

- **Neither fast-forward can hold `main` across the check and the move.** The holder WIDENED this limit to both paths (openxFactory#656 `6067853207` item 3, for Codex P1 `4223462529`).
  - The reads (the guard's, and `land`'s check of `main`'s tip) and `git merge --ff-only <commit>` are separate git processes. git has no lock that a separate process can hold across them, and holding the served `index.lock` would also stop the fast-forward.
  - On the served path, a switch of the served checkout by its own user in that window fast-forwards the branch it switched to. The post-check refuses rather than report a landing (`test_a_served_checkout_switched_during_the_fast_forward_is_never_reported`).
  - On BOTH paths, another local git process that rewinds `main` to an ancestor of the merge commit in that window is undone, and the landing reports success.
    - On the `left` path, git refuses `main` to every other working tree while the landing worktree holds it.
    - A ref update made outside any working tree is not refused.
  - `merge --ff-only <commit>`, the one move feature 007 admits, has no compare-and-swap form. `update-ref refs/heads/main <merged> <main>` on the `left` path is not adopted: it would reverse the "`main` never moves by its ref alone" design (Copilot's second review; mutant L15).
  - It is a race between the operator's own local processes, not a payload.
- **A checkout path ending in a newline or a carriage return cannot land** (Copilot `4223441552`, the same defect as Codex P2 `4223462534`). ACCEPTED as a limit by the holder (openxFactory#656 `6067853207` item 1).
  - `checked_out_at` reads `%(worktreepath)` line by line, so the path comes back altered, and `land` refuses as `main-checked-out-elsewhere`.
  - It fails closed, and the served-`HEAD` guard still refuses any move of the wrong branch.
  - The governance reading does take such a path (`test_a_checkout_whose_path_ends_in_a_newline_is_read`).
- **One refusal can print a branch name unescaped** (Copilot `4223441643`). ACCEPTED as a limit by the holder (openxFactory#656 `6067853207` item 2).
  - `fast_forward_served`'s post-check refusal names the branch the served checkout holds, as it is.
  - It is reachable only after a concurrent switch to a branch whose name holds a bidi or format character, and it can only reorder how the message displays.
- **Clean, smudge and process filters run during the landing's checkouts** (Copilot 4199664554). ACCEPTED as a limit by the holder (openxFactory#656 `6026622117` item 1).
  - A filter's command comes from git's configuration, not from the repository's content. Disabling filters would write a different working tree: LFS pointers in place of their content.
  - A filter runs during `land` as it runs during the owner's own `git checkout`. The landing's merge still takes attributes out, so no filter decides a conflict.
- **The static issuer check reads source, so a deliberately dynamic reach can pass it** (lane 3's review R2, finding 6). ACCEPTED as a limit by the holder (openxFactory#656 `6035797819`).
  - `getattr` or `importlib` written to evade the check is a deliberate structural edit of reviewed openDox code. It is the class of `6028383410` and `6028539440`, which 12.6a's in-process limit for deliberate code covers.
  - Implicit string concatenation is caught.
- **A git older than 2.31 with a remote attached is refused as `remote-unreadable`, not by the named 2.42 floor** (lane 3's review R2-DELTA, `landing.py:836`). ACCEPTED as a limit by the holder (openxFactory#656 `6069024568` item 1).
  - Such a git ignores `GIT_CONFIG_COUNT`, so the transient-remote probe fails before the merge's floor refusal is reached, and that refusal tells the user to fix or remove the remote.
  - It fails closed: nothing is merged and `main` is where it was. Without a remote, the same git gets `merge-failed` naming 2.42. Only the message's precision is affected.
- **The instrument receives a branch name.**
  - `SubmissionPort.submit(branch)` is T011's signature (12.1).
  - The head is read again immediately before `submit`, but an adapter that reads the branch later can still see a newer head.
  - Carrying the confirmed object id needs that interface to change, which is T011's or a later task's.

### What is NOT done here

- **T016:**
  - `landing_factory` and `_landing_port`;
  - the `land` verb, its routes and `actions.land`;
  - the confirm control;
  - the surface nodes in this test file;
  - a live session ending by the merge observation (`branch_session.py`).
- **Later tasks:** T017 (the CI floors: this PR raises SELECTED and PASSED, and skips nothing) and T018 (the README).

### Files changed

- `src/opendox/landing.py` (new)
- `src/opendox/landing_confirm.py` (new)
- `src/opendox/session_pr.py` (the re-exports only)
- `src/opendox/session_git.py` (T013)
- `src/opendox/conformance_corpus.py` (the audit's two sites)
- `tests/test_landing_guardrails.py` (new)
- `tests/test_session_git.py` (T013)

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


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

## T015: the `submit` verb, route and control (plan 038, P4-C)

> **Stack:** #92 (T011) landed as `09b8d44a`, #93 (T014) as `a7a1c4d3`, and #90 (T012/T013) as `6827cafc`. This branch merges `main` at `6827cafc`, so its diff against `main` holds T015's files and the collateral the holder admitted (listed below), nothing else.

- **Realizes**: 12.4a (opensoft/openXfactory#1144, `add-neutral-product-standalone-operability`).
- **Falsifier**: F12.2's five `tests/test_submit_route.py` nodes; CLI tests in `tests/test_cli_branch_actions.py`; a test that a host profile replacing the default sees no `actions.submit` key.
- **Ruled**: R2Q1, R2Q3, R2Q4, R2Q5, R2Q9 (item 7) (the plan ruled on opensoft/openXfactory#656 comment `6013547504`). **Decisions**: CF-1, N-2, N-17, OQ-12-9, OQ-12-14.
- **After**: T014 (#93), T025 and T104 (#94; the census fixture's chain is T025 → T104 → T015), T005 (the `--local` line).
- **Contract**: plan 038's `contracts/cli-http-submit-land.md`, the submit half.

### What it adds

- **`opendox submit --repo-root PATH --branch BRANCH [--local] [--json]`** (new `src/opendox/cli_branch_actions.py`). This is 12.4a's ratified shape.
  - It is contributed through `default_profile.py`'s `SUBCOMMAND_EXTENSIONS` (N-2).
  - It pushes through T014's `cli._submission_port` binding: `LocalGitSubmissions` by default, which is plain git and never `gh`. Where a host contributes a port, it uses that one (R2Q4 (a)).
  - It prints the `Submission` report (remote, ref, URL with any credential redacted, branch and commit), or one JSON object with `--json`.
  - **No actor gate** (OQ-12-9).
  - **The install mode is not read** (N-17). `--local` is refused only where it disagrees with `OPENDOX_INSTALL_MODE=hosted`, and the refusal names both.
  - **Refusals** are a named sentence on stderr with exit 1, with nothing pushed and no traceback:
    - `main` (R2Q5 (a)), before any port is asked;
    - no remote, or several and none named `origin`;
    - several push URLs, or a rejected push;
    - a report that does not name where the work went;
    - a failure the port did not name. This one gets a fixed sentence naming the exception's type alone.
  - **Redaction and checks at the boundary.**
    - The report's `url` and `remote`, and every refusal's message, pass through `redacted_text` where both doors print them (12.1a). Every `scheme://` URL in them goes through `redact_destination` first, which treats any non-ssh userinfo, and every query and fragment value, as a secret. The host is kept.
    - The report's `branch`, `ref` and `commit` are checked rather than trusted. They must be the submitted branch, `refs/heads/<that branch>`, and a full object name.
    - Both hold whoever answered, a host's contributed port included.
- **`POST /actions/session/submit`** (new `src/opendox/serve_branch_actions.py`). It is contributed through the default profile's `ROUTE_EXTENSIONS` (`BranchActionRouteExtension`) and `HANDLER_CONTRIBUTIONS` (the `BranchActionRoutes` mixin).
  - **12.4a's three-clause gate runs before any body byte is read:**
    1. off loopback → 403 `loopback_only`. This is the hosted plane's refusal, and it is the route's own.
    2. no `session` capability or no resolved actor → 403 `action_unavailable`.
    3. not the human console (the console token, a trusted `Host`, a JSON body, no foreign `Origin` or `Referer`) → 403 `agent_invocation`.
  - **The body carries `branch` alone.** Any other key, `repo_root` included, gives 400. The route takes no repository from the request.
  - **Answers:**
    - no port → 403;
    - `NoSubmissionTarget` → 409 `no_submission_target`;
    - other `SubmissionError` → 409 `submission_refused`;
    - any other exception → 500 `submission_failed`, with only the type logged;
    - success → 200 with the `Submission` object.
- **`actions.submit`** (`serve.py` `compute_capabilities`).
  - The key is PRESENT only where a route binding answers `POST /actions/session/submit`, which happens only under openDox's own profile.
  - Its VALUE is the local human's: actor, real checkout and loopback, derived from the bindings as `gate`'s is (`answers_the_submit`).
  - Core `_DEFAULT_CAPABILITIES` gains nothing (OQ-12-14). A host profile that replaces the default sees no `submit` key, route, handler or verb (R2Q3 (a)).
- **The submit control** (new `src/opendox/web/views/branch-actions.js`, wired by `web/app.js` and `web/index.html`).
  - It is keyed on `actions.submit === true` and the console token, never on `session`.
  - It is not offered in a composed render.
  - It is withheld while an active key names another repository than the one `/capabilities` declares as `repository`, because the route pushes from the served checkout alone. With no repository active, as on a standalone plane, which has no snapshot index, it is offered (`anotherRepositoryIsActive`; Copilot's finding and lane 3's MAJOR, below).
  - The account menu's access line names `submit` where it is granted (`views/account-menu.js`, admitted below; Codex's finding, below).
  - It never proposes or sends `main`, and it states a refusal in the server's own words.
  - The census fixture and `tests/test_web_boundary.py` gain its rows and its two boundary tests.

### The falsifier, run (red first)

**Red, stage 1.** The base tree with this PR's tests and no `src` change:

```
E   ImportError: cannot import name 'serve_branch_actions' from 'opendox' (…/red-base/src/opendox/__init__.py)
ERROR tests/test_submit_route.py
1 error in 0.60s
```

**Red, stage 2.** The two modules present but not wired into the default profile. Each route node answered `{'error': 'unknown_action', 'message': 'no such action route'}`, and each CLI case exited with `SystemExit: 2`:

```
FAILED tests/test_submit_route.py::test_submit_route_is_refused_off_loopback
FAILED tests/test_submit_route.py::test_submit_route_is_refused_without_a_resolved_actor
FAILED tests/test_submit_route.py::test_submit_route_is_refused_without_the_console_token[absent]
FAILED tests/test_submit_route.py::test_submit_route_is_refused_without_the_console_token[wrong]
FAILED tests/test_submit_route.py::test_submit_route_is_refused_from_a_foreign_origin[Origin]
FAILED tests/test_submit_route.py::test_submit_route_is_refused_from_a_foreign_origin[Referer]
FAILED tests/test_submit_route.py::test_submit_route_takes_no_repository_from_the_request[repo_root]
FAILED tests/test_submit_route.py::test_submit_route_takes_no_repository_from_the_request[repository]
FAILED tests/test_submit_route.py::test_submit_route_takes_no_repository_from_the_request[checkout_root]
FAILED tests/test_cli_branch_actions.py::test_submit_pushes_the_branch_and_reports_where_it_went
…
FAILED tests/test_cli_branch_actions.py::test_the_default_profile_contributes_submit
31 failed, 4 passed in 22.32s
```

**Green, at `e7ee97b8`:**

```
$ python -m pytest -q -rA <F12.2's five test_submit_route.py nodes> tests/test_submit_route.py::test_a_host_profile_replacing_the_default_sees_no_submit_key
PASSED tests/test_submit_route.py::test_submit_route_is_refused_off_loopback
PASSED tests/test_submit_route.py::test_submit_route_is_refused_without_a_resolved_actor
PASSED tests/test_submit_route.py::test_submit_route_is_refused_without_the_console_token[absent]
PASSED tests/test_submit_route.py::test_submit_route_is_refused_without_the_console_token[wrong]
PASSED tests/test_submit_route.py::test_submit_route_is_refused_from_a_foreign_origin[Origin]
PASSED tests/test_submit_route.py::test_submit_route_is_refused_from_a_foreign_origin[Referer]
PASSED tests/test_submit_route.py::test_submit_route_takes_no_repository_from_the_request[repo_root]
PASSED tests/test_submit_route.py::test_submit_route_takes_no_repository_from_the_request[repository]
PASSED tests/test_submit_route.py::test_submit_route_takes_no_repository_from_the_request[checkout_root]
PASSED tests/test_submit_route.py::test_a_host_profile_replacing_the_default_sees_no_submit_key
10 passed in 7.31s
$ python -m pytest -q tests/test_submit_route.py tests/test_cli_branch_actions.py
102 passed in 33.12s
```

**F12.2's submission half, verbatim** (opensoft/openXfactory#1144 `tasks.md`, the FALSIFIED BY block, dedented). It ran at `e7ee97b8`, this head, from a `git archive` of the commit, in a fresh venv (`pip install ".[test]"`), with a PATH holding `git` and no `gh`:

```
command -v gh: absent
…
Successfully installed … opendox-0.1.0 …
e8cc902cf58b660669f6b8ffff8349d5781a4b41        # git -C "$W/remote" rev-parse --verify sess-1
1 passed in 1.17s                                # test_server_unset_submission_factory_binds_the_neutral_default
1 passed in 1.57s                                # test_a_credential_in_the_remote_url_never_reaches_the_report
9 passed in 6.75s                                # the five test_submit_route.py nodes (parametrized)
F12.2-submission-half EXIT 0
```

### Mutants: 74 over the code at this head, all killed

**41 over the first head.** One mutant first SURVIVED: `S-gate2 capability dropped`, which kept the actor clause and dropped the `session` capability. `test_a_plane_whose_verdict_says_no_session_refuses_whatever_its_actor` was added for it, and the kill was re-proven at `19b5aba5`:

```
UNMUTATED: 1 passed in 1.74s
MUTATED: capability clause dropped
MUTANT: FAILED tests/test_submit_route.py::test_a_plane_whose_verdict_says_no_session_refuses_whatever_its_actor
```

The other 40, each killed by a named node:

```
S-gate1 loopback clause off | S-gate2 actor dropped | S-gate3 console clause off
S-body read before the gate | S-body problem ignored
S-requested not-a-dict | extra keys | message pick | str check | empty check
S-no port ignored | S-no-target code merged | S-unvetted text logged | S-success body | S-binding method
C-main refusal off | C-report str check | C-report empty check
C-mode always read | C-mode flag dropped | C-mode refusal ignored | C-refusal exit 0 | C-json off | C-binding bypassed
D-no submit verb | D-no submit route | D-no mixin
V-key always present | V-key always true | V-answers method
J-keyed on session | J-empty token | J-proposes main | J-sends main | J-refusal styled as success
J-button stays disabled | J-no token header | J-unoffered mounts | J-composed mounts | A-no mount
```

**10 over lane 3's R1 fixes**, run at `a9616ee4` against `tests/test_cli_branch_actions.py`:

```
MN1 catch-all removed                    | KILLED …test_a_port_failure_it_did_not_name_is_refused_without_its_text[binding]
MN2 exception text printed               | KILLED …test_a_port_failure_it_did_not_name_is_refused_without_its_text[binding]
MN3 type not named                       | KILLED …test_a_port_failure_it_did_not_name_is_refused_without_its_text[binding]
MN4 unnamed failure exits 0              | KILLED …test_a_port_failure_it_did_not_name_is_refused_without_its_text[binding]
MN5 binding built outside the try        | KILLED …test_a_port_failure_it_did_not_name_is_refused_without_its_text[binding]
NM1 hosted not refused                   | KILLED …test_local_beside_hosted_is_refused_naming_both[hosted]
NM2 any non-local value refused          | KILLED …test_local_beside_any_other_value_is_accepted[Hosted]
NM3 value not stripped                   | KILLED …test_local_beside_hosted_is_refused_naming_both[ hosted ]
NM4 value matched case-insensitively     | KILLED …test_local_beside_any_other_value_is_accepted[Hosted]
NM5 flag not required                    | KILLED …test_without_local_the_install_mode_is_not_read[hosted]
DONE 10 / 10
```

**1 that lane 3 did not reach:** gate clauses 2 and 3 swapped. It was killed by F12.2's own node:

```
FAILED tests/test_submit_route.py::test_submit_route_is_refused_without_a_resolved_actor - AssertionError: {'error': 'agent_invocation', …}
FAILED tests/test_submit_route.py::test_each_refusal_is_made_before_the_body_is_read[no-actor]
2 failed, 49 passed in 24.38s -> KILLED
```

**10 over the review-round guard** (`anotherRepositoryIsActive`, `7dc8214b`), run on an archive of `7dc8214b` against `tests/test_submit_route.py` and `tests/test_web_boundary.py`. Two of them make the node harness throw, so its fixture errors:

```
BASELINE rc=0 | 72 passed in 23.69s
MS1 the predicate is always false                | KILLED …test_the_control_is_withheld_only_while_another_repository_is_active (2 failed)
MS2 the predicate is always true                 | KILLED …test_a_standalone_plane_offers_the_control_as_the_page_derives_it (2 failed)
MS3 no active key counts as another repository   | KILLED …test_the_control_is_withheld_only_while_another_repository_is_active (3 failed)
MS4 an empty key counts as another repository    | KILLED …test_the_control_is_withheld_only_while_another_repository_is_active (1 failed)
MS5 the comparison is inverted                   | KILLED 67 passed, 5 errors
MS6 the mount ignores the predicate              | KILLED …test_the_control_is_withheld_only_while_another_repository_is_active (2 failed)
MS7 the mount negates it (the e149dc5 shape)    | KILLED …test_a_standalone_plane_offers_the_control_as_the_page_derives_it (1 failed)
MS8 the mount compares the branch                | KILLED 67 passed, 5 errors
MR7 the shell passes no repository               | KILLED …test_web_boundary.py::test_every_web_file_is_classified_exactly_once (2 failed)
MR8 the shell passes the ref as the repository   | KILLED …test_the_submit_route_is_addressed_by_the_branch_actions_view_alone (1 failed)
DONE 10 / 10
```

**1 over the admitted account-menu word**, run on an archive of `88b26816`:

```
MA1 the menu omits submit | KILLED …test_the_account_menu_names_submit_where_it_is_granted (1 failed)
```

**11 over the redaction rule and the report checks** (`e7ee97b8`), run on an archive of `e7ee97b8` against `tests/test_cli_branch_actions.py` and `tests/test_submit_route.py`:

```
BASELINE rc=0 | 102 passed in 34.01s
MG1 refusal_text shows the raw message                     | KILLED …test_a_contributed_refusal_is_redacted_at_the_boundary[fragment] (9 failed)
MG2 no per-URL redaction pass                              | KILLED …test_a_contributed_report_is_redacted_at_the_boundary (11 failed)
MG3 the free-text pass made stricter (lane 3's MF6 shape)  | KILLED …test_a_credential_in_the_remote_url_reaches_neither_report_nor_refusal (6 failed)
MG4 the branch check dropped                               | KILLED …test_a_report_that_is_not_the_submissions_is_refused[branch-sess-2] (1 failed)
MG5 the ref check dropped                                  | KILLED …test_a_report_that_is_not_the_submissions_is_refused[ref-refs/heads/sess-2] (2 failed)
MG6 the ref check loosened to a suffix                     | KILLED …test_a_report_that_is_not_the_submissions_is_refused[ref-refs/tags/sess-1] (1 failed)
MG7 the commit check dropped                               | KILLED …test_a_report_that_is_not_the_submissions_is_refused[commit-ccc…] (3 failed)
MG8 the commit check ignores case                          | KILLED …test_a_report_that_is_not_the_submissions_is_refused[commit-CCC…] (1 failed)
MG9 the remote is not redacted                             | KILLED …test_a_contributed_report_is_redacted_at_the_boundary (2 failed)
MG10 the url is not redacted                               | KILLED …test_a_contributed_report_is_redacted_at_the_boundary (2 failed)
MG11 the URL pattern stops at the query                    | KILLED …test_a_contributed_refusal_is_redacted_at_the_boundary[fragment] (6 failed)
DONE 11 / 11
```

(Two replaced guards are not counted here. `e149dc56`'s `servesTheActiveRepository` had its 8 mutants killed at `88b26816`, and `7dc8214b` replaced it. `2d64f42e`'s first redaction had its 7 (MX1–MX7) killed at `2d64f42e`, and `e7ee97b8` replaced it.)

### The whole suite, as `validate` runs it

- **At `e7ee97b8`, this head, run locally as `validate` runs it (full11).** The run used `CI=1`, `OPENDOX_TEST_SANDBOX_REQUIRED=1` and `LANG=C.UTF-8`, every `GIT_*` and `XF_*` variable unset, a `postgres:16` service reached through `host.docker.internal`, and the venv built with CI's install command. It reported `5899 passed, 11 skipped, 2 warnings in 3912.08s (1:05:12)`, exit 0.
- **full10 at `e7ee97b8`, the same way, at a load average of about 85:** `1 failed, 5898 passed, 11 skipped` in 2397 s, exit 1.
  - **The one failure is a timing ratio this PR does not touch:** `tests_runtime/test_migrations_apply.py::test_the_draft_page_budget_does_not_read_the_bodies_it_sizes`. It needs PostgreSQL's reading to take more than 4 × its sizing, and it measured 9.67 ms sizing against 29.50 ms reading. This PR changes neither that test nor anything under `src/opendox/runtime/`.
  - **Re-run serially at a load average of about 125–132.** At this head the node passed 3 times out of 3. On unmodified `main` `6827cafc` it FAILED 3 times out of 3.
  - The same measurement, printed, gave sizing/reading here of 4.27/25.24, 6.23/23.23 and 5.54/30.66 ms, and on `main` of 9.36/30.56, 11.57/42.08 and 5.25/23.18 ms. It crosses the 4× bar on both sides.
  - So it is a load-induced timing flake outside this PR.
- **SKIPPED stays 11.**
- **At `2d64f42e`:** `1 failed, 5885 passed, 11 skipped` at a load average of about 90, exit 1.
  - The one failure was `tests_runtime/test_oidc_verifier.py::test_one_ttl_boundary_causes_one_jwks_refresh_and_not_one_per_waiter`, a wall-clock JWKS-refresh count (`assert 3 == 2`) in code this PR does not touch.
  - Run alone at that head it passed 5 times out of 5, and its whole file gave `29 passed`.
  - CI's `validate` at `2d64f42e` (run 37874675109) printed `triple: selected=5897 passed=5886 skipped=11 failures=0 errors=0`, with the sandbox's write outside its tmpfs refused.
- **At `7dc8214b`:** `5881 passed, 11 skipped`, exit 0.
- **At `d466f2b9`, after the merge of `main` at `6827cafc`:** `5880 passed, 11 skipped`, exit 0. `7dc8214b` adds one case.
- **At `a9616ee4`, the same way:** `5730 passed, 11 skipped`, exit 0.
- **At `19b5aba5`, before lane 3's R1 fixes:** `5725 passed, 11 skipped`, exit 0. R1's tests add the five cases.

### Files

T015's Files line:
- new `src/opendox/cli_branch_actions.py`
- new `src/opendox/serve_branch_actions.py`
- `src/opendox/default_profile.py` (the first phase-4 edit)
- `src/opendox/serve.py`
- new `src/opendox/web/views/branch-actions.js`
- `src/opendox/web/app.js`
- `src/opendox/web/index.html`
- `tests/fixtures/web_boundary_census.yaml`: the `views/branch-actions.js` row, the app.js and index.html lines, and class A totals of 27 files and 18,912 lines. T104's rows are kept; class C has 14 files and 12,792 lines.
- `tests/test_web_boundary.py`
- new `tests/test_submit_route.py`
- new `tests/test_cli_branch_actions.py`

### Collateral, each admitted by the holder on opensoft/openXfactory#656

- **`tests/test_default_profile.py`** (`6023619783`; docstring `6026622117` item 2). The default's verbs are now `["runtime", "submit"]`, and it declares `HANDLER_CONTRIBUTIONS == (BranchActionRoutes,)`. The facet test's docstring now says so.
- **`tests/test_capability_honesty.py`** (`6027633398`; the helper `6028383410`).
  - `GOVERNED` gains `"submit": ("POST", "/actions/session/submit")`.
  - `_assert_every_true_flag_answers` is a PROFILE-AWARE EQUALITY with a required `default_profile` keyword: the default profile's map equals `GOVERNED`, and a composed host's map equals `GOVERNED` less `submit`.
- **`tests/test_lens_seed_actions.py`** (`6027633398`). A standalone serve's contributed routes are exactly openDox's submit route, and no seed route.
- **`tests_runtime/test_served_bundle.py`** (`6035791735`; prose `6064770458`).
  - `BUNDLE_FILES` goes 42 → 43, with a line naming `views/branch-actions.js`.
  - The prose that states the bundle's current count says 43, at lines 9, 38, 50, 417 and 437.
  - Two mentions are kept at 42, because they are not the current count. Line 15 is a measurement dated "at openDox-code#69's head" (the tree's 42 beside the wheel's 41). Line 24 is opensoft/openXfactory#1144 10.2's own count.
  - No assertion and no tree-to-wheel comparison changes.
- **`src/opendox/web/views/account-menu.js`** (`6069024568` item 2). One word: `"submit"` joins `WRITE_ACTIONS`, so the access line names the verb `actions.submit` grants. The census line count is unchanged at 181.
- **`pyproject.toml:312`** (`6069024568` item 2). One line's present-tense count: "the bundle is 43 files".

### Review rounds on this PR

- **SonarCloud at `a9616ee4`: the quality gate FAILED** on a C reliability rating on new code, with 16 open issues, all in T015's own files. All 16 were fixed in `39a73a33`, with no behaviour changed:
  - 1 bug, `javascript:S9383`: the click handler left `submit()`'s promise unhandled. `submit()` settles every outcome itself, so the handler marks it handled with `void`.
  - 2 `python:S7632`: the reason after `# noqa: BLE001` moved to the line above.
  - 8 `python:S9073`: composite asserts split.
  - 3 `python:S5778`: one throwing call per `pytest.raises`.
  - 2 `python:S9083`: `@pytest.fixture()` lost its empty parentheses.
  - At `39a73a33` the quality gate PASSED with 0 open issues.
- **Copilot at `39a73a33`, HIGH, `app.js:1696`** (thread `4223527699`, "Changes recommended"). FIX NOW under `5988818366`, fixed in `e149dc56`.
  - The defect was a misdirected push from one click. With another repository active, the control offered that repository's branch name, while the route pushes from the served checkout (it takes no repository from the request, 12.4a).
  - The fix, as corrected by `7dc8214b`: the view withholds the control while an active key names a repository other than `/capabilities.repository`, which is the authority a session verb already refuses a foreign repository against. `app.js` hands the view the active repository.
  - Tests: node-harness cases for served, foreign, none-active and undeclared repositories, and a boundary check of the shell. Mutants MS1–MS8, MR7 and MR8 are killed.
- **Codex at `a9616ee4`, P2, `serve.py:664`** (thread `4223387950`): the account menu's access line omitted `submit`. FIX NOW, admitted by `6069024568` item 2 and fixed in `63a12ad4`. Test `test_the_account_menu_names_submit_where_it_is_granted`; mutant MA1 is killed.
- **The merge of `main` at `6827cafc`** (#90) made `opendox.session_pr` re-export the landing seam, whose modules load `yaml`. So importing openDox's default profile loaded `yaml`, through this PR's module-level import in `cli_branch_actions.py`.
  - `test_importing_the_default_registers_nothing_and_needs_no_sibling` was red at the merge commit `88b26816`.
  - `d466f2b9` imports `session_pr` where it is used.
- **Copilot at `7dc8214b`, HIGH, `cli_branch_actions.py:124`** (thread `4225670374`, "Changes recommended"). FIX NOW under `5988818366`, fixed in `2d64f42e`.
  - The defect: a host's contributed port that answered a credential-bearing `url` had it printed by the CLI and answered by the route, bypassing 12.1a.
  - The same was true of a host port's refusal text, which is closed too.
  - The fix: `submission_object` re-runs `redact_destination` over `url` and `remote`, and `refusal_text` runs `redact_credentials` over every refusal both doors show.
  - The proof: five tests were red at `7dc8214b` and are green at `2d64f42e`. Mutants MX1–MX7 are killed.
- **Copilot at `2d64f42e`, HIGH, `cli_branch_actions.py:152`** (thread `4226076943`, "Changes recommended"), together with lane 3's MAJOR at the same head. FIX NOW, fixed in `e7ee97b8`.
  - The defect: the refusal redactor spared a bare username for every scheme, so a host port's refusal naming a token as https userinfo kept it. A secret under a query name no pattern knows, or in a fragment, was kept too.
  - The fix: `redacted_text` passes every `scheme://` URL through `redact_destination` before the free-text pass. The refusal, `url` and `remote` all go through it.
  - Tests: three shapes on the CLI and on both route arms, each asserting the secret gone and the host kept. 18 tests were red at `2d64f42e`. Mutants MG1–MG3 and MG11 are killed.
- **Codex at the later heads:** the Codex trigger comment (WRITER-RULES gate 3) was posted after each push. From about 19:49Z to about 23:23Z the bot answered with its usage limit (`6069024568` item 4). At `7dc8214b` (comment `6072104180`) and at `2d64f42e` (comment `6073019937`) it answered with its usage limit again.
- **At `e7ee97b8`, this head:**
  - **Codex**, re-triggered at 13:32Z, reviewed it: "Didn't find any major issues", with Reviewed commit `e7ee97b860` (comment `6082012656`).
  - **Copilot** reviewed it with 0 open findings (review `5470807021`).

### Lane 3's review R1, answered

The review is opensoft/openXfactory#656 `6064547745`, partial at `c0fb1dd3`, completed by `6066338657` at `19b5aba5` as GO (PARTIAL). Then:
- **GO at `a9616ee4`**: this PR's comment `6068113766`, with two NITs, both fixed. `pyproject.toml:312` is admitted and moved to 43 (`6069024568` item 2), and T104 is now on the After line.
- **GO (PARTIAL) at `39a73a33`**: the delta is behaviour-neutral (lane 3's coordination log, 2026-10-08 21:07Z).
- **NO-GO (EARLY) at `63a12ad4`** (lane 3's coordination log, 22:01:46Z): 1 MAJOR and 3 NITs, all fixed.
  - **MAJOR, `branch-actions.js:37`: the control was offered on no plane. FIX NOW, fixed in `7dc8214b`.**
    - The defect: since `e149dc56` the control was offered only where an active key named the served repository. A standalone plane, the one plane that carries `actions.submit`, has no snapshot index (`/snapshot-index.json` answers 404), so no key is ever active there.
    - The fix: `anotherRepositoryIsActive` withholds the control only while an active key names another repository, so Copilot's HIGH still holds.
    - The test: `test_a_standalone_plane_offers_the_control_as_the_page_derives_it` serves a real standalone plane, and the bundle's own `probeCapabilities` (the token from the URL's fragment), `fetchIndex`, `resolveStoredKey`, `resolveActive`, `isComposed` and `safeKey` derive the mount's arguments as `app.js`'s `render()` does. It was red against `d466f2b9`'s guard: `{'offered': False} != {'offered': True}`. Mutants MS2 and MS7 (the `e149dc56` shape) are killed by it.
  - **NIT, the census `app.js` row's note lacked its 1760 → 1764 move.** Fixed in `7dc8214b`.
  - **NIT, the After line omitted T104.** Fixed in this body.
  - **NIT, the body's class A total.** It now reads 18,912, this head's census figure.
- **GO (EARLY) at `7dc8214b`** (lane 3's coordination log).
- **NO-GO (EARLY) at `2d64f42e`** (lane 3's coordination log, 02:33:37Z): 1 MAJOR, 1 MINOR and 1 NIT, all fixed in `e7ee97b8`.
  - **MAJOR, `cli_branch_actions.py:152`: refusal redaction weaker than the report's.** Fixed as Copilot's thread at the same head, above.
  - **MINOR, `cli_branch_actions.py:136`: `ref`, `branch` and `commit` passed through raw, and `remote` was redacted only as a whole URL.** Fixed in the holder's stronger form.
    - `submission_object(report, branch)` refuses a report whose `branch` is not the submitted one, whose `ref` is not `refs/heads/<branch>`, or whose `commit` is not a full object name (40 hex digits, or 64 in a sha256 repository). The refusal is a fixed sentence that repeats none of the report.
    - `remote` gets the text-level redaction.
    - Tests cover six malformed reports on the CLI and one on the route. Mutants MG4–MG10 are killed.
  - **NIT: the tests spelled credential-shaped URLs whole.** Both test files now assemble them with `test_submission_default.with_userinfo`.
- **GO (EARLY) at `e7ee97b8`** (lane 3's coordination log, 2026-10-09 18:01:21Z): 0 BLOCKER, 0 MAJOR, 0 MINOR, 0 NIT. Lane 3 drove 63 hostile-port checks at every print boundary, with 0 leaks. Its two limits are recorded below, as the holder accepted them.

Each finding is classified under the convergence rule (`5988818366`).

- **MINOR, `cli_branch_actions.py`: a port exception could leak a credential. FIX NOW, fixed in `45c83c7b`.**
  - The binding and the act now sit in one `try`. Any exception other than a `SubmissionError` is refused with `UNNAMED_FAILURE`, a fixed sentence naming `type(exc).__name__` alone, with exit 1, as the route answers it.
  - New test `test_a_port_failure_it_did_not_name_is_refused_without_its_text[binding|port]`. It was red at `19b5aba5`, where the `RuntimeError` carrying `https://user:S3CRET@…` escaped `cli.main`.
- **NIT, `serve_branch_actions.py:42`: the docstring over-promised. FIX NOW (the docstring), fixed in `45c83c7b`.**
  - It now says that the act's own refusal may name the requested `branch` back to the console that sent it, as JSON the view renders as text, and that nothing else a request carried is echoed.
  - No limit is accepted. The echo is the caller's own input, behind the three clauses and the console token, rendered with `textContent`. A ref-format pre-check in the route would run git from a module that runs none, and it would still echo every well-formed name.
- **NIT, `cli_branch_actions.py:131`: a malformed install mode was refused. FIX NOW (narrowed), fixed in `45c83c7b`.**
  - The contract refuses `--local` "only where it DISAGREES with `OPENDOX_INSTALL_MODE=hosted`". The verb now reads that one value, stripped and case included, as `runtime.config.install_mode` reads it.
  - Any other value is accepted (`Hosted`, `Local`, `single-user`), since the verb does not depend on the mode. The old fail-closed test is replaced by `test_local_beside_any_other_value_is_accepted`.
- **NIT, `tests_runtime/test_served_bundle.py:9`: the bundle-count prose still read 42. FIX NOW, fixed in `a9616ee4`, with two lines kept on purpose.**
  - Lines 9, 38, 50, 417 and 437 now say 43 (`6064770458`).
  - Lines 15 and 24 stay at 42, and the holder accepted that (the ruling relayed to this writer on 2026-10-08 at 19:4xZ). Line 15 is a measurement dated at openDox-code#69's head, the tree's 42 beside the wheel's 41. Line 24 is opensoft/openXfactory#1144 10.2's own count. Moving either would make it false.
- **Lane 3's "NOT REACHED" items, now run:**
  - the BUNDLE_FILES bump;
  - F12.2 in a fresh venv (above);
  - the clause 2/3 swap mutant (killed, above);
  - the full suite to its end (above).

### Stated limits

Both are ACCEPTED LIMITS under the convergence rule (`5988818366`), ruled by opensoft/openXfactory#656 `6086098003` item 2. They are recorded here, with no push.

- **(a) `ssh://token@host` and the scp-like `token@host:path` keep the token.** That slot is the ssh login name, which `redact_destination` spares by design, as the neutral port does. Redacting it would erase the routine `git@host` display, and a token there is the host port's own misconfiguration (operator-only).
- **(b) A raw token in a host port's prose, with no URL, passes.** This is the inherent limit of pattern redaction. This PR's guarantee is that a refusal is redacted as strictly as the report, and neither covers a bare secret in prose. Known-prefix redaction is a possible later hardening, outside release 2.

### Not done here

- `opendox land` and its route (T016), which stacks on this PR.
- Lane 3's FORMAL R1-T015 at `e7ee97b8` (its EARLY GO at that head is above).
- The live sandbox is proved by this PR's own `validate` run, not locally: bubblewrap cannot create user namespaces in the local container.
- Postgres container `r2-t015-pg` is removed when T015 closes.

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


Arc: neutral-product-standalone-operability
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants