Skip to content

Move state provenance from borders to Page map - #402

Merged
max-sixty merged 20 commits into
mainfrom
codex/border-provenance-page-map
Sep 7, 2026
Merged

max-sixty merged 20 commits into
mainfrom
codex/border-provenance-page-map

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

Leaf used persistent whole-widget outlines for reader changes, worker reports, and restatements. Those outlines doubled existing borders, overemphasized long-lived provenance, and could not represent multiple provenance channels on one target.

This change derives provenance once from the standing state projection and surfaces it as explicit Page map entries without creating target-side controls or changing target geometry. Activating one of those entries focuses its target directly. The change also keeps clipped origin words on their targets for assistive technology and standalone exports, while excluding Page-map-only locations from the spoken margin-Button walk. It removes the global provenance outline rules and the extra chosen-card spread while preserving focus rings, annotation contours, activity halos, and semantic state attributes.

The integration with current banner shortcuts coalesces repeated title and shortcut-attribute writes, and swipe-card title spacing now ignores generated provenance words. Board move controls name the action and location while the shared provenance reading names the origin once.

Validation on the merge with current main: uv run pytest tests (908 passed), uv run pytest tests/test_render_margin.py -q -n0 (83 passed), uv run pytest tests/test_render_projection.py -q -n0 (103 passed), uv run pytest tests/test_render_widgets.py -q -n0 (120 passed), and uv run pre-commit run --all-files.

This was written by Codex on behalf of @max-sixty

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

Two carriers the removal leaves empty. Both reproduced on this branch against aa7c97fd; details inline.

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

Pressing a Page-map row for a provenance-only location leaves keyboard focus on a different location.

renderNow now skips host creation for an entry with no margin Button, so rows.get(entry.key) is empty for exactly the entries this change adds. A sheet press routes through activate → focusMapControl(entry), whose fallback chain is the entry's own marker, then the Map toggle, then visibleRows(). On a wide screen the toggle is hidden, so focus lands on whichever margin row happens to be on screen while revealTarget scrolls to the provenance target: the reader is announced to one location and left standing on another, and the next Tab continues from there.

Reproduced on this branch at 86fddb90 using this PR's own fixture — REPORT_PAGE, a report on t-mounts, a thread on t-parser, at 1440×900. Pressing the row whose label starts Open reported update: Reported update leaves document.activeElement on the t-parser marker, labelled Thread, 1 of 1, task · Fit squirrel baffles, 62 percent down. The Rewritten and Your change rows take the same route wherever the target carries no receipt of its own.

The line to change is outside this diff: focusMapControl (living-margin.js, function focusMapControl(entry = null)) reads "this entry has no marker" as "the map has no marker anywhere", and a Page-map-only row wants the sheet's own return route rather than a neighbour's row. Happy to push that commit if you'd like it here.

Both findings from the previous round check out on this commit — the walk now counts only entries with a margin host, and the copy carries your change and reported update as quiet words after bake strips the chrome. Both threads are already resolved.

@max-sixty

Copy link
Copy Markdown
Owner Author

Fixed the fresh keyboard finding in 61e8051d. A Page-map-only provenance entry now reveals its target and hands focus to that authored element through the existing temporary-focus primitive, rather than selecting an unrelated visible margin marker. The regression activates the row with Enter and verifies focus lands on the reported target.

This was written by Codex on behalf of @max-sixty

leaf-agent
leaf-agent previously approved these changes Sep 7, 2026

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

test_the_render_gate_applies_every_standing_action_a_second_time is red on this branch, and it is this change rather than the suite's usual noise: it passes at the merge base 3e924346 and fails deterministically (~7s) on the merge tree, and deleting just the two new words.push lines in quietFacts makes it pass again.

The gate reports <lf-swipe-card> draws 8px of inset and shows 12px below what it holds (id='ab-capacity'). That card is <lf-swipe-card id="ab-capacity"><strong>Partition capacity</strong></lf-swipe-card> — a title and nothing else — and it carries a standing move, so it now wears data-lf-reader-override. quietWord seats the word after :scope > strong, so on a title-only element the generated span becomes the last child:

<strong>Partition capacity</strong><span class="lf-ui lf-quiet" data-lf-gen="1">your change</span>

