Improve unsafe code safety documentation in turbo-tasks-backend#90755
Merged
Improve unsafe code safety documentation in turbo-tasks-backend#90755
Conversation
Merging this PR will not alter performance
Comparing Footnotes
|
Collaborator
Stats from current PR✅ No significant changes detected📊 All Metrics📖 Metrics GlossaryDev Server Metrics:
Build Metrics:
Change Thresholds:
⚡ Dev Server
⚡ Production Builds
📦 Production Builds (Webpack) (Legacy)📦 Production Builds (Webpack)
📦 Bundle SizesBundle Sizes⚡ TurbopackClient Main Bundles: **402 kB** → **402 kB** ✅ -11 B80 files with content-based hashes (individual files not comparable between builds) Server Middleware
Build DetailsBuild Manifests
🔄 Shared (bundler-independent)Runtimes
📎 Tarball URL |
lukesandberg
approved these changes
Mar 5, 2026
fd76078 to
366c8f5
Compare
sokra
added a commit
that referenced
this pull request
Mar 9, 2026
…91087) ## Summary `getFailedJobs()` in `scripts/pr-status.js` used jq's `select(.conclusion == "failure")` filter during GitHub API pagination. When a page had 100 jobs but none were failures, jq returned empty output, and the `if (!output.trim()) break` check terminated the pagination loop early — never fetching page 2+ where actual failures existed. For example, on PR #90755 (129 total jobs), all 100 jobs on page 1 were success/skipped, while the 2 failures (`test unit windows (22) / build` and `thank you, next`) were on page 2 (jobs 101-129). The script reported "Found 0 failed jobs" when there were actually 2. ## Fix `getFailedJobs()` now delegates to `getAllJobs()` (which fetches all jobs without jq filtering, so pagination works correctly) and filters for failures in JavaScript afterward. This is simpler and avoids the class of bug where jq pre-filtering interacts badly with pagination. ## Test Plan - Ran `node scripts/pr-status.js 90755` before fix: reported 0 failed jobs - Ran `node scripts/pr-status.js 90755` after fix: correctly reported 2 failed jobs (`test unit windows (22) / build` and `thank you, next`)
Fix incorrect and missing safety comments across 6 files:
- operation/mod.rs: Fix transmute safety comment using wrong lifetime
names ('a/'l instead of 'e/'tx)
- read_transaction_cache.rs: Fix reference to wrong struct name
(LmdbBackingStorage → ReadTransactionCache), add struct-level safety
invariant documenting field-ordering requirement for drop order
- startup_cache.rs: Add struct-level safety invariant documenting
self-referential pattern and field-ordering requirement
- dash_map_multi.rs: Add safety justification for unsafe impl
Send/Sync on RefMut explaining bucket pointer safety
- backing_storage.rs: Add safety comments to 6 unsafe blocks in
Either impl forwarding calls
- kv_backing_storage.rs: Improve flush safety comment specificity
366c8f5 to
875b54b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Improves safety documentation for all
unsafecode in theturbo-tasks-backendcrate (6 files, comment-only changes).Why?
A comprehensive audit of all 14 files containing
unsafecode inturbo-tasks-backendfound no soundness bugs, but identified several safety comments that were incorrect, misleading, or missing entirely. Correct safety documentation is critical for maintaining unsafe code over time — reviewers and future contributors rely on these comments to understand invariants.How?
Fixes applied (comment-only, no behavior changes):
backend/operation/mod.rs— Fixed transmute safety comment that referenced wrong lifetime names ('a/'l→'e/'tx)database/read_transaction_cache.rs— Fixed reference to wrong struct name (LmdbBackingStorage→ReadTransactionCache); added struct-level doc explaining the field-ordering invariant required for drop safetydatabase/startup_cache.rs— Added struct-level doc explaining the self-referential pattern and field-ordering invariant; improved inline safety commentutils/dash_map_multi.rs— Added safety justification forunsafe impl Send/SynconRefMutexplaining bucket pointer exclusivitybacking_storage.rs— Added// Safety:comments to 6unsafeblocks in theEitherimpl that were missing themkv_backing_storage.rs— Made theflush()safety comment more specific about what "finished processing" meansAudit summary (14 files reviewed):