Repository navigation
Conversation
…obile Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Client runtime predicate packages/client-runtime/src/state/session.ts |
The client runtime exports sessionHasScope. It returns false for failed results or missing sessions, and otherwise delegates the scope check to sessionGrantsScope. |
Web and mobile exports apps/web/src/state/session.ts, apps/mobile/src/state/session.ts, apps/mobile/src/state/session.test.ts |
The web and mobile modules re-export the client runtime helper. The mobile test mock retains the original module exports. |
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Refactor
Possibly related PRs
- pingdotgg/t3code#24445: Both PRs change the implementation of
sessionHasScopeacross the web, mobile, and client runtime modules. - pingdotgg/t3code#25678: This PR makes the mobile predicate public; the current PR preserves its export through the shared implementation.
- pingdotgg/t3code#26205: Both PRs concern the mobile
sessionHasScopepredicate and its boolean API.
Suggested reviewers: juliusmarminge
Merge Risk: 
Minimal · up to bf109
-
The refactor has no identified merge-blocking correctness or test-workflow risk.
Pre-merge checks: 
4
Finishing Touches
-
Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Web and mobile each carry their own byte-identical copy of
sessionHasScope, the check that decides whether an environment's session grants a scope. A future change to what counts as granted would have to land twice, and the two clients could drift apart.Change
The predicate now lives once in
@t3tools/client-runtime/state/session, next tocreateEnvironmentSessionAtoms, which builds the session state it reads.apps/web/src/state/session.tsandapps/mobile/src/state/session.tsimport it for their hooks and re-export it, so existing callers and the tests that stub./sessionstay as they are. The body is unchanged: a failed or missing session is never granted, and any other result defers tosessionGrantsScope.The mobile session test mocked the whole client-runtime session module, so it now spreads the real module (as
assets.test.tsdoes) to keep the shared predicate.No selector, hook, denial path or auth policy changes, so nothing a screen shows changes and there are no screenshots.
Scope and approval
This is a behavior-preserving cleanup with no new behavior or defaults, so it needs no prior issue or discussion. Maintainers, please confirm you want the predicate shared here rather than kept per client.
Verification
vp run check:changed 3fd2b855c5: format, lint, knip, typecheck (7 packages), tests and React compiler all pass.vp test runon the 20 web, mobile and client-runtime unit test files that import or mock these session modules: 207 passed.vp test runonfileSaveSessions,ThreadTerminalDrawerandChatMarkdown.permissionsbrowser tests: 7 passed.Not checked: the other web browser test files that reach these modules, which CI runs, and a manual pass in each client, since no rendered output changes.
Prior PRs
No earlier PR made this change. Two open PRs sit next to it:
sessionDeniesScopeto the same client-runtime module and edits the same import blocks. The two changes are independent, and whichever lands second needs a small import-block rebase.useEnvironmentScopehook bodies, not the predicate.Generated with Claude Opus 5.5 and GPT-6.1 Terra and GPT-6.1 Sol in T3 Code Nightly