fix(filetail): distinguish append growth from replacement - #161
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes a file-tail rotation heuristic bug where normal append-only growth (especially for files shorter than the 256-byte fingerprint window) could be misclassified as same-inode replacement, causing the tailer to reopen at byte 0 and re-read old data. It adjusts fingerprint comparison logic to distinguish true replacement from ordinary growth and adds a regression test to lock in the correct behavior.
Changes:
- Parameterize prefix fingerprint reads so the rotation check can compare only the baseline prefix length.
- Keep using the full 256-byte baseline fingerprint window for fresh opens/reopens while comparing only the stored baseline prefix.
- Add a deterministic test ensuring short-file append growth does not trigger a reopen-from-zero.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/filetail/supervisor/io.rs |
Updates the prefix fingerprinting/rotation detection logic to compare only baseline bytes while preserving a stable baseline window. |
src/filetail/supervisor_tests.rs |
Adds a regression test that reproduces and prevents the short-file append misclassification. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
jmagar
force-pushed
the
fix/filetail-start-at-end-race
branch
from
August 2, 2026 14:02
d7d9c97 to
87a4eb9
Compare
This was referenced Aug 2, 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.
Problem
Post-merge Tests for
aed693befailed in run30748902551, job91499296468:The checkpoint handoff was valid: the stored and opened file identity matched and the initial offset was 13. The reader later misclassified normal append-only growth as same-inode replacement.
For files shorter than the 256-byte fingerprint window, the baseline fingerprint contains the whole original file. If an append lands between EOF detection and the rotation check, the new fingerprint is longer, so the code treats the append as replacement and reopens at byte 0.
Fix
Verification
This also unblocks clean post-merge CI so the corrected Release Please workflow from #158 can be verified.