mirror of
https://github.com/thedotmack/claude-mem.git
synced 2026-09-20 04:23:02 +08:00
b45515c5fe
- #2572: server keys/jobs/api-key migrate-scopes CLI subcommands (secrets never printed), hand-rolled security headers (no helmet dep), wrong-runtime guard. - #2552: mount viewer static handler + compat API on the server runtime (ServerViewerRoutes). - #2554: fix stale Claude model (claude-3-5-sonnet-latest -> claude-sonnet-4-6); document subscription vs API-key auth; confirm 0.0.0.0 bind avoids loopback ECONNREFUSED. - #2558: docker-compose restart: unless-stopped on all services, REDIS_URL fallback, credentials-file mount (config-only, not runtime-verified in sandbox). - #2560: postgres platform_source column+indexes (idempotent), thread platform_source end-to-end through events schema/storage/routes/compat. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
43 lines
1.3 KiB
TypeScript
43 lines
1.3 KiB
TypeScript
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
// #2560 — platform_source threading + idempotent Postgres migration.
|
|
|
|
import { describe, expect, it } from 'bun:test';
|
|
import { CreateAgentEventSchema, AgentEventSchema } from '../../src/core/schemas/agent-event.js';
|
|
|
|
describe('agent-event platformSource threading (#2560)', () => {
|
|
it('CreateAgentEventSchema preserves platformSource when provided', () => {
|
|
const parsed = CreateAgentEventSchema.parse({
|
|
projectId: 'proj-1',
|
|
sourceType: 'api',
|
|
eventType: 'tool_use',
|
|
platformSource: 'opencode',
|
|
occurredAtEpoch: 1,
|
|
});
|
|
expect(parsed.platformSource).toBe('opencode');
|
|
});
|
|
|
|
it('defaults platformSource to null when omitted (back-compat)', () => {
|
|
const parsed = CreateAgentEventSchema.parse({
|
|
projectId: 'proj-1',
|
|
sourceType: 'hook',
|
|
eventType: 'tool_use',
|
|
occurredAtEpoch: 1,
|
|
});
|
|
expect(parsed.platformSource).toBeNull();
|
|
});
|
|
|
|
it('full AgentEventSchema round-trips platformSource', () => {
|
|
const parsed = AgentEventSchema.parse({
|
|
id: 'evt-1',
|
|
projectId: 'proj-1',
|
|
sourceType: 'server',
|
|
eventType: 'tool_use',
|
|
platformSource: 'claude-code',
|
|
occurredAtEpoch: 1,
|
|
createdAtEpoch: 2,
|
|
});
|
|
expect(parsed.platformSource).toBe('claude-code');
|
|
});
|
|
});
|