feat(domain): add the hourly per-service AI vendor discovery rollup - #436
Closed
JeremyFunk wants to merge 1 commit into
Closed
feat(domain): add the hourly per-service AI vendor discovery rollup#436JeremyFunk wants to merge 1 commit into
JeremyFunk wants to merge 1 commit into
Conversation
JeremyFunk
force-pushed
the
ai/07-service-ai-vendors-rollup
branch
from
August 12, 2026 20:04
b94869a to
75a72d7
Compare
Adds `service_ai_vendors_hourly` and its materialized view (ClickHouse migration 0016, local-store migration v5 -> v6): one row per (org, service, vendor, hour) carrying span/eligibility/session-key-state counters plus uniqCombined(12) trace and session states, feeding read-path service pruning, vendor-per-service lookup, session-key health and sampling-exemption suggestions. The MV filters `AiVendor != ''`, so the HLL states never run on ordinary HTTP or DB traffic — that filter is both the cost model and the semantics, since post-enablement "no rows" then means "no AI spans". It writes synchronously inside the INSERT into `traces`, which makes this target's part-count and merge-lag trace-ingestion health rather than side-table health. There is no POPULATE and no backfill: correctness depends on the source rows having been classified, not on the view having existed, so the enablement hour is recorded instead and hours before it do not exist for readers. 0016 is `requiredForIngest: false` — it touches nothing the gateway inserts, so the ingest gate stays at 15. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
JeremyFunk
force-pushed
the
ai/07-service-ai-vendors-rollup
branch
from
August 12, 2026 21:05
75a72d7 to
b37aef0
Compare
Collaborator
Author
🍁 Maple PR previewNote Preview resources were removed when this pull request closed. Final commit |
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.
What this layer contains
The read-path rollup and the last remaining pieces of the write-side v1:
service_ai_vendors_hourlyand its materialized view — ClickHouse migration0016, theserviceAiVendorsHourlydatasource,materializations.ts,ai-vendors-rollup-sql.ts, and local-store migration v5 → v6 (local schema version 6, frozenlocal-schema-v6.sql, history entry, manifest check).ai-registry/rollup-enablement.tsand itsindex.tsexport; the 400-day retention tier.ai-vendors-rollup.clickhouse.e2e.test.ts, plus thepackage.jsonch:testentry and the CI step that run it.097d8372….Why it is shaped this way
One row per (org, service, vendor, hour), carrying span/eligibility/session-key-state counters plus
uniqCombined(12)trace and session states — enough for read-path service pruning, vendor-per-service lookup, session-key health and sampling-exemption suggestions. The MV filtersAiVendor != '', which is simultaneously the cost model and the semantics: the HLL states never run on ordinary HTTP or DB traffic, and post-enablement "no rows" therefore means "no AI spans" rather than "not computed". Because it writes synchronously inside the INSERT intotraces, this target's part-count and merge-lag alerts are trace-ingestion health, not side-table health.There is no
POPULATEand no backfill: correctness depends on the source rows having been classified, not on the view having existed, so the enablement hour is recorded instead and earlier hours simply do not exist for readers.0016isrequiredForIngest: false— it touches nothing the gateway inserts, so the ingest gate stays at 15 and no BYO-ClickHouse org is un-readied by a read-path table.Gates run at this level
Full battery, all green:
bun typecheck— 37/37 tasks.bun run clickhouse:schema:check— up to date at revision097d8372…, lint OK (38 tables, 40 MVs), local manifest at schema v6.packages/domainvitest underCLICKHOUSE_E2E=1— 554 passed.apps/clivitest — 430 passed.bun run ch:test— 4 files, 194 passed (including the new rollup reader-contract and parity suite).cargo test --locked(+TRACE_CAPTURE_DIR) — 136 lib + 75 bin, 0 failures.Stack integrity gate: at this commit
git diffagainst the verified pre-split implementation is empty — the seven layers reassemble that tree exactly. Re-runningbun run clickhouse:schemaandbun run tinybird:manifesthere reproduces every generated file byte-for-byte.Dependencies
Top of the stack; requires #435 and everything below it.
🤖 Generated with Claude Code
Stack created with GitHub Stacks CLI • Give Feedback 💬
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.