Skip to content

feat(engine): per-record data-quality scoring (V3) - #237

Merged
athvin merged 1 commit into
mainfrom
feat/dg-v3-dq-scoring
Oct 22, 2026
Merged

athvin merged 1 commit into
mainfrom
feat/dg-v3-dq-scoring

Conversation

@athvin

@athvin athvin commented Oct 21, 2026

Copy link
Copy Markdown
Owner

0-100 per record, with three dimensions kept separately — because they fail independently and a single number says a record is bad without saying what to do about it. A record can be complete and wrong, valid and nearly empty, or both and five years stale. Those are three different jobs.

New optional data_quality config block (per-attribute weights, per-dimension weights, freshness window) and a record_quality lake table written at the end of each run. Unset writes nothing, so the table's absence is a byte-exact no-op, and GET /v1/orgs/{org}/quality answers configured: false rather than erroring — scoring is opt-in, and asking about it is a fair question either way.

The judgement that makes the score mean anything

What happens when a dimension does not apply:

Validity is measured over the validatable fields that are PRESENT. A record with no email is already penalised by completeness; scoring its validity zero as well penalises one absence twice — and makes "fill in the blanks" look like it improves validity. A record with none of them scores NULL and is averaged over the other dimensions rather than handed a zero it did not earn.

Freshness is NULL when the source carries no timestamp, because unknown age is not the same as old. Otherwise a source that simply does not publish updated_at drags every one of its records to the bottom of the work queue.

email_valid/phone_valid are reused, not recomputed. Standardize already decided, and a second opinion that could disagree would be a bug with two plausible answers.

The read

Buckets and per-dimension means, not just a mean — a mean of 70 can be every record at 70, or half at 95 and half at 45, and those need different work. Plus the worst records as a work queue.

Scores are upserted on record_key and pruned when a record leaves the corpus, so a tombstoned record does not keep a quality score for good — the same upsert-only trap E7 found in membership.

Test

record_quality_scores_each_dimension_only_where_it_applies asserts:

  • the scores discriminate — a constant score would satisfy every range check above it;
  • base_10's email-less crm:C008 loses completeness while keeping validity 1.0;
  • re-scoring the same corpus five months later lowers the total, so freshness is computed rather than stubbed;
  • re-scoring corrects rather than duplicates;
  • every scored record lands in exactly one bucket.

Determinism

Deliberate rebaseline: model_registry_golden.json gains record_qualities (pure addition). The committed config fixture is untouched — the test builds its data_quality block in code, so config_hash and the config golden do not move.

Gates

make check; the DuckLake e2e tier.

🤖 Generated with Claude Code

@athvin
athvin force-pushed the feat/dg-v3-dq-scoring branch 3 times, most recently from 0260293 to c9c7c71 Compare October 22, 2026 00:01
0-100 per record, with three dimensions kept separately — because they fail
independently and a single number says a record is bad without saying what
to do about it. A record can be COMPLETE and wrong, VALID and nearly empty,
or both and five years stale; those are three different jobs.

New optional `data_quality` config block (per-attribute weights,
per-dimension weights, freshness window) and a `record_quality` lake table
written at the end of each run. Unset writes nothing, so the table's absence
is a byte-exact no-op, and GET /v1/orgs/{org}/quality answers
`configured: false` rather than erroring — scoring is opt-in and asking
about it is a fair question either way.

The judgement that makes the score mean anything is what happens when a
dimension does not APPLY:

- Validity is measured over the validatable fields that are PRESENT. A
  record with no email is already penalised by completeness; scoring its
  validity zero as well penalises one absence twice and makes "fill in the
  blanks" look like it improves validity. A record with none of them scores
  NULL and is averaged over the other dimensions rather than handed a zero
  it did not earn.
- Freshness is NULL when the source carries no timestamp, because unknown
  age is not the same as old. Otherwise a source that simply does not
  publish `updated_at` drags every one of its records to the bottom of the
  work queue.
- `email_valid`/`phone_valid` are reused, not recomputed. Standardize
  already decided, and a second opinion that could disagree would be a bug
  with two plausible answers.

The read reports BUCKETS and per-dimension means, not just a mean — a mean
of 70 can be every record at 70 or half at 95 and half at 45 — plus the
worst records as a work queue. Scores are upserted on record_key and pruned
when a record leaves the corpus, so a tombstoned record does not keep a
score for good: the same upsert-only trap E7 found in membership.

Test: `record_quality_scores_each_dimension_only_where_it_applies` asserts
the scores DISCRIMINATE (a constant score would satisfy every range check
above it), that base_10's email-less crm:C008 loses completeness while
keeping validity 1.0, that re-scoring the same corpus five months later
LOWERS the total so freshness is computed rather than stubbed, that
re-scoring corrects rather than duplicates, and that every scored record
lands in exactly one bucket.

Deliberate rebaseline: model_registry_golden.json gains record_qualities
(pure addition). The committed config fixture is untouched — the test builds
its `data_quality` block in code, so `config_hash` and the config golden do
not move.

Gates: make check; DuckLake e2e tier.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@athvin
athvin force-pushed the feat/dg-v3-dq-scoring branch from c9c7c71 to 6a960ca Compare October 22, 2026 01:09
@athvin
athvin merged commit 7ee3af9 into main Oct 22, 2026
14 checks passed
@athvin
athvin deleted the feat/dg-v3-dq-scoring branch October 22, 2026 01:22
athvin added a commit that referenced this pull request Oct 22, 2026
…at catches drift (#243)

* feat(agents): a 15-skill library, generated references, and a gate that catches drift

The repo had three skills (entity-framework, security, pentest) covering schema
governance and security. Everything else an engineer does here was uncovered —
and those gaps are exactly where no vendor skill exists: Fellegi-Sunter
matching, DuckLake from Rust, the er CLI, the utoipa->TypeScript contract, the
BFF boundary, EKS/Terraform, and the CI gate set.

Eleven new skills, four refreshed, all flat in .claude/skills/ (rust/.claude is
gitignored and symposium regenerates it; nested skills also load only lazily).

Two defects fixed:
  - .agents/skills/ducklake-performance was tracked but unreachable — Claude
    Code only reads .claude/skills/, and symposium never mirrored it. It has
    been invisible in every session since it was written.
  - It was also stale: it instructed running benchmarks/workload_report.py,
    which no longer exists, and proposed Python-pushdown experiments in an
    all-Rust codebase. docs/profiling.md and docs/performance.md are themselves
    banner-marked historical records of the retired Python pipeline, so the
    rewrite says so rather than implying a campaign can be run.

The drift that motivated the gate: entity-framework claimed 25 entities against
a tree holding 30, security cited a statement count that had moved, and both
described er-entity check as narrower than verify when they are one code path.
So no skill states a count — counts live in five GENERATED blocks rebuilt from
entities/, the crate tree, analyze.rs, the workflows and the frontend config.
diagnostics.md derives the documented-but-unimplemented E0xx set by
set-differencing the design doc against the source, so nobody maintains it.

scripts/skills-check.sh splits by what its output derives from, and the CI
placement follows: regen derives from code (so it rides the existing lint job,
which any code change reaches), while lint derives from the skills themselves
and runs in a new job NOT gated on detect — because a .claude-only PR is
exactly what detect skips, and that is the PR that changes a skill.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(agents): route entity-framework away from sql-analysis, allow anchor links

Two findings from verifying the gate against all 15 skills.

entity-framework was the only description with no negative routing, and it now
overlaps the new sql-analysis skill on E0xx triggers — so a diagnostic question
could land on either. It now points at sql-analysis for the analyser's own
internals and at er-matching for golden-governed model SQL.

The link checker treated a `file.md#heading` target as a missing file, which
would have rejected a legitimate deep link into docs/entity-lint-rules.md. The
fragment is now stripped before the existence test while the error still reports
what the author wrote. Verified both directions: an anchor into a real file
passes, an anchor into a missing one still fails.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(agents): rebase onto main — dependabot now pins those majors, and two entities landed

Rebasing onto main picked up #240, which excludes arrow and
datafusion-common/-expr from dependabot's major updates. Three places in
rust-conventions and ci-and-supply-chain said the opposite — verified true when
written, wrong one rebase later. They now describe the exclusions and carry the
compiler errors that justified them (arrow 60's two RecordBatch types,
DataFusion 55's duplicate arrow_schema in the graph).

The generated entity index moved on its own: #236 added metric_snapshot and
#237 added record_quality, so 30 -> 32 entities and 131 -> 137 statements. The
gate caught it during a routine rebase with no prompting, which is the whole
argument for not writing counts in prose — that number would otherwise have
been silently wrong from the moment this branch rebased.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(ci): the skills job inherited rust/ as its working directory

The new `agent skills (lint)` job failed on its first push with exit 127 —
`bash: scripts/skills-check.sh: No such file or directory`. This workflow
defaults every `run` to `rust/` for the cargo jobs, and the script lives at
the repo root, so the step never reached a single assertion.

The step I added to the `lint` job already overrode it; this one did not. Both
now do, with a comment naming the failure so the next person adding a
root-relative step here does not repeat it.

Worth noting this class of bug is invisible locally: the script is
CWD-independent once it starts (it cds to its own repo root), so every local
run passed. Only CI's working-directory default could expose it — which is the
argument for observing a gate fail in CI before trusting it, and for not having
proposed it as a required check yet.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

---------

Co-authored-by: bmoore813 <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
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.

2 participants