Skip to content

T025, U-6: the staging model is import-free again (W-1 (A)), and T102's posture-note follow-on (plan 038) - #91

Merged
brettheap merged 4 commits into
mainfrom
r2/t025-staging-model-import-free
Oct 6, 2026
Merged

brettheap merged 4 commits into
mainfrom
r2/t025-staging-model-import-free

Conversation

@brettheap

@brettheap brettheap commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Authored by lane openXfactory-3, delegated by lane openxfactory-4 (#656 6013610053)

Arc: neutral-product-standalone-operability

T025, U-6: openDox web (SF; DJ (A), W-1 ruled (A)), plan 038

What changed

The model (views/staging-workbench-model.js), W-1 (A).

  • It imports nothing again. It now carries its own copy of the nine views/display.js tables it read: STAGE_ROLES, STATUS_ROLE, SCOPE_KINDS, TAB_IDS, SESSION_SCOPE_KINDS, SESSION_BRANCH_NAMESPACES, SNAPSHOT_VALUES, NEUTRAL_DISPLAY.stages (as NEUTRAL_STAGES) and NEUTRAL_DISPLAY.areas (as NEUTRAL_AREAS).
  • Its neutral vocabulary is a small reader over three of those tables. It answers the five reads the model makes (one, many, short, area, documentStage) as neutralDisplay() does, and it refuses an unknown role by name, as Display does.
  • The facet itself still arrives only through setDisplay, which the view calls at mount. Nothing a host declares is copied.
  • The nine are exported together as INLINED_DISPLAY_TABLES, keyed by the views/display.js expression each one copies, so T050's inline-parity guard can read both ends.
  • views/display.js is unchanged. It is T050's file.

The view (views/staging-workbench.js), S1, T102's follow-on.

  • T102's two re-shows (the restored-scope reconcile and an unload) now redraw the plane already stated, through a new redrawPostureNote. They no longer call showPostureNote again, so the one rule keeps its definition and its two callers. const stands = !!plane.note && plane.chat !== true; is kept verbatim.
  • One comment names editingPosture instead of its capitalised header. That comment was the only place the file carried the substring POST, which the no-write-path pin refuses.

The census and its test.

  • The two rows' loc (model 2330 → 2468, view 3621 → 3633) and the class totals (A 18621 → 18759, C 12757 → 12769).
  • A new declared class, inlined_display_tables, keyed by (path, identifier), with copies naming the views/display.js expression. The governance-literal sweep skips the string literals inside each declared table's own declaration, and nowhere else in the file. Five of the nine carry watched words: four seam-key tables, plus STATUS_ROLE's role names that are spelled like status words.
  • Three new tests:
    • test_the_staging_model_is_import_free: no import, static or dynamic, and no from "..." clause. It reads over the code, with comments and string contents blanked and each template literal's ${...} substitutions read back as code. A substitution ends at its own code brace, so a brace inside a nested string, comment or regex cannot end it early. Both points come from Copilot's two rounds.
    • test_every_inlined_display_table_is_real: each row's table is declared in the file, and each copies names something views/display.js declares.
    • test_the_inlined_tables_are_the_registry_the_model_exports: the census rows and INLINED_DISPLAY_TABLES list the same tables. A table the sweep exempts is therefore always one T050's guard reads.
  • test_every_in_scope_file_reads_the_display_facet accepts a third shape. An import-free file that inlines its tables must declare setDisplay, and an in-scope file that imports ./display.js must import it from that file and call it.

The falsifier, measured

Environment. Python 3.12.3, Node v24.21.0, pytest 8.4.2.

  • Composed run, in R1Q23 (a)'s form:
    • openXdox-code 56e1c238 (its main), installed with CI's python -m pip install -e ".[test]";
    • openDox-code force-reinstalled (pip install --force-reinstall --no-deps) at base a9ac96f9 or at this head;
    • openxFactory 92010d3e (its main), with submodules initialized recursively and PYTHONPATH="$OPENXFACTORY/scripts".
    • run off CI (no CI variable), as R2-INV-12 measured its 174.
  • openDox-code's own suite: run as its CI runs it: CI=true, a Postgres 16 database in OPENDOX_TEST_DATABASE_URL, and python -m pytest -q --junitxml=pytest-report.xml.
  • Colour. Every run quoted below for 40490d4e and 45f5c55d unsets FORCE_COLOR, CLICOLOR and COLORTERM and sets TERM=dumb, so no colour code reaches a test that matches error text.
  • The final head is 137b75b8. It is 45f5c55d with origin/main 34c20641 merged in (T010, T010: R2Q17 (a)'s required-check change, the sandbox live in validate (plan 038) #89). That merge brings only .github/workflows/validate.yml, where the sandbox is made live and OPENDOX_TEST_SANDBOX_REQUIRED=1 is set. src/ and tests/ are byte-identical to 45f5c55d.
  • Composed base for the final head: main 34c20641, whose src/ is identical to a9ac96f9. openxFactory's scripts/ and submodule gitlinks are the same at 92010d3e and at its current main 51456835.
  • Colour. Every run quoted below for 40490d4e, 45f5c55d and 137b75b8 unsets FORCE_COLOR, CLICOLOR and COLORTERM and sets TERM=dumb, so no colour code reaches a test that matches error text.
  • The bundle is the same at every head after 158ab41f. 45f5c55d changes only tests/test_web_boundary.py against 40490d4e, and 40490d4e changes the model by one line (Sonar's object spread). Each number is quoted at the head it was run on.

1. The 34 nodes, composed. Command: python -m pytest -q tests/test_staging_workbench.py.

result
base a9ac96f9 59 failed, 20 passed, 4 errors in 9.61s
head 158ab41f 29 failed, 54 passed in 9.09s
head 45f5c55d 29 failed, 54 passed in 7.61s
base main 34c20641 (for the final head) 59 failed, 20 passed, 4 errors in 9.70s
head 137b75b8 (final) 29 failed, 54 passed in 9.73s

At every head, exactly 34 nodes flipped red to green and none flipped green to red. They are the 34 tasks.md names:

node (R2-INV-P4F bucket) base head
the 28 display-js (DJ) test nodes: test_workbench_kind_and_signal_vocabularies, test_cluster_scope_is_its_document_edges, test_cluster_scope_missing_completeness_stays_missing, test_possible_scope_separates_cited_from_inherited, test_staged_scope_is_folder_docs_plus_declaring_documents, test_picked_possible_outline_is_the_picked_topic, test_unresolvable_scopes_are_null, test_lens_rescope_filters_the_existing_seed_verbatim, test_scope_derivation_is_deterministic, test_cluster_neighbourhood_is_deduped_and_honours_no_bar, test_staged_scope_has_no_neighbourhood_when_no_linked_clusters, test_scopes_derive_from_the_real_fixture_snapshot, test_a_pasted_descriptor_carries_hostile_values_through_verbatim ×5, test_a_hostile_descriptor_stays_one_command ×5, test_no_descriptor_leaves_a_shell_metacharacter_unquoted ×5, test_the_draft_says_what_you_already_have_on_this_topic 28 failed 28 passed
the 4 DJ setup errors: test_a_stale_token_catalog_failure_gets_its_own_recoverable_rung, test_an_unreadable_catalog_gets_its_own_rung_distinct_from_configured_none, test_the_editor_only_and_capable_rungs_are_unchanged, test_the_catalog_rungs_never_outrank_hidden_or_gate_off 4 errors 4 passed
S1 test_staging_workbench_view_has_no_write_path (:798 POST, then the :802 import-free pin) failed passed
S1 test_only_the_plane_postures_still_stand_as_an_inline_note (showPostureNote( counted 5, pinned 3) failed passed

The 29 still red are not this task's. They are R-1's 23, S2's 4 (allow-list entries) and S3's 2, all of them T026's. Their cause moved:

  • The harness nodes now fail on the module-level harness text, not on the import. does not provide an export named 'BRAINSTORM_AREA' appears 9 times and 'sessionRoute' 12 times: these are R-1's 21 harness nodes.
  • display.js appears in the base log 165 times and in the head log 0 times.

2. The 16 governed suites, each run alone, composed: base a9ac96f9 vs head 40490d4e, and again base 34c20641 vs head 137b75b8, with the same numbers.

  • base: 668 passed, 170 failed, 4 errors (R2-INV-12's 174 reds).
  • head: 702 passed, 140 failed, 0 errors.
  • Only tests/test_staging_workbench.py moved.

3. Every openXdox-code test file run alone, composed: 98 files, 3660 cases, base vs 40490d4e, and again 34c20641 vs 137b75b8. Both pairs give the same result: 42 nodes went red to green and 0 went green to red:

  • the 34 above;
  • 8 outside the governed set, which also copy the model alone and also read ERR_MODULE_NOT_FOUND ... display.js at base: test_doxbench_save.py 3 (errors), test_doxbench_transport.py 4 (errors), and test_session_document_ownership.py::test_the_rewrite_picker_offers_the_tiles_own_material_and_nothing_else 1 (failure).
  • Totals: base 2933 passed, 638 failed, 83 errors, 6 skipped; head 2975 passed, 607 failed, 72 errors, 6 skipped.
  • test_dependency_direction.py::test_first_attribute_access_refuses_and_names_the_layering fails at both, which is known and pre-existing at 56e1c238.

4. openDox-code's whole suite, as CI runs it.

  • base a9ac96f9: selected=5469 passed=5457 skipped=11 failures=1 errors=0. The one failure is tests_runtime/test_migrations_apply.py::test_the_lock_is_released_after_a_run (the run left its advisory lock held). It came from running alongside the head run against one Postgres server, where pg_locks is server-wide. Re-run alone at base, that file gives 37 passed.
  • head 158ab41f, locally: 5461 passed, 11 skipped, 2 warnings in 1975.36s, which is selected=5472 passed=5461 skipped=11 failures=0 errors=0. That is base + the 3 new test cases, with no other node changed, compared node by node. The skip count equals the pinned EXPECT_SKIPPED of 11.
  • head 40490d4e, locally with colour off: 5461 passed, 11 skipped, 2 warnings in 2011.25s. 45f5c55d changes only tests/test_web_boundary.py, which gives 16 passed there.
  • head 45f5c55d, CI (validate run 37452643627): triple: selected=5472 passed=5461 skipped=11 failures=0 errors=0 and pins: selected>=3977 (margin 1495) passed>=3966 (margin 1495) skipped==11.
  • head 137b75b8 (final), locally, as CI now runs it: CI=true, OPENDOX_TEST_SANDBOX_REQUIRED=1, Postgres 16, colour off. Result: 5461 passed, 11 skipped, 2 warnings in 1555.72s, which is selected=5472 passed=5461 skipped=11 failures=0 errors=0.
  • head 137b75b8 (final), CI (validate run 37496783300): live: the sandbox ran and its tmpfs took a write, refused: the write outside its tmpfs failed, and the host directory is unchanged, triple: selected=5472 passed=5461 skipped=11 failures=0 errors=0 and pins: selected>=3977 (margin 1495) passed>=3966 (margin 1495) skipped==11.

Red first

The new import-free test, run against base's model (a9ac96f9, with this PR's final test file and census copied in):

E           AssertionError: views/staging-workbench-model.js loads another module: an `import` at lines [48]. W-1 (A) makes it import-free, so a table it needs from `views/display.js` is inlined and declared in the census's `inlined_display_tables` instead.
E           assert not [48]
1 failed, 15 deselected in 0.75s

At the same base, the whole file gives 4 failed, 12 passed: the import-free test, the two declaration tests (does not DECLARE const STAGE_ROLES, and exports no INLINED_DISPLAY_TABLES), and the census loc rows. At 45f5c55d it gives 16 passed.

Mutants

Each mutant was applied to a scratch copy of 45f5c55d, whose src/ and tests/ the final head carries unchanged. Each ran against the 11 openDox-code suites that load the model; unmutated, those give 464 passed. A mutant that adds or removes a line also trips the census loc row; the table names the guard that fires besides that.

mutant result
M1, re-add the import (import { neutralDisplay as _n } from "./display.js";) KILLED: test_the_staging_model_is_import_free, with loads another module: an import at lines [62]. Composed (at 158ab41f), it is 58 failed, 21 passed, 4 errors, and all 32 DJ nodes are red again.
M2, alter one inlined entry (SCOPE_KINDS.grouping "cluster" → "group") KILLED: 14 failed, 450 passed. The failures include test_display_facet.py::test_the_workbench_model_takes_the_vocabulary_at_the_mount and test_workbench_edit_by_scope.py::test_the_browser_set_is_the_servers_set[cluster-g1…g6]. Composed (at 158ab41f), it is 34 failed, 49 passed, with 5 DJ nodes red.
M2b, alter an entry the model never reads (STATUS_ROLE.RETIRED "retired" → "retire") SURVIVES (464 passed), by design. No behaviour reads it, and the equality of the copies is T050's inline-parity guard.
M3, a census row names an undeclared table KILLED by the sweep: views/staging-workbench-model.js:79 carries 'cluster', :80 'possible', :81 'staged'. The two declaration tests also fail.
M4, a governance literal outside a declared table (export const STRAY_KIND = "staged";) KILLED by the sweep: views/staging-workbench-model.js:190 carries 'staged'. The skip is span-limited.
M5, a table dropped from INLINED_DISPLAY_TABLES KILLED: test_the_inlined_tables_are_the_registry_the_model_exports.
M6, copies: TAB_ID KILLED: views/display.js declares no TAB_ID.
M7, the view stops calling setDisplay(vocab) KILLED: test_every_in_scope_file_reads_the_display_facet.
M8, a re-export (export { DRAFT_PATHS } from "./display.js";) KILLED: a from clause at lines [1268].
M9, a dynamic import (() => import("./display.js")) KILLED: an import at lines [192].
M10, Copilot round 1's payload: an import inside a template substitution (`${import("./display.js")}`) KILLED: an import at lines [192]. At 158ab41f it SURVIVED: only the census loc row fired.
M11, Copilot round 2's payload: an import after a "}}" string inside a substitution KILLED: an import at lines [192].

Gates

  • CI at 137b75b8 (final): validate pass (the required check, with the sandbox live) and acceptance pass. validate also passed at 158ab41f, 40490d4e and 45f5c55d.
  • Copilot, four rounds through the reviewer API:
    • 158ab41f: "Changes recommended", 1 finding, r4194288989. An import inside a template substitution was blanked with the template. Fixed now at 40490d4e.
    • 40490d4e: "Changes recommended", 1 finding, r4194349872. A brace inside a nested string ended a substitution early. Fixed now at 45f5c55d.
    • 45f5c55d: "Needs a closer look", Findings: None. Its only remark was that the declared T004 prerequisite (#1245) was still pending; #1245 has since landed as 260234b5.
    • 137b75b8 (final): "Changes recommended", 1 finding, r4198449977. CLASSIFIED AS AN ACCEPTED LIMIT under the convergence rule 5988818366, for the holder's ruling. WRITER-RULES-R2 says "Changes recommended" at the final head blocks the holder's gate until the holder rules.
      • The finding: a regex literal after an un-braced if (...), as in ${(() => { if (true) /}}/.test("x"); return import("./x.js"); })()}, hides a later import from the guard. So does the same shape at top level. Reproduced at 137b75b8.
      • The cause: _js_spans's regex-or-division heuristic, written at § 3.4 S7 for the assertion-4 sweep and reused here. After ), a / is division in (a) / b and a regex in if (a) /re/, and only a parser can tell which. This leg has no JS parser in its dependency set, and changing the heuristic would also move the S7 sweep.
      • What the guard still catches: every form a maintainer writes, as the mutant table shows: static import, from re-export, dynamic import, an import in a template substitution, and an import after braces in a nested string, comment or regex. Only the deliberately built statement-level regex form gets past.
      • The reply on the thread says the same; the thread is resolved.
  • Threads: 3, all answered and resolved, 0 unresolved. Two were fixed now (r4194288989, r4194349872); the third is the accepted limit above (r4198449977).
  • SonarCloud at 137b75b8 (final): 0 open issues. The two it raised at 158ab41f (javascript:S6661 object spread, python:S9073 composite assertion) are fixed at 40490d4e.

What is NOT done

  • The equality guard that the nine copies equal views/display.js's is T050's. That is why M2b survives here.
  • The 29 nodes still red in tests/test_staging_workbench.py are T026's: R-1's 23, S2's 4 and S3's 2.
  • Prose outside this task's files that this change makes stale. It is left for the files' owners:
    • views/display.js:203-205 says SESSION_SCOPE_KINDS is declared there "rather than in views/staging-workbench-model.js … the model is class C and may carry no literal". T050 owns that file.
    • tests/test_outline_tab.py:882-890 and tests/test_doc_wheel.py:135-137 describe the staging model as importing ./display.js.
    • tests/test_doxbench_abstract_pane.py:157-161 and tests/test_doxbench_context_panes.py:118-122 still copy display.js beside the model. That is harmless and no longer needed.
  • The CI floors. This PR adds three test cases, so selected rises by 3. MIN_SELECTED/MIN_PASSED are re-pinned by T017.
  • The pins: openXdox-code's opendox pin, openxFactory's nested openDox/code and the root openDox gitlink. That is T027 and T028; the 34 nodes are quoted again at T029.

🤖 Generated with Claude Code

…'s posture-note follow-on (plan 038)

W-1 (A), RULED by Brett Heap on opensoft/openXfactory#656 comment 6013547504,
reverses section 3.4 S7's one sibling import. views/staging-workbench-model.js
now carries its own copy of the nine views/display.js tables it read
(STAGE_ROLES, STATUS_ROLE, SCOPE_KINDS, TAB_IDS, SESSION_SCOPE_KINDS,
SESSION_BRANCH_NAMESPACES, SNAPSHOT_VALUES, NEUTRAL_DISPLAY.stages and
NEUTRAL_DISPLAY.areas) and imports nothing, so a harness that copies it alone
runs it. Its neutral vocabulary is a reader over three of them that answers
the five reads the model makes, as neutralDisplay() does; the facet itself
still arrives only through setDisplay, which the shell calls at mount. The
nine are exported together as INLINED_DISPLAY_TABLES, keyed by the
views/display.js expression each copies, for T050's equality guard.
views/display.js is unchanged.

S1, T102's follow-on in views/staging-workbench.js: T102's two re-shows redraw
the stated plane through redrawPostureNote instead of calling showPostureNote
again, so the one rule keeps its two callers; and one comment names
editingPosture instead of spelling its header in capitals.

The census and its test: the two rows' loc and the class totals; a new
declared class, inlined_display_tables, by (path, identifier), whose string
literals the governance sweep skips inside that one declaration only; three
new tests: the model is import-free (red at main, line 48 import and line 50
from clause), every inlined table is declared and names a views/display.js
table, and the census list equals the model's exported registry; and the
reads-the-facet test now reads an import-free file's facet through setDisplay,
which an in-scope file that imports views/display.js must hand down.

Lane: openXfactory-3

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 6, 2026 10:38
@sourcery-ai

sourcery-ai Bot commented Oct 6, 2026

Copy link
Copy Markdown

Reviewer's Guide

The PR restores standalone execution of the staging model by inlining the display tables it needs, while preserving host vocabulary injection and adding governance tests that bind every exemption to a real declaration and export registry. It also refactors posture-note redraws to reuse the established plane-stating rule and updates the boundary census accordingly.

Sequence diagram for staging display vocabulary injection

sequenceDiagram
  participant View as staging-workbench.js
  participant Model as staging-workbench-model.js
  participant Neutral as Neutral vocabulary
  participant Host as Host display facet

  View->>Model: setDisplay(display)
  Model-->>View: displayVocabulary()
  View->>Model: workbench scope and label reads
  Model->>Host: read injected vocabulary
  Model->>Neutral: use neutralDisplay() when no facet is set
Loading

Flow diagram for posture-note redraw reuse

flowchart TD
  Mount[Mount staging workbench] --> State[lastPlane]
  NewPlane[New posture plane] --> Show["showPostureNote(plane)"]
  Show --> State
  State --> Redraw["redrawPostureNote()"]
  Restored[Restored-scope reconcile] --> Redraw
  Unload[Document unload] --> Redraw
  Redraw --> Note[Render the existing posture note]
Loading

File-Level Changes

Change Details Files
Make the staging workbench model standalone by replacing its display-module dependency with locally declared vocabulary tables and a neutral display reader.
  • Inline nine tables previously read from views/display.js.
  • Export INLINED_DISPLAY_TABLES so later parity checks can compare the copies.
  • Preserve facet injection through setDisplay and unknown-role rejection behavior.
  • Update model comments and session-table exports to document the import-free design.
src/opendox/web/views/staging-workbench-model.js
Separate posture-note definition from redraw operations so restored-scope and unload paths reuse the existing plane without re-stating it.
  • Add redrawPostureNote() and route the two re-show paths through it.
  • Keep showPostureNote() as the sole plane-stating entry point and preserve the stands calculation.
  • Rename a comment token to satisfy the no-write-path governance check.
src/opendox/web/views/staging-workbench.js
Extend the web-boundary census and tests to govern import-free files and their inlined display-table registry.
  • Add nine inlined-table census rows and update file/class LOC totals and notes.
  • Implement declaration-span detection and narrowly scoped literal-sweep exemptions.
  • Test import-free syntax, real source declarations, registry/census agreement, and facet handoff via setDisplay.
  • Retain existing import-based facet validation for files that still consume display.js directly.
tests/fixtures/web_boundary_census.yaml
tests/test_web_boundary.py

Tips and commands

Interacting with Sourcery

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

Customizing Your Experience

Access your dashboard to:

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

Getting Help

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

The import-free guard misses executable dynamic imports inside template-literal substitutions.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Makes the staging workbench model standalone and import-free while preserving display-facet injection.

Changes:

  • Inlines required display tables and neutral vocabulary.
  • Separates posture-note plane updates from redraws.
  • Extends boundary census and validation tests.
File Description
src/​opendox/​web/​views/​staging-workbench-model.js Removes the display import and embeds required tables.
src/​opendox/​web/​views/​staging-workbench.js Adds posture-note redraw handling.
tests/​test_web_boundary.py Adds import-free and inline-table checks.
tests/​fixtures/​web_boundary_census.yaml Updates measurements and table declarations.

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

Comment thread tests/test_web_boundary.py Resolved
…ar's two findings (plan 038)

Copilot on openDox-code#91 (r4194288989), fix now: _js_spans reports a whole
template literal as one string span, so _code_only blanked a
`${import("./x.js")}` together with the template around it and the
import-free test passed over an executable import. Each `${...}`
substitution is now put back and read as code, recursively, with braces
counted the way _js_spans counts them.

SonarCloud on the same head: javascript:S6661 (the neutral reader's area()
builds its entry with an object spread, not Object.assign; the model loses
one line, so its census loc and class A's total move with it) and
python:S9073 (the import-free assertion is split into its two halves, one
per way a module loads another).

Lane: openXfactory-3

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 6, 2026 10:44

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

The import-free guard can miss imports inside valid template substitutions containing nested braces.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
Resolved since last review (1)

Comment thread tests/test_web_boundary.py Resolved
…in a nested string (plan 038)

Copilot on openDox-code#91 (r4194349872), fix now: _template_substitutions
counted every brace, so a `"}}"` inside a substitution closed it early and
_code_only blanked the import after it. _substitution_end now counts only
braces in code, skipping the strings, comments and regex literals inside the
substitution as _js_spans reads them. Probed: an import after `"}}"`, after
a `/* } */` comment and after a `/}/` regex is read as code; `${"import"}`
and `${ {k: 1}.k }` read none.

Lane: openXfactory-3

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 6, 2026 10:52

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 implementation is coherent, but its declared T004 prerequisite remains pending and requires human confirmation before approval.

Review effort: Balanced
Findings: None

Resolved since last review (1)

Lane: openXfactory-3

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

sonarqubecloud Bot commented Oct 6, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
3.9% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

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

The import-free guard still misses imports following braces inside certain valid regex literals.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)

Comment thread tests/test_web_boundary.py Resolved
@brettheap brettheap changed the title DRAFT: T025, U-6: the staging model is import-free again (W-1 (A)), and T102's posture-note follow-on (plan 038) T025, U-6: the staging model is import-free again (W-1 (A)), and T102's posture-note follow-on (plan 038) Oct 6, 2026
@brettheap
brettheap marked this pull request as ready for review October 6, 2026 17:31
@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 3 days and 3 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@brettheap

Copy link
Copy Markdown
Contributor Author

READY (holder, manual landing) at 137b75b

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

Holder, at READY (T025, U-6: the staging model is import-free again, W-1 (A); plan 038; authored by lane openXfactory-3, #656 6021819682).

  • After set met: T004 (#1245) landed as 260234b5.
  • CI at 137b75b8:
    • validate passes with the sandbox live: selected=5472 passed=5461 skipped=11 failures=0 errors=0;
    • acceptance passes;
    • 0 unresolved threads;
    • no closing keywords.
  • SonarCloud: 0 issues. Its quality gate fails only on new-code duplication (3.9%), the inlined copy W-1 (A) requires, which is an ACCEPTED LIMIT (6016356225).
  • Copilot's "Changes recommended" at 137b75b8, r4198449977, is an ACCEPTED LIMIT under 5988818366. A regex literal after an unbraced if can hide a later import from the import-free scan.
    • Closing that needs a JavaScript parser.
    • The guard targets accidental re-imports, and the two real simple-payload bypasses (a template-literal ${import()}, and a brace inside a nested string) were fixed.
    • T050's equality guard adds a second line later.

@brettheap
brettheap merged commit 84f8ed8 into main Oct 6, 2026
4 of 5 checks passed
@brettheap

Copy link
Copy Markdown
Contributor Author

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

LANDED — lane openxfactory-4, 2026-10-06T17:33:41Z, PR #91 → 84f8ed8 (opensoft/openDox-code main; plain gate)

Brett: plan 038 RULED incl. lane openxfactory-4 lands every PR (#656 6013547504); holder accepted limits: SonarCloud duplication (6016356225), Copilot r4198449977 (#91 READY note)

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 to opensoft/openXdox-code that referenced this pull request Oct 7, 2026
… CP, PI) (plan 038) (#47)

Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Authored by lane openXfactory-3, delegated by lane openxfactory-4 (#656 6021862323)

Arc: neutral-product-standalone-operability

## T099: `tests/test_renderer.py`, the renderer's 21 composed reds (plan 038)

This is slice T099 of T094's map (R2-INV-R9). It works under the holder's rulings at opensoft/openXfactory#656 comment `6021830531` and lane 3's CLAIMED comment `6021862323`. Plan 038's `tasks.md` has no entry for it yet: lane 4 records T094's slices after openxFactory#1251. Until then, the contract is the map's outline row plus those rulings.

- **Realizes** (the outline row): DJ + VR 5, HH 12, CP 3 and PI 1, all in `tests/test_renderer.py`. That is 20 nodes, plus 1 on R9-W3. They are among requirement 9's declared composed tests (T073, F9.1). Each slice clears its own reds so that T073's composed step 5a can read green.
- **Falsifier** (the outline row): the composed run of `tests/test_renderer.py`, alone, reads 0 for the 21 named reds. Its 3 LI nodes arrive with T095 (R9-W2), and its 1 SF node with T104's openDox pin. The unchanged set reads unchanged, and `tests/test_declared_exclusion.py` reads green lone.
- **Ruled** (`6021830531`; and `6028383410` for the accepted limit below):
  - W1 is (A″): the harness copies `display.js` beside the module it copies, as #43 does.
  - W3: `test_dynamic_import_is_absent` is INVERTED, so it now asserts the ruled dynamic import of contributed bindings.
  - R9-R1 (a): where a test asserts words, they are the SERVED words.
- **Decisions:**
  - No node of this file asserts a display WORD, so R9-R1 (a) needs no served display here (point 1 below).
  - Every node keeps its name, the inverted pin's (point 4 below) and the collapse node's (Copilot's rename finding, declined below), so the 21 nodes T094's map and T073's declared run account for keep their identity.
- **After:** none. Nothing here waits on T095.

### What changed: one file, `tests/test_renderer.py`

1. **DJ + VR, 5 nodes: the `model.js` harness.**
   - Since § 3.4 slice S7 (openDox-code `1e46971`), `model.js` imports `./display.js`, which is itself import-free. The harness copied `model.js` alone, so node read `ERR_MODULE_NOT_FOUND`. It now copies `display.js` beside it, as #43's harness copies the staging model's siblings, and writes a `package.json` of `{"type": "module"}`.
   - The six columns are keyed BY ROLE since S7: `source`, `grouping`, `candidate`, `selection`, `submission` and `completion`, where they were `docs`, `clusters`, `possibles`, `staged`, `proposals` and `realized`. The harness and its assertions now read the role keys. Only the keys moved: every count is the one the test always pinned (6/6/5/2/1/1; 16 topic, 1 pick and 1 flow; 8 left after the collapse).
   - No assertion reads a display word, so the harness hands `buildFunnelModel` no display, and the model takes openDox's neutral one.
2. **HH, 12 nodes: ONE `Host` line.** `_raw_get` sent two `Host` lines: `putrequest(..., skip_host=False)` added one, then `putheader("Host", ...)` added a second. openDox-code `390e2c2` (T103, openDox-code#80) admits a loopback request only with exactly one, and answered every request with `403 invalid_host` ahead of every route. `putrequest` now skips its own line.
3. **CP, 3 nodes: pinned claims, respelled to the carve's ruled design.**
   - **The fetch-bearing set** (`test_data_fetches_target_only_snapshot_and_source_passthrough`, and its arithmetic in `test_the_session_transport_stays_out_of_the_fetch_bearing_set`).
     - Slice S4 (openDox-code `69d2760`) split `repo-selector.js` under RULED Q3 (openxFactory#656 `5642758731`): "a route constant travels with the binding that calls it". So the set gains `projection-index.js` (the index read, count 1).
     - `repo-selector.js` falls from 6 call sites to 2: the refresh POST and the register-projection read, which stay class A.
     - The create-project and edit-project POSTs went with `gate-projects.js`, which slice S5 leg B (`8efb3cf`) then moved into this leg's own views. That puts them outside openDox's class-A surface, which is what this pin covers.
     - The apply POST left the bundle: it is openxFactory's own fulfilment lane.
     - The map traced only the new file. The count change was measured here, against openDox-code `84f8ed83`.
     - The sibling test's self-quoting guard (its own "finding 24") now quotes six files and six counts, each needle still assembled at runtime.
   - **The collapse modifier** (`test_six_column_default_and_five_column_collapse_marker`). openDox-code `3c3a9e3` (openDox-code#35) renamed `.collapsed-docs` / `.only-docs` to the role, `.collapsed-source` / `.only-source`.
4. **PI, 1 node, W3: `test_dynamic_import_is_absent` INVERTED.**
   - The old pin asserted that no bundle file spelled `import(` anywhere. It read red on a COMMENT in `app.js`.
   - The pin now asserts that the bundle's dynamic imports, in CODE, are exactly the carve's ruled loaders of contributed bindings, each argument exactly as written:
     - `views/view_extension.js`: `new URL(binding.module, bundleRoot).href`. This is the view registry's loader, written by slice S3 (`c5edac8`); slice S5 leg B (`8efb3cf`, RULED Q1 to Q12) mounts the contributed gate loop through it.
     - `views/repo-selector.js`: `"./projection-index.js"`, from slice S4 (`69d2760`, RULED Q3).
     - `views/intent-binding.js`: `"./intent-feed.js"`, from slice S2 (`c7ab3d8`, RULED Q5).
   - The pin also asserts that the registry's loader resolves against the bundle's own root (`new URL("../", import.meta.url)`), read from executable code.
   - So none of the three can pull a URL:
     - Two name a bundle-relative sibling literally.
     - The third is bounded where a binding is declared: openDox's `viewBinding()` refuses an absolute URL, a root-relative path and a `..` climb. openDox-code's own `tests/test_view_registry.py` holds that refusal.
   - **How the scan reads code** (`_without_comments`, shaped by Copilot's two findings):
     - It reads each file WHOLE, as a JavaScript lexer reads it. It tracks string, template and regular-expression literal state, and replaces each comment with one space. It KEEPS the literals, so an `import(` spelled inside one still counts: the scan may over-count, but it never hides a call.
     - So none of these hides a call: a line break or a comment between `import` and `(`; a generator method's line that opens with `*`; a `//` comment ended by CR, U+2028 or U+2029; a spread (`...import(`); or U+FEFF before `(`. Only a member call (`a.import(`) is skipped.
     - It reads `.js`, `.mjs`, `.cjs`, `.html`, `.htm` and `.css` files.
     - **Two readings.** The default reading keeps every spelling, so it can only over-count: it refuses an unknown import. The `executable_only` reading skips a spelling inside a literal, and it must equal the same three sites: it proves each ruled loader is an executable call, so a decoy string cannot stand in for a removed loader.
     - **The loader's base** is read as every executable assignment to `bundleRoot` (plain or compound, comments not read, literals skipped). It must be exactly `bundleRoot = new URL("../", import.meta.url)`, so neither the old line kept in a comment or a string nor a later reassignment passes.
   - **The scan's own regression cases**, committed:
     - `test_the_dynamic_import_scan_reads_code_as_a_lexer_does`: 21 probe modules, each written as exact bytes, with the site map the scan must read;
     - `test_the_dynamic_import_scan_reads_every_script_suffix`;
     - `test_the_executable_reading_counts_only_calls`: 6 cases;
     - `test_the_loader_base_is_read_from_executable_code`: 5 cases.
   - **Stated limit:** the lexer tells a regular-expression literal from a division by the token before the `/`, not by a full parse. So a regex literal straight after `)` (as in `if (x) /re/.test(y)`) reads as a division. That is the limit the holder accepted for openDox-code's import-free scan (opensoft/openDox-code#91, r4198449977): closing it needs a JavaScript parser.
   - The name is kept on purpose. The node T094's map and T073's declared run account for keeps its identity, and the name still reads true: a dynamic import is absent from every line of code but these three.

### The falsifier, composed (R1Q23 (a)), each file alone

**The form:**
- openxFactory `92010d3e` (the commit `tests/composed_host_pin.yaml` names), with `openDox`, `openXdox` and `openXwallet` initialized recursively, and its `scripts/` on `PYTHONPATH`;
- openDox installed from openDox-code `main` `84f8ed83` (T025), over the pin;
- T022's one placement: the session runbook, linked from the composed tree's openDox-spec at `f7ee3c76` before the run and removed after it. T022's script is on #41, not `main`, and it refuses a checkout whose `.gitignore` lacks its line. So the run makes that one link itself, with the script's own checks (the source tracked and unmodified, and nothing already at the destination). The checkout read clean after each run;
- the colour variables unset and `TERM=dumb`;
- each file alone, with its own short TMPDIR (38 bytes, under the PostgreSQL socket limit): `python -m pytest -q -p no:cacheprovider -rfE --junitxml=… <file> < /dev/null` from the checkout root.

| `tests/test_renderer.py`, alone | result |
|---|---|
| base: `main` `fc1115d6` | `exit 1; 28 passed, 22 failed, 0 errors, 0 skipped` |
| head: `99508076` (`main` merged) | `exit 1; 82 passed, 1 failed, 0 errors, 0 skipped` |

- **Red to green: 21, and 0 green to red.** The head's other 33 nodes are the scan's new regression cases, all green. The 21 are exactly the named nodes:
  - DJ + VR: `test_model_derives_the_six_columns`, `test_model_edge_derivation`, `test_model_tally_equals_edge_count_through_the_real_js`, `test_five_column_collapse_drops_doc_edges`, `test_model_degrades_on_empty_snapshot`;
  - HH: `test_serve_snapshot_route_and_alignment`, `test_serve_static_bundle`, `test_serve_source_passthrough`, `test_serve_divergence_diverged`, `test_serve_divergence_unknown_without_head`, and `test_serve_rejects_path_traversal` × 7;
  - CP: `test_data_fetches_target_only_snapshot_and_source_passthrough`, `test_the_session_transport_stays_out_of_the_fetch_bearing_set`, `test_six_column_default_and_five_column_collapse_marker`;
  - PI: `test_dynamic_import_is_absent`.
- **The 3 LI nodes cleared with T095 (#46), at the base:** `test_generate_and_open_generates_and_always_prints_url`, `test_generate_and_open_respects_no_open` and `test_generated_snapshot_is_schema_shaped` were red at `36bbef79` and are green at `e2340bb6` and since. They were T095's under R9-W2, not this slice's.
- **Still red: 1, not this slice's.** SF, which arrives with T104's openDox pin (`doxchat-no-model` and `doxchat-untrusted` have no `styles.css` rule in the openDox these runs install, openDox-code `84f8ed83`): `test_every_constructed_doxbench_class_has_a_styles_rule`.
- **Every base and head along the way read the same way.** The bases `8b64fae0`, `d45a0939` (T023), `f70bc9c3` (T021) and `36bbef79` (T026) read the same 25 failures, and `e2340bb6` (T095) read the same 22. Every head of this PR, from `f82abd40` to `99508076`, read the same 21 flips with 0 green to red.

### The unchanged set (the same runs, each file alone)

| set | base `fc1115d6` | head `99508076` |
|---|---|---|
| 12.5's 16 governed suites (`git grep -l -e open-pr -e open_pr -e FakePullRequests -- 'tests/test_*.py'`) | 842 passed, 0 failed | 842 passed, 0 failed |
| F5.2's 5 (`test_generator`, `test_session_snapshot`, `test_snapshot_determinism`, `test_snapshot_registry`, `test_snapshot_validation_launch`) | 123 passed, 0 failed | 123 passed, 0 failed |
| `tests/test_column_contributions_governed.py` | 9 passed | 9 passed |

- All 22 files read node for node identical at base and head.
- `tests/test_declared_exclusion.py` **lone**, with CI's install (openDox at its pin `dede32b4`) and no composed tree, at `99508076`: `207 passed in 27.51s`. Run lone, `tests/test_renderer.py` still fails on its declared reason, `doc_health`.

### Mutants: 32 of 32 killed

The bundle mutants run over a fresh copy of the installed openDox bundle, which a test-only plugin hands to the suite as its `WEB`. The plugin is not committed. The control run, with the copy unmutated, read `4 passed`.

| mutant | what goes red |
|---|---|
| M1: an extra `await import("https://cdn.example/x.js")` in `views/wheel.js` | `test_dynamic_import_is_absent` |
| M2: the ruled projection-column import removed from `repo-selector.js` | `test_dynamic_import_is_absent` |
| M3: `"./intent-feed.js"` made an absolute URL | `test_dynamic_import_is_absent` |
| M4: a spaced `import ("./display.js")` added to `views/model.js` | `test_dynamic_import_is_absent` |
| M5: `/* a note */ const x = import("https://…")`, code after a block comment, in `app.js` | `test_dynamic_import_is_absent` |
| M6: the registry loader's base moved off the bundle (`new URL("https://cdn.example/")`) | `test_dynamic_import_is_absent` |
| M7: the registry loader's `import()` removed | `test_dynamic_import_is_absent` |
| M8: an extra `fetch(` in `projection-index.js` | both fetch-set pins |
| M9: the old `.collapsed-docs` spelling restored in `styles.css` | `test_six_column_default_and_five_column_collapse_marker` |
| M12: `import`, a line break, then `("https://…")` | `test_dynamic_import_is_absent` |
| M13: a generator method, `*load() { yield import("https://…"); }` | `test_dynamic_import_is_absent` |
| M14: `import /* why */ ("https://…")` | `test_dynamic_import_is_absent` |
| M15: a string holding `//` ahead of a call on the same line | `test_dynamic_import_is_absent` |
| M16: a regex literal holding a quote and `//` ahead of a call | `test_dynamic_import_is_absent` |
| M17: `// c` CR `import("https://…")` | `test_dynamic_import_is_absent` |
| M18: `// c` U+2028 `import("https://…")` (the previous scanner missed it) | `test_dynamic_import_is_absent` |
| M19: `[...import("https://…")]` (the previous scanner missed it) | `test_dynamic_import_is_absent` |
| M20: `import` U+FEFF `("https://…")` (the previous scanner missed it) | `test_dynamic_import_is_absent` |
| M21: a CR LF line continuation in a string, then a URL string and a call | `test_dynamic_import_is_absent` |
| M31: the real projection loader replaced by a decoy string, `'import("./projection-index.js")'` | `test_dynamic_import_is_absent` |
| M32: the loader's base moved to `new URL("../../", import.meta.url)`, with the old line kept in a comment | `test_dynamic_import_is_absent` |
| M10: the test's own `repo-selector.js` count pin relaxed from `==` to `>=` (in a copy of this file) | `test_the_session_transport_stays_out_of_the_fetch_bearing_set` |
| M11: the test's own `projection-index.js` count pin deleted (in a copy of this file) | `test_the_session_transport_stays_out_of_the_fetch_bearing_set` |

The SCANNER mutants (M22 to M30) each run in a temporary copy of this file, and each is killed by a named regression case:

| mutant | the case that goes red |
|---|---|
| M22: U+2028 and U+2029 dropped from the line ends | `u2028-ends-line-comment`, `u2029-ends-line-comment` |
| M23: a lookbehind that skips any dot | `spread` |
| M24: U+FEFF dropped | `ufeff-before-paren` |
| M25: the member-call skip removed | `member-call-is-not-one`, `optional-member-call-is-not-one` |
| M26: string state removed | `slashes-in-string`, `slashes-in-template`, `crlf-continuation-in-string` |
| M27: regex-literal state removed | `escaped-slash-then-slash-in-regex`, `in-a-regex` |
| M28: the executable reading ignores literals | `in-a-string`, `in-a-template`, `in-a-regex`, `call-beside-a-decoy` |
| M29: the loader's base ignores literals | `changed-with-the-old-line-in-a-string` |
| M30: the loader's base reads plain assignments only | `a-later-compound-assignment` |

DJ's own mutant is the base: the same harness without the `display.js` copy reads `ERR_MODULE_NOT_FOUND` on all five model nodes.

### CI at the head

At the head `99508076`, every check passed:
- `validate`, run 37553249790: CI's own pytest step reads `triple: selected=1107 passed=1103 skipped=4 failures=0 errors=0`, against `pins: selected>=1099 (margin 8) passed>=1095 (margin 8) skipped==4`. This is the lone CI form, and it is unchanged: `tests/test_renderer.py` is a declared file, so the step never collects it.
- SonarCloud Code Analysis.
- `copilot-pull-request-reviewer`.

### Copilot

Reviews at each head, all requested through the reviewer API:

| head | review | verdict | findings |
|---|---|---|---|
| `f82abd40` | 5433258934 | Changes recommended | 1: the line scan missed `import` + newline + `(` and generator lines (fixed, `19be4997`) |
| `19be4997` | 5433357731 | Changes recommended | 1: `//` ends at CR, U+2028 and U+2029 too (fixed, `8081f9ff`, with spread, U+FEFF and CR LF found by audit) |
| `8081f9ff` | 5435170341 | Changes recommended | 2: regression tests for the scanner (fixed, `ec1486ca`); rename `test_five_column_collapse_drops_doc_edges` (declined, below) |
| `ec1486ca` | 5435232658 | Needs a closer look | None |
| `75eb3779` | 5435680993 | Needs a closer look | None |
| `a95900c0` | 5435796042 | Changes recommended | 2: prove the ruled loaders are executable calls, and read the loader's base from executable code (both fixed, `781c7917`) |
| `99508076` | 5436219525 | Changes recommended | 1: a shadowing `bundleRoot` binding at the import site (an ACCEPTED LIMIT, ruled, below) |

**Threads: 7, all answered and resolved, 0 unresolved.**

- **The rename, declined (r4200975189).** `test_five_column_collapse_drops_doc_edges` keeps its name. It is one of the 21 nodes that T094's map and T073's declared run account for BY NAME, so a rename would turn a red-to-green flip into a vanished node and a new one. The name still holds: the edges the collapse drops are the source station's edges, built from the snapshot's `document_edges` and checked against `document_links`. Only the column KEY became the role.
- **The accepted limit (r4201878108), RULED by the holder** under the convergence rule (`5988818366`) at opensoft/openXfactory#656 comment `6028383410`. The pin is a static, whole-source lexer check, so it cannot resolve scopes. A parameter or inner binding named `bundleRoot` that shadows the base at the import site would not be seen. That payload needs a structural edit of reviewed openDox code, not a simple one. The head's review therefore still reads "Changes recommended" for this one ruled limit.

### Files changed

`tests/test_renderer.py`, and nothing else.

### What is NOT done

- **The 1 node still red:** SF, which is T104's. T104 is on openDox-code `main` (`d616da3`), and the node clears composed once its openDox pin pair moves.
- **A stale comment in a file that is not this slice's:** `src/openxdox/web/views/swb-session.js:9` still says `test_renderer.py:130` pins the set "to five". The set is six now, and the line number has moved. It is a comment, so no test reads it.
- **`validate.yml`'s floors are untouched.** `tests/test_renderer.py` is a declared file that the lone CI step never collects, and only T029 raises the floors.

🤖 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 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>
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