debug: add tags tracing logs

This commit is contained in:
Jeff Emmett 2026-03-24 13:56:22 -07:00
parent d7e195c0b3
commit 9ae88e14b7
2 changed files with 12 additions and 1 deletions

View File

@ -275,7 +275,10 @@ function seedDemoIfEmpty(space: string) {
if (d.meta) (d.meta as any).seeded = true;
});
console.log("[Cal] Demo data seeded: 2 sources, 7 events");
// Verify tags survived Automerge change
const verifyDoc = _syncServer!.getDoc<CalendarDoc>(docId);
const firstEv = verifyDoc ? Object.values(verifyDoc.events)[0] : null;
console.log(`[Cal] Demo data seeded: 2 sources, 7 events — tags: ${JSON.stringify(firstEv?.tags)}, has_key: ${'tags' in (firstEv || {})}`);
}
// ── API: Events ──

View File

@ -186,6 +186,14 @@ async function scanDir(dir: string, syncServer: SyncServer): Promise<number> {
const doc = Automerge.load(bytes);
const docId = pathToDocId(fullPath);
// Debug: check cal doc tags during load
if (docId.includes(':cal:events')) {
const events = (doc as any).events;
if (events) {
const first = Object.values(events)[0] as any;
console.log(`[DocStore] Loading ${docId}: tags=${JSON.stringify(first?.tags)}, has_tags=${'tags' in (first || {})}, keys=${Object.keys(first || {}).filter((k: string) => k.startsWith('t'))}`);
}
}
syncServer.setDoc(docId, doc);
count++;
} catch (e) {