Skip to content

dedup(helpers): extract the shared core of AST-identical sibling helpers with no existing home #18557

Open
0 of 1 issue completed

Description

@mrveiss

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

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

#17312

Activity

  1. mrveiss commented on Oct 22, 2026

    @mrveiss
    OwnerAuthor

    Verified on main @ e7812c7 (train 73, #19177; slice 3 = #19149). The class is not complete, so nothing is ticked and the issue stays open.

    • Each row gets a shared core or a recorded reason. Partial. On main:
      • Slice 1 (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 (the api/analytics* get_*_status x5 row) → utils/celery_task_status.py.
      • Slice 2 (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 worker main.py entries and ingest_man_pages vs command_manual_manager separate.
      • Slice 3 (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 for fetch_content, _classify_change and the drive HTTP helpers.
      • Not done: the api/terminal_handlers.py vs services/terminal_websocket pair 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 at autobot-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.py and index_documentation.py are no longer in the tree. I did not check how they left.
    • Rows added later are appended here. This is a process rule and has no code evidence to verify, so it stays unticked.
    • No behaviour change, verified case by case. Partial. Behaviour pins exist for the merged slices (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.
    • A guard fails if the fork returns, shown against a re-introduced copy. Partial. Each of the three guard files has contrast tests in which an inline old copy must be detected (for example 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.
  2. mrveiss commented on Oct 31, 2026

    @mrveiss
    OwnerAuthor

    Re-measured the open rows on main 7432d38.

    Row State
    native-vm/*_autobot_native.sh Shared block extracted in the PR for this slice; the rest of each script differs
    fix_kb_dimensions.py + kb_dimension_utility.py Already one: the first is a thin entry that imports main from the second (#18964)
    index_documentation.py shims Kept: each keeps a documented command working (#18129) and they differ only in path depth
    llc/adapters/* _build_state One definition left, in claude_code_adapter.py; nothing to share
    api/terminal_handlers.py vs services/terminal_websocket Still open beyond risk assessment; not measured in this pass
    Cache stats pair, Chroma adapter pair Not resolved: the audit gives no paths. I found several cache get_stats methods and no class matching a Chroma adapter pair, so I can't say which pairs it meant

    No criteria ticked.

  3. github-actions commented on Oct 31, 2026

    @github-actions
    Contributor

    Landed via the merge train (#20397, merge 04c4ed7994) via #20255

  4. mrveiss commented on Nov 1, 2026

    @mrveiss
    OwnerAuthor

    Row api/terminal_handlers.py vs services/terminal_websocket: PR #20454 gives it one shared core. The handler now delegates chat, transcript and audit work to TerminalChatIntegrator and TerminalAuditLogger, and the slice 2 guard fails if the copies return. The row is not done until that PR lands; no criteria ticked.

  5. mrveiss commented on Nov 1, 2026

    @mrveiss
    OwnerAuthor

    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.

  6. mrveiss commented on Nov 1, 2026

    @mrveiss
    OwnerAuthor

    Row "cache stats pair": no shared core, reason recorded. The audit names no paths, so this reading is mine.

    Candidate What it reads Verdict
    api/cache_management.py:73 (/api/cache/stats) Key count and memory for every Redis database Separate
    api/system.py:742 (/api/system/cache/stats) cache_manager stats plus one Redis info call, cached for 15s Separate
    cache/coordinator.py:143 Aggregates registered caches through get_stats Already the shared aggregator
    ast_cache.py:416, file_cache.py:270, embedding_cache.py:318, llm_shared/cache.py:325 Each cache's own counters, behind CacheProtocol Already one interface

    The 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 in shared_helper_cores_18557_slice2_test.py.

  7. mrveiss commented on Nov 1, 2026

    @mrveiss
    OwnerAuthor

    Row "Chroma adapter pair": my earlier note that no such pair exists was wrong. It is knowledge/backends/chromadb_adapter.py and async_chromadb_adapter.py. PR #20473 gives their argument handling one home. The row is not done until that PR lands; no criteria ticked.

  8. mrveiss commented on Nov 1, 2026

    @mrveiss
    OwnerAuthor

    Row api/terminal_handlers.py vs services/terminal_websocket: landed in the merge train (PR #20459), main f88cd37, via PR #20454. On main, the handler delegates to TerminalChatIntegrator and TerminalAuditLogger, and repo_tests/shared_helper_cores_18557_slice2_test.py::test_terminal_handlers_delegates_chat_transcript_and_audit fails if the copies return. No criteria ticked; other rows remain.

  9. github-actions commented on Nov 1, 2026

    @github-actions
    Contributor

    Landed via the merge train (#20459, merge f88cd3756a) via #20454

  10. mrveiss commented on Nov 1, 2026

    @mrveiss
    OwnerAuthor

    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.

    AC Evidence
    Each row gets a shared core or a recorded reason to stay separate. MET. Table below.
    Rows added later are appended here, not filed separately. NOT VERIFIED. This is a rule about future filing; nothing in the code shows it. Unticked.
    No behaviour change: every caller's output is identical (verified case by case, evidence pasted in the PR). NOT VERIFIED for every row. I checked the terminal, analytics and Chroma PRs: tests and a review, with the differences they disclose. Earlier slices' PR evidence was not re-read here. Unticked.
    A guard fails if the fork returns; shown to fail against a re-introduced copy. PARTLY. The terminal, analytics and Chroma guards were shown failing against a copy. Earlier slices' guards have contrast tests in shared_helper_cores_18557*_test.py; I did not rerun or re-read each against every row. Unticked.
    Row State on main
    Sanitizer pair; logging_standardizer / performance_optimizer; session migration scripts; modality agents; deploy wrappers Shared core, shared_helper_cores_18557_slice2_test.py
    _require_role; get_local_ip; the Celery task-status check Shared core, shared_helper_cores_18557_test.py
    native-vm/*_autobot_native.sh Shared block, shared_helper_cores_18557_slice4_test.py
    fix_settings_loading.py, fix_kb_dimensions.py Thin entries importing main from their utility
    ingest_man_pages vs command_manual_manager Separate: a worklist vs risk tables, recorded in the slice 2 guard
    Worker main.py entries Separate: synced alone and never import autobot_shared, guarded in slice 2
    index_documentation.py shims Kept: each keeps a documented command working (#18129)
    llc/adapters/* _build_state One definition left
    terminal_handlers.py vs terminal_websocket Shared core, slice 2 guard (PR #20454)
    analytics* get_*_status The shared part has one home, the rest separate; slice 5 guard (PR #20463)
    Chroma adapter pair Shared argument shapes, slice 6 guard (PR #20473)
    Cache stats pair Separate; the audit names no paths, so this is my reading (comment above)
    Drive and Atlassian connectors drive_base.py, atlassian_base.py, with a parity test
  11. github-actions commented on Nov 1, 2026

    @github-actions
    Contributor

    Landed via the merge train (#20500, merge 64943e39e5) via #20463, #20473

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions