fix(db): make task row state authoritative

This commit is contained in:
ZacharyZhang-NY committed 2026-04-22 16:24:57 -04:00
1 parent ebcc15c68d
commit 775598ef4c
16 files changed
+75 -924

No files matched your search

+15
View File
@@ -33,6 +33,21 @@ describe("AppDatabase", () => {
await rm(tempDir, { recursive: true, force: true });
});
it("keeps task runtime state on the tasks row", () => {
const shadowTables = db.queryAll<{ name: string }>(
"select name from sqlite_master where type = 'table' and name = 'task_leases'",
);
const phaseColumns = db.queryAll<{ name: string }>("pragma table_info(tasks)")
.filter((column) => column.name === "phase");
const phaseTriggers = db.queryAll<{ name: string }>(
"select name from sqlite_master where type = 'trigger' and name like 'trg_tasks_phase_from_status_%'",
);
expect(shadowTables).toEqual([]);
expect(phaseColumns).toEqual([]);
expect(phaseTriggers).toEqual([]);
});
it("persists company-scoped entities and resolves secret env bindings", () => {
const companyId = db.company.saveCompany({
name: "Northline Systems",