Skip to content

Name LangChain files for their header's time, and keep a stream's origins in one order - #45

Merged
wu-sheng merged 1 commit into
mainfrom
view-stable-origins
Sep 26, 2026
Merged

wu-sheng merged 1 commit into
mainfrom
view-stable-origins

Conversation

@wu-sheng

Copy link
Copy Markdown
Member

The OAP's Java view builder must produce the same asz.view document as asz for the same files. Comparing the two on real landed files found two bugs in asz itself:

  • A LangChain file was named apart from its header's time. The LangChain collector read the clock once per pass for the file's name, and once per file for the collected time at in its header. A server that stores files by session and sequence names a file from its header, as the OAP does, so it named every LangChain file differently from asz. On a real root, all 50 LangChain files differed, by up to 99 milliseconds. None of the 7,185 Claude Code files did. One time now serves the pass, as in every other adapter. Files landed before this keep their names, because landed files are never rewritten.
  • A stream's opened_by changed from one read to the next. It was built by ranging over the fold's relations, a Go map. So a stream with several candidate origins listed them in a different order on each read: five reads of a real conversation gave three orders. They are now in relation id order, as the relations list is.

Tests:

  • TestAFileIsNamedForTheTimeItsHeaderSays lands a real LangChain capture with a clock that moves on every read. It fails with either half of the collector fix undone, the transcript files or the body files.
  • TestAStreamsOriginsKeepOneOrder renders a stream with three origins 50 times. It fails on the first render without the sort.

After both fixes, the OAP's documents equal asz's on every real conversation whose files were landed after the fix:

  • 8 real Claude Code 2.1.282 sessions with calls to real MCP servers, recorded by the plugin;
  • 21 LangChain conversations from the real client captures.

On the older real root, 60 of 65 are identical. The other 5 differ only in the names of LangChain files landed before the fix.

make check passes.

…gins in one order

Both were found by comparing the OAP's asz.view documents with asz's own on
real landed files.

- The LangChain collector read the clock once per pass for a file's name and
  once per file for its header's collected time. A server that stores files
  by session and sequence names them from the header, so it named every
  LangChain file apart from asz: all 50 on a real root, by up to 99
  milliseconds. None of the 7,185 Claude Code files differed. One time now
  serves the pass, as in every other adapter.
- A stream's opened_by listed its origins in the order a Go map gave them, so
  a stream with several candidate origins changed from one read to the next.
  On a real conversation whose stream had three, five reads gave three
  orders. They are now in relation id order, as the relations list is.
@wu-sheng wu-sheng added this to the 0.6.0 milestone Sep 26, 2026
@wu-sheng
wu-sheng merged commit 80f6418 into main Sep 26, 2026
24 checks passed
@wu-sheng
wu-sheng deleted the view-stable-origins branch September 26, 2026 02:55
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.

1 participant