Repository navigation
Conversation
zzylol
added a commit
that referenced
this pull request
Nov 26, 2026
This was referenced Nov 26, 2026
Step 4 of docs/design/repo-layout.md: crates/common holds the data plane's boundary types and traits (requests and results, ingest, plan, query, stores, fallback) with the names of ASAPQuery's engine-boundary design. No implementations and no callers yet. Adds the common package to the CI format check.
common depends on asap-types directly (QueryLanguage, Source), so the Planner sync script rewrites three pins and updates three packages.
The whole-stack review found no second implementation of IngestEngine, QueryEngine, ViewStore or RawDataStore, and no production caller of IngestEngine::ingest, shutdown or QueryEngine::execute_batch. A trait is added with its second implementation, so common keeps the types and FallbackClient (three implementations later in the stack): - ViewStore, RawDataStore and their types (ViewId, ViewInstance*, ViewState), RawDataBatch, IngestEngine and IngestError are deleted, with the Source and RawDataRetention re-exports only they named. - QueryEngine and its batch-of-one tests are deleted; AnswerSource, EngineQueryResult and QueryEngineError stay for the query engine's inherent execute. - The trait-shape test checks FallbackClient alone. - README: the Planner pin is 1d527bc for all three Planner crates.
zzylol
force-pushed
the
refactor/layout-storage-crates
branch
from
November 28, 2026 00:56
5c7cf0f to
f93e5e7
Compare
zzylol
force-pushed
the
refactor/layout-common
branch
from
November 28, 2026 00:56
3f39078 to
d784733
Compare
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.
Summary
precomputeandquery) and steps 6–8 (adapters) have no interface to meet at.docs/design/repo-layout.md(docs(design): repository layout and engine boundaries #874). A new crate,crates/common(packagecommon), holds the boundary types and the one boundary trait,FallbackClient, with the names of ASAPQuery's engine-boundary design (docs(query-engine): design engine boundaries for ASAPPlanner plans ASAPQuery#935). It has no implementations, and no crate uses it yet.querycrate answers withcommon::EngineQueryResultandQueryResult, and steps 6–8's query adapters implementcommon::FallbackClient.Review guide
refactor/layout-storage-crates(refactor: split internal-metrics and storage crates out of data-plane (layout step 3) #877). This is a stacked draft.asap-typesandasync-traitworkspace dependencies and theCargo.lockentry.asap-typesadded) and updates three packages. Its test and README follow.crates/common/src/lib.rs(the public surface), thenquery_engine.rsandfallback.rs.Cargo.lock, the workflow line, the sync script and its test.Behavior: before → after
No change. Nothing calls
commonyet.Interfaces
All of this is new, in
crates/common:Each error type has a
new(message)constructor.Mapping to #935
commonnames plan types only, no executor runtimeQueryRequest.language;QueryLanguagefromasap-typesQueryEvaltimes ini64msQueryResult::{Scalar, Table}QueryResult(LabelSetper series)PlanIdcounterInstalledPlan { id, plan }AnswerSource::Planned { plan, root };CapabilityMatchedlaterEngineQueryResult::{Ready, NotReady}QueryEngineErrora single typeFallbackClienttakesQueryRequestDeviations from #935
QueryEval, not an unnamedevalenum (the design doc saysEval)QueryRequestcode (ProjectASAP/ASAPQuery#937) names itQueryEval, so adapters moved from there compile unchangedQueryResultelement structs carrylabels: LabelSet(names and values). ASAPQuery's carryKeyByLabelValues(values only),timestamp: u64and avaluesfieldtimestamp_ms: i64per decision 7;seriesholds series). Moved adapters map these fieldsFallbackClient::execute(request, headers),FallbackResponse { status_code, content_type, body },FallbackError. ASAPQuery hasexecute_query,execute_query_with_headers,FallbackResponse::{Json, Text}andStatusCodeerrorscommon, so a status code is au16and headers are(name, value)pairs. The backend's proxy forwards the client's headers and returns the backend's status, content type and bytes unchanged. JSON and TSV fit that form, and no parse is needed. One method with aheadersslice covers both of ASAPQuery's methods.get_runtime_infowaits for T4async-traitArc<dyn FallbackClient>(#935's pseudocode). Nativeasync fnin traits is not object safe on this toolchain (1.98)IngestEngine,QueryEngine,ViewStoreorRawDataStoretrait (decisions 2, 8, 13, 43–47 name them), and noRawDataBatch,IngestError,ViewIdorViewInstance*installand the query engine'sexecuteare inherent methods in step 5Algorithm changes
None. The crate has no logic.
Decisions and open questions
Needs reviewer decision: none.
Decided (judgment calls made in this PR):
asap-plannerplusasap-types, notasap-executor.InstallablePlanis defined only inasap-planner, which re-exportsPhysicalASAPDAG,PhysicalASAPNodeIdandRawDataRetention.QueryLanguageandSourceare only inasap-types.asap-typesis added at the same rev and the sync script keeps all three pins together.commonnames no executor item.asap-planneritself depends onasap-executorand the frontends, so they still compile as transitive dependencies. Dropping that would mean replacingInstalledPlan.planwith its DAG and query texts (a deviation from decision 42), so this PR keeps decision 42.IngestEngine,QueryEngine,ViewStoreandRawDataStore. Across the stack, each had exactly one implementation;storage::boundary(the onlyViewStore/RawDataStoreimplementations) had no production caller, nor didIngestEngine::ingest,shutdownorQueryEngine::execute_batch; and the onlydynengine use wasPlanInstaller's, which existed for a test fake. So they are deleted with their types (and theSourceandRawDataRetentionre-exports only they named);storagekeeps its own state codecs.QueryRequest, the result types andFallbackClientstay.QueryOutcomeandNotAnswerableReasonwait fordata-plane(step 5). OnlyQueryDispatcherand the HTTP routes that call it use them. Adapters never see them. If step 6's HTTP adapter turns out to need them, they move here then.PhysicalASAPDAGre-export. No signature names it. Callers reach it asInstallablePlan.dag.LabelSetis a type alias forBTreeMap<String, String>, the shapestorage::series_ids::Labelswraps. A sorted map gives one order for each label set.AnswerSource::CapabilityMatchedis a comment, not a variant. Adding it later will break exhaustive matches, which is the point.Verification
Run on one remote host with
ulimit -nraised, as in #877.cargo fmt --all -- --checkcargo clippy --workspace --all-targets --locked -- -D warningscargo test --workspace --lockedforward_mode::bodies_wait_for_a_raw_store_that_is_downandplanner_executor_parity::push_precompute_stores_the_window_paths_view_rowsfailed once under load, timing-dependent, and passed alone, 3/3 and 1/1)python3 -m unittest discover -s scripts/ci -p 'test_*.py'The only new test is
the_fallback_client_is_usable_as_a_trait_object(tests/trait_shapes.rs): it implementsFallbackClientoutside the crate with a trivial fake and holds it asArc<dyn FallbackClient>.An independent review covered over-abstraction, naming, fidelity to #935, dependency direction, correctness, and dead code; a later whole-stack review dropped the engine and store traits (see Decisions). Fixes in this head:
FallbackClient::executetakes the client's headers. Without them, step 6 would lose the header forwarding the proxy does today.LabelSetis at the crate root.asap-plannerbrings in transitively.1d527bcforasap-planner,asap-executorandasap-types(it said737bfb1).Follow-ups
QueryEval,Table(Table), theFallbackClientabove, the transitiveasap-plannernote, and no engine or store traits.QueryOutcomeandNotAnswerableReasonlive indata-plane(step 5).series_ids,millisandwindow_endstay instorage: nocommonitem needs them.