Skip to content

moooon

Motir

Vibe your whole project. Bring an idea — Motir's three AI layers plan it, track it, and ship it, end to end. You're looking at Motir, built in Motir.

  • Vibe Project
  • Open Source
  • AI Agent
  • AI Loop
1
requests
0
upvotes
145
planned
1,361
shipped

Motir · Work items

MOTIR-304Done

5.5.2 The "All" merged stream — comments + history interleaved by composite cursor (bounded two-source merge)

Estimate: 22m · Depends on: 5.5.1, 5.1.2

The merged tab's read: activityService.listAll(workItemId, { cursor, order }, ctx) interleaving the 5.1.2 comments read and the 5.5.1 history feed in true timestamp order.

The merge (bounded — finding #57): fetch ONE page from each source (comments cursor + revisions cursor, each take 20, same order), merge-sort by (timestamp, type, id), emit the first 20, and return a composite cursor carrying each source's position — the classic two-pointer merge over paged streams; never fetch-all-then-sort, never re-read consumed pages. Entries keep their native DTO (a comment entry IS the 5.1 comment DTO with its thread context flattened to the feed form the design specifies; a history entry IS the 5.5.1 entry) under a discriminated type. Comment-deleted revision entries appear in All (and History) exactly once — they are revisions, not comments; live comments appear as comments only (the verified comment-adds-not-in-History rule holds by construction).

Order + gating: both orders supported (the section toggle); view-gated; the same totalCount pair for the tab copy.

Acceptance criteria

  • listAll interleaves correctly across page boundaries (a seeded interleaving where the nth page boundary splits a same-minute cluster round-trips without loss or duplication — the composite-cursor property test); both orders work.
  • Each page issues exactly one bounded read per source (asserted); no fetch-all path exists.
  • Discriminated entries carry their native shapes; comment deletions appear once (as history); live comments never duplicate into history.
  • View-gated + 404 cross-workspace; pnpm test:coverage ≥90% incl. the boundary/duplication property cases.

Context refs

  • 5.5.1 (listHistory + entry DTOs); 5.1.2 (listComments — cursor take 20 + totalCount, the other source)
  • The verified All-tab merge behaviour in the Story 5.5 description
  • finding #57 (the bounded two-source merge requirement)