mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-14 21:21:10 +02:00
The creating-hook now splits its user-stamping behaviour by table: - USER_LEVEL_TABLES (userSettings, userContext, newsPreferences, meditateSettings, sleepSettings, moodSettings, timeSettings, invoiceSettings, broadcastSettings, wetterSettings, userTagPresets) still get userId stamped — these rows are primarily scoped to the signed-in user rather than a Space. - All other sync tables (the ~53 data-record tables) no longer receive userId on new writes. Attribution is the Actor system's job (__lastActor + __fieldActors are already stamped on every write); tenancy is the spaceId column's job (stamped below in the same hook). Keeping both userId and spaceId on data records was redundant. Migration approach — lenient, no Dexie bump: existing rows keep the userId they were stamped with in v28. New writes don't have it. The three public type converters that exposed userId (tags-local's toTag/toTagGroup, calc's toCalculation/toSavedFormula) use a `?? 'guest'` / `?? ''` fallback, so rows without userId stay readable. The 16-site codebase audit in phase 2c found no load- bearing reader: the few sites that reference record.userId are either one-time migration code (v28/v31/guest-migration), manifest metadata (backup format — different userId field), or the hook's own immutability guard. authorId stamping now derives from effectiveUserId directly instead of reading objRecord.userId — the previous chain relied on the userId stamp having just happened, which no longer holds for data tables. The "no table has both userId AND spaceId" invariant from the plan is now partially met: data tables will converge on it as old rows cycle out. User-level tables still have both but that's by design (userId = ownership, spaceId = v28 Personal-sentinel carried through the hook; a future cleanup could drop the spaceId on user-level tables but it's harmless today). Tests: 20/20 agents + workbench-scenes pass. Type-check clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| api | ||
| calc/packages/shared | ||
| calendar | ||
| cards | ||
| chat | ||
| citycorners | ||
| contacts | ||
| context | ||
| docs | ||
| food | ||
| guides | ||
| inventory | ||
| mana | ||
| manavoxel | ||
| memoro | ||
| moodlit | ||
| mukke | ||
| news | ||
| photos | ||
| picture | ||
| plants | ||
| presi | ||
| questions | ||
| quotes/packages/content | ||
| skilltree | ||
| storage | ||
| times | ||
| todo | ||
| traces | ||
| uload | ||