fix: re-run task when generated files are missing with method: timestamp#2716
Draft
drichardson wants to merge 2 commits intogo-task:mainfrom
Draft
fix: re-run task when generated files are missing with method: timestamp#2716drichardson wants to merge 2 commits intogo-task:mainfrom
drichardson wants to merge 2 commits intogo-task:mainfrom
Conversation
When using method: timestamp, deleting a generated file (e.g. after a clean) caused the task to be incorrectly skipped. The timestamp sentinel file at .task/timestamp/<task> was still present from the previous run, so TimestampChecker compared source timestamps against the sentinel alone and found nothing newer—never noticing that the actual outputs were gone. Fix by adding the same guard that ChecksumChecker already uses: before the timestamp comparison, iterate the declared generates patterns and return false (not up to date) if any pattern matches zero files. Fixes go-task#1230 Assisted by AI Co-Authored-By: Claude <noreply@anthropic.com>
…file Add TestStatusChecksumMissingGenerated to verify that ChecksumChecker also re-runs the task when a generated file is deleted after the checksum file is established, mirroring the coverage added for TimestampChecker. Assisted by AI Co-Authored-By: Claude <noreply@anthropic.com>
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.
When using
method: timestamp, deleting a generated file (e.g. after a clean) caused the task to be incorrectly skipped.The timestamp sentinel file at
.task/timestamp/<task>was still present from the previous run, soTimestampCheckercompared source timestamps against the sentinel alone and found nothing newer—never noticing that the actual outputs were gone.Root cause
TimestampChecker.IsUpToDateresolvesgeneratespatterns viaGlobs(). If the generated files don't exist,Globs()returns an empty slice (no error). The sentinel file is then the only entry ingenerates, and since sources haven't changed since the last run, the task is reported as up to date.ChecksumCheckeralready handles this correctly by explicitly checking that each declared generates pattern matches at least one file before proceeding.Fix
Apply the same guard to
TimestampChecker: iterate the declaredgeneratespatterns before the timestamp comparison and returnfalse(not up to date) if any pattern matches zero files.Testing
Regression tests added for both affected methods:
TestStatusTimestamp— verifiesmethod: timestampre-runs after generated file is deletedTestStatusChecksumMissingGenerated— verifiesmethod: checksumre-runs after generated file is deleted (the existing behavior was already correct; this test ensures it stays that way)Both tests follow the same pattern:
Fixes #1230