Break up aggregation god-files (cli.py ~4k, operator_status ~1.9k) via per-module registration #254
Labels
No labels
agent/claude-code
agent/codex
agent/gemini
agent/hermes
agent/iskra
agent/ollama
agent/patchwarden
area:business-model
area:competitive
area:discovery
area:forgejo
area:metrics
area:product-strategy
area:v0-core
cagan-grade-approved
client:platform
dependency/blocked
dependency/blocks-others
dependency/cross-repo
dependency/needs-confirmation
domain:agents
domain:ci
domain:docs
domain:forgejo
domain:infra
domain:memory
domain:runtime
domain:signal
domain:ux
flow/architecture
flow/blocked
flow/deployed
flow/done
flow/implementation
flow/intake
flow/maintained
flow/observed
flow/ready
flow/refining
flow/retired
flow/review
judge/codex-candidate
judge/hermes-candidate
judge/low-confidence
judge/needs-refinement
judge/operator-needed
judge/p0
judge/p1
judge/p2
judge/p3
judge/park
judge/patchwarden-candidate
judge/stale-priority
kind/adr
kind/bug
kind/chore
kind/feature
kind/infra
kind/ops
kind/refactor
kind/research
kind:artifact
kind:decision
kind:dogfood
kind:epic
kind:implementation
kind:research
merge/auto
merge/manual
merge/manual-dependency-conflict
merge/manual-failing-tests
merge/manual-merge-conflict
merge/manual-missing-review
merge/manual-operator-preference
merge/manual-red-zone
merge/manual-security-sensitive
merge/manual-unclear-scope
merge/manual-unknown
mode:operator-only
mode:patchwarden-iskra-approved
mode:safe-auto
observed/erroring
observed/needs-followup
observed/pending
observed/retire-candidate
observed/unused
observed/used
priority:p0
priority:p1
priority:p2
priority:p3
ready-for-agent
review:claude-reviewed
review:codex-reviewed
review:dziadek-reviewed
review:needs-human
safety:external-write
safety:no-prod-mutation
safety:prod-impact
safety:secret-touch
size/large
size/medium
size/small
size/tiny
size/unknown
source/adr
source/agent-generated
source/manual
source/operator-chat
source/voice-note
status:blocked
status:blocked-on-discovery
status:cagan-grade-review-pending
status:codex-ready
status:merged:pending-evidence
status:needs-evidence
status:needs-operator-decision
status:operator-needed
status:parked
tier:0-anchor
tier:0-platform-substrate
tier:1-core
tier:1-iskra-value-layer
tier:2-supporting
tier:2-tools-products-modules
type:bug
type:chore
type:docs
type:feat
type:policy
type:research
wave:1-foundation
wave:2-positioning
wave:3-validation
wave:4-economics
wave:5-operating
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
pdurlej/patchwarden#254
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Source: operator chat + architect review (
claude), 2026-06-26. Companion to decision D29 (modular-monolith boundaries). Not a floor change — internal structure for context economy, not behavior.Problem
Patchwarden is already a clean modular monolith (75 bounded stdlib-only modules). But two seams grow O(number of modules) because each new module wires itself inline:
cli.py(~4054 LOC) — every contract adds itsadd_parser+add_argument+ dispatch here (+50–82 LOC per contract, observed tick-over-tick).operator_status.py(~1937 LOC) — every module appends its status section here (+14–120 LOC per feature).Why it matters (the real driver, not tidiness)
The medium-term direction (D29) is per-module ownership — a dedicated agent thread health-checking each module on a cadence. That only works if "a module" is self-contained and context-window-sized. A 4k
cli.py+ 1.9koperator_status.pysmear every module's surface across two god-files and kill agent-context economy. Boundary test: "can one agent own this module in isolation without loading half the repo?" — today, for anything CLI- or status-facing, the answer is no.Proposed approach
Invert the dependency to a registry/hook:
register_cli(subparsers)(owns its own subparser + args + handler) and astatus_contribution(...);cli.py+operator_status.pybecome thin dispatchers (~200 LOC) iterating the registry;Priority
Below the live-lap wedge — this is enabling infra, not capability. Do incrementally/opportunistically, not as a campaign. Keep stdlib-only; no new dependencies.
Refs: decision D29; operator chat 2026-06-26.
Progress update from Codex:
d42023da:core-modulesandcore-module-stacknow register throughcli_core_modules.pyinstead of wiring parser + handler logic directly insidecli.py.cli.pyno longer importscore_module_registry/resolve_core_module_stackdirectly.1048 passed, 163 subtests passed, plus self-dogfood checks green.Remaining #254 work: repeat this pattern for additional command families, then apply the same per-module contribution pattern to
operator_status.py. Keeping this issue open.Progress update from Codex:
afbc8b33:issue-checkandpr-checknow register throughcli_policy_checks.pyinstead of wiring parser + handler logic directly insidecli.py.cli_support.pyfor shared CLI-only output andrequired-checkparsing, soevaluate/contract-prreuse the same parser without keeping policy-check handlers in the godfile.cli.pyno longer importsIssueInput,PullRequestInput,evaluate_issue, orevaluate_pull_requestdirectly.1049 passed, 163 subtests passed, plus self-dogfood checks green.Remaining #254 work: continue moving command families out of
cli.py, then apply the same contribution/registration pattern tooperator_status.py. Keeping this issue open.Progress update from Codex:
5a7c127b:external-wiring-backlog-checkandhandoff-contractsnow register throughcli_external_contracts.pyinstead of wiring parser + handler logic directly insidecli.py.cli.pyno longer importsExternalWiringBacklogInput,evaluate_external_wiring_backlog,handoff_contract_registry, orrender_handoff_contract_registrydirectly.1050 passed, 163 subtests passed, plus self-dogfood checks green.Remaining #254 work: continue moving command families out of
cli.py, then apply the same contribution/registration pattern tooperator_status.py. Keeping this issue open.Progress update: merged PR #261 (
9671df162a58) as another #254 slice.Done in this slice:
src/patchwarden/cli_artifact_roots.py;cli.pyas a registration consumer for those commands;1052 passed, 163 subtests passedbefore merge.Remaining #254 scope: continue splitting the larger aggregation surfaces, especially
operator_status, into per-module registration/inventory pieces.Progress update: merged PR #262 (
4041524459c0) as the next #254 slice.Done in this slice:
patchwarden.operator_dashboard_read_model.v1construction intosrc/patchwarden/operator_dashboard_read_model.py;operator_status.pyas the status SSoT and renderer entry point;operator_status.py;1053 passed, 163 subtests passedplus green self Forgejo checks before exact-head merge.Remaining #254 scope: continue shrinking
operator_status.pyby moving additional status contributions/artifact drilldowns toward per-module registration.Progress update: merged PR #263 (
c2b505096a93) as another #254 slice.Done in this slice:
src/patchwarden/operator_artifact_drilldowns.py;operator_status.pyas the status SSoT and renderer entry point;operator_status.pyto 1424 lines in this worktree after the split;_artifact_drilldownsdoes not drift back intooperator_status.py;1054 passed, 163 subtests passedplus green self Forgejo checks before exact-head merge.Remaining #254 scope: continue converting the remaining status payload sections into per-module contributions/registries.
Progress update: merged PR #264 (
451ed88909f4) as another #254 slice.Done in this slice:
src/patchwarden/operator_external_wiring_backlog.py;external_wiring.py's dependency onoperator_status.py;operator_status.pyto 1266 lines in this worktree after the split;EXTERNAL_WIRING_BACKLOGout ofoperator_status.pyand keeps the checker importing the catalog directly;1055 passed, 163 subtests passedplus green self Forgejo checks before exact-head merge.Remaining #254 scope: continue converting remaining status payload sections, especially dogfood wedge/status contribution data, into per-module contributions or registries.
Progress update: merged PR #265 (
24f6d9bf0c69) as another #254 slice.Done in this slice:
src/patchwarden/operator_dogfood_wedge.py;operator_status.pyas the status SSoT and renderer entry point;operator_status.pyto 1216 lines in this worktree after the split;_dogfood_wedgedoes not drift back intooperator_status.py;1056 passed, 163 subtests passedplus green self Forgejo checks before exact-head merge.Remaining #254 scope: continue converting the remaining inline status payload sections, especially protection/passsage-layer catalogs, into per-module contributions or registries.