Repository navigation
chore(scripts): decide the last five unreferenced infrastructure scripts (#15127) - #15321
Conversation
…pts (#15127) Retire fix-frontend-dependencies.sh, start_containers.sh and utilities/batch-configure-vms.sh: each names infrastructure that either never existed in tracked history (Dockerfile.dev, the frontend node_modules volume, the 'frontend'/'npu-worker'/'playwright' compose service names) or has been superseded by a proper Ansible playbook (setup-passwordless-sudo.yml #700, patch-system-packages.yml #682, health-check.yml). Wire in utilities/enable-phase4-enterprise.sh: the /api/enterprise/* router it drives is real and schema-matched (Issue #620), it just had a Python-style docstring that bash executes as commands, no auth header for the admin-gated router (now sent via the same X-Internal-API-Key convention autobot-slm-backend/api/voice_proxy.py uses), and one dead /api/enterprise/health call that does not exist as a route. Documented in scripts/README.md with a pointer to docs/prd/enterprise-features-subsystems-PRD.md, since most of the features it flips are still logger-only stubs per that PRD. Keep cleanup-legacy-python.sh as a documented manual tool: the #1898 deadsnakes-PPA migration it depends on landed and is the current CI standard, but the one-time pyenv/conda removal it performs is still useful on a machine that predates that migration. Baseline emptied: delete repo_tests/unreferenced_shell_script_baseline.py and repo_tests/unreferenced_shell_script_test.py together, per #15127 AC4.
✅ SSOT Configuration Compliance: Passing🎉 No new hardcoded values of either class — Known backlog in |
…nd spot (#15127) Review found the baseline module's deletion took the whole test file with it -- including TestNoNewUnreferencedScript, the assertion that stops a newly-unreferenced script arriving silently, and the enumeration/reach checks that stop it passing over nothing. Restored repo_tests/unreferenced_shell_script_test.py with only the baseline-specific machinery removed (the KNOWN_UNREFERENCED import, TestBaselineRatchetsDownOnly, test_every_baselined_script_is_named_only_by_the_bookkeeping); every batch regression class from the four already-landed decisions in this issue stays, each with its KNOWN_UNREFERENCED assertion dropped since the set no longer exists. Closed the guard's own blind spot: pipeline-scripts/hardcoded_values_baseline.txt records a script's path because a hardcoded-value scan found something in it, not because anything calls it, but the guard's basename-substring match counted that as a reference. Added it to NOT_A_REFERENCE. That flipped 14 scripts from 'referenced' to genuinely orphaned, not just the one this review named -- decided all 14 on the same standard as the original five: Retired (targets infrastructure that never existed or was superseded): - deployment/start_npu_worker.sh, ensure-frontend-dependencies.sh -- DEV/SANDBOX headers pointing at docker/compose/docker-compose.hybrid.yml, which does not exist (filed #15322 separately: 13 OTHER tracked files, including the live run_agent.sh entrypoint, still reference that same missing file -- out of scope here, that one needs its own review). - run_agent_fast.sh -- targets backend.fast_main:app, deleted in #567. - setup/models/setup_model_sharing.sh, setup_windows_only_models.sh -- three more missing compose files between them, a wrong container name (autobot-ollama-shared vs autobot-ollama), a hardcoded personal Windows username fallback, and an .env/.yml output scheme nothing reads. - testing/run-playwright-tests.sh, test_terminal_input.sh -- target e2e specs that live under autobot-frontend/tests/e2e/, not the autobot-slm-frontend/ tree these cd into; run-playwright-tests.sh also shells out to the deprecated root main.py (#725/#781) with a --test-mode flag it never had. - utilities/complete-vm-sync-templates.sh -- autobot-user-backend and docker/npu_worker do not exist (real paths: autobot-backend, no docker npu-worker tree at all); duplicates the raw-rsync workflow docs/adr/005-single-frontend-mandate.md names sync-frontend.sh and sync-to-vm.sh as the actual tools for. Wired in (real defect, now fixed): - testing/manage_playwright.sh -- the compose file it starts is real (container_name: autobot-playwright) but was named as a bare relative path that only resolved from inside docker/compose/ itself; resolved from the script's own location instead. - utilities/sync-npu-worker-to-windows.sh -- SOURCE_PATH was missing the autobot-npu-worker/ path segment; install.ps1/check-health.ps1 it tells the operator to run next both confirmed present at the corrected path. Kept as documented manual tools (README.md, autobot-infrastructure/shared/scripts/): - check_ai_stack_health.sh, setup/setup_tier2_research.sh -- both hardened 6 days ago (#14877/#14867) against real, current targets. - environment/set-env-deepseek.sh -- every env var it sets is live and SSOT-recognized; network-config.sh it sources exists. - utilities/prevent-local-frontend.sh -- content-consistent with the real sync-frontend.sh workflow (both target autobot-slm-frontend); never wired to a caller, but not broken either. Baseline mechanics unaffected: repo_tests/unreferenced_shell_script_baseline.py stays deleted (AC4); nothing reintroduces it.
|
Addressed the review: guard restored (`repo_tests/unreferenced_shell_script_test.py` is back, simplified to the down-only end state -- `TestNoNewUnreferencedScript` and the enumeration/reach checks survive, only the `KNOWN_UNREFERENCED`-specific machinery is gone), and `pipeline-scripts/hardcoded_values_baseline.txt` is now in `NOT_A_REFERENCE`. Closing that blind spot exposed 14 scripts, not the one anticipated -- verified this wasn't a basename-collision artifact, then decided all 14 on the same standard as the original five. 8 retired, 2 wired in (real path/auth defects, now fixed), 4 kept and documented. Full breakdown and evidence in the updated PR body. One of the retirals (`ensure-frontend-dependencies.sh` and `deployment/start_npu_worker.sh`) shares a root cause with a separate, larger finding: `docker/compose/docker-compose.hybrid.yml` doesn't exist but is still referenced by 13 other tracked files, including the live `run_agent.sh` entrypoint. That's out of scope for a script-reference-triage issue and `run_agent.sh` needs its own review, so filed #15322 rather than touching it here. A standalone analysis script (git plumbing only, same logic as the guard's own `unreferenced()`) confirms zero unreferenced scripts remain under the corrected `NOT_A_REFERENCE`. |
|
Both retirements stand, but the stated reasons were wrong or incomplete -- corrected in the PR body, not in the commit (can't amend a pushed commit; the two file deletions themselves were correct, only the write-up was fixed):
Re-checked the remaining six retirements for the same defect class: none depend on anything #15322 covers. Full per-script reasoning is in the updated PR body. Also updated #15322 itself: the deletion commit it cited was superseded by a later one, and I added the distinction that matters for whoever picks it up -- |
…ent (#15127) Two mechanical consequences of retiring 11 unreferenced infrastructure scripts, caught by CI: pipeline-scripts/hardcoded_values_baseline.txt: removed exactly the 21 entries whose path was one of the 11 retired scripts (verified via git grep before and after -- no entry for a file that still exists was touched, and none was added). The file's own header requires this: it only ever shrinks, and a stale entry is a failure in its own right. repo_tests/git_hooks_executable_test.py: the retirement dropped two of the five reach floors below their asserted minimum -- _SHEBANGED 45 < 46, _UTILITIES 77 < 79 (both under autobot-infrastructure/shared/scripts/utilities/, from batch-configure-vms.sh and complete-vm-sync-templates.sh). This guard's existing convention was to set floors AT the exact measured count for zero headroom, deliberately, so a retirement has to stop here. Given real headroom instead this time (_SHEBANGED >= 40, _UTILITIES >= 70) per review: a floor at the exact count goes red on the very next legitimate small retirement and teaches whoever hits it to lower it again without looking, where real headroom still catches an actual regression (a reader silently returning nothing, or a directory falling out of _HOOK_DIRS) while surviving the next small, legitimate one. Recorded inline with the #15127 count and reasoning. Also merged origin/Dev_new_gui (1 commit behind).
|
Both fixed, pushed on the same branch (commit
Branch is current with Added a note to the PR body flagging the three-bookkeeping-consequences pattern (unreferenced-script baseline, hardcoded-values baseline, shebang/hook reach floor) for the next person doing a batch retirement here. |
Thinking Path
First pass read the five remaining
KNOWN_UNREFERENCEDentries against the current tree rather than the issue's assumptions, since two of those assumptions turned out to be wrong on inspection:cleanup-legacy-python.sh's #1898/#1924 migration is confirmed complete (CI is Python 3.14 everywhere);enable-phase4-enterprise.sh's/api/enterprise/*API is real, not missing -- 9 live routes inautobot-backend/api/enterprise_features.py, registered under/enterpriseatfeature_routers.py:270(app factory prepends/api), every jq path the script reads matched the route handlers line-for-line.fix-frontend-dependencies.shandstart_containers.shtarget infrastructure (Dockerfile.dev,docker/compose/docker-compose.base.yml,redis/npu-worker/playwrightcompose service names) that never existed in tracked history.utilities/batch-configure-vms.sh's three subcommands are superseded by real Ansible playbooks (setup-passwordless-sudo.yml#700,patch-system-packages.yml#682,health-check.yml) and it piped a plaintext password over SSH, which CLAUDE.md's credentials rule forbids.Review round one. A reviewer confirmed the enterprise-API finding independently and flagged that deleting
repo_tests/unreferenced_shell_script_baseline.pyhad takenrepo_tests/unreferenced_shell_script_test.pywith it -- includingTestNoNewUnreferencedScript(the guard that catches a new unreferenced script) and the enumeration/reach checks. Restored the test file with only theKNOWN_UNREFERENCED-specific machinery removed; every batch-regression class from the four already-landed decisions in this issue survives untouched. The reviewer also asked to fold in an independent finding:ensure-frontend-dependencies.shonly "passed" the guard because its path appears inpipeline-scripts/hardcoded_values_baseline.txt-- a hardcoded-value finding against it, not a caller. Added that file toNOT_A_REFERENCE. Checking the actual effect (not assuming) flipped 14 scripts to genuinely orphaned, not the one anticipated. Filed #15322 for a separate, wider gap surfaced along the way:docker/compose/docker-compose.hybrid.ymlis missing but still referenced by the liverun_agent.shentrypoint and 12 other tracked files.Review round two. A reviewer caught a real contradiction: two of the 14 retirements (
deployment/start_npu_worker.sh,ensure-frontend-dependencies.sh) were justified in the commit message using the same missing file that #15322 says is a defect elsewhere in the tree, whilecheck_ai_stack_health.sh-- which references that identical file -- was kept. Same evidence, opposite verdicts, inside one PR. Investigated each on its own, independent of #15322:ensure-frontend-dependencies.shdoes not referencedocker-compose.hybrid.ymlat all -- that was a drafting error in the original commit message (this script and its already-retired siblingfix-frontend-dependencies.shgot conflated while writing it up). Re-read the actual script: it names./run_agent_unified.sh --dev, deleted in [Housekeeping] Archive Cleanup - Extract Features and Delete Archived Files #567, and its whole technique --docker exec autobot-frontend npm install "$package" --save, then restart the container to reload Vite -- is incompatible with the currentautobot-frontendservice (docker-compose.yml:631):read_only: true,cap_drop: [ALL], tmpfs-only mounts, a pre-built static bundle served by nginx (docker/frontend/Dockerfile, from the same March 2026 rebuild below). There is no writablenode_modulesand no npm at runtime to install into. Retirement stands, corrected to this evidence, unrelated to run_agent.sh (the documented 'Start full system' entrypoint) is broken: docker-compose.hybrid.yml was deliberately retired and 13 callers were never repointed #15322.deployment/start_npu_worker.shgenuinely does referencedocker-compose.hybrid.yml, so this one needed real independent grounds. Checked the deletion history properly this time: the file was deleted and recreated across several commits, and the most recent, authoritative one isbf0a3b1af("feat(docker): fresh containerization for current codebase", feat: Fresh Docker containerization — Dockerfiles and compose for current codebase #1809/feat(docker): fresh containerization for current codebase (#1809) #1818, 2026-03-15) -- its own message calls the old compose setup "obsolete" and explicitly did not recreate an NPU-worker Dockerfile when it rebuiltdocker/backend,docker/frontend,docker/slm.git grepacross every tracked*.ymlconfirms no compose file anywhere defines annpu-worker/autobot-npu-workerservice -- every match is Ansible inventory/role config, because NPU-worker deployment moved to native/Ansible (autobot-npu-worker/is a real, actively-maintained native package; the Ansiblenpu-workerrole is real). The script's own header already says so: "Production uses native deployments. See Ansible roles for equivalent." This is different fromrun_agent.sh's Redis lines, which run_agent.sh (the documented 'Start full system' entrypoint) is broken: docker-compose.hybrid.yml was deliberately retired and 13 callers were never repointed #15322 covers and which do have a live repoint target (autobot-redisin the currentdocker-compose.yml) -- posted this distinction on run_agent.sh (the documented 'Start full system' entrypoint) is broken: docker-compose.hybrid.yml was deliberately retired and 13 callers were never repointed #15322 so whoever picks it up doesn't try to fix the NPU line the same way as the Redis lines.Re-checked the other six retirements for the same defect class (support that depends only on something #15322 covers): none do.
setup_model_sharing.shandsetup_windows_only_models.sheach reference different, unrelated missing compose files (docker-compose.shared-models.yml,docker-compose.full.yml,docker-compose.windows-models.yml-- none of themhybrid.yml, none of them named in #15322), and each has independent support that doesn't depend on any missing file at all: a wrong container name (autobot-ollama-sharedvs the realautobot-ollama) and an output scheme (.env.model-sharing,AUTOBOT_MODEL_SHARING_STRATEGY) nothing reads, for the first; a hardcoded personal Windows username fallback ("marti") and the same unread-output pattern, for the second.run_agent_fast.sh(targetsfast_main.py, deleted in #567 -- a separate, unrelated cleanup commit),run-playwright-tests.sh/test_terminal_input.sh(wrong test-file locations, a deprecatedmain.pyentrypoint), andcomplete-vm-sync-templates.sh(autobot-user-backendanddocker/npu_workernever existed; duplicates the ADR's actual named tools) never toucheddocker-compose.hybrid.ymlor any Docker-modernization casualty at all.What Changed
Retired (script + zero dangling references, confirmed via
git grep), first batch:fix-frontend-dependencies.sh,start_containers.sh,utilities/batch-configure-vms.shRetired, second batch (14-script blind-spot sweep) -- each with evidence independent of #15322 (see Thinking Path for the full per-script reasoning):
deployment/start_npu_worker.sh-- Dockerfile it builds from was deliberately retired with no replacement (bf0a3b1af, 2026-03-15, explicit "obsolete"); no npu-worker docker-compose service exists anywhere in the tree; the script's own header names the real, current, actively-maintained replacement (native/Ansible).ensure-frontend-dependencies.sh--run_agent_unified.shdeleted in [Housekeeping] Archive Cleanup - Extract Features and Delete Archived Files #567; its live-npm install-inside-the-container technique is incompatible with the currentread_only: true,cap_drop: [ALL], static-nginxautobot-frontendservice.run_agent_fast.sh-- targetsbackend.fast_main:app, deleted in [Housekeeping] Archive Cleanup - Extract Features and Delete Archived Files #567.setup/models/setup_model_sharing.sh,setup_windows_only_models.sh-- wrong container name / hardcoded personal Windows username / an.env+.ymloutput scheme nothing reads (each independent of any missing compose file; the compose files these two name are different ones, not run_agent.sh (the documented 'Start full system' entrypoint) is broken: docker-compose.hybrid.yml was deliberately retired and 13 callers were never repointed #15322's).testing/run-playwright-tests.sh,test_terminal_input.sh-- target e2e specs that live underautobot-frontend/tests/e2e/, not theautobot-slm-frontend/tree theycdinto; the former also shells out to the deprecated rootmain.py(feat(security): Migrate services to mTLS authentication (PKI-based) #725/refactor: Reorganize repository folders by deployment role #781) with a--test-modeflag it never had.utilities/complete-vm-sync-templates.sh--autobot-user-backendanddocker/npu_workerdon't exist; duplicates the raw-rsync workflow the canonical ADR (docs/adr/005-single-frontend-mandate.md) namessync-frontend.sh/sync-to-vm.shas the actual tools for.Wired in --
utilities/enable-phase4-enterprise.sh: fixed the bash-executed"""docstring, added the missingX-Internal-API-Keyauth header (admin-gated router; same conventionautobot-slm-backend/api/voice_proxy.pyuses), dropped one dead/api/enterprise/healthcall. Documented with a pointer todocs/prd/enterprise-features-subsystems-PRD.md-- mostenable_feature()paths are still logger-only stubs per that PRD.Wired in, second batch:
testing/manage_playwright.sh-- the compose file it starts is real (container_name: autobot-playwright) but was a bare relative path that only resolved from insidedocker/compose/itself; resolved from the script's own location.utilities/sync-npu-worker-to-windows.sh--SOURCE_PATHwas missing theautobot-npu-worker/path segment; confirmedinstall.ps1/check-health.ps1exist at the corrected path.Recorded as manual operator tools (
scripts/README.md):cleanup-legacy-python.sh(first batch);check_ai_stack_health.sh,setup/setup_tier2_research.sh(both hardened 6 days ago, #14877/#14867, against real current targets --check_ai_stack_health.shprints a suggested recovery command that also names the missingdocker-compose.hybrid.yml, but that's one line of advice in an error path, not something the script itself depends on to run; #15322 covers it),environment/set-env-deepseek.sh(every env var it sets is live/SSOT-recognized),utilities/prevent-local-frontend.sh(content-consistent with the realsync-frontend.shworkflow -- never wired to a caller, but not broken).Guard restored, blind spot closed:
repo_tests/unreferenced_shell_script_test.pykept, simplified to the down-only end state (no moreKNOWN_UNREFERENCEDsubtraction -- every tracked script must be referenced, full stop).NOT_A_REFERENCEnow also excludespipeline-scripts/hardcoded_values_baseline.txt.repo_tests/unreferenced_shell_script_baseline.pystays deleted (AC4); nothing reintroduces a baseline.#15322 corrected and re-prioritized (comment, not a code change here): the deletion this issue first cited (
f4d5c5b151) was superseded by a later, more authoritative one --bf0a3b1af(2026-03-15), which deliberately replaced the whole compose architecture and explicitly did not recreate an NPU-worker Dockerfile. Documented that Redis-related callers (run_agent.sh'sautobot-redislines) have a live repoint target in the currentdocker-compose.yml, while NPU-worker-related callers do not -- those need the Ansible path, not a repoint. Retitled to namerun_agent.shas the documented "Start full system" entrypoint (QUICK_REFERENCE.md:29), per the request to reflect that this is a broken front door, not housekeeping.Verification
Established statically (no code executed, per constraint):
bash -nparses cleanly on every touched.shfile.unreferenced()logic exactly) run against the final tree state confirms zero unreferenced scripts remain under both the old and the correctedNOT_A_REFERENCE.git grepconfirms zero remaining references anywhere in the tree to every retired filename.git log --all --diff-filter=Dfor every "deleted"/"never existed" claim above, read to identify the most recent deletion commit and its stated rationale, not just the first one found -- this is what caught thebf0a3b1afvsf4d5c5b151distinction on review.git grepacross every tracked*.ymlfor annpu-worker/autobot-npu-workercompose service definition: none exists; every match is Ansible config.enable-phase4-enterprise.sh's curl targets/jq paths againstautobot-backend/api/enterprise_features.py's route decorators and response builders.What the restored guard covers:
TestEnumeration(sweep isn't silently empty or collapsed, #15087);TestOwnBookkeepingIsNotAReference(bookkeeping files -- now just this test module plushardcoded_values_baseline.txt-- are tracked, exist, repo-relative);TestNoNewUnreferencedScript.test_every_script_is_referenced-- the down-only end state, unconditional now that there's nothing to grandfather; four regression classes pinning every already-landed decision in this issue to the specific document/defect-fix that makes it not-debris.Left to CI: full pytest collection, pre-commit hooks (function-length, SSOT-sourcing self-test, secrets scan, mass-deletion detector) and the rest of the suite are CI's call, not asserted here.
Review round three: two mechanical bookkeeping consequences of retiring 11 scripts, caught by CI.
pipeline-scripts/hardcoded_values_baseline.txthad 21 entries for the 11 retired scripts (verified viagit grep-- every one belonged to a file this PR deleted, none belonged to a file that still exists, none needed adding). Removed exactly those 21; the file's header requires this, it only ever shrinks.repo_tests/git_hooks_executable_test.py's reach-floor test dropped two of its five floors below their asserted minimum:_SHEBANGED45 < 46 and_UTILITIES77 < 79 (both from the two retired scripts underutilities/:batch-configure-vms.sh,complete-vm-sync-templates.sh). This guard's existing convention was floors set AT the exact measured count, zero headroom, by design -- but review asked for real headroom instead this time (_SHEBANGED >= 40,_UTILITIES >= 70): a floor at the exact count goes red on the next legitimate small retirement and teaches whoever hits it to lower it again without looking, where real headroom still catches an actual regression (a reader silently returning nothing, or a directory falling out of_HOOK_DIRS) while surviving the next small one. Recorded inline with the count and reasoning.Also merged
origin/Dev_new_gui(branch was 1 commit behind) via merge, not rebase.Worth flagging for the next batch retirement in this repo: removing tracked infrastructure scripts has three bookkeeping consequences here, not one -- the unreferenced-script guard's own baseline (
repo_tests/unreferenced_shell_script_baseline.py, retired in this PR once it hit zero), the hardcoded-values baseline (pipeline-scripts/hardcoded_values_baseline.txt), and the shebang/hook reach floor (repo_tests/git_hooks_executable_test.py, if any retired script sits under a swept hook directory). All three failed silently-until-CI in this PR; none of them showed up from a plaingit grepfor the deleted filename.Model Used
Claude Opus 5 (1M context)
Refs #15127