Repository navigation
Open
0 / 10 of 1 issue completedOpen
dedup(helpers): extract the shared core of AST-identical sibling helpers with no existing home#18557
0 / 10 of 1 issue completed
Copy link
Labels
code-qualityinfrastructurephase:M4.8Shrink the symbol-fork baselineShrink the symbol-fork baselinepriority: lowtechnical-debt
Milestone
Description
Problem
One class issue for sibling helpers that are near-copies and have no issue of their own. Rows are listed here as the single home; do not file per row. Record further sightings as witnesses on #18132.
Source: external codebase audit 2026-10-14, re-verified on main 308f6cc.
Files
- code_analysis/auto-tools sanitizer pair (118 clone lines); logging_standardizer / performance_optimizer
- fix_settings_loading.py + settings_diagnostic_utility.py (pylint 195)
- ingest_man_pages.py vs command_manual_manager.py (90)
- session migration scripts (92); fix_kb_dimensions.py + kb_dimension_utility.py (41)
- deploy-hybrid.sh + deploy-native.sh (175); native-vm/*_autobot_native.sh
- 3 worker main.py entries; get_local_ip (config_bootstrap.py:41) vs _get_local_ip (backend_telemetry.py:446)
- llc/services/role_.py _require_role x4; llc/adapters/ _build_state
- 5 agent boilerplate files; api/terminal_handlers.py vs services/terminal_websocket; api/analytics* get_*_status x5
- cache stats pair; Chroma adapter pair; drive/atlassian connectors
- the two redundant 21-line index_documentation.py runpy shims under autobot-infrastructure/shared/
Evidence
- security_sanitizer.py 686 and security_deep_sanitizer.py 877 lines present
- _validation_error_without_input: 3 copies remain (npu_inference_server.py:85, ai_api_server.py:103, windows-npu-worker/app/npu_worker.py:70), homed in security(npu-worker): 2 more FastAPI apps missing the #16428 422-payload-echo fix #17112
- proposed helpers agents/_standard_agent.py and llc/services/_role_guard.py and autobot_shared/worker_entry.py do not exist
- Already homed elsewhere: size gates The Python and shell size gates duplicate ~90% of their logic, and the Python ratchet test's monkeypatching blocks the obvious fix #17377, root resolvers canonical(paths): 31 hand-rolled root resolvers under 6 names, while autobot_shared.paths.project_root() is canonical — 23 sit outside the fork detector's population #18101, tech-debt(tooling): two script pairs clone their rules table and CLI preamble — found by the widened duplication scan #18158 pairs, hardware_metrics inventory(canonical): 19 concepts with more than one definition and no existing issue — led by two secret stores whose docstrings each claim they cannot disagree about the key #17856, DB pools audit: 67 files totalling 6,754 statements have zero coverage because nothing imports them #16792
Acceptance criteria
- Each row gets a shared core or a recorded reason to stay separate.
- Rows added later are appended here, not filed separately.
- No behaviour change: every caller's output is identical before and after (verified case by case, evidence pasted in the PR).
- A guard (test or CI check) fails if the fork returns; shown to fail against a deliberately re-introduced copy.
Related issues
#18132, #18158, #17377, #18101, #17856, #16792, #17112, #16956
Parent
Metadata
Metadata
Assignees
Labels
code-qualityinfrastructurephase:M4.8Shrink the symbol-fork baselineShrink the symbol-fork baselinepriority: lowtechnical-debt
Activity
test(repo_tests): contrast tests, body-shape match and host-keyed loc…
test(helpers): behavioural pins for the slice-2 terminal and sanitize…
test(helpers): the slice-2 behaviour test takes the repo root from re…
fix(train): train-57 review — the isolated-worker check is an AST imp…
mrveiss commentedon Oct 22, 2026
Verified on main @ e7812c7 (train 73, #19177; slice 3 = #19149). The class is not complete, so nothing is ticked and the issue stays open.
repo_tests/shared_helper_cores_18557_test.py): role-exists query →llc/services/_role_guard.py; worker local-IP →windows-npu-worker/app/utils/local_ip.py; Celery pending→404 (theapi/analytics*get_*_statusx5 row) →utils/celery_task_status.py.repo_tests/shared_helper_cores_18557_slice2_test.py): sanitizer pair and console tools (logging_standardizer/performance_optimizer) →code_analysis/auto-tools/tool_base.py; session migrations →scripts/migrations/_session_redis.py; modality agents → one base__init__; deploy-hybrid/native →scripts/lib/deploy-common.sh; terminal risk assessment delegated. Reasons are recorded for keeping the workermain.pyentries andingest_man_pagesvscommand_manual_managerseparate.repo_tests/shared_helper_cores_18557_slice3_test.py): Confluence/Jira →knowledge/connectors/atlassian_base.py; GDrive/OneDrive →knowledge/connectors/drive_base.py. Reasons are recorded forfetch_content,_classify_changeand the drive HTTP helpers.api/terminal_handlers.pyvsservices/terminal_websocketpair beyond risk assessment (the terminal half). I found no core and no recorded reason in these guards for:fix_kb_dimensions.py+kb_dimension_utility.py(both still atautobot-infrastructure/shared/scripts/),native-vm/*_autobot_native.sh,llc/adapters/*_build_state, the cache-stats pair, and the Chroma adapter pair.fix_settings_loading.py,settings_diagnostic_utility.pyandindex_documentation.pyare no longer in the tree. I did not check how they left.repo_tests/shared_helper_cores_18557_slice2_behaviour_test.py,knowledge/connectors/atlassian_drive_parity_18557_test.py). The rows still open have none yet.test_atlassian_detector_flags_an_old_copy_and_passes_a_delegate,test_local_ip_detector_catches_a_renamed_copy_by_body_shape). The rows still open have no guard.mrveiss commentedon Oct 31, 2026
Re-measured the open rows on main 7432d38.
native-vm/*_autobot_native.shfix_kb_dimensions.py+kb_dimension_utility.pymainfrom the second (#18964)index_documentation.pyshimsllc/adapters/*_build_stateclaude_code_adapter.py; nothing to shareapi/terminal_handlers.pyvsservices/terminal_websocketget_statsmethods and no class matching a Chroma adapter pair, so I can't say which pairs it meantNo criteria ticked.
fix(infra): the shell source floors follow the native-vm block move (#…
fix(infra): the shell source floors follow the native-vm block move (#…
github-actions commentedon Oct 31, 2026
Landed via the merge train (#20397, merge
04c4ed7994) via #20255mrveiss commentedon Nov 1, 2026
Row
api/terminal_handlers.pyvsservices/terminal_websocket: PR #20454 gives it one shared core. The handler now delegates chat, transcript and audit work toTerminalChatIntegratorandTerminalAuditLogger, and the slice 2 guard fails if the copies return. The row is not done until that PR lands; no criteria ticked.mrveiss commentedon Nov 1, 2026
Row
api/analytics* get_*_status x5: PR #20463 gives the shared part one home and records why the other routes stay separate (table in the PR). The row is not done until that PR lands; no criteria ticked.mrveiss commentedon Nov 1, 2026
Row "cache stats pair": no shared core, reason recorded. The audit names no paths, so this reading is mine.
api/cache_management.py:73(/api/cache/stats)api/system.py:742(/api/system/cache/stats)cache_managerstats plus one Redisinfocall, cached for 15scache/coordinator.py:143get_statsast_cache.py:416,file_cache.py:270,embedding_cache.py:318,llm_shared/cache.py:325CacheProtocolThe two routes share a name and little else. If the audit meant a different pair, this reading does not cover it. Row 6 (agent boilerplate) was already resolved by
BaseModalityAgent, pinned inshared_helper_cores_18557_slice2_test.py.mrveiss commentedon Nov 1, 2026
Row "Chroma adapter pair": my earlier note that no such pair exists was wrong. It is
knowledge/backends/chromadb_adapter.pyandasync_chromadb_adapter.py. PR #20473 gives their argument handling one home. The row is not done until that PR lands; no criteria ticked.mrveiss commentedon Nov 1, 2026
Row
api/terminal_handlers.pyvsservices/terminal_websocket: landed in the merge train (PR #20459), main f88cd37, via PR #20454. On main, the handler delegates toTerminalChatIntegratorandTerminalAuditLogger, andrepo_tests/shared_helper_cores_18557_slice2_test.py::test_terminal_handlers_delegates_chat_transcript_and_auditfails if the copies return. No criteria ticked; other rows remain.github-actions commentedon Nov 1, 2026
Landed via the merge train (#20459, merge
f88cd3756a) via #20454mrveiss commentedon Nov 1, 2026
Every row now has a shared core or a recorded reason, checked against main 64943e3. The analytics and Chroma rows landed in the merge train (PR #20500), via PRs #20463 and #20473.
shared_helper_cores_18557*_test.py; I did not rerun or re-read each against every row. Unticked.logging_standardizer/performance_optimizer; session migration scripts; modality agents; deploy wrappersshared_helper_cores_18557_slice2_test.py_require_role;get_local_ip; the Celery task-status checkshared_helper_cores_18557_test.pynative-vm/*_autobot_native.shshared_helper_cores_18557_slice4_test.pyfix_settings_loading.py,fix_kb_dimensions.pymainfrom their utilityingest_man_pagesvscommand_manual_managermain.pyentriesautobot_shared, guarded in slice 2index_documentation.pyshimsllc/adapters/*_build_stateterminal_handlers.pyvsterminal_websocketanalytics* get_*_statusdrive_base.py,atlassian_base.py, with a parity testgithub-actions commentedon Nov 1, 2026
Landed via the merge train (#20500, merge
64943e39e5) via #20463, #20473