Skip to content

Comments

Replace panic! and assert! with turso_macros assertions#5488

Merged
LeMikaelF merged 1 commit intomainfrom
claude/turso-assertions-details-5AoPZ
Feb 20, 2026
Merged

Replace panic! and assert! with turso_macros assertions#5488
LeMikaelF merged 1 commit intomainfrom
claude/turso-assertions-details-5AoPZ

Conversation

@LeMikaelF
Copy link
Collaborator

@LeMikaelF LeMikaelF commented Feb 20, 2026

Description

This PR replaces all instances of panic! and assert! macros with structured assertion macros from turso_macros (turso_assert! and turso_assert_unreachable!). These macros provide better error context by including structured metadata about the failure conditions.

This will make turso-stress failures easier to read, instead of them looking like this:

image

Convert panic!/assert! in turso-stress to turso_assert/turso_assert_unreachable
with structured details blocks, so Antithesis gets proper metadata instead of
baked-in format strings. Also remove redundant format!("{:?}", ...) wrappers
in btree.rs and builder.rs details blocks since the macro already applies Debug
formatting.

https://claude.ai/code/session_012NRC1Tbyaoexyb8PruUQLG
Copy link

@turso-bot turso-bot bot left a comment

Choose a reason for hiding this comment

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

Please review @jussisaurio

@LeMikaelF
Copy link
Collaborator Author

still a draft


if overflows {
*write_state = WriteState::Balancing;
turso_assert!(matches!(self.balance_state.sub_state, BalanceSubState::Start), "no balancing operation should be in progress during insert", { "state": format!("{:?}", self.state), "sub_state": format!("{:?}", self.balance_state.sub_state) });
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The format! here was redundant, because I changed these macros to use Debug.

@LeMikaelF LeMikaelF marked this pull request as ready for review February 20, 2026 20:24
Copy link

@turso-bot turso-bot bot left a comment

Choose a reason for hiding this comment

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

Please review @jussisaurio

@LeMikaelF LeMikaelF merged commit 6d5c2b7 into main Feb 20, 2026
84 of 85 checks passed
@LeMikaelF LeMikaelF deleted the claude/turso-assertions-details-5AoPZ branch February 20, 2026 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants