Update hivegrid-cloud reference to latest main

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
davidandClaude Fable 5 committed 2026-07-08 16:15:37 +02:00
1 parent e98d38e716
commit 7b21524c86
3781 files changed
+373484 -225607

No files matched your search

@@ -2,7 +2,6 @@
This document describes the Meilisearch-backed search subsystem introduced
in phase 04 (#48). It is the user-facing complement to
`docs/improvement-plan/04-search-rag/meilisearch.md` (technical spec) and
`docs/deploy/meilisearch.md` (operator runbook).
## Architecture
@@ -29,7 +28,7 @@ in phase 04 (#48). It is the user-facing complement to
- **Source of truth** is Postgres. Meilisearch is a projected read-side
populated asynchronously through the outbox pattern (#42).
- **Tenant isolation** is enforced inside `@toolctrl/search`. Every read
- **Tenant isolation** is enforced inside `@hivegrid/search`. Every read
and write goes through `searchInIndex / bulkIndex / deleteFromIndex`
with an explicit `tenantId`. The wrapper injects
`tenantId = "<id>"` into the Meilisearch filter expression and
@@ -49,7 +48,7 @@ Meilisearch.
| Index | Searchable | Filterable | Sortable |
| -------------- | --------------------------------------------------- | ------------------------------------------------------ | --------------------------------------- |
| `kb-articles` | title, summary, content, tags | tenantId, knowledgeBaseId, language, isPublished, tags | createdAt, updatedAt, publishedAt |
| `crm-contacts` | firstName, lastName, email, company, jobTitle, tags | tenantId, status, ownerId, tags | createdAt, updatedAt, lastInteractionAt |
| `crm-contacts` | firstName, lastName, email, company, jobTitle, tags | tenantId, entityType, status, ownerId, tags | createdAt, updatedAt, lastInteractionAt |
| `rows` | searchable, folio, entityName | tenantId, entityId, entityName, createdById | createdAt, updatedAt, folio |
| `entities` | name, title, titlePlural | tenantId, type | name, createdAt, updatedAt |
| `users` | firstName, lastName, email | tenantId, type, admin, active | createdAt, lastLoginAt |
@@ -80,24 +79,25 @@ one otherwise).
| CRM contact helper | shipped | `apps/web/app/modules/crm/services/crmContactSearch.server.ts` wraps `crm-contacts` with `searchWithFallback` and a tenant-scoped SQL fallback. |
| Rows helper | shipped | `apps/web/app/modules/rows/services/rowSearch.server.ts` wraps the `rows` index with an `entityId` filter and tenant-scoped SQL fallback. |
| CRM/Rows producer and callsite integration | yes | `RowsApi.getAll` calls `searchCrmContacts` for tenant-scoped CRM contact-list free-text filters and `searchRows` for other tenant-scoped row filters. `RowsApi.create / createSimple / update / del` emit `search.index.*` events through `rowSearchOutbox.server.ts`. Contact rows fan out to both `crm-contacts` and `rows`. |
| Bulk reindex pagers | partial | `apps/worker/src/index.ts` registers `createSearchIndexerBulkPagers({ prisma })`; `BULK_REINDEX_SUPPORTED_INDEX_NAMES` exposes `kb-articles`, `crm-contacts`, `rows`, and `users`. Entities still need an explicit pager before `--index=all` can rebuild every projected index. |
| HiveGrid global-search producers | yes | `apps/web/app/services/search/searchIndexProjection.server.ts` publishes `search.index.*` events and mirrors `SearchIndexEntry` for Kontakt/Firma/Lead/Projekt/File/Task/User lifecycle mutations. Cmd+K and `/search` read through tenant- and permission-aware SQL+Meili search. |
| Bulk reindex pagers | partial | `apps/worker/src/index.ts` registers `createSearchIndexerBulkPagers({ prisma })`; `BULK_REINDEX_SUPPORTED_INDEX_NAMES` exposes `kb-articles`, `crm-contacts`, `users`, and `projects`. File/task live producers are wired, but their disaster-recovery bulk pagers still need explicit coverage before `--index=all` can rebuild every projected index. |
Open hot-path gaps still serve from the legacy SQL path. Until a specific
producer emits index events, a specific callsite reads through the helper, and
the indexer has the relevant backfill pager, relevance, typo-tolerance and
disaster-recovery reindex coverage remain partial for that path. Rows and CRM
contacts have read/CUD producer pieces plus worker bulk-reindex pagers wired,
but row indexing is still published post-write rather than inside the row
mutation transaction. Entities still require a dedicated bulk pager; entity
definitions are global platform-catalog records without a source `tenantId`, so
their tenant-scoped projection needs an explicit design decision before
production backfills include them.
disaster-recovery reindex coverage remain partial for that path. Rows, CRM
contacts and the HiveGrid global-search entities now have read/CUD producer
pieces wired. CRM contacts, users, projects and KB articles also have worker
bulk-reindex pagers; files/tasks still depend on live producer replay until a
dedicated DR pager is added. Entities still require a dedicated bulk pager before
they are part of the disaster-recovery backfill. Row indexing is still published
post-write rather than inside the row mutation transaction.
## CLI Operations
```bash
# Reindex every supported bulk-reindex index for every tenant via outbox events.
# Today this means KB articles, CRM contacts, rows, and users; unsupported names are rejected.
# Today this means KB articles, CRM contacts, users, and projects; unsupported names are rejected.
pnpm cli search reindex --tenant=all --index=all
# Reindex one tenant's KB articles.
@@ -107,7 +107,7 @@ pnpm cli search reindex --tenant=tnt_abc123 --index=kb-articles
The CLI never writes to Meilisearch directly. It produces
`search.index.<entity>.bulkreindex` outbox events; the worker-general
service consumes them and pages over Postgres through registered
`bulkPagers`. Today, `kb-articles`, `crm-contacts`, `rows`, and `users` are listed in
`bulkPagers`. Today, `kb-articles`, `crm-contacts`, `users`, and `projects` are listed in
`BULK_REINDEX_SUPPORTED_INDEX_NAMES`; the CLI and worker enforce that contract
so operators cannot enqueue unsupported bulk jobs by accident. Operators should
not rely on full-index backfills for entities until its pager is added. A full
@@ -145,7 +145,7 @@ The Meilisearch volume is treated as cache. To rebuild from scratch:
3. `pnpm cli search reindex --tenant=all --index=all`.
This rebuild currently covers the supported bulk-reindex set only:
`kb-articles`, `crm-contacts`, `rows`, and `users`. Entities require a
`kb-articles`, `crm-contacts`, `users`, and `projects`. Entities require a
dedicated bulk pager before they are part of the disaster-recovery backfill.
Expected time-to-recovery on a single replica: <30 minutes for 1 M KB-article
documents.