Skip to content

fix(cloud): salvage comment listing rows per-row - #731

Merged
Neonforge98 merged 2 commits into
developfrom
fix/tolerant-comment-listing-rows
Aug 6, 2026
Merged

fix(cloud): salvage comment listing rows per-row#731
Neonforge98 merged 2 commits into
developfrom
fix/tolerant-comment-listing-rows

Conversation

@Neonforge98

@Neonforge98 Neonforge98 commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Problem

Two cloud listing reads on the comments plane parsed all-or-nothing:

1. cloud_list_session_comments (z.array(CloudSessionCommentWireSchema)). Any of the following zod-failed the entire listing:

  • one structurally malformed row,
  • a row whose mentionedUserIds exceeds this client's outbound 50-cap (read-side .max(50) re-check),
  • a newer backend introducing a kind or resolution enum value this client doesn't know.

The atom layer then pins that session's comment pane in state:"error" with exponential retry — for every member, indefinitely, and the diagnostic names neither the row nor the field.

2. cloud_list_team_inbox_mentions — one malformed mention row blanked the whole Team Inbox page the same way.

This is the class the sessions listing already survives per-row (tolerant-record sweep, #698/#728); these were the remaining all-or-nothing reads on the sharing surface.

Fix (mirrors the sessions-listing idiom)

  • Both listings parse rows as z.unknown()[] + per-row safeParse: a bad row is dropped alone and the first casualty is named (id + first zod issue path/message) in a rate-limited warn.
  • kind/resolution get .catch(undefined): an unknown enum value degrades to its documented absent-field semantics ('user' / plain resolve) — the row survives.
  • Read-side .max(50) on mentionedUserIds removed; the cap stays enforced where it protects something (outbound request build, server RPC).
  • A malformed page envelope (unreadCount, cursors) still rejects outright — tolerance is per-row, not anything-goes.

Verification

  • Comments client: malformed row dropped alone (siblings survive), unknown kind/resolution degrade with row kept, 60-mention row kept on read.
  • Inbox client: malformed mention row dropped alone; malformed page envelope still rejects.
  • Suites: comments plane 95/95, inbox+comments clients 47/47. Repo typecheck + eslint clean.

Found by the escape-class audit (cross-version + adversarial-row lenses) over the session-sharing surface.

cloud_list_session_comments parsed all-or-nothing: one malformed row, a
mention list past this client's outbound cap, or a NEWER backend's
kind/resolution enum value zod-failed the whole listing, pinning that
session's comment pane in error-retry for every member with no way to
attribute the culprit.

Apply the tolerant-record rule the sessions listing already follows:
parse rows individually and drop only the bad one, naming the first
casualty (id + first zod issue) in a rate-limited diagnostic; degrade
unknown kind/resolution values to their absent-field semantics instead
of failing; stop re-checking the 50-mention cap on read.

Pre-commit hook ran. Total eslint: 18, total circular: 0
@Neonforge98
Neonforge98 force-pushed the fix/tolerant-comment-listing-rows branch from 033c1df to d31a008 Compare August 6, 2026 20:50
Same all-or-nothing class as the comments listing: one malformed mention
row zod-failed the whole cloud_list_team_inbox_mentions page, blanking
the Team Inbox instead of costing the one row. Parse rows individually,
name the first casualty, and keep rejecting a malformed page envelope
(unreadCount/cursor) outright.

Pre-commit hook ran. Total eslint: 18, total circular: 0
@Neonforge98
Neonforge98 force-pushed the fix/tolerant-comment-listing-rows branch from d31a008 to 515c5dc Compare August 6, 2026 21:28
@Neonforge98
Neonforge98 merged commit 63e1902 into develop Aug 6, 2026
3 checks passed
@Neonforge98
Neonforge98 deleted the fix/tolerant-comment-listing-rows branch August 6, 2026 22:27
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