Skip to content

Control-plane resolver: centralize local-vs-server dispatch (phases 1+2)#88

Merged
sox8502 merged 2 commits into
mainfrom
daniel/control-plane-resolver
Jul 18, 2026
Merged

Control-plane resolver: centralize local-vs-server dispatch (phases 1+2)#88
sox8502 merged 2 commits into
mainfrom
daniel/control-plane-resolver

Conversation

@sox8502

@sox8502 sox8502 commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

What

Two stacked commits implementing phases 1–2 of the control-plane separation plan.

Commit 1 — the resolver (src/local/resolve.rs)

The single place that answers "does this id belong to the local store or the server api?":

  • ProjectRef / resolve_project (keyed on local_projects)
  • RunRef / resolve_run — wraps the existing local::local_run test (a run is local iff its experiment is in local_experiments; store membership alone is not enough, since server HF runs also land in runs)
  • 8 reject-guard commands → one-line is_local() guards; Store::open_at(dir) so tests use throwaway temp dirs instead of mutating the process-global ORX_DATA_DIR

Commit 2 — total-match dispatch + ExperimentRef

  • ExperimentRef / resolve_experiment (keyed on local_experiments) — exp.rs's five experiment-scoped sites (status/cmd/desc/run/cancel) and both wait branches route through it
  • The six dual-mode commands (exp, runs, logs, project, report, create-experiment) convert from if local { return … } early-returns to a uniform total match { Local => local_fn, Server => run_server }, with server bodies extracted byte-for-byte into named fns — the mechanical hoist target for the later ControlPlane trait
  • Credentials stay inside the server arms: local mode keeps working logged-out

What deliberately did NOT change

  • Zero behavior change in both commits — only the decision and the code's shape moved.
  • up.rs / supervise.rs keep direct store calls (lookups + the local→cloud mirror bridge, not ownership dispatch).
  • client::Run vs StoredRun still coexist — domain-type unification is Phase 3 (own PR; it touches wire formats on the up API and CLI output).

Verification

  • 6 resolver unit tests, incl. the regression guard that a server HF run present in the local runs table resolves Server.
  • cargo fmt --check / clippy -D warnings / cargo test --locked (187 passed) green on both commits.
  • End-to-end smoke against an isolated ORX_DATA_DIR + XDG_CONFIG_HOME: local arms (runs/logs/exp status) serve from the store logged-out; server arms stop at the login check without touching the api; reject-guards fire the exact unsupported message.
  • Two independent 4-agent review rounds (2 correctness incl. adversarial + 2 quality each), one per phase — both unanimous no-blockers; nits applied.

sox8502 added 2 commits July 17, 2026 18:07
Commands used to hand-roll the "is this id a local project/run or a
server one?" decision as a copy-pasted get_local_project / local_run
fork across 14 files. Add local::resolve — ProjectRef/resolve_project
and RunRef/resolve_run (which reuses local::local_run, since store
membership alone is not enough: server HF runs also live in the runs
table) — and route every dispatch site through it. Reject-guard sites
use the is_local() guard form; dual-mode sites carry the fetched
project through the Local arm, so no second store lookup.

up.rs and supervise.rs keep their direct store calls deliberately:
those are lookups and the cloud-mirror bridge, not ownership dispatch.

Store::open_at(dir) lets the resolver's tests run against a throwaway
temp-dir store without mutating the process-global ORX_DATA_DIR, which
the localbox lifecycle test owns under the parallel test runner.

Phase 1 of the control-plane separation plan; a later phase abstracts
the per-arm bodies behind the resolver.
Convert the six dual-mode commands (exp, runs, logs, project, report,
create-experiment) from local-early-return guards to a uniform total
match over the resolver, with server bodies extracted into named
run_server-style fns — the mechanical hoist target for the later
ControlPlane trait. Adds ExperimentRef/resolve_experiment (keyed on
local_experiments) and routes exp.rs's five experiment-scoped dispatch
sites plus both wait branches through it.

Bodies are unchanged; credentials stay inside the server arms so local
mode keeps working logged-out. Verified end-to-end against an isolated
data dir + config (local arms serve from the store; server arms stop at
the login check without touching the api).
@sox8502 sox8502 changed the title Centralize local-vs-server control-plane dispatch in a resolver Control-plane resolver: centralize local-vs-server dispatch (phases 1+2) Jul 18, 2026
@sox8502
sox8502 merged commit 8d07767 into main Jul 18, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant