Skip to content

fix(mobile): serialize development account replacement - #5641

Open
iscekic wants to merge 1 commit into
mainfrom
mobile-live-loading-2be5
Open

fix(mobile): serialize development account replacement#5641
iscekic wants to merge 1 commit into
mainfrom
mobile-live-loading-2be5

Conversation

@iscekic

@iscekic iscekic commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

No new behavior — this level changes development tools and automated checks, not the released app.


Summary

DevSessionReplacement serializes development account changes through sign-out and useDevSessionLoginCommit, so the previous account's authenticated subscriptions finish cleanup before sign-in.
The Admission contract supplies identity, consent, and shell readiness; useDevSessionNavigation also checks token ownership and the authentication epoch.
Failures before enqueueing release the request; queued failures or a missing commit after 15 seconds block replacements until restart, with credential-free reports.

Files
  • apps/mobile/src/components/dev-session-injector.tsx — coordinates replacement across bootstrap, Strict Mode replay, and remounts; validates admission and reports sanitized outcomes (M; Source; 280 changed lines).
  • apps/mobile/src/app/(auth)/login.tsx — marks login readiness after passive cleanup and clears readiness on unmount (M; Source; 2 changed lines).
  • apps/mobile/src/components/dev-session-injector.mounted.test.tsx — covers cleanup, paired ingress, installed Expo queuing, commit correlation, readiness checks, failures, and remounts (A; Test; 911 changed lines).

DevSessionRequest pairs credentials, destination, and request ID; DevSessionSnapshot exposes the pending request, active replacement, and login readiness.
takeDevSessionFromUrl gains optional destination and initial-delivery arguments and returns acceptance; consumePendingDevSession now returns a request instead of credentials.
Duplicate cold deliveries do not replay, only the latest waiting pair survives, and credential-only links still default to Home.

Files
  • apps/mobile/src/lib/dev-session-inject.ts — adds request snapshots, latest-pair retention, cold deduplication, and committed-route matching (M; Source; 123 changed lines).
  • apps/mobile/src/lib/dev-session-inject.test.ts — updates consumed request expectations and covers Home defaults, cold deduplication, and latest-pair retention (M; Test; 46 changed lines).

useDevSessionNavigation blocks ordinary destinations during replacement and appends DEV_SESSION_MARKER (__dev_session_request) only to an admitted navigation action.
isDevSessionDestinationCommitted checks the selected, complete route, request marker, tab group, and encoded detail parameters rather than a pathname or dispatch return.
Root navigation remains the only dispatcher and keeps anchored navigation; development dispatch failures reject the request, while ordinary navigation errors still propagate.

Files
  • apps/mobile/src/app/_layout.tsx — checks readiness before consuming destinations and preserves anchored dispatch with development-specific failure handling (M; Source; 31 changed lines).

redirectSystemPath and captureLaunchDeepLink capture development credentials with their destination before publishing ordinary navigation, and handled credential links never return to Expo routing.
setPendingDeepLink accepts an optional devRequestId, which getPendingDeepLinkRequestId exposes only in memory; PendingDeepLinkRecord keeps its existing shape.
Existing deep links, notification precedence, persisted destinations, and release behavior remain compatible; consuming or clearing a destination also clears its development request ID.

Files
  • apps/mobile/src/lib/deep-link-handler.ts — captures paired requests before ordinary routing and suppresses credential URLs when resolution fails (M; Source; 10 changed lines).
  • apps/mobile/src/lib/deep-link-launch.ts — captures paired launch requests, keeps request IDs in memory, and clears IDs on consumption or reset (M; Source; 21 changed lines).
  • apps/mobile/src/lib/deep-link-handler.test.ts — asserts paired capture and credential suppression when routing fails (M; Test; 17 changed lines).
  • apps/mobile/src/lib/deep-link-launch.test.ts — covers paired launch capture and persistence without credentials or request IDs (M; Test; 31 changed lines).

Both continuous integration (CI) workflows now accept pull_request events against any base branch, so stacked pull requests receive checks.
push remains restricted to main; workflow_call, read-only permissions, and existing mobile paths filters remain intact, with workflow-contract changes also triggering mobile checks.
Both workflows run Check stacked CI admission unconditionally after dependency installation; its trigger-contract tests fail the job when admission rules or invocation placement change.

Files
  • .github/workflows/ci.yml — removes the base restriction and checks trigger contracts before change filtering (M; Source; 4 changed lines).
  • .github/workflows/kilo-app-ci.yml — removes the base restriction, extends both path filters, and checks trigger contracts before mobile tests (M; Source; 8 changed lines).
  • scripts/stacked-ci.test.mjs — validates trigger admission, path filters, permissions, reusable calls, and unconditional check placement (A; Test; 163 changed lines).

Tests: 5 files changed: dev-session-injector.mounted.test.tsx and stacked-ci.test.mjs added; dev-session-inject.test.ts, deep-link-handler.test.ts, and deep-link-launch.test.ts modified.
Generated: 0 files changed.


Verification

  • No manual tests ran for this level because runtime verification is pending on the stack tip.
  • The handoff provides no passing result for hosted checks or native verification.

Visual Changes

Visual Changes: N/A

Reviewer Notes

Human steps

  • before merge: Wait for the final human-ready labels.
  • before merge: Complete human review, then merge the stack from bottom to top.
  • before merge: Do not merge this pull request automatically.
  • after merge: If a development navigation request becomes blocked, restart the app before another mobile-open request.
  • after merge: If replacement fails before navigation, send a fresh mobile-open request.
  • The change requires no new environment values, secrets, migrations, or deployment steps.

Focused checks

  • The handoff reports 104 mobile tests and 27 CI trigger tests passed, plus changed-file lint and formatting.

Scope and file inventory

  • Repository: Kilo-Org/cloud.
  • Worktree: /Users/igor/Projects/.worktrees/mobile-live-loading-2be5.
  • Scope: level 1, branch mobile-live-loading-2be5, commit de4bd200d, compared with origin/main.
  • File status: M means modified; A means added. Each file entry states its class and changed-line size from the supplied statistics.
  • Total: 13 files, 1,596 insertions, and 51 deletions; 8 source files, 5 test files, and no generated files.

Notes

Runtime verification is pending on the stack tip; this level has focused test coverage only.

Stacked PRs — merge bottom to top. Each level shows only its own diff.

Runtime verification (E2E, user advocacy, simplify) runs on the tip PR over every level.
Every level keeps its own checks, its own bot review, and its own threads; each one is answered on its own PR.
Each level is its own deliverable: it builds and passes its own checks alone.
A finding on a level is repaired on that level, then carried upward with stack.sh forward.

  1. mobile-live-loading-2be5fix(mobile): serialize development account replacement #5641 ← this PR
  2. mobile-live-loading-2be5-s2fix(mobile): track accepted live query outcomes #5649 (tip)

@iscekic iscekic self-assigned this Aug 28, 2026
@kilo-code-bot

kilo-code-bot Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (13 files)
  • .github/workflows/ci.yml
  • .github/workflows/kilo-app-ci.yml
  • apps/mobile/src/app/(auth)/login.tsx
  • apps/mobile/src/app/_layout.tsx
  • apps/mobile/src/components/dev-session-injector.mounted.test.tsx
  • apps/mobile/src/components/dev-session-injector.tsx
  • apps/mobile/src/lib/deep-link-handler.test.ts
  • apps/mobile/src/lib/deep-link-handler.ts
  • apps/mobile/src/lib/deep-link-launch.test.ts
  • apps/mobile/src/lib/deep-link-launch.ts
  • apps/mobile/src/lib/dev-session-inject.test.ts
  • apps/mobile/src/lib/dev-session-inject.ts
  • scripts/stacked-ci.test.mjs

Reviewed by grok-4.6 · Input: 163.2K · Output: 28.7K · Cached: 592.9K

Review guidance: REVIEW.md from base branch main

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