Repository navigation
§ 3.6 follow-ups: the seven findings #26 registered, each with its case - #30
Conversation
… its case openDox-code#26 landed with seven findings REGISTERED rather than taken, because its batches had a scope somebody set. This is the act that takes them. Each is measured against a full checkout of `4f8ae01e` — never by pointing `PYTHONPATH` at an old tree, which pytest's `pythonpath = ["src"]` silently defeats (that trap is now written down in `docs/runtime.md` § 8). 1. THE SERVED DATABASE HAS A NON-SECRET DECLARATION (ruled item 4, from A25-3's half-closed finding). A25-3 established that the configuration-time comparison of the two DSNs can never fire in a shipped deployment, because the Deployment holds the served DSN and the migration Job holds the migration one and no workload holds both — so the migration container must be TOLD where the API reads. It was told the SCHEMA and not the DATABASE, which is the wider question: a schema comparison made in the wrong database compares two names that happen to agree, and `dbname` may be omitted entirely, in which case libpq defaults it to the connection USER. So a mispointed migration DSN applied DDL — and `runtime reset` DROPPED the six coordination tables — in a database the API never reads, with nothing in the shipped shape able to notice. `OPENDOX_SERVED_DATABASE` is a NAME and never a credential; `refuse_a_database_the_api_will_not_read` compares it with `current_database()` BEFORE the ledger is bootstrapped, and before the schema guard, in all three acts (`apply`, `migrate --plan`, `reset`). Four manifest edits carry it: the configmap literal, the Job's env, compose's migrate service and `.env.example`. 2. S8544 — EVERY INSTALL OF THIS PACKAGE READS ONE DEPENDENCY LOCK. `pyproject.toml` declares what this package needs and deliberately does not pin it; the other half was missing, so the required job, the DB-backed job and the image resolved whatever the index offered on the day they ran — the same commit tested twice is two different programs. `constraints-cpython312- linux.txt` is the resolved set, MEASURED in a clean venv rather than written by hand, and passed with `-c` in all three places. A constraints file, so the required job still installs `.[test]` ALONE. At the repository ROOT deliberately: `deploy/` holds the git-ignored `.env` that `.dockerignore` exists to keep out of the build context, and a lock living there would have meant a `!deploy…` re-inclusion. 3. `_found` AROUND THE ACT, NOT ONLY THE PRE-CHECK. Both repository routes read the map row through `_found` and then called the act, which takes the row FOR UPDATE inside itself; a row deleted between those two statements raised `identity.NotFoundError` past a handler that catches only `RepositoryActRefused` — measured at `4f8ae01e` as an uncaught exception, which is a 500 where this API documents 404. Same class as #25's round 10 on the draft-discard path, same repair. 4. A PARAMETER NAME IS JUDGED BY ITS WORDS AND ITS DECLARED COMPOUNDS. Making every needle of six characters or more a SUBSTRING bought `sslpassword` at the price of every other compound of those words: `passwordless` and `secretary` were refused as credential-bearing (measured). A false refusal at a CONFIGURATION boundary is not a safe direction — it is an install that will not start for a reason that is not true — so the one compound this runtime meets is DECLARED. `credentials_version` stays refused on purpose: `credentials` is one of its words, and that same reading is what catches `access_token`, `X-Api-Key` and `sessionToken`. 5. THE TEMPORARY INDEX IS WRITTEN THROUGH THE HELD DESCRIPTOR. Every other call in `write_back` goes through `-C /proc/self/fd/<n>`, which is what makes "the check and the use are one object" true; `GIT_INDEX_FILE` was built from `rev-parse --absolute-git-dir`, a PATHNAME. MEASURED on git 2.43.0 with the directory renamed away and a symlink to a second repository put in its place after the probe: the absolute form wrote `opendox-index-…` into the DECOY and the descriptor-relative form wrote it into the real repository. `--git-dir` asked through `-C` answers RELATIVE (`.` bare, `.git` checkout, measured), so joining it onto the runner's root keeps the whole path inside the descriptor. 6. THE STORE NAMES AN AUTHORITY IT CANNOT READ. `_scp_like_userinfo` declines a head holding whitespace so the rule cannot start judging prose, and the redactor's class excludes it so an unrelated `user@host` down git's stderr is not joined to the URL above it — and `user:pa ss@host:path` fell between them, refused in its URL form and accepted in its scp form. #26 closed the printing half; this closes the store's own guard, by SHAPE and never by value. Nothing ordinary is caught: a head without `:` is a username, a value without `@` has no authority, and `/srv/a@b/my repos/x.git` is neither. 7. THE REPOSITORY ROOT IS CREATED 0700 — measured first, as ruled. Every repository under it is `REPOSITORY_DIRECTORY_MODE`; the root above them took `Path.mkdir`'s default, `0o777 & ~umask`, so MEASURED under the container's umask (0o022) `runtime init` left it 0755 and under umask 0 it left it 0777 — every project id listable and traversable by any local account. 0700 is umask-safe, because a umask can only remove bits. An EXISTING root is reported and not re-moded, on the walk's own rule that it narrows only what it made itself; the mode is in `init`'s evidence so an operator upgrading sees it. Three existing cases moved with the code and say why in place: the required job's install guard reads the `.[…]` EXTRAS now rather than searching the whole command line for the word `runtime` (the lock's filename contains it); the Dockerfile's install assertions read the parts rather than one exact line; and the redactor/refusal corpus records that one of its two "hidden but not refused" shapes is now refused, leaving only the double-encoded parameter name — which stays a deliberate difference, because a server decodes a name once. Lane: openxfactory-4 (openXfactory-4-openDox_extraction) Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`6d2b0861` is the commit that was measured: 355 passed 1 skipped on the required job's own six modules with the runtime extra unimportable, and 566 on `pytest -q tests_runtime/` with a database. The PR description is written with the same two numbers at the same commit, in this act — the ordering the review at `0a2af8b8` asked for on the sibling PR, where the description lagged the workflow block by one commit. Lane: openxfactory-4 (openXfactory-4-openDox_extraction) Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Sorry @brettheap, you've used your own review budget of 250,000 diff characters for the last 7 days.
You can request another review in 4 days and 8 hours by commenting @sourcery-ai review. Upgrade to get a review now.
Reviewer's GuideThis PR implements the seven registered §3.6 follow-ups: it adds served-database refusal checks, locks all dependency installs, fixes repository-action race/error handling, narrows credential detection while covering unreadable authorities, hardens repository-root permissions, and documents reliable older-head regression measurements. It also adds or updates focused deployment, migration, API, Git, redaction, and CLI tests for each behavior. Sequence diagram for served-database migration refusalsequenceDiagram
participant CLI
participant MigrationRunner
participant PostgreSQL
CLI->>MigrationRunner: apply()
MigrationRunner->>PostgreSQL: selected_database()
PostgreSQL-->>MigrationRunner: current_database()
alt database differs from served_database
MigrationRunner-->>CLI: MigrationError
else database matches
MigrationRunner->>MigrationRunner: refuse_a_schema_the_api_will_not_read()
MigrationRunner->>PostgreSQL: bootstrap_ledger()
MigrationRunner-->>CLI: migrations applied
end
Sequence diagram for descriptor-bound repository write-backsequenceDiagram
participant WriteBack
participant Git
participant Repository
participant Decoy
WriteBack->>Git: rev-parse --git-dir
Git-->>WriteBack: relative git directory
WriteBack->>WriteBack: build path under git.root
WriteBack->>Repository: read-tree and update-index via held descriptor
WriteBack->>Repository: write-tree
Repository-->>WriteBack: commit created
Decoy-->>WriteBack: no temporary index written
Flow diagram for credential-name and authority refusalflowchart TD
A[Remote URL or parameter name] --> B{Parameter contains a secret word?}
B -->|yes| C[Refuse credential-bearing parameter]
B -->|no| D{Declared compound sslpassword?}
D -->|yes| C
D -->|no| E{Authority has whitespace-bearing userinfo?}
E -->|yes| C
E -->|no| F[Accept value]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Critical database declaration gaps and the linked-worktree index fallback remain unresolved.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 3
Open (4)
What changed in this PR
This PR addresses seven runtime, deployment, dependency, credential-handling, and repository-safety follow-ups.
Changes:
- Adds served-database guards and deployment configuration.
- Adds shared dependency constraints for CI and Docker.
- Hardens repository writes, initialization, credential handling, and regression coverage.
| File | Reviewed changes |
|---|---|
tests_runtime/test_runtime_cli.py |
Tests database wiring and repository-root permissions. |
tests_runtime/test_migrations_apply.py |
Tests served-database validation. |
tests_runtime/test_local_git_adapter.py |
Tests Git index handling and credential cases. |
tests_runtime/test_deploy_shape.py |
Tests constrained installs and deployment configuration. |
tests_runtime/test_api_endpoints.py |
Tests disappearing repository rows returning 404. |
src/opendox/runtime/migrations.py |
Adds database-target validation; nit (1 vote): reset wording should identify the selected database. |
src/opendox/runtime/local_git_adapter.py |
Uses descriptor-relative indexes; critical (3 votes): the linked-worktree absolute-path fallback remains unsafe. |
src/opendox/runtime/config.py |
Adds database and credential rules; moderate (1 vote): whitespace-bearing scp authorities can produce a 500. |
src/opendox/runtime/cli.py |
Adds root-permission handling; moderate (1 vote): the pre-created image root can bypass the 0700 invariant. |
src/opendox/runtime/app.py |
Translates act-time missing rows to 404 responses. |
docs/runtime.md |
Documents older-head regression testing; nit (2 votes): create the extraction directory first. |
deploy/kubernetes/base/migration-job.yaml |
Passes the served database to the migration job. |
deploy/kubernetes/base/kustomization.yaml |
Adds database configuration; critical (1 vote): empty defaults leave the guard disabled. |
deploy/compose/Dockerfile |
Applies constrained dependency installation and creates the project directory. |
deploy/compose/docker-compose.yaml |
Propagates the served database; critical (2 votes): its default does not match the bundled database. |
deploy/compose/.env.example |
Documents the served-database setting. |
constraints-cpython312-linux.txt |
Records resolved dependency constraints. |
.github/workflows/validate.yml |
Applies dependency constraints; nit (1 vote): an install-contract comment is stale. |
.dockerignore |
Includes the constraints file in Docker builds. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Review at
|
…th at 2104
Four of the review's findings at `4df3701c`, each measured in the file it names.
The first two are the same defect in two deployments: a declaration that
defaults to EMPTY beside a server that CREATES a named database.
COMPOSE. `postgres` is `POSTGRES_DB: ${OPENDOX_PG_DB:-opendox}` and the
migration container was told `${OPENDOX_PG_DB:-}`, so an operator who sets
nothing — the first run everybody makes — got a server holding `opendox` and a
container told nothing at all. `_served_database()` turns that into `None` and
the guard is a no-op in exactly the shape it was added for. One expression for
both now, defaults included, so they cannot come apart.
KUBERNETES. `pg_database=` was empty in the base and set by NEITHER overlay
(measured: `dev` merges only `opendox-oidc`; `managed-database` merges
`migration_wait_host` and a commented `runtime_pg_role`) — so the guard was off
in every shipped shape. The base declares `opendox`, which is what its own
`postgres-statefulset` hardcodes, and the managed-database overlay — which
DELETES that StatefulSet — now carries the commented edit beside the one it
already carries for `runtime_pg_role`. Leaving it wrong there is a REFUSAL and
not a silent wrong-database migration, which is the direction this declaration
exists to choose. `pg_schema` stays empty for the opposite reason: `public` is
PostgreSQL's default rather than a name this repository chose.
THE IMAGE'S REPOSITORY ROOT. `runtime init` narrows the root it CREATES, and in
the shipped image it creates nothing: the Dockerfile makes
`/var/lib/opendox/projects` in its own layer, so by the time `init` runs the
root is already there and this runtime does not re-mode a directory it did not
make. `mkdir -p` takes `0o777 & ~umask` — 0755 for a `RUN` layer — so the
directory holding every project's bare repository shipped world-readable and
traversable while each repository under it is 0700. `install -d -m 0700` states
the mode itself, so no umask applies, and the layer that OWNS the directory is
the one that makes it.
THE RUNBOOK STEP RUNS AS WRITTEN. `tar -x -C /tmp/oldhead` does not create its
destination, and the paragraph dropped the `mkdir` my own runs used. A step that
fails on its first command teaches that the section is decorative.
AND THE COMMENT AT `local_git_adapter.py:2104` SAID SOMETHING FALSE. It claimed
an absolute `--git-dir` "cannot arise for a repository this act writes to".
MEASURED false on git 2.43.0: `git -C <worktree> rev-parse --git-dir` answers
the absolute `<main>/.git/worktrees/<name>`, and
`test_a_linked_worktree_can_reach_its_write_path` — landed with § 3.6 — serves
exactly that shape WRITABLE and drives `write_back` through it. So the fallback
branch is live for a supported corpus and its index is still bound to a
pathname. NO BEHAVIOUR CHANGES HERE: the repair is two more held descriptors
(the worktree's own gitdir and `--git-common-dir`, which is where `objects/` and
`refs/` live) and it is RULED a separate act, with read-only linked worktrees
rejected because that reverses what § 3.6 landed with its own case. What this
commit changes is the comment, which now says what is true and what is
scheduled — the one thing a comment owes.
Two cases carry it: the shipped shapes' declarations (compose's two services
compared as one expression, the base's literal against its own StatefulSet, and
the overlay's commented edit) and the image's root mode.
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`4767ceb7` is the commit that was measured: 357 passed 1 skipped on the required job's own six modules with the runtime extra unimportable, and 568 on `pytest -q tests_runtime/` with a database. The PR description is edited to the same commit and the same two numbers in this act. This branch also carries `origin/main` by merge (openDox-code#29's "Pin the triple" step on the required job), never by rebase, and both of this act's hunks in that file stayed where they were: the two `-c` installs and this comment block. Lane: openxfactory-4 (openXfactory-4-openDox_extraction) Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Four unresolved moderate findings remain in dependency locking, service wiring, migration-path coverage, and credential-shape handling.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (3)
Review at
|
| value | credential_in_a_remote_url |
refuse_credential_bearing_remote |
where |
|---|---|---|---|
/srv/repos/a:b@c.git |
"a password in the URL's authority" | ACCEPTED | origin/main already |
/srv/my repos/a:b@c.git |
(main) None → (here) "an authority this runtime cannot read as one word" |
ACCEPTED | widened by this act |
So the shape the review names is real, and the plain one — no whitespace at all — has been on main since § 3.5: the store refuses a value the act accepts, and app.py translates identity.RefusedError nowhere (grep: not one occurrence), so it leaves the route as an unhandled exception. That is a 500 for a legal local-path remote, and it is the same class as #26's ;token= 500, which was closed by making the two readings agree on that one shape rather than by closing the escape.
The repair that ends the class rather than this instance is the boundary one, and it is the shape this PR already used for NotFoundError: except identity.RefusedError → 409 on the three routes that call an act which writes through the store (create, attach, push), so a store refusal can never again arrive as a crash. Restricting the fallback to a genuine scp authority — a head with no / in it — is the narrower half and closes the two rows above; it does not close the class.
Registered, with the boundary repair named, because the cap is on this PR and not on the finding.
2. cli.py:829 — no DB-backed case drives migrate --plan or reset with a mismatched served DATABASE. TRUE.
The wiring is there for all three acts and the case covers apply() — including that the DATABASE is asked before the SCHEMA when both declarations are wrong — but the schema guard has test_reset_and_plan_ask_the_served_schema_declaration_the_run_asks and the database guard has no twin. It is a coverage gap rather than a defect: the two call sites are one line each and are visible in the diff. It goes on the same follow-up as the boundary repair, because a case that drives reset wants the same harness that one built.
Still open from the previous round
Follow-up #1 — write_back's index is still pathname-bound for a linked worktree, measured (--git-dir through -C answers the absolute <main>/.git/worktrees/<name>, and § 3.6's landed case serves that shape writable). Ruled a separate act: bind the worktree's own gitdir and --git-common-dir by descriptor, keep linked worktrees writable. The comment at local_git_adapter.py:2104 no longer claims otherwise.
Closed in this round, per the review's own list
Default OPENDOX_PG_DB to the served database, Enable database guard for all Kubernetes deployment shapes and Create extraction directory before untarring — all three resolved at 4767ceb7, with two cases carrying them.
validate and runtime are green at 58852e1f. The figure block and this description name the same commit, 4767ceb7: 357 passed, 1 skipped hermetic and 568 passed on pytest -q tests_runtime/.
Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
|
Lane: openxfactory-4 (openXfactory-4-openDox_extraction) LANDED — lane openxfactory-4, 2026-09-18T22:12:55Z, PR #30 → 5c86713 (opensoft/openDox-code main; plain gate) § 3.6 follow-ups: the seven findings #26 registered (OPENDOX_SERVED_DATABASE + current_database() guard with manifests incl. compose/k8s defaults, S8544 dependency lock, _found around attach/push, whole-token secret matching, descriptor-bound GIT_INDEX_FILE, whitespace scp authority named, 0700 root incl. the image), each with its case; follow-up #1 linked-worktree descriptor binding (ruled) and follow-up #2 RefusedError→409 boundary + mismatched-database cases registered |
…lack The floors moved twice in this pull request and the second measurement is the one that governs. First: eight tests joined the list with `tests/test_conformance_corpus.py` — run 35400706354, 1076 -> 1084 and 1073 -> 1081. Then #30 landed (merge `5c867137`, 22:12:50Z), this branch merged `origin/main`, and the number moved again — run 35400771494 over the merged head: selected 1093, passed 1090, skipped 3. NINE OF THOSE ARE #30'S, AND IT LEFT THE FLOORS WHERE IT FOUND THEM. Its tests went into files ALREADY in the required job's lists — `tests_runtime/test_deploy_shape.py`, `test_local_git_adapter.py`, `test_runtime_cli.py` — which is the one way to add tests here without touching the list, and therefore the one way to grow the pin's slack without noticing. Main was left with `selected>=1076 (margin 9)`: green, and blind to any regression smaller than nine tests. That is not a criticism of the landing so much as evidence that the procedure needs to be attached to "adding tests" rather than to "editing the list", and the pin's comment now says so where the next reader will be standing. Closed here because this act was re-measuring anyway. A floor with slack in it is a floor that has stopped catching the regression it was set to catch. Neither figure is derived: 1084 + 9 = 1093 is a check on the reading, not its source. EXPECT_SKIPPED stays 3 across all three runs. Lane: openxfactory-4 (openXfactory-4-openDox_extraction) Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…d Q-F1's transposition (#31) Lane: openxfactory-4 (openXfactory-4-openDox_extraction) CLAIM [`5736795055`](opensoft/openXfactory#656 (comment)) — `split-opendox-two-layer-product` § 3.7 FLOOR PART 3, the **openDox side**. The other two sides are landed: openxFactory's half of RULED Q-F1 (a) (`#1086` → `049d54a9`) and openXdox's reader (`openXdox-code` #23 → `3ee8cd31`). # § 3.7 FLOOR PART 3 — openDox's conformance reader The box asks for one thing and names two parts of it. Its own words: > **§ 3.7 also owes a DECLARED factory and Q-F1's transposition** — `tasks.md:1392-1394` > a reader that exists **is not a pass recorded**. The exit line — the three-argument command returning `OK — 17 of 17` … is owed — `tasks.md:1489-1493` > **Q-F1 (a)** — how FLOOR PART 3 runs against a GIT-HISTORY reader: **the DESTINATION transposes the corpus into git and says so** (`conformance_corpus.transpose()`, run with `--corpus <transposition>`), documents, keys and bytes unchanged — `tasks.md:1357-1361` So this PR is a factory, a transposition, and a recorded pass — **not a CI step**. openDox's implementation already existed (`LocalGitCorpus`, landed by #26 with Q-F2's three construction data on `__init__`); what was missing was the module that points it at somebody else's corpus. The ledger's reading of this side was blunt and correct: *"openDox — NOT EVIDENCED, and unlike openXdox this one has NOT moved: `openDox-code` carries no conformance reader at all"* (`:1516-1519`). ## The pass, measured openxFactory's runner at `eb1880cb`, against this tree and a transposition built by this module: ``` $ python3 scripts/verify-carve-conformance.py \ --destination opendox_code \ --dest-root <this checkout> \ --adapter opendox.conformance_corpus:reader \ --corpus <the transposition> OK …: opendox_code passed the neutral conformance corpus — 17 of 17 check(s), reader opendox.conformance_corpus:reader, corpus …, TRANSPOSED and FAITHFUL to …/tests/corpus-adapter/fixtures — 3 document(s) at revision 91c6319e…, key/sha256 table 744c9183…, unmoved across the run EXIT=0 ``` `TRANSPOSED and FAITHFUL` is the half that cannot be faked: the runner computes `{key: sha256(bytes)}` off openxFactory's **files** and compares it against what **this reader serves**, so a transposition that dropped, added, renamed or re-encoded a document refuses `conformance-corpus-unfaithful` instead of passing. ## What the module is 152 lines, two functions. | | | | --- | --- | | `reader(name, location)` | the declared factory. **Neither argument is used**, and that is the property being measured rather than an oversight: one reader built from the corpus's terms alone is pointed at all four of the corpus's states in a single run, which the three resolution-time negative confirmations require. | | `transpose(shipped, dst)` | Q-F1 (a)'s permission, taken with its proof — the same documents laid into git, bytes and keys unchanged. | **`write_path=None` is load-bearing**, and is the one place this could have quietly failed. `LocalGitCorpus` declares *openDox's* governed write path; the corpus's `read-only-declared-at-resolution` check asserts that resolution reports **none**, and has a name for a reader that brings one anyway: *"a reader is inventing one"*. `kind_field` / `required_fields` are the corpus's own two-field header (`Type`, `Title`) — a corpus that "has never heard of a factory", in the words of its own first document — so they are values here, never defaults inherited from openDox. **All four states are built**, because the seventeen checks resolve four locations and three of them are negative confirmations: - `neutral` — a git repository holding **exactly** the shipped files - `empty` — a repository committed with `--allow-empty` and **no tracked path**; a `.gitkeep` would be listed by `ls-tree -r` and the empty corpus would hold a document - `not-a-directory` — a file - the absent state — built by **not creating it**, which is the only honest way to build it ## The tests, and what they deliberately do not do 8 tests, added to the required job's named list. **They prove the property the runner checks, not the run**: the runner needs openxFactory's checkout and its fixtures, which this leg does not have and must not acquire to satisfy a test. So they reproduce the runner's own asymmetric comparison — a `{key: sha256}` table off the **files** against what the **reader** serves — over a corpus built in a tmpdir with the shipped one's shape, plus: the transposition adds no key of its own; the empty state answers rather than refuses; both refusal states refuse with the right kind. Bytes are compared as `Document.content` **bytes**, never decoded — a transposition that re-encoded a document would round-trip through `str` and compare equal while the bytes on disk had changed. ## Honest size: M The factory is small (openXdox's analogue is 94 lines) because the adapter already exists here. `transpose()` is the part openXdox never needed, and the faithfulness proof is unforgiving about keys, so it is a medium change rather than a small one. ## The pin The required job's collection triple is pinned by this lane's #29 → `373b05aa`. Adding a test file moves it, so the floors are **re-measured from this PR's own CI run and raised with the reason in the same commit** — `pytest-suite.yml`'s own procedure, and the mechanism its comment names: what moves these numbers here is editing the explicit list, and nothing else. ## Coordination **#30 @`58852e1f`** is open on this repository and overlaps two files (`validate.yml`, `local_git_adapter.py`). Different subject, different claim; named before authoring rather than discovered at a conflict. If it lands first this branch takes `git merge origin/main` — never a rebase — and **re-measures the pin afterwards**, because #30's own test additions move the same three numbers. **This does not tick § 3.7**, which needs both destinations; openXdox's pass is evidenced ([`5736681367`](opensoft/openXfactory#656 (comment))) and this supplies openDox's. It is also **§ 8.2 part 3**, whose other three parts are already on record. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Lane: openxfactory-4 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… 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>
… that is a refusal (#32) # 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`](#30 (comment)) — **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`](#30 (comment)) | | 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`](#30 (comment)) | ## 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](https://claude.com/claude-code) Lane: openxfactory-4 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>







The seven follow-ups openDox-code#26 registered rather than took
§ 3.6 landed with seven findings registered, because each of its batches had a scope the holder set. This is the act that takes them, one commit, one case each.
Every measurement here was made against a full checkout of
4f8ae01e— never by pointingPYTHONPATHat an old tree.pyproject.tomlsets[tool.pytest.ini_options] pythonpath = ["src"]and pytest prepends it, so aPYTHONPATH"old head" proof silently measures the new code and the case passes for nothing. That trap is now written down indocs/runtime.md§ 8, "Proving a regression case against an older head", because it is the one that leaves a regression test in the suite that never saw the regression.The seven, with where each came from
_foundwraps the pre-check and not the act: a deleted row is a 500db5197d0, suppressedpasswordless,secretarydb5197d0, suppressedwrite_backreuses a pathname where the act holds a descriptor4156f233runtime init's umask-derived modelocal_git_adapter.py:465; ruled "measure first"1.
OPENDOX_SERVED_DATABASE, and four manifest editsA25-3's finding was that
config._refuse_two_dsns_that_select_different_schemascan never fire in a shipped deployment: the Deployment holds the served DSN, the migration Job holds the migration one, and no workload holds both — so the migration container has to be told where the API reads. It was told the schema. It was not told the database, and that is the wider question: a schema comparison made in the wrong database compares two names that happen to agree, anddbnamemay be omitted from a DSN entirely, in which case libpq defaults it to the connection USER (measured for #25's two-DSN guard) — so two DSNs that look alike can select two databases without either one saying so.The consequence is A25-3's, one level up: DDL and a ledger applied to a database nothing serves, or
runtime resetdropping the six coordination tables of a database that was never this install's. That verb cannot be undone.refuse_a_database_the_api_will_not_readcompares the declaration withcurrent_database()before the ledger is bootstrapped and before the schema guard — the wider question first, so the refusal names the database when both declarations are wrong — in all three acts:apply(),migrate --plan,reset. A name and never a credential, which is the whole reason a workload that must not hold the served DSN can be given it. Four manifest edits carry it: the configmap literal (pg_database=), the Job's env, compose's migrate service (from the same.envvalue the Postgres service creates), and.env.example.2. S8544 — one measured dependency lock, read by all three installs
pyproject.tomldeclares what this package needs and deliberately does not pin it; a library that pins its dependents' versions cannot be installed beside anything. The other half was missing: the required job, the DB-backed job and the runtime image each resolved whatever the index offered on the day they ran, so the same commit tested twice is two different programs.constraints-cpython312-linux.txtis the resolved set — generated in a clean venv on cpython 3.12 / linux, not written by hand, with the command to regenerate it in its own header — and it is passed with-cin all three places. A constraints file and not a requirements one: it pins what is installed and installs nothing, so the required job still installs.[test]alone and the FastAPI and psycopg entries simply do not apply there.It sits at the repository root, and that is load-bearing:
deploy/holds the git-ignored.envthat.dockerignoreexists to keep out of the build context, so a lock living there would have meant a!deploy…re-inclusion — and the guard that no such rule exists is what keeps the filled-in.envat home.3.
_foundaround the act, not only the pre-checkBoth repository routes read the map row with
_found(...)and then call the act, which takes the rowFOR UPDATEinside itself. A row deleted between those two statements raisedidentity.NotFoundErrorpast a handler that catches onlyRepositoryActRefused— measured at4f8ae01eas an uncaught exception, which is a 500 where this API documents 404. The same class as #25's round 10 on the draft-discard path, and the same repair: the translation belongs on the call that can raise it, not on a read taken beforehand.4. A parameter name is judged by its words, plus one declared compound
Whole-word matching answered
sslpassword— libpq's own keyword — as innocent, so the first repair made every declared needle of six characters or more a substring. That bought one true name at the price of every other compound of those words: measured,passwordlessandsecretarywere refused as credential-bearing. A false refusal at a configuration boundary is not the safe direction — this predicate decides whether an install starts.So the compound is declared, and there is exactly one this runtime meets.
credentials_versionstays refused on purpose:credentialsis one of its words, and that same reading is what catchesaccess_token,X-Api-KeyandsessionToken— narrowing past it would mean comparing the whole name, which those three walk straight through.5. The temporary index is written through the held descriptor
Every other call in
write_backgoes through-C /proc/self/fd/<n>, which is what makes "the check and the use are one object" true.GIT_INDEX_FILEwas built fromrev-parse --absolute-git-dir— a pathname. Measured on git 2.43.0, with the directory renamed away and a symlink to a second repository put in its place after the probe:opendox-index-…landed--git-dirasked through-Canswers relative —.for the bare repository this act creates,.gitfor a checkout, both measured — so joining it onto the runner's own root keeps the whole path, and theunlinkthat cleans it up, inside the descriptor. The case drives the swap from the probe itself and asserts both the mechanism (the index path is inside/proc/self/fd/) and the consequence (the decoy holds nothing, the real repository holds the commit); against4f8ae01eit reports the absolute path.6. The store names an authority it cannot read
_scp_like_userinfodeclines a head holding whitespace so this rule cannot start judging prose, and the redactor's_CREDENTIAL_SHAPEDexcludes it so an unrelateduser@hostthree lines down git's stderr is not joined to the URL above it — anduser:pa ss@host:pathsat between them: refused in its URL form, accepted in its scp form. #26 closed the printing half at the one-URL entry point; this closes the store's own guard, by shape and never by value, on_split_url's reasoning that a value this module cannot parse can still carry a credential. Nothing ordinary is caught: a head without:is a username, a value without@has no authority, and/srv/a@b/my repos/x.gitis neither.7. The repository root is created 0700 — measured first, as ruled
The holder ruled "measure first, fix only if a reachable path leaves it wider than 0700".
runtime initis that path: every repository under the root is createdREPOSITORY_DIRECTORY_MODE, and the root above them tookPath.mkdir's default,0o777 & ~umask. Measured: 0755 under the container's own umask (0o022) and 0777 under umask 0 — every project id listable, and traversable, by any local account.0o700is umask-safe, because a umask can only remove bits, andPath.mkdirappliesmodeto the leaf only, which is right: the parents are the operator's own path components.An existing root is reported and not re-moded, on the walk's own rule that it narrows only what it made itself — an operator's mount point is not this act's to change — and the mode is in
init's evidence, so an operator upgrading from a build that created it 0755 sees the number and decides.Three existing cases moved with the code, and say why in place
.[…]extras now, rather than searching the whole command line for the wordruntime— the lock's filename contains it, and what the job must not do is install the runtime extra;-cand wraps;?%74oken=is the one that arrives astokenand is refused.Measured (python 3.12.3, pytest 8.4.2, postgres 16.15, git 2.43.0)
Every figure below was measured at
4767ceb7, with theruntimeextra made UNIMPORTABLE (the required job's own install) and with no ambient git configuration, and holds at the current head58852e1, which adds only the workflow's record of it. This description is edited in the same act as that record, which is what the round at0a2af8b8asked for on the sibling PR. The branch carriesorigin/mainby merge (#29's "Pin the triple" step on the required job), never by rebase; both of this PR's hunks in that file — the two-cinstalls and the figure block — stayed where they were.validatejob's own invocation (--noconftest, the six hermetic modules)tests_runtime/test_local_git_adapter.pytests_runtime/test_repository_act.py(DB-backed)python -m pytest -q tests_runtime/withOPENDOX_TEST_DATABASE_URLsetpython -m pyflakes src/opendox/runtime/*.py tests_runtime/*.pypip install -c … -e ".[test]"in a clean venv)Ten new cases, each run against
4f8ae01efirst, and each failed there for its own reason: the uncaughtNotFoundError,MigrationRunner.__init__() got an unexpected keyword argument 'served_database',0o777, the absolute index path, the three refusals and the missing lock.The review at
4df3701c, and what it movedFour findings, all measured true, all taken in one push — three of them defects in this act's own output, which is the line the holder drew: a finding about landed code is registered, work that does not do what it says is repaired.
${OPENDOX_PG_DB:-}next toPOSTGRES_DB: ${OPENDOX_PG_DB:-opendox}; the Kubernetes base leftpg_database=empty and neither overlay set it (measured:devmerges onlyopendox-oidc,managed-databasemergesmigration_wait_hostand a commentedruntime_pg_role). So the guard item 1 exists to add was a no-op in every shape that ships. One expression for compose's two services now; the base declaresopendox, which its own StatefulSet hardcodes; the managed-database overlay — which deletes that StatefulSet — carries the commented edit beside the one it already carries. Leaving it wrong there is a refusal, not a silent wrong-database migration.pg_schemastays empty for the opposite reason:publicis PostgreSQL's default, not a name this repository chose.runtime initnarrows the root it creates, and in the shipped image it creates nothing — the Dockerfile makes/var/lib/opendox/projectsin its own layer withmkdir -p, which takes0o777 & ~umask(0755 for aRUN), and this runtime does not re-mode a directory it did not make.install -d -m 0700states the mode itself, in the layer that owns the directory.tar -x -Cdoes not create its destination.local_git_adapter.py:2104said something false, and now says the truth. See follow-up Bootstrap posture: LICENSE, SECURITY, CODEOWNERS, validate check, pytest suite #1 below. No behaviour changed there in this act.Registered as follow-up #1 — a separate PR, ruled
write_back's index is still pathname-bound for a LINKED WORKTREE, and the comment that denied it was wrong. Measured on git 2.43.0:git -C <worktree> rev-parse --git-diranswers the absolute<main>/.git/worktrees/<name>— not.or.git— andtest_a_linked_worktree_can_reach_its_write_path, landed with § 3.6, serves exactly that shape writable and driveswrite_backthrough it. So the fallback branch is live for a supported corpus, and for itGIT_INDEX_FILEstays outside the held descriptor: the race this PR closes for a bare repository and a checkout remains open there.Ruled by the holder: bind the worktree's metadata by descriptor — its own gitdir and
--git-common-dir, which is whereobjects/andrefs/live, so two more held directories threaded through the method — and keep linked worktrees writable. Making them read-only instead is rejected, because it reverses a decision § 3.6 landed with its own case. A separate act, size M, not folded in here.Not in this act
local_git_adapter.py:465is the one item that came back "measure, then decide" and the decision is recorded above:runtime initis the reachable path and it is fixed; the walk's ownfchmodwas already correct, and a pre-existing root is reported rather than re-moded — with the image's own layer now making that root 0700, since it is the one place that owns it.secrets:S8136false positives on this repository's own redaction fixtures) are untouched; the gate is advisory here and they are not this act's list.Lane: openxfactory-4 (openXfactory-4-openDox_extraction)
🤖 Generated with Claude Code
Summary by Sourcery
Harden runtime migrations, repository operations, credential handling, dependency installation, and deployment configuration against the seven registered follow-up findings.
New Features:
Bug Fixes:
Enhancements:
Build:
CI:
Deployment:
Documentation:
Tests:
Chores: