Fix #377: Signal bitmap shard corruption#588
Conversation
|
Warning Review limit reached
More reviews will be available in 46 minutes and 48 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughBitmapIndexReader now performs explicit validation on decoded shard payloads and bitmap values. Two new error handlers consolidate invalid-data behavior: ChangesEnhanced validation and error handling for corrupted shards
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Release Preflight
If you tag this commit as |
|
@codex Self-discovered Code Lawyer issue during PR audit.
|
|
@codex Activity Summary
Validation:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/domain/services/index/BitmapIndexReader.ts`:
- Around line 256-258: The current guard in BitmapIndexReader (checking data ===
null || typeof data !== 'object' || Array.isArray(data')) still accepts
non-plain objects (e.g. Uint8Array) which can be cached as a LoadedShard and
later misinterpreted by _getEdges; update the validation to only accept plain
objects (e.g. ensure Object.getPrototypeOf(data) === Object.prototype or use a
shared isPlainObject helper) and call this._handleInvalidShardShape(path, oid,
'shard_not_object') when the prototype check fails so non-plain decoded values
are rejected before caching.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 88b0c976-abe5-4a89-bca7-97d194b656c4
📒 Files selected for processing (2)
src/domain/services/index/BitmapIndexReader.tstest/unit/domain/services/BitmapIndexReader.test.ts
Release Preflight
If you tag this commit as |
|
@codex Code Lawyer Activity Summary
Validation:
|
Release Preflight
If you tag this commit as |
What changed
Added explicit corruption handling for malformed bitmap shard shapes and non-byte bitmap values.
Why
In non-strict mode, corrupted shards still return an empty result, but now emit warnings so callers and tests can distinguish corruption from a real no-neighbor result. In strict mode, invalid bitmap values now throw
ShardCorruptionError.Closes #377
Validation
npx vitest run test/unit/domain/services/BitmapIndexReader.test.tsnpm run typecheck:src -- --pretty falsenpm run typecheck:test -- --pretty falseSummary by CodeRabbit
Bug Fixes
Tests