Skip to content

ensureFresh: split strict/best-effort variants, bound Find's ErrNotFound fallback - #134

Merged
quad341 merged 3 commits into
mainfrom
deploy/crn-tk8qd-gate
Aug 21, 2026
Merged

quad341 merged 3 commits into
mainfrom
deploy/crn-tk8qd-gate

Conversation

@quad341

@quad341 quad341 commented Aug 21, 2026

Copy link
Copy Markdown
Owner

What this changes

cairn's internal index-freshness check (ensureFresh) is split into two
variants. Six read paths (Find, FindCorrection, Status, Search,
Recall, CullCandidates) now use a best-effort variant: if the bounded
self-heal reindex times out, they serve the (possibly lagging) index instead
of failing the call. The one path that gates a mutation (EntryByID, used by
cull-evict, promote-mark, and anchor-attach) is unchanged and still requires
a fully fresh index before proceeding.

Separately, Find's "not found" fallback — which force-reindexes to confirm
a real miss — was previously unbounded and could stall for the full
lock-contention window (~33s). It's now bounded by the same timeout the
self-heal path already uses, and reports "not found" (rather than a timeout
error) if that bound is hit — a real miss and an unconfirmable-within-budget
miss now look the same to callers.

Review notes

  • internal/cairn/evict.go's EntryByID intentionally still calls the
    strict variant — it's the sole pre-mutation gate for delete, tier
    promotion, and anchor-attach, and should not be relaxed.
  • The new bound on Find's not-found fallback reuses the existing
    self-heal timeout constant rather than introducing a new one.
  • No new logging, no dependency changes, no config surface added.

Test plan

  • go build ./... && go test ./... -race -count=1 — all 7 packages
    green, zero failures/skips.
  • 3 new tests cover: a best-effort caller serving a lagging index on
    reindex overrun, EntryByID still hitting the strict deadline
    (regression guard), and a genuinely-missing id returning "not found"
    within the bound instead of stalling.
  • Release gate: release-gates/crn-tk8qd-gate.md

🤖 Deployed by actual-factory

cairn-reviewer-scratch added 3 commits August 20, 2026 17:18
@quad341
quad341 merged commit afc97ff into main Aug 21, 2026
2 checks passed
@quad341
quad341 deleted the deploy/crn-tk8qd-gate branch August 21, 2026 12:06
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.

1 participant