Skip to content

fix(memory): page meetings by cursor and search their summaries - #494

Open
Lumea-art wants to merge 1 commit into
simplexai-labs:mainfrom
Lumea-art:feat/meetings-keyset-pagination
Open

Lumea-art wants to merge 1 commit into
simplexai-labs:mainfrom
Lumea-art:feat/meetings-keyset-pagination

Conversation

@Lumea-art

@Lumea-art Lumea-art commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

What and why

browseMeetings paged by array offset. A meeting finalized, hidden, or removed between two requests shifted every later page: the reader repeated one meeting, and when a meeting with a lower position disappeared it skipped one. The Web loads every page and de-duplicates by id, so a repeat disappeared quietly while a skip lost a meeting from the list.

This pages by the key the list already sorts on: started_at DESC, id. The cursor stores the last meeting's start and id, so a page starts after a row rather than after a count. A numeric cursor from an older server is still answered as an offset, and an unknown cursor is rejected.

The Meetings search box matched the meeting name, date, time and recording file name. List entries now also carry the first 240 characters of the published summary, and the search matches it, so a meeting is findable by what was discussed. The full summary stays on the entry request.

Review fixes (rebased onto 1c35212)

  • P2 — MemoryEntryPage.next_cursor now refs components/common.yaml#/components/schemas/Cursor instead of the digit-only pattern; regenerated the Go and TypeScript contracts.
  • P3 — removed the now-dead includeContent parameter from readMeetingSummary and its call site.
  • P3 — summaryExcerpt strips only leading list markers (/^\s*[-*+]\s+/gmu) and keeps hyphens inside words. Added a test with Follow-up on Q3-plan so the Web substring search still finds hyphenated terms.
  • Wording now says "first 240 characters" in the README, tests and this description instead of "opening sentence".

How it was verified

  • meeting-browser.test.ts (18): removal and insertion between pages, legacy numeric cursor, invalid cursor, summary excerpt, hyphenated terms.
  • server-http.test.ts (6): paging through /internal/v1/memory/entries.
  • pnpm --filter @linger/node-services typecheck; pnpm contracts:generate and contracts:verify; eslint/prettier on the changed files.

Boundary

  • The API shape is unchanged; a meeting row's summary now holds the excerpt instead of an empty string.
  • The cursor is opaque because it is page data. An older Node Services process rejects the new format during a mixed-version rollout; Node Services normally runs as one process, and the new code still accepts numeric cursors.
  • perf(memory): serve the memory browser from an incremental catalog #433 relaxes the same request-cursor line for the memory catalog. The reviewer asked to land perf(memory): serve the memory browser from an incremental catalog #433 first; I will rebase this PR on it once merged, and the shared contract line will resolve to one change.
  • Search stays client-side over the pages the Meetings tab already loads; no new query parameter.

Context

No open issue was available for this: every matching report already has a PR or waits on an external component. It follows the same pagination problem the memory catalog fixed for daily and weekly reports in #433.

@linger-review linger-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve with nits (1 P2, 2 P3)

Scope: base main, merge base b64e183c. 1 commit, 8 files reviewed. Loaded the coderbook, ponytail-review and karpathy-guidelines skills. This review ran in a separate session.

Findings

P2

The response next_cursor pattern still allows only digits (contracts/openapi/node-services-internal/openapi.yaml:1741)

  • Problem: The PR relaxes only the cursor query parameter (line 656). MemoryEntryPage.next_cursor in the same contract still says pattern: ^[0-9]{1,9}$. browseMeetings now returns a base64url JSON cursor such as eyJpIjoi... (meeting-browser.ts:243), so the contract contradicts what the server actually sends.
  • Why nothing fails today: No layer checks responses against the schema at runtime. TeamHub's memoryclient decodes JSON200 as-is (apps/teamhub/internal/memoryclient/client.go:186-191), and the generated types don't carry the pattern. Any client, mock server or contract test that does check responses would reject every meeting page that has a next page.
  • Fix: Point next_cursor at components/common.yaml#/components/schemas/Cursor, which is the opaque 1-1024 character cursor the public MemoryEntryPage already uses (contracts/openapi/components/memory-browser.yaml:85). Or relax it to the same pattern as the request. Then regenerate.

