Repository navigation
Throw a typed, retryable error when querying an attribute whose index is still building - #1363
Conversation
…ebuild A query on an attribute whose secondary index is still building threw a generic 503 (ServerError), indistinguishable from a permanent failure. Callers that wrap per-row lookups in try/catch (e.g. a dedup-before-insert import) could silently treat it as "no result" and drop writes for the duration of the rebuild. Introduce IndexRebuildingError (extends ServerError; statusCode 503, code INDEX_REBUILDING, retryable true), thrown from the search isIndexing path (message unchanged for back-compat). Surface code/retryable in the operations-API error body, gated on error.retryable so other errors are unaffected, so HTTP callers can distinguish and retry as well as in-process callers. Closes #1355 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request introduces a new IndexRebuildingError class (extending ServerError) to handle queries on attributes with rebuilding secondary indexes as a distinct, retryable 503 error. It updates the search logic, error handler, and unit tests to support and verify this behavior. The review feedback suggests setting the name property on the new error class to ensure correct serialization and stack traces, along with adding a corresponding assertion in the unit tests.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
Reviewed; no blockers found. |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
ServerError/Error leave `name` as 'Error', so without this the stack trace, JSON serialization, and any caller keying on error.name would not identify the error. Set it explicitly and assert it in the unit test. (review feedback) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
kriszyp
left a comment
There was a problem hiding this comment.
Clean, minimal typed error — correct placement on the cold indexing path. LGTM! 🟢
Reviewed by Claude Sonnet 4.6
|
Docs follow-up: HarperFast/documentation#532 documents the new |
* docs(query-optimization): document the INDEX_REBUILDING retryable 503 Querying an attribute whose secondary index is still (re)building now returns a typed, retryable 503 (code INDEX_REBUILDING). Documents the response shape and the retry guidance in the Query Optimization reference. See HarperFast/harper#1363. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * docs(query-optimization): format INDEX_REBUILDING error fields as a table Per review feedback (matches the operator table earlier in this doc). Values backticked so the message's <attribute> placeholder isn't parsed as JSX in MDX. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Summary
A query on an attribute whose secondary index is still (re)building threw a generic
503(ServerError), indistinguishable from a permanent failure — so callers that wrap per-row lookups in try/catch (e.g. a dedup-before-insert import) could silently treat it as a "no result" and drop writes for the duration of the rebuild.Adds
IndexRebuildingError(extendsServerError;statusCode 503,code: INDEX_REBUILDING,retryable: true), thrown from thesearchisIndexingpath (message unchanged for back-compat). In-process callers can now branch oninstanceof/code/retryable; the operations-API error body also carriescode/retryable(gated onerror.retryable, so other errors are unaffected). The REST/http.tspath already distinguishes it via the class name in the body.Resolves #1355 (part of #1354).
Where to look
server/serverHelpers/serverHandlers.js— the only behavioral change on the operations-API path: the 503 body now includescode/retryablewhenerror.retryableis set. Adding fields is additive, but worth a glance if any strict downstream client/proxy depends on the exact{ error }shape.utility/errors/hdbError.ts— the new error class.Docs
Introduces a new public error
code(INDEX_REBUILDING). Minor — flagging the docs decision rather than assuming: happy to add a short mention to the operations-API error docs if wanted (not done in this PR).🤖 Generated with Claude Code (Opus 4.8)