managarten/apps/mana/apps/web/src/lib/modules/context
Till JS 4ff95b2315 feat(spaces): rename legacy spaceId → contextSpaceId (v31 migration)
Resolves the name collision flagged in the Spaces RFC: four tables
owned the term "spaceId" before the multi-tenancy Spaces foundation
landed in v28 (conversations, documents, spaceMembers, memoSpaces
— chat's context-folder reference, context's parent context-space,
and memoro's membership/join tables). After v28, the scope wrapper
started filtering on a field that meant something different in these
tables, which would have hidden their records from the UI.

Dexie v31 migration:
- Renames the index from spaceId → contextSpaceId on all four tables.
- upgrade() copies each existing `spaceId` value to `contextSpaceId`
  (when it's a real context-space reference and not already the v28
  `_personal:<userId>` sentinel), then resets `spaceId` to the
  personal-space sentinel so the scope wrapper picks the row up on the
  active-space boot pass.

Type changes:
- LocalConversation, Conversation:           spaceId → contextSpaceId
- LocalDocument:                             spaceId → contextSpaceId
- LocalSpaceMember, LocalMemoSpace (memoro): spaceId → contextSpaceId

Code updates:
- chat/queries.ts: toConversation + filterBySpace renamed to
  filterByContextSpace (exports updated in chat/index.ts).
- chat/stores/conversations.svelte.ts: create() param + write site.
- context/queries.ts: toDocument + useSpaceDocuments signature.
- context/collections.ts: seed data.
- context/ListView.svelte + route pages: form data.
- dashboard/widgets/ContextDocsWidget.svelte: read site.

Table names stay: `spaceMembers` and `memoSpaces` still carry their old
names because they belong to the memoro module's context-space concept
and table renames also require sync-routing updates. A dedicated
cleanup can rebrand those once memoro's data model is revisited.

0 errors across 7148 files.

Plan: docs/plans/spaces-foundation.md

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 19:52:44 +02:00
..
stores feat: rename ManaCore to Mana across entire codebase 2026-04-05 20:00:13 +02:00
collections.ts feat(spaces): rename legacy spaceId → contextSpaceId (v31 migration) 2026-04-20 19:52:44 +02:00
index.ts fix(mana/web): clear remaining type errors — long-tail sweep 2026-04-09 20:25:08 +02:00
ListView.svelte feat(spaces): rename legacy spaceId → contextSpaceId (v31 migration) 2026-04-20 19:52:44 +02:00
module.config.ts fix(mana/web): commit module-registry + module.config.ts files (build-critical) 2026-04-07 19:49:58 +02:00
queries.ts feat(spaces): rename legacy spaceId → contextSpaceId (v31 migration) 2026-04-20 19:52:44 +02:00
types.ts feat(spaces): rename legacy spaceId → contextSpaceId (v31 migration) 2026-04-20 19:52:44 +02:00