Skip to content

test(runtime): clear C5a per-key vetting sets in the inline-guard test reset#6805

Merged
proggeramlug merged 2 commits into
mainfrom
fix/6802-test-reset-hash-sets
Jul 23, 2026
Merged

test(runtime): clear C5a per-key vetting sets in the inline-guard test reset#6805
proggeramlug merged 2 commits into
mainfrom
fix/6802-test-reset-hash-sets

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Follow-up to CodeRabbit's post-merge review finding on #6802: test_reset_class_field_inline_guard() reset only the sticky disable flag, leaving DECLARED_FIELD_NAME_HASHES / PROTO_DESCRIPTOR_KEY_HASHES accumulated across tests in one process — a key name reused by a later test would inherit earlier state and make the disable decision order-dependent. The reset now clears both sets (cfg(test)-only change; the sets stay monotonic in production by design).

Both c5a_tests green with the fix. Includes the changelog.d fragment.

Summary by CodeRabbit

  • Tests
    • Improved test isolation by fully resetting cached state between class-field validation tests.
    • Prevented test results from depending on execution order or reused field and descriptor names.
    • Added a changelog entry documenting the test reliability improvement.

Ralph Küpper added 2 commits July 22, 2026 21:49
… test reset (CodeRabbit on #6802)

The sets are production-monotonic by design; without clearing them the
cfg(test) reset left earlier tests' declared-field / installed-key state
visible to later tests reusing a key name, making the disable decision
order-dependent.
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The class-field inline-guard test reset now clears C5a declared-field and prototype-descriptor hash sets, preventing state from persisting across tests. A changelog entry documents the reset behavior.

Changes

C5a test reset cleanup

Layer / File(s) Summary
Reset C5a vetting state
crates/perry-runtime/src/object/descriptor_state.rs, changelog.d/6805-test-reset-c5a-sets.md
The test reset takes the stored declared-field and prototype-descriptor hash sets from their locks, and the changelog records the update.

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

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is a short summary, but it omits the required template sections like Summary, Changes, Related issue, and Test plan. Add the template sections with a brief Summary, concrete Changes, Related issue or n/a, Test plan commands, and the checklist items.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the runtime test-reset change and matches the main change in the PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/6802-test-reset-hash-sets

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 `@crates/perry-runtime/src/object/descriptor_state.rs`:
- Around line 154-159: Update the reset helper’s write-lock handling for
DECLARED_FIELD_NAME_HASHES and PROTO_DESCRIPTOR_KEY_HASHES so poisoned locks are
recovered with into_inner() or cause an explicit failure, rather than being
silently skipped. Ensure guard.take() runs for both hash sets even after a prior
test panic, preserving deterministic reset behavior.
🪄 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: b9d04e3b-fd95-4fb9-8332-5759652b2e7d

📥 Commits

Reviewing files that changed from the base of the PR and between f7d1988 and c3e4042.

📒 Files selected for processing (2)
  • changelog.d/6805-test-reset-c5a-sets.md
  • crates/perry-runtime/src/object/descriptor_state.rs

Comment on lines +154 to +159
if let Ok(mut guard) = DECLARED_FIELD_NAME_HASHES.write() {
guard.take();
}
if let Ok(mut guard) = PROTO_DESCRIPTOR_KEY_HASHES.write() {
guard.take();
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Do not silently skip a poisoned reset lock.

If a test panics while holding either lock, write() returns Err and this helper leaves the corresponding hash set populated, reintroducing order-dependent test state. Recover the poisoned guard with into_inner() (or fail explicitly) so the reset remains deterministic.

🤖 Prompt for 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.

In `@crates/perry-runtime/src/object/descriptor_state.rs` around lines 154 - 159,
Update the reset helper’s write-lock handling for DECLARED_FIELD_NAME_HASHES and
PROTO_DESCRIPTOR_KEY_HASHES so poisoned locks are recovered with into_inner() or
cause an explicit failure, rather than being silently skipped. Ensure
guard.take() runs for both hash sets even after a prior test panic, preserving
deterministic reset behavior.

@proggeramlug
proggeramlug merged commit 0ccd160 into main Jul 23, 2026
29 of 30 checks passed
@proggeramlug
proggeramlug deleted the fix/6802-test-reset-hash-sets branch July 23, 2026 05:43
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.

1 participant