Repository navigation
fix: compare the unrounded age in --stale_days checks - #390
Merged
Merged
Conversation
timedelta.days floors negative deltas, so a source file a minute older than the model counted as a full day older and --stale_days 1 reported it. Compare the exact age in days and round only for the message.
izar
approved these changes
Nov 11, 2026
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.
With
--stale_days 1, a source file that is only a minute older than the model is reported as "Model script model.py is only 1 days newer than source code file source.py". On a fresh clone, where all files get nearly the same mtime, this prints for every source file._staletakes(src_mtime - tm_mtime).days, andtimedelta.daysrounds negative deltas down, so -60 seconds becomes -1 day and theage <= -daysbranch fires a day early. Now the age is compared in exact days and rounded only for the message. The "This model is N days older" side keeps the same thresholds and output.The new test in
tests/test_stale_paths.pysets the source 60 seconds older than the model and runs--stale_days 1. It fails on master and passes with the change; the other stale tests still pass. Ruff and Black report nothing new on the changed lines.I found no existing issue or PR for this.