Skip to content

refactor(j5): the Inbox's answer flow and kept items live in client-runtime - #878

Merged
Jacksondr5 merged 2 commits into
j5/mainfrom
j5code/inbox-shared-logic
Nov 1, 2026
Merged

Jacksondr5 merged 2 commits into
j5/mainfrom
j5code/inbox-shared-logic

Conversation

@Jacksondr5

Copy link
Copy Markdown
Owner

Problem

Mobile's Inbox (#830) needs the same rules web's Inbox uses, but those rules live in web-only files: kept-while-typing items and their closed lines, answering with retry, and who has an inbox at all. Building mobile against copies would leave two versions to drift.

What changed

Moved into packages/client-runtime/src/j5/inbox.ts, unchanged:

  • nextKeptItems, answeredByLine and closedLine, from apps/web/src/j5/a2a/inboxKept.logic.ts (deleted): an item closed while the person typed stays, with their words and who answered (Inbox AC16, AC17).
  • submitHumanInboxAnswer, HumanInboxAnswerAttempt and keepForPersonScopes, from HumanInboxPage.tsx: answering, where a retry with the same words reuses its clientRequestId, and dropping drafts when an environment's person changes.
  • writesNowhere, from apps/web/src/j5/state.ts: an unknown device or a Viewer everywhere has no inbox (Inbox AC14).

Web imports them from there. Its behaviour is unchanged, and the tests moved with the code: inboxKept.logic.test.ts and the three submitHumanInboxAnswer cases are now in client-runtime/src/j5/inbox.test.ts, plus two new writesNowhere cases. captureHumanInboxAnswer stays on web, because it reads a DOM event.

This is part 1 of 4 for #830. Next come the mobile Inbox screen and route, then answering, then the header bell and count.

Checklist

  • One concern: moving the Inbox's shared logic, with no behaviour change
  • Tests: the moved tests pass in client-runtime, and the web page test passes
  • UI changes: none
  • Live testing: none needed; there's no behaviour change. Web's Inbox is exercised when mobile's lands.
  • Upstream-owned files: none edited
  • Upstream product: no change
  • Surfaces: web imports the shared code; mobile uses it from part 2
  • Docs: none

Built by Claude Opus 5.5 in Claude Code (J5 crew seat builder-identity).

🤖 Generated with Claude Code

…untime

Web's kept-while-typing rules (nextKeptItems, answeredByLine, closedLine), the
answer-and-retry core (submitHumanInboxAnswer, keepForPersonScopes) and the
"writes nowhere" inbox gate move into client-runtime/src/j5/inbox.ts with their
tests, so mobile's Inbox (#830) uses the same code. Web's behaviour is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
j5-code Ready Ready Preview Nov 1, 2026 8:15pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

  • Run on-demand review

This review includes 7 billable files and costs up to $1.75.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 10 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used all 3 included reviews currently available. Your 43 included PR review attempts over the past 7 days set your current allowance at 3 reviews per hour.

Learn how review limits work.

Review configuration:

Run configuration
Commits

Reviewing files that changed from the base of the PR and between edc4350 and 6ef7de5.

Files selected for processing: 7
  • apps/web/src/j5/a2a/HumanInboxPage.test.ts
  • apps/web/src/j5/a2a/HumanInboxPage.tsx
  • apps/web/src/j5/a2a/inboxKept.logic.test.ts
  • apps/web/src/j5/a2a/inboxKept.logic.ts
  • apps/web/src/j5/state.ts
  • packages/client-runtime/src/j5/inbox.test.ts
  • packages/client-runtime/src/j5/inbox.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@Jacksondr5 Jacksondr5 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Combined review: reviewer-opus and reviewer-sol (Claude Opus 5.5 and GPT Sol 6.1), head 274d7a0

Both of us reviewed the PR independently. Neither found anything. It's a pure lift, with no change in behaviour.

  • Copied exactly. nextKeptItems, answeredByLine, closedLine, submitHumanInboxAnswer, HumanInboxAnswerAttempt and keepForPersonScopes are exact text copies of the web code they replace (inboxKept.logic.ts and HumanInboxPage.tsx).
  • writesNowhere. It's the old atom's predicate, identical, as a pure function over ConnectionAccess | null. Web's atom family wraps it and reads the same connectionAccess dependency.
  • Left on web. captureHumanInboxAnswer stays there, which is right because it reads a DOM event.
  • Tests. The kept-item tests moved byte for byte. The submit tests moved with only their type import changed, and there are two new writesNowhere cases. 14 client-runtime inbox tests pass.
  • Docs. The PR's diff also shows #831's wave 1 docs (#864, reviewed before), which aren't part of this change.

The panel has no open code findings. Nothing visible changes, so no tester run is needed. Before merge it needs green J5 CI.

@github-actions github-actions Bot added size:L 100-499 effective changed lines (test files excluded in mixed PRs). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels Nov 1, 2026
@Jacksondr5
Jacksondr5 merged commit 4b510a1 into j5/main Nov 1, 2026
32 checks passed
@Jacksondr5
Jacksondr5 deleted the j5code/inbox-shared-logic branch November 1, 2026 20:44

This branch was successfully deployed

1 active deployment
Preview — 6ef7de52 Deployed Nov 1, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 effective changed lines (test files excluded in mixed PRs). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant