Skip to content

Support typed requests from projected data rows - #985

Merged
max-sixty merged 6 commits into
mainfrom
codex/issue-973
Sep 23, 2026
Merged

max-sixty merged 6 commits into
mainfrom
codex/issue-973

Conversation

@max-sixty

@max-sixty max-sixty commented Sep 23, 2026 •

Copy link
Copy Markdown
Owner

Closes #973. A data-bound widget can now declare typed request verbs for each record key. The server validates the key and bound detail against the current source revision, projects one lifecycle per record, and preserves historical seats after rows leave the data. The browser exposes those seats through widgetController.request(key), checks the currently offered row, and stamps its source revision from the projected seat.

The gallery includes a projected job-request specimen. Registry guidance, protocol documentation, generated examples, and integration/browser tests cover keyboard and pointer dispatch, Ask aggregation, stale data, forged keys, failure and completion, and historical rows.

This was written by Codex on behalf of max-sixty

Bind request units and detail fields to validated data rows, fold one lifecycle per record, and expose those seats to browser widgets. Add gallery and browser coverage for independent row requests.
Expose per-record controller selections, preserve historical attempts without phantom offers, gate dispatch at the shared entry point, and align registry docs and snapshots.

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One public-surface trap in the new package API holds this back.

A projected request's data_revision is the source revision (request_records returns selected["revision"] or int(snapshot_id)). The name, though, is the one watchData gives the page store revision: snapshot.origin.data_revision = runtime.data.revision in runtime/data.js, and it's documented that way in packages.md ("the accepted store's data_revision at delivery"). A module author who sends snapshot.origin.data_revision gets every press refused as stale whenever the two numbers differ, which happens on any page with a second source or after a clear.

The name collision is a symptom. The underlying problem is that the module stamps a value the controller already has. request(key) reads a seat whose seat.data_revision is the value admission checks, and the gallery widget reads that same field to disable its button. If the controller's request(key).dispatch stamped data_revision from that seat, the field would leave the package API, the naming conflict would go with it, and lf-job-requests.js and the packages.md paragraph would both get shorter. That would also leave the browser's gate in application.js comparing a value against itself, so that check could become just the ready/offered test.

Comment thread skills/leaf/references/packages.md Resolved
@max-sixty
max-sixty merged commit 878780e into main Sep 23, 2026
4 checks passed
@max-sixty
max-sixty deleted the codex/issue-973 branch September 23, 2026 08:07
max-sixty pushed a commit that referenced this pull request Sep 23, 2026
…he secondary ink, and update three nightly tests (#1002)

Main's `nightly` job has been red since the complete suite last took a
turn: [run
35837027671](https://github.com/max-sixty/leaf/actions/runs/35837027671)
reported five failures on 1b4fb67. Four still reproduce on current main
and are fixed here; the fifth,
`test_a_stamped_live_draft_and_its_unstamped_view_keep_distinct_menu_rows`,
already passes there and is untouched.

Behind those four are five causes. Two are defects in shipped code — a
package widget that builds a press outside the layer's press contract,
and a reference link that misses AA on the ground a chosen row wears.
The other three are tests still spelling a contract a merged change
moved, each in a `test_render_*` module the everyday gate does not run,
so the change landed green and reddened main afterwards.

## The exported corpus offers a press it cannot take

`test_the_exported_corpus_stands_on_its_own` found two `button.lf-btn
lf-ui` elements wearing the pointer hand in a standalone copy with no
script to answer them.

`data-lf-offer` is the layer's one spelling of a press: the theme hangs
the hand, the hover wash and the here ring on it, and the bake reads it
to decide what a file can still work. `lf-job-requests`, added with
projected requests in #985, builds its Restart control with
`document.createElement("button")`, so it carries no marker — and the
bake's `browserControl` selector matches `button:not([data-lf-offer])`,
so it read both presses as platform controls that keep working without
Leaf and left them standing. What stayed was `.lf-btn`'s own paint over
a control whose behaviour went with the scripts.

Building it with `offer("button", "lf-btn", "Restart")` is what
[`references/packages.md`](https://github.com/max-sixty/leaf/blob/895a629c7a240370bbf6c0d31c7194bdc02bcf0c/skills/leaf/references/packages.md#L442)
already asks of a module — "`offer()` and `relabel()` on anything
injected" — and produces the same element plus the marker, so the aim
floor, the here ring and the `g` target map reach it too. The widget's
own nightly case,
`test_projected_request_rows_have_independent_buttons`, still passes.

## A block reference misses AA on a chosen row

Behind that assertion the same test had a second failure: axe reports
`color-contrast` (serious) on the `§ off-t-resync` link in the exported
corpus's chosen option, at 4.43:1.

It became reachable in the same window for a good reason. On the last
green nightly the copy had **lost** the authored `chosen` attribute; it
now keeps it. The corpus's log holds no `choose` action for that group,
so the attribute is the document's initial condition and keeping it is
what the markup says. The row form's ground exists precisely so a copy
says which option was taken, and now it paints: `--ok-tint`.

`.lf-ref` was asking for `--muted`, the document's quiet ink, which
measures 4.433:1 on `--ok-tint`. `--muted-2` is the token the palette
states is "held to 4.5:1 against the page surfaces it lands on", and a
generated `§` reference is layer chrome rather than document prose, so
that is the ink it should have been wearing. The two differ by two
points per channel, so nothing visibly moves and the reading clears.

Worth a maintainer's eye separately: `--muted` also measures 4.469:1 on
`--chip`, so the same shortfall exists anywhere the document's quiet ink
lands on a layer surface. Nothing reads it today, and widening the
repair past the one element the gate names did not seem mine to decide.

## `reveal` now requires the intent its caller retained

#982 removed `reveal`'s default second argument and made a missing one a
`TypeError`, so no delayed caller can take a fresh intent after its
wait.
`test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus`
calls `reveal` through `__lfRuntimeImport` to open whatever container a
ring specimen sits in, and still passed one argument.

That disclosure is not a reader's delayed work a later input may
supersede — it is the arrangement saying what the page must show next —
so it hands over the intent that always holds.

## Return submits from a Leaf composer; Shift+Return is the line break

#986 moved the shared composer's submit onto Return.
`test_a_growing_reply_keeps_its_send_in_the_list` grows a reply box by
typing a line and pressing Enter, so each press sent that line as its
own reply instead of inserting a newline.

The card still overran the list — on eleven arriving messages rather
than on the box — so the `assert overran` guard that exists to catch a
vacuous run passed, and the failure surfaced thirty seconds later as a
`wait_for_function` timeout on the Send button. The test now presses
Shift+Enter and reads the reply box's own height before and after the
typing, so the next time that key's meaning moves the failure names the
cause instead of timing out on a symptom.

## Two commits gave a scoped chrome class a document-level face

`test_a_coined_class_cannot_reach_the_chromes_rules` probes for a scoped
rule leaking onto a page element, and keeps an explicit list of the
classes held out of that probe because the theme dresses them at
document level on purpose. #991 put `.lf-compose-placeholder` in both
sheets, and #995 did the same for `.lf-action-icon`,
`.lf-conversation-head` and `.lf-msg-sending` while rebuilding the
margin card's sticky head.

All four are the case the list already documents — the theme dresses a
shared control or message part wherever it renders, while the chrome's
scope only places its own copy — so the exception is widened with each
one's reason, which is what the assertion asks for.

## Verification

Run on this branch under Ubuntu 24.04 with `--run-nightly`: all four
failing cases pass, as do
`test_projected_request_rows_have_independent_buttons`,
`test_the_feature_gallery_has_no_serious_wcag_a_or_aa_violations`,
`test_the_adopted_sheet_decides_nothing_by_standing_last`, and
`test_render_options.py` / `test_render_options_addition.py` — 74
passed, one failure. Each of the four was reproduced first on unmodified
main, so none of them is the run's own noise. Pre-commit passes on the
changed files.

That one failure,
`test_a_widget_move_keeps_one_target_seat_across_revisions_until_honored`,
is not this branch's and is not in the run being fixed: it passed on
1b4fb67, and it fails identically on unmodified 895a629 — alone, under
`-n0`, in 10 seconds, on
`expect(receipt).to_have_attribute("data-lf-kinds", "sent")`. It is a
later regression from the seven commits that landed after this run, and
main's in-flight nightly will report it on its own.

<details><summary>The run's five failures, and where each stands on
current main</summary>

```
tests/test_render_controls.py::test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus
  TypeError: reveal needs the intent its gesture retained          reproduced · fixed
tests/test_render_conversations.py::test_a_coined_class_cannot_reach_the_chromes_rules
  extra: lf-compose-placeholder                                    reproduced · three more names since
tests/test_render_conversations.py::test_a_growing_reply_keeps_its_send_in_the_list
  TimeoutError: Page.wait_for_function                             reproduced · fixed
tests/test_render_export.py::test_the_exported_corpus_stands_on_its_own
  offering: ['button.lf-btn lf-ui', 'button.lf-btn lf-ui']         reproduced · fixed
  then color-contrast (serious) 4.43:1 on .lf-ref                  behind it · fixed
tests/test_render_projection.py::test_a_stamped_live_draft_and_its_unstamped_view_keep_distinct_menu_rows
  Locator expected to have count '4', actual 3                     passes on main · untouched
```

The contrast reading was pinned against the last green nightly
(00d7a41), where the same test passes and the exported chosen option
computes `background-color: rgba(0, 0, 0, 0)`; on current main the same
node computes `rgb(223, 237, 223)`.

</details>

Co-authored-by: leaf-agent <[email protected]>
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.

Typed requests cannot be offered from projected data rows

2 participants