Skip to content

fix(realtime): index Windows in-place writes reported as attrib; reads raise no event - #505

Merged
HananKavitzAmat merged 12 commits into
chunkhound:mainfrom
fstrasz:fix/windows-attrib-upstream
Nov 18, 2026
Merged

HananKavitzAmat merged 12 commits into
chunkhound:mainfrom
fstrasz:fix/windows-attrib-upstream

Conversation

@fstrasz

@fstrasz fstrasz commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #504. This branch is #504's branch, with #504's review changes merged in, plus one commit, 352bed9 (fix(realtime): index Windows in-place writes reported as attrib; reads raise no event). It replaces the event-type list that #504 introduces, so it cannot apply without it. Please review that commit only; the merges only carry #504 along, and it will rebase cleanly once #504 lands.

Problem

Two Windows problems with the watchdog backend, both left open in #504.

1. Most in-place writes are never indexed.

  • watchdog 7 classifies a FILE_ACTION_MODIFIED record as attrib whenever its LastChangeTime is ahead of its LastModificationTime (winapi._parse_extended_event_buffer). NTFS updates those two timestamps on its own schedule, so an ordinary append usually loses that race.
  • A direct probe (watchdog 7.1.0, 30 appends via open(path, "a") 1.2 s apart): 26 arrived as attrib only, 4 as modified only. open(path, "r+") behaves the same way.
  • _consume_events acts on created / modified / deleted / dir_* only, so an attrib-only write is never queued for indexing.

2. Every read takes a queue slot.

  • watchdog subscribes to FILE_NOTIFY_CHANGE_LAST_ACCESS. With last-access updates on (fsutil behavior query disablelastaccess), every read of a file not read for over an hour raises an event: attrib on watchdog 7, modified on 6.
  • Each of those events takes one of the 1,000 queue slots.
  • ChunkHound's own start-up scan reads every file.

Fix

  1. Map attrib to modified. In events.py, WATCHDOG_TO_CONSUMER_EVENT replaces CONTENT_EVENT_TYPES as the one place a watchdog type is admitted, and maps attrib to modified.
    • The handler carries the mapped type in a local. Source/filtered bookkeeping, dedup and the consumer all see modified.
    • On Linux, attrib is IN_ATTRIB (chmod, touch). watchdog 6, the version uv.lock pins, already reports that as modified (inotify.py: elif event.is_attrib or event.is_modify). So on watchdog 7 this restores the watchdog 6 behaviour rather than adding new work.
  2. Stop subscribing to last-access changes on Windows. ignore_windows_last_access() clears FILE_NOTIFY_CHANGE_LAST_ACCESS from watchdog.observers.winapi.WATCHDOG_FILE_NOTIFY_FLAGS. It is called in _create_watchdog_observer() before the Observer is built.
    • watchdog has no per-watch flag. Both 6.0 and 7.1 read that module global on every ReadDirectoryChangesW call, so clearing it before the observer starts covers every watch.
    • It is a no-op off Windows, or if watchdog lacks either name.
    • Writes still arrive through LAST_WRITE, SIZE and ATTRIBUTES.

Measured

Setup: Windows 11, NTFS with last-access updates on, a real chunkhound mcp --no-daemon (watchdog backend, regex only) on a 1,436-file TypeScript repository.

  • Every file's atime was aged 3 h before each run, so the start-up scan's reads update it.
  • After query_ready and a 90 s quiet window, each run appended a token to one file five times, 3 s apart (outside the 2 s dedup window), and regex-searched for each token.
watchdog read events at start-up live_indexing_state when quiet writes found by search
7.1.0 before 514 busy (157 queued) 1 of 5
7.1.0 after 0 idle 5 of 5, 2.3–3.4 s after the write
6.0.0 after 0 idle 5 of 5, 1.1–2.2 s

Tests

