Skip to content

[Access] Fix race condition with block collection indexing#8377

Merged
peterargue merged 3 commits intomasterfrom
peter/allow-blockcollection-index-lag
Jan 30, 2026
Merged

[Access] Fix race condition with block collection indexing#8377
peterargue merged 3 commits intomasterfrom
peter/allow-blockcollection-index-lag

Conversation

@peterargue
Copy link
Contributor

@peterargue peterargue commented Jan 30, 2026

Previously, the API required that the block/collection index exist if the tx/collection index did. These indices are store separately, so there is a race condition in which one may exists before the other.

This PR relaxes the check in the API to return a NotFound error in this case instead of throwing an exception.

Summary by CodeRabbit

  • Bug Fixes

    • Transaction lookup now returns a clear "not found" response when the block for a submitted transaction is missing, instead of a generic error.
  • Tests

    • Tests updated to assert both the explicit not-found outcome and the separate propagated error path for block lookup failures.

✏️ Tip: You can customize this high-level summary in your review settings.

@peterargue peterargue requested a review from a team as a code owner January 30, 2026 22:40
@github-actions
Copy link
Contributor

github-actions bot commented Jan 30, 2026

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 30, 2026

📝 Walkthrough

Walkthrough

lookupSubmittedTransactionResult now treats a storage ErrNotFound from ByCollectionID as a NotFound status return instead of triggering an irrecoverable error; other errors remain wrapped and cause the irrecoverable path. Tests updated to cover both not-found and exception propagation paths.

Changes

Cohort / File(s) Summary
Transaction error handling
engine/access/rpc/backend/transactions/transactions.go, engine/access/rpc/backend/transactions/transactions_test.go
Handle ErrNotFound from ByCollectionID by returning a NotFound status; preserve irrecoverable behavior for other errors. Tests updated: one subtest verifies the not-found return, another verifies wrapped exception propagation.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 I dug through blocks with eager paws,
Found none and paused without a cause.
"Not found," I said, no panic spree—
Another bug fixed, hop—yippee! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: converting a race condition error path from an exception to a NotFound response when block/collection indices are out of sync.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch peter/allow-blockcollection-index-lag

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

peterargue and others added 2 commits January 30, 2026 18:04
@peterargue peterargue added this pull request to the merge queue Jan 30, 2026
Merged via the queue into master with commit b92ae46 Jan 30, 2026
61 checks passed
@peterargue peterargue deleted the peter/allow-blockcollection-index-lag branch January 30, 2026 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants