Repository navigation
Decide decay from the ranks read out of the store - #49
Merged
Merged
Conversation
writeFileStore totalled the final slice, so the paths being added and their rank + 1/rank increments counted toward the decay threshold. fasd accumulates `count += $2` inside its `$2 >= 1` block, summing only the ranks of the lines it read: new paths are not counted, increments are not counted, and pruned lines contribute nothing. The gap shows on a store just under the threshold. With high|1999 and `-A p1 p2`, fasder reached 2001 and aged everything to 1799.1/0.9/0.9, where fasd counts 1999 and writes 1999/1/1 untouched. Total the ranks in AddToStore, after the prune and before any increment, and pass that to writeFileStore. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
4 tasks
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
writeFileStoretotalled the final slice, so the paths being added and theirrank + 1/rankincrements counted toward the decay threshold. fasd accumulatescountinside its$2 >= 1block:Three things follow from where that line sits, none of which held before:
BEGINand never pass through the body.count += $2uses the value as read, not$2 + 1/$2.$2 >= 1guard.Follow-up to #48, where this surfaced while fixing the batching bug.
Effect
Measured against binaries built from
mainat 05fd6c7 and this branch:mainhigh|1999+-A p1 p2high|1799.1 p1|0.9 p2|0.9high|1999 p1|1 p2|1high|2001+-A p1 p2high|1800.9 p1|0.9 p2|0.9high|2000+-A highhigh|1800.00045high|2000.0005Row 1 is the practical one: a store sitting just under the threshold got aged early simply because two new paths were added in the same operation. Row 3 shows the same effect from an increment alone — 2000 is not over 2000, but 2000.0005 is.
Row 2 confirms genuine decay still fires, so this narrows when aging happens rather than disabling it.
Validation
go test ./...,-shuffle=onx3,go vet ./...,gofmtcleanTestAddPathsAppliesDecayOnceForTheWholeArgumentListfrom Drop entries whose rank has decayed below 1 #48 still passes, pinning row 2Touches
filestore.goonly.🤖 Generated with Claude Code