Skip to content

List what happened in the order it happened, never by id - #46

Merged
wu-sheng merged 1 commit into
mainfrom
order-by-position
Sep 26, 2026
Merged

wu-sheng merged 1 commit into
mainfrom
order-by-position

Conversation

@wu-sheng

Copy link
Copy Markdown
Member

Why

A stream's opened_by, the relations list and a node's edges were ordered by relation id. Relation ids end in hashes, so a workflow launch listed the streams it started in hash order. Horizon shows a step's first starts edge as the stream to open, and its inspector lists them in this order. On 94 real conversations, 130 of the 150 steps that started several streams led with a stream other than the one their run named first.

What changes

  • Inside one stream or one workflow run, position decides: the record's seq, row, block.
  • Across streams, time decides. A position means nothing there, since a child's file can land before its parent's.
  • The two are combined as a merge (internal/view/order.go). Each lane keeps its own position order, and the lanes are merged by taking, each time, the lane whose next item is earliest, a timed item before an untimed one. A single comparison that decides some pairs by position and others by time is not transitive, as the talk order found.
  • A relation is placed at the earliest record its evidence names, by the same rule. Each stream's origins are ordered on their own, and an origin that is not listed takes no part in the order.
  • Workspace changes and tool executions stay in time order. Records of one instant are ordered by where each was read, no longer by id or by how the time is written. compareTimes now compares instants only.
  • An id decides only between items that one record supports, such as two relations with the same evidence.
  • Not changed: unresolved and the other sessions stay ordered by id; unresolved entries carry no position, and session nodes are the only nodes without one.
  • Removed: the unused Conversation.Edges.

No key changes; asz.view stays 1.0.

Measured

On the 94 real conversations (65 Claude Code, 8 MCP, 21 LangChain), every document has the same content as on main. The order changed in 57. The documented example changes only in order.

Tests

  • TestInOrderMergesLanesByTime: position inside a lane even where times disagree, time across lanes, lane heads of one time, untimed and unlanded items.
  • TestAStreamsOriginsKeepOneOrder, rewritten: origins by position, with ids in the other order.
  • TestEachStreamsOriginsAreOrderedOnTheirOwn: one stream's origins are not moved by another stream's, or by an origin that is not listed.
  • TestAStepsEdgesAreInTheOrderTheyHappened: a launch's edges in its run's order; evidence in two lanes placed by time.
  • TestRecordsOfOneTimeAreInTheOrderTheyWereRead: two spellings of one instant, times that do not parse, the runtime's change first.

17 mutations of these rules were each caught by a test. make check passes.

A stream's origins, the relations list and a node's edges were ordered
by relation id. The ids end in hashes, so a workflow launch listed the
streams it started in hash order. On 94 real conversations, 130 of the
150 steps that started several streams led with a stream other than
the one their run named first.

They are now ordered by where things happened. Inside one stream or one
workflow run, a record's position decides: seq, row, block. Across
streams, time decides, since a child's file can land before its
parent's. The two are combined as a merge: each lane keeps its position
order, and the lanes are merged by time. A single comparison that
decides some pairs by position and others by time is not transitive.

A relation is placed at the earliest record its evidence names, by the
same rule. Each stream's origins are ordered on their own, and an
origin that is not listed takes no part in the order.

Workspace changes and tool executions stay in time order. Records of one
instant are now ordered by where each was read, not by id and not by
how the time is written.

An id decides only between items one record supports. On the 94
conversations the content is unchanged; the order changed in 57.
@wu-sheng wu-sheng added this to the 0.6.0 milestone Sep 26, 2026
@wu-sheng wu-sheng added the enhancement New feature or request label Sep 26, 2026
@wu-sheng
wu-sheng merged commit 130601c into main Sep 26, 2026
24 checks passed
@wu-sheng
wu-sheng deleted the order-by-position branch September 26, 2026 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant