Skip to content

v3.0.0#10

Draft
noahbaculi wants to merge 28 commits into
mainfrom
v3.0.0
Draft

v3.0.0#10
noahbaculi wants to merge 28 commits into
mainfrom
v3.0.0

Conversation

@noahbaculi
Copy link
Copy Markdown
Owner

@noahbaculi noahbaculi commented May 21, 2026

Version 3.0.0

  • Add CONTEXT.md defining canonical terms: reference, search root, candidate file, search, comparison, similarity_ratio, include/exclude glob, max_file_lines, count
  • Add docs/adr/0001-similarity-ratio-uses-textdiff-ratio.md recording that similarity_ratio is similar::TextDiff::ratio() (Ratcliff/Obershelp over line sequences), not "fraction of reference lines present in the candidate"
  • Flag the existing FileMatch / percent_match names as scheduled for rename to FileComparison / similarity_ratio in subsequent commits

@noahbaculi noahbaculi marked this pull request as draft May 21, 2026 00:30
@noahbaculi noahbaculi changed the title v3.0.0 language cleanup (docs) v3.0.0 May 21, 2026
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.
@noahbaculi noahbaculi self-assigned this May 21, 2026
noahbaculi added 25 commits May 20, 2026 18:46
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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant