Skip to content

feat(vnext): add catalog search cache policy#196

Merged
Light2Dark merged 1 commit into
dev-refactorfrom
codex/vnext-catalog-cache-policy
Jul 25, 2026
Merged

feat(vnext): add catalog search cache policy#196
Light2Dark merged 1 commit into
dev-refactorfrom
codex/vnext-catalog-cache-policy

Conversation

@Light2Dark

@Light2Dark Light2Dark commented Jul 25, 2026

Copy link
Copy Markdown
Member

Summary

  • add a bounded exact-key ready-page cache with epoch-scoped invalidation
  • add fail-closed loading barriers and retry gates for subscribed and unsubscribed providers
  • add atomic refresh-observer transfer with reentrancy-safe availability dispatch
  • document marimo connection-incarnation and unresolved-metadata semantics
  • codify the accelerated candidate-boundary delivery cadence

Why

Catalog completion needs to reuse proven results without allowing stale pages, same-epoch loading transitions, remounted editors, or cache pressure to bypass epoch authority. This keeps the package-private scheduler, policy state, and observer lifecycle coherent before session composition and the public adapter are added.

Verification

  • 1,895 tests passed; 1 expected failure
  • changed coverage: 98.02% statements, 95.86% branches, 99.47% functions, 98.49% lines
  • full typecheck, oxlint, test-integrity, browser, demo, and package smoke passed
  • two independent exact-head adversarial reviews approved
  • catalog scheduler benchmark passed

Summary by cubic

Adds a bounded, epoch-aware cache for catalog search to reuse “ready” pages without serving stale data, and introduces refresh leases to prevent duplicate provider work.

  • New Features

    • Added SqlCatalogSearchPolicyStore: exact-key cache for ready pages with epoch-scoped invalidation.
      • Bounded by MAX_CATALOG_POLICY_STORE_ENTRIES (256) and MAX_CATALOG_POLICY_STORE_RETAINED_BYTES (2 MiB).
    • Integrated the policy store into relation-catalog-search-work with fail-closed loading/retry gates.
    • Added refresh leasing (retainForRefresh) and single-shot availability dispatch with reentrancy safety.
    • New default DEFAULT_CATALOG_REFRESH_LEASE_MS = 1000.
    • Exposed hasLiveSubscription(scope) on the epoch coordinator.
    • Updated ADR and implementation docs; added comprehensive unit and type tests.
  • Migration

    • If you provide a custom SqlCatalogEpochCoordinator, implement hasLiveSubscription(scope).
    • Availability targets must be synchronous and return undefined.
    • Optional: tune refreshLeaseMs via search-work options; no other changes required.

Written for commit 803afd1. Summary will update on new commits.

Review in cubic

@github-actions

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 98.49% (🎯 91%) 1373 / 1394
🔵 Statements 98.02% (🎯 91%) 1439 / 1468
🔵 Functions 99.47% (🎯 90%) 190 / 191
🔵 Branches 95.86% (🎯 85%) 880 / 918
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/vnext/relation-catalog-epoch-coordinator.ts 98.26% 97.26% 98.21% 98.86% 245, 341, 397-398, 430, 544, 1005, 1049
src/vnext/relation-catalog-search-policy-store.ts 99.52% 95.59% 100% 99.49% 674
src/vnext/relation-catalog-search-work.ts 97.48% 95.22% 100% 98.01% 568, 580-581, 908, 1068, 1089, 1148-1149, 1283, 1297, 1374, 1389, 1450-1459, 1640, 1725, 1973-1977, 2060-2065
Generated in workflow #750 for commit 803afd1 by the Vitest Coverage Report Action

@Light2Dark
Light2Dark marked this pull request as ready for review July 25, 2026 12:52
@Light2Dark
Light2Dark merged commit f0f4d5e into dev-refactor Jul 25, 2026
9 checks passed
@Light2Dark
Light2Dark deleted the codex/vnext-catalog-cache-policy branch July 25, 2026 12:54
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