fix: reject whitespace-padded venue ids across host and SDK - #55
Open
mfw78 wants to merge 2 commits into
Open
Conversation
Both VenueId types now refuse empty and whitespace-padded ids, rejecting rather than trimming so two spellings never collapse into one id (the exact-equality manifest_id_check depends on that). Host-side VenueId::new tightens from whitespace-only to any surrounding whitespace. SDK-side VenueId gains a validating constructor, FromStr, and TryFrom in place of the unvalidated From impls; from_static stays const and fails padded literals at const evaluation. The venue marker macro rejects a padded id literal at expansion, before the manifest comparison. The runtime half (manifest names) is upstream nullislabs/nexum-runtime#110. Closes #39
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.
What
Rejects (never trims) empty or whitespace-padded venue ids across all three surfaces: host-side
registry.rs, host-sideclient.rsimport validation, and SDK-sideclient.rs.videre-host/src/registry.rs:VenueId::newnow rejects empty input and any surrounding whitespace (was: whitespace-only input only);InvalidVenueId's error message updated to match.videre-host/src/client.rs: the wire venue id validation doc comment updated to reflect the tightened check; test renamed and extended to cover leading/trailing/newline/NBSP padding, not just blank input.videre-sdk/src/client.rs:VenueIdgainedInvalidVenueId(viathiserror), a validatingVenueId::new(impl Into<Cow<'static, str>>),FromStr,TryFrom<String>, andTryFrom<&str>. The unvalidatedFrom<String>/From<&str>impls are removed, so no infallible path accepts arbitrary strings.from_staticstaysconstand asserts at const evaluation via a hand-rolledconst padded()helper (manual UTF-8 boundary-char decode plusconst char::is_whitespace).videre-sdk/src/keeper.rs:Keeper::newtightened fromimpl Into<VenueId>toVenueId(only the identity conversion remained); test call sites updated toVenueId::from_static.videre-macros/src/venue_marker.rs: updated alongside theVenueIdconstruction changes.Why
Closes #39
A whitespace-padded venue id (
cow,cow,cow\n,cow\u{a0}) previously slipped past validation, letting two spellings of what should be one id both resolve. Reject-not-trim keeps the id's spelling exact rather than silently rewriting it, so a padded id can never be installed or accepted at any of the three boundaries: host registry construction, the host's wasm import seam, and the SDK client.Testing
All on a fresh clone of
fix/venue-id-whitespace(a6c9442) insidenix develop(rustc 1.94.0, cargo-nextest 0.9.127), withRUSTFLAGS="-D warnings"and--lockedthroughout, mirroring.github/workflows/ci.yml.cargo clippy -p videre-host -p videre-sdk -p videre-macros --all-targets --all-features --locked -- -D warnings- clean, no warnings.cargo test --doc -p videre-host -p videre-sdk -p videre-macros --all-features --locked- ok; 0 doctests in each of the three crates (no doc examples on the touched surface).RUSTDOCFLAGS="-D warnings" cargo doc --no-deps -p videre-host -p videre-sdk -p videre-macros --locked- documented all three, no warnings.videre-macroschanged, so the guest wasms were rebuilt:cargo build --release --target wasm32-wasip2 --locked -p echo-venue -p echo-client -p echo-keeper -p flaky-venue -p logging-venue- all 5 built.AI Assistance
Implemented with claude-fable-5, red-teamed with claude-opus-5, PR description written by claude-sonnet-5.