docs(gc-rooting): #7211 is fixed, and add the runtime-cache class - #7281
Conversation
… class Three corrections to the GC rooting invariant documentation: 1. Remove the "And the one that is still open (PerryTS#7211)" section. Issue PerryTS#7211 (ClassExprFresh rooting predicate) was fixed in PerryTS#7226, and the allowlist is now empty, verified by scripts/gc_root_dominance_allowlist.json. 2. Add the runtime-cache class as class 5 to the taxonomy. This class describes thread-local or static cells holding GC pointers with no registered scanner, distinguished by failing 10/10 rather than intermittently. Real instances: PerryTS#7226 (js_value_typeof strings, rawJSON key) and PerryTS#7239 (ten runtime caches). 3. Update the hazard-2 paragraph to reference PerryTS#7226 as the PR that fixed PerryTS#7211, and clarify that the PerryTS#7211 entries were deleted when the predicate was fixed. 4. Update the "Root before you call" rule to reference PerryTS#7211 specifically rather than "bug PerryTS#5" since the numbering has changed. Verified against: - Issue PerryTS#7211 is closed - scripts/gc_root_dominance_allowlist.json is empty - PerryTS#7226 commit message documents the runtime-cache class - CLAUDE.md:253 consistent with these changes
📝 WalkthroughWalkthroughThe GC-rooting invariant documentation now describes five failure modes, including unscanned runtime caches. It also updates gate-promotion status and explains the ChangesGC-rooting invariant documentation
Estimated code review effort: 1 (Trivial) | ~4 minutes Possibly related issues
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 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 `@docs/src/internals/gc-rooting-invariant.md`:
- Around line 115-119: Revise the next section’s description of
scripts/gc_root_dominance_check.py to state that it detects only emitted-LLVM
rooting hazards, not runtime-table cache issues. Keep PERRY_GC_ZEAL,
PERRY_GC_PROTECT_FROMSPACE, and PERRY_GC_PROTECT_FROMSPACE_DEPTH as the checks
for runtime caches, and preserve the existing guidance to register mutable
roots.
- Around line 98-103: Update the “Runtime-cache class” description to avoid
claiming failure always occurs at collection `#0`. Explain that the pointer
becomes stale at the first moving collection after the cache is populated and
remains stale until code rewrites the cache, while preserving the distinction
from register-class bugs.
- Line 53: Run perry-doc-tests against docs/src and update all 13 untagged
TypeScript code fences in the documentation: mark illustrative fences with the
typescript,no-test tags, or replace them with {%#include ...%} directives where
the content should be sourced from a file.
🪄 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 Plus
Run ID: ece7df8c-adfc-4980-8643-99ab98cd6f80
📒 Files selected for processing (1)
docs/src/internals/gc-rooting-invariant.md
Three verified bot findings folded into one commit: 1. policy.rs "sound by construction" overclaim (#7291 thread): the #7280 correction at line 2379 explicitly says the deferral is NOT "sound by construction" because runtime Rust frames need explicit rooting, but the comment at line 2474 still called the same deferral "sound by construction." Aligned it to "makes the collection point precise," matching the corrected framing. 2. gc-rooting-invariant.md "collection #0" imprecision (#7281 thread): a runtime cache populated after earlier collections goes bad at the first moving collection after population, not at collection #0. Reworded to state that precisely. 3. 15 untagged TypeScript doc fences (#7281 thread): perry-doc-tests --lint reported untagged ts/typescript fences across docs/src. Tagged each as typescript,no-test. Linter now reports "docs/src ok." Refuted (no change needed): - #7284 thread claimed docs overclaim --audit-poll-capable CI wiring, but the workflow step was included in the PR squashed commit and is present on main; the docs are accurate. - #7281 thread 3 claimed the static-checker scope was unlimited, but the doc already says "Scope: emitted-LLVM rooting hazards only."
docs/src/internals/gc-rooting-invariant.mdteaches contributors the rooting invariant using real bugs as case studies, and it had drifted from reality in two ways that matter.#7211 is closed, not open. The page carried a section titled "And the one that is still open (#7211)". It was fixed by #7226, and the checker's allowlist is now empty (
scripts/gc_root_dominance_allowlist.jsonreads"entries": [], annotated "EMPTY IS THE GOAL AND IT IS CURRENTLY MET"). The stale section is removed and the hazard-2 paragraph now cites #7226.The runtime-cache class was missing from the taxonomy. It is added as a named class with its tell — a thread-local or static cell holding a GC pointer that no registered scanner rewrites — citing #7226 (the interned
typeofresult strings and the rawJSON key) and #7239 (ten runtime caches: CACHED_ENV, CACHED_PERMISSION, CACHED_REPORT, ERROR_CONSTRUCTOR_PTR, INPUT_HANDLER, RESIZE_CALLBACK, FRAME_CALLBACKS, CURRENT_NEW_TARGET, ACCESSOR_RECEIVER_OVERRIDE, PENDING_FETCH_SIGNAL).This one is worth naming explicitly because it is invisible to the static checker by construction: the checker reads emitted IR, and a runtime-side cache never appears there. It was also the hardest instance of the class to find.
The "rules of thumb" cross-reference was renumbered to match, and
CLAUDE.md:253was checked for consistency (it already describes the runtime cache as a sibling class and points here for the full writeup).Docs only — one file, 25 insertions, 31 deletions.
Summary by CodeRabbit
ClassExprFreshallowlist guidance following predicate fixes.