You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
lib/core/controlplane.rb (575 lines, ~70 public methods) is the everything-wrapper for the cpln CLI: images, workloads, domains, volumesets, cron, logs, apply. Two specific pain points beyond sheer size:
Regex-scraped apply results.parse_apply_result (#L449) carries three rubocop:disable Metrics/* and extracts created/updated resources by regex-matching cpln apply stdout. If Control Plane changes its output format, parsing silently returns an empty list — downstream code can't tell "nothing created" from "format changed".
Proposed approach (slice per PR, behavior-preserving)
Extract ApplyResultParser with its own unit spec built from captured real cpln apply outputs (fixtures). Emit a warning when the command succeeded but zero items parsed — that's the "format changed" tripwire.
Check whether cpln apply (and other scraped commands) support structured output (--output json); prefer it where available and keep the regex parser as fallback.
Split Controlplane incrementally into resource-scoped collaborators (e.g. image/workload/domain/volumeset managers) behind the existing facade so call sites migrate gradually. One resource family per PR.
ApplyResultParser unit-tested against real captured outputs; zero-items-on-success warns
controlplane.rb reduced to a facade (or removed) with resource managers individually spec'd
rubocop:disable Metrics/* count reduced in touched files, not carried over
Full fast suite green in CI; at least one manual :slow/dispatch run before release since apply/deploy paths are load-bearing
Priority / size / dependencies
P3. Size: L (multiple PRs). Blocked by #380 (error paths raise, not exit) and #383 (retry/token changes touch the same seams). Coordinate with #381 on command building.
Origin: automated codebase health review, 2026-07-02, against 7c96df9.
Summary
lib/core/controlplane.rb(575 lines, ~70 public methods) is the everything-wrapper for thecplnCLI: images, workloads, domains, volumesets, cron, logs, apply. Two specific pain points beyond sheer size:parse_apply_result(#L449) carries threerubocop:disable Metrics/*and extracts created/updated resources by regex-matchingcpln applystdout. If Control Plane changes its output format, parsing silently returns an empty list — downstream code can't tell "nothing created" from "format changed".build_command(#L400-L443) mixes command construction, output-redirection suffixes, and temp-stderr bookkeeping in one method (see also Harden CLI command construction: resolve args_join quote-escaping TODO, prefer array-form subprocess args #381 for the argument-quoting side of this).Proposed approach (slice per PR, behavior-preserving)
ApplyResultParserwith its own unit spec built from captured realcpln applyoutputs (fixtures). Emit a warning when the command succeeded but zero items parsed — that's the "format changed" tripwire.cpln apply(and other scraped commands) support structured output (--output json); prefer it where available and keep the regex parser as fallback.Controlplaneincrementally into resource-scoped collaborators (e.g. image/workload/domain/volumeset managers) behind the existing facade so call sites migrate gradually. One resource family per PR.build_command+ redirection handling) into a small builder used by all managers — coordinate with Harden CLI command construction: resolve args_join quote-escaping TODO, prefer array-form subprocess args #381 rather than duplicating it.Acceptance criteria
ApplyResultParserunit-tested against real captured outputs; zero-items-on-success warnscontrolplane.rbreduced to a facade (or removed) with resource managers individually spec'drubocop:disable Metrics/*count reduced in touched files, not carried over:slow/dispatch run before release since apply/deploy paths are load-bearingPriority / size / dependencies
P3. Size: L (multiple PRs). Blocked by #380 (error paths raise, not exit) and #383 (retry/token changes touch the same seams). Coordinate with #381 on command building.
Origin: automated codebase health review, 2026-07-02, against 7c96df9.