tests/realtime/test_realtime_windows_attrib.py adds two tests. Both fail without this commit and pass with it, on watchdog 7.1.0 and on 6.0.0.

  1. test_attrib_event_is_queued_as_a_change: an attrib event on an indexable file is queued as ("modified", path). Without the commit it is queued as ("attrib", path), which the consumer ignores.
  2. test_windows_read_raises_no_event_and_write_is_a_change (Windows only): this uses a real watchdog observer from _create_watchdog_observer().
    • Setup: the file's atime is aged before the watch exists. A sentinel write is awaited first, to prove the watch is armed.
    • Assertions: a read then queues nothing, and an append arrives as modified.
    • Without the commit, the read queues attrib (7.1) or modified (6.0).
    • The test skips itself if the read did not move st_atime, i.e. last-access updates are off.
    • It restores the watchdog global with monkeypatch.

Realtime suites, run on Windows with Python 3.13 against both watchdog versions: tests/realtime, tests/test_realtime_backend_config.py, tests/test_realtime_failures.py, tests/test_realtime_functional.py, tests/test_mcp_watchman_fallback.py, tests/unit/test_daemon_realtime_lifecycle.py, tests/unit/test_realtime_compaction_retry.py, tests/unit/test_realtime_embed_starvation.py, tests/unit/test_watchdog_import_isolation.py, tests/test_mcp_startup_barrier.py, tests/test_mcp_read_only.py.

  • After: 182 passed, 34 skipped on each version.
  • Before: the 2 new tests fail.
  • One before-run on 7.1 also failed test_file_debouncing_cleans_up_state. It passed in 3 of 3 reruns on the same base.

Related: #104 ("Failed to queue event" on a large Windows project): its traceback shows a burst of FileModifiedEvents from WindowsApiObserver, which fits problem 2 here (reads raise events on watchdog 6).

🤖 Generated with Claude Code, reviewed by FStrasz

fstrasz and others added 2 commits November 10, 2026 17:38
On Linux, watchdog's inotify emitter was scheduled with no event_filter, so
it watched IN_OPEN / IN_CLOSE_NOWRITE / IN_CLOSE_WRITE and every plain read
of an indexable file produced `opened` + `closed_no_write`. The handler
admitted any event type on an indexable path, so each read took one of the
1,000 event-queue slots before the consumer, which acts only on created /
modified / deleted / dir_*, dropped it. ChunkHound's own start-up scan reads
every file, so it could overflow the queue and request an
event_queue_overflow resync; a type-check or test run over the tree does the
same.

Fix, at the source:
- events.py: CONTENT_EVENT_TYPES is the single list of event types that can
  mean a content change; on_any_event drops every other type first, with no
  callback. watchdog_event_filter() derives the watchdog classes from it.
- startup.py (_bootstrap_fs_monitor) and pipeline.py (_add_directory_watch)
  pass that filter to observer.schedule. On inotify it narrows the kernel
  watch mask, so reads are never reported at all. Both call sites use the
  same filter because watchdog 7 shares one inotify fd per observer and each
  inotify_add_watch replaces the inode's mask.

`attrib` is kept. On Windows, watchdog 7.1 reports an in-place append as
`attrib` when the change time is ahead of the write time (3 of 3 appends in
a probe), so for some writes it is the only event. The consumer does not act
on `attrib` today; that, and Windows last-access updates arriving as
`attrib`, are left for a separate change. Windows behaviour is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s raise no event

On Windows, watchdog 7 classifies a FILE_ACTION_MODIFIED as `attrib` whenever
the record's LastChangeTime is ahead of its LastModificationTime. An in-place
append usually is: measured on NTFS, 26 of 30 appends arrived as `attrib` only
and 4 as `modified` only. The consumer acts on created/modified/deleted, so
most in-place writes were never indexed by the watcher.

watchdog also subscribes to FILE_NOTIFY_CHANGE_LAST_ACCESS, so with last-access
updates on, every read of a file not read for an hour raises an event (7:
`attrib`, 6: `modified`) that takes an event-queue slot; ChunkHound's own
start-up scan reads every file.

- events.py: WATCHDOG_TO_CONSUMER_EVENT replaces CONTENT_EVENT_TYPES as the one
  place a watchdog type is admitted, mapping attrib to modified. On Linux,
  watchdog 6 already reports IN_ATTRIB as modified, so this is that behaviour
  on watchdog 7 too.
- events.py: ignore_windows_last_access() clears the last-access bit from
  watchdog's module-global notify flags, which both 6.0 and 7.1 read on every
  ReadDirectoryChangesW call; called where the observer is created.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@fstrasz

