Skip to content

§ 3.6 follow-up #2: a linked worktree's metadata, and a store refusal that is a refusal - #32

Merged
brettheap merged 6 commits into
mainfrom
build/3-7-followup-2-worktree-and-refusals
Sep 19, 2026
Merged

brettheap merged 6 commits into
mainfrom
build/3-7-followup-2-worktree-and-refusals

Conversation

@brettheap

@brettheap brettheap commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up #2 to openDox-code#30: the four it registered and did not take

#30 landed with four findings registered, because its head was capped after the second push. This is the act that takes them. Each is measured against a full checkout of 5c867137 — never with PYTHONPATH, for the reason docs/runtime.md § 8 now records.

# what origin
1 a linked worktree's metadata was not bound by descriptor, so its index stayed pathname-bound #30 thread on local_git_adapter.py:2124 — ruled by the holder
2 identity.RefusedError was translated nowhere, so a store refusal the act did not pre-empt was a 500 #30 thread on config.py:584
3 the whitespace fallback read a local path as an authority same thread
4 the served-database guard's other two acts had no case #30 thread on cli.py:829

1. A linked worktree is the third shape, and the binding did not reach it

-C /proc/self/fd/<n> binds the working directory, and for the two shapes this act creates that is the repository — a bare repository is its own git directory, a checkout's is .git inside it — so rev-parse --git-dir answers a relative name and the index joins onto the held root. A linked worktree is neither. Measured on git 2.43.0:

linked worktree
<worktree>/.git a file naming an absolute path
rev-parse --git-dir (through -C) <main>/.git/worktrees/<name> — absolute, holds the INDEX, holds neither objects/ nor refs/
rev-parse --path-format=absolute --git-common-dir where objects/ and refs/ actually are

resolve serves that shape writable, with a case landed since § 3.6, so the pathname branch was live for a supported corpus.

Ruled by the holder on #30: bind both directories by descriptor and keep linked worktrees writable — making them read-only would reverse what § 3.6 landed with its own case. metadata_held_open opens the two O_NOFOLLOW and names them GIT_DIR and GIT_COMMON_DIR as /proc/self/fd/<n>, inherited by every call. Measured end to end before it was written: rev-parse, hash-object -w, read-tree, update-index, write-tree, commit-tree and update-ref all behave as they do without them, the commit lands on the worktree's own branch, the main branch is untouched, and the temporary index lands inside the held git directory.

What the case does not do, and why it says so. It does not rename the git directory under a running write: git enumerates worktrees through <common>/worktrees/<name> to decide whether a branch is checked out elsewhere, so re-pointing that name mid-write makes update-ref refuse with cannot lock ref … unable to resolve reference — git's own bookkeeping, through a name no descriptor of ours binds, and nothing to do with this finding. An absence that is measured and written down is not the same as one nobody noticed.

2. A store refusal is a refusal, not a crash — the class, not the instance

repository_act refuses a credential-bearing remote and so does identity.CoordinationStore: layering, not duplication, and the two readings are deliberately not identical. Nothing translated the store's — app.py caught RepositoryActRefused and nothing else — so a value one of them refuses and the other accepts left the route as an unhandled exception, which FastAPI answers 500.

It has happened twice, and both times it was closed one shape at a time: …?mode=1;token=… on #26, where the act accepted what the store refused, and /srv/repos/a:b@c.git, measured a 500 at 5c867137 (the new case reproduces it there as a raw identity.RefusedError). except identity.RefusedError → 409 on the three routes that call an act writing through the store ends the class: a refusal is a refusal, named by shape and never by value.

3. A local path is not an authority

The whitespace fallback #30 added — for user:pa ss@host:path, which both the refusal's class and the redactor's excluded — read the whole head before the last @. So /srv/my repos/a:b@c.git, a directory whose name holds a colon and an at-sign and a perfectly legal git push destination, was refused by the store and replaced with <redacted-url> by the printer.

Git's own rule is the test, and it is about the first colon: the [user@]host:path form is recognised only when nothing before that colon is a /. It separates the two cases exactly, which is why it is this rule and not "a head holding any slash":

value before the first : verdict
ci:hun/ter2@github.com:o/r.git ci an authority — #25's password-containing-a-slash hole stays closed
/srv/my repos/a:b@c.git a path a local path, not judged

Both halves of the pair take it, because both made the same misreading.

4. The database guard's other two acts are measured

refuse_a_database_the_api_will_not_read is called from apply(), from runtime migrate --plan and from runtime reset, and only apply() had a case — "one line each and visible in the diff" is not a measurement. The new case is the schema guard's twin: a real schema with a coordination table in it, a migration DSN that reaches this database, a declaration naming another, both verbs refusing with the table still there, and both going through once the declaration agrees.

It passes against 5c867137, and the docstring says so rather than letting it read as a regression test: it pins wiring that was untested, and it earns its place by what it catches later — which is exactly how the schema guard came to be missing from two of its three acts.

5. And the regression this PR's own item 1 introduced, closed here

write_back declares exactly two kinds — CORPUS_READ_ONLY and WRITE_PATH_UNREACHABLE — and a caller may branch on err.refusal.kind; the module has been repaired for this before (round 13's _repository_root, which refused with a kind this operation does not declare). Entering metadata_held_open at the with statement put its work outside _write_back_bound's handler, and one of those calls had been inside it: the rev-parse --git-dir that used to be a single line computing named_git_dir. Measured at 97a1b37e with the real adapter, both raw:

what fails what escaped write_back
open_no_follow_chain on the worktree's git directory FileNotFoundError
rev-parse --git-dir — the probe itself GitCommandFailed

The second row is the wider half and the review did not reach it: that probe runs for every shape, so an ordinary bare repository or checkout could leak it too — this branch regressed the promise on the common path, which is the same class item 2 above closes at the API boundary.

The translation belongs to the helper, because the helper owns both the probes and the opens: it catches GitCommandFailed, OSError and RuntimeError (a symlink loop raises the last, which is why the root probe catches it), closes any descriptor it had already taken, and refuses with WRITE_PATH_UNREACHABLE naming the failure class and not git's stderr. One case drives both rows, the probe row on an ordinary repository, and it fails against 97a1b37e with the raw GitCommandFailed.

Measured (python 3.12.3, pytest 8.4.2, postgres 16.15, git 2.43.0)

Every figure was measured at acbb6d46 — this branch with origin/main merged in (openDox-code#31, § 3.7's conformance factory; no rebase) — with the runtime extra made UNIMPORTABLE and no ambient git configuration, and holds at the current head f8678ad, which adds only the workflow's record of it and the triple's floors. This description is edited in the same act as that record.

run result
the required validate job's own invocation (--noconftest, the six hermetic modules) 360 passed, 1 skipped
of which tests_runtime/test_local_git_adapter.py 138 passed
python -m pytest -q tests_runtime/ with OPENDOX_TEST_DATABASE_URL set 573 passed
python -m pyflakes src/opendox/runtime/*.py tests_runtime/*.py clean
the required job's triple (tests/ 725+2 skipped, S7 residue 13, hermetic six 361+1 skipped) selected 1099, passed 1096, skipped 3

The triple's floors move up with the cases that raised them — MIN_SELECTED 1096 → 1098 → 1099, MIN_PASSED 1093 → 1095 → 1096, EXPECT_SKIPPED unchanged at 3 because no file turned into skips. Clause (d)'s floors are a ratchet: an act that adds cases raises them, so a number that later goes down is what they exist to catch.

And they were measured on the merged tree, not derived from it. This branch had moved them once already, to 1087/1084, measured before any of #31's tests existed; the merge discarded that side and took main's 1096/1093, and then the floors were moved again from a real run of the three invocations. 1096 + 2 = 1098 is a check on the reading — the rule #31 wrote into that block when it moved the floors three times — and not its source.

Three of the four new cases fail at 5c867137 — 'GitRunner' object has no attribute 'held_environment', /srv/my repos/a:b@c.git refused as an authority, and the raw identity.RefusedError that is the 500. The fourth is the coverage case above, which passes there by design.

Sequencing

openDox-code#31 (§ 3.7, the conformance factory) landed first (93ccc3dd), and this branch took it by merge (d6cb2621), never by rebase. The one conflict was the triple's floors and it is resolved to main's side, because #31 had re-pinned them three times as it measured and those are the true floors at 93ccc3dd; this branch's own move was then re-made from a run over the merged tree. Nothing else in that file collided: #31 added a line to the first list, and this branch's hunks are the figure block and the floors.

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

🤖 Generated with Claude Code

Summary by Sourcery

Harden repository writes and refusal handling for linked worktrees, local paths, and database command safeguards.

New Features:

  • Bind linked worktree metadata through inherited descriptors so writable operations keep the index, objects, and refs tied to the intended repository.
  • Translate coordination-store refusals into HTTP 409 responses across repository mutation endpoints.
  • Extend migration and reset coverage to verify served-database safeguards across all supported commands.

Bug Fixes:

  • Treat local paths containing colons and at-signs as paths rather than credential-bearing authorities.
  • Normalize metadata probe and open failures into the write-back operation's declared refusal kind instead of leaking raw exceptions.

Enhancements:

  • Preserve descriptor-bound Git environments throughout repository write operations and ensure temporary index cleanup failures are reported consistently.

CI:

  • Update validation test-count floors and recorded measurements for the expanded hermetic and runtime test suites.

Tests:

  • Add regression coverage for linked worktree writes, refusal responses, local-path parsing, metadata failure translation, and migration/reset database guards.

brettheap and others added 2 commits September 19, 2026 00:57
Follow-up #2 to openDox-code#30, which registered these four and took none of
them: the holder ruled the first, and the other three come from that PR's own
review threads. Every measurement is against a full checkout of `5c867137`.

1. A LINKED WORKTREE IS THE THIRD SHAPE, AND THE BINDING DID NOT REACH IT.
   `-C /proc/self/fd/<n>` binds the working directory, and for the two shapes
   this act creates that IS the repository — a bare repository is its own git
   directory, a checkout's is `.git` inside it — so `rev-parse --git-dir`
   answers a relative name and the index joins onto the held root. A linked
   worktree is neither: measured on git 2.43.0, `<worktree>/.git` is a FILE
   naming an absolute path, `--git-dir` answers `<main>/.git/worktrees/<name>`
   (which holds the INDEX and neither `objects/` nor `refs/`), and those live
   in the COMMON directory. `resolve` serves that shape WRITABLE, with a case
   landed since § 3.6, so the pathname branch was live for a supported corpus.
   RULED: bind both directories by descriptor and keep linked worktrees
   writable — taking the write away reverses what § 3.6 landed with its own
   case. `metadata_held_open` opens the two `O_NOFOLLOW` and names them
   `GIT_DIR` and `GIT_COMMON_DIR` as `/proc/self/fd/<n>`, inherited by every
   call; MEASURED end to end, the whole write sequence behaves as it does
   without them, the commit lands on the worktree's own branch and the main
   branch is untouched.
   What the case does NOT do is rename the git directory under a running write,
   and that is recorded rather than left as an absence: git enumerates
   worktrees through `<common>/worktrees/<name>` to decide whether a branch is
   checked out elsewhere, so re-pointing that name mid-write makes `update-ref`
   refuse — git's own bookkeeping, through a name no descriptor of ours binds.
   The binding property is asserted where it lives: on the descriptors.

2. A STORE REFUSAL IS A REFUSAL, NOT A CRASH. `repository_act` refuses a
   credential-bearing remote and so does `identity.CoordinationStore` —
   layering, and the two readings are deliberately not identical. Nothing
   translated the store's: `app.py` caught `RepositoryActRefused` and nothing
   else, so a value ONE refuses and the other accepts left the route as an
   unhandled exception, which FastAPI answers 500. It has happened twice, and
   both times it was closed one shape at a time — `…?mode=1;token=…` on
   openDox-code#26, and `/srv/repos/a:b@c.git`, MEASURED a 500 at `5c867137`.
   `except identity.RefusedError` on the three routes that call an act writing
   through the store closes the class instead of the instance.

3. A LOCAL PATH IS NOT AN AUTHORITY. The whitespace fallback #30 added — for
   `user:pa ss@host:path`, which both classes excluded — read the whole head
   before the last `@`, so `/srv/my repos/a:b@c.git`, a directory whose name
   holds a colon and an at-sign and a legal `git push` destination, was refused
   by the store AND replaced with `<redacted-url>` by the printer. GIT'S OWN
   RULE is the test and it is about the FIRST colon: the `[user@]host:path`
   form is recognised only when nothing before it is a `/`. That separates the
   two cases exactly, which is why it is this rule and not "a head holding any
   slash" — `ci:hun/ter2@github.com:o/r.git` is openDox-code#25's password
   containing a slash, and `ci` is what precedes its first colon. Both halves
   of the pair take it, because both made the same misreading.

4. THE DATABASE GUARD'S OTHER TWO ACTS ARE MEASURED. `refuse_a_database_the_
   api_will_not_read` is called from `apply()`, from `migrate --plan` and from
   `reset`, and only `apply()` had a case — "one line each and visible in the
   diff" is not a measurement. The new case is the schema guard's twin, and it
   PASSES against `5c867137`: it pins wiring that was untested, and it earns
   its place by what it catches later, which is exactly how the schema guard
   came to be missing from two of its three acts.

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

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…t raised it

`f8cb7a90` is the commit that was measured: 359 passed 1 skipped on the
required job's own six modules with the runtime extra unimportable, and 572 on
`pytest -q tests_runtime/` with a database. The PR description states the same
two numbers at the same commit, in this act.

AND THE TRIPLE MOVES UP, because this branch adds to it. Measured at
`f8cb7a90` across the required job's three reports — `tests/` 714 selected 2
skipped, the S7 residue 13, `tests_runtime/`'s hermetic six 360 selected 1
skipped — the triple is selected 1087, passed 1084, skipped 3. The floors go to
1087 and 1084; `EXPECT_SKIPPED` does not move, because no file turned into
skips. Clause (d)'s floors are a RATCHET: an act that adds cases raises them,
and an act that merely finds them low leaves them alone, so a number that later
goes down is what it was always meant to be — a test that stopped being
collected.

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

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings September 19, 2026 00:59
@sourcery-ai

sourcery-ai Bot commented Sep 19, 2026

Copy link
Copy Markdown

Reviewer's Guide

The PR closes four follow-up findings by descriptor-binding linked worktree metadata during writes, translating store refusals to HTTP 409 responses, distinguishing local paths from credential-bearing authorities using Git’s first-colon rule, and adding migration/reset guard coverage; validation floors and records are updated to reflect the expanded test suite.

Sequence diagram for descriptor-bound linked worktree writes

sequenceDiagram
    participant Writer
    participant GitRunner
    participant Metadata as metadata_held_open
    participant Git
    participant Worktree

    Writer->>Metadata: metadata_held_open(git)
    Metadata->>Git: rev-parse --git-dir
    Metadata->>Git: rev-parse --path-format=absolute --git-common-dir
    Metadata->>Metadata: open_no_follow_chain(git_dir)
    Metadata->>Metadata: open_no_follow_chain(common_dir)
    Metadata-->>GitRunner: GitRunner with GIT_DIR and GIT_COMMON_DIR
    Writer->>Git: hash-object -w
    Writer->>Git: read-tree / update-index / write-tree
    Writer->>Git: commit-tree
    Writer->>Git: update-ref
    Git-->>Worktree: Commit worktree branch
    Git-->>Worktree: Keep main branch untouched
Loading

Sequence diagram for translating store refusals to HTTP 409

sequenceDiagram
    actor Client
    participant API
    participant Act as repository_act
    participant Store as CoordinationStore

    Client->>API: create, attach, or push repository
    API->>Act: repository operation
    Act->>Store: write through store
    Store-->>Act: identity.RefusedError
    Act-->>API: identity.RefusedError
    API-->>Client: HTTP 409 repository.refused
Loading

Sequence diagram for migration and reset database guard coverage

sequenceDiagram
    participant Operator
    participant CLI
    participant Guard as refuse_a_database_the_api_will_not_read
    participant Database

    Operator->>CLI: runtime migrate --plan or runtime reset
    CLI->>Guard: refuse_a_database_the_api_will_not_read
    Guard->>Database: Check coordination table
    alt Database declaration disagrees
        Guard-->>CLI: Refusal
        CLI-->>Operator: Refuse operation
    else Declaration agrees
        Guard-->>CLI: Allow operation
        CLI->>Database: Execute migration or reset
    end
Loading

Flow diagram for authority versus local-path detection

flowchart TD
    Input[Remote value with whitespace before last @] --> Head[Extract text before last @]
    Head --> Colon{Head contains a colon?}
    Colon -->|No| Local[Do not classify as authority]
    Colon -->|Yes| FirstColon[Inspect text before first colon]
    FirstColon --> Slash{Contains /?}
    Slash -->|Yes| Local
    Slash -->|No| Authority[Classify as credential-bearing authority]
Loading

File-Level Changes

Change Details Files
Bind linked worktree metadata through inherited directory descriptors throughout write operations.
  • Detect absolute linked-worktree git metadata and open both git and common directories with no-follow semantics.
  • Propagate GIT_DIR/GIT_COMMON_DIR via /proc/self/fd and keep temporary indexes, object writes, commits, and ref updates descriptor-bound.
  • Add an end-to-end linked-worktree write and descriptor-repointing regression test.
src/opendox/runtime/local_git_adapter.py
tests_runtime/test_local_git_adapter.py
Translate store-level repository refusals into consistent HTTP conflicts.
  • Handle identity.RefusedError alongside act-level refusals on repository creation, remote attachment, and push routes.
  • Verify refused remotes return sanitized 409 responses rather than 500 errors.
src/opendox/runtime/app.py
tests_runtime/test_api_endpoints.py
Align whitespace-based remote authority detection with Git's scp-like parsing rule.
  • Classify a value as an authority only when no slash precedes its first colon.
  • Apply the same rule to refusal detection and URL redaction while preserving password-with-slash protection.
  • Add coverage for local paths containing spaces, colons, and at-signs.
src/opendox/runtime/config.py
src/opendox/runtime/local_git_adapter.py
tests_runtime/test_local_git_adapter.py
Add coverage for served-database guards in migration planning and reset flows.
  • Exercise refusal when the migration database differs from the served declaration and verify reset preserves schema contents.
  • Verify both commands proceed when the declaration matches.
tests_runtime/test_migrations_apply.py
Update validation records and ratcheted test-count floors for the expanded runtime coverage.
  • Record measured hermetic and database-backed test results.
  • Raise selected and passed minimum floors to match the new cases.
.github/workflows/validate.yml

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

🔵 Needs a closer look

Metadata acquisition errors can escape without the declared refusal translation.

Review effort: Lite
Findings: None

What changed in this PR

Hardens linked-worktree writes, refusal handling, remote URL validation, and migration safety checks.

Changes:

  • Binds linked-worktree metadata through descriptors.
  • Converts store refusals to HTTP 409 responses.
  • Adds regression coverage and updates CI test floors.
File Description
tests_runtime/​test_migrations_apply.py Migration/reset guard coverage
tests_runtime/​test_local_git_adapter.py Worktree and URL regression tests
tests_runtime/​test_api_endpoints.py Refusal response coverage
src/​opendox/​runtime/​local_git_adapter.py Descriptor-bound writes and URL classification
src/​opendox/​runtime/​config.py Local-path-aware authority detection
src/​opendox/​runtime/​app.py Store refusal translation
.github/​workflows/​validate.yml Updated validation floors

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

brettheap and others added 2 commits September 19, 2026 01:13
… build/3-7-followup-2-worktree-and-refusals

ONE CONFLICT, in the triple's floors, and it is resolved to MAIN'S SIDE: #31
re-pinned them three times as it measured — 1084/1081, then 1090 over the
merged #30 (closing a nine-test slack #30 had left), then 1093 for its own
hardening cases and the `init.templateDir` one — and those are the true floors
at `93ccc3dd`. This branch's own move, which was measured before any of #31's
tests existed, is DISCARDED here and re-measured on the merged tree in the next
commit. A floor is a measurement, not an arithmetic.

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

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`d6cb2621` — this branch with openDox-code#31 merged in — is the tree that was
measured, by running the three invocations the required job runs and summing
their JUnit reports:

    tests/ (29 files, #31's conformance corpus among them)   725 selected, 2 skipped
    the S7 residue                                            13 selected
    the hermetic six                                         360 selected, 1 skipped
    ------------------------------------------------------------------------
    TRIPLE                              selected 1098, passed 1095, skipped 3

So `MIN_SELECTED` goes 1096 -> 1098 and `MIN_PASSED` 1093 -> 1095. The two are
this branch's own hermetic cases; its other two are in the DB-backed job, which
this triple does not count. `EXPECT_SKIPPED` does not move: no file turned into
skips, which is the thing that number exists to catch.

1096 + 2 = 1098 is a CHECK on the reading, not its source — the rule #31 wrote
into this block when it moved the floors three times, and the reason the merge
commit discarded this branch's earlier floors rather than adding to them: they
were measured before any of #31's tests existed.

The hermetic figure is re-stated at this head for the same reason. It did not
move — 359 passed, 1 skipped — but the TREE did, and a figure that was not
taken on the tree it is stated for is a figure nobody measured.

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

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings September 19, 2026 01:17
@brettheap
brettheap marked this pull request as ready for review September 19, 2026 01:17

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

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

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

Address the metadata-open error translation and preserve hermetic test-fixture setup.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Medium severity

Open (1)

brettheap and others added 2 commits September 19, 2026 01:26
… be held

MY OWN REGRESSION, from the commit that bound a linked worktree's metadata, and
the review at `97a1b37e` found it. `write_back` declares exactly two kinds —
`CORPUS_READ_ONLY` and `WRITE_PATH_UNREACHABLE` — and a caller may branch on
`err.refusal.kind`. Entering `metadata_held_open` at the `with` statement put
its work OUTSIDE `_write_back_bound`'s handler, and one of those calls had been
INSIDE it: the `rev-parse --git-dir` that used to be a single line computing
`named_git_dir`. MEASURED at `97a1b37e` with the real adapter, both raw:

    open_no_follow_chain fails on the worktree's gitdir  ->  FileNotFoundError
    rev-parse --git-dir fails                            ->  GitCommandFailed

The second is the wider half and the review did not reach it: that probe runs
for EVERY shape, so an ordinary bare repository or checkout could leak it too —
this branch regressed the promise on the common path, which is the same class
its own item 2 closes at the API boundary.

THE TRANSLATION BELONGS TO THE HELPER, because the helper owns both the probes
and the opens: it catches `GitCommandFailed`, `OSError` and `RuntimeError`
(`Path.resolve`'s symlink loop raises the last, which is why the root probe
catches it too), closes any descriptor it had already taken, and refuses with
`WRITE_PATH_UNREACHABLE` naming the failure CLASS and not git's stderr — a
refusal that quotes a message writes it into whatever reports the refusal. The
subject comes from the caller, so the refusal names the write path the caller
asked about.

One case, both rows, and the probe row is driven on an ORDINARY repository
because that is where the wider half lived. It fails against `97a1b37e` with
the raw `GitCommandFailed` this commit removes.

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

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`acbb6d46` is the commit that was measured: 360 passed 1 skipped on the
required job's own six modules with the runtime extra unimportable, and 573 on
`pytest -q tests_runtime/` with a database. The PR description states the same
two numbers at the same commit, in this act.

The triple was re-run the same way over the same head — `tests/` 723 passed 2
skipped, the S7 residue 13, the hermetic six 360 passed 1 skipped — giving
selected 1099, passed 1096, skipped 3, so the floors go to 1099 and 1096. One
case added, one floor step; `EXPECT_SKIPPED` does not move.

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

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings September 19, 2026 01:26
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
3.1% 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

🟢 Approval recommended

All reviewed changes are covered and no unresolved blocking issues were identified.

Review effort: Lite
Findings: None

Resolved since last review (1)

@brettheap
brettheap merged commit d816cf0 into main Sep 19, 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-09-19T01:30:33Z, PR #32 → d816cf0 (opensoft/openDox-code main; plain gate)

§ 3.6 follow-up #2: linked-worktree metadata bound by descriptor (own gitdir + --git-common-dir, worktrees writable; RULED 5736683962), identity.RefusedError → 409 on create/attach/push, git's first-colon rule in refusal and printer, migrate --plan/reset mismatched-database cases; the regression item 1 introduced (raw exceptions escaping write_back) closed with WRITE_PATH_UNREACHABLE; triple 1099/1096/3 pinned

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