Repository navigation
Conversation
The recency boost never changed file priority or output order. Three defects each disabled it on its own: - serialize_repo computed the boost map but process_files_parallel ignored it (`_boost_map`), and the processor was built with empty commit_times. The processor now takes the boost map, keyed by canonical absolute path so subdirectory inputs match the repo-root paths git reports. - get_recent_commit_times_git2 walked the full tree of each commit, so every file in HEAD got HEAD's time and all boosts were 0. Each commit is now diffed against its first parent, so a file only gets the time of a commit that changed it. - clap-config-file ignores default_value on config-only scalars, so max_git_depth was 0 on the CLI and no commits were scanned. It now falls back to DEFAULT_MAX_GIT_DEPTH (100) unless the config sets it. Fixes prooflinedev#272
get_file_priority compiled every rule's regex on each call, and the parallel processor called it once per file, so a run did files x rules regex compilations. Add CompiledPriorityRules, built once when the processor is created, and score every file against it. get_file_priority and get_file_priority_with_category keep their signatures and delegate to it. 20,000 files with 10 rules (release build, 5 runs): ~2.3s -> ~0.19s. Output is byte-for-byte identical. Fixes prooflinedev#273
A file deleted in a newer commit was skipped there, then picked up again from the older commit that added it. Deleted paths stayed in the map and widened the oldest/newest range that the recency boost is normalised over. The newest commit touching a path now decides its entry, and a deletion records no time. Also cover modifications and the max_git_depth commit window. Refs prooflinedev#272
The benchmark and coverage jobs ran `git checkout ${{ github.head_ref }}`.
For pull requests from forks that branch does not exist in this
repository, so both jobs failed with "pathspec did not match".
`git fetch origin main` also resolved to the tag named `main` (an old
v0.21 commit) instead of the branch, so baselines were measured against
the wrong code. Check out github.event.pull_request.base.sha and
github.sha instead, which are unambiguous and work for forks.
This branch has not been deployed
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.
Fixes #272
Fixes #273
Summary
#272: the Git recency boost never affected priority. Three independent defects, each of which disabled it on its own:
process_files_parallelignored the boost map (_boost_map) and built the processor with emptycommit_timesParallelFileProcessor::with_recentness_boostapplies it. Keys are canonical absolute paths, soyek src/matches the repo-root-relative paths git reportsget_recent_commit_times_git2walked each commit's full tree, so every file in HEAD got HEAD's time and all boosts tied at 0default_valueon config-only scalars, somax_git_depthwas0on the CLI and the revwalk didtake(0)apply_config_scalar_defaultsrestoresDEFAULT_MAX_GIT_DEPTH(100) unless the config setsmax_git_depth/max-git-depth; an explicit0is still respectedA follow-up commit also drops files whose newest change was a deletion. Before, the older commit that added such a file gave it a time, which widened the range the boost is normalised over.
#273: regexes compiled per file.
CompiledPriorityRulesis built once per processor and reused for every file.get_file_priorityandget_file_priority_with_categorykeep their public signatures and delegate to it.Results
Running yek on this repo, the
src/files committed most recently (config.rs,error.rs,pipeline.rs) now come last. Before, the order was alphabetical.Priority-rule benchmark, 20,000 files, 10 rules, release build, 5 runs each:
Output is byte-for-byte identical (
cmp).CI fix included
The Benchmark and Code Coverage jobs failed on this PR, and on other fork PRs such as #269 and #271, before running any yek code:
git checkout ${{ github.head_ref }}, but a fork's branch doesn't exist in this repo:error: pathspec 'fix/apply-git-recency-boost' did not match.git fetch origin mainresolved to the tagmain(194c765, v0.21.0) rather than the branch, so benchmark and coverage baselines were measured against old code.ci: check out PR and base commits by SHAswitches both jobs togithub.event.pull_request.base.shaandgithub.sha. Happy to split this into its own PR if you prefer.Notes for review
src/config.rsis near the code fix: read snake_case keys from yek config files #269 touches (snake_case config keys), so a small rebase may be needed depending on merge order. The new default helper accepts both key styles, consistent withapply_config_bool_overrides.max_git_depthcommits now get no recency entry (boost 0). Before, they inherited HEAD's time.Test plan
tests/git_boost_test.rs(new): newer file outranks older by exactlygit_boost_max; subdirectory input;git_boost_max = 0; non-git directory; CLI end-to-end with no config. All failed before the fix.priority_test: commit time is when the file last changed, not HEAD (failed before)priority_test: modified files take the newer time; deleted files are dropped (failed before the follow-up); files outside themax_git_depthwindow are left outconfig.rsunit tests:max_git_depthdefault without a config file, default when the key is omitted, and explicit values in both key stylespriority_test:CompiledPriorityRulessums matches, skips invalid patterns, and matchesget_file_prioritycargo test --no-fail-fast: 414 passed, 0 failedmake lint(clippy-D warnings+fmt --check)diff_tree_to_treeerror branch, which only runs on a corrupt object databasex86_64-pc-windows-msvc, so the boost path runs there