Repository navigation
Description
Lane: openreposhape-2 (openRepoShape-2)
What is wrong. tests/conftest.py::run_script (lines 100-101, before this
fix) starts every subprocess under test from a COPY of the calling process's
own environment:
asked = env or {}
env = {**os.environ, **asked}
#: THE LANE IS NOT INHERITED (Copilot, PR #112). ...
if "LANES_LANE" not in asked:
env["LANES_LANE"] = ""
env.setdefault("GIT_AUTHOR_NAME", "openRepoShape tests")PR #112 (merged as 3d3c155) added exactly one name to the "not inherited"
list: LANES_LANE, because it changes what update-shape.py check and
shape-doctor.py print. But scripts/repo_shape.py's resolve_link_source
(line 1460) reads a SECOND family of environment variables that changes tool
output the same way — SHAPE_PIN_SOURCE_<PRODUCT>
(PIN_SOURCE_ENV_PREFIX = "SHAPE_PIN_SOURCE_", line 784;
pin_source_env_name, line 787) — and rule 2 there reads it BEFORE rule 3,
the cwd-derived sibling checkout:
def resolve_link_source(product: str, root: Path | None = None, ...):
"""...
1. `--link-source <product>=<path>` (case-insensitive on the name)
2. `SHAPE_PIN_SOURCE_<PRODUCT>` in the environment
3. a checkout sitting BESIDE this project (`../openXdox`)
4. a bare `--link-source <path>` with no `product=` prefix
"""
...
env_name = pin_source_env_name(product)
env_value = os.environ.get(env_name)
if env_value:
candidates.append((Path(env_value), f"${env_name}"))None of these are blanked by run_script, so a developer shell or CI box
that happens to export e.g. SHAPE_PIN_SOURCE_OPENXDOX, pointed at a real
checkout that declares a pin, changes what any test under tests/ sees —
exactly the same class of exposure LANES_LANE's blanking already closed
for the lane name.
This is not hypothetical: PR #120 (merged as 8f72237) hit it directly.
Copilot flagged that
test_cli_reports_an_unread_link_as_a_warning_and_still_classifies
(tests/test_naming_policy.py) would false-pass or false-fail depending on
whatever SHAPE_PIN_SOURCE_OPENXDOX happened to be set to in the invoking
shell — reproduced live on this workstation, where ~/projects/openXdox
really does declare neutral_product_pins: [openDox] — and PR #120 fixed
it for that ONE test only, by giving it its own explicit
env={"SHAPE_PIN_SOURCE_OPENXDOX": str(no_such_checkout)} override
(commit c30d9f4). Both of PR #120's own review-thread comments
(2026-09-11T21:25:25Z and 2026-09-11T21:44:15Z) name the general fix as a
follow-up and say it was deliberately left undone there because
tests/conftest.py belonged to PR #112 that round:
A general rule in
run_scriptitself — blank everySHAPE_PIN_SOURCE_*
variable unless the caller names it inenv=— would close this whole
class of exposure for every current and future test at once. Not done in
this PR:tests/conftest.pyis owned by PR #112 this round. Filing that
follow-up is for after #112 lands.
and, after #112 landed and showed run_script's new LANES_LANE shape:
Generalizing that same
run_scriptmechanism to blank every
SHAPE_PIN_SOURCE_*variable unless the caller names it inenv=would
fold this test's local workaround into the one place that already carries
the identical pattern forLANES_LANE, and remove the need for any
future test to know to defend itself.
PR #112 has since landed (3d3c155) and gave run_script exactly that
LANES_LANE-blanking mechanism. This issue is the named follow-up: the same
mechanism does not yet exist for SHAPE_PIN_SOURCE_*, so every other test
in the suite that reaches resolve_link_source through run_script without
naming its own env= — today just the one PR #120 patched locally — is
still exposed, and any test written tomorrow that reaches it will be
exposed again unless its author remembers to defend itself individually.
What would fix it. Generalise run_script's existing LANES_LANE
blanking to a second rule, beside it: every environment variable inherited
from the calling process whose name starts with
repo_shape.PIN_SOURCE_ENV_PREFIX is blanked unless THIS call's own env=
names that exact variable — mirroring the LANES_LANE mechanism PR #112
already added a few lines above it, and importing the prefix from
scripts/repo_shape.py rather than re-spelling the string literal. PR
#120's own local env= override in
test_cli_reports_an_unread_link_as_a_warning_and_still_classifies becomes
redundant once the general rule exists and should be removed, with a
regression test in its place that proves the general mechanism directly
(monkeypatching the ambient variable to something that WOULD verify, and
asserting it still doesn't reach the child) plus a second test proving a
caller that DOES name the variable in its own env= still reaches it.
Activity
brettheap commentedon Sep 11, 2026
(lane openreposhape-2 (openRepoShape-2), 2026-09-11T22:15Z) CLAIMED — session 3b1ab8cf, on Brett Heap's word 'go, fan out on all of it'. Branch fix/conftest-blanks-pin-source-env, worktree ~/projects/openRepoShape--conftest-pin-source-env on Eagle, from origin/main bd6eaec. Scope: generalise tests/conftest.py::run_script's LANES_LANE blanking to a second rule that blanks every inherited SHAPE_PIN_SOURCE_* variable unless the caller's own env= names it, remove PR #120's now-redundant local override, and add proof tests for the general mechanism.
brettheap commentedon Sep 11, 2026
(lane openreposhape-2 (openRepoShape-2), 2026-09-11T23:20Z) PULL REQUEST OPEN: #128 (head 9a290f3).
tests/conftest.py: the pin-source blanking rule now folds names to up…
tests/test_naming_policy.py: the four tests that call link_pins_from_…
tests/conftest.py: the direct link_pins_from_trees tests now clear ev…
tests/conftest.py: clear_ambient_pin_sources folds case in its prefix…
brettheap commentedon Sep 12, 2026
(lane openreposhape-2 (openRepoShape-2), 2026-09-12T01:10:27Z) MERGED — #128 → 50d4078 (squash), on Brett Heap's word 'go, fan out on all of it, hold the doctor refactor'. tests/conftest.py::run_script blanks every inherited SHAPE_PIN_SOURCE_* variable unless the caller names it (prefix imported from repo_shape, case folded the way Windows environment names are, via one shared is_pin_source_name predicate), clear_ambient_pin_sources(monkeypatch) does the same for tests that call link_pins_from_trees in-process, #120's per-test override is dropped, mutation-tested proof tests added; five Copilot rounds taken, the last 'Approval recommended' with 0 findings; 1136 passed / 1 skipped by the agent's arithmetic, 1135 confirmed on the prior head. Object complete.