Repository navigation
refactor(coordinator): reorganize domain ownership and storage backends - #1324
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Threat model review — advisoryReviewed head Review not completed for this head. Previous findings are superseded, not confirmed resolved. Models: budgeted Sonnet / selective Opus / selective Sol 6.1. Findings require human validation; this review never requests changes or blocks merging. Coverage: 0/0 source units; cross-file integration pending. 0 selected depth batch(es) pending. All threat definitions indexed; relevant full definitions selected. Unchanged callers are not scanned. Cost this run: $0.0000 reported, $0.0000 reserved with unknown cost; 0 paid request(s), 0 reused batch(es), 0 provider cache-hit tokens. Saved findings and earlier report · Historical findings are not confirmed resolved. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 965971abf9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…dinator Upstream reorganized the coordinator (#1324): route bindings live in coordinator/api/routes.go, handlers belong to domain owners, the store backends are separate packages and every Go test lives under coordinator/tests. - Bind the three interest routes in routes.go with the same middleware and order; serve them from the accounts owner (coordinator/api/accounts/small_models_interest.go). - Keep the contract in coordinator/store and move the backends to store/memory and store/postgres. The schema statement is still the last appended migration. The page-size clamp both backends share moves to coordinator/internal/store/shared. - Move the tests to tests/api/accounts/contracts, tests/store/contracts and tests/store/postgres with the same names, cases and assertions. The storage-failure test now injects its failing store through the constructor instead of replacing a private field. - Documentation: keep both sides, cite the new paths, add the interface to the store table (the union is now fourteen interfaces) and a navigation row for the feature. The wire contract, SQL and console code are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…zed coordinator Upstream reorganized the coordinator (#1324): response assembly is owned by coordinator/internal/inference/relay, dispatch by coordinator/internal/inference/dispatch, provider ingress and the queue placeholder by coordinator/api/inference, and every Go test lives under coordinator/tests. - Account each decrypted chunk in Owner.HandleChunk before it is classified or queued, and normalize the coordinator-only response_limit terminal in handleInferenceErrorOwned, as before. - Budget the assembler in relay.Controller.NonStream (held first chunks and channel chunks), every dispatched attempt in dispatch.Plan.Dispatch, and the queue placeholder in Primary.Run. - The limits-to-budget rule, which the owner, the dispatcher and the relay all need, is the small package coordinator/internal/inference/responselimit. registry.ResponseBudget and both environment variables are unchanged. - Move the eleven tests, with the same names and assertions, to the owners they exercise: tests/api/inference, tests/api/inference/failure, tests/api and tests/registry. - Documentation: keep both sides, cite the new paths, and note the limit in the coordinator component map, the error-vocabulary row and consumer billing troubleshooting. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…oordinator Upstream reorganized the coordinator (#1324): admission is owned by coordinator/api/inference (Admission), self-route availability by coordinator/internal/inference/routeplan, and every Go test lives under coordinator/tests. - Admission.Run owns the scan permit, releases it, then applies the returned terminal action; Admission.evaluate holds the gates. The statements are those of the original change. - The self-route split lives where master moved its body: Availability.Rejection returns the terminal action and Availability.Unavailable wraps it, so the media-resolution caller keeps its immediate response. - shedIfUnservable returns its terminal action instead of applying it. - Move the two test files to tests/api/inference with the same ten tests and 42 subtests, on the scan gate's real Acquire/Release/InFlight boundary. One assertion that read the Autopilot demand's private finished flag is not expressible there; the handler-exit Finish assertion still pins it for the public modes. - Documentation: keep both changelog entries, cite the new paths, and note the permit scope in the API contract and the navigation guide. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ation onto it The base of this change (the offline conformance suite) now sits on the reorganized coordinator (#1324): the request prelude is owned by coordinator/internal/inference/prelude and every Go test lives under coordinator/tests. - The fix is still one statement: Parser.Parse removes the caller's top-level user and metadata fields right after the request date is pinned, so every provider-bound body derives from the minimized map. The helper moves with it, private to the prelude package. - Master does not omit either field on its own: with the statement removed, both reach the provider on all four endpoints. - Move the tests, with the same names and assertions, to the packages master split the old one into: tests/api/inference/contracts (the HTTP cases and the response oracle), tests/api/inference (prelude, field shapes, prepared cache controls, stop normalization) and tests/api/inference/providerwire (candidate body parity). The contracts package gains a copy of the retry fixture its neighbour already has. - Documentation: keep both sides, cite the new locations, and add a navigation row for the prelude. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Port the log redaction onto the #1324 coordinator layout. Each redacted log field now lives in its new owner file; the personal-data log tests move to coordinator/tests/api (package api_test) and run through the composed router. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Port the explored-provider pricing onto the reorganized registry: - forecast: split IdleEvidenceGap out of EvidenceExplorable and add ExplorationReplacesRate (the per-rate age rule). - performance.Rates: ExploredPrefill/ExploredDecode replace the own rate after a reviewed profile point in Prefill and EffectiveDecode; ProjectedDecode keeps its own chain, as before. - registry: fillExplorationRates stores the replaced medians on the snapshot once per fill; resolve*TPS, candidateSnapshot.rates() and the cache service cost pass them on, and commit skips NoteTTFTPrediction for a median-priced candidate. TPSRegistry gains the isolated-prefill store, fed by the heartbeat. - candidatearena.ChunkSize 55 -> 53: candidateSnapshot grew by two float64 fields, and the size-class test requires a retune. - Tests move to coordinator/tests/registry and use exported and internal APIs only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Port the goose migration runner onto the #1324 layout. - The runner moves to coordinator/store/postgres/migrations.go and replaces the boot-time statement slice there. The SQL baseline and the pg_dump move to coordinator/store/postgres/schema/. The baseline is unchanged: its 255 blocks equal, byte for byte, the statements that master's migrate executes on a fresh database (pgx trace of master and of the old merge base are identical). - The DDL constants that only the old slice used are deleted, including the internal cachemigrations package, privacysql and profilesql/schema.go; tests read those statements from the baseline. - The migration tests and their harness (baselineStatement, forgetMigrationVersions, replayMigrations, loadSchemaFile, schemaSnapshot, queryLines, assertSameLines) move to coordinator/tests/store/postgres/ and use NewPostgres through the fixture. TestConcurrentMigrationsApplyOnce now holds the goose advisory lock while two coordinators start, so it fails at once when the runner does not take the lock. - The DAR-349 dedupe guard also scans the SQL migrations. - Docs and the docs-impact rules use the new paths. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Master #1324 moved every coordinator test under coordinator/tests/ and deleted coordinator/appattest/service/fixtures_test.go. The merge takes master's deletion; the next commit ports the added helpers and tests to the external test packages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…budget onto it The base of this change now sits on the reorganized coordinator (#1324): the receipt tracker is coordinator/internal/registry/cachetracker, plans and claims are coordinator/internal/registry/cacheplan, and every Go test lives under coordinator/tests. - cachetracker/attempt_budget.go holds the charge formula (CacheAttemptCharge), its checked arithmetic, the per-generation byte ledger (AttemptBudget) and the detachment of every retained string. - Tracker.StoreAttemptLocked reports admission and refuses a record that would exceed the ledger; removal refunds the stored charge; terminal, lookup and READY updates keep the admitted charge and store under a cloned nonce. - cacheplan gains Plan.Detached and Claims.Len, which the charge and the detachment consume. - registry: PreparePrefixCacheV2Attempt publishes the owner from the admitted record and leaves the request uncached when admission is refused, as before the move. CacheDependencies.AttemptBudgets constructs the ledger for each generation, like the other per-generation components; the default is the same 64 MiB. - Tests: the 16 new tests keep their names and assertions and move to coordinator/tests/registry with the six edited fixtures. They read the ledger and the indexes through the injected generation components instead of private tracker fields. - Documentation: keep both sides and cite the new locations. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… onto it The base of this change now sits on the reorganized coordinator (#1324), where the prompt-sidecar client and preload controller live in coordinator/internal/promptcontract/{sidecar,preload} and every Go test lives under coordinator/tests. - Cache planning (the planner and its telemetry) moves to coordinator/internal/inference/routeplan, beside the memo that consumes it; Owner.NewCachePlanner binds it, like NewAliasPlanner. - The sidecar client's planning admission (bounded pending plans and bytes, cancellation, per-pool connection budgets) and the per-contract preload readiness go into master's sidecar and preload packages; the public promptcontract files keep master's text plus the wiring. - The Rust sidecar files are byte-identical to the pull request. - Tests move with their names and assertions to coordinator/tests/api/ inference, tests/promptcontract, tests/registry and tests/cmd/ promptsidecarloadproof. Eleven tests that read the sidecar client's private admission state and connection pools are not carried in this commit; they follow with an injected dependency. - Master's TestPreloadControllerComposesRealOwnersForEmptyCatalog expected an empty catalog to make the controller ready. This pull request closes participation for an empty verified set instead, so the test now checks the same composition against that outcome. - Documentation: keep both sides, cite the new locations, two navigation rows for the new owners; three changelog bullets in "cache reliability". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tive set onto it The base of this change now sits on the reorganized coordinator (#1324): the preload controller lives in coordinator/internal/promptcontract/ preload, cache planning in coordinator/internal/inference/routeplan, and every Go test under coordinator/tests. - The demand-based active set, selection order and conflict handling sit beside the preload controller in internal/promptcontract/preload, private as written. Above capacity it loads only contracts with demand, so more than eight verified contracts no longer turn cache planning off for every model. - The verified-artifact handoff moves to internal/promptcontract/catalog; the public provisioner adds the closed check. Planning changes go into routeplan; the registry projection callback is a method of the inference owner; cache_plan_preflight.go and cache_preload_identity.go stay in coordinator/registry. - e2e changes are carried line for line. - Tests move with their names and assertions to coordinator/tests. 32 new tests that drive the private active-set policy or the controller's private clock and lock are not carried in this commit; they follow with injected dependencies. Master's TestPreloadControllerDiscardsChangedGenerationsDuringPreload gets a verified aggregate in its setup, the same synthetic-setup change this pull request makes to its own tests. - Documentation: keep both sides and cite the new locations; changelog bullets in "cache reliability". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n onto it The base of this change now sits on the reorganized coordinator (#1324). This part is provider (Swift) code plus one coordinator test and documentation, so little moves: - The provider sources and tests merge unchanged; the reorganization did not touch them. - TestDiagnosticCacheEpochFanout moves to coordinator/tests/registry as an external test. It registers the two-model provider through the real registration path, seeds holders through the generation's tracker, and reads the epoch-change removals from the lifecycle status and the injected holder directory instead of private tracker fields. Same assertions. - A comment in SSDHybridCheckpointStore+ReadAttempt.swift no longer names a superseded SDK pin (from the private remediation reviewed on 2026-10-03). - Documentation: three pages conflicted only in their freshness stamps. The changelog's three bullets move into this stack's "cache reliability" section. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he tests onto it The base of this change now sits on the reorganized coordinator (#1324). This part adds no production code: composed tests, a benchmark and documentation. - The six composed cache-planning test files move to coordinator/tests/api/inference as external tests, where the planning fixtures and the retained reservation controller live. All six tests, their subtests and assertions are kept. - The generic preparation baseline and its benchmark move to coordinator/tests/api/inference/contracts beside the bench fixture, which gains the optional dispatch observer and testing.TB cleanup. - The three polled reads of the outstanding service hold go through conformance.OutstandingServiceHold on the fixture's reservation controller instead of a private map. - The response oracle the composed tests share with the privacy contract tests is copied into the owner test package. - Documentation: test commands and cited paths follow the new layout. The changelog needs no entry of its own; its bullets already sit once in "cache reliability". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#1324 moved coordinator/api/dispatch.go to coordinator/api/inference/dispatch.go. The design record still linked the old path, so docs-check fell back to history. That lookup stopped at the legacy stamp commit 973e14b from #1245, which is not in master history, and docs-check failed. Point the "Reservation, plans and retries" code-map link at the new file, the same home that architecture/first-content-routing.md cites for dispatchState. The record status is "In progress", the column is "Current integration point", and the freshness stamp stays unchanged because this is a path move only. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Summary
Reorganize coordinator ownership and isolate every coordinator Go test in the
mirrored
coordinator/tests/tree. Tests exercise the actual router, backends,transports and production-consumed components with retained constructor inputs.
Production packages do not contain
_test.gofiles or import test infrastructure.The existing PR commits establish domain owners, application assembly and storage
backends. This follow-up replaces their colocated private tests with genuine
component boundaries while retaining the original test names, assertions,
benchmarks, backend matrices and deterministic race schedules.
Consumer and provider wire shapes, auth distinctions, routing/admission policy,
load and activation safeguards, billing arithmetic, SQL behavior and release
versions remain unchanged. One inference owner still arbitrates active requests,
cancellation, late terminal events, refunds and settlement.
Before And After
api/testsandstore/testscontract treescoordinator/tests, mirroring owning production domains-coverpkgacross shard binaries; test fixtures/database plumbing excludedtests/protocol/testdata; Swift and TypeScript consumers updatedNo overlays,
go:linkname, reflection-based private access, copied productionimplementations, raw-state facades or arbitrary exports are used to make relocated
tests compile. Exported configuration contracts remain only where real callers
consume them. Mutable implementation state remains private.
File Trees
Abbreviated to changed boundaries. The Before tree describes the original PR base;
the test-preservation audit additionally uses published commit
d341dea82as thefrozen pre-isolation checkpoint.
Before
After
Before
After
Blue represents callers, assembly and test discovery; purple represents explicit
production owners/components; green represents preserved transitions and outcomes.
Validation
Validated the strict-isolation follow-up from a clean checkout of signed commits
63f5f88a2anddab7ba200, using a dedicated disposable PostgreSQL server.Follow-up
859060a5ffixes large-list pre-push component detection, with afailing-before/passing-after regression and all 20 runner/hook guards passing.
No production databases or coordinator endpoints were used. The clean checkout
includes the pinned
libs/mlx-swift-lmsubmodule needed by documentation links.go test ./coordinator/tests -count=1passes from the clean checkout-count=10; all 35 inference-media cases race-count=5pass-count=20, builds and vet pass-count=5, deterministic race-count=20, bounded fuzzing and 14 Rust shared-vector/planner tests passcoordinator/tests/api/inference/requestgolangci-lint v2.1.6: zero issues in the final clean checkout;go vet ./coordinator/...,gofmt, and whitespace checks passCore reproduction commands (set
DATABASE_URLto a dedicated local disposablePostgreSQL server, not production):
The coverage instrumentation scope changes with package isolation. Coverage
percentages are not presented as a like-for-like improvement. Local hardware-backed
provider E2E and Swift runtime tests were not run: this validation checkout does
not have the complete MLX-Swift build dependencies or a loaded provider model.
The seven Swift fixture consumers were reviewed for correct relocated paths.
No release, deployment, merge or provider-version bump is included.
Review Follow-Ups
Signed commits
c0d23710eand8ea5bf6b3restore behavior-specific documentationgates for relocated billing/settlement, Autopilot demand, inference metrics,
registry eligibility/gate/queue/candidate/quote-plan owners, and shared protocol
fixtures. The App Attest README now documents real component ownership and
mirrored test commands instead of selectors that discover zero tests.
The new guard covers 29 actual source/fixture paths, rejects every unrelated
canonical-document combination, accepts each allowed domain document, and
preserves Go test-file exclusions. All added cases failed before their respective
mapping fixes and pass afterward. All 13 docs-impact tests, 20 runner/hook guards,
documentation lint (330 files), and documentation impact checks pass.
Seven independent reviewers examined inference lifecycle/settlement, registry
concurrency/admission, cache routing/persistence, trust/security, storage/billing,
tooling/test preservation, and the targeted mapping patch. They found three
additional documentation/discovery gaps; all were fixed and re-reviewed. No
concrete introduced runtime regressions were found in the reviewed paths. Scoped
normal/race suites passed. To close the reviewers' PostgreSQL execution gap, the
full isolated coordinator race/production-coverage suite was rerun with a dedicated
local PostgreSQL server and passed in 151.8 seconds. No production code changed
in these two follow-ups, and this review is not proof of every possible interleaving.
Signed follow-up
a21f76d1cremoves the provider test-only owner overlay.Heartbeat telemetry/benchmarks and deterministic inventory writer-failure tests
use explicit standalone component fixtures, not an embedded owner with parallel
heartbeat/inventory instances. The new live heartbeat contract checks the actual
composed owner through
/ws/provider, including registry ingestion and telemetryafter an ordered drain barrier. The existing replacement contract checks actual
inventory/readiness wiring on the same socket. Deliberately miswiring the real
heartbeat or inventory constructor to another registry makes the corresponding
transport test fail; those negative controls were restored before publication.
All original named tests, assertions, race schedules and four heartbeat benchmark
workloads are preserved. Full provider normal/shuffled-race suites, repeated live
wiring race tests, benchmark execution, vet, pinned lint (zero issues), layout,
runner guards and docs checks pass. Independent re-review has no remaining
actionable findings. The pre-push complete Go suite passes. This follow-up changes
tests/documentation only, with no production behavior or test-accessor additions.