The <strong> therefore stops being :last-child, and the swipe package's strong:first-child:not(:last-child) rules start matching — the winning one is the verdict="keep" pair near lf-swipe-pile[verdict="pass"] > lf-swipe-card > strong:first-child:not(:last-child), which reserves var(--sp-1). The span is position: absolute, so nothing fills that 4px, and the card renders 8px of padding plus an orphan 4px margin. theme.css's own trim avoids exactly this by spelling the question :nth-last-child(1 of :not(.lf-ui, [data-lf-gen])); the package rules use the bare pseudo-class, which cannot know the runtime may append a word.

Rewriting all three :not(:last-child) occurrences in skills/leaf/packages/swipe/theme.css to :not(:nth-last-child(1 of :not(.lf-ui, [data-lf-gen]))) clears the gate locally. That file is outside this diff, so I have not left an inline suggestion — happy to push that commit here if you want it.

Worth a look beyond the one the corpus catches: this change makes a formerly inert attribute into an injected child on any provenance-bearing element, so every > :last-child or :not(:last-child) rule that can sit on such an element is newly exposed. lf-swipe-card > :last-child is the same shape one line up, and .lf-pr-description-body > :last-child has it too. I only reproduced the swipe card.

The other four failures in that job — test_an_unchanged_heartbeat_restates_no_margin_name[corpus] and [gallery], and test_the_small_screen_map_is_a_complete_accessible_sheet[pointer] and [keyboard] — reproduce identically at 3e924346, so they are not this branch's.

@leaf-agent
leaf-agent dismissed their stale review September 7, 2026 17:11

CI failed — the render gate's TRAPPED_MARGINS reading is red on this commit; see the review on 61e8051.

leaf-agent and others added 7 commits September 7, 2026 10:20
Tonight's nightly regeneration of the tend workflow files, which moves
this repo from tend 0.1.24 to 0.2.0.

**tend version:** 0.1.24 → 0.2.0

**Notable changes**

