Skip to content

Publish an explainer of the event log at /event-log/ - #1091

Merged
max-sixty merged 6 commits into
mainfrom
event-log-explainer
Sep 24, 2026
Merged

max-sixty merged 6 commits into
mainfrom
event-log-explainer

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

This adds an explainer of the event log at docs/event-log.html, published at /event-log/. It shows how a widget's verb becomes a logged event and how the fold turns the log back into state. The markdown contracts stay the rules: the page explains at explainer depth and links to events.md, packages.md "User state", /registry/#x-state and layer-registry.md.

Sections.

  • Layers: a diagram and a table (widget → append door → events.jsonl → fold).
  • Try it: a live lf-specimen with an options group and a feed of the specimen's own log, plus a walkthrough: add an option, pick another, press z three times.
  • Verbs: the lf-options declaration with notes: x-state, the [widget, unit, verb] coordinate, and x-awaits.answered. A collapsed table lists every declared verb.
  • The fold: over a captured log.
  • Taking an action back: the three ways.
  • Other writers: agent-written verbs and leaf report, then leaf events --follow, and how the log differs from data.json.

The example records come from a real run. I drove the specimen's markup in Chrome and copied the leaf events output verbatim. Two tests keep the page from drifting from the code:

  • test_the_event_log_page_shows_the_records_the_door_writes replays the same commands through the append door. It requires the stored records to equal what the page shows, apart from id and ts. When they differ, it prints the new records ready to paste.
  • test_the_event_log_page_quotes_the_registry holds the annotated declaration to lf-options' registry entry, and the verb table to every declared x-state verb.

Links. PRODUCT_ROUTES gains the page, so it is in the sitemap. It is linked the way /registry/ is: from how-it-works.html twice and from extending.html's reference list. The site nav stays at four entries.

Fix found on the way. The feed named a pick of a user-added option by its generated id ("You chose “ship-option-8ed22a9d…”"). GestureWords only looked in the document. It now takes a created child's words from the latest action that created it at or before the gesture described, so a reused id never lends later words to an earlier gesture. It reads them through created_words, the one reading of a child's x-text-format that the version gate also uses now, so markdown words read as formatted text. This also fixes deliveries and the transcript. A contract test covers the reuse and markdown cases.

Tests. Everyday suite: 1358 passed. leaf version check --render passes in light and dark. scripts/site.py builds 84 pages. The page and contract test files pass after the review fixes (302). I didn't run the site through Wrangler.

🤖 Generated with Claude Code

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

max-sixty and others added 4 commits September 23, 2026 22:28
Since #1078 moved lf-activity's wording to the server, GestureWords named
an element only from the gesture's document, so a pick of an option the
user added read as its minted id ("You chose “ship-option-8ed2…”").
GestureWords now reads each `creates` action's words once and uses them
wherever a gesture names that child: `name` for the history row, and
`says` for deliveries and the transcript, where the created child now
stands in for its enclosing widget.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A product page explaining how widget verbs become log records and how the
fold turns them into state: the layers, lf-options' declaration with
notes, a log captured from the page's own specimen, the three ways an
action is taken back, agent-written verbs, and the change feed. A live
specimen with an lf-activity feed lets the reader produce the same log.

Two tests keep it from drifting: one replays the captured commands
through the append door on the specimen's markup and requires the stored
records to match what the page shows, printing the records to paste when
they do not; the other holds the annotated declaration to lf-options'
registry entry and the verb table to every declared x-state verb.

How it works and Extending link to it.

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

@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 new created-child wording can misstate what an earlier gesture named when an option ID is reused. It also reports raw Markdown where the option displays formatted words. The explainer points readers to the contract file for external data values. Details are inline.

Comment thread docs/event-log.html Resolved
max-sixty and others added 2 commits September 23, 2026 22:52
GestureWords kept one id→words map for the whole log, so an id an undone
add freed and a later add reused gave its later words to earlier gestures,
and it read the raw detail text, so an inline-Markdown option showed its
syntax. A gesture now reads the latest creating action at or before it,
through `passages.created_words`, which applies the child's
`x-text-format` as an added child renders it. The version gate's echo
check reads the same helper, and the history's add row goes through the
same reading.