fstrasz commented Nov 11, 2026

Copy link
Copy Markdown
Contributor Author

@HananKavitzAmat could you review this one, and #504 under it, when you have a moment? They affect users today, though CI can't show it:

  • pyproject.toml asks for watchdog>=4.0.0 with no upper bound, so a pip install or uv tool install of ChunkHound on Python 3.11+ resolves watchdog 7.1.0 (released 2026-11-05).
  • On Windows, watchdog 7 reports most in-place writes as attrib, which the realtime consumer ignores. In the probe above, 26 of 30 appends arrived as attrib only, and in the end-to-end run only 1 of 5 writes was found by search. Those files stay stale in the index until something else touches them.
  • CI doesn't see it, because uv.lock pins watchdog 6.0.0, which still reports these writes as modified.

Order: #504 first. This PR is #504's commit plus one; it replaces the event-type list #504 introduces, so it can't land before it. Once #504 is merged I'll bring this branch up to date with main. Then the last commit is the whole remaining diff.

🤖 Generated with Claude Code

@VakninAriel VakninAriel left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Code Review — PR #505

Verdict: 🚫 Request Changes

Summary

Watchdog 7 can report ordinary Windows in-place writes as attrib events, which the existing consumer ignores, while last-access notifications also consume queue capacity for reads. Stacked on #504, this PR maps attrib to modified and disables Windows last-access notifications before observer creation.

What's good

  • Attribute normalization happens before admission, bookkeeping and queueing, so the Windows write signal consistently reaches those stages as the consumer-supported modified type.
  • The Windows observer test first proves the watch is armed with a sentinel write, checks a read separately from an append, and restores the process-wide watchdog flag after the test.

Freshness warning: Package freshness checked 2026-11-11T15:38:58.574960+00:00: STALE: included heads/eligibility changed; see overview and freshness audit before posting. This report applies only to its pinned SHA.

Severity Count
🔴 Critical 0
🟠 High 0
🟡 Medium 1
🟢 Minor 0

Findings

