g1t/services/work/migrations/0021_confidence.sql
| 1 | -- How sure g1t is of a change an agent made, worked out from what it can |
| 2 | -- observe (confidence.rs), and what the agent said of it itself. New tables |
| 3 | -- rather than new columns, so that running this again changes nothing. |
| 4 | |
| 5 | -- The latest for each pull request g1t sees through. |
| 6 | CREATE TABLE IF NOT EXISTS pull_confidence ( |
| 7 | pull_id TEXT PRIMARY KEY, |
| 8 | repo_id TEXT NOT NULL, |
| 9 | -- low, medium or high. |
| 10 | level TEXT NOT NULL, |
| 11 | -- JSON: g1t_contracts::work::Confidence. |
| 12 | detail TEXT NOT NULL, |
| 13 | updated_at TEXT NOT NULL |
| 14 | ); |
| 15 | CREATE INDEX IF NOT EXISTS pull_confidence_by_repo ON pull_confidence (repo_id, level); |
| 16 | |
| 17 | -- For each agent run that made or revised a change: what its agent said of |
| 18 | -- its own work (self_level, uncertain_about) and, once worked out, how sure |
| 19 | -- g1t was of the change as the run left it (detail). |
| 20 | CREATE TABLE IF NOT EXISTS run_confidence ( |
| 21 | run_id TEXT PRIMARY KEY, |
| 22 | pull_id TEXT, |
| 23 | repo_id TEXT NOT NULL, |
| 24 | self_level TEXT, |
| 25 | -- JSON array of short phrases. |
| 26 | uncertain_about TEXT NOT NULL DEFAULT '[]', |
| 27 | -- JSON: g1t_contracts::work::Confidence. |
| 28 | detail TEXT, |
| 29 | updated_at TEXT NOT NULL |
| 30 | ); |
| 31 | CREATE INDEX IF NOT EXISTS run_confidence_by_pull ON run_confidence (pull_id); |
| 32 | |
| 33 | -- A repository's choice about low-confidence changes. A missing row is the |
| 34 | -- default: ask a person before merging one. |
| 35 | CREATE TABLE IF NOT EXISTS confidence_rules ( |
| 36 | repo_id TEXT PRIMARY KEY, |
| 37 | hold_low INTEGER NOT NULL DEFAULT 1, |
| 38 | updated_by TEXT NOT NULL, |
| 39 | updated_at TEXT NOT NULL |
| 40 | ); |