Skip to content

fix(runtime): wpfacts_check family SCRATCH uses perry_thread_local! (tls-budget) - #14594

Closed
raliclo wants to merge 2 commits into
PerryTS:mainfrom
raliclo:fix/family-perry-thread-local
Closed

raliclo wants to merge 2 commits into
PerryTS:mainfrom
raliclo:fix/family-perry-thread-local

Conversation

@raliclo

@raliclo raliclo commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

tls-budget / self-test-checkers fails on every PR: 74304a9 added a raw thread_local! (SCRATCH) to crates/perry-runtime/src/wpfacts_check/family.rs, and scripts/check_thread_locals.py allows none there. This PR declares it with crate::perry_thread_local!, as the sibling wpfacts_check/life.rs does.

Changes

  • crates/perry-runtime/src/wpfacts_check/family.rs: thread_local! → crate::perry_thread_local! (same body, same .with() call sites).

Related issue

Introduced by 74304a9 (check mode: the family claim).

Test plan

On current main (f451fa6139):

command main this branch
python3 scripts/check_thread_locals.py FAIL: family.rs: 1 raw thread_local! declaration(s), none allowed thread-local policy OK: 479 hot declarations, 246 cold declarations in 91 recorded files, capacity 768
python3 scripts/check_thread_locals.py --self-test OK OK
RUST_TEST_THREADS=1 cargo test --release -p perry-runtime --lib wpfacts_check not run 10 passed

Built on macOS (Apple M6), nightly from rust-toolchain.toml, LLVM 23.1.5.

Checklist

  • I have NOT bumped the workspace version or edited CHANGELOG.md
  • My commits follow the loose feat: / fix: / docs: / chore: prefix convention used in the log
  • I've read CONTRIBUTING.md and agree to the Code of Conduct

🤖 Generated with Claude Code

https://claude.ai/code/session_01CUQanVsnitcrmYLAWWPc3p

Summary by CodeRabbit

  • Chores
    • Updated an internal thread-local declaration to comply with the project’s policy check.

ralic and others added 2 commits November 13, 2026 08:53
74304a9 added a raw `thread_local!` to
crates/perry-runtime/src/wpfacts_check/family.rs, which
`scripts/check_thread_locals.py` refuses, so `tls-budget /
self-test-checkers` fails on every PR. `crate::perry_thread_local!` takes the
same syntax and the same `.with()` calls, as `wpfacts_check/life.rs` already
does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CUQanVsnitcrmYLAWWPc3p
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CUQanVsnitcrmYLAWWPc3p
@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The check-mode family claim’s SCRATCH counter now uses crate::perry_thread_local! instead of thread_local!. Its Cell<u32> initializer is unchanged. The changelog records the change.

Changes: Thread-local declaration update

Layer / File(s) Summary
Update the SCRATCH declaration
crates/perry-runtime/src/wpfacts_check/family.rs, changelog.d/14594-family-perry-thread-local.md
SCRATCH now uses crate::perry_thread_local!; its Cell<u32> value and initializer remain unchanged. The changelog notes that tls-budget refused the raw declaration.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Bug fix

Possibly related issues

  • Issue 10709 concerns another raw thread_local! conversion and a Linux debug SIGSEGV associated with perry_thread_local!. The issue says the cause is unconfirmed; its effect on this SCRATCH change is unresolved.

Possibly related PRs

  • PerryTS/perry#14373: Replaces raw thread_local! declarations with crate::perry_thread_local! to address the same thread-local policy self-check failure.
Merge Risk: Minimal · up to 760ff

This is a small declaration change that satisfies the thread-local policy check without altering runtime behavior. No actionable merge risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the actual change: the family SCRATCH declaration in wpfacts_check now uses perry_thread_local! instead of a raw thread_local!. The tls-budget tag names the policy the change satisfies…
Description check Passed The description follows the repository template. It has a summary explaining the raw thread_local! failure and the fix, a changes list naming the file, a related issue (commit 74304a9), and a test …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the actual change: the family SCRATCH declaration in wpfacts_check now uses perry_thread_local! instead of a raw thread_local!. The tls-budget tag names the policy the change satisfies. The title is specific and matches the raw summary, objectives, and description.

Full details: Description check

Explanation

The description follows the repository template. It has a summary explaining the raw thread_local! failure and the fix, a changes list naming the file, a related issue (commit 74304a9), and a test plan with before-and-after results. The template's Checklist items are marked. The template's test-plan checkboxes for the full workspace test command and docs are not addressed, and the template's HTML comment block about version bumps is omitted. These gaps are minor because the change is a single-line declaration fix.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 091fde50-812a-47f3-a191-d0b7f002111b
Commits

Reviewing files that changed from the base of the PR and between f451fa6 and 760ffd6.

Files selected for processing: 2

  • changelog.d/14594-family-perry-thread-local.md
  • crates/perry-runtime/src/wpfacts_check/family.rs

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 4 remain after this review.

@raliclo

raliclo commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

This fix is also included in #14604, which fixes the other mechanical/stale reds on main in one PR. Whichever you prefer: merge this one alone, or close it in favour of #14604.

@raliclo

raliclo commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

Merged as part of #14604 (ed15abd), so this one is no longer needed. Closing.

@raliclo raliclo closed this Nov 13, 2026
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.

2 participants