Skip to content

fix(filetail): preserve reconciled checkpoint on first open - #157

Merged
jmagar merged 1 commit into
mainfrom
fix/filetail-checkpoint-sync
Aug 2, 2026
Merged

fix(filetail): preserve reconciled checkpoint on first open#157
jmagar merged 1 commit into
mainfrom
fix/filetail-checkpoint-sync

Conversation

@jmagar

@jmagar jmagar commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

Problem

Post-merge Coverage for #154 exposed a file-tail first-open race. reconcile() persisted a start-at-end checkpoint, but the spawned task discarded the reconciled source snapshot and reloaded the registry before its first open. Under coverage load, the task could ingest a pre-existing line instead of starting from the checkpoint.

Failed main run: 30722500743 (Coverage).

Fix

  • pass the exact checkpointed source snapshot from reconcile() into the task
  • use that snapshot for the first open when the live source definition still matches
  • continue reloading current registry state for retries
  • preserve disable and reconfiguration behavior by validating the live definition first
  • add a deterministic current-thread regression test

Verification

  • original checkpoint race test: 50 consecutive passes
  • deterministic first-open regression: 50 consecutive passes
  • full file-tail suite: 37 passed, 0 failed
  • cargo check --all-targets: passed
  • strict cargo clippy --all-targets --all-features -- -D warnings: passed
  • formatting, diff integrity, and module-size guard: passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a file-tail “first open” race where reconcile() persisted a start-at-end checkpoint, but the spawned tail task could discard that reconciled snapshot and reload registry state before its first open—potentially ingesting pre-existing lines under coverage load.

Changes:

  • Pass the checkpointed FileTailSource snapshot produced by reconcile() into the spawned task, and use it for the first open when the live registry definition still matches.
  • Preserve existing disable/reconfigure behavior by validating the live registry entry first and continuing to reload registry state on retries.
  • Add a deterministic current_thread regression test that reproduces the original timing hazard reliably.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/filetail/supervisor.rs Ensures the first open uses the reconciled checkpoint snapshot (when the live definition matches), preventing pre-checkpoint ingestion.
src/filetail/supervisor_tests.rs Adds a deterministic regression test that validates the first open honors the checkpoint snapshot created by reconcile().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jmagar
jmagar force-pushed the fix/filetail-checkpoint-sync branch from e8cccd2 to 072d73a Compare August 2, 2026 04:16
@jmagar
jmagar merged commit 2086823 into main Aug 2, 2026
18 checks passed
@jmagar
jmagar deleted the fix/filetail-checkpoint-sync branch August 2, 2026 04:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants