Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/6805-test-reset-c5a-sets.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test(runtime): the class-field inline-guard test reset also clears the C5a per-key vetting hash sets, removing cross-test order dependence for reused key names (CodeRabbit follow-up on #6802).
10 changes: 10 additions & 0 deletions crates/perry-runtime/src/object/descriptor_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,16 @@ pub(crate) fn class_field_inline_guard_enabled() -> bool {
#[cfg(test)]
pub(crate) fn test_reset_class_field_inline_guard() {
PERRY_CLASS_FIELD_INLINE_GUARD_DISABLED.store(0, Ordering::Relaxed);
// Also clear the C5a per-key vetting sets (production-monotonic, so
// without this a key name reused across tests in one process would
// inherit an earlier test's declared-field / installed-key state and
// make the disable decision order-dependent (CodeRabbit on #6802).
if let Ok(mut guard) = DECLARED_FIELD_NAME_HASHES.write() {
guard.take();
}
if let Ok(mut guard) = PROTO_DESCRIPTOR_KEY_HASHES.write() {
guard.take();
}
Comment on lines +154 to +159

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.

}

/// #5654: flip the process-wide inline gate only when the descriptor target can
Expand Down
Loading