refactor(dag): ExportFormat implements FromStr instead of shadowing it - #148
Merged
ApiliumDevTeam merged 1 commit intoJul 30, 2026
Conversation
ApiliumDevTeam
force-pushed
the
fix/nan-in-clamp-shaped-expressions
branch
from
July 29, 2026 10:06
30aaba4 to
9b62d8d
Compare
ApiliumDevTeam
force-pushed
the
refactor/exportformat-implements-fromstr
branch
from
July 29, 2026 10:06
1f61a38 to
d8e5c58
Compare
`ExportFormat::from_str` was an inherent method returning `Option`, which shadows `std::str::FromStr::from_str` and returns a different shape from it. A caller reading `ExportFormat::from_str(..)` could not tell which one they were getting, and got no reason for the failure either way. Implement the trait with an error that carries the offending input and knows the accepted spellings. The list of valid formats lived in the REST handler, where it could drift away from the parser with nothing to catch it — it already advertised "dot, mermaid, json" while the parser also accepted "graphviz" and "md". Now the type owns it and a test asserts the message names every spelling the parser takes. One caller migrated. `cargo clippy --workspace --all-targets -- -D warnings` and `cargo fmt --all --check` are both clean with no `#[allow]` left anywhere from this series.
ApiliumDevTeam
force-pushed
the
fix/nan-in-clamp-shaped-expressions
branch
from
July 29, 2026 10:25
9b62d8d to
98fa442
Compare
ApiliumDevTeam
force-pushed
the
refactor/exportformat-implements-fromstr
branch
from
July 29, 2026 10:25
d8e5c58 to
1ca5a92
Compare
This was referenced Jul 29, 2026
ApiliumDevTeam
merged commit Jul 30, 2026
e4a8ee4
into
fix/nan-in-clamp-shaped-expressions
12 checks passed
This was referenced Jul 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Last of the stack. Base is #147. Touches a public signature, which is why it is separate.
What was wrong
ExportFormat::from_strwas an inherent method returningOption. It shadowsstd::str::FromStr::from_strand returns a different shape from it, so a caller readingExportFormat::from_str(..)could not tell which one they were getting — and got no reason for the failure either way.What it is now
A real
FromStrwith an error that carries the offending input and knows the accepted spellings.That last part fixed a live inconsistency: the list of valid formats lived in the REST handler, where it could drift from the parser with nothing to catch it. It already had. The handler advertised
"dot, mermaid, json"while the parser also acceptedgraphvizandmd. The type owns the list now, and a test asserts the message names every spelling the parser takes.Blast radius
One caller outside this module's own tests, migrated here. Technically a public-API change, so worth a minor version even though every consumer is in this workspace.
Verification
#[allow(clippy::should_implement_trait)]removed — no#[allow]from this series is left anywhere.cargo clippy --workspace --all-targets -- -D warningsexit 0 ·cargo fmt --all --checkexit 0 · 2248 tests green.