Repository navigation
Description
Goal: #949's three leftovers are closed in one change: a row that fails if step (4) joins a relative SHAPE_PIN_SOURCE_<LINK> to any folder but the standard's checkout, LinkSources.__init__ back under SonarCloud's cognitive complexity of 15, and a hand-typed --link-remedy whose owner part holds = read for the link it names.
Filed by lane openRepoShape-3, from lane 4's RV949 re-check of #949 at ced3d7c2 (its SHOULD-3, NIT-8 and the optional tightening, comment 6254587539), on #949.
State. #949 LANDED while this was being drafted: squash a19d69cb4, merged 2026-10-19T11:49:51Z, with its head still ced3d7c2. So this is read at origin/main ae63d450, and setup-project.py, scripts/validate-repository-naming.py, tests/test_setup_project_py.py and tests/test_chain_remedy_callers.py there are byte-identical to ced3d7c2 (git diff --quiet ced3d7c2 HEAD -- <file> for each). Every file and line below is main's, and is the reviewed head's.
The three items:
- SHOULD-3, mutant NJ.
pin_sources_joined(shape_root, env)(setup-project.py:2554) joins each non-emptySHAPE_PIN_SOURCE_*toshape_rootwithos.path.join(str(shape_root), value)(:2572);check_namescalls it with the standard's checkout (:2650). The rowtest_step_four_reads_a_relative_variable_where_step_five_does(tests/test_setup_project_py.py:3255, itsrun_entrycall at:3281-3287) starts setup withrun_entry, whose working folder isREPO, the standard's checkout, unlesscwd=is passed (:110). So the folder setup starts in and the standard's checkout are one folder in the row. The unit testtest_only_a_pin_source_variable_that_names_a_path_is_joined(:3301) callspin_sources_joined(REPO, ...)in process, and pytest's working folder is alsoREPO. A person who runs setup from another folder is the case no test holds. - NIT-8,
python:S3776.LinkSources.__init__(scripts/validate-repository-naming.py:278-358) gained the--link-remedyloop (:302-312). SonarCloud's bot comment on setup-project.py and validate-repository-naming.py: step (4) reads and names what step (5) does,--link-remedyreads a link holding=, strips its words and notes an unused one, and the Windows hand clone passes-c core.autocrlf=false(#907, #926) #949 of 2026-10-18T19:19Z reported "1 New issue" with the quality gate passed, and RV949 names it:python:S3776, CRITICAL, at:278, "Refactor this function to reduce its Cognitive Complexity from 19 to the 15 allowed". By the rule's counting the loop costs 4 (thefor, theifone level in, and itsand), so the function stood at 15 before it. I could not run Sonar here (the sonarqube MCP did not connect) and did not check whether the issue is open on main after the merge; the figure is the bot's and RV949's. - Optional tightening.
LinkSources._read_remedy(:360-384) reads a--link-remedyvalue at its LAST=that leaves a chain link before it and words after it, takingrepo_basenameof the text before that=(:376-382).repo_basenamekeeps what follows the last/, soopenXdox=a/openYdox=bis read as the linkopenYdoxwith the wordsb.
What happens. Measured on a detached clone at ae63d450, a stub gh (exit 97) first on PATH, GH_TOKEN=bogus, an empty GH_CONFIG_DIR, GIT_SSH_COMMAND=false, /usr/bin/python3 -m pytest -q -p no:cacheprovider --basetemp=<scratch>/bt -o tmp_path_retention_policy=failed.
NJ (os.path.join(str(shape_root), value) changed to os.path.join(os.getcwd(), value) at setup-project.py:2572):
-k "test_step_four_reads_a_relative_variable_where_step_five_does or test_only_a_pin_source_variable_that_names_a_path_is_joined"
unmutated: 3 passed, 245 deselected
NJ: 3 passed, 245 deselected <- the mutant survives
the row's run_entry call given cwd=tmp_path:
unmutated 3 passed
NJ 2 failed ([verified], [breaking]), 1 passed
The one test that still passes under NJ is the unit test. A shape_root other than the working folder would fail it too. The files were put back with git checkout and setup-project.py checked by its sha256 (4acf81df..., the digest RV949 gave).
The remedy reading, by calling LinkSources([], <chain>, remedies=[<value>]) on main and on a copy of the gate with the tightening below:
value chain at main with the tightening
openXdox=a/openYdox=b openXdox, openYdox, openInk openYdox: b openXdox: a/openYdox=b
opensoft/open=y=words opensoft/open=y, openInk open=y: words open=y: words
open=y=words open=y, openInk open=y: words open=y: words
Through the gate end to end, --link-remedy=openXdox=a/openYdox=b: main before #949 (cf66102f) read it at the first = and gave openXdox the words (a/openYdox=b); main now gives openYdox the words (b) and leaves openXdox the gate's own. RV949 accepted that side effect (it happens only by hand: setup's words never hold =), and noted the tightening as optional.
Evidence.
- The three measurements above, and the lines.
- RV949's comment: SHOULD-3 ("the rows cannot tell the standard's checkout from the folder setup was started in"), NIT-8, and "The side effect you asked me to rule on: ACCEPTED".
scripts/validate-repository-naming.pyis a pinned copy (setup-project.py and validate-repository-naming.py: step (4) reads and names what step (5) does,--link-remedyreads a link holding=, strips its words and notes an unused one, and the Windows hand clone passes-c core.autocrlf=false(#907, #926) #949's body names the rowupstream-changed scripts/validate-repository-naming.py, digest0ee8e794at the merged head), so NIT-8 and the tightening re-pin every project once. The setup-project.py test change does not.
Direction.
- SHOULD-3. Add
cwd=tmp_pathto the row'srun_entrycall (tests/test_setup_project_py.py:3281-3287). In the unit test, pass ashape_rootthat is not the working folder (for exampletmp_path) and expectos.path.join(str(tmp_path), relative). Skip the row whereos.path.relpathraises, as it does now. - NIT-8. Move the remedy loop into a method,
_read_remedies(remedies), that fillsself.remedies,self.remedy_readingandself.remedy_replaced;__init__calls it once. A prototype of that move (the loop lifted whole), made together with the tightening below, kepttests/test_chain_remedy_callers.pyat 50 passed (run on theced3d7c2tree, which is main's). Recount the complexity with Sonar, not by hand. - Tightening. In
_read_remedy's loop, skip a candidate whose text before its last/holds=(owner = typed[:at].rpartition("/")[0]; take the candidate only when"=" not in owner). Prototype: the table's right-hand column, andtests/test_chain_remedy_callers.py50 passed with it and the move together. An owner is never spelled with=, soopensoft/open=y=wordsstill reads right. - setup-project.py and validate-repository-naming.py: step (4) reads and names what step (5) does,
--link-remedyreads a link holding=, strips its words and notes an unused one, and the Windows hand clone passes-c core.autocrlf=false(#907, #926) #949 has landed, so this is a change of its own. Do NIT-8 and the tightening in one change to the gate, so the pinned copy re-pins once.
Verify.
- Under NJ the row fails (2 failed) and unmutated it passes; the unit test, given a
shape_rootthat is not the working folder, fails under NJ too, since NJ ignoresshape_root. Re-make NJ, and keep the sha256 ofsetup-project.pybefore and after. tests/test_setup_project_py.py -k "relative_variable or only_a_pin_source_variable"passes.LinkSources.__init__no longer appears in SonarCloud's new issues on the pull request.tests/test_chain_remedy_callers.pyandtests/test_pinned_copy_text.pypass; a new row holdsopenXdox=a/openYdox=bgivingopenXdoxits words, and one holdsopensoft/open=y=words.tests/test_cli_reference.pypasses if the help text changes; one file at a time under a stubgh.
Size: S.
Lane: openreposhape-3 (openRepoShape-3)
Activity
brettheap commentedon Oct 19, 2026
CLAIMED — lane openRepoShape-3, session b30e8b49-f249-4668-adb1-1dbfa93c09e1@Eagle, 2026-10-19T19:02:58Z, for #991
Logged in
lanes/log/openRepoShape-3.mdat3419225f19105daf9b999345e98c3a01d3944c6d.The three reads (lane-collision-protocol Rule 1):