Skip to content

[Gap]: Evaluate store-extension primitives for durable keyed state and idempotent mutations #426

Closed

Description

@jimhoyd

What I was trying to do

Benchmark run test1 (Claude Sonnet 5 medium, one fresh URLCode run per task, core revision cb48354ed414bef7a4dcf810ecd1a19057745a82) repeatedly needed mutable application state:

  • url-shortener: create a caller-selected short code, validate a destination, redirect through the stored link, and atomically count clicks. The agent implemented four functions around an in-process Map; it passed 8/8 acceptance checks.
  • form-lab: allocate and persist a submission, retrieve its confirmation/edit views, and update it. The agent placed the persistence/update flow in a function; it passed 4/9 checks, the same score as its Fastify control.
  • webhook-api: deduplicate an event and record delivery state. The URLCode arm verified its local attempt but could not be scored after a provider-side 529 outage, so it is supporting, not comparative, evidence.

Where it broke down

The shortener implementation’s Map is process-local: it is lost on restart and is not shared across instances. That workaround conflicts with the project direction that operators own durable application data. The existing store extension appropriately owns bounded CRUD and operator-selected storage, but the benchmark evidence suggests a possible seam for explicitly reviewed state transitions that CRUD alone does not express: claim a caller-chosen key if absent, atomically increment a declared numeric field, and atomically claim an idempotency key.

This is deliberately not a request to restore a special-purpose URL-shortener handler in core; the project direction says stored short links are not a core feature. The question is whether a small store-extension capability can safely and portably cover the shared state patterns.

Candidate direction

Evaluate an extension-owned, bounded mutation contract or recipe rather than a general transaction/query language. Candidate operations should be declarative, schema-bound, and storage-backend-owned:

  • insert/claim a record by a declared unique application key;
  • increment an explicitly declared numeric counter;
  • claim an idempotency key with bounded retention and a deterministic duplicate result.

The design must state concurrency and durability semantics, failure behavior, record/retention bounds, single-process versus multi-instance support, authorization/ownership composition (#331, #336), and which targets refuse activation. It must not let project YAML select a database/provider or weaken operator review and pinned extension grants.

Acceptance evidence

  • A store-backed short-link fixture passes create/invalid-destination/redirect/404/click-count tests without application state functions.
  • A webhook-style fixture proves exactly one state transition and one delivery-attempt decision for a duplicate event under concurrent requests, with documented delivery/retry limits.
  • Restart and multi-instance behavior is either demonstrated for a supported backend or explicitly refused/documented.
  • Rerun the same benchmark tasks and report custom-plumbing LOC and correction cycles, not only acceptance.

What I did not verify

I did not verify that these operations are the smallest adequate store surface, that the current store implementation can offer them across all its supported deployments, or that the webhook task’s unscored URLCode arm would pass the frozen harness. One run per task is evidence of repeated agent plumbing, not proof of demand or a final API.

Activity

  1. added
    ai-first
    extension
    important
    on Sep 22, 2026
  2. jimhoyd commented on Sep 22, 2026

    @jimhoyd
    CollaboratorAuthor

    Implemented and merged in #429.

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

    ai-firstextensionimportant

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions