Skip to content
42 changes: 40 additions & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,53 @@ jobs:
src/apps/mobile/android/app/build/test-results/
if-no-files-found: ignore
ios:
runs-on: macos-latest
runs-on: macos-26
env:
DEVELOPER_DIR: /Applications/Xcode_26.5.app/Contents/Developer
steps:
- uses: actions/checkout@v5
- name: Create iPhone simulator
run: |
xcodebuild -version
xcrun simctl list runtimes
simulator_id=$(xcrun simctl create 'OpenBitFun CI' \
com.apple.CoreSimulator.SimDeviceType.iPhone-17-Pro-Max \
com.apple.CoreSimulator.SimRuntime.iOS-26-5)
echo "IOS_SIMULATOR_DESTINATION=platform=iOS Simulator,id=$simulator_id" >> "$GITHUB_ENV"
- uses: actions/setup-node@v4
with:
node-version: '22'
- uses: actions/setup-java@v5
with:
distribution: temurin
java-version: '21'
- uses: gradle/actions/setup-gradle@v4
- run: ./gradlew compileKotlinIosSimulatorArm64 --no-daemon
- name: Build shared iOS XCFramework
run: ./gradlew compileKotlinIosSimulatorArm64 :core-feature:assembleOpenBitFunMobileCoreDebugXCFramework --no-daemon
working-directory: src/apps/mobile/shared
- run: ./Testing/run-pure-swift-tests.sh
working-directory: src/apps/mobile/ios
- name: Build iOS app and UI tests
working-directory: src/apps/mobile/ios
run: |
xcodebuild -project OpenBitFun.xcodeproj -scheme OpenBitFun -configuration Debug \
-destination "$IOS_SIMULATOR_DESTINATION" \
-derivedDataPath "$RUNNER_TEMP/OpenBitFunDerivedData" \
build-for-testing
- name: Run StreamingPresentationUITests
working-directory: src/apps/mobile/ios
run: |
xcodebuild -project OpenBitFun.xcodeproj -scheme OpenBitFun -configuration Debug \
-destination "$IOS_SIMULATOR_DESTINATION" \
-derivedDataPath "$RUNNER_TEMP/OpenBitFunDerivedData" \
-resultBundlePath "$RUNNER_TEMP/StreamingPresentationUITests.xcresult" \
-parallel-testing-enabled NO -testLanguage zh-Hans -testRegion CN \
-only-testing:OpenBitFunUITests/StreamingPresentationUITests \
test-without-building
- name: Upload iOS UI test results on failure
if: failure()
uses: actions/upload-artifact@v6
with:
name: ios-streaming-ui-test-results
path: ${{ runner.temp }}/StreamingPresentationUITests.xcresult
if-no-files-found: ignore
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,7 @@ private struct ThinkingBlock: View {
.foregroundStyle(OpenBitFunTheme.muted)
.lineSpacing(MobileDesignTypography.bodyLarge.lineSpacing)
.textSelection(.enabled)
.accessibilityIdentifier("thinking.content.\(partID)")
}
}
// Match Harmony: preserve manual toggles during one thinking phase,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,22 @@ struct MobileDesignGallery: View {
#if DEBUG
/// Deterministic native rendering fixture. It never opens a remote transport.
struct StreamingRegressionView: View {
private enum ThinkingPhase {
case waiting, readyForAnswer, answering
}

@StateObject private var model = MobileAppModel(sessions: [], selectedSessionID: "fixture", messages: [], connectCore: false)
@State private var generation = 0
@State private var finished = false
@State private var olderCount = 0
@State private var historyCount = 40
@State private var historyRequests = 0
@State private var thinkingPhase = ThinkingPhase.waiting
private let showsThinkingControls = ProcessInfo.processInfo.arguments.contains("--thinking-regression")
private let showsDelayedOpenControls = ProcessInfo.processInfo.arguments.contains("--open-loading-regression")
private let thinkingSegments = (1...12).map { index in
"Thinking segment \(index): checking chronology and viewport stability.\nCheck input.\nCheck output.\nCheck viewport.\nCheck ordering.\n\n"
}

var body: some View {
VStack(spacing: 0) {
Expand All @@ -101,13 +111,15 @@ struct StreamingRegressionView: View {
model.composerSendGeneration &+= 1
model.isSending = true
finished = false
thinkingPhase = .waiting
generation += 1
}.accessibilityIdentifier("fixture.send")
Button("Reset session") {
generation = 0
model.selectedSessionID = UUID().uuidString
model.timelineRows = history
model.isSending = false
thinkingPhase = .waiting
}.accessibilityIdentifier("fixture.reset")
}
Button("Short history") {
Expand All @@ -116,8 +128,27 @@ struct StreamingRegressionView: View {
olderCount = 0
model.timelineRows = history
model.remoteHasMoreMessages = true
thinkingPhase = .waiting
}.accessibilityIdentifier("fixture.shortHistory")
if ProcessInfo.processInfo.arguments.contains("--open-loading-regression") {
if showsThinkingControls {
HStack {
Button("Show answer") {
showThinkingRegression(thought: thinkingSegments.joined(), answerVisible: true, live: true)
thinkingPhase = .answering
}
.disabled(thinkingPhase != .readyForAnswer)
.accessibilityIdentifier("fixture.showThinkingAnswer")
Button("Finish stream") {
showThinkingRegression(thought: thinkingSegments.joined(), answerVisible: true, live: false)
model.isSending = false
finished = true
thinkingPhase = .waiting
}
.disabled(thinkingPhase != .answering)
.accessibilityIdentifier("fixture.finishThinkingAnswer")
}
}
if showsDelayedOpenControls {
HStack {
Button("Open delayed session") {
model.remoteExpectedDeviceKey = "account:fixture-device"
Expand All @@ -135,6 +166,8 @@ struct StreamingRegressionView: View {
model.finishRemoteConversationOpenIfReady(timelineSessionID: "delayed")
}.accessibilityIdentifier("fixture.finishLoading")
}
.buttonStyle(.bordered)
.font(.footnote)
}
if ProcessInfo.processInfo.arguments.contains("--history-pagination-regression") {
Text("History requests: \(historyRequests)").accessibilityIdentifier("fixture.historyRequests")
Expand Down Expand Up @@ -219,19 +252,14 @@ struct StreamingRegressionView: View {
finished = true
return
}
if ProcessInfo.processInfo.arguments.contains("--thinking-regression") {
if showsThinkingControls {
var thought = ""
for index in 1...12 {
thought += "Thinking segment \(index): checking chronology and viewport stability.\nCheck input.\nCheck output.\nCheck viewport.\nCheck ordering.\n\n"
model.timelineRows = history + [thinkingRow(thought: thought, answer: "", live: true)]
for segment in thinkingSegments {
do { try await Task.sleep(nanoseconds: 350_000_000) } catch { return }
thought += segment
showThinkingRegression(thought: thought, answerVisible: false, live: true)
}
do { try await Task.sleep(nanoseconds: 3_000_000_000) } catch { return }
model.timelineRows = history + [thinkingRow(thought: thought, answer: "ANSWER-AFTER-THINKING", live: true)]
do { try await Task.sleep(nanoseconds: 2_000_000_000) } catch { return }
model.timelineRows = history + [thinkingRow(thought: thought, answer: "ANSWER-AFTER-THINKING", live: false)]
model.isSending = false
finished = true
thinkingPhase = .readyForAnswer
return
}
var body = ""
Expand Down Expand Up @@ -284,12 +312,14 @@ struct StreamingRegressionView: View {
], streaming: false, typing: false, showRetry: false, error: nil)
}

private func thinkingRow(thought: String, answer: String, live: Bool) -> MobileConversationRow {
private func showThinkingRegression(thought: String, answerVisible: Bool, live: Bool) {
let answer = answerVisible ? "ANSWER-AFTER-THINKING" : ""
var blocks: [MobileTimelineBlock] = [.thinking(id: "thought", text: thought, streaming: answer.isEmpty && live)]
if !answer.isEmpty { blocks.append(.text(id: "answer", text: answer, streaming: live)) }
return MobileConversationRow(id: live ? "thinking-live" : "thinking-final", kind: "ASSISTANT", text: answer,
let row = MobileConversationRow(id: live ? "thinking-live" : "thinking-final", kind: "ASSISTANT", text: answer,
thinking: thought, images: [], tools: [], blocks: blocks, streaming: live, typing: false,
showRetry: false, error: nil, live: live)
model.timelineRows = history + [row]
}

private var history: [MobileConversationRow] {
Expand Down
Loading
Loading