Submatter/packages/shared/src/worker/checkpoint.test.ts
Randall Stillwell 6ccb060bea feat(second-brain): open self-hosted Obsidian for crews — harness-agnostic v0.1
- MCP create-backlog-item for natural language Plan/Epic/Task authoring
- Worker non-code: optional worktree + per-harness allowlist + doc_review→published
- Harness registry: harness_providers/role_harness_routes, WorkerAdapter (minimal|crewai|langgraph|remote-ag-ui), AG-UI POST /api/ag-ui, Settings → Harnesses with Test
- Plans tree: backlog.listTree + createPlan/Epic/Task + Start→Convoy, web CRUD without CLI
- Fleet: /fleet rollup across workspaces + SSE /api/fleet/events

Decision: docs/decisions/2026-08-25-second-brain-os-pivot.md
Convoy: .convoys/second-brain-os-v01

Co-authored-by: orchestrator
2026-08-25 16:20:53 -05:00

42 lines
1.1 KiB
TypeScript

import { describe, expect, it } from "vitest";
import {
workerCheckpointPayloadSchema,
workerCheckpointToolStepSchema,
} from "@tasks/shared/worker";
describe("worker checkpoint schemas", () => {
it("accepts path + hash tool steps without file contents", () => {
const step = workerCheckpointToolStepSchema.parse({
seq: 1,
tool: "write_file",
args: {
path: "apps/worker/src/x.ts",
contentHash: "a".repeat(64),
},
ok: true,
resultDigest: "ok:deadbeefdeadbeef",
});
expect(step.args).not.toHaveProperty("content");
expect(JSON.stringify(step)).not.toMatch(/api[_-]?key/i);
});
it("rejects oversized tool history beyond the bound", () => {
const history = Array.from({ length: 51 }, (_, i) => ({
seq: i + 1,
tool: "read_file" as const,
args: { path: `f-${i}.ts` },
ok: true,
}));
expect(() =>
workerCheckpointPayloadSchema.parse({
toolHistory: history,
filesTouched: [],
branch: "worker/x",
worktreePath: "/tmp/wt",
}),
).toThrow();
});
});