🟡 [Preserve follow-up indexing when filtering consecutive write events] (#1 · Medium)

Location: chunkhound/services/realtime/events.py — lines 238–240

The complete main-based diff inherits #504's read-only filtering. On Linux, write a file, let indexing read that version, then write it again during the active pass and within the two-second dedup window. Removing intervening open/close events leaves modified followed by modified; _consume_events drops the second event before add_file can reserve an active-work follow-up. The accepted-event callback only refreshes pending work. Indexed content can therefore remain stale. Attribute normalization in the final #505 commit does not repair this inherited interaction.

Suggested fix:

Keep read-only events out of the queue, but allow repeated content changes to reach debounce/coalescing and active follow-up scheduling. Carry the #504 correction into this stack and test a second write after the first indexing read but before its completion.

Review metadata and audit

Draft review for human approval. Nothing has been posted to GitHub.

Pinned head SHA: 352bed9b1dd6d539e67bd89f2bdc2ca12aab9c7d

Package freshness checked 2026-11-11T15:38:58.574960+00:00: STALE: included heads/eligibility changed; see overview and freshness audit before posting. This report applies only to its pinned SHA.

PR: #505

Title: fix(realtime): index Windows in-place writes reported as attrib; reads raise no event

Author: fstrasz · Branches: fix/windows-attrib-upstream → main

Diff merge base: 98be86f

Review scope: Entire pinned PR diff against main merge base 98be86f through 352bed9; relevant callers, lifecycle and tests inspected. Consolidation of independent Sonnet and Astra reviews, not an additional independent model review.

Eligibility: Bug fix addressing existing behavior; no new feature.

Overall assessment (audit only)

The Windows-specific changes introduce no separately substantiated defect, but the full main-based diff retains #504's Medium dropped-follow-up-write regression. The pinned #505 handler/consumer reproduced it on Linux; request changes for the inherited filtering interaction, not for attribute normalization.

Strength evidence

  • {"strength_index": 0, "path": "chunkhound/services/realtime/events.py", "source": "pr-505.pinned.diff", "detail": "WATCHDOG_TO_CONSUMER_EVENT maps attrib to modified; on_any_event uses the mapped local event_type for source/filtered callbacks, admission and _queue_event. This does not establish follow-up scheduling correctness."}
  • {"strength_index": 1, "path": "tests/realtime/test_realtime_windows_attrib.py", "source": "pr-505.pinned.diff", "detail": "test_windows_read_raises_no_event_and_write_is_a_change awaits a sentinel, skips when atime does not change, checks read/write queues and uses monkeypatch to restore WATCHDOG_FILE_NOTIFY_FLAGS; no local Windows pass is asserted."}

Finding #1 evidence

  • Final cross-PR audit executed the actual pinned #505 handler and consumer with Linux watchdog 6.0.0: merge-base handler delivered value = 2; head delivered only value = 1 and suppressed three modified events. Exit 0. Probe: /tmp/chunkhound-final-audit-qfk_juar/probe-505.py.
  • pipeline.py is byte-identical between #504 and #505. Its same-type dedup at 1061-1081 precedes add_file's active-follow-up reservation at 957-964. This is inherited in the full merge-base diff, not newly introduced by the Windows-only final commit.

Reviewer keys: astra

Verification

  • Final audit: pinned #505 Linux handler/consumer probe exited 0 and reproduced dropped second-write admission; simplified in-flight sink, not native end-to-end indexing. See final-audit.json for commands and output.
  • Reconciler verified both completed statuses, provenance validity, exact pinned metadata/worktree HEAD, full-index diff bytes, report SHA-256 hashes and distinct actual assistant-message provider/model/responseModel identities.
  • Both reviewers ran uv run --no-sync mypy chunkhound: 993 errors in 89 files. Astra shadowed all three changed production files with merge-base versions and obtained the same normalized diagnostics.
  • Sonnet targeted pytest: two collection errors, zero tests run. Astra targeted pytest including watchdog import isolation: three collection errors, zero tests collected successfully.
  • Astra supplementary AST-extracted production-logic checks passed for attribute normalization, read rejection, Windows mask guards/idempotence (fake external Windows module), and a real Linux watchdog 6 observer read/append check.
  • Reconciler traced events.py normalization into pipeline.py:1092-1095 add_file processing and confirmed both startup and dynamic directory scheduling use the same event filter.

Limitations

  • The native extension is missing from the shared environment, preventing application-test collection; no environment repair was attempted.
  • Linux and watchdog 6.0.0 only: actual Windows notifications and watchdog 7 behavior were not executed locally. Isolated checks do not replace application or Windows tests.
  • CI was green at the pinned inventory snapshot; no fresh remote CI run was performed by the reconciler.
  • CI is a captured snapshot, not a fresh run or a guarantee of current branch status.
  • Model identities are verified declarations supplied by the reconciler; the renderer does not inspect raw reports or provenance events.

Disposition of discarded / merged findings

  • Final audit supersedes the previous no-bug conclusion for the full diff: the pinned #505 runtime probe reproduces #504's filtering/dedup interaction. The incremental Windows change remains without a separate finding. Attribute this shared issue to #504 and avoid posting duplicate comments when reviewing the stack jointly.
  • Sonnet process-wide watchdog flag observation is documented behavior; no second in-process watchdog consumer or concrete regression was demonstrated. Not promoted to a finding.
  • Sonnet timing/flakiness concern is not backed by a failing run; retained only as Windows verification risk, not a defect.
  • Sonnet startup observer protocol concern is preexisting: Astra baseline comparison found identical normalized diagnostics. No runtime bug established.

Independent reviewer provenance

  • sonnet — provider: amat-tfy; requested model: standard-chat-dev/claude-sonnet-5.5; verified response model: aws-aidev-models/us.anthropic.claude-sonnet-5-5. Identity evidence · Raw report
  • astra — provider: amat-tfy; requested model: frontier-chat-dev/gpt-6-astra; verified response model: gpt-6-astra. Identity evidence · Raw report

CI snapshot

Captured: 2026-11-11T14:18:23.581921+00:00. Eligibility green: True. Counts: {"SKIPPED": 2, "SUCCESS": 23}

Reviewed by Ariel Vaknin via pi.dev

@VakninAriel VakninAriel left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Code Review — PR #505

Verdict: 🚫 Request Changes

Summary

Watchdog 7 can report ordinary Windows in-place writes as attrib events, which the existing consumer ignores, while last-access notifications also consume queue capacity for reads. Stacked on #504, this PR maps attrib to modified and disables Windows last-access notifications before observer creation.

What's good

  • Attribute normalization happens before admission, bookkeeping and queueing, so the Windows write signal consistently reaches those stages as the consumer-supported modified type.
  • The Windows observer test first proves the watch is armed with a sentinel write, checks a read separately from an append, and restores the process-wide watchdog flag after the test.

Freshness warning: Package freshness checked 2026-11-11T15:38:58.574960+00:00: STALE: included heads/eligibility changed; see overview and freshness audit before posting. This report applies only to its pinned SHA.

Severity Count
🔴 Critical 0
🟠 High 0
🟡 Medium 1
🟢 Minor 0

Findings

🟡 [Preserve follow-up indexing when filtering consecutive write events] (#1 · Medium)

Location: chunkhound/services/realtime/events.py — lines 238–240

The complete main-based diff inherits #504's read-only filtering. On Linux, write a file, let indexing read that version, then write it again during the active pass and within the two-second dedup window. Removing intervening open/close events leaves modified followed by modified; _consume_events drops the second event before add_file can reserve an active-work follow-up. The accepted-event callback only refreshes pending work. Indexed content can therefore remain stale. Attribute normalization in the final #505 commit does not repair this inherited interaction.

Suggested fix:

Keep read-only events out of the queue, but allow repeated content changes to reach debounce/coalescing and active follow-up scheduling. Carry the #504 correction into this stack and test a second write after the first indexing read but before its completion.

Review metadata and audit

Draft review for human approval. Nothing has been posted to GitHub.

Pinned head SHA: 352bed9b1dd6d539e67bd89f2bdc2ca12aab9c7d

Package freshness checked 2026-11-11T15:38:58.574960+00:00: STALE: included heads/eligibility changed; see overview and freshness audit before posting. This report applies only to its pinned SHA.

PR: #505

Title: fix(realtime): index Windows in-place writes reported as attrib; reads raise no event

Author: fstrasz · Branches: fix/windows-attrib-upstream → main

Diff merge base: 98be86f

Review scope: Entire pinned PR diff against main merge base 98be86f through 352bed9; relevant callers, lifecycle and tests inspected. Consolidation of independent Sonnet and Astra reviews, not an additional independent model review.

Eligibility: Bug fix addressing existing behavior; no new feature.

Overall assessment (audit only)

The Windows-specific changes introduce no separately substantiated defect, but the full main-based diff retains #504's Medium dropped-follow-up-write regression. The pinned #505 handler/consumer reproduced it on Linux; request changes for the inherited filtering interaction, not for attribute normalization.

Strength evidence

  • {"strength_index": 0, "path": "chunkhound/services/realtime/events.py", "source": "pr-505.pinned.diff", "detail": "WATCHDOG_TO_CONSUMER_EVENT maps attrib to modified; on_any_event uses the mapped local event_type for source/filtered callbacks, admission and _queue_event. This does not establish follow-up scheduling correctness."}
  • {"strength_index": 1, "path": "tests/realtime/test_realtime_windows_attrib.py", "source": "pr-505.pinned.diff", "detail": "test_windows_read_raises_no_event_and_write_is_a_change awaits a sentinel, skips when atime does not change, checks read/write queues and uses monkeypatch to restore WATCHDOG_FILE_NOTIFY_FLAGS; no local Windows pass is asserted."}

Finding #1 evidence

  • Final cross-PR audit executed the actual pinned #505 handler and consumer with Linux watchdog 6.0.0: merge-base handler delivered value = 2; head delivered only value = 1 and suppressed three modified events. Exit 0. Probe: /tmp/chunkhound-final-audit-qfk_juar/probe-505.py.
  • pipeline.py is byte-identical between #504 and #505. Its same-type dedup at 1061-1081 precedes add_file's active-follow-up reservation at 957-964. This is inherited in the full merge-base diff, not newly introduced by the Windows-only final commit.

Reviewer keys: astra

Verification

  • Final audit: pinned #505 Linux handler/consumer probe exited 0 and reproduced dropped second-write admission; simplified in-flight sink, not native end-to-end indexing. See final-audit.json for commands and output.
  • Reconciler verified both completed statuses, provenance validity, exact pinned metadata/worktree HEAD, full-index diff bytes, report SHA-256 hashes and distinct actual assistant-message provider/model/responseModel identities.
  • Both reviewers ran uv run --no-sync mypy chunkhound: 993 errors in 89 files. Astra shadowed all three changed production files with merge-base versions and obtained the same normalized diagnostics.
  • Sonnet targeted pytest: two collection errors, zero tests run. Astra targeted pytest including watchdog import isolation: three collection errors, zero tests collected successfully.
  • Astra supplementary AST-extracted production-logic checks passed for attribute normalization, read rejection, Windows mask guards/idempotence (fake external Windows module), and a real Linux watchdog 6 observer read/append check.
  • Reconciler traced events.py normalization into pipeline.py:1092-1095 add_file processing and confirmed both startup and dynamic directory scheduling use the same event filter.

Limitations

  • The native extension is missing from the shared environment, preventing application-test collection; no environment repair was attempted.
  • Linux and watchdog 6.0.0 only: actual Windows notifications and watchdog 7 behavior were not executed locally. Isolated checks do not replace application or Windows tests.
  • CI was green at the pinned inventory snapshot; no fresh remote CI run was performed by the reconciler.
  • CI is a captured snapshot, not a fresh run or a guarantee of current branch status.
  • Model identities are verified declarations supplied by the reconciler; the renderer does not inspect raw reports or provenance events.

Disposition of discarded / merged findings

  • Final audit supersedes the previous no-bug conclusion for the full diff: the pinned #505 runtime probe reproduces #504's filtering/dedup interaction. The incremental Windows change remains without a separate finding. Attribute this shared issue to #504 and avoid posting duplicate comments when reviewing the stack jointly.
  • Sonnet process-wide watchdog flag observation is documented behavior; no second in-process watchdog consumer or concrete regression was demonstrated. Not promoted to a finding.
  • Sonnet timing/flakiness concern is not backed by a failing run; retained only as Windows verification risk, not a defect.
  • Sonnet startup observer protocol concern is preexisting: Astra baseline comparison found identical normalized diagnostics. No runtime bug established.

Independent reviewer provenance

  • sonnet — provider: amat-tfy; requested model: standard-chat-dev/claude-sonnet-5.5; verified response model: aws-aidev-models/us.anthropic.claude-sonnet-5-5. Identity evidence · Raw report
  • astra — provider: amat-tfy; requested model: frontier-chat-dev/gpt-6-astra; verified response model: gpt-6-astra. Identity evidence · Raw report

CI snapshot

Captured: 2026-11-11T14:18:23.581921+00:00. Eligibility green: True. Counts: {"SKIPPED": 2, "SUCCESS": 23}

Reviewed by Ariel Vaknin via pi.dev

fstrasz and others added 6 commits November 12, 2026 06:56
Brings in chunkhound#507 (never drop a duplicate event while the path's change is
being processed), which the review's stale-index finding needs, and chunkhound#489.
One conflict, in the startup.py import from .events: both names kept
(forward_to_loop from main, watchdog_event_filter from this branch).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…filtered

With read-only events dropped, two writes reach the consumer as
modified, modified, with no open or close between them. The test drives
the real handler with the Linux sequence (write, the indexing run's read,
a second write inside the duplicate-event window) through the real
consumer and process loop, and checks the second write is processed.
It fails without the consumer's rule that a path being processed never
has a duplicate dropped (chunkhound#507).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… debounce

With read-only events dropped, every save after the first reaches the
consumer as a duplicate `modified` and is suppressed before add_file,
which is what pushed the pending debounce back. On Linux a burst of saves
was then indexed part-way through and again afterwards (10 saves 0.3 s
apart: 5 passes instead of 1, each queueing an embed pass). The
suppression branch now refreshes the debounce horizon for a write
whose change is waiting in debounce.

Tests: a burst of saves closer than the debounce delay is indexed once,
with the final content; the write-after-read test now uses fake services,
a long duplicate window so it always exercises the rule, and gathers its
tasks on the way out. The events.py comment no longer says dropping
`closed` changes nothing indexed: that holds only with the consumer's
two rules.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…windows-attrib-upstream

Brings in chunkhound#504's review changes: main (with chunkhound#507's active-path rule),
the consumer's debounce refresh for a suppressed duplicate write, and
their tests. Two conflicts:
- events.py: this branch's WATCHDOG_TO_CONSUMER_EVENT and
  ignore_windows_last_access() are kept; the opening comment takes chunkhound#504's
  corrected wording (dropping `closed` is safe only with the consumer's
  two rules).
- startup.py: the import from .events names all four symbols.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review follow-up to the debounce refresh. The duplicate check is back to
main's exact condition, so a repeated delete or directory event no
longer resolves its path; only a suppressed write looks up its debounce
key. The refresh applies on every backend that goes through the
consumer (watchdog on any OS, Watchman): a burst of saves is indexed
once, and a file written without pause is indexed once it goes quiet,
which is what the debounce documents.

The burst test now waits for the indexing pass instead of a fixed
sleep, so a stalled runner cannot end it before the pass runs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…windows-attrib-upstream

Brings in chunkhound#504's review follow-up (the debounce key is resolved only for a
suppressed write; the burst test waits for the indexing pass). No conflicts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@fstrasz

fstrasz commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

@VakninAriel thanks. As you noted, the finding comes from #504's filter, not from the attrib change, so it's fixed on #504 and merged in here (8c0f961, then ad7e239 for #504's last follow-up). #504's reply has the detail: #507's rule on main keeps a write made while the file is being processed, and a dropped duplicate save now still pushes the pending debounce back. Both come with tests.

On this branch:

🤖 Generated with Claude Code, reviewed by FStrasz

@HananKavitzAmat

Copy link
Copy Markdown
Collaborator

Looks good to me!

@HananKavitzAmat
HananKavitzAmat self-requested a review November 16, 2026 14:52
fstrasz and others added 2 commits November 16, 2026 10:52
Brings in chunkhound#504's squash (11d1753) and chunkhound#510. This branch already carries chunkhound#504's final head (4e10023), and the squash is byte-identical to that head merged onto 84ab53d, so the conflicts in realtime/events.py and realtime/startup.py resolve to this branch merged with 84ab53d, which merges cleanly. No other conflicts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Brings in chunkhound#534. No conflicts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@fstrasz

fstrasz commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

@VakninAriel, following up on your review. The finding came from #504's read-only filter, and its fix landed with #504 (11d1753, details). This branch includes it. The test you suggested is test_write_after_an_indexing_read_is_indexed: a second write lands while the first is being processed, after that run read the file and inside the duplicate-event window. It passed today on ubuntu, macOS and Windows at 6cb4d0c. Does that resolve the finding?

🤖 Generated with Claude Code, reviewed by FStrasz

fstrasz and others added 2 commits November 18, 2026 02:23
…er factory

Main's _create_watchdog_observer (chunkhound#509) now takes the inotify overflow callback and returns (observer, detection). The test's assertions are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@fstrasz

fstrasz commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

Merged main into this branch after #509 landed. chunkhound/services/realtime/startup.py conflicted with #509's watchdog observer factory. The resolution keeps both changes: the fallback path still clears the Windows last-access flag before it creates the observer, and it now returns the observer with its overflow detection state.

A follow-up commit updates tests/realtime/test_realtime_windows_attrib.py for the factory's new signature. It now takes the overflow callback and returns (observer, detection). The test's assertions are unchanged.

On this head, CI's windows job ran test_attrib_event_is_queued_as_a_change, which passed. test_windows_read_raises_no_event_and_write_is_a_change was skipped there; it skips itself when the volume does not record last-access times. It passed on a local Windows machine where last-access updates are on.

🤖 Generated with Claude Code, reviewed by FStrasz

@HananKavitzAmat

Copy link
Copy Markdown
Collaborator

looks good!

@HananKavitzAmat
HananKavitzAmat dismissed VakninAriel’s stale review November 18, 2026 11:23

The issues in this review are reviewed

@HananKavitzAmat
HananKavitzAmat added this pull request to the merge queue Nov 18, 2026
Merged via the queue into chunkhound:main with commit 40ee8e9 Nov 18, 2026
27 checks passed
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.

3 participants