Repository navigation
test_update_shape_pin_source.py: the row that compares an in-process check with a subprocess one unsets LANES_LANE in its own process, as run blanks it for the child, so a lane in the shell no longer puts a --trailer on one answer (#1299) - #1303
brettheap wants to merge 2 commits into
Conversation
…`check` with a subprocess one unsets `LANES_LANE` in its own process, as `run` blanks it for the child, so a lane in the shell no longer puts a `--trailer` on one answer (#1299) `test_a_pin_as_scaffolded_hands_its_owner_repo_to_open_upstream` (#1269) asserts that `update_shape.main(["check", ...])`, run in this process, and the same `check` run through conftest's `run` give one `(code, stdout)`. The child's `LANES_LANE` is blanked by `run` ("THE LANE IS NOT INHERITED"); this process's is not, and `apply_command` reads it through `lane_trailer_argument`. With `LANES_LANE=openRepoShape-5` exported, only the in-process NEXT line ended `--trailer 'Lane: openRepoShape-5'`, so the row failed in any local run inside a lane, and CI, which sets none, stayed green. `monkeypatch.delenv("LANES_LANE", raising=False)` before `main(...)` puts this process where a shell outside a lane is, and where the blank the child gets reads the same (`lane_trailer` reads an unset or empty value as no lane), so the two answers are the one answer whether or not the variable is set. monkeypatch restores it after the row. No production file changes. Closes #1299 Lane: openreposhape-5 (openRepoShape-5) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Reviewer's GuideTestsUnset
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Independent review of #1303 (#1299) for lane openRepoShape-5, by rv1303 (opus), at 9012067: READY #1303 is one commit, FindingsMUST: none. SHOULD: none. NIT 1 (the code comment), two loose phrases.
NIT 2 (PR body, "What changed"). The body says conftest's
NIT 3 (PR body, "Survey"). The body says the trailer functions "are named in fifteen test files". I could not reproduce that: Judgements1. Against #1299's Goal and Verify list (module of 36 ids; every failure is the target row):
With the guard removed, a 2. The choice of fix.
3. The survey's claim that no other row fails because of the variable.
4. Mutants (module alone, git 2.43.0, lane runner / plain runner; each restored by sha256, tree clean after each):
5. Gates (head
6. Merge-trees (git 2.47.1,
7. The record.
Context: at about 10:27Z, CI's Logs and scripts are in Lane: openreposhape-5 (openRepoShape-5) |
…NES_LANE")` names the child's runner as this module's `run` through `conftest.run_script` and says the child reads a blank lane, not none (#1299) rv1303's review of #1303 (issuecomment-6765193590) found two loose phrases in the comment above `monkeypatch.delenv("LANES_LANE", raising=False)`, and this round changes that comment and nothing else: - it said conftest's `run`, and conftest has no `run`: the module's own `run` calls `conftest.run_script`, which blanks the child's lane ("THE LANE IS NOT INHERITED"); - it said the subprocess does not read the variable, and it does: through the same `lane_trailer`, it reads a blank. It now also says that with the guard in place the child gets no lane even without that blank, because `run_script` copies `os.environ` after the guard has run. Comments only: `ast.dump` of the file is equal before and after, and the diff holds `#` lines alone. The module is 36 passed under run10.sh and under run10-lane.sh, on git 2.43.0 and on git 2.47.1. Lane: openreposhape-5 (openRepoShape-5) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|



Goal
tests/test_update_shape_pin_source.py::test_a_pin_as_scaffolded_hands_its_owner_repo_to_open_upstream(added by #1269) passes in any environment, whether or notLANES_LANEis set. Test only: no production file changes.On main
0354a7e70it failed in every local run whereLANES_LANEwas exported (a shell inside a lane), and CI, which sets none, stayed green. Nothing a user sees was wrong: this is a test that depended on the environment it ran in (found by lane 3's gate of #1281, #473 issuecomment-6762880003).What held on main
The row compares
update_shape.main(["check", "--root", ...]), run in this process, with the samecheckrun as a subprocess through this module'srun, which callsconftest.run_script, and asserts the two(code, stdout)pairs are equal.conftest.run_scriptblanksLANES_LANEfor the child ("THE LANE IS NOT INHERITED").cmd_checkprints itsNEXTthroughapply_command, which ends inlane_trailer_argument(shlex.quote), and that reads this process's environment.LANES_LANE=openRepoShape-5, the in-processNEXT apply ... --branch shape/update-<sha>line ended--trailer 'Lane: openRepoShape-5'and the subprocess's did not.Measured at
0354a7e70(stubghfirst on PATH,GH_TOKEN=bogus, an emptyGH_CONFIG_DIR,GIT_SSH_COMMAND=false,GIT_CONFIG_GLOBAL=/dev/null):LANES_LANEopenRepoShape-5--traileralone)What changed
tests/test_update_shape_pin_source.py, in that one row:monkeypatch.delenv("LANES_LANE", raising=False)beforeupdate_shape.main(...), with a comment that says why. Seven lines, no other file.delenv, notsetenv("LANES_LANE", ""). Both read as no lane (lane_trailerreadsstr(env.get("LANES_LANE") or ""), so unset and empty are the same), and the equivalent form passes in the same runs (mutant M4 below).delenvis the state of a shell that is in no lane, which is the state the row's expectation describes; the empty string is whatconftest.run_scriptwrites into the child's environment, and conftest's own reason (inblank_unnamed_pin_sources) is a convention:""rather than a deleted key matches howlane_traileralready reads an emptyLANES_LANEas no lane.raising=Falsekeeps the row quiet where the variable was never set, and monkeypatch puts the shell's value back after the row.Rows
One row changed, none added. It fails at main's test file with
LANES_LANEset (above) and passes at this head with it set or unset: the module is 36 passed under both runners, on git 2.43.0 (the mutant runs below,head).Survey: every other row that could fail the same way
Which tools print a lane trailer:
scripts/shape_materialize.pydefineslane_trailerandlane_trailer_argument, andgrep -n 'lane_trailer\|lane_trailer_argument' scripts/*.py *.pyfinds two tools that call them:update-shape.py(apply_command, theNEXTofcheck) andshape-doctor.py(lane_trailer_command: theshape currencyrow'swhy, twice, andbump_leg_command'skeep_gitlinkandkeep_pin). No template script readsLANES_LANE.Which rows reach them in this process:
update_shape.main(is called in six files (test_update_shape_landing.py4 times,_unreadable3,_messages,_partial_rollback,_pin_sourceand_pr_baseonce each), and the doctor'smodule.main(intest_doctor_unreadable_paths.py;bump_leg_command,apply_command,lane_trailer*andcmd_checkare named in nine test files (whatgrep -lE 'bump_leg_command|apply_command|lane_trailer|cmd_check' tests/*.pyfinds at the head,tests/conftest.pycounted; eight at main0354a7e70, the ninth being this row's own comment). Every other in-processmain(intests/(adopter,scaffold,family,bump-leg, the validators, the CLI reference generator) belongs to a tool that prints no trailer.Rather than trust the grep, every file that could matter was run with
LANES_LANE=openRepoShape-5exported, on main0354a7e70, git 2.43.0, in runs of at most 100 ids:test_update_shape*.py,test_doctor*.pyandtest_bump_leg*.py, plustest_shape_doctor.py,test_commit_trailers.py,test_git_bash_dialect.py,test_family.py,test_family_dry_run.py,test_cli_reference.py,test_readme_windows_quoting_sentence.py,test_tracking_branch_ref.py,test_repo_hygiene.py,test_scaffold_e2e.py,test_adopt_entry_paths.py,test_path_guard_hygiene.pyandtest_no_auto_maintenance.py: 3829 passed, 15 skipped, 1 failed: this row.update-shape.pyorshape-doctor.pyin-process or namesLANES_LANE(thetest_adopt_*,test_scaffold_*,test_family_*,test_chain_*,test_pin_*,test_pinned_*,test_validate_*and similar files): 5369 passed, 7 skipped, 2 failed. The two aretest_ruleset_hint_tracking_branch.py::test_the_hint_names_one_exit_and_taking_it_finishes_the_run[adopt-extracted-trunk]and[adopt-seeded-trunk], which assert thatmainis not in the hint, and the hint prints the run's basetemp path, which carriedmainin its name (n1299-sv2-main-lane). Run again at a neutral basetemp name, both pass under the lane runner and the plain one.So this is the only row that fails because of the variable; no other file changes. The rows that do ask for a lane (
test_commit_trailers.py,test_update_shape_next_quoting.py,test_doctor_gitlink_repairs.pysince #1081,test_shape_doctor.py) set it themselves and held under the exported variable.Mutants
Applied alone in a detached tree at main (
n1299-mut) with this head's test file, module of 36 ids under each runner, git 2.43.0, restored by sha256 (the tree's file is main's blob again,7bff19aa..., tree clean):LANES_LANE=openRepoShape-5delenvline removeddelenv("LANES_LANES")(a wrong name)delenvmoved aftermain(...)setenv("LANES_LANE", "")(lane 3's form)setenv("LANES_LANE", "openRepoShape-9")M1 to M3 are killed by the lane runner alone and pass without it, which is why CI never saw the row fail. M4 survives and is meant to: it is the same state as
delenvas far aslane_trailercan tell. M5 shows the row does compare the trailer: a lane named in this process and not the child's is a difference it catches.Runs
run10.sh(the lane's runner) unsets everyLANES_*variable before pytest, since lane 4's #1060, which is why this row's defect never showed in a lane's own gates.run10-lane.shis that runner with the one line replaced byexport LANES_LANE=openRepoShape-5.At head
90120676f, 24 runs of at most 100 ids each per row below (19 files, 1677 ids:tests/test_update_shape_pin_source.py; the files that callupdate_shape.main(or the doctor'smain(in this process; the files that name a trailer function; and the hygiene five withtests/test_no_auto_maintenance.py). git-filter-repoa40bce548d2c(2.47.0, CI's pin) on every run.LANES_*variable)LANES_LANE=openRepoShape-5)LANES_*variable)LANES_LANE=openRepoShape-5)The 19 files:
test_update_shape_pin_source36,test_update_shape_landing74,test_update_shape_messages27,test_update_shape_partial_rollback22,test_update_shape_pr_base29,test_update_shape_unreadable56,test_update_shape90,test_update_shape_next_quoting49,test_commit_trailers158,test_doctor_gitlink_repairs23,test_doctor_unreadable_paths132,test_shape_doctor449,test_git_bash_dialect93, and the hygiene five and the maintenance rowtest_path_guard_hygiene121,test_repo_hygiene101,test_agents_md_codes47,test_cli_reference23,test_pinned_copy_text87,test_no_auto_maintenance60.Skips (each the same on every row of the table):
tests/test_no_auto_maintenance.py:222(2): the session began with GIT_CONFIG_GLOBAL set, and its file includes that onetests/test_shape_doctor.py:10516(3): the PowerShell line is printed, and powershell.exe exists, only on a Windows hostMerges
git merge-tree --write-tree(git 2.47.1), the new head64154fe85(one commit on90120676f, which was made on main0354a7e70) with:b607223b4, fetched fresh at 10:41:56Z and again at 10:43:38Z, stillb607223b4: clean, tree17b162ea4. That tree differs from main's intests/test_update_shape_pin_source.pyalone (10 added lines) and keeps the head's blob8dbc229bd. The three commits main gained since the base (adopt-project.py:plan-wrong-kind,plan-unsupported-mode,plan-bad-legandplan-bad-idsay a plan value that is not text as_read_assays what the plan's reader read,kind is the number 7anddeclares leg a list of 2 item(s)wherereprspelled it7,Trueand['a', 'b'], and a plan with nokind:ormode:line saysabsentwhere it saidNone(#1199) #128134eb466e7, tests: under a Latin-1 locale 12 of the 13 rows of #1259 skip on their own premise or read their UTF-8 file as UTF-8, and the 13th, the assembly root bootstrap.py saying it could not create a branch it made, is left failing for its own issue (#1259) #12785f06c3eb6, validate-manifest.py and validate-family.py: a line feed, or a character that does not print, in a value no pattern reads is refused by that key's code where it wasmanifest okorfamily ok, and the five keys a person types keep #255's rule (#1205) #1282b607223b4) touchadopt-project.py,templates/assembly-root/scripts/validate-manifest.py,templates/family-root/scripts/validate-family.py,tests/conftest.py(35 lines: one new helper,scalar_lines_not_refused),tests/test_adopt_plan_values_read_as.py,tests/test_bootstrap_spelling.py,tests/test_family.py,tests/test_manifest_validator.pyandtests/test_pinned_copy_text.py: nothing this change or the row's tools touch. The predicted merge (36f43fcc7, unreferenced) runstests/test_update_shape_pin_source.pyas 36 passed underrun10.shand 36 passed underrun10-lane.sh, git 2.43.0 (runsn1299b-pm-plainandn1299b-pm-lane). At the base itself the merge-tree is clean too (treebc7d629c9).--, so a root file namedHEADno longer stopsexecutewith exit 128 before that leg is pushed, nor blanks whatapply --branchsays it committed (#1215) #1294ce9fbee6e: clean. repo_shape.py, path_classify.py, bump-leg.py, validate-repository-naming.py, update-shape.py and the root's validate-manifest.py: not-a-mapping and wrong-kind refusals name the file asshown_pathdoes, so no U+202E, ESC or line feed is raw (#1279) #128486ab76db4: clean. Neither touches the test file.--work-dirrow skips and the two U+00E9 rows read the child's UTF-8, so none of the three fails on a tool that is right, and the bytes helper starts its child asrun_scriptdoes (#1196) #120913a2c58cb(touchestests/conftest.py): conflicts intests/test_adopt_plan_paths_spelled.py(add/add). It conflicts the same way with main alone, so this change does not cause it.No open PR but this one touches
tests/test_update_shape_pin_source.py(27 open PRs, files read withgh pr list --json files, at 10:41Z).The round after rv1303's review
rv1303 found this PR READY at
90120676f(#1303 issuecomment-6765193590) and left three NITs, all wording. This round takes all three in one commit,64154fe85, on90120676f, pushed as a fast-forward. It changes no code and no row.run(conftest has norun: this module's ownruncallsconftest.run_script) and said the subprocess does not readLANES_LANE(it reads a blank, through the samelane_trailer). It now says that this module'srungoes throughconftest.run_script, which blanks the child's lane; that the child reads a blank; and that with the guard in place the child gets no lane anyway, becauserun_scriptcopiesos.environafter the guard has run (rv1303's mutant M7: with conftest's blank removed, the row still passes).run_scriptcannot delete a key, was wrong. The text now gives conftest's own reason: a convention that matches howlane_trailerreads an empty value as no lane.grep -lEnamed there finds,tests/conftest.pycounted. The survey's conclusion does not depend on the count.The round is comments only:
ast.dumpoftests/test_update_shape_pin_source.pyis equal before and after (the dump's sha256 is31ddf9aa6a5ffor both).git diff 90120676f 64154fe85is 8 added and 5 removed lines, every one a#comment line, in that one file. Its blob goes fromafe3189f9to8dbc229bd.The module alone (36 ids), with the new head's file in the tree (sha256
fb70dc334de1, the committed blob's), run namesn1299b-...:LANES_*variable)LANES_LANE=openRepoShape-5)LANES_*variable)LANES_LANE=openRepoShape-5)None skipped. The gates of the Runs section above were run at
90120676f, and the new head differs from it by those comments alone.Closes #1299
Lane: openreposhape-5 (openRepoShape-5)
🤖 Generated with Claude Code
Summary by Sourcery
Bug Fixes: