Skip to content

refactor(cli): GraphClient enum + read verbs (RFC-009 Phase 3a) - #210

Merged
aaltshuler merged 1 commit into
mainfrom
refactor/graph-client-reads
Jun 13, 2026
Merged

refactor(cli): GraphClient enum + read verbs (RFC-009 Phase 3a)#210
aaltshuler merged 1 commit into
mainfrom
refactor/graph-client-reads

Conversation

@aaltshuler

Copy link
Copy Markdown
Collaborator

First slice of RFC-009 Phase 3 — the fork collapse the matrix (Phase 1) and the shared DTO crate (Phase 2) were built to make safe.

What lands

A GraphClient enum in a new client.rs is the single home for the embedded-vs-remote split: resolve() does the shared preamble (apply_server_flag → token → URI/remoteness) once, and each verb is one method routing to the engine (local) or HTTP (remote). The five uniform read forks — branch list, commit list, commit show, schema show, snapshot — collapse from per-command if graph.is_remote { … } else { … } to one line each. main.rs net −66 lines.

Two referees, both green

  • Parity matrix textually unchanged (parity_matrix.rs — Phase 1) and passing: behavior is identical per verb, including that local reads still open the engine without policy (today's behavior, preserved exactly).
  • Full cargo test --workspace --locked green (60 suites).

Design note

Enum, not the RFC's literal "trait": there are only ever two variants, and inherent async methods avoid async_trait boxing and the apply_schema catalog-validator closure that isn't object-safe (arrives in 3b). Same one-body-two-impls collapse, less ceremony — flagged here so the deviation is on the record.

Scope (this is 3a of three)

  • 3a (here): factory + uniform reads.
  • 3b: write verbs (load, mutate, branch create/delete/merge, schema apply) + the policy-bearing query — the Embedded variant grows a policy context.
  • 3c: export (streaming) + graphs-list, then delete the now-redundant execute_*_remote/execute_* helper pairs.

Noted, not bundled

Two pre-existing dead-code warnings (inferred_config_path, yaml_string) orphaned by #199's scaffold removal surfaced during the build — left untouched here (the plan scoped their removal as a separate cleanup); will clear in a small follow-up.

🤖 Generated with Claude Code

The embedded-vs-remote split gets one home: a GraphClient enum
(Embedded { uri } | Remote { http, base_url, token }) with a resolve()
factory that absorbs the shared preamble (apply_server_flag -> token ->
URI/remoteness) and a verb method per command. The five uniform read
forks — branch list, commit list, commit show, schema show, snapshot —
collapse from per-command if-graph-is-remote else to one line each
(main.rs: -113/+47). Behavior identical per verb (local reads still open
WITHOUT policy, as today); the Phase-1 parity matrix is the referee and
passes textually unchanged.

Enum, not the RFC trait: only two variants ever, and inherent async
methods avoid async_trait boxing and the apply_schema closure that is not
object-safe (3b) — same one-body-two-impls collapse, less ceremony.

Scope: the uniform reads only. The query verb (policy-open + operator-
alias early-return + param merge) joins the write verbs in 3b;
export/streaming and graphs-list in 3c, where the now-shared
execute_*_remote/execute_* pairs get retired.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@aaltshuler
aaltshuler requested a review from ragnorc as a code owner June 13, 2026 14:45

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aaltshuler has reached the 50-review limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@aaltshuler
aaltshuler merged commit 7bfe9c6 into main Jun 13, 2026
7 checks passed
@aaltshuler
aaltshuler deleted the refactor/graph-client-reads branch June 13, 2026 15:02
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