Integrate message-anchored comments MVP - #1882
Conversation
7a5de35 to
9676053
Compare
|
Remediation follow-up for staging-blocking verifier
Recommendation: #1882 is ready for a fresh staging verification task. |
d31d2c3 to
a1fb44d
Compare
|
Remediation update for cross-session comment mutation 500 New head: Root cause: Cloudflare ProjectData DO RPC serialized Fix: normalize exact serialized comment not-found RPC strings in Tests/evidence:
Specialist review tracker:
Staging verification intentionally not performed by this agent per task instruction; ready for independent staging verification pinned to this new head once CI is green. |
|
|
Final independent staging verification PASS for pinned head 1749f79.\n\nEvidence:\n- deploy-staging.yml run 32566266288 completed successfully at headSha 1749f79: https://github.com/raphaeltm/simple-agent-manager/actions/runs/32566266288\n- Pre-deploy checks: PR head matched pinned SHA; checks terminal/green; .codex/config.toml absent from diff; #1878/#1879/#1880 open with mergedAt=null; unfiltered staging run list had no queued/in_progress contention before trigger.\n- Live app/API: authenticated once via token-login then reused storage state; created two distinct sessions in one project; created message-anchored thread, replied, resolved, reopened, reloaded/listed persistence; browser WebSocket receivers observed comment.thread.changed frames for create/reply/resolve/reopen without reload.\n- Former blocker: resolving session A thread through session B returned clean 404 {error: NOT_FOUND, message: Comment thread not found}; no 500/raw internals; session A thread remained unmutated and session B list did not disclose it.\n- Auth/regression: unauth protected API returned 401; /health returned 200; dashboard/settings loaded; no browser console errors. Navigation-aborted /api/t and route-change fetches were observed but no comment-related network failures.\n- Directive/UI: /send returned 202 and status sent with directive; desktop and mobile screenshots captured message badge/count, comment thread/reply/sent badge, directive content, no horizontal overflow. Artifacts are in verifier workspace /tmp/pr1882-verification/.\n- Observability/cleanup: pnpm quality:observability-noise passed (tool skipped unavailable telemetry/D1 checks); D1 cleanup proof active_nodes=0, verifier_active_tasks=0, verifier task statuses cancelled,cancelled,cancelled,cancelled, enabled platform cloud credential=1.\n\nNo merge performed. |



