fix: address platform source review feedback
Tighten platform source persistence so legacy callers cannot silently relabel existing sessions, repair migration 24 when schema_versions drifts from the real schema, and polish the follow-up UI/error-handler review nits. - only backfill platform_source when it is blank and raise on explicit source conflicts for an existing session - make migration 24 verify both the sdk_sessions column and its index before treating it as applied - expose platform_source from the functional session getters and add regression tests for source preservation and schema drift recovery - add the required APPROVED OVERRIDE annotation for centralized HTTP error translation - keep mobile source pills on a single horizontal row
This commit is contained in:
@@ -130,6 +130,38 @@ describe('Sessions Module', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('platform_source', () => {
|
||||
it('should default new sessions to claude when platformSource is omitted', () => {
|
||||
const sessionId = createSDKSession(db, 'session-platform-1', 'project', 'prompt');
|
||||
const session = getSessionById(db, sessionId);
|
||||
|
||||
expect(session?.platform_source).toBe('claude');
|
||||
});
|
||||
|
||||
it('should preserve a non-default platform_source for legacy callers that omit platformSource', () => {
|
||||
const sessionId = createSDKSession(db, 'session-platform-2', 'project', 'prompt', undefined, 'codex');
|
||||
let session = getSessionById(db, sessionId);
|
||||
expect(session?.platform_source).toBe('codex');
|
||||
|
||||
createSDKSession(db, 'session-platform-2', 'project', 'prompt');
|
||||
session = getSessionById(db, sessionId);
|
||||
expect(session?.platform_source).toBe('codex');
|
||||
});
|
||||
|
||||
it('should reject explicit platform_source conflicts for the same session', () => {
|
||||
createSDKSession(db, 'session-platform-3', 'project', 'prompt', undefined, 'codex');
|
||||
|
||||
expect(() => createSDKSession(
|
||||
db,
|
||||
'session-platform-3',
|
||||
'project',
|
||||
'prompt',
|
||||
undefined,
|
||||
'claude'
|
||||
)).toThrow(/Platform source conflict/);
|
||||
});
|
||||
});
|
||||
|
||||
describe('updateMemorySessionId', () => {
|
||||
it('should update memory_session_id for existing session', () => {
|
||||
const contentSessionId = 'content-session-update';
|
||||
|
||||
Reference in New Issue
Block a user