FLAG-1 unified task_attempts schema (single canonical DDL + 3-shape migration)

User decision 2026-11-05: unified schema, rejecting the rehearsal
runtime column-union workaround and a ledger rename. One definition
(cloud.attempt_ledger.TASK_ATTEMPTS_DDL, 12 columns) shared by
cloud.attempts and cloud.db.POSTGRES_SCHEMA; ensure builds the
unified table fresh and migrates old resume, gap-3 ledger, and
rehearsal shapes in place with rows intact. aggregate counts
ledger rows only (outcome NULL = resume row, never counted).
SQLite verified by 8 new tests; Postgres real-DB upgrade path
explicitly NOT verified (see batch summary). Local commit only:
no merge, no push, no deploy.
This commit is contained in:
host committed 2026-11-05 02:22:47 +00:00
1 parent 6d009af48f
commit 6a70775ad9
6 files changed
+467 -113

No files matched your search

+13 -2
View File
@@ -223,9 +223,14 @@ class LedgerOnboardingGapTestCase(unittest.TestCase):
finally:
conn.close()
self.assertFalse(out["tables_ready"])
# Unified schema: the required set is all 12 columns, so a
# gap-3-shaped table is missing corrects_attempt_no AND
# the five resume columns, not just the one column.
self.assertEqual(
out["missing"],
["task_attempts missing columns: corrects_attempt_no"])
["task_attempts missing columns: corrects_attempt_no, "
"kind, interrupted_reason, checkpoint_round, "
"result_text, error_text"])
def test_verify_marker_missing_column(self):
conn = self._sqlite(
@@ -237,9 +242,15 @@ class LedgerOnboardingGapTestCase(unittest.TestCase):
finally:
conn.close()
self.assertFalse(out["tables_ready"])
# Unified schema: the gap-3-shaped ledger table is also
# missing the five resume columns, reported before the
# marker table's own missing column.
self.assertEqual(
out["missing"],
["task_attempt_origin_markers missing columns: queued_at"])
["task_attempts missing columns: kind, "
"interrupted_reason, checkpoint_round, result_text, "
"error_text",
"task_attempt_origin_markers missing columns: queued_at"])
class LedgerOutboxGapTestCase(unittest.TestCase):