• feat(provider): person-prime scan verb + sortable_chunk_fields cap (WT #349)

    vh released this 2026-07-15 08:13:08 -07:00 | 127 commits to main since this release

    Implement the memory-store scan verb — a query-LESS, LIVE-only, globally
    ordered top-N-by-recency read — and advertise sortable_chunk_fields= [{updated_at}] at the Bifrost handshake. Advertising the cap is what lights
    up Worldtree's #349 person-prime turn-1 durable-fact injection (Branch-A
    "updated_at" in caps.sort_fields_supported); the fix is ZERO Worldtree
    change — the running provider announcing the cap is the trigger.

    scan is:

    • LIVE-only server-side (INV-009): superseded/tombstoned excluded — a dead
      fact can never inject; person-prime's lifecycle_state=live does not ride
      the scan wire, so server-side is authoritative.
    • Globally ordered before pagination (INV-010): the full scope-filtered live
      set is ordered by (sort.field, direction) globally; missing value LAST,
      chunk_id tiebreak. Backed by an expression index on
      json_extract(record_json,'$.updated_at') to stay in the 500ms budget.
    • Cursor = offset into the global order; emits a next cursor only when a
      further match exists (no empty trailing page — matches the reference).

    Sort is dispatch-gated: an unadvertised sort.field raises InvalidArguments,
    never a silent unsorted fallback.

    Contract amended: un-defers scan, adds the FN spec + INV-009/INV-010 +
    sortable_chunk_fields to INV-006. TDD 7/7 green (scan_recency tracer,
    live_only, scope_isolation, unadvertised_sort, person_prime_record_shape,
    cursor pagination, parity_vs_reference vs InMemoryMemoryStore #195). Full
    suite 638 green.

    Downloads