Skip to content

smite: extract Violation enum for target-bug findings#142

Open
erickcestari wants to merge 1 commit into
morehouse:masterfrom
erickcestari:extract-violation
Open

smite: extract Violation enum for target-bug findings#142
erickcestari wants to merge 1 commit into
morehouse:masterfrom
erickcestari:extract-violation

Conversation

@erickcestari

Copy link
Copy Markdown
Contributor

Carve target-misbehavior findings out of ExecuteError into a dedicated Violation enum, and replace raw finding strings in scenarios with its variants. Centralizes the finding vocabulary so new oracles route through a single match arm and each message lives in one place.

@ekzyis ekzyis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Concept ACK

This replaces four very similar branches in ir.rs with one

Comment on lines +140 to +143
/// The target broke a protocol invariant. Surfaced to the scenario as a
/// failure; see [`Violation`] for the full catalog of target-bug findings.
#[error(transparent)]
Violation(#[from] Violation),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: I think Violation as a name is too generic. It doesn't say what was violated. Could rename to ProtocolViolation? I assume this is only meant for protocol violations, as per the documentation and current usage?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

See my comment below

Comment thread smite/src/violation.rs Outdated
Comment thread smite/src/violation.rs
Comment on lines +14 to +20
/// The target process died during or after processing the input.
#[error("target crashed")]
Crashed,

/// The target stopped responding to the post-input ping-pong sync.
#[error("target hung (ping timeout)")]
Hung,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Regarding my suggestion to rename to ProtocolViolation: these two aren't as clearly protocol violations as the others

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Violation is intentionally generic: it's the catalog of everything the fuzzer judges to be a target bug, not just protocol violations. A crash or a hang isn't a protocol violation, but it's still a violation of what a correct target should do, so ProtocolViolation would be too narrow for the enum as a whole. That's also why I kept Crashed/Hung in it. Note that the doc on ExecuteError::Violation does say "protocol invariant". That's accurate there, since the executor only ever produces the protocol-shaped variants; Crashed/Hung are raised directly by the scenarios and never go through ExecuteError.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the explanation. Makes sense to me!

Comment thread smite/src/violation.rs
Comment thread smite-scenarios/src/scenarios/noise.rs
Comment thread smite/src/violation.rs
Comment thread smite-scenarios/src/executor.rs Outdated
Comment thread smite-scenarios/src/executor.rs Outdated
Carve target-misbehavior findings out of ExecuteError into a dedicated
Violation enum, and replace raw finding strings in scenarios with its
variants. Centralizes the finding vocabulary so new oracles route through
a single match arm and each message lives in one place.
@erickcestari erickcestari requested a review from ekzyis July 9, 2026 18:47
@erickcestari

Copy link
Copy Markdown
Contributor Author

Thanks for the review @ekzyis! I've addressed most of your comments and added a comment about Violation. I don't have a strong opinion there, but Idk if it's valid another enum to separate the Hungs/Crashed case from the protocol violations.

@ekzyis ekzyis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ACK 8628e82

Comment thread smite/src/violation.rs
Comment on lines +14 to +20
/// The target process died during or after processing the input.
#[error("target crashed")]
Crashed,

/// The target stopped responding to the post-input ping-pong sync.
#[error("target hung (ping timeout)")]
Hung,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the explanation. Makes sense to me!

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