Skip to content

Give each margin control its receipt in the model, and list a target's controls once - #2522

Merged
max-sixty merged 5 commits into
mainfrom
agent-a8d1ec9db82bffa76
Oct 12, 2026
Merged

max-sixty merged 5 commits into
mainfrom
agent-a8d1ec9db82bffa76

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

The margin kept its own copy of the rule that picks a contribution control's workflow receipt. #2504 moved the Page Map to a model-owned receipt, but the margin still painted the target's agent work over its primary control after the cluster rendered, and cleared that control to nothing once it stopped carrying the work. So a package control with its own workflowReceipt that gave up the primary seat showed its own receipt in the Page Map and none in the margin. Page annotation views (data-annotations="page") built their control list a third way and painted only each control's own receipt. Because the inventory drops the target's workflow item once a control carries it, that view showed the target's agent work nowhere.

One rule now decides it. marginInventory gives every control item a receipt: the target's receipt on the surviving primary and the control's own everywhere else. entryControls(entry) in margin-model.js is the one list of a target's controls, in canonical order. The Page Map and view.controls(entry) both read it. Receipts are seat state, so each seat paints what its projection chose on every pass through presentContributionReceipts, which the contributionReceipts template directive now wraps. The margin's clusters and readings, the inline Thread seats, page annotation views and the feature gallery all call it, and widget-api.js exports it. presentContributionEntry no longer paints a record's receipt or turn, and the margin's carrier bookkeeping is gone.

Review item 50, "the margin keeps its own copy of the contribution receipt rule"

  • Behaviour change: a control that stops carrying its target's agent work goes back to its own receipt in the margin, as it already did in the Page Map. A page annotation view now shows the target's agent work on its primary control and lists controls in the canonical order its contract (module-authoring.md) names.
  • Hand-written source: +97 / −101 lines (net −4). That covers the runtime modules (margin-model.js, margin-map-model.js, contribution-controls.js, annotation-view.js, inline-contributions.js, widget-api.js, margin-projection.js, margin-cluster-view.js) and the feature gallery widget, and excludes the regenerated corpus copy.
  • Tests: +159 / −7 lines. test_each_seat_agrees_with_the_page_map_on_a_controls_receipt runs once with margin annotations and once with page annotations, and both fail on main. With the margin, edit shows no receipt where the Page Map shows picked_up. With page annotations, edit shows picked_up where working belongs. The margin-model runtime test checks that the cluster, its focused options and the Page Map read the same receipts, and the gallery atlas test now also checks the "On you" turn.

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

max-sixty and others added 3 commits October 11, 2026 23:29
…the seat

The margin chose a control's workflow receipt by hand: it painted the target's
agent work over the primary control after the cluster rendered, and cleared
the control to nothing when it stopped carrying that work. The Page Map chose
the same receipt in its model, falling back to the control's own. So a package
control with its own `workflowReceipt` that gave up the primary seat showed
its own receipt in the Page Map and none in the margin.

`marginInventory` now gives every control item its `receipt` by one rule (the
target's on the surviving primary, its own elsewhere), and the Page Map reads
its controls from those items instead of re-deriving them from the offers.
Receipts are seat state: each seat paints what its projection chose, on every
pass, through `presentContributionReceipts`, which the `contributionReceipts`
template directive now wraps. The margin's clusters and readings, the inline
Thread seats and page annotation views call it; `presentContributionEntry` no
longer paints a record's receipt or turn, and the margin's carrier bookkeeping
is gone.

Behaviour change: a control that stops carrying its target's agent work goes
back to its own receipt in the margin, as it already did in the Page Map.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…iews

Page annotation views built their control list a third way, from the offers
in declaration order, and painted each control's own receipt. In
`data-annotations="page"` the inventory has already dropped the target's
workflow item once a control carries it, so that work showed nowhere in the
view while the Page Map showed it on the primary. `entryControls` in
margin-model.js is now the one list of a target's controls, in canonical
order with each control's receipt; the Page Map and `view.controls(entry)`
both read it.

Behaviour change: a page annotation view shows the target's agent work on its
primary control and lists controls in the canonical order its contract names.

The feature gallery painted its receipt and turn samples through
`presentContributionEntry`, which no longer paints them; `widget-api.js` now
exports `presentContributionReceipts` and the gallery calls it. Margin control
items lose their constant `surface` field.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
leaf-agent previously approved these changes Oct 12, 2026
# Conflicts:
#	skills/leaf/assets/runtime/annotation-overlay/margin-cluster-view.js

@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.

The receipt change has no review finding, but I’m withholding approval on this head because test fails in check:browser: the committed protocol contract still says protocol 1 while the registry says 2. lint then fails because it depends on test. #2536 addresses both gate failures.

@max-sixty
max-sixty merged commit 8e1c4f2 into main Oct 12, 2026
3 checks passed
@max-sixty
max-sixty deleted the agent-a8d1ec9db82bffa76 branch October 12, 2026 10:02
max-sixty added a commit that referenced this pull request Oct 12, 2026
Main exported readingPaint from presence.js (#2568), which lf-diff imports and
module-authoring.md documents, so it stays an authoring export; this branch's removal
of renderRetired and textNodesUnder stands. Main also split a margin control's
receipts out of presentContributionEntry into presentContributionReceipts (#2522), so
the reference documents both.

Co-Authored-By: Claude Opus 5.5 (1M context) <[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.

2 participants