Skip to content

Restore a superseded answer's thread on retraction, and sample threads as their log leaves them - #2515

Merged
max-sixty merged 4 commits into
mainfrom
server-owned-readings
Oct 12, 2026
Merged

max-sixty merged 4 commits into
mainfrom
server-owned-readings

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Two follow-ups from #2480, both bugs that were already on main.

A version note that brings back a superseded answer is filed under that answer's thread. When a note retracts only the action that had replaced an answer on a widget, the answer wins again and build_threads closes its thread again. thread_memberships, which wait delivery and the browser's held news read, never filed the note under that thread, so neither saw it. Memberships now track every standing action per widget coordinate and, when a note retracts the winner, file the note under the thread the restored winner answers. Standing answers are counted per thread, so an action joins the distinct threads at its coordinate in constant time: 16k actions at one coordinate fold in about 20 ms, against about 3.5 s on main.

A sampled child page starts with its threads as the source log leaves them. sample_events copies selected threads into a child page with one revision, and got that wrong three ways:

  • It passed SourceDocument.within (id → the record of the lf-* element holding it) where action_rests_on expects enclosing ids, so an action's declared dependencies never counted. The attribute is now holders; InitialPageView.within had the same mix-up and now reads enclosing_ids too.
  • It rewrote every copied event to revision 1, notes included, so nothing a later version retracted stayed retracted in the child. Retractions are now applied before copying: retracted actions, notes, and undos of anything left behind stay out.
  • It copied only events filed under a selected thread, so an action that answered nothing but wins again once the answer superseding it is retracted was lost. Every surviving action at a coordinate a selected thread acted at is now copied.

No shipped sample log holds a restating note, and the regenerated corpus is unchanged.

Tests: a restored-answer case in test_a_gesture_at_a_coordinate_reaches_only_the_answers_still_standing_there, and test_a_sampled_thread_starts_as_its_source_log_leaves_it; each fails with its part of the fix reverted.

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

max-sixty and others added 2 commits October 11, 2026 23:07
…s as their log leaves them

A version note that retracted only the action superseding an answer gave
the coordinate back to that answer, and `build_threads` closed its thread
again, but `thread_memberships` never filed the note under that thread,
so wait delivery and held news missed it. Memberships now track every
standing action per coordinate and, when a note retracts the winner,
file the note under the thread the restored winner answers. Standing
answers are counted per thread, so an action joins the distinct threads
at its coordinate rather than every earlier answer there: 16k actions at
one coordinate fold in ~20 ms, against ~3.5 s before.

`sample_events` copied a child page's threads wrong in two ways. It
passed `SourceDocument.within`, which maps an id to the record of the
lf-* element holding it, where `action_rests_on` expects enclosing ids,
so an action's declared dependencies never counted; that attribute is now
`holders`, and `InitialPageView.within`, which had the same mix-up, reads
`enclosing_ids` like `sample_events`. And it rewrote every copied event
to revision 1 with the notes that retracted them, so nothing stayed
retracted in the child. A child has one revision, so retractions are now
applied before copying: retracted actions, notes, and undos of what is
not copied stay behind, and every surviving action at a coordinate a
selected thread acted at is copied, so the child folds the parent's
winner there. No shipped sample log holds a restating note, and the
regenerated corpus is unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit 7d8e6a3 into main Oct 12, 2026
2 checks passed
@max-sixty
max-sixty deleted the server-owned-readings branch October 12, 2026 07:53
max-sixty added a commit that referenced this pull request Oct 12, 2026
… winner changes (#2603)

Four readers worked out which action wins a widget coordinate: the
projection fold, `build_threads`, `thread_memberships`, and sample
selection through memberships. This gives that rule one home,
`events.Standing`, and makes the step-by-step reader linear.

**The reading.** An action stands from admission until an undo withdraws
it or a version note retracts what it rests on, and the latest standing
action wins, including one answering nothing. `build_threads` and the
projection fold admit the log's actions with its whole floors and
withdrawals. `thread_memberships` walks the log instead, handing undos
and notes to `withdraw` and `restate` where they fall; each step reports
a `Change` only where the winner moved.

**Memberships are now exact.** An event files under the threads it
names, the membership of the gesture an undo takes back, and the answers
of the winner before and after each change it causes. Before, a later
action joined every earlier answer still standing at its coordinate, so
it could release held news for an answer it did not unseat; a note now
files only under threads whose closure it changes. Sample selection
loses nothing, since #2515 copies whole coordinates.

**Cost.** A note reaches the actions resting on what it restates through
an index, and each coordinate keeps its actions in an `OrderedDict`,
whose tail stays constant to reach after removals. 64k actions at one
coordinate, each undone newest- or oldest-first, take about 0.4 s.

**Tests.**
`test_every_change_to_a_threads_resolution_reaches_its_membership`
checks, over every three-step history of answers, non-answers, undos and
notes at one coordinate, that each thread whose resolution
`build_threads` changes is in the event's membership; the code before
#2515 fails it. A case pins that undoing an answer another has
superseded files only under its own thread. Across 28,561 four-step
histories, `build_threads` matches the previous code and no note
over-includes a thread.

> _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 Nov 27, 2026
…s word the page has moved past

A version that restates an element now takes back every action resting
on it together with the earlier decisions each of those had replaced at
its coordinate (`InForce`), so no replaced decision comes back to decide
the widget. What a user sees differently: a pick the user replaced, or
an accept or reject they superseded, no longer returns when the agent
restates its replacement, and the question asks again with nothing
picked; a board card whose destination column is restated falls back to
its markup place rather than to its previous move. This reverses #2515's
rule that a note retracting only an answer's superseder gives the
coordinate back to that answer; that PR gave no product reason, and
SOUL.md keeps a choice effective until the user changes it. Every reader
of liveness now reads `InForce`: served undo candidates read the
projection's `in_force`, and `sample_events` admits the log through it.

Two ways a widget's kept facts could be overridden by a stale word are
closed. A gesture made on a version older than the one the widget's kept
facts were said on leaves those standing (`obligations.widget_facts`),
as a tab still on v1 pressing Done no longer answers a question v2
reopened. A `facts` event now names the seq of the reading it was worked
out from (`through`), and admission refuses it as `stale-facts` once a
gesture or another word on the widget landed after that reading, so a
word sent just before a press can't land after it and reopen the
question. A tab says a refused or unreached word again at its next
reading.

module-state.md points at lf-options' `answered` rather than copying it,
and How it works says a version asks again once a tab shows it.

> _This was written by Claude Code on behalf of max-sixty_
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