mirror of
https://github.com/coleam00/Archon
synced 2026-04-21 13:37:41 +00:00
fix(review): add SQLite migrateColumns entry for default_branch + fix WorkspaceSyncResult mock shape
Fixes two code review issues from PR #1274: - H-1: Add ALTER TABLE migration for default_branch column in remote_agent_codebases so existing SQLite users get the column without data loss (NULL means syncWorkspace auto-detects the branch) - M-1: Fix WorkspaceSyncResult mock in orchestrator.test.ts to return the correct shape matching the interface (branch/synced/previousHead/newHead/updated) and import BranchName for proper type casting Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
abb64819ef
commit
b1f93a6168
2 changed files with 24 additions and 1 deletions
|
|
@ -215,6 +215,20 @@ export class SqliteAdapter implements IDatabase {
|
|||
} catch (e: unknown) {
|
||||
getLog().warn({ err: e as Error }, 'db.sqlite_migration_session_columns_failed');
|
||||
}
|
||||
|
||||
// Codebases columns
|
||||
try {
|
||||
const codebaseCols = this.db.prepare("PRAGMA table_info('remote_agent_codebases')").all() as {
|
||||
name: string;
|
||||
}[];
|
||||
const codebaseColNames = new Set(codebaseCols.map(c => c.name));
|
||||
|
||||
if (!codebaseColNames.has('default_branch')) {
|
||||
this.db.run('ALTER TABLE remote_agent_codebases ADD COLUMN default_branch TEXT');
|
||||
}
|
||||
} catch (e: unknown) {
|
||||
getLog().warn({ err: e as Error }, 'db.sqlite_migration_codebases_columns_failed');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import { makeTestWorkflow, makeTestWorkflowList } from '@archon/workflows/test-u
|
|||
import type { Conversation, Codebase, Session } from '../types';
|
||||
import { ConversationNotFoundError } from '../types';
|
||||
import type { WorkflowDefinition } from '@archon/workflows/schemas/workflow';
|
||||
import type { BranchName } from '@archon/git';
|
||||
|
||||
// ─── Mock setup (BEFORE importing module under test) ─────────────────────────
|
||||
|
||||
|
|
@ -127,7 +128,15 @@ mock.module('../utils/worktree-sync', () => ({
|
|||
}));
|
||||
|
||||
// Git workspace sync mock
|
||||
const mockSyncWorkspace = mock(() => Promise.resolve({ fetched: true, reset: false }));
|
||||
const mockSyncWorkspace = mock(() =>
|
||||
Promise.resolve({
|
||||
branch: 'main' as BranchName,
|
||||
synced: true,
|
||||
previousHead: 'abc12345',
|
||||
newHead: 'abc12345',
|
||||
updated: false,
|
||||
})
|
||||
);
|
||||
const mockToRepoPath = mock((p: string) => p);
|
||||
const mockToBranchName = mock((b: string) => b);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue