Repository navigation
chore(scripts): resolve ten of the twenty-one unreferenced infrastructure scripts (#15127) - #15144
Merged
Merged
Conversation
mrveiss
force-pushed
the
issue-15127-unreferenced-scripts
branch
from
August 26, 2026 16:32
aca59e8 to
167db9d
Compare
mrveiss
force-pushed
the
issue-15127-unreferenced-scripts
branch
from
August 26, 2026 17:54
167db9d to
2da1340
Compare
Closed
4 tasks
mrveiss
force-pushed
the
issue-15127-unreferenced-scripts
branch
from
August 26, 2026 19:09
2da1340 to
f5861ee
Compare
Contributor
✅ SSOT Configuration Compliance: Passing🎉 No new hardcoded values of either class — Known backlog in |
Closed
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thinking Path
21 scripts, and the instruction that matters is that the count is a trap. I resolved ten with
evidence and left eleven explicitly undecided rather than making 21 fast calls, so this is
Refs #15127, notCloses.The two flagged for special care both contradict the issue's stated premise.
git-askpass.sh— the issue says an askpass helper is invoked by assigningGIT_ASKPASS=, whicha basename grep cannot see. I searched the mechanism, not the name: there is no
GIT_ASKPASSassignment anywhere in the repo, and the only
*ASKPASS*occurrences at all are inautobot-backend/services/terminal_secrets_service.py, which setsSSH_ASKPASSto a helper itwrites itself at runtime (
_setup_askpass_script, lines 339-355) — never to this file. So itis not invoked invisibly; it is not invoked. It is also unusable if it ever were: git reads the
first line of an askpass helper's stdout as the credential, and lines 10, 15 and 20 print a
human prompt before the value on lines 12, 17 and 22.
utilities/load-env.sh— likewise. NoBASH_ENV, noENV=, nodirenv/.envrc, andenumerating every
source/.target in every shell file in the repo yields six distincttargets, none of them this file (the only env file anyone sources is
.env.native-vm, directly).Two of its four modes select
.env.distributedand.env.docker-desktop, neither of which hasever been tracked, and
ENV_FILEresolves against the caller's cwd while its own help text sayssource ./load-env.sh— so its documented invocation cannot find its own file. Its job is ownedby
detect-environment.sh(sameexport $(grep -v '^#' … | xargs)idiom, and is referenced)plus
generate-env-files.py/validate-env-files.py.Neither was retired on the strength of a grep: each has a named, landed successor doing the same
job.
A defect in the guard itself, found on the way in — now fixed in the base, not here.
repo_tests/unreferenced_shell_script_test.pywas red on #15129's original head, on all 21 entriesat once:
The baseline module lists every script by path, sits in the tree, and
git grepfinds it — so eachbaselined script had exactly one "reference": the list of things with no reference. My own
additions reintroduced it one level up, because a test that names a script in an assertion becomes
that script's reference; I caught that by mutation rather than by reading, when deleting the README
entry for
monitor_testing.shfailed to turn the guard red.#15129's owner has taken that fix into the base as
bd96b8542(NOT_A_REFERENCE, excluding bothbookkeeping modules), which is the right home for it — a guard that is red the moment it lands is
not a guard. This PR is rebased onto it and carries none of it. What remains here is the
consequence: every kept script is pinned to the document that references it, not merely to "is
referenced", because that weaker assertion is satisfied by this module's own mention of the
filename. That is the same shape as the
test_the_wired_in_script_is_referenced_by_the_runbookcorrection in the base.
What Changed
Retired — five (proved nothing should call them)
git-askpass.shGIT_ASKPASS/ASKPASSassignment repo-wide;terminal_secrets_service.py:339-355generates its own helper; and it prints the prompt where git expects the secretstart_vnc.shfa55a78bde), which addedapi/vnc_manager.pyalongside it invoking/usr/bin/vncserverdirectly and never referencing the script;infrastructure/browser-vnc.service:16-19runs the identical-geometry 1920x1080 -depth 24on display:1utilities/sync-grafana-dashboards.shansible/roles/monitoring/tasks/grafana.yml:131-134performs the same dashboards→/var/lib/grafana/dashboards/copy; the script's own header already concedes Ansible owns it; and its source path (config/grafana/dashboards) has not existed since #781utilities/create_github_issues.shsrc/andbackend/, roots removed at #926utilities/load-env.shWired in — two (each was unrunnable from any directory)
install-doc-sync-hook.sh—HOOK_SOURCEpointed at$PROJECT_ROOT/scripts/hooks/, removed atrefactor: Reorganize repository folders by deployment role #781, so the installer could only print "Hook source not found" and exit 1. The hook it installs
still exists at
autobot-infrastructure/shared/scripts/hooks/post-commit-doc-sync; the installerand the hook were added as a designed pair in
3b95ecf466(Documentation Indexing - Enable Chat Agent Self-Awareness #250). Repointed and documented.utilities/start-seq-forwarder.sh— line 7cds intoutilities/, after whichpython3 scripts/seq_log_forwarder.pyresolves toutilities/scripts/seq_log_forwarder.py,which has never existed. Anchored to
${SCRIPT_DIR}/../seq_log_forwarder.py, which does, with afail-closed check. It also ran
pip install aiohttpinto whatever interpreter was first onPATH; it now reports the missing dependency and exits instead of mutating the caller'senvironment.
Recorded as genuine manual tools — three
All three already run correctly against the current tree (each resolves its root through
scripts/lib/project_root.sh, hardened at #13149) and had no inbound reference of any kind.network/fix-wsl-networking.sh→ a new Repair script section indocs/developer/WSL2_NETWORKING.md, which described exactly this failure mode and named noscript at all.
monitor_testing.shandcleanup-disk-space.sh→ a new Manual operator tools section inautobot-infrastructure/shared/scripts/README.md, alongside the two wired-in scripts.The guard
TestTheBatchThisIssueResolvedasserts, per script, that the five retired ones are gone from bothtree and baseline; that each of the five kept ones is named by the specific document that
justifies keeping it (
KEPTmaps script → document); and that both wired-in scripts name pathsthat exist and that neither runs
pip install.NOT_A_REFERENCEexclusion this depends on lives in the base (bd96b8542), not here.Zero-headroom floors — six, across three files
Retiring
utilities/sync-grafana-dashboards.shremoves onesource .../lib/...site, andrepo_tests/shell_lib_sources_resolve_test.pycarries five non-vacuity floors pinned to the tree'sexact current size. All five had to move by exactly one:
len(_SITES)len(rels)distinct scriptschecked(resolved)checked(shape)len(decisive)Only the first is visible on a first run:
len(rels)sits after it in the same test function, sothe earlier assertion ends the function before it is reached. A single red line in a multi-assert
test is a floor, not a census of what broke — measured by evaluating the module's internals
directly rather than by reading the failure list.
Attribution measured, not assumed. Of the five files this PR deletes, exactly one carries a lib
source site:
So the delta is exactly −1 on every counter, and each floor is decremented by that and no more.
Recomputed after #15129's squash and the four merges that followed (#15142, #15125, #15131,
#15148), rather than assumed to have survived. Every floor still sits exactly at the count, with
no slack — which is the property the contract below depends on:
len(_SITES)len(rels)len(decisive)checked(shape)extensionless_SCANNEDgit ls-files(#15079)Why decrement rather than loosen. The file already answers this, at the
len(rels)floor:That is a deliberate acknowledge-on-change tripwire, and #14371 set the precedent by decrementing
56 → 55 with a comment naming the retired script. Replacing it with a loose floor plus "this is not
a census" would weaken a guard a prior issue deliberately tightened, and would remove exactly the
step that forces a human to state which script went and why. These decrements follow the existing
precedent's shape: measured delta, named script, named issue.
The floors keep their teeth — see mutation D below.
The sixth floor: the
AUTOBOT_reach self-checkautobot-infrastructure/shared/tests/test_ssot_config_lib.sh:458(run by thessot-config-lib-guardpre-commit hook, gated in CI by
verify-precommit-configstep 8) carries the same shape again:Measured, and the arithmetic is −3, not −2. The floor was not sitting at the count: the base
tree held 62 distinct names against a floor of 61, so one name of slack was already there.
AUTOBOT_*names in tracked*.shorigin/Dev_new_guiAll three lost names trace to one retired script,
utilities/load-env.sh, which was the onlytracked
.shfile naming any of them:.shholder at baseAUTOBOT_DEPLOYMENT_MODEutilities/load-env.shenv_registry.py:214, four.env*files, read byautobot-backend/user_management/config.pyAUTOBOT_PLAYWRIGHT_API_PORTutilities/load-env.shAUTOBOT_PLAYWRIGHT_HOSTutilities/load-env.shThe other four retirements contributed no
AUTOBOT_name uniquely, so nothing else in this diffreduced the reach.
Acknowledge-on-change, not derivable. The check counts the very names its own regex finds, so an
expectation computed the same way would confirm itself — the
_SITESargument unchanged. (#15079'sreach floor was derivable, from
git ls-files, and was correctly derived; these are not the sameproblem.) Lowered to 59, the exact current count, which also absorbs the stale slack, with a
comment naming the script, the three names and this issue. It keeps its teeth — see mutation E.
The file's own comment states the purpose this preserves: the var-count floor "catches a regex that
stops matching a variable shape".
The pattern
Six zero-headroom floors, in three files, tripped by one batch of retirements:
repo_tests/shell_lib_sources_resolve_test.py(five),autobot-infrastructure/shared/tests/test_ssot_config_lib.sh(one). They are deliberateacknowledge-on-change tripwires and this PR treats them as such — but they are invisible until a
deletion trips them, they live in unrelated files, and each fails independently. The next person
retiring a script will hit whichever one this PR did not touch. Worth a follow-up that inventories
them in one place; not folded in here, because retuning six guards' sensitivity is a change of a
different kind from resolving ten scripts.
Not resolved — eleven, deliberately
backup_ollama_models.sh,build_secure_sandbox.sh,cleanup-legacy-python.sh,debug_chat_system.sh,fix-frontend-dependencies.sh,start_containers.sh,start_seq.sh,utilities/batch-configure-vms.sh,utilities/enable-phase4-enterprise.sh,utilities/ollama_thread_utility.sh,utilities/security-audit.sh.Three are genuinely ambiguous rather than merely unexamined, and the choice is an owner's, not
mine:
batch-configure-vms.shis live and was maintained as recently as #14172, but Ansible is thedeclarative owner of the sudoers and package state it sets imperatively;
ollama_thread_utility.shneeds a one-line path fix butroles/llm/templates/ollama.service.j2may already make it redundant;
start_seq.shreaches for a forwarder that is gone entirely ratherthan mis-pathed, so wiring it in means merging it into
start-seq-forwarder.sh.Verification
git-askpass.shinvoked by no mechanismgit grep -i askpass→ one hit, its own comment; noGIT_ASKPASSanywhere; successor atterminal_secrets_service.py:339-355load-env.shinvoked by no mechanismsource/.target in every shell file enumerated → 6 distinct, none matching; noBASH_ENV/.envrc/direnv;.env.distributedand.env.docker-desktopuntrackedstart_vnc.shsuperseded at birthgit show fa55a78bdeaddsvnc_manager.pyin the same commit, callingvncserverdirectlyhooks/post-commit-doc-syncandseq_log_forwarder.pyboth tracked; asserted in the testgit grep -lI -F <basename>excluding the file itself → NONE for all fiveunreferenced()no longer lists thempytest repo_tests/unreferenced_shell_script_test.pyon129eff2d2→1 failed, 8 passed24 passed78 passed; both together102 passed in 15.50sAUTOBOT_reach delta is exactly three, all from one script.shholder wasload-env.shssot-config-lib-guardcleanbash autobot-infrastructure/shared/tests/test_ssot_config_lib.sh→ 38 passed, 0 failedsync-grafana-dashboards.shcarries asource .../lib/siteblack --checkclean,flake8→ 0,scripts/check_python_file_size.py→ exit 0bash -non both modified scripts → cleanShards:
repo_tests/unreferenced_shell_script_test.py→ shard 8 of 12;repo_tests/shell_lib_sources_resolve_test.py→ shard 10 of 12(
stable_shard.shard_of,--shard-splits 12). No new module added, so no shard membership moves.Not proven:
shellcheckis unavailable on this runner, so the two modified shell scripts areverified by
bash -nand by reading, not by a linter. Neither script was executed — one installs agit hook, the other starts a forwarder against a live Seq.
Contrast mutations (re-run against this branch's final head,
48455c821)A. Delete the README entry documenting
monitor_testing.sh— the "record as a manual tool"resolution is only real if removing the documentation puts the script back on the pile:
Before the base's
NOT_A_REFERENCEfix this mutation passed, which is how the self-referencedefect surfaced.
B. Empty
KNOWN_UNREFERENCED— the enumeration must fail when emptied, not report a clean tree:C. Restore one retired script to the tree — retirement must be asserted, not assumed:
D. Regress the source matcher — proves a floor lowered by one still catches a broken matcher
rather than having been tuned into uselessness. Narrowing
_SOURCEto only${SCRIPT_DIR}-prefixedquoted paths drops the sweep from 77 sites to 39:
A first attempt at this mutation — dropping the unquoted-path alternative — left all 78 green,
because every real site is double-quoted. Recorded because a mutation that does not move the
number proves nothing, and reporting it as a pass would have been the vacuity this PR is about.
E. Regress the
AUTOBOT_matcher — narrowing the reach scan's pattern to$AUTOBOT_VNC…drops it from 59 names to 6:
So a floor lowered by three still catches a regressed regex. Clean run: 38 passed, 0 failed,
which is the
ssot-config-lib-guardhook CI gates on.Tree restored after each; working tree clean. 24 passed on the orphan guard, 78 passed on
the shell-sweep guard, 102 passed together on the rebased head.
Filed, not fixed here
#15151 —
AUTOBOT_PLAYWRIGHT_HOST/AUTOBOT_PLAYWRIGHT_API_PORTare documented but read by nothing. Pre-existing, not caused by the retirement:load-env.shhad no caller, so they had no live consumer before it went either.#15143 —
detect-environment.shselects three.envfiles that do not exist. Different scope: itis referenced, so the unreferenced-script guard never looked at it, and it needs correcting
rather than retiring.
Model Used
Claude Opus 5 (1M context)
Refs #15127 — ten of twenty-one resolved; eleven remain in the baseline, named above.