Repository navigation
tests/test_scaffold_pin_and_reuse.py: the two descendant scaffold tests run the scaffolded project's validate-pins.py with --pin-source for the stand-in they pinned and assert the digest recomputes, so neither reaches a real gh api nor passes on a skipped digest (#272) - #274
Conversation
…ts run the scaffolded project's validate-pins.py with --pin-source for the stand-in they pinned and assert the digest recomputes, so neither reaches a real gh api nor passes on a skipped digest (#272) `validate-pins.py` resolves a neutral pin's source from four places and no other (`resolve_neutral_pin_source`): `--pin-source <product>=<path>`, `SHAPE_PIN_SOURCE_<PRODUCT>`, a checkout beside the assembly root named for the pinned repository, and a bare `--pin-source`. The two descendant scaffold tests ran the scaffolded project's `validate-pins.py` with no arguments and met none of them: `run_script` blanks every `SHAPE_PIN_SOURCE_*` the caller did not name, the stand-in sits at `tmp_path/<product>` and not beside `work/<Project>`, and the loop passed `[]`. So it fell to `tree_digest_from_gh`, a real `gh api repos/opensoft/<product>/git/trees/<sha>?recursive=1` whenever a `gh` is on PATH, and a failed read is a `skip` line with exit 0: the tests passed on a digest nobody rechecked and depended on the operator's `gh` login and network, against tests/conftest.py's "NO NETWORK AND NO GITHUB". The `validate-pins.py` row of each loop now passes `--pin-source openGlass=<stand-in>` and `--pin-source openXdox=<layer>`, the spelling `test_a_neutral_product_root_may_also_pin_a_neutral_product` already used. The naming and manifest validators keep their arguments, and the second test's `declared-unverified` assertion on them is unchanged. A new helper, `assert_pin_digest_recomputed`, asserts that stdout carries `<product>: pin commit <sha12> digest recomputes` and no `skip <product>:` line, with a message saying the digest must be recomputed from the stand-in, never skipped; the exit code cannot tell the two apart, so the tests now fail if the source stops being found. Evidence, with a `gh` shim that logs argv and exits 97 first on PATH: main's bytes log two `api repos/opensoft/openGlass/...` and `.../openXdox/...` lines and both tests pass; these bytes log none and pass, and dropping the new `--pin-source` from either test turns only that test red, on the new assertion. A suite-wide guard against any test reaching `gh` (the issue's decision 2) is not part of this change. Lane: openreposhape-4 (openRepoShape-4) Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
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 16 hours and 7 minutes by commenting |
Reviewer's GuideThe two descendant scaffold tests now point validate-pins.py at the stand-in repositories they pinned and assert the validator actually recomputes each digest, preventing false-positive passes caused by skipped checks or unintended GitHub API access. File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
…, #272 via #274, #205 via #232) into fix/adopt-record-submodule-placement Brings in 23e16ae (#251), 60588d5 (#206), 018ce0d (#207), 67a398a (#272) and d94d155 (#205) on top of 5751460. No rebase. The first four change none of this branch's files. d94d155 changes shape-doctor.py and tests/test_shape_doctor.py, as this branch does. One conflict, in shape-doctor.py's module docstring, under EXIT CODES. Both sides added a clause to exit 1's list of findings: #205 "a manifest is there and does not load", and #189 "or, for a submodule, a leg other than the one `project.yaml` records for it". Both are kept: #205's in its place in the list, and #189's after the path-policy clause it qualifies. Only the docstring's first line reaches `--help`, so docs/cli.md is unchanged. Merged without a conflict, and checked: - `check_placement`: #205 adds its `waiting_row` gate after the family-holder return and before `ctx.legs()`. The merged function is this branch's plus exactly those eight lines. So a `project.yaml` that does not load makes the placement row `n/a`, waiting on the `manifest` row, before the record is read. The record is read from `ctx.manifest`, which #205 now loads once, with the same `load_yaml`, so a manifest that loads gives the record it always gave. - #205 removes `Context._declares`, and nothing on this branch names it. This branch leaves `placement_row` unchanged, and #205's gate calls it as (NA, reason, None, detail). - No top-level name is bound twice in adopt-project.py, scaffold-project.py, scripts/repo_shape.py, scripts/shape_materialize.py, shape-doctor.py, validate-manifest.py or update-shape.py. Each merged module's names are the base's plus what either side added. Every definition only one side changed is that side's text. The two that both changed are the docstring above and `check_placement`. - These commits leave adopt-project.py, scripts/repo_shape.py and scripts/shape_materialize.py untouched. So the record's writer and reader are the ones the round trip and the revert table ran on at a01ab02, and the record is still spelled by `double_quoted`. - AGENTS.md is untouched: 472 lines, under the cap of 472. - The branch's diff against main is still #189 alone: 12 files, +1670 -157. The one deletion more than against 5751460 is the EXIT CODES sentence above, which now rewraps two of #205's lines. Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…, #205, #215, #241 and #249/#250 merge with no conflict, and `_entry_findings` still hands `_leg_findings` the tree and ends with the root-symlink findings origin/main moved 60588d5 -> b30595c while the targeted runs of 8f624aa went: 018ce0d (#207 via #222), 67a398a (#272 via #274), d94d155 (#205 via #232), c2ff2b0 (#215 via #240), c3a9645 (#241 via #256) and b30595c (#249 and #250 via #284). It is merged again because c2ff2b0 changes adopt-project.py and b30595c changes scripts/shape_materialize.py's `render`. Conflicts: none. `git merge-tree --write-tree` gave tree be093a5, and the merge stages the same tree. Checked on that tree: - `_entry_findings` still calls `_leg_findings(plan, tree)` and ends with `_root_symlink_findings(plan, source, tree)`. - No top-level name is bound twice in adopt-project.py, scaffold-project.py, scripts/repo_shape.py or scripts/shape_materialize.py, none is loaded but bound nowhere (AST), and main changed the signature of no function this branch calls. - Both sides are intact by +/- line sets: each side's change against the merge base 60588d5 reappears, line for line, against the other side. - c2ff2b0 adds helpers to tests/conftest.py (`planned`, `GITLINK`, `findings` and others) and no fixture. tests/test_adopt_root_symlinks.py imports its conftest names one by one and none of these, so its own `planned` and `GITLINK` are unaffected. - b30595c's `render` spells a double-quoted YAML value with `double_quoted`; this branch's walker reads `assembly_root_paths()` and never renders. Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Opus 5.5 <[email protected]>



Lane: openreposhape-4 (openRepoShape-4)
Claim: #272 (comment)
Summary
test_a_declared_descendant_scaffolds_with_legs(openGlass) andtest_a_descendant_that_pins_a_layer_scaffolds_through_the_chain(openXdox) ran the scaffolded project's ownscripts/validate-pins.pywith no arguments.validate-pins.pyfinds a neutral pin's source in four places and no other (resolve_neutral_pin_source):--pin-source <product>=<path>,SHAPE_PIN_SOURCE_<PRODUCT>, a checkout beside the assembly root, a bare--pin-source. The tests met none of them (run_scriptblanks everySHAPE_PIN_SOURCE_*the caller did not name, the stand-in sits attmp_path/<product>, and the loop passed[]), so it fell totree_digest_from_gh, a realgh api repos/opensoft/<product>/git/trees/<sha>?recursive=1whenever aghis on PATH. A failed read is askipline with exit 0, so both tests passed on a digest nobody rechecked and depended on the operator'sghlogin and network, againsttests/conftest.py's "NO NETWORK AND NO GITHUB".This change touches
tests/test_scaffold_pin_and_reuse.pyonly:validate-pins.pyrow of each loop passes--pin-source openGlass=<stand-in>/--pin-source openXdox=<layer>, the spellingtest_a_neutral_product_root_may_also_pin_a_neutral_productalready used. The naming and manifest validators keep their arguments; the second test'sdeclared-unverifiedassertion on them is unchanged and still holds.assert_pin_digest_recomputed, asserts thatvalidate-pins.py's stdout carries<product>: pin commit <sha12> digest recomputesand noskip <product>:line, with a message saying the digest must be recomputed from the stand-in, never skipped. The exit code cannot tell a recompute from a skip; the stdout line can.Not in this change (the issue's optional decision 2): a suite-wide guard so no test can reach
ghunnoticed (a failingghshim inrun_script, or an autouse fixture). It touches every test on three OSes, and a Windows shim needs PATHEXT handling, so it is a possible follow-up.Closes #272
Evidence
A
ghshim first on PATH appends argv,PYTEST_CURRENT_TESTand the calling process to a log and exits 97. Command (two tests):pytest tests/test_scaffold_pin_and_reuse.py::test_a_declared_descendant_scaffolds_with_legs tests/test_scaffold_pin_and_reuse.py::test_a_descendant_that_pins_a_layer_scaffolds_through_the_chain -qapi repos/opensoft/openGlass/git/trees/<sha>?recursive=1andapi repos/opensoft/openXdox/git/trees/<sha>?recursive=1, both fromscripts/validate-pins.py--pin-sourcedropped from the openGlass row onlytest_a_declared_descendant_scaffolds_with_legs, onassert_pin_digest_recomputed), 1 passed--pin-sourcedropped from the openXdox row onlytest_a_descendant_that_pins_a_layer_scaffolds_through_the_chain, onassert_pin_digest_recomputed), 1 passedOver the committed head, with the same shim:
pytest tests/test_scaffold_pin_and_reuse.py tests/test_neutral_pin_validator.py tests/test_repo_hygiene.py -qgives 81 passed, 0 skipped, and the shim log is empty for all 81.CI's three OSes (
tests,tests-macos,tests-windows) are the gate; the new code adds no stdin, path-separator or shell handling beyond what the third test's--pin-sourcerow already carries.Summary by Sourcery
Make descendant scaffold pin validation deterministic and network-independent by supplying local pin sources and requiring digest recomputation.
Bug Fixes:
Enhancements:
Tests: