Skip to content

feat: add maintenance history endpoint - #1318

Merged
kvlonge merged 7 commits into
mainfrom
feat/maintenance-history
Nov 6, 2026
Merged

kvlonge merged 7 commits into
mainfrom
feat/maintenance-history

Conversation

@kvlonge

@kvlonge kvlonge commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Why

The UI's maintenance panel shows a target's recorded moves, the old-name views kept for them, and janitor cleanups. All three are already mirrored into the control store, but nothing read them back.

Changes

  • GET /api/control/locations/{location}/targets/{target}/maintenance?node=&limit= returns {migrations, old_name_views, janitor_events}. It needs view on the whole target, like the check listing.
  • Migrations come newest first, optionally only moves into one model. origin_model is nullable.
  • The response includes every recorded old-name-view step of the returned moves, joined on the move's warehouse event ID within the same location and target, oldest first. Steps written at the same instant are not in step order.
  • Janitor events come newest first and are empty when node is set, because cleanups are not tied to models.
  • limit defaults to 100 and is capped at 1000 for moves and janitor events each.
  • New indexes for the move filter and the step join. Control stores from earlier pre-release versions are refused and must be recreated.
  • Check reads moved into a new warehouse_history module with these reads.
  • TypeScript client regenerated.
  • Test fix: the worker contract now renews its 30 s scheduler lease, which expired on a slow Windows runner (Fenced).

Verification

  • cargo test -p sqlbuild-orchestration --all-features: one endpoint test, on SQLite and PostgreSQL, covers:
    • per-model filtering and the limit=1 cut;
    • a step of an older move left out when only the newest move is returned;
    • a step recorded under another target never appearing (confirmed by mutation);
    • a denial on a target the person has no role on.
  • make check-ci, public-repository scan.
  • Review: one read-only pass, no blockers. Its two test gaps are covered above. view_sql in old-name views is the generated projection over relation and column names, not model SQL, so it stays readable with view.
  • DuckShop: maintenance_history.json edge case.

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.
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/check-evidence to main November 6, 2026 06:49
@kvlonge
kvlonge enabled auto-merge (squash) November 6, 2026 06:50
@kvlonge
kvlonge merged commit ec9a3b4 into main Nov 6, 2026
92 of 94 checks passed
@kvlonge
kvlonge deleted the feat/maintenance-history branch November 6, 2026 09:48
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