feat: message tree parser with defensive timestamps #40

Merged
forgejo-bot merged 3 commits from feature/8_message_tree_parser into main 2026-10-16 15:33:57 +00:00
Owner

Message-tree parser for Open WebUI chats (ticket #8, PO decision confirmed in comment 2236):

  • Message now models parentId/childrenIds and parses timestamps defensively (ts_defensive: < 1e12 = seconds, >= 1e12 = milliseconds; serialization always writes seconds)
  • MessageTree::active_thread() walks backwards from currentId with cycle protection and orphan tolerance
  • Chat custom deserialization accepts both the history-tree shape and the legacy chat.messages[] fallback (list order trusted for linked entries, sequential relink otherwise)
  • 13 new tests: multi-turn ordering, branch-following, legacy relink, orphan stop, cycle termination, mixed-unit normalization

All checks green: build, 43/43 core tests, clippy -D warnings, fmt.

Closes #8

Message-tree parser for Open WebUI chats (ticket #8, PO decision confirmed in [comment 2236](https://code.hoppe-dev.eu/OpenCode/Arachne/issues/8#issuecomment-2236)): - `Message` now models `parentId`/`childrenIds` and parses timestamps defensively (`ts_defensive`: < 1e12 = seconds, >= 1e12 = milliseconds; serialization always writes seconds) - `MessageTree::active_thread()` walks backwards from `currentId` with cycle protection and orphan tolerance - `Chat` custom deserialization accepts both the history-tree shape and the legacy `chat.messages[]` fallback (list order trusted for linked entries, sequential relink otherwise) - 13 new tests: multi-turn ordering, branch-following, legacy relink, orphan stop, cycle termination, mixed-unit normalization All checks green: build, 43/43 core tests, clippy -D warnings, fmt. Closes #8
feat: parse message trees with defensive timestamps
All checks were successful
CI / ci (pull_request) Successful in 3m6s
7f856fe26c
Implements the full message-tree parser (#8): history.messages dict
with parentId/childrenIds linkage and camelCase currentId, legacy
fallback to flat chat.messages[] (sequential relinking when entries
carry no linkage, trusted order when they do), cycle guard and orphan
tolerance in active_thread(), and a single ts_defensive serde helper
(seconds < 1e12, milliseconds above - PO decision in #8) normalizing
to UTC while always serializing seconds.

Co-Authored-By: OpenCode <opencode@noreply.code.hoppe-dev.eu>
Merge main into feature/8_message_tree_parser to pick up triage fix
All checks were successful
CI / ci (pull_request) Successful in 4m33s
PR Triage / Label and schedule auto-merge (pull_request) Successful in 14s
184551ec77
forgejo-actions scheduled this pull request to auto merge when all checks succeed 2026-10-16 14:51:05 +00:00
OpenCode changed title from [8] feat: message tree parser with defensive timestamps to feat: message tree parser with defensive timestamps 2026-10-16 15:21:57 +00:00
forgejo-actions canceled auto merging this pull request when all checks succeed 2026-10-16 15:22:01 +00:00
forgejo-actions canceled auto merging this pull request when all checks succeed 2026-10-16 15:22:02 +00:00
forgejo-actions scheduled this pull request to auto merge when all checks succeed 2026-10-16 15:22:02 +00:00
Merge main to pick up shared triage workflow
All checks were successful
PR Triage / Triage pull request-1 (pull_request) Successful in 5s
PR Triage / Triage pull request (pull_request) Successful in 0s
CI / ci (pull_request) Successful in 4m41s
fc32709e63
forgejo-bot canceled auto merging this pull request when all checks succeed 2026-10-16 15:33:54 +00:00
forgejo-bot scheduled this pull request to auto merge when all checks succeed 2026-10-16 15:33:54 +00:00
forgejo-bot deleted branch feature/8_message_tree_parser 2026-10-16 15:33:57 +00:00
Sign in to join this conversation.
No description provided.