Skip to content

Add serve-multi: one query service for several repositories - #618

Merged
tinder-maxwellelliott merged 1 commit into
masterfrom
maxwelle/serve-multiple-repos-97dfc0
Nov 4, 2026
Merged

tinder-maxwellelliott merged 1 commit into
masterfrom
maxwelle/serve-multiple-repos-97dfc0

Conversation

@tinder-maxwellelliott

Copy link
Copy Markdown
Collaborator

Summary

bazel-diff serve-multi --repo NAME=PATH [--repo NAME=PATH ...] runs the impacted-target query service for several git clones in one process. serve is untouched.

  • Per-repository state, shared caches. Each repository has its own workspace lock, git/Bazel binding, readiness flag and counters, so queries against different repositories run concurrently. The memory, --cacheDir and remote (S3/GCS/Nexus) tiers are shared: cache keys are tree hash + configuration fingerprint, so identical trees in two clones share one entry by design.
  • Request routing. Clients pick a repository with repo= (query string on GET and POST; a POST body repo wins). One repository → repo is optional. Several → missing repo is a 400, unknown is a 404; both errors list the served names. The readiness check now runs after input parsing and per repository.
  • /health and /metrics. /health is ready when every repository is. /metrics keeps its existing top-level fields as aggregates (summed counters, any-busy) and adds a repositories map with per-repo workspace/ready/activeQueries/workspaceBusy/counters.
  • Startup. Initial fetch and warmup run per repository in parallel; one cache pruner.
  • CLI. ServeMultiArgs flattens ServeArgs, so every serve flag is available and the two can't drift; --workspacePath is hidden and conflicts with --repo. To support that, HashingArgs.workspace_path became Option<PathBuf> with required = true (accessed via HashingArgs::workspace()); serve --help is byte-identical to before.

Tests

  • //src:cli_tests: serve-multi parsing (normalization, missing/conflicting/invalid --repo, duplicate names) and serve unchanged.
  • //src:rust_tests: repository name/spec validation; routing across two real git repositories (400/404/200, POST body precedence, shared cache key for identical trees, per-repo readiness, /metrics shape).
  • e2e: new core::serve_multiple_repositories (two workspaces, divergent edits, cross-repo SHA rejected, metrics), plus the existing serve e2e cases.
  • //tools/e2e:regen_check, README generator build, clippy clean.

Docs

README (template + generated) gains a "Serving several repositories" section, the repo= parameter on the endpoints, the repositories metrics field, and the serve-multi CLI help block.

🤖 Generated with Claude Code

`bazel-diff serve-multi --repo NAME=PATH ...` serves several git clones
from one process. Each repository gets its own workspace lock, git/Bazel
binding, readiness flag and counters, so queries on different
repositories run concurrently; the memory, disk and remote cache tiers
are shared, since cache keys are tree + configuration fingerprint and
identical trees in two clones share an entry on purpose.

Requests select a repository with `repo=` (query string on GET/POST;
a POST body `repo` wins). With one repository the parameter is
optional; with several, a missing `repo` is a 400 and an unknown one a
404, both listing the served names. `/health` reports all repositories
ready; `/metrics` keeps its top-level fields as aggregates and adds a
`repositories` map. Startup fetch and warmup run per repository in
parallel.

`serve` is unchanged (its one repository is named `default`).
`serve-multi` flattens `ServeArgs` so the two commands share every
flag; `--workspacePath` is hidden and rejected there, which is why
`HashingArgs.workspace_path` became `Option<PathBuf>` with
`required = true`.

Adds CLI parsing tests, a routing unit test over two real git repos,
the e2e case `core::serve_multiple_repositories`, and README docs
(including the `serve-multi` CLI help block).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@tinder-maxwellelliott
tinder-maxwellelliott merged commit 91998fa into master Nov 4, 2026
19 checks passed
@tinder-maxwellelliott
tinder-maxwellelliott deleted the maxwelle/serve-multiple-repos-97dfc0 branch November 4, 2026 00:57
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