test: compare upgraded schema versions with ASSISTANT_DATABASE_SCHEMA_VERSION

The supervision upgrade tests asserted the latest version literally (56);
schema 57 (activity history order and indexes) made them fail.
This commit is contained in:
mesalogo
2026-10-04 00:26:10 +08:00
parent 78beade289
commit 5d0ca44b22
2 changed files with 4 additions and 4 deletions
@@ -5,7 +5,7 @@ import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { DatabaseSync } from 'node:sqlite'
import { afterEach, expect, it, vi } from 'vitest'
import { AssistantDatabase } from './assistant-database'
import { ASSISTANT_DATABASE_SCHEMA_VERSION, AssistantDatabase } from './assistant-database'
import { extractExperiences } from './supervision-experiences'
import { assignStories } from './supervision-stories'
import { deriveSuggestions } from './supervision-suggester'
@@ -168,6 +168,6 @@ it('upgrades schema 55 suggestions to 56 without losing rows', async () => {
cleanups.push(async () => { db.close(); await rm(directory, { recursive: true, force: true }) })
expect(db.supervisionSuggestions().get('keep')).toMatchObject({ kind: 'open_item', title: 'Keep', storyId: null })
const check = new DatabaseSync(path)
expect(check.prepare('PRAGMA user_version').get()!.user_version).toBe(56)
expect(check.prepare('PRAGMA user_version').get()!.user_version).toBe(ASSISTANT_DATABASE_SCHEMA_VERSION)
check.close()
})
@@ -5,7 +5,7 @@ import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { DatabaseSync } from 'node:sqlite'
import { afterEach, expect, it, vi } from 'vitest'
import { AssistantDatabase } from './assistant-database'
import { ASSISTANT_DATABASE_SCHEMA_VERSION, AssistantDatabase } from './assistant-database'
import { SupervisorService, type SupervisorSummarizerRequest } from './supervisor-service'
import type { SupervisionRunRequest } from '../../shared/supervision-contracts'
import type { ReviewConfiguration } from './supervision-review-store'
@@ -115,7 +115,7 @@ it('upgrades released per-scope progress and duplicated events into the shared t
PRAGMA user_version = 52;`)
f.db.close()
f.db.initialize(process.cwd())
expect(f.sql.prepare('PRAGMA user_version').get()!.user_version).toBe(56)
expect(f.sql.prepare('PRAGMA user_version').get()!.user_version).toBe(ASSISTANT_DATABASE_SCHEMA_VERSION)
expect(f.sql.prepare("SELECT DISTINCT scope FROM review_checkpoints").all().map(row => row.scope)).toEqual(['timeline'])
expect(current(f.sql)).toHaveLength(2)
await expect(f.run({ kind: 'projects', projectIds: [f.a.id] })).resolves.toMatchObject({ status: 'no_change' })