Repository navigation
fix(cache): tolerate small future cache timestamps - #759
Merged
Merged
Conversation
Windows file mtimes can be slightly ahead of time(), which made Cache.new discard a just-written cache and repeat successful DNS writes. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟢 Approved
The narrow logic change matches the intended behavior, preserves normal expiry, and has focused boundary coverage.
No open issues 🎉
What changed in this PR
This PR prevents freshly written runtime caches from being discarded when Windows file timestamps are slightly ahead of the clock, avoiding unnecessary repeated DNS writes.
Changes:
- Accepts future cache timestamps up to 2 seconds ahead.
- Preserves rejection of larger future skew and normal age-based expiry.
- Adds deterministic coverage for the 2-second acceptance and 3-second rejection boundaries.
| File | Description |
|---|---|
| tests/test_cache.py | Tests future timestamp tolerance alongside the existing expiry boundary. |
| ddns/cache.py | Adds a 2-second timestamp tolerance to runtime cache expiry checks. |
Review effort: Balanced
The entrypoint shell exited as soon as tini forwarded SIGTERM, so container teardown could kill the initial DDNS child before it handled the signal. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
NewFuture
enabled auto-merge (squash)
October 22, 2026 14:37
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
Windows file timestamps can be slightly ahead of
time().Cache.newtreated any future mtime as expired, so a just-written cache could be discarded and a successful DNS write repeated. This showed up as a flaky Windows ARM standalone E2E failure intest_partial_domain_failure_is_a_tool_error.A cache file up to 2 seconds ahead of the clock is now kept, matching the existing dashboard read tolerance. Files further in the future, and caches past
cache_max_age, are still discarded.Scope
Risk and compatibility
Changes
Cache.newallows up to 2 seconds of future file-time skew before treating the cache as outdatedValidation
The Windows ARM Nuitka standalone job was not rerun locally.
Review notes