fix(mobile): render the phase sidebar before the list that always wins - #157
Merged
Conversation
The phone reports `1.0.4` where a fork build must report `1.0.4+bk.<sha7>`. The `+bk.` suffix is the only way to tell which commit a binary came from, and docs/operations/bk-mobile-build.md leans on it to detect client/server version skew — so losing it made the fork blind to exactly the failure mode that document exists to prevent. I caused it. To stop `expo-constants` dragging expo-modules-core onto the import graph of tests reaching `authClientMetadata` (it reads `__DEV__` at import time, which vitest does not define), I made the manifest read a fail-soft `require`. That swallowed the real read too, so `bkBuildGitSha()` returned null in a genuine Expo runtime and every build since has reported a bare version. The repo already had the right answer: `features/cloud/publicConfig.test.ts` mocks expo-constants. So this restores the static import — matching every other consumer in the app — and mocks the module in `connection.test.ts` instead, which is where the import-graph problem actually was. Verified: 245 tests across 26 files, `vp run typecheck` clean. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Third attempt at the same bug, so this time the reachability is verified rather than assumed. `HomeScreen` has an early return `if (threadListV2Enabled)`, and `resolveThreadListV2Enabled` returns true unless a device opted into the legacy list — so that return fires on every phone. My phase-sidebar branch sat *after* it and was unreachable dead code. The toggle wrote its preference, the pane existed, and nothing could ever render it. Moved above that return. Verified order in HomeScreen is now: empty state → phase sidebar → V2 list. `ThreadNavigationSidebarPane` had the same shape of defect: it renders a thread list from two paths (`props.nativeChrome` and the fallback) and I had gated only the first, so the flag was half-wired on tablets too. Both paths now gate. The pattern across all three failures is identical — I put code somewhere plausible and never traced whether that line executes. Existence is not reachability, and neither typecheck nor unit tests can tell the difference. Verified: 280 tests across 31 files, `vp run typecheck` clean, lint clean, and the return order in both files read back explicitly. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: unavailable · PR result: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
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.
The bug
The phase sidebar toggle did nothing on a phone across three attempted fixes. Root cause, finally traced instead of guessed:
HomeScreenhas an early returnif (threadListV2Enabled)at line 1159, andresolveThreadListV2Enabledreturns true unless a device explicitly opted into the legacy list. My phase-sidebar branch sat after that return, so it was unreachable dead code. The preference wrote correctly,PhaseSidebarPaneexisted and compiled, and nothing could ever render it.Moved above that return. Verified order in
HomeScreenis now: empty state → phase sidebar → V2 list.ThreadNavigationSidebarPanehad the same shape of defect — it renders a thread list from two paths (props.nativeChromeand the fallback) and only the first was gated, leaving the flag half-wired on tablets. Both paths now gate.Also fixed: the app was not reporting its build SHA
The phone reported
1.0.4where a fork build must report1.0.4+bk.<sha7>. That suffix is howdocs/operations/bk-mobile-build.mddetects client/server version skew, and losing it made every "which build is this?" question unanswerable — which is a large part of why this took three rounds to diagnose.Cause was mine: to keep
expo-constantsoff the import graph of tests reachingauthClientMetadata, I made the manifest read a fail-softrequire, which swallowed the genuine read too. Restored the static import (matching every other consumer in the app) and mocked the module inconnection.test.tsinstead — which is whatfeatures/cloud/publicConfig.test.tsalready does.Why none of this was caught earlier
All three failures are the same mistake: code placed somewhere plausible without tracing whether that line executes. Typecheck and unit tests cannot tell existence from reachability, and CI has no device. The only signal was running it on a phone.
Verification this time included reading the return order back out of both files rather than trusting placement.
Verification
245 tests across 26 files,
vp run typecheckclean,vp fmt --checkclean, fork markers pass. Re-verified after merging currentexpbkmain.Model: Claude Opus 5 (1M context), harness: Claude Code in T3 Code.
🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.