fix: add OverlayName::try_new with release-mode path separator validation#261
Merged
tylerbutler merged 3 commits intomainfrom Apr 11, 2026
Merged
Conversation
…tion OverlayName::new used debug_assert! for validation, which is stripped in release builds. This adds a try_new constructor that returns anyhow::Result and validates against both forward slashes and backslashes. User-input boundary call sites in sources.rs are migrated to try_new, while trusted call sites (file stems, already-normalized names) keep using new. The debug_assert in new() is also updated to check for backslashes. Closes #238 🤖 Generated with [Nori](https://noriagentic.com) Co-Authored-By: Nori <contact@tilework.tech>
Contributor
Changelog PreviewThis PR adds the following changelog entries: v0.12.1 - 2026-04-11Command:
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Kept module-based structure from main (resolve.rs, create.rs, remove.rs, status.rs, git_exclude.rs) and removed duplicate inline definitions from lib.rs. Added missing unwrap_or_default() in resolve.rs for get_fuzzy_suggestions_multi_source. 🤖 Generated with [Nori](https://noriagentic.com) Co-Authored-By: Nori <contact@tilework.tech>
🤖 Generated with [Nori](https://noriagentic.com) Co-Authored-By: Nori <contact@tilework.tech>
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.
Summary
OverlayName::try_new()constructor that returnsanyhow::Resultand validates against both/and\path separators, ensuring validation is not stripped in release buildssrc/sources.rs(list_overlays_for_repo) to usetry_newdebug_assert!innew()to also check for backslash\#[should_panic]test (which only worked in debug mode) with properResult-based tests for both separator typesTest plan
try_newrejects forward slashes — new testtry_new_rejects_forward_slashtry_newrejects backslashes — new testtry_new_rejects_backslashtry_newaccepts valid names — new testtry_new_accepts_valid_nameCloses #238