Skip to content

Typed requests cannot be offered from projected data rows #973

Closed

Description

@max-sixty

What happens

A widget bound to a data contract renders one datum per record with projectData. I wanted each row to offer a one-shot typed request to the host, a restart verb bound to that record's id, the way an authored x-request holder does with defineRequestElement.

There is no way to declare it. x-request binds detail fields to authored string attributes on the holder, and the server derives the request seats of a revision from that revision's authored elements (request_lifecycles_for walks the revision's lf_elements for tags declaring x-request). A projected datum is not an authored element: it has no id in the revision and exists only in the browser after a snapshot arrives. A control rendered inside one therefore has no seat, and a request sent from it is refused as an unknown request widget in that revision.

What I expected

A per-row typed request on data-bound rows, with the same guarantees rows already get for comments. Comments anchor to a projected datum by (source, revision, datum key) and survive snapshot replacement; a request seat keyed the same way, with bind entries validated against the contract's record schema instead of holder attributes, would let a data-bound widget offer verbs per record without authoring a holder per row.

Smallest repro

A page with a page-local registry declaring a data contract whose records are { "id": string, "state": string }, and an element lf-rows with x-data bound to it. Its module renders each record with projectData and wants, inside each row, a child control carrying verb="restart" for that record. There is no registry entry that makes that child an offer: x-request on lf-rows binds to lf-rows's own authored attributes, so one holder carries one target, not one per record; and a holder declared per row cannot exist, since rows are not in the revision. Reading the server side, a request event whose widget id is not in the revision or in thread markup fails declared_request_error as an unknown request widget, so sending one from a row control by hand is not a route either.

The workaround in use: the reader comments on the row and the host session reads the words, which loses the typed detail and the lifecycle (ready, pending, completed) that x-request gives authored holders.

Seen on leaf e84a03a.

This was written by Claude Code on behalf of max-sixty

Activity

  1. added
    enhancement
    on Sep 23, 2026
  2. leaf-agent commented on Sep 23, 2026

    @leaf-agent
    Collaborator

    There's no route today, and the reading of the server side is right — but the missing piece is narrower than a second datum-keyed anchor concept. Leaf already folds per-record reader gestures on data-bound widgets; requests are the one durable channel that was built without the coordinate that does it.

    Actions and reports get a fold coordinate of owner widget, fold unit, and facet at admission (event_meaning.py:46), and unit is either "widget" or the name of a detail field — it is not required to hold an authored element id. lf-diff already uses that: its review verb declares "unit": "file" (packages/diff/registry.json:105), and the file it folds on is a datum key out of the unified-diff snapshot, not an element in the revision. So lf-rows can already carry a per-record action. What it cannot carry is a per-record request, because a request's admitted meaning is {"document": document} and nothing else (event_meaning.py:68) and its seat is keyed on (document, widget) (requests.py:36).

    That matters beyond the refusal in the repro. Suppose the unknown-widget check were satisfied by sending from lf-rows itself: the seat rules would still be wrong per row. request_lifecycle_error (requests.py:158) refuses a second attempt at the widget, so one row's pending restart would block every other row, and one completed restart would close the holder for all of them permanently. The seat is the holder because nothing in the request channel can say what it is per. Adding the unit dimension answers both the refusal and the lifecycle at once; a per-row holder or a seat keyed like a comment anchor answers only the first and leaves a second seat concept beside the one actions use.

    The two rules that hard-code "one holder, one target" are in declared_request_error: offers requires an authored direct child of the holder whose enum attribute names the verb (requests.py:130), and bind compares each bound detail field to an authored attribute on the holder (requests.py:143), with the registry gate insisting that attribute be a required authored string on the tag (registry/widgets.py:141). Validating bind against the contract's record schema, as the issue proposes, is the right replacement for the second — the first needs the verb offered once on the holder rather than once per row.

    Two things worth deciding before anyone writes it:

    • How hard the door checks the unit value. The action channel takes file as a free string; nothing proves the record was ever displayed. Comments went the other way — datum_anchor_error refuses a datum anchor whose source revision that seat never showed. A request has an external, non-undoable effect that may precede its receipt, which argues for the comment standard, but that means the request door starts reading data.json, which no part of it reads today.
    • What ask: true does per row. A ready request is a reader Ask; a unit-bearing request verb on a 200-row snapshot puts 200 entries on the reader's list. That's a product question about what the Asks projection should hold, not a validation detail.

    The comment workaround you're on is the honest one until then. For a record set that's known at authoring time, authoring one holder per record does work — it's only the projected case that has no seat.

  3. added a commit that references this issue on Sep 23, 2026
    878780e
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

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions