Skip to content

cache: scoped loads re-parse out-of-range files every run because their entries aren't visible to reconcileFile #1034

Closed as not planned

Description

@iamtoruk

Follow-up to #1032 (the republish half is fixed by the merge-shard no-op check).

Under #1007's month-scoped loadCache, files whose bucket is out of range have no entry in section.files, so reconcileFile sees them as uncached and the parser re-parses them on every ranged run (status --format json etc.), producing an identical entry. Observed on a real corpus: Claude files in an out-of-scope month, plus SQLite-backed sources (cursor state.vscdb, warp.sqlite) whose mtime moves constantly. It's now a wasted parse + one shard read, no longer a write.

Fix direction: have the scoped load expose the fingerprints (dev/ino/mtime/size/offset) of entries in skipped shards — cheap, e.g. a fingerprint index in the envelope or a per-shard sidecar — so reconcileFile can classify them unchanged without loading turn bodies. That's an envelope format change (lossless), so it belongs in its own PR with the usual migration/two-writer tests.

Activity

  1. iamtoruk commented on Aug 22, 2026

    @iamtoruk
    MemberAuthor

    Closing with #1057: the described re-parse waste is real and was measured live (main re-parses the same 1,080 unchanged out-of-range files on every warm scoped run, never converging) — but eliminating 89% of it (#1057, mechanism verified working) moved neither wall-clock nor CPU time on either of two real corpora, because the scope-independent stat()/fingerprint discovery sweep over the full tree (~6.4s over 21k files) dominates every dated command. The bottleneck is the sweep, not the re-parses. A successor issue targeting the discovery sweep would be the fix that actually shows up on a stopwatch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions