indexer: Windows live Modify dedup ignores ctime, missing same-length overwrites until reconcile #16
Labels
No labels
code-review
correctness
dos
performance
security
severity/high
severity/low
severity/medium
tech-debt
Kind/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
h-dv/code-index#16
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Severity: Medium · Category: Correctness (staleness window)
The Windows
Modify(Any)fast-pathis_metadata_only_modify(crates/daemon/src/watcher.rs:766-778) compares only(mtime_ns, size)and drops the event when they match — butclassify_stat(crates/indexer/src/reconcile.rs:46-51) additionally requiresctime_nsequality. A content overwrite that preserves mtime+size (e.g.cp -p, a restore, an in-place same-length rewrite) bumps NTFS ChangeTime but is skipped live.Not permanent — the 30-min periodic reconcile checks ctime and heals it — but it is a real staleness window that the tier-1 rule was meant to close.
Fix
FILE_BASIC_INFOpathmeta_ctime_ns_for_pathalready uses) and compare it; or accept-and-document that live Windows dedup is mtime+size only and correctness rests on the periodic reconcile.Filed from a deep multi-agent code review of the workspace (v0.5.7). Severity/category per the review; file:line refs were accurate at review time — verify against current
master.Closing as WONTFIX (accept-and-document) — documented in
49953d5.Reassessed on current master: the divergence is real and unchanged —
is_metadata_only_modify(watcher.rs) compares only(mtime, size)whilereconcile::classify_statadditionally requiresctime_ns, so a same-length content overwrite preserving mtime+size is skipped live. But the only fix is to read ctime here viameta_ctime_ns_for_path, which is exactly theCreateFileW+GetFileInformationByHandleEx+CloseHandleround-trip this fast-path was created to eliminate (it was the dominant Windows idle-CPU sink). Reintroducing it to close a narrow, self-healing window is a bad trade.The window is bounded and healed by the periodic reconcile (default 30 min), which does compare ctime. Added an explicit doc note at the comparison site recording this as a deliberate, accepted tradeoff (Windows-only; correctness rests on the reconcile safety-net). No behavior change, so no test.