Skip to content

refactor: size reduction — retire superseded batch paths, dead code, test consolidation #700

Closed

Description

@Jammy2211

Overview

A refactor review of PyAutoBrain (2026-11-22) found the code is not bloated by copy-paste: the size that can go is superseded features plus scattered dead code, and the test suite can shrink by consolidation. The human approved the scope below in chat on 2026-11-22. The work is implemented on branch ccr-8b5cfeb8-q3j117.

Plan

  • Remove the August batch collect flow (hand-dispatched batch record, collect scoring, review packet, --integration), superseded by the shift orchestrator.
  • Remove the per-worker @mention path, unreachable since the questions inbox replaced it; keep the retry for needs-you event comments.
  • Remove the one-off batch questions --backfill.
  • Remove the caller-less board overnight functions and their tests.
  • Sweep confirmed dead code and unused imports.
  • Move dated incident history out of code comments and docstrings (comment-only).
  • Consolidate duplicated test setup, parametrize same-body tests, drop strictly redundant tests.
  • Tier: judge — merge mode: human /prm.

Not in scope (not approved): doctrine and prompt-wording pin tests, and "tombstone" absence tests.

Removing batch collect and batch questions removes CLI surface, so this is not a pure refactor; nothing else changes CLI behaviour.

Detailed implementation plan

Affected Repositories

  • PyAutoBrain (primary)

Branch Survey

Repository Current Branch Dirty?
./PyAutoBrain ccr-8b5cfeb8-q3j117 clean

Branch: ccr-8b5cfeb8-q3j117

Implementation Steps

  1. agents/conductors/batch/_batch.py: delete the 118 symbols reachable only from _main_collect, the collect verb and its flags (--slot, --evidence, --integration, --push, --stamp); delete _integration.py, packet.js, tests/test_batch_collect.py, test_batch_integration.py, test_batch_freeze.py; keep the live record readers in a small tests/test_batch_records.py. Update batch.sh, the batch AGENTS.md, skills/batch/*.md, skills/COMMANDS.md, the registry description.
  2. _orchestrator.py: delete _mention_triggers, mention_body, _note_mention, _mentions; _retry_mentions handles event markers only. _digest.py: drop the "mentioned" suffix, the self-mention warning and the pushes finding.
  3. _questions.py / _batch.py: delete backfill and the questions verb.
  4. board/_board.py: delete collect_overnight, _overnight_line, _overnight_state_item, review_runs; re-point the injected-GitHub-data test at the upkeep leg.
  5. Dead names across agents/, bin/, board/ and four shell files; hygiene scanners share _hygiene_scan.py; three identical intake/cortex helpers move to board/_theme.py.
  6. Comment/docstring pass over all Python source; verified by AST equality with docstrings stripped. Docstrings printed as --help keep their wording.
  7. tests/_helpers.py and tests/_shift_fixtures.py; parametrize; remove redundant tests after moving unique asserts.

Key Files

  • agents/conductors/batch/_batch.py — 4,173 → ~1,900 lines
  • agents/conductors/batch/_orchestrator.py — mention path removed
  • tests/_helpers.py, tests/_shift_fixtures.py — shared test setup

Witness

Full suite passes; batch collect and batch questions exit 2; the surviving batch verbs print byte-identical output before and after against a real Mind; the pre-change orchestrator tests pass against the new source.

Original Prompt

Click to expand starting prompt

PyAutoBrain size reduction: retire superseded batch paths, dead code, test consolidation

Type: refactor
Target: PyAutoBrain
Repos:

  • PyAutoBrain
    Difficulty: medium
    Autonomy: supervised
    Consequence: judge
    Priority: medium
    Status: draft
    Filed: 2026-11-22
    Lane: any

A refactor review of @PyAutoBrain (2026-11-22) found the code is not bloated by
copy-paste; the size that can go is superseded features plus scattered dead
code, and the test suite can shrink by consolidation. The human approved, in
chat on 2026-11-22:

  1. Remove the August batch collect flow (the hand-dispatched batch record,
    collect scoring, the review packet and --integration), superseded by the
    shift orchestrator: the collect code in _batch.py, _integration.py,
    packet.js, their tests and docs.
  2. Remove the per-worker @mention path, unreachable since M3.5
    (_mention_triggers returned []); keep the event-comment retry.
  3. Remove the one-off batch questions --backfill.
  4. Remove the caller-less board overnight functions and their tests.
  5. Sweep confirmed dead code and unused imports.
  6. Move dated incident history out of code comments and docstrings.
  7. Consolidate duplicated test setup, parametrize same-body tests, and drop
    tests that are strictly redundant.

Not approved, so untouched: doctrine and prompt-wording pin tests, and the
"tombstone" absence tests.

Items 1 to 4 remove CLI surface (batch collect, batch questions), so this
is not a pure refactor; nothing else changes CLI behaviour.

Witness: the full suite passes; bin/pyauto-brain batch collect and batch questions exit 2 (unknown verb); for the comment-only pass, every touched
file's AST with docstrings stripped equals its AST before the pass.

Activity

  1. Jammy2211 commented on Nov 22, 2026

    @Jammy2211
    ContributorAuthor

    Shipped in #701 (merged 2026-11-22, merge commit 428fe1e).

    • batch collect, the per-worker @mention path, batch questions --backfill and the caller-less board overnight functions are removed.
    • Dead code swept; incident history moved out of comments (comment-only, AST-checked); test setup consolidated.
    • Python source 46,657 → 42,971 lines; tests 40,294 → 37,314; test functions 2,106 → 1,899.
    • Full suite: 2,448 passed, 3 skipped; CI green on 3.12 and 3.13. A live watcher tick was not run.

    Follow-ups not done here: the dashboard batch status box and plan's "carried" read still reference collect-written record keys; PyAutoMind and PyAutoHeart docs still mention batch collect.


    Generated by Claude Code

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions