Skip to content

Refactor: actor-discriminator-capture-gate test files exceed 600-line maintainability threshold #815

@michael-wojcik

Description

@michael-wojcik

Context

PR #808 introduced + significantly grew two test files that now exceed the 600-line maintainability threshold flagged by the file-size advisory hook throughout the PR's development:

Combined: 3060 lines across the two files.

These are siblings to issue #807 (which tracks the same threshold violation for wake_lifecycle_emitter.py + 4 test files) but are NOT covered by #807's affected-files table.

Why this issue exists separately from #807

Per architect's verify-only re-review of PR #808 (commit c8927704), the architect initially claimed #807 was the right structural-debt owner for the cosmetic-cleanup-cycle observation, but on §AUDIT discipline correction recognized that #807's affected-files table is:

  • wake_lifecycle_emitter.py (1041 lines, production)
  • test_wake_inbox_drain.py (1783 lines)
  • test_inbox_wake_lifecycle_emitter.py (1230 lines)
  • test_wake_lifecycle_emitter.py (869 lines)
  • test_wake_lifecycle_arm_edge_cases.py (683 lines)

The 2 capture-gate-bundle test files are NOT in that table. Filing as a sibling issue rather than expanding #807's scope keeps the two refactor surfaces independently trackable.

Why this isn't urgent

Per the verify-only re-review verdict (architect APPROVE, security-engineer PASS): the 5-cycle polish chain that grew these files was shippable — each cycle was small, disk-grounded, and downstream of the empirical-pivot (capture-campaign) in PR #808. The growth pattern is not pathological churn; it's normal post-pivot polish on a pivot-class commit. The file-size threshold violation is structural debt to address in a focused refactor, not a merge blocker.

Proposed approach (when this issue is picked up)

Per the architect's open question to the orchestration_calibration corpus: pivot-class commits on hook_infrastructure scope should pre-allocate +2-3 polish cycles. PR #808's 5-cycle realization is the empirical anchor. The refactor PR should:

  1. Decompose test_actor_discriminator_capture_gate.py (1360 lines, 12 test classes per the Coverage Map TOC at L14-26) along the TS-1..TS-12 boundary — possibly into 2-3 focused test modules.
  2. Decompose test_teardown_request_emitter.py (1700 lines) along its test-class boundaries.
  3. Preserve all 101 passing tests; this is a structural refactor, not a behavior change.
  4. Keep the Coverage Map TOC + per-event partition discipline pins intact.

Cross-refs

Severity

type: refactor (not bug, not security). priority: medium — structural debt, not active failure mode; addressing it improves long-term maintainability but doesn't unblock any current work.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions