From 90120676fd7ec3f4be0079830346fe134b65d000 Mon Sep 17 00:00:00 2001 From: Brett Heap Date: Tue, 10 Nov 2026 09:08:14 +0000 Subject: [PATCH 1/2] 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) `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 --- tests/test_update_shape_pin_source.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/test_update_shape_pin_source.py b/tests/test_update_shape_pin_source.py index 3b29edb9..afe3189f 100644 --- a/tests/test_update_shape_pin_source.py +++ b/tests/test_update_shape_pin_source.py @@ -431,6 +431,13 @@ def opening(spec, *_pin_path): return real(str(upstream_and_project["upstream"])) monkeypatch.setattr(update_shape, "open_upstream", opening) + # THIS PROCESS READS `LANES_LANE`, THE SUBPROCESS BELOW DOES NOT (#1299). + # `update_shape.main` prints its NEXT through `lane_trailer_argument`, + # which reads this process's environment, where conftest's `run` hands + # the child a blank lane. In a shell that exports one, only the in-process + # NEXT ended `--trailer 'Lane: '`, and the two answers differed by + # that alone. Unset is no lane, as the blank is: the two read the same. + monkeypatch.delenv("LANES_LANE", raising=False) code = update_shape.main(["check", "--root", str(root)]) out = capsys.readouterr().out passed = run(root, "check", *upstream_of(upstream_and_project)) From 64154fe858787f345847c4ce68c46b4a38c858a5 Mon Sep 17 00:00:00 2001 From: Brett Heap Date: Tue, 10 Nov 2026 10:41:41 +0000 Subject: [PATCH 2/2] test_update_shape_pin_source.py: the comment on the row's `delenv("LANES_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 --- tests/test_update_shape_pin_source.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/test_update_shape_pin_source.py b/tests/test_update_shape_pin_source.py index afe3189f..8dbc229b 100644 --- a/tests/test_update_shape_pin_source.py +++ b/tests/test_update_shape_pin_source.py @@ -431,12 +431,15 @@ def opening(spec, *_pin_path): return real(str(upstream_and_project["upstream"])) monkeypatch.setattr(update_shape, "open_upstream", opening) - # THIS PROCESS READS `LANES_LANE`, THE SUBPROCESS BELOW DOES NOT (#1299). + # THIS PROCESS READS `LANES_LANE`, THE CHILD READS A BLANK (#1299). # `update_shape.main` prints its NEXT through `lane_trailer_argument`, - # which reads this process's environment, where conftest's `run` hands - # the child a blank lane. In a shell that exports one, only the in-process - # NEXT ended `--trailer 'Lane: '`, and the two answers differed by - # that alone. Unset is no lane, as the blank is: the two read the same. + # which reads this process's environment. This module's `run` goes + # through `conftest.run_script`, which blanks the child's lane. In a + # shell that exports one, only the in-process NEXT ended + # `--trailer 'Lane: '`, and the two answers differed by that + # alone. Unset is no lane, as the blank is: the two read the same. 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. monkeypatch.delenv("LANES_LANE", raising=False) code = update_shape.main(["check", "--root", str(root)]) out = capsys.readouterr().out