The event-log page now names `data/<source>.json` as where an external
source's value lives.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit 1b8d1a9 into main Sep 24, 2026
5 checks passed
@max-sixty
max-sixty deleted the event-log-explainer branch September 24, 2026 06:15
max-sixty added a commit that referenced this pull request Sep 24, 2026
…its explainer role (#1095)

Refinements from a review of #1075 (`leaf events --follow`) and #1091
(the event-log explainer).

**The follower ends when its log is replaced.**
- Before this, `follow_events` kept its byte offset across an inode
change. A log renamed into place stalled the follower silently, and a
longer replacement would have been printed from the middle under the
wrong seqs.
- It now remembers the inode of the file it first opened. It ends with
the existing `<log> is gone` error (exit 1) when the inode changes, when
the file is shorter than what was read, or when the file vanishes
between the stat and the open.
- `test_events_follow_ends_when_its_log_is_replaced` covers it and times
out without the guard.

**Startup skips parsing what `--after` excludes.** The lines at or
before `--after` are counted, not parsed. With `--after 199999` on a log
of 200k events, the first event arrives in 0.04 s at 82 MB, down from
0.43 s at 390 MB.

**`events.md`.**
- "Following the log" moves after the paragraph on dependency identities
and `meaning.creates`, which #1075 had cut off from Admission.
- It drops the "public format" promise, which AGENTS.md "Stage"
contradicts, and keeps the rule that a reader drops fields and kinds it
does not recognise.
- It states the exit-1 case.

**Page tests.**
- The captured log's `lf-note` anchors are now derived from the record
layout and compared with the page. When regenerated records shift lines,
the test fails and prints the values to use.
- The verb-table test now compares the Unit and Record columns as well
as tag and verb.

**Page prose.**
- The reports and follow sections are cut to one sentence of mechanism
each, plus a link to the rule, so they no longer copy `packages.md` and
`events.md`.
- The eyebrow says "how it works".
- The Layers table no longer uses "envelope". It names what the door
adds, and it lists the log's kinds by group.

**Tests.** Everyday suite: 1359 passed. `scripts/site.py` builds 84
pages. `leaf version check --render` is clean in light and dark.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

> _This was written by Claude Code on behalf of max-sixty_

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Sep 24, 2026
…rb's writer once (#1101)

This finishes cut-overs that #1076, #1082 and #1091 left half done, as
found in a review of those PRs.

**`meaning.scope` replaces `meaning.document`.**
- Before, "document" named two shapes: the stored `"page" | "thread"`
and the `{kind, revision}` identity that requests, lifecycle seats and
the runtime use.
- Admission now stores `meaning.scope`.
- One helper, `events.document_identity(scope, revision)`, builds the
identity. `event_document`, admission's request check and the served
request readings all use it. The two direct reads of
`meaning["document"]` now go through it too.
- *Contract:* the `$events` meaning schemas and `handling` `when`
clauses, `events.md`, the seed logs, three snapshots and the delivery
sample in `how-it-works.html` are updated. Each snapshot diff is only
the rename.

**One word for deferred payloads.** The contract already said
`records.deferred`. The door and the API now say it too:
- `data_fragment` → `deferred_value`;
- `/api/data` → `/api/deferred`;
- `loadDataFragment` → `loadDeferred`;
- the error strings;
- `packages.md` and `page-storage.md`.

**The writer is resolved once.**
- In Python, `state_specs(entry, writer=…)` filters by writer, and
`verb_writer(spec)` answers for one verb. The five call sites that
restated "absent means user" use them.
- In the browser, `registry.adoptRegistry()` sets `writer` on every
`x-state` verb when the vocabulary arrives, so `stateSpecs`, widgets and
the command hub read one value.

**Created children.**
- `gesture_words` and the version gate take a created child's tag from
`meaning.creates` rather than re-deriving it.
- `passages.shown_words` is now the one reading of a created child's
`x-text-format`, used by passage capture, the gate and gesture wording.

**`example_data.captured_value`** refuses a `lines` range on a
`unified-diff` capture instead of silently ignoring it.

**The event-log page.** Its captured records are regenerated for
`scope`, the note anchors follow them, and the note on `meaning` names
`scope`.

**Tests.** Everyday suite on the merge with main: 1364 passed, and one
failure under parallel load that passed alone. `npm run test:runtime`:
91. `check:browser` clean; `test:browser` 64. A nightly subset over
diff, data, deferred, request, receipt, create, writer and report passed
303.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

> _This was written by Claude Code on behalf of max-sixty_

---------

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