Repository navigation
Keep a recovered thread's identity when its opening log event is lost - #1237
Merged
Merged
Conversation
A torn opening event leaves the first surviving reply as the thread root, but the thread remains keyed by the missing parent's ID. Keep that ID in the recovered root and use the surviving message as its browser presentation. The Threads attention filter now finds the open Ask on the same identity. The torn-log browser case now asserts the recovered card ID and the user attention count.
max-sixty
pushed a commit
that referenced
this pull request
Sep 26, 2026
The [nightly run](https://github.com/max-sixty/leaf/actions/runs/36263488351) failed in four browser cases. The recovered-thread case was fixed by #1237 and passes on current main. This PR updates the other three tests to match the behavior they intend to check: - A narrower Threads panel reflows its rows, so its numeric scroll offset changes even while the focused thread remains visible. The test now checks the retained thread and an interior, visible reading place. - Passage travel centers a mark in the usable landing band between the banner and shortcut bar. The test measures that band rather than the full viewport. - The `t` walk selects the next thread, then `c` focuses that thread's reply box. The test checks that box rather than the first box in the list. All four failed cases pass on the current main plus this change (`uv run pytest` with their node IDs, `-q -n0`); `uv run pre-commit run --files tests/test_render_controls.py tests/test_render_projection.py` also passes. --------- Co-authored-by: leaf-agent <[email protected]>
max-sixty
added a commit
that referenced
this pull request
Sep 27, 2026
…ning message takes replies (#1260) A thread's `id` is now its one identity in the runtime, and its `root` is a real message. Before this, the user could not reply to or resolve a thread whose opening log line was torn: the append door refused both with `unknown parent`. **The bug.** When a torn line loses a thread's opening comment, `build_threads` keeps the thread under the lost id. #1237 made the thread read correctly by giving the surviving reply a copy of the lost id as its root (`{**reply, "id": parent}` in `events.py`, and the same fallback in `thread/model.js`). The runtime keyed threads on `root.id`, so that made attention and the card id line up. But the root is also what a reply or resolve addresses as its `parent`, and the lost id names no message. So the panel drew the thread, and then the append door answered 400 to every reply and resolve in it. `test_a_panel_reads_a_log_that_lost_the_message_a_reply_answers` now replies and resolves in such a thread and checks that both land with `parent: "tv-kept"`. On main the reply is refused. **One identity.** - `build_threads` gives each thread an `id` field. For a torn thread, `root` is the surviving reply under its own id, the same record as `msgs[0]`. The served state now carries `id` from the fold instead of adding it separately, and `thread_digest` reads it. - The runtime keys every thread on `thread.id`: placement and marks (`anchor-paint`, `drawing-paint`, `placement`, `surfaces`, `thread-list`), travel and reveal (`anchor-travel`, `narrowing`, `margin-projection`), attention and workflows (`application.ts`, `thread/model.js`), news (`semantic-news`), frozen message documents (`state-application`), holds (`presentation`, `heldBy`), and card ids. `root.id` is read only where a message is meant: the `parent` of a reply or settlement, and a thread's turns. - `threadNames` in `thread/model.js` maps every name that reaches a thread to it: its id, each message's id, and each pending id this tab sent. `foldThreads` uses it to attach pending replies and settlements. The publisher uses it to find which thread a local or refused reply belongs to. That replaces `message.parent` used as a thread id, and the separate `PENDING + root.attempt` lookup for recovery. - The thread card's model carries `root` (the message that replies and settlements address) beside `id`. `wireReply` takes the draft key and a `parent` reader instead of a stand-in thread object, and `settleThread` takes `parent`. **Selectors.** `thread/selectors.js` now exports `THREAD` (`.lf-thread, .lf-page-thread`), and `SAYS_IN` is built from it. `thread/replies.js`, `thread/landing.js` and `thread/focus.js` spelled those selectors out; they now import them. **Contract.** `references/packages.md` now says `openThread` takes the Thread's `id`, that `heldBy` is a Thread id, and that `root` can differ from `id`. The Thread-filter widget test from #1257 opens threads by `thread.id`. **Tests.** Thread fixtures in `application.test.mjs` and `tests/runtime/` now carry the served `id`. A new publisher test covers a torn thread: its Ask attention, the subject of a pending reply's workflow, and recovery after a refused reply, all under the lost id. With `threadOf` reverted to `message.parent`, that test fails. The Python torn-thread test checks that `id` is the lost id and `root` is `msgs[0]`. Helpers that looked up served threads by `root.id` (`model_folds.threads`, `test_read_state`, `test_interact_session`, `test_render_pages`) now use `id`. For every thread whose opening message survives, `id == root.id`, so nothing moves outside the torn case. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The nightly run failed because a torn opening log event left a recovered thread keyed by the missing message ID while its exposed root carried the first surviving reply's ID. The open Ask was attached to the missing ID, so the Threads filter showed “You (0)” despite the Ask being visible.
Keep the missing opener's ID as the recovered thread's identity, and use the first surviving reply for its displayed content. The browser regression now checks both the recovered card ID and “You (1)”.
Verified with
uv run pytest tests/test_render_threads.py -q -n2(105 passed), the targeted session attention tests (2 passed),npm run test:runtime(125 passed), andnpm run check:browser.