feat(sketch_db): retire schema/ module — sid-only lifecycle - #189
Merged
Merged
Conversation
…, consumers not yet fixed Mid-refactor checkpoint so a follow-up agent can pick up cleanly. Compile is BROKEN with ~17 unresolved imports — see PR/agent prompt for the remaining consumer list. Done: * AggStatus + DEFAULT_RETIREMENT_RETENTION → lifecycle/status.rs * TimelineSegment + TimelineCoverage → query/timeline.rs * sketch_db/mod.rs re-exports updated * sketch_db/schema/ DELETED * lifecycle/eviction.rs rewritten sid-only, tests rewritten * Internal imports in index/, lifecycle/reconcile.rs migrated Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Drop `SchemaRegistry` / `AggSchema` references from the backfill module tree as part of the schema-retirement big-bang. Specifically: * `storage_engines/mod.rs` no longer re-exports `AggSchema` / `SchemaRegistry` (only `AggStatus` remains). * `BackfillService` and `BackfillWindowProcessor` drop their `schemas: Arc<SchemaRegistry>` field; constructors lose the `schemas` parameter. * `BackfillRegistry::create_checked` swaps its `&SchemaRegistry` + `agg_id` parameters for `&AggregationConfig` + `created_at_ms: u64`. The caller (currently the HTTP handler in drivers/) already has both on hand from its `StreamingConfig` snapshot. The `CreateError::UnknownAgg` variant is retained for HTTP error mapping but is no longer produced by `create_checked` itself — the caller proves the agg exists by holding its config. * Tests that previously dereferenced `schemas.get(agg_id) .created_at_ms` now stamp their own wall-clock millis via a local `now_ms()` helper, matching the registry's own helper. * `create_checked_rejects_unknown_agg` is removed (its case is unreachable in the new signature). The data_plane crate still has ~10 errors outside this slice's scope (precompute_engine / query_engines / drivers / controller) that sibling agents in the parallel retirement big-bang own. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…gestState + main wiring
…re endpoints
Remove the per-`agg_id` `SchemaRegistry` wiring from the HTTP server's
state + builder + lifecycle endpoints and rewire each one against the
sid catalog (`SketchStore`). The legacy `SchemaRegistry` type was
deleted upstream by the schema retirement big-bang; this slice closes
out the consumers in `drivers/query/servers/http.rs`.
* `HttpServer` / `AppState`: delete the `schemas:
Option<Arc<SchemaRegistry>>` field, the matching `with_schemas`
builder, and every clone site (both `run` and `start_test_server`).
* `POST /api/v1/streaming-config`: drop the legacy
`schemas.reconcile(snap)` path entirely; only the sid-level
`lifecycle::reconcile_from_streaming_config(&SketchStore, &cfg,
DEFAULT_RETIREMENT_RETENTION)` survives. Response shape changes:
`schemas_created` / `schemas_retired` →
`sids_retired: [<u64>...]` (no `added` — sids are minted lazily by
the ingest path on first write).
* `GET /api/v1/db/schemas`: same path, sid-level body. Returns
`count` + `schemas: [{sid, metric_name, status, first_seen_unix_ms,
retired_at_ms, expires_at_ms, group_by_keys, agg_kind}]`. Empty
catalog returns 200 + empty array (no more 503).
* `POST /api/v1/db/schemas/:sid/retire` (was `:agg_id`):
`SketchStore::force_retire(sid, DEFAULT_RETIREMENT_RETENTION)`.
* `POST /api/v1/db/schemas/:sid/expire` (was `:agg_id`):
`SketchStore::force_expire(sid)`.
* Backfill handler: drop the inner `state.schemas` guard and pass
`state.sketch_index.as_ref()` to `BackfillRegistry::create_checked`
— the sibling backfill slice owns the `&SchemaRegistry → &SketchStore`
parameter swap on `create_checked` itself.
* Tests: rewrite `setup_test_server_with_hot_reload_and_schemas` →
`setup_test_server_with_hot_reload_and_sketch_index` and
`setup_test_server_with_backfill_and_schemas` →
`setup_test_server_with_backfill_and_sids`. Add a
`register_precompute_sid` test helper. Rewrite
`test_streaming_config_swap_drives_schema_reconcile` →
`_sid_reconcile` (asserts on `sids_retired`), drop the
`_without_schemas_still_succeeds` test (the `schemas` notion is gone
entirely) and replace with `_response_shape_with_empty_catalog`.
Rewrite `test_get_schemas_returns_active_and_retired_with_status_filter`
for the sid body shape; add
`test_post_schema_retire_and_expire_endpoints_drive_sid_catalog`.
Re-target the two timeline tests at the new sketch_index helper.
The route paths `/api/v1/db/schemas{,/:sid/retire,/:sid/expire}` are
kept under their existing `schemas` prefix to avoid breaking external
callers; only the `:agg_id` path segment was renamed to `:sid`.
`AppState` no longer holds a `schemas` field; `main.rs` will drop the
`.with_schemas(...)` builder call in its sibling slice.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
After cherry-picking the four parallel slices (backfill, engine, ingest, http) onto feat/schema-retire-final, three cross-slice mismatches needed fixing: 1. `drivers/query/servers/http.rs` backfill handler — X3 assumed `create_checked` would take `&SketchStore`, but X1 changed it to `&AggregationConfig + created_at_ms: u64`. Rewired the handler to look up the agg-config from the hot-reload streaming-config snapshot (404 on miss) and derive `created_at_ms` as the earliest live `first_seen_unix_ms` from the sid catalog, falling back to wall-clock-now when no sid has ingested data yet. Test fixture `setup_test_server_with_backfill_and_sids` now builds a `StreamingConfig` + `HotReloadStreamingConfig` matching the active agg_ids so the lookup succeeds. 2. `drivers/ingest/otel.rs` `flush_barrier_drops` — X4 deleted `IngestState::record_barrier_drop` (the §6.3 counter was neutered in PR #187), but the helper was still calling it. Stubbed the helper to log-only. 3. `precompute_engine/output_sink.rs` test — `sketch_db::schema` path was hardcoded; switched to the new `sketch_db::lifecycle::AggStatus` location. 758/758 lib tests pass; 5 ignored. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced May 17, 2026
Closed
zzylol
added a commit
that referenced
this pull request
May 18, 2026
…#272 step 4) (#288) Issue #272 step 4 asks to "re-enable the two ignored cross-reconfigure dispatch tests in `tests/schema_timeline_dispatch_tests.rs`". That file no longer exists: it was deleted in PR #280 (B7.5 v2) along with the legacy `handle_query_promql` family it exercised, and its two ignored tests were `panic!()` stubs with no real implementations. The only remaining ignored cross-reconfigure test (`test_get_timeline_returns_segments_after_reconfigure` in `http.rs:2440`) is wedded to the pre-#189 `SchemaRegistry::reconcile()` contract that eagerly populated the timeline source on YAML POST. Post-#189 the sid lifecycle is explicit (see `lifecycle::reconcile_from_streaming_config` module doc): "There is no 'added' set: sids are minted lazily by the ingest path on first write". Re-enabling the test as written requires either an architectural switch to eager sid minting (contradicts the documented sid lifecycle) or rewriting the test to interleave an ingest step (changes the contract being tested) — both out of scope for #272. Updates the `#[ignore]` reason + comment to document this resolution so the next maintainer doesn't re-investigate. No production change; no test count delta (baseline stays 727 lib + 2 ignored). Closes step 4 of #272 as obsoleted by #280. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
Schema retirement big-bang (plan step #5). Deletes the
sketch_db::schemamodule and theArc<SchemaRegistry>field on every consumer. The §6 lifecycle now lives entirely in the sid catalog (SketchStore); the §7 timeline + §6.3 ingest barrier + reconcile-on-config-swap all run sid-level.Built as four parallel slices off
feat/schema-retire-final@e5eb1d3(type relocations + sid-onlylifecycle/eviction.rs), cherry-picked into a single branch with three small integration fixups.What landed
Types (moved out of the deleted
schema/):AggStatus+DEFAULT_RETIREMENT_RETENTION→lifecycle/status.rsTimelineSegment+TimelineCoverage→query/timeline.rs(the producer)Consumers migrated:
sketch_db/backfill/{mod,processor,service}.rs+storage_engines/mod.rsBackfillRegistry::create_checkednow takes&AggregationConfig + created_at_ms: u64.BackfillServiceandBackfillWindowProcessordrop theirschemasfield. Re-exports ofAggSchema/SchemaRegistryremoved.query_engines/asap_query_engine/engine.rs+tests/schema_timeline_dispatch_tests.rsASAPQueryEngine::schema_registryfield +with_schema_registrybuilder deleted. Dispatcher tests stripped ofAggSchema/SchemaRegistry; two#[ignore]'d tests stubbedpanic!()pending sid-level cross-reconfigure dispatch.drivers/query/servers/http.rsAppState.schemas+HttpServer::with_schemasdeleted. Swap handler drops the legacyschemas.reconcile; JSON response surfacessids_retiredfromSidReconcileSummary./api/v1/db/schemasendpoints rewired sid-level:GETreturnssnapshot_instances();/retire//expiretake:sidinstead of:agg_id.precompute_engine/{engine,ingest_handler}.rs+drivers/ingest/otel.rs+main.rsIngestState.schemasfield +record_barrier_dropmethod deleted.otel.rsdropsschemas.reconcile, usesDEFAULT_RETIREMENT_RETENTIONfor the sid-level reconcile retention.main.rsstops constructingSchemaRegistryand drops every.with_schema_registry/.with_schemaschain call.SchemaEvictionService::newrewired to sid-only.Integration fixups (single commit
f698555):AggregationConfigfrom hot-reload streaming-config snapshot, derivecreated_at_msfrom sid catalog (fall back to wall-clock-now when no live ingest yet).flush_barrier_dropsstubbed to log-only afterrecord_barrier_dropremoval.schema::AggStatuspath inoutput_sink.rstest routed tolifecycle::AggStatus.Test plan
cargo build --lib -p data_plane→ 0 errorscargo test --lib -p data_plane→ 758 passed; 5 ignoredFollow-ups (separate PRs)
#[ignore]'d cross-reconfigure dispatch tests need sid-level rewrites (no longer reproducible fromSchemaRegistry-shaped fixtures because two distinctAggregationConfigs with the same content signature collapse into one sid-level segment).SchemaEvictionServiceno longer cancels in-flight backfills on retirement — backfill jobs remainagg_id-keyed; rekeying on sid + restoring the cancel step is a follow-up.🤖 Generated with Claude Code