Repository navigation
Fail the write_run preflight closed when the link-refusal walk cannot read a subdirectory, and correct the 3.13 rationale (for #1197) - #1200
Conversation
… read a subdirectory, and correct the 3.13 rationale _refuse_links_inside's own os.walk(run_dir) passed no onerror at all, unlike its sibling _refuse_foreign_descendants (PR #1189/#1190), which already fails closed the same way. An unreadable subdirectory was silently skipped, so a symlink hiding inside one would never be caught. Both walks now share a new _refuse_unreadable_walk(run_dir) onerror factory that refuses by name, tree-relative to run_dir. Also corrects the false "Python 3.13 pathlib swallows every OSError" rationale left in catalog.py's _own_mode docstring and two tests/doc-health/test_catalog.py comments: verification against the actual CPython 3.12/3.13 sources found the _ignore_error errno allow-list unchanged between versions, so the behaviour those comments justify (explicit os.lstat + errno handling) is correct, but the stated reason was wrong. See the PR body for the sources. For #1197 (re-scoped after the verification pass found the original Python 3.13 premise false). Lane: openxfactory-1 Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
@codex review |
Reviewer's GuideThe PR closes a write_run preflight gap by making both os.walk-based refusal scans reject unreadable subdirectories instead of silently skipping them, with relative-path diagnostics and regression coverage. It also corrects outdated Python 3.13 rationale in production documentation and tests while leaving the explicit lstat and defensive probe behavior unchanged. Sequence diagram for fail-closed write_run directory scanningsequenceDiagram
participant W as write_run
participant L as _refuse_links_inside
participant O as os.walk
participant E as _refuse_unreadable_walk
participant C as CatalogError
W->>L: _refuse_links_inside(run_dir)
L->>O: os.walk(run_dir, onerror=_refuse_unreadable_walk(run_dir))
alt directory enumeration succeeds
O-->>L: directory entries
L-->>W: continue preflight
else subdirectory cannot be enumerated
O->>E: _onerror(OSError)
E->>C: raise CatalogError(relative path)
C-->>W: preflight refused
end
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The revised rationale incorrectly describes documented Python 3.13 behavior as private and undocumented.
Review effort: Balanced
Findings: 2
Open (2)
What changed in this PR
Adds fail-closed handling for unreadable subdirectories during catalog run preflight.
Changes:
- Shares an
os.walkerror callback across both preflight scans. - Adds regression coverage for unreadable subdirectories.
- Revises comments about Python 3.13
pathlibbehavior.
| File | Description |
|---|---|
scripts/doc_health/catalog.py |
Adds shared unreadable-walk refusal handling. |
tests/doc-health/test_catalog.py |
Adds regression coverage and revises rationale comments. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Copilot review (PR #1200): the prior rewrite called the propagate-vs- absent contract on Path.is_symlink/is_dir/is_file "private" and "undocumented." Checked against the official docs.python.org/3.13 pathlib page: it explicitly says "False is also returned if the path doesn't exist or is a broken symlink; other errors (such as permission errors) are propagated" for all three. That is a documented, public contract, not an internal detail. Reworded catalog.py's _own_mode docstring and both corrected test_catalog.py comments to say so, and reframed the explicit os.lstat as insulation against a future version changing that contract, not a correction of today's. Lane: openxfactory-1 Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 27c11f6b17
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Codex review (PR #1200, P3): the previous wording framed Python 3.14 delegating is_symlink/is_dir/is_file to os.path.islink/isdir/isfile (which swallow every OSError) as only a hypothetical future change. Checked the CPython 3.14 branch directly: Lib/pathlib/__init__.py's Path.is_symlink() already is `return os.path.islink(self)`, and is_dir()/is_file() call os.path.isdir()/isfile() the same way when follow_symlinks=True (the default), falling back to a bare `except (OSError, ValueError): return False` otherwise. The change has already landed there; it is not speculative. Reworded catalog.py's _own_mode docstring and both test_catalog.py comments to say the propagate-vs-absent contract holds through 3.13 and changes in 3.14, and reframed the link-free test's monkeypatch as pinning to Python 3.14's actual is_symlink body, not a hypothetical worst case. Lane: openxfactory-1 Co-Authored-By: Claude Fable 5.1 <[email protected]>
Copilot review (PR #1200, high severity): onerror only covers a failed scandir(top), not a failed per-entry classification. os.walk's own is_dir() catches an OSError from one listed entry and treats it as a plain file rather than aborting (same on 3.12, 3.13, and 3.14), and the entry is still yielded either way. A bare node.is_symlink() would then misclassify it right along with os.walk: not a directory to refuse enumerating, and on Python 3.14 not a symlink either, since is_symlink there swallows the same error (Lib/pathlib/__init__.py: `return os.path.islink(self)`). _refuse_links_inside now classifies every listed name with _own_mode, the same explicit os.lstat primitive _link_inside already uses for the read-side scan, instead of calling Path.is_symlink directly. A node _own_mode cannot check (any errno but ENOENT/ENOTDIR) refuses by name, on every interpreter version alike. New test test_refuse_links_inside_fails_closed_on_an_unprobeable_entry injects the OSError from os.lstat itself (the per-node probe), not from scandir, per the review's ask. Lane: openxfactory-1 Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
@codex review |
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Brings the branch current with main after #1198 (51887c6), #1199 (7daaf0f, the catalog staging directory, the deleted _is_writer_temp, the fsync-then-rename durability work), #1202-#1206 and #1181. The merge applied without conflicts. #1199 did not reshape any function this branch touches: _own_mode, _refuse_links_inside and the os.walk error path of _refuse_foreign_descendants are as this branch left them, and main's rewrite of _refuse_foreign_descendants' docstring (no temp admitted, STAGING_DIR) and its body (the _is_writer_temp clause gone) sits beside this branch's shared _refuse_unreadable_walk onerror unchanged. The diff against main is still exactly this branch's two files, at the same size as before the merge. Lane: openxfactory-1 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9f3e67b294
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…s split Codex (P1) and Copilot, reviewing PR #1200 at 9f3e67b, found the same fail-open: os.walk splits each listing with DirEntry.is_dir(), and when that call raises it files the entry as a non-directory and never enters it, though the entry's own lstat then says it is a directory. Classifying every listed name by _own_mode did not help while os.walk still chose what to enter, so a symlink below such a directory stayed hidden and _refuse_links_inside passed the run. Both writer walks now go through one explicit walk, _walk_run_tree: it lists names only (os.scandir, never asked to classify an entry), splits them by each node's own lstat (_own_mode), enters exactly the nodes that lstat says are directories, and refuses a link, an unprobeable node or an unlistable directory as it goes. It is the walk _link_inside already makes for the read-side scan, raising where that one returns. _refuse_foreign_descendants uses it too: under os.walk's split a directory whose is_dir() failed was refused under its own name instead of the stranger inside it, or, at a recorded file's own path, passed without being entered. The onerror factory _refuse_unreadable_walk becomes _unenumerable_refusal, the same tree-relative refusal. Two regression tests inject the failure on DirEntry.is_dir() alone (a scandir wrapper), assert the premise that os.walk then never enters the directory, and assert both walks still refuse by name. Both failed before this change: the link test did not raise, and the stranger test named the directory, not the stranger. The os.walk is_dir() handling was checked in CPython 3.12, 3.13 and 3.14's Lib/os.py. Lane: openxfactory-1 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@codex review |
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Copilot, reviewing PR #1200 at 89c1d63: the walk raised _own_mode's refusal unchanged for a node whose lstat fails, and that refusal interpolates the raw OSError, host-absolute path and all, while the same walk names a directory it cannot list relative to run_dir. _walk_run_tree now probes each node with _walked_mode: the explicit lstat _own_mode makes, with the same errno handling, refusing a symlink exactly as _own_mode does (_symlink_refusal) but naming a node it cannot check by its path relative to run_dir, in _unenumerable_refusal's form, with the OSError kept as the cause. _own_mode itself, which the read-side scan uses, is unchanged; follow-up #1201 covers its message. The unprobeable-entry test now nests the denied node, and both fail-closed tests assert the relative name and the absence of the absolute path; the extended test failed on the prior head. Lane: openxfactory-1 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@codex review |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Brings the branch current with main after #1207 (plan 034 bookkeeping, specs/034-opendox-standalone-operation only). No file this branch touches moved on main, so the merge applied without conflicts and the diff against main is still exactly scripts/doc_health/catalog.py and tests/doc-health/test_catalog.py. Lane: openxfactory-1 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@codex review |
|
|
Codex Review: Didn't find any major issues. What shall we delve into next? Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
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 21 hours and 16 minutes by commenting @sourcery-ai review. Upgrade to get a review now.
Brings in 6fe0ee7 (#1200, scripts/doc_health/catalog.py and its test); no overlap with the dashboard lane files. Lane: openxfactory-5 (openXfactory-5) Co-Authored-By: Claude Opus 5.5 <[email protected]>
Lane: openxfactory-4 (openXfactory-4-openDox_extraction) Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
… T061 entries (5916000030) (#1210) Lane: openxfactory-4 (openXfactory-4-openDox_extraction) This PR is bookkeeping only (T007 batch K). It records two items of Brett Heap's multi-choice word of 2026-09-30, on `#656` comment [`5916000030`](#656 (comment)), in #1144 (`add-neutral-product-standalone-operability`). It also carries the plan-034 lines that follow from them. Plan 034 was read at `main` `0b6d8667`, which is #1207, and this branch has since merged `main` `6fe0ee7a` (#1200). ## Item 1: requirement 17 and scenario 17.1 ("any endpoint") Brett chose *"Yes, amendment batch K (Recommended)"*. The batch adds a note citing the rulings, and it does not rewrite ratified text. **Where the note sits.** It is a dated note in requirement 17's body, in the spec delta (`specs/neutral-product-standalone-operability/spec.md`). - It comes AFTER the requirement's SHALL paragraph and above its scenarios. That is batch D's form (#1170 → `79a720a2`), and it matches the `AMENDED … ON BRETT'S RULING` notes elsewhere in the corpus. - The parser still reads the requirement's first line as `A neutral product that offers model-assisted chat SHALL reach ANY endpoint that`. - The requirement keeps 4 scenarios, and the capability keeps 76. A short `AMENDED — T007 Batch K` pointer block follows batch H's 16.3 addendum in `tasks.md`. The note is placed where "any endpoint" is normative: the spec delta is what archive promotes. A note in `tasks.md` alone would leave the promoted requirement reading "ANY" with nothing beside it. This was Copilot's Principle II point on #1207. **What the note records.** Two rulings narrow requirement 17 in one respect, the route a credential travels by: - **The built-in resolver:** the loopback rule, `5880893901`, *"Refuse unless loopback (Recommended)"*. It covers a credential the resolver reads from an `env:` or `keyring:` reference (T080, openDox-code#63). - **The broker path:** `5890601202`, *"Yes, separate phase-3 draft (Recommended)"*, which gives the broker path T080's protections. It covers a token a broker mints (openDox-code#64). The rule the note states: - Each such credential is sent only over `https://`, or over `http://` to `127.0.0.1`, `[::1]` or `localhost`, which are the ruling's hosts as it spells them. - A binding that would present one over `http://` to any other host is refused when it is declared, with `ENDPOINT_NOT_PRIVATE`, before anything is resolved or minted. Nothing is stored. - The request that presents the credential follows no redirect, and over plain `http://` it takes no proxy. This is how #63 and #64 keep the route. - The auth kind `none` presents nothing and keeps whatever route it declares. `5901112350` (item 2) is #64's other ruling. It is about the broker runner's own refusals and does not bear on the route, so the note names it only as that. **What does not move:** - the requirement's title, its SHALL paragraph and all four scenarios; - 16.3's text and batch H's addendum; - F16.1. Its control record names a broker reference on `http://127.0.0.1:9`, a loopback route, which both rules accept. `proposal.md` (lines 399 and 729) and `design.md` § D14 also say "any" endpoint. They are left unchanged, as batch D left its packet prose, because the ruling names requirement 17 and scenario 17.1. ## Item 4: T061's ten edits to protected suites Brett chose *"Reword as reviewed entries (Recommended)"*. F5.2 gains a batch K paragraph after batch G's, in the form of batch F's admission line. **The ten edits.** The reviewed allow-list (R1Q7 (a), `5817152735`) admits ten more edits, all T061's (openXdox-code#36). Each is its own entry with its reason, and none is a respelling. - Nine are in `tests/test_snapshot_validation_launch.py`. - One is `tests/test_snapshot.py::test_a_missing_validator_is_unavailable_not_a_verdict`. - Each keeps its real assertions. Only the premise that a validator is found by walking up changes, to 7.3's answer. - `test_a_run_dir_beside_a_checkout_still_uses_that_one_first` inverts its expected answer and keeps its name, because an entry admits an edit inside one named test. **The chaining rule** (a holder decision within item 4, because it is the mechanism of the admission): - Batch C's text reads *"the landing's actual diff for that path contains ONLY the entry's recorded text"*. That implies one entry per suite per landing, and T059's check (openXdox-code#35, `scripts/protected_suites.py`) states it outright. - T061 is ONE landing, which edits `tests/test_snapshot.py` twice and the launch suite nine times. - For F5.2 only, batch K reads batch C's sentence as the recorded texts of several entries together. The entries apply in the order listed and chain by git blob. The landing's diff must still be exactly their texts, and each entry still admits one landing. - F5.2's call becomes `python3 scripts/protected_suites.py --chains …`. - **12.5 is not amended.** Its call passes no `--chains` and refuses a chain. Neither file is one of its governed suites: its `git grep` selects the same 16 files at openXdox-code `main` `c41063d6` and at T059's head `4feb8009`, which this batch's writer measured, as T061's writer also did at T061's head. ## Plan 034 - **`tasks.md`:** - T007 gains batch K's bullet, its `Ruled:` citations and its `After, by batch` line: *"nothing, since `5916000030` is given"*. That line names what K lands before (openXdox-code#36, openDox-code#63 and openDox-code#64) by pull request, because the plan's graph tools read a task id there as a predecessor. - T007 is unticked, because batch K has not landed. The bookkeeping after K's landing re-ticks it with K's merge commit. - T061 gets a bullet for the ten cases, K on its `After:` line, and F5.2 "as C, F, G and K amend it". - T063, the phase-2 checkpoint, runs F5.2 as C, F, G and K amend it, with its last step passing `--chains`. It cites item 4 and waits on K, and so does its slice row. - T080's loopback bullet now records Brett's answer to #1207's question, instead of "not settled here". Its broker bullet replaces the stale "one question is open" with the two answered rulings: `5901112350` item 2, and `5916000030` item 5. - The dependency order and the phase-2 and phase-3 slice tables name K. P2-C's row lists the launch suite and `scripts/protected_suites.py`. - § "Ruled amendments" gains `5916000030` in its heading and two K rows. - **`spec.md` FR-009** follows the ruling: a credential travels only over `https://` or loopback `http://`, for both the built-in resolver and a broker's token; any other `http://` endpoint that would receive one is refused when declared; the request follows no redirect and, over plain `http://`, takes no proxy; and `none` keeps its route. US2's independent test and SC-002 run F5.2 as C, F, G and K amend it. - **`plan.md`** lists batches A to K, and its dependency graph adds K to T061's, T063's and T080's lines. ## Gates All of these were run from this clone's root at `36ea163f`, against a same-kind fresh clone of `main` `6fe0ee7a`. doc-health was re-run at each later head (`b043f31e`, `cc5f3d18` and `7e843366`, which touch only plan 034's files), and its report is byte-identical each time. Both clones sit in directories named `openxFactory`: doc-health reads the directory name as the repo identity. | gate | `main` `6fe0ee7a` | this branch `36ea163f` | |---|---|---| | `OPENSPEC_TELEMETRY=0 openspec validate add-neutral-product-standalone-operability --strict` (1.13.1) | valid | valid | | `OPENSPEC_TELEMETRY=0 openspec validate --all --strict` | `110 passed, 1 failed (111 items)` | the same, and the output is byte-identical. The one failure is the pre-existing `add-chain-attestation` | | `python3 scripts/validate-openspec-cli-pin.py --all` (pinned 1.12.0) | rc 0, `0 UNDISPOSITIONED failures` | rc 0, `0 UNDISPOSITIONED failures`, with 1 accepted exception (`add-chain-attestation`, Brett Heap 2026-09-05, "take exit 2") | | `python3 scripts/doc-health.py --single-repo . --as-of 2026-09-30` | 31 critical, 22 error, 60 warning, 20 info | byte-identical report, 0 new regressions | At `fd1cae4d`, before the merge of `main` (#1200 touches only `scripts/doc_health/catalog.py` and its test), these also ran: - `box_census.py` over #1144's `tasks.md`: `total 124`, with 104 `[ ]`, 11 `[x]` and 9 `[~]`. That is unchanged, since no box is added or removed. - Every one of these passed: - `scripts/proposal-support.py . verify add-neutral-product-standalone-operability`; - `scripts/validate-sequenced-after.py . --ledger-diff` (229 rows); - `validate-code-surface.py` and `validate-target-release.py`; - `validate-document-catalog.py` (`0 error(s), 0 warning(s)`); - `validate-pin-registrations.py`. - `pytest -q tests/doc-health/test_modified_block_currency_self_gate.py tests/sequenced_after`: 306 passed. - **The plan's consistency checks** (`depcheck`, `chaincheck`, `chaindirect`, `arrowcheck`, `phasecover` and `sharedfiles`). The lane's persisted parser, `aftergraph.py` in opensoft/brett-wip `handoffs/xFactory/attachments/lane-opendox/r1plan/tools/`, named batches A to I only, so it read J's and K's lines with I's. It is now widened to A to K in brett-wip `18f6a1b2` (`BATCHES = "ABCDEFGHIJK"`, every `[A-I]` made `[A-K]`, its docstring and the README line), on the holder's decision. - The old parser reads `main` and this branch alike, at 99 nodes and 217 edges. - The widened parser reads this branch at `b043f31e` and at `7e843366` at 101 nodes and 223 edges, with no cycles, 0 chain gaps and 0 of 67 arrow mismatches. `chaindirect` reports 42 pairs, `sharedfiles` the 4 known phase-1 pairs, and `qcheck` 27 of 27. - **The widened parser refuses `main` until this PR lands** (*"T007's After, by batch, names no line for ['K']"*), since `main` has no K line. That is the same pattern as round 2's widening beside its revision. **The diff:** #1144's two files take 105 inserted lines and 0 removed. Plan 034's files take 132 inserted and 57 removed. ## Review | Copilot at | verdict | threads | answered in | |---|---|---|---| | `36ea163f` | Changes recommended | the persisted parser reads A to I only (medium); plan.md's graph lacks K on T061 and T080 (low); T063, US2's independent test and SC-002 lack K (low) | brett-wip `18f6a1b2`; `b043f31e`, which also names K on T063's graph line and in the dependency order | | `b043f31e` | Changes recommended | FR-009 omits the note's redirect and proxy guarantees | `cc5f3d18`; `7e843366` gives T080's route bullet the same sentence | ## Landing - It carries no `Arc:` trailer (R1Q20 (a)), and no commit or line of this body carries a closing keyword. - It touches `openspec/changes/`, so it lands under a **Rule 6 `LANDING`/`LANDED` window**. The holder lands it. - It opens as a DRAFT. - Batch K lands before T061 (openXdox-code#36), and before T080 (openDox-code#63) and openDox-code#64. CLAIMED on `#656`: #656 (comment) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Lane: openxfactory-4 Co-Authored-By: Claude Fable 5.1 <[email protected]>
… with a Python 3.14 CI leg (for #1201) (#1211) * Fail the write_run preflight closed when the link-refusal walk cannot read a subdirectory, and correct the 3.13 rationale _refuse_links_inside's own os.walk(run_dir) passed no onerror at all, unlike its sibling _refuse_foreign_descendants (PR #1189/#1190), which already fails closed the same way. An unreadable subdirectory was silently skipped, so a symlink hiding inside one would never be caught. Both walks now share a new _refuse_unreadable_walk(run_dir) onerror factory that refuses by name, tree-relative to run_dir. Also corrects the false "Python 3.13 pathlib swallows every OSError" rationale left in catalog.py's _own_mode docstring and two tests/doc-health/test_catalog.py comments: verification against the actual CPython 3.12/3.13 sources found the _ignore_error errno allow-list unchanged between versions, so the behaviour those comments justify (explicit os.lstat + errno handling) is correct, but the stated reason was wrong. See the PR body for the sources. For #1197 (re-scoped after the verification pass found the original Python 3.13 premise false). Lane: openxfactory-1 Co-Authored-By: Claude Fable 5.1 <[email protected]> * Describe the documented pathlib contract instead of calling it private Copilot review (PR #1200): the prior rewrite called the propagate-vs- absent contract on Path.is_symlink/is_dir/is_file "private" and "undocumented." Checked against the official docs.python.org/3.13 pathlib page: it explicitly says "False is also returned if the path doesn't exist or is a broken symlink; other errors (such as permission errors) are propagated" for all three. That is a documented, public contract, not an internal detail. Reworded catalog.py's _own_mode docstring and both corrected test_catalog.py comments to say so, and reframed the explicit os.lstat as insulation against a future version changing that contract, not a correction of today's. Lane: openxfactory-1 Co-Authored-By: Claude Fable 5.1 <[email protected]> * Qualify the pathlib contract as documented through 3.13, changed in 3.14 Codex review (PR #1200, P3): the previous wording framed Python 3.14 delegating is_symlink/is_dir/is_file to os.path.islink/isdir/isfile (which swallow every OSError) as only a hypothetical future change. Checked the CPython 3.14 branch directly: Lib/pathlib/__init__.py's Path.is_symlink() already is `return os.path.islink(self)`, and is_dir()/is_file() call os.path.isdir()/isfile() the same way when follow_symlinks=True (the default), falling back to a bare `except (OSError, ValueError): return False` otherwise. The change has already landed there; it is not speculative. Reworded catalog.py's _own_mode docstring and both test_catalog.py comments to say the propagate-vs-absent contract holds through 3.13 and changes in 3.14, and reframed the link-free test's monkeypatch as pinning to Python 3.14's actual is_symlink body, not a hypothetical worst case. Lane: openxfactory-1 Co-Authored-By: Claude Fable 5.1 <[email protected]> * Classify every listed node by its own lstat, not by Path.is_symlink Copilot review (PR #1200, high severity): onerror only covers a failed scandir(top), not a failed per-entry classification. os.walk's own is_dir() catches an OSError from one listed entry and treats it as a plain file rather than aborting (same on 3.12, 3.13, and 3.14), and the entry is still yielded either way. A bare node.is_symlink() would then misclassify it right along with os.walk: not a directory to refuse enumerating, and on Python 3.14 not a symlink either, since is_symlink there swallows the same error (Lib/pathlib/__init__.py: `return os.path.islink(self)`). _refuse_links_inside now classifies every listed name with _own_mode, the same explicit os.lstat primitive _link_inside already uses for the read-side scan, instead of calling Path.is_symlink directly. A node _own_mode cannot check (any errno but ENOENT/ENOTDIR) refuses by name, on every interpreter version alike. New test test_refuse_links_inside_fails_closed_on_an_unprobeable_entry injects the OSError from os.lstat itself (the per-node probe), not from scandir, per the review's ask. Lane: openxfactory-1 Co-Authored-By: Claude Fable 5.1 <[email protected]> * Route the six doc-health gates through one strict probe, fs_probe (for #1201) Python 3.14's Path.exists/is_dir/is_file/is_symlink answer False for a node whose stat fails for any reason; through 3.13 they raise every OSError that does not name the node's absence. The #1201 survey found six read-side sites where that False switches a gate off: the complete-coverage baseline gate (catalog_baseline.is_baseline_complete and load_baseline), the regression gate (runner.main's --previous-report), the preflight validators (preflight._entrypoints and run_preflight), the pin-record ladder (families._pinned_arm), the aggregation-backlog detector (ideation_routing._aggregation_backlog_findings) and the catalog-tag guard (ideation_readiness.load_catalog_tags). Brett Heap's ruling (1(b), raw OSError) routes them through one leaf module, scripts/doc_health/fs_probe.py: one explicit os.stat or os.lstat with the 3.12/3.13 allow-list written out (ENOENT, ENOTDIR, EBADF and ELOOP read as absent, every other errno propagates raw). On 3.12 and 3.13 each site behaves exactly as before; on 3.14 it stops swallowing. Each site carries a one-line comment saying why it must refuse. tests/doc-health/conftest.py gains pathlib_314, which runs a test natively and again under CPython 3.14's own query bodies (transcribed from Lib/pathlib/__init__.py), and ProbeDenial, which denies os.stat/os.lstat of named nodes (chmod denies nothing to root). test_fs_probe.py pins the errno table and drives each gate with EACCES and EIO under both models; against the old probes every 3.14-model gate case fails. Lane: openxfactory-1 Co-Authored-By: Claude Opus 5.5 <[email protected]> * Fail the catalog writer's probes closed, with a tree-relative refusal (for #1201) The writer's five pathlib probes (_refuse_foreign_node, _occupied, _read_claims, and the run-directory probes in write_snapshot and write_run) now classify a node by the one explicit lstat the run scan already used (_node_mode, beneath _own_mode). A node whose lstat fails for any reason but FileNotFoundError or NotADirectoryError is a CatalogError, never absent. On 3.14 the no-follow guard used to pass an unstat-able node, a symlink included, as absent, and an existing immutable record read as "nothing there". The refusal (_unchecked_refusal, which _own_mode's refusal now uses too) names the node by its path under the catalog root and the failure by its errno name, never str(exc): CI's secret sweeper redacts the host-absolute path the OSError carries. To name nodes tree-relative, the catalog root is threaded through _own_mode, _link_inside, _refuse_links_inside, _refuse_foreign_node, _read_claims, _occupied, _read_record, _holds_exactly, _load_run_bytes and _addresses_itself (document_catalog's one caller and the tests' direct calls updated). The symlink and "occupied by a" messages keep their text. Tests: every node the preflight classifies, and every probe after it, with EACCES and EIO, under both pathlib models: a controlled refusal, a redacted message, and a tree unchanged node for node. Against the pre-change code all 56 of those cases fail. Absence still reads as absent, ELOOP refuses (the catalog's flavour is stricter than fs_probe's), and no refusal carries the OSError's own filename or strerror. Lane: openxfactory-1 Co-Authored-By: Claude Opus 5.5 <[email protected]> * Add the doc-health-py314 CI leg, a job of its own beside pytest-suite (for #1201) Ruling 3 on #1201: .github/workflows/doc-health-py314.yml runs python -m pytest tests/doc-health on actions/setup-python 3.14, with the same nested checkout, gitlinks and hash-pinned lock as pytest-suite. It is a separate job, not a matrix on pytest-suite, because a matrix renames that required job's check-runs and its pinned context would never report. No ruleset requires it. test_py314_leg.py pins both halves. Lane: openxfactory-1 Co-Authored-By: Claude Opus 5.5 <[email protected]> * Refuse a symlink loop in resolve_in_root on every Python version (for #1201) RULED by Brett Heap, "#1201 3.14: 1(a)". Python 3.12's non-strict Path.resolve() stat-ed its own result and raised RuntimeError on ELOOP, which resolve_in_root turned into its UNRESOLVABLE refusal. Python 3.13 dropped that check (its resolve() is a bare os.path.realpath), so on 3.13 and 3.14 a looping pin record came back resolved and the pinned-target arm reported it as merely absent. The new doc-health-py314 leg measured this: test_a_self_looping_symlink_record_cannot_be_resolved_and_reads_nothing failed on 3.14.7, on this branch and on its unchanged base alike. scripts/pin_containment.py now asks the filesystem itself: after resolving, _is_symlink_loop stats the root and the target and refuses on ELOOP (or Windows' ERROR_CANT_RESOLVE_FILENAME), the question 3.12 asked, with no version test. Any other stat failure is left to the caller, as 3.12 left it. The refusal's reason names no path. Tests: the existing loop test is unchanged and passes on 3.12 and 3.14. New: a self-loop and a two-link cycle under CPython 3.13's own resolve body (monkeypatched onto Path on any interpreter), same finding byte for byte and nothing read; and a loop in an intermediate directory, called directly, under both resolves. Without the fix the three 3.13-model cases fail. Lane: openxfactory-1 Co-Authored-By: Claude Opus 5.5 <[email protected]> * Refuse a looping root in boundary_dir on every Python version too (for #1201) The same ruling as the previous commit, "#1201 3.14: 1(a)", applied to the other resolve in scripts/pin_containment.py. boundary_dir resolves the root before it checks the contracts/ boundary. On 3.12 a root that loops (or one reached through a looping ancestor) made that resolve raise RuntimeError, and the root refused as UNRESOLVABLE. From 3.13 on the resolve returned, the contracts/ probes below it failed on ELOOP and read as absent, and the root refused as BOUNDARY_MISSING instead: a refusal that changed with the interpreter. boundary_dir now asks _is_symlink_loop of the resolved root (os.stat and ELOOP, no version test) and returns UNRESOLVABLE, whose reason names no path. Its second resolve needs no check: it runs only on a contracts/ that already stat-ed as a real directory. The two refusals now share one reason string. The one caller, families._pinned_arm, prints the reason text, which is unchanged. Tests: a root that is itself a loop, and a root under a looping ancestor, each natively and under CPython 3.13's own resolve body patched onto Path. Without the fix the two 3.13-model cases fail. Lane: openxfactory-1 Co-Authored-By: Claude Opus 5.5 <[email protected]> * Install the 3.14 leg's lock binary-only, and return the pathlib_314 model (for #1201) SonarCloud flagged the new doc-health-py314 job's pip step (githubactions S8541): without --only-binary :all:, a package could run a setup script. Every package in requirements/hermes-runtime-contracts.lock ships a 3.14 wheel (17 of 17 on the job's first runs and on a local 3.14.7), so the step now installs as former-id-arrival-gate.yml and openxdox-consumer-gate.yml do: --require-hashes --only-binary :all:, in a literal block because ":all: -r" is not a plain YAML scalar. pytest-suite.yml keeps its own form. The pathlib_314 fixture returns its model instead of yielding it (SonarCloud python S9100): it has no teardown of its own, monkeypatch undoes the swap. Lane: openxfactory-1 Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Fable 5.1 <[email protected]>






Lane: openxfactory-1
What: the write_run preflight's two run-directory walks,
_refuse_links_insideand_refuse_foreign_descendants, now fail closed on every node they cannot list or check. Both go through one explicit walk,_walk_run_tree, instead ofos.walk. It lists names only (os.scandir, never asked to classify an entry). It splits them by each node's ownlstat(_walked_mode) and enters exactly the nodes thatlstatsays are directories. It refuses as it goes, in three cases:_symlink_refusal, unchanged);lstatfails for any reason but its absence;_unenumerable_refusal).The last two are named by their path relative to
run_dir, never by the host-absolute path theOSErrorcarries. The PR also corrects the false "Python 3.13 pathlib swallows every OSError" rationale incatalog.py's_own_modedocstring and twotests/doc-health/test_catalog.pycomments (from PR #1189 / PR #1190, for #1187). The explicitos.lstatwith errno handling those comments justify was already correct. Only the stated reason was wrong.Why, for #1197 (re-scoped after a verification pass):
The original #1197 asked to harden
write_run's probes against a claimed Python 3.13 pathlib change: "the_ignore_errorerrno allow-list is gone, soPath.exists/is_dir/is_file/is_symlinkreturnFalsefor anyOSError." Verification against the actual CPython sources found that premise false for 3.13, but confirmed for 3.14:3.13branch tip,Lib/pathlib/_abc.py:_IGNORED_ERRNOS = (ENOENT, ENOTDIR, EBADF, ELOOP)is present, unchanged from 3.12'sLib/pathlib.py.exists()/is_dir()/is_file()/is_symlink()all still doexcept OSError as e: if not _ignore_error(e): raise— a non-allow-listed errno (EACCES, EIO, …) is re-raised, not swallowed. This matches the official docs (docs.python.org/3.13/library/pathlib.html), which state foris_dir/is_file/is_symlink: "False is also returned if the path doesn't exist or is a broken symlink; other errors (such as permission errors) are propagated" — a documented public contract, even though the exact mechanism implementing it (_ignore_error/_IGNORED_ERRNOS) is a private, underscore-prefixed internal.Lib/pathlib/_local.py'sPathoverrides none of the four — onlystat()(a rawos.stat()passthrough),is_mount(),is_junction().v3.13.0release tag's_abc.pyis byte-identical to the branch tip in this region (confirmed by diff).follow_symlinkskeyword-only argument added tois_dir/is_file).3.14branch restructured the package (_abc.pyis gone;Lib/pathlib/__init__.pynow holdsPathdirectly). There,is_symlink()isreturn os.path.islink(self);is_dir()/is_file()callos.path.isdir()/os.path.isfile()the same way whenfollow_symlinks=True(the default), or fall back to a bareexcept (OSError, ValueError): return Falseotherwise;exists()callsos.path.exists()/lexists(). All four now swallow everyOSErrorunconditionally — exactly the behaviour the original issue described, just one version early. (Codex review finding on this PR; verified directly against the CPython3.14branch, not taken on faith.)os.path.exists/isfile/isdir/islinkingenericpath.pyDO swallow allOSErrors unconditionally in every version checked (3.12, 3.13, 3.14 alike) — not version-gated on their own — andcatalog.pynever calls them.The coordinator re-scoped #1197 (issuecomment-5880376184) to the real, version-independent gap the verification surfaced:
_refuse_links_inside's ownos.walkhad noonerrorat all, unlike_refuse_foreign_descendants(which already fails closed the same way, PR #1189/#1190). So an unreadable subdirectory inside an existing run directory was silently skipped, and a symlink hiding inside one would never be caught — present on 3.12 today, not merely a future hazard. This PR fixes that gap, and corrects the two comment blocks: they now say the propagate-vs-absent contract is documented through 3.13 and changes in 3.14, and frame the explicitos.lstatas keeping the scan correct on a version CI does not run today (3.14), not insulation against a merely hypothetical one. The two tests' monkeypatches (Path.is_symlink = lambda self: os.path.islink(self), etc.) are unchanged in mechanism — they now correctly read as pinning to Python 3.14's actual method bodies, not an arbitrary worst case.Merging main, and #1199. This branch has merged
maintwice with merge commits, never a force-push. The first merge (9f3e67b, main 91e4685) brought in #1198, #1199 (7daaf0f), #1202-#1206 and #1181. The second (090a811, main 0b6d866) brought in #1207, which touched onlyspecs/034-opendox-standalone-operation/. Both merges applied without textual conflicts. After each one, the diff against main is exactly this PR's two files. Here is how each point where #1199's landed code meets this PR was resolved:_is_writer_temp(deleted by Stage the catalog's rendered temps outside the scanned run tree and admit no temp-shaped sibling (for #1196) #1199). It sat between_refuse_links_insideand_refuse_foreign_descendants. This PR never touched it, and it is gone as landed. Nothing of this PR depended on it._refuse_foreign_descendants(reshaped by Stage the catalog's rendered temps outside the scanned run tree and admit no temp-shaped sibling (for #1196) #1199). Stage the catalog's rendered temps outside the scanned run tree and admit no temp-shaped sibling (for #1196) #1199 rewrote its docstring (no temp is admitted,STAGING_DIR) and dropped the_is_writer_tempclause from its body. Both are kept exactly as landed. This PR changed only how that function walks: first to the sharedonerrorrefusal, and then, after the review round at 9f3e67b, to_walk_run_tree. The per-filenode not in allowed_filescheck and the per-directoryallowed_dirscheck are Stage the catalog's rendered temps outside the scanned run tree and admit no temp-shaped sibling (for #1196) #1199's, unchanged. They now run over lists split by each node's ownlstat.STAGING_DIR,_write_rendered,_rename_compatible,_fsync_publishand the claim's fsync are untouched.STAGING_DIRsits beside the day directories underruns/, never inside a run directory, so neither walk ever lists it. No temp of the writer's can now appear inside a run mid-walk._own_mode(read side). Its behaviour is unchanged, and only its docstring's rationale was corrected. The writer's walk uses its own_walked_mode: the samelstatand errno handling, with a tree-relative refusal. Follow-up doc-health catalog: audit the remaining bare pathlib probes against CPython 3.14's swallow-everything semantics (follow-up to #1197) #1201 owns_own_mode's message and the remaining bare pathlib probes (_occupied,_refuse_foreign_node,run_dir.exists()).How verified, at the current head 090a811 (main 0b6d866 merged):
python3 -m pytest tests/doc-health -q: 2021 passed, 0 failed, 7 warnings (7m00s). The run was in a full clone with the openXwallet, openXdox and openDox submodules initialized, so the 7 carve-reach failures noted at the first head below no longer occur.tests/doc-health/test_catalog.py: 77 passed, of which 4 tests are this PR's.pytest-suitejob 109973888161 readselected=9329 passed=9323 skipped=6 failures=0 errors=0, against floors of 7050 and 7044 andskipped==6(the pinned exact value). Both the freshness verifier and the vector replay passed. The local CI-equivalent run (tests/ -m "not postgres", Python 3.12.3) read 8896 passed, 21 skipped, 0 failed; it is missing only the pinned core checkout.os.walkwalk: one reported DID NOT RAISE, and the other named the directory (xFactories) instead of the stranger. The extended probe test failed on 89c1d63 with the raw[Errno 13] Permission denied: '/tmp/...'text.os.walk's swallowing of aDirEntry.is_dir()OSErrorwas checked in CPython 3.12, 3.13 and 3.14Lib/os.py: it files the entry as a non-directory.At the first head, 2201c4a (before main was merged); kept for the record:
python3 -m pytest tests/doc-health -qand the targetedtests/doc-health/test_catalog.py -v— tail below.test_refuse_links_inside_fails_closed_on_an_unenumerable_subdirectorymonkeypatchesos.scandir(notchmod: chmod does not deny a directory to root, so a chmod-based repro would not hold under a root test runner or in CI) to deny exactly one subdirectory, and asserts the preflight refuses, naming the node tree-relative torun_dir("(xFactories)"), never the host-absolute path the rawOSErrorcarries.test_refuse_links_inside_fails_closed_on_an_unprobeable_entrymonkeypatchesos.lstat(the per-node probe, notscandir) to deny exactly one file, and asserts the preflight refuses.test_write_run_fails_closed_on_an_unenumerable_run_directory(the sibling_refuse_foreign_descendantscoverage, chmod-based) stays green, unchanged.(A fourth commit added
test_refuse_links_inside_fails_closed_on_an_unprobeable_entry; the targeted run is 68 passed after it, still 0 failed.)Also ran the full
tests/doc-healthdirectory (python3 -m pytest tests/doc-health -q): 2002 passed, 7 failed, 1 skipped. All 7 failures are pre-existing and unrelated:test_ideation_readiness.py(x3),test_readiness_dispatch.py,test_sentinel_vocabulary.py(x2),test_status_reader_real_lines.py— every one raisescarved_reach.CarveReachUnavailable: ... openXdox/code is empty ... Run git submodule update --init --recursive openDox openXdox, because this clone'sopenDox/openXdoxsubmodules are uninitialized (git submodule statusshows both with a leading-). None of the 7 touchtest_catalog.pyor any symbol this PR changes.Review cycle: Copilot found 2 findings at the first head (both about the same over-correction: calling the pathlib contract "private/undocumented" when
is_dir/is_file/is_symlinkdocument it through 3.13) — fixed and resolved; Copilot's next review reported Findings: None. Codex then found a follow-up (P3): the fixed wording called the 3.14 change merely hypothetical/future when it has already landed — fixed and resolved, verified directly against the CPython3.14branch as cited above. Copilot's next pass then raised a high-severity finding of its own:onerroronly covers a failedscandir(top), not a failed per-entry classification —os.walk's ownis_dir()swallows anOSErrorfrom one listed entry and treats it as a plain file (same on 3.12/3.13/3.14), and the still-barenode.is_symlink()in_refuse_links_inside's loop body would misclassify right along with it, and on 3.14 swallow the same error too. Fixed by classifying every listed name with_own_mode(the same explicitos.lstatprimitive_link_insidealready uses for the read-side scan) instead of callingPath.is_symlinkdirectly, with a new regression test injecting theOSErrorfromos.lstatitself rather thanscandir.After main was merged (9f3e67b), Codex (P1) and Copilot (high) raised the same finding.
os.walksplits a listing withDirEntry.is_dir(), and when that call raises it files the entry as a non-directory and never enters it, although the entry's ownlstatthen says it is a directory. So a symlink or a stranger below such a directory stayed hidden. That was fixed in 89c1d63 by replacing both writer walks with_walk_run_tree, with two regression tests that failDirEntry.is_dir()alone through a scandir wrapper. At 89c1d63 Copilot then found that a node the walk could notlstatwas refused with_own_mode's raw-OSErrormessage, which carries the host-absolute path. That was fixed in 8b65b02 (_walked_mode, a tree-relative refusal with theOSErrorkept as its cause). Every thread was answered and resolved. At 8b65b02 and again at the current head 090a811, Copilot reported Findings: None and Codex found no major issues. There are 0 unresolved threads.Ownership: this PR owns the two writer walks (
_refuse_links_inside,_refuse_foreign_descendants, and the new_walk_run_tree,_walked_modeand_unenumerable_refusal) and the probe-rationale comments only. #1199 (for #1196) owned_write_rendered, the staging directory and the temp-admission clause. It landed first (7daaf0f), and this branch merged main after it, as agreed.Files changed:
scripts/doc_health/catalog.py:_walk_run_tree(anlstat-driven walk),_walked_mode(the writer's probe) and_unenumerable_refusal(a tree-relative refusal, which replaces the_refuse_unreadable_walkonerrorfactory an earlier head of this PR added);_refuse_links_insideand_refuse_foreign_descendantswalk through it;_own_mode's docstring rationale is corrected (documented through 3.13, changed in 3.14).tests/doc-health/test_catalog.py:DirEntry.is_dir()for each walk;deny_is_dirscandir wrapper;os.walkcomment updated.🤖 Generated with Claude Code