Skip to content

feat(dla): M7 — KPI workbook, coverage, prior-bundle import, term mapping - #11

Merged
udaybhan05 merged 10 commits into
mainfrom
feat/m7-kpi
Jun 24, 2026
Merged

udaybhan05 merged 10 commits into
mainfrom
feat/m7-kpi

Conversation

@udaybhan05

Copy link
Copy Markdown
Collaborator

Summary

M7 makes the engagement measurable and reusable: a KPI workbook, a review-
coverage tracker, prior-bundle import, and SME term-mapping rules + late-
arriving-doc preservation. Built on the apps/dla workspace layout.

What's included

  • KPI workbook — dla kpi add and a /kpi web form define KPIs (name,
    definition, formula, grain, dimensions, source tables, owner). Source tables
    are validated to exist; a missing table is rejected (CLI exit 4 / web 400
    inline) with the offending table listed — no half-written KPI on disk. KPIs
    are sme-authored.
  • Coverage tracker — dla coverage (table/json) and a /coverage page
    report confirmed/total per reviewable artifact type (FR-022).
  • Prior-bundle import — dla import --prior-bundle <dir> inherits a prior
    engagement's descriptions / glossary / KPIs with imported_from set and
    original provenance preserved; the writer protects newer SME work.
  • Term-mapping rules — exact/glob/regex rules (matched against names only)
    map a column/table to a glossary term and are consulted before any fuzzy
    match (FR-021); higher precedence wins. CLI-free storage + /term-mappings
    create/delete UI.
  • Late-arriving docs — a re-import never clobbers an artifact an SME already
    reconciled (client-provided-reconciled is preserve-worthy).

Testing

  • 150 apps/dla tests pass (unit + integration + eval); ruff + mypy clean.
  • New integration tests: KPI validation, coverage accuracy (5/10 -> 50%),
    prior-bundle inherit + preserve, term-mapping precedence, late-arriving
    re-import preservation. New TestClient tests for the KPI/coverage/term-rule
    web routes.

Notes

  • No new dependencies. New schema: KpiPayload, TermMappingRulePayload
    (+ FormulaKind/PatternKind), reader-registered.

- Schema: KpiPayload + TermMappingRulePayload + FormulaKind/PatternKind enums
  (reader dispatch registered for kpi + term_mapping_rule)
- KPI workbook: validate_source_tables (refs must exist; raises with the
  missing list), kpi artifact builder/writer (provenance sme-authored)
- dla kpi add CLI (--name/--definition/--formula/--grain/--owner/
  --source-tables/--dimensions); exit 4 when a source table is missing
- Tests: KPI validation (missing-table list) + valid-write

Part of M7 (KPI/coverage/prior-bundle/term-mapping). 140 apps/dla tests pass;
ruff + mypy clean. Local-only (M7 PR opens when the milestone is complete).
- coverage.compute_coverage: confirmed/total per reviewable artifact type
  (confirmed = client-provided-reconciled / ai-drafted-edited / sme-authored)
- dla coverage CLI (--format table/json)
- Test: 5-of-10 confirmed descriptions -> 50% coverage

141 apps/dla tests pass; ruff + mypy clean. (/coverage web page + KPI web UI
batched into the M7 UI increment.)
- import_prior_bundle inherits a prior engagement's reviewable artifacts
  (descriptions, glossary, KPIs) into the new bundle with imported_from set
  and original provenance preserved; the atomic writer protects newer SME
  work (a prior artifact that would clobber it is skipped)
- dla import --prior-bundle <path> wired (now one of client-docs/dbt/prior)
- Tests: inherit with imported_from + preserved provenance; newer SME work
  not clobbered

143 apps/dla tests pass; ruff + mypy clean.
- reconciliation.term_mapping: SME rules (exact/glob/regex on NAMES only,
  T166) map a column/table name to a glossary term; resolve_term returns the
  highest-precedence match and is authoritative — consulted before any fuzzy
  match (FR-021). save_rule / delete_rule / load_rules.
- Re-import preservation: a late re-import never clobbers an artifact an SME
  already reconciled (client-provided-reconciled is preserve-worthy in the
  writer) — demonstrated by test_late_arriving_docs.
- Tests: rule precedence (glob + exact, higher precedence wins; no fuzzy when
  a rule matches) + late-arriving re-import preservation.

146 apps/dla tests pass; ruff + mypy clean. (Web pages for KPI/coverage/
term-mappings + demos batched into the M7 UI/finalize increment.)
- /kpi list + create/update form (validates source tables; missing table ->
  400 inline, no half-written KPI) + /kpi/{id} detail
- /coverage dashboard page (confirmed/total bar per artifact type)
- /term-mappings: list + create + delete (HTMX); rules consulted before fuzzy
- nav links + coverage-bar CSS; routers registered
- TestClient tests: kpi create + missing-table 400, coverage page, term-rule
  create

150 apps/dla tests pass; ruff + mypy clean.
The license gate rejected hypothesis 6.155.2 (MPL-2.0), a dev/test dependency
from the workspace dev group. MPL-2.0 is file-level copyleft and the package
is never shipped — same rationale as the existing tqdm/certifi/pathspec
exceptions. Unblocks ci/checks.
…e gate

greenlet (transitive via sqlalchemy) reports the compound license string
'MIT AND PSF-2.0'; both halves are permissive and already individually
allow-listed. Same per-package exception pattern as tiktoken/tqdm.
…ction

The pinned ref google/osv-scanner-action@<sha> resolves the repo-root
action.yml, which has no 'runs:' section (it is a metadata stub), so every
run failed with 'Top level runs: section is required'. The actual composite
action lives at osv-scanner-action/action.yml (runs: using docker, same
scan-args inputs). Repoint to google/osv-scanner-action/osv-scanner-action@<sha>;
SHA unchanged (same pinned commit).
…rlette 1.x)

With the osv-scanner-action pin corrected the lockfile scan runs for the
first time and surfaces real findings:
- pydantic-settings 2.14.1 -> 2.14.2 (GHSA-4xgf-cpjx-pc3j, Medium): in-range
  patch bump, genuine fix.
- 4 starlette findings (GHSA-82w8/wqp7/x746/jp82): fixed only in starlette 1.x
  (TestClient -> httpx2 major migration), the same deferral already documented
  for GHSA-86qp. Added to osv-scanner.toml under the same rationale, owner
  (Anmol), and 2026-09-12 review-by; lift on the starlette 1.x move.
@udaybhan05
udaybhan05 merged commit 5b4aa74 into main Jun 24, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant