You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit fa47944
Browse filesBrowse the repository at this point in the historyBrowse files
Migration `0426_file_search_owner_scope.sql` adds canonical workspace/Project ownership to the existing build, revision, and chunk pipeline. Legacy workspace inserts are translated by triggers, and the existing workspace trigram index remains usable. Project rows use a separate owner-scoped trigram index on the same chunk table. Organizations and personal users are not enabled search owners.
73
73
74
-
The new `file_search_dispatch_queue` replaces the workspace-keyed scheduler because older workers cannot decode a Project without a workspace. During expansion, workspace mutations enqueue both queues, while the new dispatcher reads the owner queue. Both deployments share the dispatcher lock, revision claim token, build lease, and publication fence. Drain old app dispatchers and Trigger workers/retries before enabling Project dispatch. Retire the legacy queue and its dual enqueue in a later contract deploy; they are not a second indexing pipeline. The `file-search-owners-v3` cursor performs bounded owner/file keyset backfill and hourly reconciliation without rewriting extracted text in the migration. Each claim pass takes owners never dispatched first, so the owners a backfill page wakes enter the queue as if just dispatched: a page of reconciliation wake-ups rotates in by dispatch age behind the owners the file trigger woke for a write, instead of delaying them by several passes.
74
+
The new `file_search_dispatch_queue` replaces the workspace-keyed scheduler because older workers cannot decode a Project without a workspace. During expansion, workspace mutations enqueue both queues, while the new dispatcher reads the owner queue. Both deployments share the dispatcher lock, revision claim token, build lease, and publication fence. Drain old app dispatchers and Trigger workers/retries before enabling Project dispatch. Retire the legacy queue and its dual enqueue in a later contract deploy; they are not a second indexing pipeline. The `file-search-owners-v3` cursor performs bounded owner/file keyset backfill and hourly reconciliation without rewriting extracted text in the migration. Claims take owners woken since their last dispatch first (`wokenSinceDispatch` in `dispatcher.ts`); backfill wake-ups enter as if just dispatched and never touch an owner already queued, so a page of them cannot delay a file write by several passes.
75
75
76
76
Generated document indexing never executes source. A cached artifact must match its owner and current input manifest. Each published build stores at most 500 input identities. Queries exclude a build when any input is changed, archived, deleted, or outside the owner, and report it as pending coverage. Input mutations wake their owner queue; the dispatcher retires stale manifests in bounded batches before rebuilding. Expired build cleanup also removes its dependency records. A cache miss indexes the stored generation source as text until an authorized rendering path creates a current artifact.
* The transaction's start time. Queue rows compare `updated_at` with `last_dispatched_at`, and
176
+
* the `workspace_file_search_mark_pending` trigger writes `updated_at` the same way, so both sides
177
+
* share one clock.
178
+
*/
179
+
consttransactionNow=sql`now()`
180
+
181
+
/**
182
+
* Whether an owner was woken after its last dispatch: never dispatched, or touched since. A file
183
+
* write, a released claim, and a reaped claim advance `updated_at`; a claim stamps both columns
184
+
* with one time, and a reconciliation wake-up enters with them equal. A write whose transaction
185
+
* began before the claim that stamped its owner reads as earlier and waits one rotation.
186
+
*/
187
+
constwokenSinceDispatch=sql`(${fileSearchDispatchQueue.lastDispatchedAt} IS NULL OR ${fileSearchDispatchQueue.updatedAt} > ${fileSearchDispatchQueue.lastDispatchedAt})`
188
+
189
+
/**
190
+
* Whether the queued owner already holds every claim it may have outstanding. Such an owner can
191
+
* claim nothing this pass, so being woken must not put it ahead of owners that can: it keeps
192
+
* rotating by dispatch age, or a busy owner written to between passes would take every turn while
193
+
* the free global capacity goes unused.
194
+
*/
195
+
constownerSlotsFull=sql`(SELECT count(*) FROM (
196
+
SELECT 1 FROM workspace_file_search_revision active
197
+
WHERE coalesce(active.entity_type, 'workspace') = ${fileSearchDispatchQueue.entityType}
198
+
AND coalesce(active.entity_id, active.workspace_id) = ${fileSearchDispatchQueue.entityId}
199
+
AND active.status = 'pending' AND active.dispatched_at IS NOT NULL
0 commit comments