P3

includeContent is now dead (apps/node-services/src/memory/meeting-browser.ts:100)

  • Problem: browseMeetings was the only caller that passed false. It now passes a literal true (line 212), and the tests use the default.
  • Fix: Delete the parameter, the ternary at line 140 and the true argument.

The excerpt turns every hyphen into a space (apps/node-services/src/memory/meeting-browser.ts:79)

  • Problem: .replace(/[*_>#-]/gu, " ")also rewrites hyphens inside words. "follow-up" becomes "follow up" and "Q3-plan" becomes "Q3 plan". A user who types the word as it appears in the summary gets no match, because the Web search uses a plain substringincludes (meetings-panel.tsx:137`).
  • Fix: Strip only list markers at the start of a line (/^\s*[-*+]\s+/gmu) and keep hyphens inside words.
  • Also: The excerpt is the first 240 characters of the body, not the "opening sentence" that the PR body, README and test name describe. That's fine, but the wording could match the code.

Verified as fine

  • Sort order and cursor agree. Both the in-memory sort (meeting-browser.ts:148-152) and the cursor comparison (meeting-browser.ts:64-68) use started_at desc, then id.localeCompare, so the cursor and the slice agree even where Postgres collation would order ids differently (ready-meetings.ts:39). Two rows with the same millisecond fall back to the id tie-break on both sides.
  • Removal and insertion between pages. A removed cursor row still resolves to the next row after it, and a newly inserted newer row lands before the cursor. The new tests in meeting-browser.test.ts cover both cases.
  • Legacy cursors. A legacy numeric cursor can't be mistaken for the new format: base64url-encoded JSON always starts with eyJ. Invalid cursors throw TypeError, and server.ts:85/203 maps that to 400.
  • Other memory kinds still validate. Relaxing the shared list-request regex (server.ts:717) does not loosen daily and weekly paging, because parseCursor still demands digits (memory-browser.ts:180-185).
  • No extra I/O for the excerpt. The Wiki pages were already loaded for the selected rows (meeting-browser.ts:168-180), so building the excerpt is pure computation. The entry request still returns summary: "" and the full content, capped at 200k characters.
  • The new summary reaches no other UI. On the Web, entry.summary appears only in the Meetings search haystack (meetings-calendar.ts:65, meetings-panel.tsx:137). wiki-graph-daily-panel.tsx:356 renders only daily and weekly entries. TeamHub passes the field through unchanged.
  • Contracts and docs. contracts/generated doesn't encode the pattern, so regeneration produces no diff. The memory README is updated. No CJK in added lines or in the commit message.

Process notes

  • One commit, with no merge or fixup commits. The merge state is BLOCKED while CI and approval are pending.

CI

  • Passing: changes, repository-gate, check (contracts), check (teamhub-cli), web tests (2/2).
  • Still running at review time: web tests (1/2), web-static.
  • I did not run any tests locally.

Automated review by Claude Code


Automated review of 1fe9041 by Claude Code.

@DolphinMiner

Copy link
Copy Markdown
Contributor

Nice improvement—a few small fixes before merging (let's land #433 first and rebase):

Relax MemoryEntryPage.next_cursor in contracts/openapi/node-services-internal/openapi.yaml to match the opaque cursor.
Remove the now-dead includeContent parameter from readMeetingSummary.
Keep in-word hyphens in summaryExcerpt (strip leading list markers like /^\s*[-*+]\s+/gmu instead of all -), so hyphenated terms stay searchable.

@Lumea-art
Lumea-art force-pushed the feat/meetings-keyset-pagination branch from 1fe9041 to 57bf0eb Compare November 26, 2026 15:28
@Lumea-art

Copy link
Copy Markdown
Contributor Author

Thanks — all three are fixed in the new head, rebased onto 1c35212b:

  • P2: MemoryEntryPage.next_cursor now refs components/common.yaml#/components/schemas/Cursor (the opaque 1–1024 cursor), and I regenerated the Go/TypeScript contracts.
  • P3: removed includeContent from readMeetingSummary and its only true argument.
  • P3: summaryExcerpt now strips only leading list markers (/^\s*[-*+]\s+/gmu) and keeps in-word hyphens. Added a test where the published summary says Follow-up on Q3-plan, so the Web substring search can still find it. The wording is now "first 240 characters" in the README, test name and PR description.

meeting-browser (18) and server-http (6) pass, and contracts:generate/verify are clean.

On ordering: #433 is still open, so I have not merged or force-rebased on it. Once it lands I'll rebase this PR; the only overlap is the request cursor pattern in server.ts and the internal contract, which will collapse to one change.

@linger-review linger-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve with nits (1 P3)

Scope: follow-up on 1fe9041. Base main, merge base 1c35212b; 1 commit, 10 files reviewed (generated contracts checked against the OpenAPI source). The PR was rebased since the previous review, so 1fe9041..HEAD includes unrelated main changes; I re-reviewed the full merge-base diff instead. Helper skills: coderbook, ponytail-review and karpathy-guidelines were not loaded; the review followed the linger-pr-review checklist directly. Ran in a separate session.

Previous findings

  • Resolved: response next_cursor limited to digits. MemoryEntryPage.next_cursor now refs common.yaml#/components/schemas/Cursor (contracts/openapi/node-services-internal/openapi.yaml:1740), and the Go and TS contracts were regenerated.
  • Resolved: dead includeContent parameter. It is removed from readMeetingSummary and its call site (apps/node-services/src/memory/meeting-browser.ts:141, :208).
  • Resolved: the excerpt replaced every hyphen. Only leading list markers are stripped now (meeting-browser.ts:82), and the new test keeps a hyphen inside a summary word for search covers it.

Findings

P3

  • apps/node-services/src/memory/meeting-browser.ts:84: body.length > 240 ? \${body.slice(0, 240)}…`returns 241 characters. BothMemoryEntry.summaryschemas declaremaxLength: 240 (contracts/openapi/node-services-internal/openapi.yaml, contracts/openapi/components/memory-browser.yaml:61`). Any summary longer than 240 characters therefore produces a list entry that breaks the contract. Nothing validates responses at runtime today, so nothing fails yet, but a future response validator or a strict client would reject the page. Fix: slice to 239 before adding the ellipsis, and add an assertion in the existing excerpt test.

Verified as fine

  • Cursor ordering. ready-meetings.ts:39 orders by started_at DESC, id. browseMeetings re-sorts in memory with the same comparator that meetingCursorStart uses (meeting-browser.ts:150-155, :64-68), so the page and the cursor agree even if localeCompare and the DB collation order differ. A removed cursor row still resumes strictly after its key, so a page neither skips nor repeats a row.
  • Legacy and hostile cursors. Numeric cursors still page by offset (:47-48). An encoded cursor always starts with eyJ, so it never collides with the digit form. Bad base64 or JSON, a wrong shape and an invalid date all throw TypeError, including JSON null (destructuring it throws). server.ts:85 and :203 map that to 400.
  • End-to-end cursor path. TeamHub passes the cursor through unchanged (apps/teamhub/internal/app/handlers_personal_wiki.go:78-81, internal/memoryclient/client.go:175). The public parameter is already the opaque Cursor (max 1024), which matches the relaxed internal pattern (server.ts:717).
  • No new I/O on the list path. readMeetingSummary was already called for every selected row (meeting-browser.ts:206-213). Only the excerpt is new, and the full content stays on the entry request (:221-223).
  • Web. summary flows through meetingsByDate (apps/web/src/features/memory/meetings-calendar.ts:65) into the client-side search string (meetings-panel.tsx:137). The panel test covers it.
  • The README was updated. No CJK in added lines or the commit message.

Process notes

  • None. Single commit, no merge commits; the commit author is linked to Lumea-art.

CI

All reported checks pass. check-node-services has no CI lane (scripts/check-plan.mjs:148), so I ran vitest run tests/memory/meeting-browser.test.ts tests/memory/server-http.test.ts locally: 24/24 passed. Merge state is BLOCKED (pending review), not behind.

Automated review by Claude Code


Automated review of 57bf0eb by Claude Code.

@Lumea-art
Lumea-art force-pushed the feat/meetings-keyset-pagination branch from 57bf0eb to 87e8443 Compare November 27, 2026 00:03
@Lumea-art

Copy link
Copy Markdown
Contributor Author

Fixed the 240-character cap in 87e8443c: the excerpt now slices to 239 before appending …, so it never exceeds MemoryEntry.summary's maxLength: 240. Added caps a summary at the contract's 240 characters, which publishes a 300-character body and asserts the list summary is exactly 240 characters and ends with the ellipsis. meeting-browser.test.ts is 19/19, and prettier is clean.

@linger-review linger-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve (0 findings)

Follow-up on 57bf0eb. Merge base 1c35212b, 1 commit, 10 files reviewed.

Resolved: summary excerpt was 241 characters, over MemoryEntry.summary maxLength 240 (apps/node-services/src/memory/meeting-browser.ts:84 now slices 239 + …; covered by "caps a summary at the contract's 240 characters" in tests/memory/meeting-browser.test.ts:358).

Verified as fine

  • Cursor and page use the same order: rows are re-sorted by started_at desc, id asc (meeting-browser.ts:149-153) and meetingCursorStart finds the first row strictly after the key, so a deleted or newly inserted row neither repeats nor skips a page (meeting-browser.ts:40-70).
  • The opaque cursor passes every hop: TeamHub's public route uses common.yaml Cursor (1–1024 chars, teamhub-api.openapi.yaml:2392) and forwards it unchanged (apps/teamhub/internal/memoryclient/client.go:175); Node accepts ^[A-Za-z0-9_-]{1,1024}$ (server.ts:717), which base64url output satisfies. Other kinds still reject non-numeric cursors (memory-browser.ts:180).

Process notes

  • main has moved to 6a511c15; the branch needs a rebase before it can merge.

CI: changes passed; the other checks were still pending at review time. I didn't run tests locally because this worktree has no dependencies installed.

Automated review by Claude Code


Automated review of 87e8443 by Claude Code.

Meetings paged by array offset, so a meeting finalized, hidden, or removed between two requests shifted every later page: the reader repeated one meeting or skipped one. The cursor now carries the last meeting's started_at and id, and a numeric cursor from an older server is still answered as an offset.

List entries also carry the first 240 characters of the published summary, so the Meetings search matches what was discussed and not only the name, date, time and recording file name. The full summary stays on the entry request. The internal response cursor is now the shared opaque Cursor, and summary excerpts keep hyphens inside words.
@Lumea-art
Lumea-art force-pushed the feat/meetings-keyset-pagination branch from 87e8443 to ba9b664 Compare November 27, 2026 00:12

@linger-review linger-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve (0 findings)

Follow-up on 87e8443: merge base 6a511c15, 1 commit, 10 files. git range-diff shows the patch is identical to the previous head; this push only rebased it. I still re-checked the assumptions across the whole PR.

Verified as fine

  • The cursor and the page share one order. browseMeetings sorts by started_at DESC, id with localeCompare, and meetingCursorStart uses the same comparison. A removed or newly inserted row therefore cannot shift or repeat a page, and a numeric cursor from an older server is still answered as an offset (apps/node-services/src/memory/meeting-browser.ts:41-68, :149-168).
  • The new cursor passes every hop. TeamHub copies cursor and next_cursor through without checking their format (apps/teamhub/internal/app/handlers_personal_wiki.go:79-88, :146-148). The public parameter is the shared Cursor schema (1–1024 chars, contracts/openapi/components/common.yaml:40). The internal contract and server.ts:717 now accept base64url.
  • The excerpt reaches the Web search. TeamHub forwards entry.Summary (handlers_personal_wiki.go:161), and the panel adds item.summary to the search haystack (apps/web/src/features/memory/meetings-panel.tsx:137). The excerpt comes from the wiki page the list already loads, so it adds no extra read.

CI: all checks pass (check (computer-go) jobs are skipped because the PR doesn't touch them). I ran no tests myself.

Automated review by Claude Code


Automated review of ba9b664 by Claude Code.

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.

2 participants