Build-cache data mart + MetricFlow semantic layer (10 measures + KPI)#2
Merged
Conversation
…+ KPI) Adds the marts and semantic layer on top of staging: - dim_agents, fct_build_tasks (task grain, semantic), fct_builds (build grain) - enforced contract on the public fct_builds mart - MetricFlow semantic model with 10 governed measures - KPI cache_hit_rate (+ remote_execution_rate, cpu_hours_saved, cpu_efficiency, gb_served_from_cache) and a metricflow time spine - singular business-invariant test (cache_hits <= cacheable_tasks; rate in [0,1]) - CI: dbt build on DuckDB + KPI resolution via MetricFlow + agent-guardrail check Closes #1 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…s sources dbt has no dependency edge from a source() to the seed that populates it, so a parallel `dbt build` on a fresh DB races the staging views ahead of the seed load. Load seeds first, then `dbt build --exclude resource_type:seed`, on a persistent file target (DBT_TARGET=ci) shared across steps incl. MetricFlow. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
dbt has no built-in DBT_TARGET env var, so `env: DBT_TARGET: ci` was a no-op and CI actually ran on the dev target while the ci: output sat unused — misleading config that passed only by luck. MetricFlow can't select a target either (no --target flag); it uses the profile default. So consolidate on a single persistent dev target that seed/build/parse/mf all share, and document the warehouse target as a commented example. Found via adversarial review workflow. No behavior change to a passing build. Co-Authored-By: Claude Opus 4.8 (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.
Closes #1.
Adds the data mart and governed semantic layer on top of the staging foundation.
What's here
dim_agents,fct_build_tasks(task grain — the cache facts),fct_builds(build grain rollup).fct_buildsiscontract: enforced+access: public— schema breaks fail at build time.cache_hit_rateand supporting metrics (remote_execution_rate,cpu_hours_saved,cpu_efficiency,gb_served_from_cache), sliceable by tenant/project/build_type/region/agent_class/task_kind/time.unique+not_null, FKrelationships, and a singular invariant (cache_hits <= cacheable_tasks, rate ∈ [0,1]).dbt buildon DuckDB →dbt parse→mf querythe KPI, plus an agent-guardrail check that flags execution-plane changes per ADR 0001.Verified locally
dbt build→ PASS=35, 0 errors.mf query --metrics cache_hit_rate,cpu_hours_saved,remote_execution_rate→0.6898,264.16,0.7562.Confinement note
Pure SQL/YAML — no macros, hooks,
run-operation, Python models, orpackages.yml. Per ADR 0001 this sits in the branch + DB role + CI zone; no sandboxed execution required.