ControlPlane trait: plane-agnostic dual-mode commands (v0.1.63)#90
Merged
Conversation
Phase 3 (final) of the control-plane separation. Adds src/plane.rs — a #[async_trait(?Send)] ControlPlane trait with 14 verbs derived from the six dual-mode commands' paired arms — with ServerPlane (wraps client.rs, connects via require_credentials on the server arm only, with a sync ServerPlaceholder so pre-login guards keep firing before the login check) and LocalPlane (owns the Store; ?Send because rusqlite is !Sync — planes are driven inline under block_on and never spawned). The six commands collapse to resolve-once-then-verb; their local/server bodies move verbatim into the plane impls. Printing stays in the impl where the two planes differ (status blocks, launch recaps) and in the command where shared (runs table, logs footer). Domain type plane::Run (+RunLog/RunOrigin) merges the two run_failure_detail twins — output.rs no longer depends on client::Run. CLI-facing only: local::model (the up-API wire), the SQLite schema, and the client.rs DTOs are untouched, verified by byte-identical golden snapshots of the affected commands on a seeded isolated store. The plane lives outside src/local/ because local/mod.rs's invariant (nothing there calls client.rs) would otherwise break. up.rs and supervise.rs stay off the trait as the deliberate cloud-mirror bridges.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Final phase of the control-plane separation (#88 was phases 1–2). Adds
src/plane.rs:ControlPlanetrait (#[async_trait(?Send)], 14 verbs derived mechanically from the six dual-mode commands' paired local/server arms)ServerPlane— wrapsclient.rs; a syncServerPlaceholderruns pre-login guards first, thenconnect()fetches credentials exactly where the old server arms calledrequire_credentialsLocalPlane— owns theStore;?Sendbecause rusqlite is!Sync(planes are driven inline underblock_on, never spawned — documented invariant)plane::Rundomain type (+RunLog/RunOrigin) — merges the tworun_failure_detailtwins;output.rsno longer depends onclient::RunThe six dual-mode commands (
exp,runs,logs,project,report,create-experiment) are now thin: parse →resolve_*(id)→ verb. Their bodies moved verbatim into the plane impls (commands shed ~2,000 lines).Wire safety
Domain types are CLI-facing only.
local::model(theup-API → UI wire), the SQLite schema, and theclient.rsDTOs are untouched — none appear in the diff. Golden snapshots of all affected commands (local + server arms, incl. failure-detail rendering) captured on the pre-change build and re-diffed after: byte-identical.src/planelives outsidesrc/local/deliberately —local/mod.rs's invariant (nothing there callsclient.rs) holds;local::resolveremains the pure decision layer.up.rs/supervise.rsstay off the trait as the cloud-mirror bridges; end-state layering verified by grep: commands → plane → {client | local+store}.Verification
cargo fmt --check/clippy -D warnings/cargo test --locked(193 passed; 6 new plane tests incl. all threeRunOriginfailure wordings and the byte-exactLocalPlaneunsupported message)ORX_DATA_DIR+XDG_CONFIG_HOME: local arms logged-out, server arms stop at the login check,exp descset/get/conflict paths, report guidanceexp descstdin now resolves after the login check restoring pre-trait ordering;ServerPlane::reportuses its own resolved id)