Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion dashboard/src/data/localProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,14 @@ const db = () =>
}));
const keyFor = (bucket: Bucket, id: string) => `${bucket}:${id}`;
const recordFor = <T>(bucket: Bucket, id: string, value: T) => {
recordValueSchemas[bucket].parse(value);
const parsed = recordValueSchemas[bucket].parse(value);
if (
parsed &&
typeof parsed === "object" &&
"id" in parsed &&
parsed.id !== id
)
throw new Error(`Record key ${id} does not match its value id.`);
return recordSchema.parse({ key: keyFor(bucket, id), bucket, id, value });
};
const valueFor = <T>(bucket: Bucket, value: unknown): T =>
Expand Down
9 changes: 8 additions & 1 deletion dashboard/tests/localProvider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,15 @@ describe("local IndexedDB provider", () => {
expect(seededAgents.map((agent) => agent.id).sort()).toEqual(
agentSeedCatalog.map((agent) => agent.id).sort(),
);
// ORIGINAL (preserved, not deleted — disabled by comment):
// await localProvider.put("agents", "codex", {
// ...seededAgents[0],
// name: "Locally customized Codex",
// });
const codex = seededAgents.find((agent) => agent.id === "codex");
if (!codex) throw new Error("Expected the seeded Codex agent.");
await localProvider.put("agents", "codex", {
...seededAgents[0],
...codex,
name: "Locally customized Codex",
});
await localProvider.initialize();
Expand Down
Loading