- Every job now opens with a `Check whether tend is enabled` step that
reads `.config/tend.yaml` from the default branch and gates the rest of
the job on it (max-sixty/tend#1132). This is a runtime kill switch:
setting `enabled: false` on `main` stops every tend job without
regenerating a workflow. It accounts for most of the added lines here,
since the check is inlined once per job. This repo's config sets no
`enabled` key, so the default `true` applies and behaviour is unchanged.
- The runner logic moved out of inline Bash and skill prose into tend's
own Python (max-sixty/tend#1158), which is why `tend-mention`'s `verify`
and `tend-notifications`' pre-check bodies are rewritten even though
what they decide is unchanged.
- Workflows gained Claude effort/harness arguments (max-sixty/tend#1161)
and experimental Codex subscription auth (max-sixty/tend#1159), so the
harness a job runs under is configurable per repo. Neither is set here.
- `ci-fix` now takes a concurrency group per branch and watched workflow
(max-sixty/tend#1148), so two failing workflows on the same branch no
longer cancel each other's fix run. That matters here, where `ci-fix`
watches both `ci` and `publish-site`.
- Review behaviour: a standing bot approval is dismissed when a later
review withholds the verdict (max-sixty/tend#1136) or when another PR
merging invalidates it (max-sixty/tend#1139).
- `tend check` paginates its secret listings (max-sixty/tend#1137), so a
repo with more than one page of secrets can no longer pass the allowlist
check by omission.

**Verification**

Regenerating with `uvx [email protected] init` against this repo's
`.config/tend.yaml` reproduces all eight workflow files byte for byte,
so nothing here is a hand-edit and every repo customization (the
`setup:` uv steps, `bot_name`, the `ci-fix` watched workflows) survived.
`.github/actionlint.yaml` is unchanged by 0.2.0.

Full comparison:
max-sixty/tend@0.1.24...0.2.0

Co-authored-by: leaf-agent <[email protected]>
The root instructions say the everyday suite and pre-commit never read
`worker/`, so a worker change is ungated until CI's `website-worker` job
runs. That is true of `worker/src/`, but not of `worker/server.py`,
which both gates already cover — and `worker/server.py` is where the
container adapter lives, including the website-agent turn and reply
endpoints added yesterday. A session that takes the paragraph literally
runs the npm gate, which never touches `server.py`, and skips the suite
that does.

This rewrites both passages to say which half is ungated. No behavior
changes, so there is no regression test to add; the claim is checked
below against the two gates it describes, and the existing
`test_the_root_instructions_name_every_directory_ci_gates_on_its_own`
still passes because `` `worker/` `` stays named in the repository map.

<details><summary>Evidence</summary>

`tests/test_website_server.py` loads the adapter directly rather than
importing a package, so a grep for `import` in the suite does not show
it:

```python
_spec = importlib.util.spec_from_file_location(
    "website_server", ROOT / "worker" / "server.py"
)
```

Both gates, run on this branch:

```
$ uv run pytest tests/test_website_server.py -q
4 passed in 2.09s

$ uv run pre-commit run ruff-check --files worker/server.py
ruff check...............................................................Passed
```

`.pre-commit-config.yaml`'s `exclude` does not name `worker/`, so every
Python hook takes `worker/server.py`. `ci.yaml`'s `website-worker` job
runs `npm ci`, `npm run typecheck`, `npm test`, and the wrangler dry run
— all under `working-directory: worker`, all against the TypeScript
project, none of which reads `server.py`.

The paragraph landed in #331 the day after
`tests/test_website_server.py` landed in #313, so it has been describing
the wrong half since it was written.

</details>

---------

Co-authored-by: leaf-agent <[email protected]>
The Go-to overlay now leaves repeated chord context off generated target
hints, so each page target shows only the suffix the reader still needs
to press. Stable global destinations instead expose their complete `g`
chords directly on the banner controls, and the chord disappears when
character shortcuts are disabled.

Tests cover suffix-only hint rendering, banner chord
projection—including folded controls—and shortcut preferences.

> _This was written by Codex on behalf of max-sixty_

---------

Co-authored-by: leaf-agent <[email protected]>
Co-authored-by: leaf-agent <[email protected]>
Leaf currently holds one EventSource connection open for every tab,
including hidden ones. Cloudflare counts each streaming response as an
in-flight container request, so those sessions never begin the existing
idle timeout and consume the public instance ceiling indefinitely.

This change raises the public `lite` container limit from 100 to
Cloudflare's current account capacity of 15,000. It also makes document
visibility the browser lease: hidden tabs close their news stream and
stop timed reads, while visible tabs reconnect and catch up from the
canonical state projection. The ten-minute idle grace remains, and one
visible tab is enough to keep a multi-tab reader session alive.

The browser test proves a hidden page neither hears nor polls for
changed state, stops advancing reader presence, then reconnects once and
catches up when visible. The storage contract now defines `viewed.json`
as visible reader attention rather than background-tab lifetime. The
parsed deployment-config test pins both the exact capacity and `lite`
instance type while retaining the existing production
application-identity guard.

> _This was written by Codex on behalf of max-sixty_
`s` previously stopped at response-neutral target selection while
Alt-click immediately opened Comment. This routes keyboard hints through
the same canonical comment action, so the field receives focus and
unsent drafts move consistently. Page-text search remains the deliberate
selection-first route.

The browser contracts now cover ordinary items, nested targets, visual
parts, draft carry-over, reactions, absent reaction vocabularies,
in-flight sends, and the keyline/reference wording. The product overview
and explainer describe the same direct Comment route and its
Tab/ellipsis response extension.

Tested with `uv run pytest tests` (907 passed), a focused/nightly
browser run (232 passed), `uv run pre-commit run --all-files`, and a
live UI sweep at 390, 1200, and 1440 pixels in light and dark themes.

> _This was written by Codex on behalf of max-sixty_
…ce-page-map

# Conflicts:
#	skills/leaf/assets/runtime/keyboard/page.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.

One more failure, in a module this PR's CI cannot reach: tests/test_render_widgets.py::test_a_board_says_which_column_each_card_is_in. It passes at the merge base 8fbf925c and fails at 2dda51d0 — the moved card's aria snapshot gains a - text: your change line before its Button. The nightly step runs only the test modules the branch touches, and this is not one of them, so the case first runs after the merge, on main.

It reads as a decision rather than a re-baseline. That card's Button is already named Move: Squirrel baffle — Done — your move, so a reader listening now hears the origin twice on the same card: once as the quiet word inside the card, once in the name of the control that put it there. The snapshot is where that shows up plainly, which is what the test is for — test_a_board_says_which_column_each_card_is_in's own docstring says the second snapshot is the assertion, because a name set where the move happens goes stale on whichever path forgets to restate it.

The same question applies wherever a widget's Button already speaks its provenance; the board is just where the corpus asserts it. Happy to push whichever way you decide.

Reproduction
git checkout 8fbf925c && uv run pytest tests/test_render_widgets.py::test_a_board_says_which_column_each_card_is_in   # passes
git checkout 2dda51d0 && uv run pytest tests/test_render_widgets.py::test_a_board_says_which_column_each_card_is_in   # fails

Host Chrome 151.0.7922.34. The rest of tests/test_render_widgets.py and tests/test_render_gate.py (191 cases), and tests/test_render_navigation.py with tests/test_render_controls.py (174 cases), are green on the branch.

@max-sixty

Copy link
Copy Markdown
Owner Author

Fixed in 1fded849. Board now leaves provenance to the shared card reading and keeps the Move control's accessible name to its action, card, and current column. The accessibility snapshot now contains one your change reading, the focused board and projection regressions pass, and the standalone export retains the origin after live controls are removed.

This was written by Codex on behalf of @max-sixty

@leaf-agent

Copy link
Copy Markdown
Collaborator

Confirmed — 61e8051d closes the keyboard finding, and it closes it in a better place than the change I offered. Handing the arrival to focusDestination(entry.target) keeps focusMapControl's fallback chain meaning what it says ("this entry's marker, else the map's own way back") instead of teaching it a fourth case, and the sheet route is safe on the same reasoning the close handler already spells out: sheetCloseOwnsFocus short-circuits the late restore, so the task-delayed close can't take focus off the target the press just arrived on.

Verified at 2dda51d0: the new case in test_page_map_only_origins_do_not_count_as_margin_buttons passes, and it exercises the route I reported — 1440×900, Map toggle hidden, Enter on the Open reported update row, focus on #t-mounts and off the t-parser marker. The rest of tests/test_render_margin.py is green apart from the two test_the_small_screen_map_is_a_complete_accessible_sheet cases, which are the base-branch failures already named above.

@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 board decision reads right — one origin word on the card, and the Move control back to naming its action and destination. What the commit leaves behind is the board's own account of why #names is wired the way it is.

connectedCallback's comment above this.#observeNames() still says: "Grip names come from where their cards sit and whether the runtime has marked the placement as their move, so mutations of those two inputs restate them … Only the origin attribute is observed, so #names writing an aria-label cannot feed the pass back into itself." After this commit there is one input rather than two, the origin pass is no longer an occasion to restate a name, and no attribute is observed at all — the observer takes childList on columns only. The paragraph reads as an instruction: someone keeping the name current would put data-lf-reader-override back into the filter, which is exactly what this commit removed. The loop-safety it argues also now rests on a different fact — an aria-label write on a grip is not a column childList mutation — and nothing in the file states that one.

Two more sites carry the removed suffix as current: the file header, "each grip is named for the column its card now sits in and whether its move awaits a version (#names)", and test_a_moved_card_identifies_its_reader_origin_across_tabs, whose docstring still says the moved card "stays explicitly identified as overriding authored placement and its grip says so, in the tab that moved it and in a fresh replay alike". That commit updated the test's assertions but not its statement of what it tests, and the docstring is the only place naming the both-tabs claim — which now belongs to the quiet word rather than the grip. The sibling docstring in test_a_board_says_which_column_each_card_is_in was updated in this same commit, so this looks like an oversight rather than a decision.

All three sit outside this diff, so there are no inline suggestions to apply. Happy to push the commit here if you want it in this PR.

@leaf-agent

Copy link
Copy Markdown
Collaborator

Withdrawing the render-gate finding from my 17:11 review — it no longer reproduces, and it was already fixed inside this PR when I posted it. e2b720bf rewrote all three swipe strong:first-child:not(:last-child) rules to :has(~ :not(.lf-ui, [data-lf-gen])), which asks the same question my suggested :nth-last-child(1 of :not(…)) did. It landed about five minutes after that review, so the merge tree I measured predated it. test_the_render_gate_applies_every_standing_action_a_second_time passes for me at both 2dda51d0 and 1fded849, and all of tests/test_render_projection.py is green (104 cases). Nothing outstanding from that review — the swipe theme needs no further change here.

@max-sixty

Copy link
Copy Markdown
Owner Author

Fixed in 90ee57d3. The board header and observer comment now describe column-only grip names and the childList loop boundary, while the projection test attributes cross-tab provenance to the shared quiet word and Page-map entry.

This was written by Codex on behalf of @max-sixty

leaf-agent
leaf-agent previously approved these changes Sep 7, 2026
@leaf-agent

Copy link
Copy Markdown
Collaborator

Confirmed — 90ee57d3 closes the documentation finding at all three sites.

The observer comment now states the loop boundary the code actually rests on — #observeNames takes childList on columns only, and #names writes an aria-label on a grip, which is not a child-list mutation — so the paragraph no longer reads as an instruction to put an attribute filter back. The header drops the second input to match #names, which builds Move: <title> — <column> and nothing else, and test_a_moved_card_identifies_its_reader_origin_across_tabs's docstring now names the quiet word and Page-map entry as the carriers of the cross-tab claim rather than the grip. Grepping the tree for the removed suffix finds no other site still asserting it.

Both cases pass for me at 90ee57d3 — test_a_board_says_which_column_each_card_is_in and test_a_moved_card_identifies_its_reader_origin_across_tabs, 6.9s.

@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 banner half of ddd2b781 swaps a reading that fails on the shipped layout for one that cannot fail on any layout the CSS can produce, so Map (n) — the control this test exists to check — is no longer measured for placement at all.

[data-lf-chord] in skills/leaf/assets/runtime/chrome.css declares padding-block: 3px 14px and anchors its ::after at bottom: 3px, both fixed, so chordBottom is always innerBottom - 3 and the text always starts below innerTop. chordBottom <= innerBottom + 0.5 and textTop >= innerTop - 0.5 are therefore true by construction; only textBottom <= chordTop + 1.5 can fail, and only on outright overlap. Measured: setting that rule to padding-block: 24px 14px — the label shoved to the bottom of a button 21px taller than it needs — leaves both cases green, where the pre-commit reading failed them. This is the only place in the suite that measures compact-banner text placement, so nothing else covers the gap.

A balance statement is still available for the chord case and, unlike the union centring the commit dropped, it does not depend on glyph metrics: the room the button reserves above the label against the room below the chord, padding-top versus innerBottom - chordBottom, both exactly 3px today. Suggested inline — it passes at this head and fails on the 24px probe.

The thread half needs nothing; textareaRight against the thread's border box was the stale reading, and the content-box form replaces it correctly.

Comment thread tests/test_render_margin.py Resolved
Comment thread tests/test_render_margin.py Resolved
@leaf-agent
leaf-agent dismissed their stale review September 7, 2026 18:38

Superseded by the review on a later commit.

…ce-page-map

# Conflicts:
#	skills/leaf/assets/runtime/keyboard/page.js
leaf-agent added a commit that referenced this pull request Sep 7, 2026
… body's width

A docked margin row remembered `document.body.getBoundingClientRect().right` as the width its dock answered about, but the footprint that answer is made from is measured against the space between the reading column's right edge and that shell edge. Opening the thread panel narrows the column inside a body whose width never moves, so the memo matched, the dock stood, and the rows stayed in flow under their blocks.

Store and compare `marginRoom(columnRect, shellRight)` instead, matching the change already carried on #402 statement for statement so the two resolve as one.
…ce-page-map

# Conflicts:
#	skills/leaf/assets/runtime/margin-layout.js
…ce-page-map

# Conflicts:
#	skills/leaf/assets/runtime/living-margin.js
@max-sixty
max-sixty merged commit d819059 into main Sep 7, 2026
4 checks passed
@max-sixty
max-sixty deleted the codex/border-provenance-page-map branch September 7, 2026 22: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