Repository navigation
tests/: a red composite assert names both halves, and a leaked sys.path names none (#115) - #116
Conversation
…th names none (#115) SonarCloud's python:S9073 flagged 22 `assert a and b` sites across nine tests/ files: a failure there prints only `AssertionError`, with no way to tell which half broke without opening the file and re-deriving it. Each is now two `assert`s, each keeping (or duplicating) a message that still says what failed, with no change to what is actually being checked. python:S8997 flagged 8 sites, all a bare `sys.path.insert(0, str(REPO / "scripts"))` inside a test function with no matching cleanup, so the entry leaks into `sys.path` for the rest of the test process once the test that added it returns. Each now takes the `monkeypatch` fixture and calls `monkeypatch.syspath_prepend(...)` instead, which pytest undoes at teardown on its own. Removing the last `sys.path.insert` in tests/test_scaffold_e2e.py left `import sys` unused there, so that import goes with it. tests/test_naming_policy.py is untouched: another lane in this fan-out owns it. Nothing outside tests/ changed. Lane: openreposhape-2 (openRepoShape-2) Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
@codex review |
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 2 days and 21 hours by commenting @sourcery-ai review. Upgrade to get a review now.
Reviewer's GuideThe PR updates tests only: it makes composite assertions report which condition failed and replaces per-test File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
There was a problem hiding this comment.
🟢 Approval recommended
No unresolved review issues remain, and the changes are limited to test diagnostics and isolation.
Pull request overview
This test-only PR improves assertion diagnostics and prevents temporary sys.path leakage.
Changes:
- Splits composite assertions into independent checks.
- Uses pytest’s
monkeypatchfor temporary import paths. - Removes the unused
sysimport.
File summaries
| File | Description |
|---|---|
tests/test_update_shape_add.py |
Splits a composite assertion. |
tests/test_shape_doctor.py |
Splits composite assertions. |
tests/test_setup_sh.py |
Splits a composite assertion. |
tests/test_setup_project_py.py |
Splits a composite assertion. |
tests/test_scaffold_e2e.py |
Improves assertions and isolates import paths. |
tests/test_repo_hygiene.py |
Splits composite assertions. |
tests/test_openreposhape_command.py |
Splits a composite assertion. |
tests/test_free_plan_hint.py |
Splits a composite assertion. |
tests/test_family.py |
Improves assertions and isolates import paths. |
Review details
- Files reviewed: 9/9 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
… `AGENTS-shape.md`, and `LANES_LANE` is promised to carry a `Lane:` argument only for a name that survives a paste (#111) BOTH OF COPILOT'S FOURTH ROUND ON PR #112 — two suppressed documentation findings on the same two lines of `AGENTS.md`, and neither is about what the tools do. They are about who is told, and about a promise wider than the code behind it. A PROJECT READS ITS OWN `AGENTS-shape.md`, NOT THIS CHECKOUT'S `AGENTS.md`. `scripts/shape_materialize.py` copies `templates/assembly-root/AGENTS-shape.md` verbatim into every scaffolded assembly root and digest-pins it, and that file is where an agent standing in such a project learns the shape's mechanics — including how a re-pin is run. Its "never edit a pinned file" section named the exit (upstream, then `update-shape.py` from a checkout of the standard, landed as a pull request) and stopped there, so the one thing the previous commits added to that procedure reached the standard's own readers and no project's. The section now carries the two-command block and a paragraph in the file's own voice: `apply` takes a repeatable `--trailer`, appended in the order given, and only alongside `--branch` because without one there is no commit to put a line on; `apply` composes that message itself, so a `Lane:` line or a `Co-Authored-By:` reaches the re-pin commit this way and no other rather than by amending it afterwards; `check` writes nothing and takes none. This is the same fix round 3 took in `templates/family-root/AGENTS-shape.md` for `family.py bump`, applied to the other holder of the same kind of doc. Both are pinned copies, so this moves the digest of `templates/assembly-root/AGENTS-shape.md` and every scaffolded project will report `upstream-changed` for it until its estate re-pins — the ordinary cost of changing a copy, and the reason the change is one section rather than a rewrite. `tests/test_scaffold_e2e.py` and `tests/test_family.py` recompute those digests from the bytes on disk, so nothing is hard-coded to move with them; each now also asserts `--trailer` is IN the file it checks, because a procedure that reached only the standard once can do so again. "WHERE `LANES_LANE` IS SET" PROMISED MORE THAN `lane_trailer` DELIVERS. That function deliberately offers nothing for a lane name that would not survive being pasted — a quote, a `$`, a backtick, a backslash, a newline, surrounding whitespace — because a printed next command is there to be copied, and one that breaks or expands when it is copied is worse than no line at all. A reader with such a name, told the `NEXT` line "already carries the `Lane:` argument", would go looking for a bug. The sentence now says what is true on both sides: where `LANES_LANE` holds a name that survives being pasted the two printed lines carry the argument already, and one that would not is offered on neither. Seven lines to seven, so the 433-line cap in `tests/test_repo_hygiene.py` is untouched. THE THIRD ITEM THIS ROUND RAISED WAS ALREADY TAKEN. `unicodedata.category` of a lone surrogate is `Cs`, and `UNPRINTABLE_CATEGORIES` has listed `Cs` since the previous commit, with the grammar cases in `tests/test_commit_trailers.py` (`NOT_TEXT`) to prove it. Verified again here rather than assumed: `subprocess.run(["true", "Lane: a\ud800b"])` raises `UnicodeEncodeError` instead of mangling the value, which is exactly the failure `--trailer` must refuse at the boundary rather than let reach `git commit`. PROVEN ON A TREE REBASED ONTO `origin/main` AT e9fa826 (#116, #117 and #121 landed under this branch while it was open) — the rebase was conflict-free, because #121 touched `scripts/repo_shape.py`, `scripts/render-cli-reference.py`, `setup-project.py` and the leg-template validators and this branch edits none of them. The commit itself sits on c19a595 unrebased: the branch ruleset refuses a force-push, which is the correct answer, and GitHub tests the merge with `main` regardless. 1131 passed, 1 skipped on the rebased tree; the one red is the machine-dependent `test_cli_reports_an_unread_link_as_a_warning_and_still_classifies` in `tests/test_naming_policy.py`, pre-existing and not this branch's. `docs/cli.md` regenerates byte-identical on both trees — through the old `render-cli-reference.py` and through #121's new one — so no `--help` text moved. Lane: openreposhape-2 (openRepoShape-2) Co-Authored-By: Claude Fable 5.1 <[email protected]>
…le `--trailer`, and the printed `apply` already carries the lane, so the commit they write ends with its `Lane:` line instead of being amended afterwards (#111) (#112) * `update-shape.py apply --branch` and `family.py bump` take a repeatable `--trailer`, and the printed `apply` already carries the lane, so the commit they write ends with its `Lane:` line instead of being amended afterwards (#111) Both tools compose their own commit message — "Re-sync the shape copies to <repo> @ <sha12>", "Bump <Member> to <sha12> in the <Family> family" — so the `Lane: <name>` line the lane-collision protocol wants on every artifact a lane produces, and the `Co-Authored-By:` this estate adds beside it, reached those commits through nothing at all. Four InkRouter re-pins landed on 2026-09-11 carrying neither, each one run exactly as a printed `NEXT` line said. `--trailer "<Key>: <value>"` is repeatable, kept in the order given, and validated at the argparse boundary, so a line that is not a trailer is refused with the usage beside it and before a repository is opened. On `apply` it needs `--branch`, refused under the same `update-branch-required` id as `--push` and `--pr` and now naming whichever of the three was passed: a trailer is a line on a commit, and without `--branch` there is no commit to put one on. The write is `git commit --trailer` where the host git is 2.32 or newer, probed once from `git --version` and parsed conservatively, and an append to the message text where it is not — the same commit either way, which `tests/test_commit_trailers.py` writes both of and compares. Passed no trailer, the message and the `git commit` argv are the ones these tools always built. `update-shape.py check`'s `NEXT` line and the doctor's `shape currency` row now end with `--trailer "Lane: <$LANES_LANE>"` when the environment names a lane, quoted through the doctor's own platform-aware `quote_arg` on its rows, so the line survives being pasted; with no lane set nothing is added and both are byte-identical to what they printed before. Only the lane is derived — a co-author names a person or a model no environment variable knows. What a trailer is, which git takes the option, and which variable names the lane live in `scripts/shape_materialize.py`, imported by both tools already and in no copy list; `scripts/repo_shape.py` would have put an `upstream-changed` row in front of every project in the estate for a helper none of their copies would call, which is the argument `shape-doctor.py` makes about its quoter. Lane: openreposhape-2 (openRepoShape-2) Co-Authored-By: Claude Fable 5.1 <[email protected]> * A trailer is matched with `fullmatch` and the lane is read RAW, so a newline in either is refused instead of reaching the commit message and argv (#111) TWO HOLES OF ONE SHAPE, both found by Copilot on PR #112, and both about "one line" being asserted by something that does not assert it. `trailer_line` matched with `re.match` against a pattern ending in `$`, and `$` stops just before a FINAL newline — so `--trailer "Lane: x\n"` was accepted whole and the newline went into the message `git commit -F -` reads and into the `--trailer` argument beside it. `.fullmatch` is what requires the value whole, which is the lesson `shape-doctor.py`'s `quote_arg` took on PR #102 against `"Atlas\n"`; this is the same defect one file along. And the middle of the pattern was `[^\n]`, which is not "one line" either: `\r`, `\v`, `\f` and a bare `\t` all went through, each a line break or a column jump to some reader of the commit. Both classes now admit no control character at all, and the refusal says so. `lane_trailer` asked the alphabet about a `.strip()`ed name, so `LANES_LANE="xfactory-1\n"` — the shape `$(cat …)` and a CRLF file produce — was offered on the printed next command as `Lane: xfactory-1`: a name the contract says is not offered, trimmed into one that is, with nothing said. The raw bytes are what `LANE_NAME_RE` is now asked about, and a value with whitespace around it is NOT a lane name, decided that way because `TRAILER_RE` refuses a value starting or ending in whitespace — a printed line offering a trailer this tool's own `--trailer` would then refuse is worse than one offering none. Stripping decides exactly one thing now: that an all-whitespace variable means no lane, which is `LANES_LANE=` spelled with a space in it. Fourteen cases, including the trailing newline that got through, each control character the interior class admitted, every whitespace-around-the-name shape, and the invariant the two rules exist to keep: a lane the printer offers is a trailer `--trailer` would accept. The review's third finding — `AGENTS.md` at 434 lines against a cap of 433 — does not reproduce: `wc -l AGENTS.md` is 433, the file carries 433 newlines and 433 `splitlines()` entries and ends with one, and `test_agents_md_is_short_enough_to_be_read` passes. The cap is untouched. Lane: openreposhape-2 (openRepoShape-2) Co-Authored-By: Claude Fable 5.1 <[email protected]> * A trailer is ONE line because `splitlines()` and `unicodedata` say so, not because an ASCII class does, and the holder's own instructions show `bump`'s trailers (#111) THREE FINDINGS FROM COPILOT'S THIRD ROUND ON PR #112, one of them a hole in the grammar the previous round opened and two of them about what a reader — a person or a test — is told. `[^\x00-\x1f\x7f]` READS AS "NO CONTROL CHARACTER" AND IS NOT ONE. It names C0 and DEL and stops there, so the C1 block `\x80`-`\x9f`, U+0085 NEXT LINE, U+2028 LINE SEPARATOR and U+2029 PARAGRAPH SEPARATOR all went through a pattern whose whole job was "one line" — and Python's own `str.splitlines()` treats every one of them as a line boundary, so a value the tool called one line arrived as two in anything that read the commit message back that way. The `Cf` characters got through the same gap without even being breaks: two trailers differing by a zero-width joiner look identical to a reader and are not, which is the confusion a trailer exists to avoid. A CHARACTER CLASS LARGE ENOUGH TO NAME THEM ALL WOULD BE A SECOND, WORSE COPY OF THE UNICODE TABLES, so `one_printable_line` asks the two questions in their own words instead: `value.splitlines() != [value]` is this interpreter's own definition of a line boundary, and moves by itself the day a future Python adds one; `unicodedata.category` then refuses `Cc`, `Cf`, `Zl`, `Zp` and `Cs`. `Cs` is there because a byte the locale could not decode reaches `sys.argv` as a lone surrogate, which is not text at all — git is handed that undecodable byte straight back, or, on the pre-2.32 path that appends trailers to the MESSAGE, `subprocess` raises `UnicodeEncodeError` on a value `--trailer` had already accepted. `is_trailer` IS THE WHOLE RULE AND BOTH CALLERS USE IT, so the invariant the last round established — what `--trailer` refuses, no printed next command offers — holds by construction rather than by two checks that agree today. `LANE_NAME_RE` needs no second guard bolted on: it is a positive alphabet of printable ASCII, so nothing `one_printable_line` refuses can be in a lane name, and there is now a test saying that out loud for the day somebody widens it. `templates/family-root/AGENTS-shape.md` IS THE PINNED, AGENT-FACING MECHANICS DOC copied into every holder, and its `family.py bump` example still showed a bare bump. A procedure an agent reads in the holder it is standing in is the one it follows, so the example carries `--trailer` and a paragraph says what it is for: `bump` composes its own message, so a `Lane:` line reaches that commit this way and no other, and `add` and `remove` do not take it. This repository's `AGENTS.md` said it already; the copy every holder carries did not. THE BASELINE HALF OF A WITH/WITHOUT COMPARISON INHERITED THE RUNNER'S LANE. `tests/conftest.py::run_script` now blanks `LANES_LANE` for every tool under test unless the CALLER names it — which is how a test asks for a lane — so a suite run inside a lane asserts the same lines as one run outside it. The baseline of the test that compares the two pins it explicitly as well: the assertion there is "the lane run is the plain one PLUS the trailer", and a baseline that had quietly been a second lane run would have compared two identical lines and passed. Sixty-five new cases in `tests/test_commit_trailers.py`, 60 to 125: every line boundary, every invisible and every lone surrogate in the middle of a value and at the end of one, each of the two checks proved to be the one that catches its own half, the lane alphabet proved to exclude all of them, and `is_trailer` proved to be the single predicate both callers use. `docs/cli.md` regenerates byte-identical — no `--help` text moved. 1131 passed, 1 skipped; the one red is the machine-dependent `test_cli_reports_an_unread_link_as_a_warning_and_still_classifies` in `tests/test_naming_policy.py`, which is pre-existing and not this branch's. Lane: openreposhape-2 (openRepoShape-2) Co-Authored-By: Claude Fable 5.1 <[email protected]> * The re-pin trailers reach a scaffolded project through its OWN pinned `AGENTS-shape.md`, and `LANES_LANE` is promised to carry a `Lane:` argument only for a name that survives a paste (#111) BOTH OF COPILOT'S FOURTH ROUND ON PR #112 — two suppressed documentation findings on the same two lines of `AGENTS.md`, and neither is about what the tools do. They are about who is told, and about a promise wider than the code behind it. A PROJECT READS ITS OWN `AGENTS-shape.md`, NOT THIS CHECKOUT'S `AGENTS.md`. `scripts/shape_materialize.py` copies `templates/assembly-root/AGENTS-shape.md` verbatim into every scaffolded assembly root and digest-pins it, and that file is where an agent standing in such a project learns the shape's mechanics — including how a re-pin is run. Its "never edit a pinned file" section named the exit (upstream, then `update-shape.py` from a checkout of the standard, landed as a pull request) and stopped there, so the one thing the previous commits added to that procedure reached the standard's own readers and no project's. The section now carries the two-command block and a paragraph in the file's own voice: `apply` takes a repeatable `--trailer`, appended in the order given, and only alongside `--branch` because without one there is no commit to put a line on; `apply` composes that message itself, so a `Lane:` line or a `Co-Authored-By:` reaches the re-pin commit this way and no other rather than by amending it afterwards; `check` writes nothing and takes none. This is the same fix round 3 took in `templates/family-root/AGENTS-shape.md` for `family.py bump`, applied to the other holder of the same kind of doc. Both are pinned copies, so this moves the digest of `templates/assembly-root/AGENTS-shape.md` and every scaffolded project will report `upstream-changed` for it until its estate re-pins — the ordinary cost of changing a copy, and the reason the change is one section rather than a rewrite. `tests/test_scaffold_e2e.py` and `tests/test_family.py` recompute those digests from the bytes on disk, so nothing is hard-coded to move with them; each now also asserts `--trailer` is IN the file it checks, because a procedure that reached only the standard once can do so again. "WHERE `LANES_LANE` IS SET" PROMISED MORE THAN `lane_trailer` DELIVERS. That function deliberately offers nothing for a lane name that would not survive being pasted — a quote, a `$`, a backtick, a backslash, a newline, surrounding whitespace — because a printed next command is there to be copied, and one that breaks or expands when it is copied is worse than no line at all. A reader with such a name, told the `NEXT` line "already carries the `Lane:` argument", would go looking for a bug. The sentence now says what is true on both sides: where `LANES_LANE` holds a name that survives being pasted the two printed lines carry the argument already, and one that would not is offered on neither. Seven lines to seven, so the 433-line cap in `tests/test_repo_hygiene.py` is untouched. THE THIRD ITEM THIS ROUND RAISED WAS ALREADY TAKEN. `unicodedata.category` of a lone surrogate is `Cs`, and `UNPRINTABLE_CATEGORIES` has listed `Cs` since the previous commit, with the grammar cases in `tests/test_commit_trailers.py` (`NOT_TEXT`) to prove it. Verified again here rather than assumed: `subprocess.run(["true", "Lane: a\ud800b"])` raises `UnicodeEncodeError` instead of mangling the value, which is exactly the failure `--trailer` must refuse at the boundary rather than let reach `git commit`. PROVEN ON A TREE REBASED ONTO `origin/main` AT e9fa826 (#116, #117 and #121 landed under this branch while it was open) — the rebase was conflict-free, because #121 touched `scripts/repo_shape.py`, `scripts/render-cli-reference.py`, `setup-project.py` and the leg-template validators and this branch edits none of them. The commit itself sits on c19a595 unrebased: the branch ruleset refuses a force-push, which is the correct answer, and GitHub tests the merge with `main` regardless. 1131 passed, 1 skipped on the rebased tree; the one red is the machine-dependent `test_cli_reports_an_unread_link_as_a_warning_and_still_classifies` in `tests/test_naming_policy.py`, pre-existing and not this branch's. `docs/cli.md` regenerates byte-identical on both trees — through the old `render-cli-reference.py` and through #121's new one — so no `--help` text moved. Lane: openreposhape-2 (openRepoShape-2) Co-Authored-By: Claude Fable 5.1 <[email protected]> --------- Co-authored-by: Claude Fable 5.1 <[email protected]>
…uash landing is tested instead of only the pull request it squashed (#122) (#124) `.github/workflows/tests.yml` ran on `pull_request` and `workflow_dispatch` only, so `main` itself was never tested by CI: a squash of several disjoint pull requests landing in one evening (tonight's #116, #117 and #121) is a tree no run had ever exercised, even though each one was green on its own run. SonarCloud already analyses every push to `main`; the test record stopped at each pull request's last run instead of following it there too. Brett Heap ruled "do option 1 on 122": `on:` gains `push: { branches: [main] }`, and `tests-windows` / `tests-macos` each gain `if: github.event_name != 'push'` so they keep running on `pull_request` and a manual `workflow_dispatch` but skip on the main push — a squash-interaction regression is not OS-specific, so the ubuntu job on `main` is the gate for that, and the two jobs GitHub bills at 2x (Windows) and 10x (macOS) stay the pull-request-only gate they already were. A top-level `concurrency:` group keyed on the PR number (falling back to `github.ref`) cancels a superseded run of the same PR or the same branch, without touching an unrelated PR's in-flight run. The header comment gets one paragraph saying so, for the next reader. Nothing under `templates/` changes; the assembly-root `validate.yml` is a project's own gate and stays digest-pinned. Lane: openreposhape-2 (openRepoShape-2) Co-authored-by: Claude Fable 5.1 <[email protected]>



Lane: openreposhape-2 (openRepoShape-2)
Claim: #115 (comment)
Closes #115.
What was wrong
SonarCloud flagged 30 sites in
tests/, two rules:python:S9073"Split this composite assertion into separate assertions" (22sites): an
assert a and b(ora and b, msg) prints onlyAssertionErroron a red run, with no way to tell which half broke without opening the file.
python:S8997"Use the monkeypatch fixture for temporary modificationsinstead of manually modifying global state" (8 sites): each was a bare
sys.path.insert(0, str(REPO / "scripts"))inside a test function, withnothing to undo it — the entry leaked into
sys.pathfor the rest of thetest process once that test returned.
What landed
Every composite assert became two
assertstatements, each keeping (orduplicating) a message that still says what failed. What is actually checked
is unchanged. Site by site:
tests/test_scaffold_e2e.py:280S9073 →assert " code" in status and " spec" in statussplit, each keepingstatusas the messagetests/test_scaffold_e2e.py:282S9073 →assert 'path = spec' in modules and 'path = code' in modulessplit, each keepingmodulesas the messagetests/test_scaffold_e2e.py:574S9073 →assert "legs_credential" in fetch and "GITHUB_OUTPUT" in fetchsplittests/test_scaffold_e2e.py:732S9073 →assert "AGENTS.md" not in rows and "CLAUDE.md" not in rows, (...)split, message duplicated on bothtests/test_scaffold_e2e.py:755S9073 →assert (A in flat and B in flat)split into two plain assertstests/test_scaffold_e2e.py:773S9073 →assert "spec/" in body and "code/" in bodysplittests/test_scaffold_e2e.py:788S9073 →assert f"{ORG}/{PROJECT}" in text and "AGENTS-shape.md" in textsplittests/test_family.py:231S9073 →assert NAME in agents and "inkrouter" in agents and ORG in agentssplit into threetests/test_family.py:234S9073 →assert "AGENTS.md" not in rows and "CLAUDE.md" not in rows, (...)split, message duplicatedtests/test_family.py:909S9073 →assert folder.is_dir() and not (folder / ".git").exists(), (...)split, message duplicatedtests/test_family.py:978S9073 →assert not (tmp_path / "a").exists() and not (tmp_path / "b").exists()splittests/test_family.py:1166S9073 →assert holder.is_dir() and (holder / "family.yaml").is_file(), (...)split, message duplicatedtests/test_shape_doctor.py:779S9073 →assert check.id and check.labelsplittests/test_shape_doctor.py:883S9073 →assert "git -C" in row["next"] and "checkout --" in row["next"], row["next"]split, message kept on bothtests/test_shape_doctor.py:1518(line 1519 in this tree) S9073 →assert entry["misplaced"] == 0 and entry["review_required"] == 0split, each givenentryas its message to match the sibling assert on the line abovetests/test_repo_hygiene.py:152S9073 →assert "#51" in text and "2026-09-05" in text, (...)split, message duplicatedtests/test_repo_hygiene.py:1172S9073 →assert runs and all(run == out_file for run in runs), (...)split, message duplicatedtests/test_free_plan_hint.py:68S9073 →assert "SHAPE_LEGS_APP_ID" in hint and "SHAPE_LEGS_APP_PRIVATE_KEY" in hintsplittests/test_openreposhape_command.py:734S9073 →assert "gh api" in body and "curl -fsSL" in bodysplittests/test_setup_project_py.py:1054S9073 →assert command.strip() and command.isascii()splittests/test_setup_sh.py:168S9073 →assert "git " in out and re.search(...), outsplit, message kept on bothtests/test_update_shape_add.py:459S9073 →assert ADDED not in checked.stdout and ADDED_SCRIPT not in checked.stdoutsplitFor S8997, each site now takes the
monkeypatchfixture and callsmonkeypatch.syspath_prepend(str(REPO / "scripts"))in place of the manualsys.path.insert(0, ...), so pytest restoressys.pathat teardown insteadof the entry leaking into later tests:
tests/test_family.py:183S8997 →test_init_copies_the_siblings_utility_and_the_makefile_targettakesmonkeypatchtests/test_family.py:207S8997 →test_init_writes_the_holders_agent_filestakesmonkeypatchtests/test_family.py:243S8997 →test_the_holder_says_what_its_bytes_aretakesmonkeypatchtests/test_scaffold_e2e.py:688S8997 →test_the_shape_pin_records_the_openreposhape_committakesmonkeypatchtests/test_scaffold_e2e.py:716S8997 →test_the_pinned_agent_file_is_byte_identical_to_the_templatetakesmonkeypatchtests/test_scaffold_e2e.py:814S8997 →test_the_default_visibility_is_privatetakesmonkeypatchtests/test_scaffold_e2e.py:841S8997 →test_internal_visibility_is_acceptedtakesmonkeypatch(the call sits mid-test, after an unrelatedrun_script)tests/test_scaffold_e2e.py:897S8997 →test_the_scaffolded_root_says_what_its_bytes_aretakesmonkeypatchConverting all 5 sites in
tests/test_scaffold_e2e.pyleftimport sysunused there (nothing else in the file touched
sys), so that import lineis removed.
tests/test_family.pykeepsimport sys— it still has onemodule-level
sys.path.insertoutside any test function (not in scope foreither rule, since it runs once at import time, not per test).
No digest-pinned file (
scripts/repo_shape.py,scripts/validate-repository-naming.py,contracts/repository-naming.yaml,the
templates/assembly-root/ortemplates/family-root/scripts) wastouched — everything here is under
tests/.tests/test_naming_policy.pyis untouched: another lane in this fan-outowns it.
How it was proven
python3 -m py_compileon all nine changed files, clean.Full suite, foreground, from this worktree:
timeout 1200 python3 -m pytest tests -q -p no:cacheprovider— 984 passed, 1 skipped, 1 failed in8m40s. The one failure is the known pre-existing, machine-dependent flake
called out in the fan-out brief, untouched by this PR:
tests/test_naming_policy.py::test_cli_reports_an_unread_link_as_a_warning_and_still_classifies.No other test regressed.
No tool's
--helptext changed, soscripts/render-cli-reference.pyandtests/test_cli_reference.pywere not re-run.🤖 Generated with Claude Code
Summary by Sourcery
Improve test isolation and failure diagnostics across the test suite.
Bug Fixes:
Enhancements:
Tests:
Chores: