Skip to content

Take event-name constants and contributionEntry out of the package API - #6941

Merged
max-sixty merged 5 commits into
mainfrom
agent-a581112940aff9b6b
Nov 24, 2026
Merged

max-sixty merged 5 commits into
mainfrom
agent-a581112940aff9b6b

Conversation

@max-sixty

@max-sixty max-sixty commented Nov 24, 2026 •

Copy link
Copy Markdown
Owner

One step of the package-interface redesign: names that only name an event Leaf already sends, or that only rebuild what Leaf already does with a plain object, leave the package API. Six go, 183 names to 177. Packages write lf-page-interface, lf-presentation, lf-layout and lf-preview-ended in place of PAGE_INTERFACE, PRESENTATION, LAYOUT and PREVIEW_ENDED. registerContribution and presentContributionEntry already normalize a plain entry, so contributionEntry goes and callers pass the object. contributionItemKey only joined an item's owner and id, which module-annotations.md now tells a consumeAnnotations caller to key rows by.

To weigh: nothing a user sees should change, and no lint rule or test watch changed. Left in: clockValue, partOver and matchesWhen, which nothing outside the runtime calls but which each give a package a rule of Leaf's own, so removing them is a feature's removal for Max to decide; and PendingTaskEvent, since #6936 made it how a widget announces preparation and five packages build it, so it belongs in the library. The shared-contribution-actions eval now passes plain entries.

Max approved the redesign and asked for small steps. He hasn't read this diff. A fresh agent reviewed it.

Ran: pre-commit, pnpm run check, 20 browser tests by node id.

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

One step of the package-interface redesign. Nine names leave the package
API. `PAGE_INTERFACE`, `PRESENTATION`, `LAYOUT` and `PREVIEW_ENDED` only
named events Leaf already sends, so packages write `lf-page-interface`,
`lf-presentation`, `lf-layout` and `lf-preview-ended`.
`contributionEntry` normalized an entry that `registerContribution` and
`presentContributionEntry` already normalize, so callers pass plain
objects. Nothing outside the runtime used `clockValue`, `matchesWhen`,
`partOver` or `contributionItemKey`. The runtime keeps each function it
uses; `clockValue` joins check-api.js for the three browser tests that
drive a clock-tracked draw.

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

Of the nine names, clockValue is the one whose removal leaves package authors with a gap the references no longer cover. The "Time readings" section of module-state.md used to give a widget one way to act on a time condition, such as marking data stale after a limit or grouping by day, and it told authors to "keep no clock of your own" so the result could never disagree with an ago drawn next to it. With that paragraph removed, the section covers only ago. A widget that needs a stale badge will now reach for Date.now() and its own timer. That timer reads the browser's clock rather than the server time ago uses, and nothing redraws the widget when the condition flips.

The PR body already lists this under "To weigh", and per AGENTS.md, "The maintainer decides", taking a feature away is Max's call. The redesign approval doesn't cover it while he hasn't read the diff. So I'm leaving the verdict to him rather than approving. Everything else here only removes wrappers, and it checks out: pnpm run test:browser and pnpm run test:runtime both pass on the merged tree. If clockValue goes, say in "Time readings" what a widget should do for a time condition instead. If it stays, keep the export and the paragraph.

A package that redraws on a time condition reads it from Leaf's server
clock through clockValue, as an age beside it does; without it the
widget keeps a clock of its own. Its removal is a feature's, which the
maintainer decides.

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

Keeping clockValue resolves what I raised last round: the export and the "Time readings" paragraph now match main exactly.

My earlier review was wrong to call everything else a wrapper removal. The PR body itself says partOver and matchesWhen take a capability away. Both are documented package API on main, in module-reading.md (the matchesWhen(element, when) sentence and the partOver(node) paragraph). The first lets a widget evaluate a {when} declaration such as an awaits's. The second gives a widget the part of the page On Me groups an item under, so a package can group or label by the same rule. No package calls either one. But per AGENTS.md, "Regular maintenance", that doesn't show they're unused, since the maintainer builds features ahead of their use. Per "The maintainer decides", taking a feature away is Max's call, and the body says he hasn't read this diff. Approving would merge it under yolo, so I'm leaving the verdict to him. If both go, the rest of the PR is ready. If either stays, restore its export and its paragraph, the same way clockValue came back.

Each gives a package a rule of Leaf's own, the part On Me groups an item
under and whether a declared when holds, so removing it takes a feature
away, which the maintainer decides.
@max-sixty max-sixty changed the title Take event-name constants and unused names out of the package API Take event-name constants and contributionEntry out of the package API Nov 24, 2026
@max-sixty
max-sixty merged commit eb810b5 into main Nov 24, 2026
6 checks passed
@max-sixty
max-sixty deleted the agent-a581112940aff9b6b branch November 24, 2026 04:12
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