refactor(core): normalize WalkBuilder paths at source to eliminate ./ prefix#9
Merged
Merged
Conversation
… prefix collect_markdown_files now strips the leading './' that WalkBuilder produces when root is '.', so every returned path matches the shape a user would type on the command line. With this normalisation in place the transient canonical_plan_key / find_matching_plan_key workaround from #7 is redundant — all ReplacementPlan key operations revert to plain HashMap lookups, honouring KISS. The two regression tests from #6 continue to pass, confirming the source-level fix is sufficient. A new test locks in the 'no ./ prefix' invariant. Refs #8
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
Normalize
WalkBuilderoutput paths at the source (collect_markdown_files) by stripping the./prefix, then remove thecanonical_plan_key/find_matching_plan_keyworkaround frommv.rsthat was only necessary because of this inconsistency.Linked Issue
Closes #8
Changes
src/core/util.rs:collect_markdown_filesnow strips the leading./thatWalkBuilderproduces whenrootis".", so every returned path matches the shape a user would type on the command line.src/core/mv.rs: removedcanonical_plan_key,find_matching_plan_key, and theresolve_pathimport. AllReplacementPlankey operations (remove,contains_key, inequality checks) revert to plainHashMaplookups.tests/lib_find_tests.rs: new testtest_find_references_paths_have_no_dot_slash_prefixlocks in the invariant. The two fix(mv): mv fails when source has a self-reference and path shape differs from WalkBuilder output #6 regression tests (test_mv_relative_source_with_self_reference_succeeds,test_mv_relative_source_rewrites_external_reference) continue to pass, confirming the source-level fix is sufficient.Testing
scripts/precheck.shpasses locally (cargo clippy: No issues found,cargo test: 275 passed, 1 ignoredacross 9 suites)./prefix invariant