Skip to content

port/audit upstream PR 2284: fix(analytics): preserve distance invalidation during an active build #622

Closed

Description

@dborup

Port or audit of upstream Kpa-clawbot/CoreScope PR 2284 ("fix(analytics): preserve distance invalidation during an active build"). Read the upstream PR and its linked issue for details (read only; never comment there).

What upstream fixed

Upstream: background-fill completion could reset an active sync.Once, causing a fatal mutex unlock or letting an older distance build mark an incomplete index ready. Fix: build admission under the existing mutex plus a generation check.

What to do here

  1. Audit first. Find out whether our fork has the same defect. Our code has diverged in several places; do not cherry-pick blindly.
  2. If it applies: port the fix adapted to our code, with a red test before and green after, plus a mutant that the test kills. Include perf numbers where the change touches a hot path.
  3. If it does not apply: add tests that pin the correct behaviour (as in audit: store lock reads and region/area set resolution vs upstream PRs 2246 and 2247 #597/audit: store lock readers vs upstream 2246/2247 #602) and explain why the defect cannot occur here.

Where to look

We made distance indexing lazy (#558/#589) and chunked. Check whether our lazy build, background fill loader and invalidation can race the same way (stale completion consuming an invalidation, or a Once reset while active). Use -race and a deterministic interleaving test.

Constraints: no SQL under PacketStore.mu; cmd/server stays read-only; no new map[string]interface (Kpa-clawbot#1383); CSS variables only for UI changes.

Activity

  1. dborup commented on Oct 28, 2026

    @dborup
    OwnerAuthor

    Fixed by #636 (merged as 264f3fb82eadcb69061185cb1cb2ef3dec8171cb).

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions