v3.0.0#10
Draft
noahbaculi wants to merge 28 commits into
Draft
Conversation
Apply the v3.0.0 language cleanup from CONTEXT.md across the Rust core, CLI, pyo3 module, type stubs, Python tests, and README. Breaking renames: - FileMatch -> FileComparison (Rust struct + Python class) - percent_match -> similarity_ratio - FileMatch.lines -> FileComparison.content - get_percent_matching_lines -> get_similarity_ratio - format_file_matches -> format_file_comparisons - Args.max_lines -> Args.max_file_lines, CLI --max-lines -> --max-file-lines - Args.include_patterns/exclude_patterns -> include_glob/exclude_glob - Python search_for_lines -> search - Python kwargs include_globs/exclude_globs/max_lines -> include_glob/exclude_glob/max_file_lines - Local renames: comp_path -> candidate_path, comp_lines -> candidate_content, ref_lines -> reference_string, file_matches -> file_comparisons Also add `dynamic = ["version"]` to pyproject.toml so newer maturin (>=1.13) can resolve the version from Cargo.toml.
The doctest referenced sample-comprehensive/... paths that aren't in the repo and panicked on read_to_string. Point it at files under sample_dir_hello_world and sample_dir_mix and recompute the expected column widths so cargo test --doc passes.
Finish the v3.0.0 language cleanup: drop the misleading
"substring 'foo'" wording from the README and use a real glob
('**/*foo*'), rename the walkdir_vec local to dir_entries in
run_search and cli_run_search, and document the breaking renames
in a new CHANGELOG.md linked from the README.
compare_files was demoted to pub(crate) on the way to becoming dead once run_search routed through the new progress-callback helper. Since nothing inside the crate still called it, drop the function and the walkdir::DirEntry import.
Spec/ADR-0002 promised compare_file would be pub(crate); also restore the CLI graceful-error path that a stray todo!() was blocking.
Demote Args.include_glob and Args.exclude_glob to pub(crate). The fields hold the parsed glob::Pattern form, and exposing them as pub made glob::Pattern part of the semver-covered surface that ADR-0002 explicitly excludes. Construction stays through Args::new with string globs; the binary-crate tests that previously mutated the field are rewritten to build a fresh Args via Args::new.
"".split('\n') returns [""] not [], so the previous
grid_options.is_empty() branch was unreachable. With
--min-similarity-ratio it is now common to filter everything out;
the user was seeing a blank interactive picker instead of the
intended 'No files found' message.
The flag previously accepted any f32, including NaN (which made '>= min' always false and silently filtered everything), negatives, and values above 1.0. Add a value_parser that bounds to [0.0, 1.0] and rejects NaN explicitly.
extract_glob_arg discarded the underlying conversion error with |_|, so a user passing include_glob=[1, 2] got a generic 'must be str, list[str], or None' with no hint that the issue was the int element. Preserve the inner error in the message and add a Python regression test.
PyO3's PathBuf extractor accepts str and os.PathLike at runtime, but the .pyi declared str only. Widen the path parameters of search() and FileComparison.__new__ to Union[str, os.PathLike[str]] so type checkers stop rejecting pathlib.Path arguments.
The existing min_similarity_ratio test only exercised the predicate. Add a test that runs the full main() pipeline on real files and asserts the survivors are descending-sorted, above the threshold, within the user count, and identical to the prefix of the descending-sorted full list filtered to the threshold.
Replace format!("{:?}", e) with e.to_string() in into_args. Debug
on io::Error prints the internal struct shape; Display prints the
user-facing message.
- README 'Output for v3.0.0' block regenerated to include --min-similarity-ratio and the multi-line clap format. - README Versioning section gets a 'Migrating from 2.x to 3.x' subsection with a Python before/after. - CONTEXT.md: the FileMatch rename is done, not 'scheduled'. - ADR-0002: function names corrected to parse_glob_vec and compare_file (the functions in the tree).
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.
Version 3.0.0
CONTEXT.mddefining canonical terms: reference, search root, candidate file, search, comparison,similarity_ratio, include/exclude glob,max_file_lines,countdocs/adr/0001-similarity-ratio-uses-textdiff-ratio.mdrecording thatsimilarity_ratioissimilar::TextDiff::ratio()(Ratcliff/Obershelp over line sequences), not "fraction of reference lines present in the candidate"FileMatch/percent_matchnames as scheduled for rename toFileComparison/similarity_ratioin subsequent commits