Summary
Primary integration PR for the message-anchored commenting MVP from idea
01M0JQB842XSJ3W172DYPB37HN.Primary branch/head
sam/execute-task-using-skill-2f0t46a1fb44d981ff7654a6b616a020d6f03ab422bc4dmainorigin/main728611b878086087a76b8f534af26b3db945e7b6Constituent PR heads integrated
These exact constituent heads were squash-applied so their commits are not ancestors of this primary branch. This is intentional: keep the constituent PRs open/unmerged and have the coordinator squash-merge this primary PR later.
sam/build-backendmultiplayer-constituent-pr-ys44492c980b159128de0e2a02bb639ba348e3735c7be7sam/build-mcpagent-directive-constituent-ekeztr63508d06a57fe2ba544f7449113dd599097369e7sam/build-production-web-ui-z72qrzbc252a91e0ab607569638081a940f1c8819be8afVerification on the integration branch:
Integration conflict and contract resolution
apps/api/src/routes/chat.tsso REST comment routes and directive routes are both registered.mainafter Add manual session sleep control #1881, preserving the manual session sleep controls and resolving the only conflict inapps/web/src/components/project-message-view/index.tsxby keeping both import sets.packages/shared/src/types/comments.tsinto a single message-only contract used by REST, MCP, WebSocket, and UI code. Author shape supports the integratedname/displayNameusage without adding file anchors.listCommentThreads,getCommentThread,createCommentThread,createCommentReply, andupdateCommentThreadStatus.getCommentThreadwrapper required by the integrated MCP/directive path.messageId,quote,clientMutationId{ thread }-> UI{ comment }/comments/:threadId/sendpath to call durablesendMessageCommentDirectivebefore returning the thread assent; delivery failure remains fail-closed.comment.thread.changedWebSocket events into the UI comment event cache path.Preflight and specialist evidence
032-message-comment-threads; comment writes/read models stay inside the DO; list queries are bounded and indexed by session/message/status sequence. No staging/deploy commands were run.Agent Preflight (Required)
Classification
External References
N/A: this integration does not change an external provider API; evidence came from the in-repo feature contract and constituent PRs, including
specs/035-message-comments/contracts/message-comment-api.md, #1878, #1879, and #1880.Codebase Impact Analysis
Cross-component integration spans
apps/apiDurable Object storage/routes/MCP services,packages/sharedcomment contracts, andapps/webAPI mapping/WebSocket/UI flows. The integration also reconciles route tests, DO tests, React unit tests, and Playwright coverage for the message-comment path.Documentation & Specs
The integrated branches include message-comment API/spec/config documentation updates for
specs/035-message-comments/contracts/message-comment-api.md, environment/default limit references, and API-reference skill material. This primary PR preserves those docs and verifies the code contracts against them.Constitution & Risk Check
Checked Principle XI/no hardcoded values and the security-sensitive multi-tenant boundaries. Limits stay environment-backed; comments remain server-authoritative in ProjectData; MCP identity/provenance is derived from verified context; directive delivery fails closed; scope remains message-only with file/markdown anchoring deferred.
Local validation
No bare
pnpm formatwas run.Passed:
Validation notes:
pnpm check:fastpassed after the final minimal patch with existing non-blocking advisory output: format ratchet2036/2225 unformatted file(s), Oxlint shadow diagnostics, report-only type-boundary findings, and known ESLint warnings.pnpm typecheckpassed; Astro template validation still prints existing baseline diagnostics while exiting successfully.pnpm buildpassed with known build warnings (advancedChunksdeprecation, Lightning CSS@source, Tailwind sourcemap warning).pnpm testpassed after rebasing and the MCP hook-timeout stabilization: Turbo21 successful, 21 total; API591test files /7918tests passed; Web285test files /3419tests passed.beforeEachtimeout intests/unit/routes/mcp-error-handling.test.ts. The test passed in isolation; the integration branch now gives that setup hook a 20s timeout. The isolated test (1file /8tests) and the full root suite both pass after the change.Coordination notes
Remediation update — staging verifier blockers
New remediation head:
a1fb44d981ff7654a6b616a020d6f03ab422bc4d.Blockers fixed from verifier task
01M0KQ4XAJCRKGW2E0GPXPH00Y:comment.thread.changedWebSocket frames now flow throughuseProjectWebSocketinto the same TanStack Query cache updater used by the session socket. Receiving browsers update create/reply/resolve/reopen state without reload.Comment thread not foundmisses now map to intentional bounded404 NOT_FOUNDresponses instead of falling through to500.Root cause:
ProjectData.broadcastCommentThread()emittedcomment.thread.changedto bothsession:<sessionId>sockets and untagged project sockets.useProjectWebSocketreceived the project-wide frames but ignored that event type; the cache mutation handler only lived behind the session-specific chat socket. A receiving browser could therefore observe the frame while the rendered comments cache stayed stale.(sessionId, threadId)row in ProjectData, but Durable Object RPC could surface the typedCommentNotFoundErroras a plainError("Comment thread not found").apps/api/src/routes/chat-comments.tsonly recognized typed/name/code errors, so this serialized domain miss was treated as an unexpected 500.Files changed in the remediation commit:
apps/web/src/hooks/useProjectWebSocket.ts,apps/web/src/pages/project-chat/useProjectChatState.ts,apps/web/src/components/project-message-view/comments/useMessageComments.ts,apps/web/src/lib/query-options/comments.ts,apps/web/src/lib/query-options/index.tsapps/api/src/routes/chat-comments.tsapps/web/tests/unit/hooks/useProjectWebSocket.test.ts,apps/web/tests/unit/lib/message-comment-query-cache.test.ts,apps/api/tests/unit/routes/chat-comments.test.ts.claude/rules/13-staging-verification.mdRemediation validation run locally:
Results: focused web tests passed
86/86; focused API route tests passed6/6; web/api typechecks passed; message-comments Playwright visual audit passed6/6;pnpm check:fastpassed with existing advisory/report-only warnings; web/api builds passed with existing build warnings;git diff --checkpassed.Post-Mortem:
.claude/rules/13-staging-verification.mdnow requires browser stream verification/tests to assert receiving-browser UI/cache convergence through the exact socket/hook that receives the production frame, not just frame arrival.Coordination status: no staging deployment was run for this remediation; no production merge was performed; constituent PRs #1878/#1879/#1880 must remain open/unmerged.