Skip to content

Conversation

@THardy98
Copy link
Contributor

@THardy98 THardy98 commented Oct 30, 2025

What was changed

Add antithesis_assertions feature flag to core SDK. Minimal assertions included, but can be added with more usage.

Why?

antithesis testing

  1. How was this tested:
    It's not really, just compiles

@THardy98 THardy98 force-pushed the antithesis-instrumentation branch 3 times, most recently from 7215c4d to 1b9db17 Compare November 2, 2025 18:57
@THardy98 THardy98 marked this pull request as ready for review November 2, 2025 20:23
@THardy98 THardy98 requested a review from a team as a code owner November 2, 2025 20:23
Comment on lines 196 to 198
x => {
crate::antithesis::assert_always!(
false,
"activity cancel yields supported command",
::serde_json::json!({
"activity_seq": self.shared_state.attrs.seq,
"unexpected_command": format!("{x:?}"),
"state": self.state().to_string(),
})
);
panic!("Invalid cancel event response {x:?}");
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we need these since a normal panic is still going to trigger antithesis - but the extra info can be useful.

It might make sense to make a macro like dbg_panic that these three places can use, but, not a big deal.

Comment on lines 444 to 445
#[cfg(not(feature = "antithesis_assertions"))]
macro_rules! dbg_panic {
Copy link
Member

Choose a reason for hiding this comment

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

We don't need two versions of this. You can just feature flag the assert_always statement

Comment on lines 40 to 42
/// No-op when feature is disabled.
#[inline(always)]
pub(crate) fn ensure_init() {}
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't need to exist because no one calls it when compiled without this flag.

In fact I'm surprised it doesn't warn as dead code

Comment on lines 46 to 51
($condition:expr, $message:literal, $details:expr) => {{
let _ = ($condition, $message);
let _ = $details;
}};
($condition:expr, $message:literal) => {{
let _ = ($condition, $message);
Copy link
Member

Choose a reason for hiding this comment

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

I think assigning things like this is actually going to cause the compiler not to optimize some stuff away.

Honestly, I'm not sure we want to do this technique at all. It's slightly more wordy, but guarding every call to assert_always with the flag at the callsite is safer in terms of actually making sure everything gets compiled out

@THardy98
Copy link
Contributor Author

THardy98 commented Nov 6, 2025

@Sushisource just FYI, I've been holding off on this given that the Antithesis experiment finishes next week and we're blocked on upgrading core due to worker heartbeating anyways (also doesn't seem worth to cherry-pick this commit into SDKs). It's more useful to investigate what we're getting already with the Antithesis + omes runs as of right now.

Depending on the success of the experiment, i'll either address + merge or just close the PR.

@THardy98
Copy link
Contributor Author

THardy98 commented Nov 7, 2025

@Sushisource just FYI, I've been holding off on this given that the Antithesis experiment finishes next week and we're blocked on upgrading core due to worker heartbeating anyways (also doesn't seem worth to cherry-pick this commit into SDKs). It's more useful to investigate what we're getting already with the Antithesis + omes runs as of right now.

Depending on the success of the experiment, i'll either address + merge or just close the PR.

I ended up just doing it anyways. Antithesis errors are difficult to debug. I want to try it on a test Python branch with this cherry-picked to see if we can get something more focused.

…e machines instead of direct calls to antithesis assert_always (dbg_panic just logs in non-release builds with no antithesis_assertions feature flag anyways)
@THardy98 THardy98 force-pushed the antithesis-instrumentation branch from 1bbaa43 to ada2e54 Compare November 7, 2025 19:18
Comment on lines +536 to 538
return Err(fatal!("{}",
"StartChildWorkflowExecutionInitiated attributes were unset".to_string(),
));
Copy link
Member

Choose a reason for hiding this comment

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

All these ones are oddly formatted with {} just being replaced w/ a static string

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.

5 participants