Skip to content

feat: add microbatch coverage endpoint - #1319

Merged
kvlonge merged 14 commits into
mainfrom
feat/microbatch-coverage
Nov 6, 2026
Merged

kvlonge merged 14 commits into
mainfrom
feat/microbatch-coverage

Conversation

@kvlonge

@kvlonge kvlonge commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Why

The UI's model page shows microbatch coverage: what is complete, where the holes are, and what a version change still needs rebuilt. That history is mirrored from the warehouse but was never projected.

Changes

  • GET /api/control/locations/{location}/targets/{target}/microbatches/{model}?limit= returns coverage of the model's newest recorded relation and generation, or null. Only concurrent microbatch models are tracked. Needs view on the whole target.
  • Uses the executor's native coverage projection. Batches are:
    • complete;
    • gap, a hole between completed partitions;
    • replay_required, inside the newest live replay requirement and completed at another version. A newer completion at a third version ends it, as in the executor.
  • Adjacent pieces of one completion merge; zero-width pieces are dropped. Each batch keeps its completion's own bound text.
  • known_gaps lists every hole; batches holds the newest limit (default 200, cap 1000).
  • Bounds sort by value: integers, and timestamps via the existing CPython fromisoformat port, so +00 offsets work and instants order correctly.
  • sqlbuild-model-config (depends only on sqlbuild-core) moves one layer earlier so the control server can use that parser.
  • New index on the model. Earlier pre-release control stores are refused and must be recreated.
  • Client regenerated.

Verification

  • cargo test -p sqlbuild-orchestration --all-features: 102 passed on SQLite and PostgreSQL. The endpoint test covers integer and offset bounds whose text order is wrong, mixed bound spellings, a newer overlapping completion, two requirements, a superseded one, both hole kinds, other scopes, generations and models, truncation, an untracked model and a denial. Mutating each rule fails it, except dropping the zero-width skip, which the merge absorbs.
  • make check-ci, public-repository scan.
  • One read-only review; its two blockers are fixed and rechecked.
  • DuckShop: microbatch_coverage.json.

People with view.evidence on a check's model can read the sample rows stored with one of its results. Columns are the rows' keys in sorted order, the order the warehouse stores them in, and a row without a key holds null there. Every read is audited, and a read whose audit cannot be written discloses nothing. The SQL and evidence reads now share one authorize, read and audit path.
People with view on a target can read its recorded model moves, every step of their old-name views, and janitor cleanups, newest moves first. Filtering by model returns only moves into that model and their views, using new indexes on the destination model and the move's event. Check and maintenance reads now live in their own warehouse-history domain, apart from metadata ingestion.
People with view on a target can read one model's recorded microbatch coverage: its completed segments, the holes between completed partitions, and segments a newer replay requirement still needs rebuilt at its version. Coverage is projected from the mirrored completion and replay-requirement facts of the model's newest relation and generation, with the same projection the executor uses; cursor bounds sort by value, so offset timestamps order by instant rather than text. Coverage is tracked only for concurrent microbatch models, so other models read as null.
The worker contract held one 30 second scheduler lease without renewing it,
so on a slow runner its second claim came after expiry and was fenced.
Renew it in the background, as a running scheduler does.
Base automatically changed from feat/maintenance-history to main November 6, 2026 09:48
@kvlonge
kvlonge enabled auto-merge (squash) November 6, 2026 09:49
@kvlonge
kvlonge merged commit d9abd83 into main Nov 6, 2026
92 of 94 checks passed
@kvlonge
kvlonge deleted the feat/microbatch-coverage branch November 6, 2026 11:56
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