-
Notifications
You must be signed in to change notification settings - Fork 12
Fix invalidation bug where jsonb "null" was being conflated with SQL NULL #3861
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request fixes a bug where recovered instances (instances that were previously in an error state but then repaired) continued to show errors because error_doc was stored as JSONB null instead of SQL NULL. The fix ensures that cleared JSON fields are stored as SQL NULL.
Changes:
- Modified
asExpressionsfunction to distinguish between SQL NULL and JSONB null for JSON fields - Added regression test to verify
error_docis SQL NULL after instance recovery
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/runtime-common/expression.ts | Updated asExpressions to return SQL NULL instead of JSONB null when JSON field values are null/undefined |
| packages/realm-server/tests/indexing-test.ts | Added test assertion to verify error_doc IS NULL after instance recovery |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
hmm the modified test has a failed assertion 😞 |
Host Test Results 1 files ± 0 1 suites ±0 3h 12m 53s ⏱️ + 1h 40m 16s For more details on these failures, see this check. Results for commit a555784. ± Comparison against base commit 4eaa075. This pull request removes 1 and adds 207 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
fixed now |
Issue: recovered instances (instances that were previously an error, but then repaired) kept showing errors because error_doc was stored as jsonb null (not SQL NULL), so the index still treated them as errored even after dependencies were fixed.
the fix was to store SQL NULL for cleared JSON fields so recovered instances/modules no longer retain error state (expression.ts). Added regression coverage to confirm error_doc is SQL NULL after a recovery path (indexing-test.ts).