Skip to content

impl(atlas): D1 hot-cache admission policy — heat, heavy-query, tenant quotas, eviction #13103

Open

Description

@dezren39

Implementation follow-on 3 of 6 under #9134 (Atlas D1 tenant hot cache design, doc/2026-11-23T08-06-00Z_design_atlas_d1_tenant_hot_cache/2026-11-23T08-06-00Z_design_atlas_d1_tenant_hot_cache.md, merged via PR #13098).

Scope (§3, §5, §8 item 3 of the design): admission policy — heat counters (eligible after 2 requests / 10 min), heavy-query immediate admission (source latency > 250 ms or rows-read > 10,000; both estimates, config), per-tenant quota with tier weights 1:4:16 and a 5% per-tenant floor, 256 KB entry size cap, 30 s negative-result TTL, and the LRU eviction sweep (per-tenant under pressure, B/C before A, unused quota borrowable).

Acceptance: policy unit tests for each rule incl. quota-pressure eviction order; all thresholds read from config, none hardcoded.

Activity

  1. developing-today commented on Nov 23, 2026

    @developing-today
    Contributor
  2. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    xaltha lane picking this up: implementing the D1 hot-cache admission policy slice (§3/§5/§8 item 3) — heat counters, heavy-query admission, per-tenant quotas (tiers 1:4:16, 5% floor), 256 KB entry cap, 30 s negative TTL, LRU eviction sweep — as self-contained policy logic based on main, with unit tests per rule and all thresholds from config. Sibling slices #13100/#13101 are being built in parallel by other xaltha lanes; this slice defines its store surface against the #9134 design contracts, not their branches.

  3. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Landed as PR #13132 (branch xaltha/13103-atlas-admission, commit 8a9c431, base main): pure policy module pkgs/atlas-search/worker/src/admission.ts implementing §3/§5 — HeatTracker (2 requests / 10 min), heavy-query immediate admission (>250 ms or >10,000 rows, strict, config), 256 KB entry cap (absolute), negative results on the same gates with the 30 s TTL, quotaShares (5% floor reserved per tenant, remainder by tier weights 1:4:16, pure-weight fallback when floors exceed the budget), and planEvictions (binds only under pressure; B/C before A, LRU inside class, stops at share). All thresholds are named AdmissionConfig values. Evidence: 29 new tests / 64 assertions all passing (run under bun's test runner in the sandbox — the package has no node_modules here; worker.test.ts/mcp.test.ts need the cloudflare:test runtime and are CI's first full vitest run via the atlas-search-worker-tests workflow, where admission.test.ts is now registered); src/admission.ts typechecks clean under tsc --strict. The slice is self-contained against the design contracts and does not depend on the #13100/#13101 branches.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions