feat: workspace source-of-truth hard cut

This commit is contained in:
Mohamed Boudra
2026-03-03 23:28:16 +07:00
parent f3796e2ba5
commit cb92f39e73
20 changed files with 1813 additions and 945 deletions
@@ -0,0 +1,42 @@
import { describe, expect, test } from 'vitest'
import {
SessionInboundMessageSchema,
SessionOutboundMessageSchema,
} from './messages.js'
describe('workspace message schemas', () => {
test('parses fetch_workspaces_request', () => {
const parsed = SessionInboundMessageSchema.parse({
type: 'fetch_workspaces_request',
requestId: 'req-1',
filter: {
query: 'repo',
projectId: 'remote:github.com/acme/repo',
idPrefix: '/Users/me',
},
sort: [{ key: 'activity_at', direction: 'desc' }],
page: { limit: 50 },
subscribe: {},
})
expect(parsed.type).toBe('fetch_workspaces_request')
})
test('rejects invalid workspace update payload', () => {
const result = SessionOutboundMessageSchema.safeParse({
type: 'workspace_update',
payload: {
kind: 'upsert',
workspace: {
id: '/repo',
projectId: '/repo',
name: '',
status: 'not-a-bucket',
activityAt: null,
},
},
})
expect(result.success).toBe(false)
})
})