Skip to content

Uncertainty engine: D1 migration (#97)#108

Merged
ssilvius merged 2 commits intomainfrom
feat/uncertainty-migration
Apr 28, 2026
Merged

Uncertainty engine: D1 migration (#97)#108
ssilvius merged 2 commits intomainfrom
feat/uncertainty-migration

Conversation

@ssilvius
Copy link
Copy Markdown
Contributor

Closes #97. First step of the Phase 1 stack.

Adds 0002_uncertainty_engine.sql with the uncertainty_prediction and uncertainty_calibration_snapshot tables and the four indexes the design doc calls for: cohort_key, surface, state, and (state, orphan_after) for the orphan sweep.

Created via wrangler d1 migrations create per the migration convention. Applied locally; both tables and indexes verified.

Stack: this -> #98 schema -> #99 routes -> #100 orphan cron -> #101 calibration cron.

Closes #97. Phase 1 of the uncertainty engine spike.

Two tables per docs/designs/uncertainty-engine.md schema section:
- uncertainty_prediction: emit + witness lifecycle (state machine over
  emitted | witnessed | orphaned | retired). Indexes on cohort_key,
  surface, state, and (state, orphan_after) to support the orphan sweep.
- uncertainty_calibration_snapshot: materialized reliability per cohort,
  recomputed by the nightly calibration cron. Indexed on cohort_key.

Created via wrangler d1 migrations create. Applied locally; both tables
present and indexes verified.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ssilvius ssilvius merged commit 4d6d0a5 into main Apr 28, 2026
1 check 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.

Uncertainty engine: D1 migration for uncertainty_prediction + uncertainty_calibration_snapshot

1 participant