diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml index 56e3949..563918d 100644 --- a/.github/workflows/quality.yml +++ b/.github/workflows/quality.yml @@ -44,7 +44,7 @@ jobs: - name: iOS release-record consistency tests and draft check if: ${{ !cancelled() && steps.install.outcome == 'success' }} run: | - node --test scripts/ios-release/*.test.mjs + node --test scripts/ios-release/*.test.mjs scripts/ios-assets/*.test.mjs scripts/ios-native/*.test.mjs node scripts/ios-release/check.mjs - name: Unit and backend tests if: ${{ !cancelled() && steps.install.outcome == 'success' }} @@ -60,7 +60,6 @@ jobs: env: EXPO_OFFLINE: '1' EXPO_NO_TELEMETRY: '1' - EXPO_PUBLIC_CONVEX_URL: https://fixture.invalid run: bun run build:mobile - name: Install client-test browser and host dependencies id: browsers @@ -121,10 +120,103 @@ jobs: retention-days: 3 if-no-files-found: warn + native-build: + name: Build unsigned iOS simulator app + runs-on: macos-26 + timeout-minutes: 50 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + ref: ${{ github.event.pull_request.head.sha || github.sha }} + - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 + with: + node-version: '24.12.0' + - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2 + with: + bun-version: '1.4.2' + - name: Install locked dependencies without lifecycle scripts + run: bun install --frozen-lockfile --ignore-scripts + - name: Compile and inspect the source-bound Release app + env: + REFRESH_PODS: ${{ contains(github.event.pull_request.labels.*.name, 'native-pods-refresh') }} + run: | + if [ "$REFRESH_PODS" = true ]; then + bun scripts/ios-native/run.mjs --refresh-pods + else + bun scripts/ios-native/run.mjs --build-only + fi + - name: Freeze partial evidence if native execution ended early + if: ${{ always() }} + run: node scripts/ios-native/snapshot.mjs + - name: Retain native build or dependency-refresh evidence + if: ${{ always() }} + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: ios-native-build-${{ github.event.pull_request.head.sha || github.sha }} + path: reports/native-evidence/ + retention-days: 1 + compression-level: 9 + if-no-files-found: warn + + native: + name: Native qualification (${{ matrix.group }}) + needs: native-build + runs-on: macos-26 + timeout-minutes: 60 + strategy: + fail-fast: false + max-parallel: 4 + matrix: + group: [phone-5, phone-6, tablet-8, tablet-10] + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + ref: ${{ github.event.pull_request.head.sha || github.sha }} + - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 + with: + node-version: '24.12.0' + - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2 + with: + bun-version: '1.4.2' + - name: Install locked dependencies without lifecycle scripts + run: bun install --frozen-lockfile --ignore-scripts + - name: Download this run's source-bound simulator app + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: ios-native-build-${{ github.event.pull_request.head.sha || github.sha }} + path: reports/native-build/ + - name: Install hash-verified local Maestro CLI + shell: bash + run: | + curl --fail --location --retry 2 https://github.com/mobile-dev-inc/Maestro/releases/download/cli-2.10.0/maestro.zip -o "$RUNNER_TEMP/maestro.zip" + printf '%s %s\n' '29b675e10cc12080e445e9bfb2e2b4e4dfb9c0f2e30d5884120d258b5e1cd991' "$RUNNER_TEMP/maestro.zip" | shasum -a 256 -c - + unzip -q "$RUNNER_TEMP/maestro.zip" -d "$RUNNER_TEMP/maestro-tool" + test -x "$RUNNER_TEMP/maestro-tool/maestro/bin/maestro" + echo "$RUNNER_TEMP/maestro-tool/maestro/bin" >> "$GITHUB_PATH" + echo "JAVA_HOME=$(/usr/libexec/java_home -v 17)" >> "$GITHUB_ENV" + - name: Verify the app and exercise this device group + env: + NATIVE_TEST_GROUP: ${{ matrix.group }} + run: bun scripts/ios-native/run.mjs "--test-group=$NATIVE_TEST_GROUP" + - name: Freeze partial evidence if native execution ended early + if: ${{ always() }} + run: node scripts/ios-native/snapshot.mjs + - name: Retain unsigned native evidence, including failed-run diagnostics + if: ${{ always() }} + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: ios-native-${{ matrix.group }}-${{ github.event.pull_request.head.sha || github.sha }} + path: reports/native-evidence/ + retention-days: 1 + compression-level: 9 + if-no-files-found: warn + quality-gate: name: quality-gate if: ${{ always() }} - needs: [validate, mutation] + needs: [validate, mutation, native-build, native] runs-on: ubuntu-latest timeout-minutes: 2 steps: @@ -132,8 +224,10 @@ jobs: env: VALIDATION_RESULT: ${{ needs.validate.result }} MUTATION_RESULT: ${{ needs.mutation.result }} + NATIVE_BUILD_RESULT: ${{ needs.native-build.result }} + NATIVE_RESULT: ${{ needs.native.result }} run: | - if [ "$VALIDATION_RESULT" != success ] || [ "$MUTATION_RESULT" != success ]; then - echo "Qualification did not succeed: validation=$VALIDATION_RESULT mutation=$MUTATION_RESULT" + if [ "$VALIDATION_RESULT" != success ] || [ "$MUTATION_RESULT" != success ] || [ "$NATIVE_BUILD_RESULT" != success ] || [ "$NATIVE_RESULT" != success ]; then + echo "Qualification did not succeed: validation=$VALIDATION_RESULT mutation=$MUTATION_RESULT native-build=$NATIVE_BUILD_RESULT native=$NATIVE_RESULT" exit 1 fi diff --git a/apps/mobile/.gitignore b/apps/mobile/.gitignore index b57f48a..c9d795c 100644 --- a/apps/mobile/.gitignore +++ b/apps/mobile/.gitignore @@ -1,2 +1,6 @@ # Editable release records are source, unlike generated desktop release output. !/release/ + +# Generated by Expo prebuild. Keep native configuration in app.json/plugins. +/ios/ +/android/ diff --git a/apps/mobile/.impeccable/surfaces/apps-mobile-app-index-tsx.md b/apps/mobile/.impeccable/surfaces/apps-mobile-app-index-tsx.md new file mode 100644 index 0000000..62e8cc1 --- /dev/null +++ b/apps/mobile/.impeccable/surfaces/apps-mobile-app-index-tsx.md @@ -0,0 +1,13 @@ +# Native local game + +Mode: Operate. Target: Expo/React Native on iPhone and iPad. This is the separate native adaptation requested by issue #42, not a change to the desktop/web system. + +Use the established evergreen dice deck, porcelain pip faces and clay action color as the game-specific layer. Use system typography, scalable text, semantic iOS surfaces and text colors, native stack navigation, sheets/alerts and safe areas for the surrounding interface. Do not copy the desktop's dense table or shrink it to phone width. + +Compact windows use a vertical play/score flow with a reachable roll action. Expanded iPad windows separate the play controls from the score list. Window width and text scale determine that structure, not a hard-coded device name. All targets are at least 44 points; no fixed-height text containers or decorative permissions, sound, haptics or animation are required. + +The local store owns acknowledgment, retries and persistence. Show loading, corrupt/unavailable data, pending-write retry, explicit reload/reset, Resume/Discard and local-only result states. Never imply that a local score is server-verified. Keep one accessible score action per category and describe held/suggested states in words as well as color. + +The existing development name is not public branding approval. Support contacts, App Store IDs and final privacy/legal declarations remain unset until approved. Native simulator screenshots must identify their source commit and device; web-adapter tests are only supplemental coverage. Physical-device, VoiceOver, TestFlight and store acceptance remain separate. + +Verification is bounded: implement the complete flow, inspect a batched iPhone/iPad light/dark and large-text pass, fix the observed issues together, then one confirmation pass. Native functional failures still need diagnosis and regression tests; do not polish indefinitely. diff --git a/apps/mobile/PRIVACY.md b/apps/mobile/PRIVACY.md new file mode 100644 index 0000000..bcbf464 --- /dev/null +++ b/apps/mobile/PRIVACY.md @@ -0,0 +1,31 @@ +# Privacy policy draft + +Prepared September 27, 2026. This is development copy, not an approved policy for a published app. The owner must approve the public identity, contact information and final declarations after the signed candidate is measured. See the [privacy acceptance issue](https://github.com/HemSoft/yahtzee/issues/48). + +## Data on the device + +The native gameplay code stores the player name, up to five recent names, game preferences, the active game and its held dice, completed scores, and local rankings in the app's private storage. It retains the latest 500 completed games and the all-time top ten entries per supported dice mode. Local rankings are not an online leaderboard. + +The development build has no account, remote players, cloud-sync feature, advertising or purchases. It does not import online game records. Its SQLite document is not encrypted by the application. Device security and operating-system data protection are separate from application-level encryption. + +## Retention, deletion and backups + +An active game stays available until it is completed, explicitly discarded or removed with the local-data reset. A confirmed reset deletes the app's current game data and preferences from its container. A failed reset remains visible and can be retried. Damaged or unsupported data remains in place until an explicit recovery or reset choice. + +Deleting the app removes its local container. Offloading may retain it. The storage location is eligible for operating-system backups, subject to device settings and backup behavior. Restoring a backup can restore older game data. Resetting the current app does not erase existing backups. Physical-device backup and restore verification is still pending. + +## Diagnostics and support + +The current source requires a preview before sharing diagnostics. The preview contains the app version and build, platform and OS version, a compact or expanded window category, and save-schema and scoring-rule versions. It excludes player names, game identifiers, scores, saved documents, error text, logs and credentials. Nothing is sent when a preview opens or closes. + +Choosing Share opens the operating system's share controls with exactly the previewed text. The selected app or destination may use the network and follows its own privacy practices. Sharing is optional. + +The repository's [GitHub issue page](https://github.com/HemSoft/yahtzee/issues) is public. Do not post player names, save files, credentials or screenshots containing private information there. GitHub handles information submitted to it under [GitHub's privacy statement](https://docs.github.com/en/site-policy/privacy-policies/github-general-privacy-statement). + +An owner-approved private support contact and final public policy URL have not been selected. They must be provided before this draft is published as the release policy. + +## Native SDKs and release verification + +The first unsigned simulator build contains an embedded JavaScript bundle and has Expo updates disabled in its compiled configuration. Static inspection is not proof of zero network traffic or a completed privacy audit. Bundled SDK behavior, manifests and signatures, signed-archive permissions, and measured traffic still require release verification. + +The [engineering inventory](../../docs/mobile-privacy-audit.md) records observations and open work. App Store privacy answers and export-compliance classification remain unset. No legal attestation is supplied by this draft. diff --git a/apps/mobile/app.json b/apps/mobile/app.json index 2914aa3..a3de55d 100644 --- a/apps/mobile/app.json +++ b/apps/mobile/app.json @@ -2,25 +2,39 @@ "expo": { "name": "Yahtzee", "slug": "yahtzee", - "version": "0.1.0", + "version": "1.0.0", "scheme": "yahtzee", "platforms": ["ios", "android"], - "orientation": "portrait", + "orientation": "default", + "userInterfaceStyle": "automatic", "icon": "./assets/icon.png", - "splash": { - "image": "./assets/splash.png", - "resizeMode": "contain", - "backgroundColor": "#fafafa" - }, "ios": { - "bundleIdentifier": "com.hemsoft.yahtzee" + "bundleIdentifier": "com.hemsoft.yahtzee", + "buildNumber": "1", + "supportsTablet": true, + "requireFullScreen": false, + "icon": { + "light": "./assets/icon.png", + "dark": "./assets/icon-dark.png", + "tinted": "./assets/icon-tinted.png" + } }, "android": { "package": "com.hemsoft.yahtzee", "adaptiveIcon": { - "foregroundImage": "./assets/icon.png", - "backgroundColor": "#fafafa" + "foregroundImage": "./assets/launch-mark.png", + "backgroundColor": "#1e453a" } - } + }, + "plugins": [ + "expo-router", + ["expo-build-properties", { "ios": { "deploymentTarget": "17.0" } }], + ["expo-splash-screen", { + "image": "./assets/launch-mark.png", + "imageWidth": 160, + "backgroundColor": "#f2f2f7", + "dark": { "image": "./assets/launch-mark.png", "backgroundColor": "#000000" } + }] + ] } } diff --git a/apps/mobile/app/_layout.tsx b/apps/mobile/app/_layout.tsx index a047438..60ae853 100644 --- a/apps/mobile/app/_layout.tsx +++ b/apps/mobile/app/_layout.tsx @@ -1,15 +1,20 @@ import React from "react"; -import { Stack } from "expo-router"; -import { ConvexProvider, ConvexReactClient } from "convex/react"; - -const url = process.env.EXPO_PUBLIC_CONVEX_URL; -if (!url) throw new Error("Missing EXPO_PUBLIC_CONVEX_URL environment variable"); -const convex = new ConvexReactClient(url); +import { DarkTheme, DefaultTheme, Stack, ThemeProvider } from "expo-router"; +import { StatusBar } from "expo-status-bar"; +import { LocalProvider, useLocalGame } from "../src/local/LocalProvider"; +function Navigation() { + const { colors, dark } = useLocalGame(); + return + + + + + + + ; +} export default function Layout() { - return ( - - - - ); + return ; } diff --git a/apps/mobile/app/help.tsx b/apps/mobile/app/help.tsx new file mode 100644 index 0000000..4cc52bb --- /dev/null +++ b/apps/mobile/app/help.tsx @@ -0,0 +1,15 @@ +import React from "react"; +import { Stack, useRouter } from "expo-router"; +import { SafeAreaView } from "react-native-safe-area-context"; +import { useLocalGame } from "../src/local/LocalProvider"; +import { Help } from "../src/screens/Help"; +import { Action } from "../src/ui/controls"; + +export default function HelpRoute() { + const { colors } = useLocalGame(); + const router = useRouter(); + return + router.back()} /> }} /> + + ; +} diff --git a/apps/mobile/app/history.tsx b/apps/mobile/app/history.tsx new file mode 100644 index 0000000..9930ca3 --- /dev/null +++ b/apps/mobile/app/history.tsx @@ -0,0 +1,9 @@ +import React from "react"; +import { SafeAreaView } from "react-native-safe-area-context"; +import { useLocalGame } from "../src/local/LocalProvider"; +import { History } from "../src/screens/History"; + +export default function HistoryRoute() { + const { colors } = useLocalGame(); + return ; +} diff --git a/apps/mobile/app/index.tsx b/apps/mobile/app/index.tsx index b9a88e7..356fd95 100644 --- a/apps/mobile/app/index.tsx +++ b/apps/mobile/app/index.tsx @@ -1,416 +1,8 @@ -import React, { useState, useCallback, useEffect, useMemo } from "react"; -import { - View, - Text, - TouchableOpacity, - TextInput, - ScrollView, - StyleSheet, -} from "react-native"; -import AsyncStorage from "@react-native-async-storage/async-storage"; -import { useQuery, useMutation, useAction } from "convex/react"; -import { api } from "../../../convex/_generated/api"; -import { - getAvailableCategories, - calculateTotal, - calculateMaxPossibleScore, - pickAiCategory, - getCategories, - createEmptyGameLog, - type GameLog, - type GameLogEntry, -} from "@yahtzee/game-engine"; -import { lightTheme, darkTheme, useGameSession } from "@yahtzee/ui"; - -const DIE_FACES: Record = { - 1: "⚀", 2: "⚁", 3: "⚂", 4: "⚃", 5: "⚄", 6: "⚅", -}; - -type Screen = "setup" | "playing" | "finished"; +import React from "react"; +import { useRouter } from "expo-router"; +import { NativeGameScreen } from "../src/screens/NativeGameScreen"; export default function Index() { - const [screenState, setScreen] = useState("setup"); - const [playerName, setPlayerName] = useState(""); - const [recentNames, setRecentNames] = useState([]); - const [diceCount, setDiceCount] = useState(5); - const [aiOpponents, setAiOpponents] = useState(0); - const startGuest = useAction(api.gameSessions.start); - const moveGuest = useMutation(api.games.move); - const { game, busy, error, canRetry, retry, start, reset, - roll: handleRoll, toggleHold: handleToggleHold, selectCategory: handleSelectCategory, - } = useGameSession({ start: startGuest, move: moveGuest }); - const screen = screenState === "playing" && game?.status === "finished" ? "finished" : screenState; - const [themeMode, setThemeMode] = useState<"light" | "dark">("light"); - const theme = themeMode === "dark" ? darkTheme : lightTheme; - - useEffect(() => { - AsyncStorage.getItem("yahtzee-recent-names").then((raw) => { - if (raw) { - const names = JSON.parse(raw) as string[]; - setRecentNames(names); - if (names.length > 0) setPlayerName(names[0]); - } - }).catch(() => {}); - }, []); - - // Convex queries - const allGameLogs = useQuery(api.gameLogs.list, {}); - const activeDiceCount = game?.diceCount ?? diceCount; - const topScoresRaw = useQuery(api.highScores.top, { diceCount: activeDiceCount }); - - const gameLog: GameLog = useMemo(() => { - if (!allGameLogs) return createEmptyGameLog(); - return { - entries: allGameLogs.map((e): GameLogEntry => ({ - id: e.gameId, - diceCount: e.diceCount, - startedAt: e.startedAt, - completedAt: e.completedAt, - durationSeconds: e.durationSeconds, - players: e.players, - winnerName: e.winnerName, - })), - }; - }, [allGameLogs]); - - const highScoresForDice = useMemo( - () => (topScoresRaw ?? []), - [topScoresRaw] - ); - - - const toggleTheme = useCallback(() => { - setThemeMode((prev) => { - const next = prev === "light" ? "dark" : "light"; - AsyncStorage.setItem("yahtzee-theme", next).catch(() => {}); - return next; - }); - }, []); - - // Load theme preference on mount (theme stays local) - useEffect(() => { - (async () => { - try { - const themeRaw = await AsyncStorage.getItem("yahtzee-theme"); - if (themeRaw === "dark") setThemeMode("dark"); - } catch { /* A missing local preference uses the default light theme. */ } - })(); - }, []); - - const handleStartGame = useCallback(async () => { - const name = playerName.trim(); - if (await start({ name, diceCount, aiOpponents })) { - setScreen("playing"); - const updated = [name, ...recentNames.filter((entry) => entry !== name)].slice(0, 5); - setRecentNames(updated); - AsyncStorage.setItem("yahtzee-recent-names", JSON.stringify(updated)).catch(() => {}); - } - }, [playerName, diceCount, aiOpponents, recentNames, start]); - - const handleCancelGame = useCallback(() => { - reset(); setScreen("setup"); - }, [reset]); - - const currentPlayer = game?.players[game.currentPlayerIndex]; - const isHumanTurn = currentPlayer && !currentPlayer.isAi; - const canInteract = !!isHumanTurn && !busy && !canRetry; - const connectionStatus = - {busy && {game ? "Saving move..." : "Starting guest game..."}} - {error && {error}} - {canRetry && Retry move} - ; - - if (screen === "setup") { - return ( - - - {theme.mode === "light" ? "🌙" : "☀️"} - - 🎲 Yahtzee - {connectionStatus} - - {recentNames.length > 0 && ( - - {recentNames.map((name) => ( - setPlayerName(name)} - style={{ paddingHorizontal: 10, paddingVertical: 4, borderRadius: 12, borderWidth: 1, borderColor: playerName === name ? theme.accent : theme.border, backgroundColor: playerName === name ? theme.accentBg : theme.surface }} - > - {name} - - ))} - - )} - AI Opponents - - {[0, 1, 2, 3].map((n) => ( - setAiOpponents(n)} - > - - {n === 0 ? "Solo" : `${n} AI`} - - - ))} - - Dice Count - - {[5, 6, 8, 10].map((n) => ( - setDiceCount(n)} - > - {n} - - ))} - - - Start Game - - - ); - } - - if (screen === "finished" && game) { - const sorted = game.players.slice().sort((a, b) => calculateTotal(b, game.diceCount).grandTotal - calculateTotal(a, game.diceCount).grandTotal); - const topScores = highScoresForDice; - return ( - - Game Over! - {sorted.map((p, i) => { - const matching = gameLog.entries - .filter((e) => e.diceCount === game.diceCount) - .flatMap((e) => e.players) - .filter((pl) => pl.name === p.name); - const avg = matching.length === 0 ? 0 : Math.round(matching.reduce((sum, pl) => sum + pl.score, 0) / matching.length); - return ( - - - {i === 0 ? "🏆 " : `${i + 1}. `}{p.name}{p.isAi ? " 🤖" : ""}: {calculateTotal(p, game.diceCount).grandTotal} pts - - - (avg: {avg}) - - - ); - })} - - Play Again - - - {topScores.length > 0 && ( - - 🏅 High Scores ({game.diceCount} dice) - - - # - Player - Score - Date - - {topScores.map((hs) => ( - - {hs.rankCurrent} - - {hs.playerName}{hs.isAi ? " 🤖" : ""} - - {hs.score} - - {new Date(hs.dateRecorded).toLocaleDateString()} - - - ))} - - - )} - - ); - } - - if (!game) return null; - - const available = canInteract ? getAvailableCategories(game.players[game.currentPlayerIndex], game.diceCount) : []; - const hasRolled = game.rollsLeft < game.maxRolls; - const suggestedCategory = game && isHumanTurn && hasRolled - ? pickAiCategory(game.dice, game.players[game.currentPlayerIndex], game.diceCount) - : undefined; - - return ( - - {connectionStatus} - {/* Quit button */} - - ✕ Quit Game - - - - {currentPlayer?.name}'s turn · Round {Math.min(game.currentRound, game.totalRounds)}/{game.totalRounds} · Rolls: {game.rollsLeft} - - - {!isHumanTurn && ( - 🤖 AI is thinking... - )} - - - {game.dice.map((val, i) => ( - canInteract && handleToggleHold(i)} - disabled={!canInteract || game.rollsLeft === 0} - > - {val > 0 ? DIE_FACES[val] ?? val : "?"} - - ))} - - - 0 ? theme.primary : theme.disabledBg }, (!canInteract || game.rollsLeft <= 0) && styles.disabledBtn]} - accessibilityRole="button" - onPress={handleRoll} - disabled={!canInteract || game.rollsLeft <= 0} - > - - {game.rollsLeft === game.maxRolls ? "Roll Dice" : `Re-roll (${game.rollsLeft})`} - - - - {/* Multi-player scorecard */} - {available.length > 0 && hasRolled && ( - Click any highlighted row to place your score - )} - - - {/* Header row */} - {(() => { - const totals = game.players.map((p) => calculateTotal(p, game.diceCount)); - const scores = totals.map((t) => t.grandTotal); - const indexed = scores.map((s, i) => ({ i, s })).sort((a, b) => b.s - a.s); - const ranks = new Array(scores.length); - let rank = 1; - for (let j = 0; j < indexed.length; j++) { - if (j > 0 && indexed[j].s < indexed[j - 1].s) rank = j + 1; - ranks[indexed[j].i] = rank; - } - const lbScores = highScoresForDice.map((e) => e.score); - const maxScores = game.players.map((p) => calculateMaxPossibleScore(p, game.diceCount)); - const bestLbRanks = maxScores.map((max) => { - let r = 1; - for (const s of lbScores) { if (s > max) r++; else break; } - return r; - }); - return ( - - Category - {game.players.map((p, i) => ( - - {totals[i].grandTotal} pts - - #{ranks[i]} in game · best: #{bestLbRanks[i]} - - {p.name}{p.isAi ? " 🤖" : ""} - - ))} - - ); - })()} - - {getCategories(game.diceCount).map((cat) => { - const isAvailable = available.includes(cat.id) && hasRolled; - const isSuggested = suggestedCategory === cat.id && isAvailable; - return ( - isAvailable && handleSelectCategory(cat.id)} - disabled={!isAvailable} - > - - - {isSuggested ? "⭐ " : isAvailable ? "► " : ""}{cat.label} - - - {game.players.map((p, i) => { - const scored = p.scores[cat.id]; - const showPotential = i === game.currentPlayerIndex && isAvailable; - return ( - - - {scored !== undefined ? scored : showPotential ? cat.score(game.dice) : "—"} - - - ); - })} - - ); - })} - - {/* Grand total row */} - - Grand Total - {game.players.map((p) => ( - - {calculateTotal(p, game.diceCount).grandTotal} - - ))} - - - - - ); + const router = useRouter(); + return router.push("/history")} onHelp={() => router.push("/help")} />; } - -const styles = StyleSheet.create({ - container: { padding: 20, alignItems: "center", paddingTop: 60 }, - title: { fontSize: 32, fontWeight: "bold", marginBottom: 20 }, - subtitle: { fontSize: 16, marginBottom: 10 }, - input: { borderWidth: 1, borderRadius: 8, padding: 12, width: "100%", fontSize: 16, marginBottom: 16 }, - label: { fontWeight: "bold", marginBottom: 8 }, - presetRow: { flexDirection: "row", gap: 8, marginBottom: 20, flexWrap: "wrap", justifyContent: "center" }, - presetBtn: { paddingHorizontal: 20, paddingVertical: 10, borderRadius: 8, borderWidth: 2 }, - startBtn: { paddingHorizontal: 32, paddingVertical: 14, borderRadius: 8 }, - startBtnText: { color: "#fff", fontSize: 18, fontWeight: "bold" }, - disabledBtn: { opacity: 0.5 }, - quitBtn: { alignSelf: "flex-end", borderWidth: 1, borderRadius: 6, paddingHorizontal: 12, paddingVertical: 6, marginBottom: 10 }, - quitBtnText: { color: "#c62828", fontSize: 14 }, - aiThinking: { fontWeight: "bold", marginBottom: 8 }, - diceRow: { flexDirection: "row", flexWrap: "wrap", gap: 8, justifyContent: "center", marginBottom: 16 }, - die: { width: 56, height: 56, borderRadius: 10, borderWidth: 2, alignItems: "center", justifyContent: "center" }, - dieText: { fontSize: 28 }, - rollBtn: { paddingHorizontal: 32, paddingVertical: 12, borderRadius: 8, marginBottom: 20 }, - rollBtnText: { color: "#fff", fontSize: 16, fontWeight: "bold" }, - sheetRow: { flexDirection: "row", borderBottomWidth: 1 }, - catCol: { width: 140, paddingVertical: 8, paddingHorizontal: 8 }, - playerCol: { width: 80, paddingVertical: 8, paddingHorizontal: 4 }, - finalScore: { fontSize: 28, fontWeight: "bold", marginVertical: 8 }, -}); diff --git a/apps/mobile/assets/README.md b/apps/mobile/assets/README.md new file mode 100644 index 0000000..be5a04c --- /dev/null +++ b/apps/mobile/assets/README.md @@ -0,0 +1,21 @@ +# Development icon and launch assets + +These assets use original repository-authored SVG geometry derived from the game's pip controls. There is no external artwork, font, sound or copied product logo. The source and exports follow the repository's MIT license. This does not clear third-party names or trademarks. + +`icon-source.svg` is the editable source. It combines a tilted porcelain die, an evergreen background, four evergreen corner pips and a clay center pip. Do not add lettering, an Apple-style rounded mask or an outer transparent margin to the iOS icon exports. iOS applies its own shape. + +- `icon.png`: opaque light/App Store master, 1024 by 1024. +- `icon-dark.png`: opaque dark variant, 1024 by 1024. +- `icon-tinted.png`: opaque grayscale tinted variant, 1024 by 1024. +- `launch-mark.png`: transparent launch/Android foreground mark, 1024 by 1024. + +Regenerate from the repository root with ImageMagick 7.1.2-13 Q16-HDRI: + +```sh +node scripts/ios-assets/generate.mjs +node --test scripts/ios-assets/check.test.mjs +``` + +The generator changes colors from the SVG source, strips export metadata and records the renderer plus source/export hashes in `provenance.json`. The source hash normalizes line endings to LF. Tests fully decode the PNGs, check hashes/dimensions/opacity, enforce grayscale for the tinted variant and check app-configuration references. + +Inspect native launch, small home-screen, dark and tinted rendering before release. File validation and local image inspection do not prove every system treatment. `publicIdentityApproved` remains false. Do not treat the development name, icon files or source license as public-brand or App Store approval. diff --git a/apps/mobile/assets/icon-dark.png b/apps/mobile/assets/icon-dark.png new file mode 100644 index 0000000..9467cd7 Binary files /dev/null and b/apps/mobile/assets/icon-dark.png differ diff --git a/apps/mobile/assets/icon-source.svg b/apps/mobile/assets/icon-source.svg new file mode 100644 index 0000000..6fb96d8 --- /dev/null +++ b/apps/mobile/assets/icon-source.svg @@ -0,0 +1,14 @@ + + Development dice mark + + + + + + + + + + + + diff --git a/apps/mobile/assets/icon-tinted.png b/apps/mobile/assets/icon-tinted.png new file mode 100644 index 0000000..01bc688 Binary files /dev/null and b/apps/mobile/assets/icon-tinted.png differ diff --git a/apps/mobile/assets/icon.png b/apps/mobile/assets/icon.png new file mode 100644 index 0000000..d2c408e Binary files /dev/null and b/apps/mobile/assets/icon.png differ diff --git a/apps/mobile/assets/launch-mark.png b/apps/mobile/assets/launch-mark.png new file mode 100644 index 0000000..f484f35 Binary files /dev/null and b/apps/mobile/assets/launch-mark.png differ diff --git a/apps/mobile/assets/provenance.json b/apps/mobile/assets/provenance.json new file mode 100644 index 0000000..5652e71 --- /dev/null +++ b/apps/mobile/assets/provenance.json @@ -0,0 +1,47 @@ +{ + "schemaVersion": 1, + "origin": "Repository-authored SVG geometry, adapted from the game's pip controls", + "source": "icon-source.svg", + "sourceSha256": "06a8d30e14dd58aae688027a93986c5590003b30179e6e7281e95f83befb5b4b", + "sourceNormalization": "LF", + "renderer": "Version: ImageMagick 7.1.2-13 Q16-HDRI x64 dd991e2:20260119 https://imagemagick.org", + "generator": "scripts/ios-assets/generate.mjs", + "publicIdentityApproved": false, + "externalArtwork": [], + "fonts": [], + "sound": [], + "exports": [ + { + "file": "icon.png", + "role": "ios-light-and-app-store", + "width": 1024, + "height": 1024, + "transparencyAllowed": false, + "sha256": "de1789f6e47e87e562c318e188556cb2d460b6b871060da922214ea1ee449368" + }, + { + "file": "icon-dark.png", + "role": "ios-dark", + "width": 1024, + "height": 1024, + "transparencyAllowed": false, + "sha256": "17b53cf5c0aa3074097a95ee73a5b3e8a9eb3855c64235c7b4f0bbb4ac6fd26d" + }, + { + "file": "icon-tinted.png", + "role": "ios-tinted", + "width": 1024, + "height": 1024, + "transparencyAllowed": false, + "sha256": "ede85d00f61af5e6664929f7d2715c322f809e9af6c9b352c00ebfd6a0d92073" + }, + { + "file": "launch-mark.png", + "role": "launch-and-android-foreground", + "width": 1024, + "height": 1024, + "transparencyAllowed": true, + "sha256": "d86c7aff5fa70b48c3b020de1e851a73222cfced15e77bfb766bb39236231bdd" + } + ] +} diff --git a/apps/mobile/native/Podfile.lock b/apps/mobile/native/Podfile.lock new file mode 100644 index 0000000..82af5e5 --- /dev/null +++ b/apps/mobile/native/Podfile.lock @@ -0,0 +1,2692 @@ +PODS: + - EXConstants (57.0.19): + - ExpoModulesCore + - Expo (57.0.24): + - ExpoModulesCore + - ExpoModulesJSI + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-debug + - React-Fabric + - React-featureflags + - React-graphics + - React-ImageManager + - React-jsi + - React-NativeModulesApple + - React-RCTAppDelegate + - React-RCTFabric + - React-renderercss + - React-rendererdebug + - React-utils + - ReactAppDependencyProvider + - ReactCodegen + - ReactCommon/turbomodule/bridging + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - Yoga + - ExpoAsset (57.0.18): + - ExpoModulesCore + - ExpoDomWebView (57.0.1): + - ExpoModulesCore + - ExpoFileSystem (57.0.7): + - ExpoModulesCore + - ExpoFont (57.0.4): + - ExpoModulesCore + - ExpoGlassEffect (57.0.3): + - ExpoModulesCore + - ExpoKeepAwake (57.0.2): + - ExpoModulesCore + - ExpoLinking (57.0.10): + - ExpoModulesCore + - ExpoLogBox (57.0.4): + - React-Core + - ExpoModulesCore (57.0.18): + - ExpoModulesJSI + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-debug + - React-Fabric + - React-featureflags + - React-graphics + - React-ImageManager + - React-jsi + - React-jsinspector + - React-NativeModulesApple + - React-RCTFabric + - React-renderercss + - React-rendererdebug + - React-utils + - ReactCodegen + - ReactCommon/turbomodule/bridging + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - Yoga + - ExpoModulesJSI (57.1.0): + - React-Core + - ReactCommon + - ExpoModulesWorklets (57.0.18): + - ExpoModulesCore + - ExpoModulesJSI + - ExpoModulesWorkletsAdapter (57.0.18): + - ExpoModulesCore + - ExpoModulesJSI + - ExpoModulesWorklets + - RNWorklets + - ExpoRouter (57.0.22): + - ExpoModulesCore + - RNScreens + - ExpoSplashScreen (57.0.9): + - ExpoModulesCore + - ExpoSQLite (57.0.3): + - ExpoModulesCore + - ExpoSymbols (57.0.3): + - ExpoModulesCore + - ExpoSystemUI (57.0.4): + - ExpoModulesCore + - ExpoUI (57.0.19): + - ExpoModulesCore + - ExpoModulesWorklets + - React-RCTFabric + - FBLazyVector (0.86.3) + - hermes-engine (250829098.0.17): + - hermes-engine/Pre-built (= 250829098.0.17) + - hermes-engine/Pre-built (250829098.0.17) + - RCTDeprecation (0.86.3) + - RCTRequired (0.86.3) + - RCTSwiftUI (0.86.3) + - RCTSwiftUIWrapper (0.86.3): + - RCTSwiftUI + - RCTTypeSafety (0.86.3): + - FBLazyVector (= 0.86.3) + - RCTRequired (= 0.86.3) + - React-Core (= 0.86.3) + - React (0.86.3): + - React-Core (= 0.86.3) + - React-Core/DevSupport (= 0.86.3) + - React-Core/RCTWebSocket (= 0.86.3) + - React-RCTActionSheet (= 0.86.3) + - React-RCTAnimation (= 0.86.3) + - React-RCTBlob (= 0.86.3) + - React-RCTImage (= 0.86.3) + - React-RCTLinking (= 0.86.3) + - React-RCTNetwork (= 0.86.3) + - React-RCTSettings (= 0.86.3) + - React-RCTText (= 0.86.3) + - React-RCTVibration (= 0.86.3) + - React-callinvoker (0.86.3) + - React-Core (0.86.3): + - hermes-engine + - RCTDeprecation + - React-Core-prebuilt + - React-Core/Default (= 0.86.3) + - React-cxxreact + - React-featureflags + - React-hermes + - React-jsi + - React-jsiexecutor + - React-jsinspector + - React-jsinspectorcdp + - React-jsitooling + - React-perflogger + - React-runtimeexecutor + - React-runtimescheduler + - React-utils + - ReactNativeDependencies + - Yoga + - React-Core-prebuilt (0.86.3): + - ReactNativeDependencies + - React-Core/CoreModulesHeaders (0.86.3): + - hermes-engine + - RCTDeprecation + - React-Core-prebuilt + - React-Core/Default + - React-cxxreact + - React-featureflags + - React-hermes + - React-jsi + - React-jsiexecutor + - React-jsinspector + - React-jsinspectorcdp + - React-jsitooling + - React-perflogger + - React-runtimeexecutor + - React-runtimescheduler + - React-utils + - ReactNativeDependencies + - Yoga + - React-Core/Default (0.86.3): + - hermes-engine + - RCTDeprecation + - React-Core-prebuilt + - React-cxxreact + - React-featureflags + - React-hermes + - React-jsi + - React-jsiexecutor + - React-jsinspector + - React-jsinspectorcdp + - React-jsitooling + - React-perflogger + - React-runtimeexecutor + - React-runtimescheduler + - React-utils + - ReactNativeDependencies + - Yoga + - React-Core/DevSupport (0.86.3): + - hermes-engine + - RCTDeprecation + - React-Core-prebuilt + - React-Core/Default (= 0.86.3) + - React-Core/RCTWebSocket (= 0.86.3) + - React-cxxreact + - React-featureflags + - React-hermes + - React-jsi + - React-jsiexecutor + - React-jsinspector + - React-jsinspectorcdp + - React-jsitooling + - React-perflogger + - React-runtimeexecutor + - React-runtimescheduler + - React-utils + - ReactNativeDependencies + - Yoga + - React-Core/RCTActionSheetHeaders (0.86.3): + - hermes-engine + - RCTDeprecation + - React-Core-prebuilt + - React-Core/Default + - React-cxxreact + - React-featureflags + - React-hermes + - React-jsi + - React-jsiexecutor + - React-jsinspector + - React-jsinspectorcdp + - React-jsitooling + - React-perflogger + - React-runtimeexecutor + - React-runtimescheduler + - React-utils + - ReactNativeDependencies + - Yoga + - React-Core/RCTAnimationHeaders (0.86.3): + - hermes-engine + - RCTDeprecation + - React-Core-prebuilt + - React-Core/Default + - React-cxxreact + - React-featureflags + - React-hermes + - React-jsi + - React-jsiexecutor + - React-jsinspector + - React-jsinspectorcdp + - React-jsitooling + - React-perflogger + - React-runtimeexecutor + - React-runtimescheduler + - React-utils + - ReactNativeDependencies + - Yoga + - React-Core/RCTBlobHeaders (0.86.3): + - hermes-engine + - RCTDeprecation + - React-Core-prebuilt + - React-Core/Default + - React-cxxreact + - React-featureflags + - React-hermes + - React-jsi + - React-jsiexecutor + - React-jsinspector + - React-jsinspectorcdp + - React-jsitooling + - React-perflogger + - React-runtimeexecutor + - React-runtimescheduler + - React-utils + - ReactNativeDependencies + - Yoga + - React-Core/RCTImageHeaders (0.86.3): + - hermes-engine + - RCTDeprecation + - React-Core-prebuilt + - React-Core/Default + - React-cxxreact + - React-featureflags + - React-hermes + - React-jsi + - React-jsiexecutor + - React-jsinspector + - React-jsinspectorcdp + - React-jsitooling + - React-perflogger + - React-runtimeexecutor + - React-runtimescheduler + - React-utils + - ReactNativeDependencies + - Yoga + - React-Core/RCTLinkingHeaders (0.86.3): + - hermes-engine + - RCTDeprecation + - React-Core-prebuilt + - React-Core/Default + - React-cxxreact + - React-featureflags + - React-hermes + - React-jsi + - React-jsiexecutor + - React-jsinspector + - React-jsinspectorcdp + - React-jsitooling + - React-perflogger + - React-runtimeexecutor + - React-runtimescheduler + - React-utils + - ReactNativeDependencies + - Yoga + - React-Core/RCTNetworkHeaders (0.86.3): + - hermes-engine + - RCTDeprecation + - React-Core-prebuilt + - React-Core/Default + - React-cxxreact + - React-featureflags + - React-hermes + - React-jsi + - React-jsiexecutor + - React-jsinspector + - React-jsinspectorcdp + - React-jsitooling + - React-perflogger + - React-runtimeexecutor + - React-runtimescheduler + - React-utils + - ReactNativeDependencies + - Yoga + - React-Core/RCTSettingsHeaders (0.86.3): + - hermes-engine + - RCTDeprecation + - React-Core-prebuilt + - React-Core/Default + - React-cxxreact + - React-featureflags + - React-hermes + - React-jsi + - React-jsiexecutor + - React-jsinspector + - React-jsinspectorcdp + - React-jsitooling + - React-perflogger + - React-runtimeexecutor + - React-runtimescheduler + - React-utils + - ReactNativeDependencies + - Yoga + - React-Core/RCTTextHeaders (0.86.3): + - hermes-engine + - RCTDeprecation + - React-Core-prebuilt + - React-Core/Default + - React-cxxreact + - React-featureflags + - React-hermes + - React-jsi + - React-jsiexecutor + - React-jsinspector + - React-jsinspectorcdp + - React-jsitooling + - React-perflogger + - React-runtimeexecutor + - React-runtimescheduler + - React-utils + - ReactNativeDependencies + - Yoga + - React-Core/RCTVibrationHeaders (0.86.3): + - hermes-engine + - RCTDeprecation + - React-Core-prebuilt + - React-Core/Default + - React-cxxreact + - React-featureflags + - React-hermes + - React-jsi + - React-jsiexecutor + - React-jsinspector + - React-jsinspectorcdp + - React-jsitooling + - React-perflogger + - React-runtimeexecutor + - React-runtimescheduler + - React-utils + - ReactNativeDependencies + - Yoga + - React-Core/RCTWebSocket (0.86.3): + - hermes-engine + - RCTDeprecation + - React-Core-prebuilt + - React-Core/Default (= 0.86.3) + - React-cxxreact + - React-featureflags + - React-hermes + - React-jsi + - React-jsiexecutor + - React-jsinspector + - React-jsinspectorcdp + - React-jsitooling + - React-perflogger + - React-runtimeexecutor + - React-runtimescheduler + - React-utils + - ReactNativeDependencies + - Yoga + - React-CoreModules (0.86.3): + - RCTTypeSafety (= 0.86.3) + - React-Core-prebuilt + - React-Core/CoreModulesHeaders (= 0.86.3) + - React-debug + - React-featureflags + - React-jsi (= 0.86.3) + - React-jsinspector + - React-jsinspectorcdp + - React-jsinspectortracing + - React-NativeModulesApple + - React-RCTBlob + - React-RCTFBReactNativeSpec + - React-RCTImage (= 0.86.3) + - React-runtimeexecutor + - React-utils + - ReactCommon + - ReactNativeDependencies + - React-cxxreact (0.86.3): + - hermes-engine + - React-callinvoker (= 0.86.3) + - React-Core-prebuilt + - React-debug (= 0.86.3) + - React-jsi (= 0.86.3) + - React-jsinspector + - React-jsinspectorcdp + - React-jsinspectortracing + - React-logger (= 0.86.3) + - React-perflogger (= 0.86.3) + - React-runtimeexecutor + - React-timing (= 0.86.3) + - React-utils + - ReactNativeDependencies + - React-debug (0.86.3): + - React-debug/redbox (= 0.86.3) + - React-debug/redbox (0.86.3) + - React-defaultsnativemodule (0.86.3): + - hermes-engine + - React-Core-prebuilt + - React-domnativemodule + - React-Fabric/animated + - React-featureflags + - React-featureflagsnativemodule + - React-idlecallbacksnativemodule + - React-intersectionobservernativemodule + - React-jsi + - React-jsiexecutor + - React-microtasksnativemodule + - React-mutationobservernativemodule + - React-RCTFBReactNativeSpec + - React-viewtransitionnativemodule + - React-webperformancenativemodule + - ReactNativeDependencies + - Yoga + - React-domnativemodule (0.86.3): + - hermes-engine + - React-Core-prebuilt + - React-Fabric + - React-Fabric/bridging + - React-FabricComponents + - React-graphics + - React-jsi + - React-jsiexecutor + - React-RCTFBReactNativeSpec + - React-runtimeexecutor + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - Yoga + - React-Fabric (0.86.3): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-cxxreact + - React-debug + - React-Fabric/animated (= 0.86.3) + - React-Fabric/animationbackend (= 0.86.3) + - React-Fabric/animations (= 0.86.3) + - React-Fabric/attributedstring (= 0.86.3) + - React-Fabric/bridging (= 0.86.3) + - React-Fabric/componentregistry (= 0.86.3) + - React-Fabric/componentregistrynative (= 0.86.3) + - React-Fabric/components (= 0.86.3) + - React-Fabric/consistency (= 0.86.3) + - React-Fabric/core (= 0.86.3) + - React-Fabric/dom (= 0.86.3) + - React-Fabric/imagemanager (= 0.86.3) + - React-Fabric/leakchecker (= 0.86.3) + - React-Fabric/mounting (= 0.86.3) + - React-Fabric/observers (= 0.86.3) + - React-Fabric/scheduler (= 0.86.3) + - React-Fabric/telemetry (= 0.86.3) + - React-Fabric/uimanager (= 0.86.3) + - React-Fabric/viewtransition (= 0.86.3) + - React-featureflags + - React-graphics + - React-jsi + - React-jsiexecutor + - React-logger + - React-rendererdebug + - React-runtimeexecutor + - React-runtimescheduler + - React-utils + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - React-Fabric/animated (0.86.3): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-cxxreact + - React-debug + - React-Fabric/animationbackend + - React-featureflags + - React-graphics + - React-jsi + - React-jsiexecutor + - React-logger + - React-rendererdebug + - React-runtimeexecutor + - React-runtimescheduler + - React-utils + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - React-Fabric/animationbackend (0.86.3): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-cxxreact + - React-debug + - React-featureflags + - React-graphics + - React-jsi + - React-jsiexecutor + - React-logger + - React-rendererdebug + - React-runtimeexecutor + - React-runtimescheduler + - React-utils + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - React-Fabric/animations (0.86.3): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-cxxreact + - React-debug + - React-featureflags + - React-graphics + - React-jsi + - React-jsiexecutor + - React-logger + - React-rendererdebug + - React-runtimeexecutor + - React-runtimescheduler + - React-utils + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - React-Fabric/attributedstring (0.86.3): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-cxxreact + - React-debug + - React-featureflags + - React-graphics + - React-jsi + - React-jsiexecutor + - React-logger + - React-rendererdebug + - React-runtimeexecutor + - React-runtimescheduler + - React-utils + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - React-Fabric/bridging (0.86.3): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-cxxreact + - React-debug + - React-featureflags + - React-graphics + - React-jsi + - React-jsiexecutor + - React-logger + - React-rendererdebug + - React-runtimeexecutor + - React-runtimescheduler + - React-utils + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - React-Fabric/componentregistry (0.86.3): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-cxxreact + - React-debug + - React-featureflags + - React-graphics + - React-jsi + - React-jsiexecutor + - React-logger + - React-rendererdebug + - React-runtimeexecutor + - React-runtimescheduler + - React-utils + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - React-Fabric/componentregistrynative (0.86.3): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-cxxreact + - React-debug + - React-featureflags + - React-graphics + - React-jsi + - React-jsiexecutor + - React-logger + - React-rendererdebug + - React-runtimeexecutor + - React-runtimescheduler + - React-utils + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - React-Fabric/components (0.86.3): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-cxxreact + - React-debug + - React-Fabric/components/legacyviewmanagerinterop (= 0.86.3) + - React-Fabric/components/root (= 0.86.3) + - React-Fabric/components/scrollview (= 0.86.3) + - React-Fabric/components/view (= 0.86.3) + - React-featureflags + - React-graphics + - React-jsi + - React-jsiexecutor + - React-logger + - React-rendererdebug + - React-runtimeexecutor + - React-runtimescheduler + - React-utils + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - React-Fabric/components/legacyviewmanagerinterop (0.86.3): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-cxxreact + - React-debug + - React-featureflags + - React-graphics + - React-jsi + - React-jsiexecutor + - React-logger + - React-rendererdebug + - React-runtimeexecutor + - React-runtimescheduler + - React-utils + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - React-Fabric/components/root (0.86.3): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-cxxreact + - React-debug + - React-featureflags + - React-graphics + - React-jsi + - React-jsiexecutor + - React-logger + - React-rendererdebug + - React-runtimeexecutor + - React-runtimescheduler + - React-utils + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - React-Fabric/components/scrollview (0.86.3): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-cxxreact + - React-debug + - React-featureflags + - React-graphics + - React-jsi + - React-jsiexecutor + - React-logger + - React-rendererdebug + - React-runtimeexecutor + - React-runtimescheduler + - React-utils + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - React-Fabric/components/view (0.86.3): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-cxxreact + - React-debug + - React-featureflags + - React-graphics + - React-jsi + - React-jsiexecutor + - React-logger + - React-renderercss + - React-rendererdebug + - React-runtimeexecutor + - React-runtimescheduler + - React-utils + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - Yoga + - React-Fabric/consistency (0.86.3): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-cxxreact + - React-debug + - React-featureflags + - React-graphics + - React-jsi + - React-jsiexecutor + - React-logger + - React-rendererdebug + - React-runtimeexecutor + - React-runtimescheduler + - React-utils + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - React-Fabric/core (0.86.3): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-cxxreact + - React-debug + - React-featureflags + - React-graphics + - React-jsi + - React-jsiexecutor + - React-logger + - React-rendererdebug + - React-runtimeexecutor + - React-runtimescheduler + - React-utils + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - React-Fabric/dom (0.86.3): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-cxxreact + - React-debug + - React-featureflags + - React-graphics + - React-jsi + - React-jsiexecutor + - React-logger + - React-rendererdebug + - React-runtimeexecutor + - React-runtimescheduler + - React-utils + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - React-Fabric/imagemanager (0.86.3): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-cxxreact + - React-debug + - React-featureflags + - React-graphics + - React-jsi + - React-jsiexecutor + - React-logger + - React-rendererdebug + - React-runtimeexecutor + - React-runtimescheduler + - React-utils + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - React-Fabric/leakchecker (0.86.3): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-cxxreact + - React-debug + - React-featureflags + - React-graphics + - React-jsi + - React-jsiexecutor + - React-logger + - React-rendererdebug + - React-runtimeexecutor + - React-runtimescheduler + - React-utils + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - React-Fabric/mounting (0.86.3): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-cxxreact + - React-debug + - React-featureflags + - React-graphics + - React-jsi + - React-jsiexecutor + - React-jsinspectortracing + - React-logger + - React-rendererdebug + - React-runtimeexecutor + - React-runtimescheduler + - React-utils + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - React-Fabric/observers (0.86.3): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-cxxreact + - React-debug + - React-Fabric/observers/events (= 0.86.3) + - React-Fabric/observers/intersection (= 0.86.3) + - React-Fabric/observers/mutation (= 0.86.3) + - React-featureflags + - React-graphics + - React-jsi + - React-jsiexecutor + - React-logger + - React-rendererdebug + - React-runtimeexecutor + - React-runtimescheduler + - React-utils + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - React-Fabric/observers/events (0.86.3): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-cxxreact + - React-debug + - React-featureflags + - React-graphics + - React-jsi + - React-jsiexecutor + - React-logger + - React-rendererdebug + - React-runtimeexecutor + - React-runtimescheduler + - React-utils + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - React-Fabric/observers/intersection (0.86.3): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-cxxreact + - React-debug + - React-featureflags + - React-graphics + - React-jsi + - React-jsiexecutor + - React-logger + - React-rendererdebug + - React-runtimeexecutor + - React-runtimescheduler + - React-utils + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - React-Fabric/observers/mutation (0.86.3): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-cxxreact + - React-debug + - React-featureflags + - React-graphics + - React-jsi + - React-jsiexecutor + - React-logger + - React-rendererdebug + - React-runtimeexecutor + - React-runtimescheduler + - React-utils + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - React-Fabric/scheduler (0.86.3): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-cxxreact + - React-debug + - React-Fabric/animationbackend + - React-Fabric/observers/events + - React-Fabric/viewtransition + - React-featureflags + - React-graphics + - React-jsi + - React-jsiexecutor + - React-logger + - React-performancecdpmetrics + - React-performancetimeline + - React-rendererdebug + - React-runtimeexecutor + - React-runtimescheduler + - React-utils + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - React-Fabric/telemetry (0.86.3): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-cxxreact + - React-debug + - React-featureflags + - React-graphics + - React-jsi + - React-jsiexecutor + - React-logger + - React-rendererdebug + - React-runtimeexecutor + - React-runtimescheduler + - React-utils + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - React-Fabric/uimanager (0.86.3): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-cxxreact + - React-debug + - React-Fabric/uimanager/consistency (= 0.86.3) + - React-featureflags + - React-graphics + - React-jsi + - React-jsiexecutor + - React-logger + - React-rendererconsistency + - React-rendererdebug + - React-runtimeexecutor + - React-runtimescheduler + - React-utils + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - React-Fabric/uimanager/consistency (0.86.3): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-cxxreact + - React-debug + - React-featureflags + - React-graphics + - React-jsi + - React-jsiexecutor + - React-logger + - React-rendererconsistency + - React-rendererdebug + - React-runtimeexecutor + - React-runtimescheduler + - React-utils + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - React-Fabric/viewtransition (0.86.3): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-cxxreact + - React-debug + - React-featureflags + - React-graphics + - React-jsi + - React-jsiexecutor + - React-logger + - React-rendererdebug + - React-runtimeexecutor + - React-runtimescheduler + - React-utils + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - React-FabricComponents (0.86.3): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-cxxreact + - React-debug + - React-Fabric + - React-FabricComponents/components (= 0.86.3) + - React-FabricComponents/textlayoutmanager (= 0.86.3) + - React-featureflags + - React-graphics + - React-jsi + - React-jsiexecutor + - React-logger + - React-RCTFBReactNativeSpec + - React-rendererdebug + - React-runtimescheduler + - React-utils + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - Yoga + - React-FabricComponents/components (0.86.3): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-cxxreact + - React-debug + - React-Fabric + - React-FabricComponents/components/inputaccessory (= 0.86.3) + - React-FabricComponents/components/iostextinput (= 0.86.3) + - React-FabricComponents/components/modal (= 0.86.3) + - React-FabricComponents/components/rncore (= 0.86.3) + - React-FabricComponents/components/safeareaview (= 0.86.3) + - React-FabricComponents/components/scrollview (= 0.86.3) + - React-FabricComponents/components/switch (= 0.86.3) + - React-FabricComponents/components/text (= 0.86.3) + - React-FabricComponents/components/textinput (= 0.86.3) + - React-FabricComponents/components/unimplementedview (= 0.86.3) + - React-FabricComponents/components/virtualview (= 0.86.3) + - React-featureflags + - React-graphics + - React-jsi + - React-jsiexecutor + - React-logger + - React-RCTFBReactNativeSpec + - React-rendererdebug + - React-runtimescheduler + - React-utils + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - Yoga + - React-FabricComponents/components/inputaccessory (0.86.3): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-cxxreact + - React-debug + - React-Fabric + - React-featureflags + - React-graphics + - React-jsi + - React-jsiexecutor + - React-logger + - React-RCTFBReactNativeSpec + - React-rendererdebug + - React-runtimescheduler + - React-utils + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - Yoga + - React-FabricComponents/components/iostextinput (0.86.3): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-cxxreact + - React-debug + - React-Fabric + - React-featureflags + - React-graphics + - React-jsi + - React-jsiexecutor + - React-logger + - React-RCTFBReactNativeSpec + - React-rendererdebug + - React-runtimescheduler + - React-utils + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - Yoga + - React-FabricComponents/components/modal (0.86.3): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-cxxreact + - React-debug + - React-Fabric + - React-featureflags + - React-graphics + - React-jsi + - React-jsiexecutor + - React-logger + - React-RCTFBReactNativeSpec + - React-rendererdebug + - React-runtimescheduler + - React-utils + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - Yoga + - React-FabricComponents/components/rncore (0.86.3): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-cxxreact + - React-debug + - React-Fabric + - React-featureflags + - React-graphics + - React-jsi + - React-jsiexecutor + - React-logger + - React-RCTFBReactNativeSpec + - React-rendererdebug + - React-runtimescheduler + - React-utils + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - Yoga + - React-FabricComponents/components/safeareaview (0.86.3): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-cxxreact + - React-debug + - React-Fabric + - React-featureflags + - React-graphics + - React-jsi + - React-jsiexecutor + - React-logger + - React-RCTFBReactNativeSpec + - React-rendererdebug + - React-runtimescheduler + - React-utils + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - Yoga + - React-FabricComponents/components/scrollview (0.86.3): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-cxxreact + - React-debug + - React-Fabric + - React-featureflags + - React-graphics + - React-jsi + - React-jsiexecutor + - React-logger + - React-RCTFBReactNativeSpec + - React-rendererdebug + - React-runtimescheduler + - React-utils + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - Yoga + - React-FabricComponents/components/switch (0.86.3): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-cxxreact + - React-debug + - React-Fabric + - React-featureflags + - React-graphics + - React-jsi + - React-jsiexecutor + - React-logger + - React-RCTFBReactNativeSpec + - React-rendererdebug + - React-runtimescheduler + - React-utils + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - Yoga + - React-FabricComponents/components/text (0.86.3): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-cxxreact + - React-debug + - React-Fabric + - React-featureflags + - React-graphics + - React-jsi + - React-jsiexecutor + - React-logger + - React-RCTFBReactNativeSpec + - React-rendererdebug + - React-runtimescheduler + - React-utils + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - Yoga + - React-FabricComponents/components/textinput (0.86.3): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-cxxreact + - React-debug + - React-Fabric + - React-featureflags + - React-graphics + - React-jsi + - React-jsiexecutor + - React-logger + - React-RCTFBReactNativeSpec + - React-rendererdebug + - React-runtimescheduler + - React-utils + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - Yoga + - React-FabricComponents/components/unimplementedview (0.86.3): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-cxxreact + - React-debug + - React-Fabric + - React-featureflags + - React-graphics + - React-jsi + - React-jsiexecutor + - React-logger + - React-RCTFBReactNativeSpec + - React-rendererdebug + - React-runtimescheduler + - React-utils + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - Yoga + - React-FabricComponents/components/virtualview (0.86.3): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-cxxreact + - React-debug + - React-Fabric + - React-featureflags + - React-graphics + - React-jsi + - React-jsiexecutor + - React-logger + - React-RCTFBReactNativeSpec + - React-rendererdebug + - React-runtimescheduler + - React-utils + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - Yoga + - React-FabricComponents/textlayoutmanager (0.86.3): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-cxxreact + - React-debug + - React-Fabric + - React-featureflags + - React-graphics + - React-jsi + - React-jsiexecutor + - React-logger + - React-RCTFBReactNativeSpec + - React-rendererdebug + - React-runtimescheduler + - React-utils + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - Yoga + - React-FabricImage (0.86.3): + - hermes-engine + - RCTRequired (= 0.86.3) + - RCTTypeSafety (= 0.86.3) + - React-Core-prebuilt + - React-Fabric + - React-featureflags + - React-graphics + - React-ImageManager + - React-jsi + - React-jsiexecutor (= 0.86.3) + - React-logger + - React-rendererdebug + - React-utils + - ReactCommon + - ReactNativeDependencies + - Yoga + - React-featureflags (0.86.3): + - React-Core-prebuilt + - ReactNativeDependencies + - React-featureflagsnativemodule (0.86.3): + - hermes-engine + - React-Core-prebuilt + - React-featureflags + - React-jsi + - React-jsiexecutor + - React-RCTFBReactNativeSpec + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - React-graphics (0.86.3): + - hermes-engine + - React-Core-prebuilt + - React-featureflags + - React-jsi + - React-jsiexecutor + - React-rendererdebug + - React-utils + - ReactNativeDependencies + - React-hermes (0.86.3): + - hermes-engine + - React-Core-prebuilt + - React-cxxreact (= 0.86.3) + - React-jsi + - React-jsiexecutor (= 0.86.3) + - React-jsinspector + - React-jsinspectorcdp + - React-jsinspectortracing + - React-jsitooling + - React-oscompat + - React-perflogger (= 0.86.3) + - React-runtimeexecutor + - ReactNativeDependencies + - React-idlecallbacksnativemodule (0.86.3): + - hermes-engine + - React-Core-prebuilt + - React-jsi + - React-jsiexecutor + - React-RCTFBReactNativeSpec + - React-runtimeexecutor + - React-runtimescheduler + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - React-ImageManager (0.86.3): + - React-Core-prebuilt + - React-Core/Default + - React-debug + - React-Fabric + - React-graphics + - React-rendererdebug + - React-utils + - ReactNativeDependencies + - React-intersectionobservernativemodule (0.86.3): + - hermes-engine + - React-Core-prebuilt + - React-cxxreact + - React-Fabric + - React-Fabric/bridging + - React-graphics + - React-jsi + - React-jsiexecutor + - React-RCTFBReactNativeSpec + - React-runtimeexecutor + - React-runtimescheduler + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - Yoga + - React-jserrorhandler (0.86.3): + - hermes-engine + - React-Core-prebuilt + - React-cxxreact + - React-debug + - React-featureflags + - React-jsi + - ReactCommon/turbomodule/bridging + - ReactNativeDependencies + - React-jsi (0.86.3): + - hermes-engine + - React-Core-prebuilt + - ReactNativeDependencies + - React-jsiexecutor (0.86.3): + - hermes-engine + - React-Core-prebuilt + - React-cxxreact + - React-debug + - React-jserrorhandler + - React-jsi + - React-jsinspector + - React-jsinspectorcdp + - React-jsinspectortracing + - React-jsitooling + - React-perflogger + - React-runtimeexecutor + - React-utils + - ReactNativeDependencies + - React-jsinspector (0.86.3): + - hermes-engine + - React-Core-prebuilt + - React-featureflags + - React-jsi + - React-jsinspectorcdp + - React-jsinspectornetwork + - React-jsinspectortracing + - React-oscompat + - React-perflogger (= 0.86.3) + - React-runtimeexecutor + - React-utils + - ReactNativeDependencies + - React-jsinspectorcdp (0.86.3): + - React-Core-prebuilt + - ReactNativeDependencies + - React-jsinspectornetwork (0.86.3): + - React-Core-prebuilt + - React-jsinspectorcdp + - ReactNativeDependencies + - React-jsinspectortracing (0.86.3): + - hermes-engine + - React-Core-prebuilt + - React-jsi + - React-jsinspectornetwork + - React-oscompat + - React-timing + - React-utils + - ReactNativeDependencies + - React-jsitooling (0.86.3): + - hermes-engine + - React-Core-prebuilt + - React-cxxreact (= 0.86.3) + - React-debug + - React-jsi (= 0.86.3) + - React-jsinspector + - React-jsinspectorcdp + - React-jsinspectortracing + - React-runtimeexecutor + - React-utils + - ReactNativeDependencies + - React-jsitracing (0.86.3): + - React-jsi + - React-logger (0.86.3): + - React-Core-prebuilt + - ReactNativeDependencies + - React-Mapbuffer (0.86.3): + - React-Core-prebuilt + - React-debug + - ReactNativeDependencies + - React-microtasksnativemodule (0.86.3): + - hermes-engine + - React-Core-prebuilt + - React-jsi + - React-jsiexecutor + - React-RCTFBReactNativeSpec + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - React-mutationobservernativemodule (0.86.3): + - hermes-engine + - React-Core-prebuilt + - React-cxxreact + - React-Fabric + - React-Fabric/bridging + - React-Fabric/observers/mutation + - React-featureflags + - React-jsi + - React-jsiexecutor + - React-RCTFBReactNativeSpec + - React-runtimeexecutor + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - Yoga + - react-native-safe-area-context (5.9.1): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-debug + - React-Fabric + - React-featureflags + - React-graphics + - React-ImageManager + - React-jsi + - react-native-safe-area-context/common (= 5.9.1) + - react-native-safe-area-context/fabric (= 5.9.1) + - React-NativeModulesApple + - React-RCTFabric + - React-renderercss + - React-rendererdebug + - React-utils + - ReactCodegen + - ReactCommon/turbomodule/bridging + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - Yoga + - react-native-safe-area-context/common (5.9.1): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-debug + - React-Fabric + - React-featureflags + - React-graphics + - React-ImageManager + - React-jsi + - React-NativeModulesApple + - React-RCTFabric + - React-renderercss + - React-rendererdebug + - React-utils + - ReactCodegen + - ReactCommon/turbomodule/bridging + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - Yoga + - react-native-safe-area-context/fabric (5.9.1): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-debug + - React-Fabric + - React-featureflags + - React-graphics + - React-ImageManager + - React-jsi + - react-native-safe-area-context/common + - React-NativeModulesApple + - React-RCTFabric + - React-renderercss + - React-rendererdebug + - React-utils + - ReactCodegen + - ReactCommon/turbomodule/bridging + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - Yoga + - React-NativeModulesApple (0.86.3): + - hermes-engine + - React-callinvoker + - React-Core + - React-Core-prebuilt + - React-cxxreact + - React-debug + - React-featureflags + - React-jsi + - React-jsinspector + - React-jsinspectorcdp + - React-runtimeexecutor + - ReactCommon/turbomodule/bridging + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - React-networking (0.86.3): + - React-Core-prebuilt + - React-jsinspectornetwork + - React-jsinspectortracing + - React-performancetimeline + - React-timing + - ReactNativeDependencies + - React-oscompat (0.86.3) + - React-perflogger (0.86.3): + - React-Core-prebuilt + - ReactNativeDependencies + - React-performancecdpmetrics (0.86.3): + - hermes-engine + - React-Core-prebuilt + - React-jsi + - React-performancetimeline + - React-runtimeexecutor + - React-timing + - ReactNativeDependencies + - React-performancetimeline (0.86.3): + - React-Core-prebuilt + - React-featureflags + - React-jsinspector + - React-jsinspectortracing + - React-perflogger + - React-timing + - ReactNativeDependencies + - React-RCTActionSheet (0.86.3): + - React-Core/RCTActionSheetHeaders (= 0.86.3) + - React-RCTAnimation (0.86.3): + - RCTTypeSafety + - React-Core-prebuilt + - React-Core/RCTAnimationHeaders + - React-debug + - React-featureflags + - React-jsi + - React-NativeModulesApple + - React-RCTFBReactNativeSpec + - ReactCommon + - ReactNativeDependencies + - React-RCTAppDelegate (0.86.3): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-CoreModules + - React-debug + - React-defaultsnativemodule + - React-Fabric + - React-featureflags + - React-graphics + - React-hermes + - React-jsitooling + - React-NativeModulesApple + - React-RCTFabric + - React-RCTFBReactNativeSpec + - React-RCTImage + - React-RCTNetwork + - React-RCTRuntime + - React-rendererdebug + - React-RuntimeApple + - React-RuntimeCore + - React-runtimeexecutor + - React-runtimescheduler + - React-utils + - ReactCommon + - ReactNativeDependencies + - React-RCTBlob (0.86.3): + - hermes-engine + - React-Core-prebuilt + - React-Core/RCTBlobHeaders + - React-Core/RCTWebSocket + - React-jsi + - React-jsinspector + - React-jsinspectorcdp + - React-NativeModulesApple + - React-RCTFBReactNativeSpec + - React-RCTNetwork + - ReactCommon + - ReactNativeDependencies + - React-RCTFabric (0.86.3): + - hermes-engine + - RCTSwiftUIWrapper + - React-Core + - React-Core-prebuilt + - React-debug + - React-Fabric + - React-FabricComponents + - React-FabricImage + - React-featureflags + - React-graphics + - React-ImageManager + - React-jsi + - React-jsinspector + - React-jsinspectorcdp + - React-jsinspectortracing + - React-networking + - React-performancecdpmetrics + - React-performancetimeline + - React-RCTAnimation + - React-RCTFBReactNativeSpec + - React-RCTImage + - React-RCTText + - React-rendererconsistency + - React-renderercss + - React-rendererdebug + - React-runtimeexecutor + - React-runtimescheduler + - React-utils + - ReactNativeDependencies + - Yoga + - React-RCTFBReactNativeSpec (0.86.3): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-jsi + - React-NativeModulesApple + - React-RCTFBReactNativeSpec/components (= 0.86.3) + - ReactCommon + - ReactNativeDependencies + - React-RCTFBReactNativeSpec/components (0.86.3): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-debug + - React-Fabric + - React-featureflags + - React-graphics + - React-jsi + - React-NativeModulesApple + - React-rendererdebug + - React-utils + - ReactCommon + - ReactNativeDependencies + - Yoga + - React-RCTImage (0.86.3): + - RCTTypeSafety + - React-Core-prebuilt + - React-Core/RCTImageHeaders + - React-jsi + - React-NativeModulesApple + - React-RCTFBReactNativeSpec + - React-RCTNetwork + - ReactCommon + - ReactNativeDependencies + - React-RCTLinking (0.86.3): + - React-Core/RCTLinkingHeaders (= 0.86.3) + - React-jsi (= 0.86.3) + - React-NativeModulesApple + - React-RCTFBReactNativeSpec + - ReactCommon + - ReactCommon/turbomodule/core (= 0.86.3) + - React-RCTNetwork (0.86.3): + - RCTTypeSafety + - React-Core-prebuilt + - React-Core/RCTNetworkHeaders + - React-debug + - React-featureflags + - React-jsi + - React-jsinspectorcdp + - React-jsinspectornetwork + - React-NativeModulesApple + - React-networking + - React-RCTFBReactNativeSpec + - ReactCommon + - ReactNativeDependencies + - React-RCTRuntime (0.86.3): + - hermes-engine + - React-Core + - React-Core-prebuilt + - React-debug + - React-jsi + - React-jsinspector + - React-jsinspectorcdp + - React-jsinspectortracing + - React-jsitooling + - React-RuntimeApple + - React-RuntimeCore + - React-runtimeexecutor + - React-RuntimeHermes + - React-utils + - ReactNativeDependencies + - React-RCTSettings (0.86.3): + - RCTTypeSafety + - React-Core-prebuilt + - React-Core/RCTSettingsHeaders + - React-jsi + - React-NativeModulesApple + - React-RCTFBReactNativeSpec + - ReactCommon + - ReactNativeDependencies + - React-RCTText (0.86.3): + - React-Core/RCTTextHeaders (= 0.86.3) + - Yoga + - React-RCTVibration (0.86.3): + - React-Core-prebuilt + - React-Core/RCTVibrationHeaders + - React-jsi + - React-NativeModulesApple + - React-RCTFBReactNativeSpec + - ReactCommon + - ReactNativeDependencies + - React-rendererconsistency (0.86.3) + - React-renderercss (0.86.3): + - React-debug + - React-utils + - React-rendererdebug (0.86.3): + - React-Core-prebuilt + - React-debug + - ReactNativeDependencies + - React-RuntimeApple (0.86.3): + - hermes-engine + - React-callinvoker + - React-Core-prebuilt + - React-Core/Default + - React-CoreModules + - React-cxxreact + - React-featureflags + - React-jserrorhandler + - React-jsi + - React-jsiexecutor + - React-jsinspector + - React-jsitooling + - React-Mapbuffer + - React-NativeModulesApple + - React-RCTFabric + - React-RCTFBReactNativeSpec + - React-RuntimeCore + - React-runtimeexecutor + - React-RuntimeHermes + - React-runtimescheduler + - React-utils + - ReactNativeDependencies + - React-RuntimeCore (0.86.3): + - hermes-engine + - React-Core-prebuilt + - React-cxxreact + - React-Fabric + - React-featureflags + - React-jserrorhandler + - React-jsi + - React-jsiexecutor + - React-jsinspector + - React-jsitooling + - React-performancetimeline + - React-runtimeexecutor + - React-runtimescheduler + - React-utils + - ReactNativeDependencies + - React-runtimeexecutor (0.86.3): + - React-Core-prebuilt + - React-debug + - React-featureflags + - React-jsi (= 0.86.3) + - React-utils + - ReactNativeDependencies + - React-RuntimeHermes (0.86.3): + - hermes-engine + - React-Core-prebuilt + - React-featureflags + - React-hermes + - React-jsi + - React-jsinspector + - React-jsinspectorcdp + - React-jsinspectortracing + - React-jsitooling + - React-jsitracing + - React-RuntimeCore + - React-runtimeexecutor + - React-utils + - ReactNativeDependencies + - React-runtimescheduler (0.86.3): + - hermes-engine + - React-callinvoker + - React-Core-prebuilt + - React-cxxreact + - React-debug + - React-featureflags + - React-jsi + - React-jsinspectortracing + - React-performancetimeline + - React-rendererconsistency + - React-rendererdebug + - React-runtimeexecutor + - React-timing + - React-utils + - ReactNativeDependencies + - React-timing (0.86.3): + - React-debug + - React-utils (0.86.3): + - hermes-engine + - React-Core-prebuilt + - React-debug + - React-jsi (= 0.86.3) + - ReactNativeDependencies + - React-viewtransitionnativemodule (0.86.3): + - hermes-engine + - React-Core-prebuilt + - React-Fabric + - React-Fabric/bridging + - React-jsi + - React-jsiexecutor + - React-RCTFBReactNativeSpec + - React-runtimeexecutor + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - Yoga + - React-webperformancenativemodule (0.86.3): + - hermes-engine + - React-Core-prebuilt + - React-cxxreact + - React-jsi + - React-jsiexecutor + - React-performancetimeline + - React-RCTFBReactNativeSpec + - React-runtimeexecutor + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - ReactAppDependencyProvider (0.86.3): + - ReactCodegen + - ReactCodegen (0.86.3): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-debug + - React-Fabric + - React-FabricImage + - React-featureflags + - React-graphics + - React-jsi + - React-jsiexecutor + - React-NativeModulesApple + - React-RCTAppDelegate + - React-rendererdebug + - React-utils + - ReactCommon/turbomodule/bridging + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - ReactCommon (0.86.3): + - React-Core-prebuilt + - ReactCommon/turbomodule (= 0.86.3) + - ReactNativeDependencies + - ReactCommon/turbomodule (0.86.3): + - hermes-engine + - React-callinvoker (= 0.86.3) + - React-Core-prebuilt + - React-cxxreact (= 0.86.3) + - React-jsi (= 0.86.3) + - React-logger (= 0.86.3) + - React-perflogger (= 0.86.3) + - ReactCommon/turbomodule/bridging (= 0.86.3) + - ReactCommon/turbomodule/core (= 0.86.3) + - ReactNativeDependencies + - ReactCommon/turbomodule/bridging (0.86.3): + - hermes-engine + - React-callinvoker (= 0.86.3) + - React-Core-prebuilt + - React-cxxreact (= 0.86.3) + - React-jsi (= 0.86.3) + - React-logger (= 0.86.3) + - React-perflogger (= 0.86.3) + - ReactNativeDependencies + - ReactCommon/turbomodule/core (0.86.3): + - hermes-engine + - React-callinvoker (= 0.86.3) + - React-Core-prebuilt + - React-cxxreact (= 0.86.3) + - React-debug (= 0.86.3) + - React-featureflags (= 0.86.3) + - React-jsi (= 0.86.3) + - React-logger (= 0.86.3) + - React-perflogger (= 0.86.3) + - React-utils (= 0.86.3) + - ReactNativeDependencies + - ReactNativeDependencies (0.86.3) + - RNCAsyncStorage (2.2.0): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-debug + - React-Fabric + - React-featureflags + - React-graphics + - React-ImageManager + - React-jsi + - React-NativeModulesApple + - React-RCTFabric + - React-renderercss + - React-rendererdebug + - React-utils + - ReactCodegen + - ReactCommon/turbomodule/bridging + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - Yoga + - RNCMaskedView (0.3.2): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-debug + - React-Fabric + - React-featureflags + - React-graphics + - React-ImageManager + - React-jsi + - React-NativeModulesApple + - React-RCTFabric + - React-renderercss + - React-rendererdebug + - React-utils + - ReactCodegen + - ReactCommon/turbomodule/bridging + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - Yoga + - RNGestureHandler (3.3.0): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-debug + - React-Fabric + - React-featureflags + - React-graphics + - React-ImageManager + - React-jsi + - React-NativeModulesApple + - React-RCTFabric + - React-renderercss + - React-rendererdebug + - React-utils + - ReactCodegen + - ReactCommon/turbomodule/bridging + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - Yoga + - RNReanimated (4.7.0): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-debug + - React-Fabric + - React-featureflags + - React-graphics + - React-hermes + - React-ImageManager + - React-jsi + - React-NativeModulesApple + - React-RCTFabric + - React-renderercss + - React-rendererdebug + - React-utils + - ReactCodegen + - ReactCommon/turbomodule/bridging + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - RNReanimated/apple (= 4.7.0) + - RNReanimated/common (= 4.7.0) + - RNReanimated/view (= 4.7.0) + - RNWorklets + - Yoga + - RNReanimated/apple (4.7.0): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-debug + - React-Fabric + - React-featureflags + - React-graphics + - React-hermes + - React-ImageManager + - React-jsi + - React-NativeModulesApple + - React-RCTFabric + - React-renderercss + - React-rendererdebug + - React-utils + - ReactCodegen + - ReactCommon/turbomodule/bridging + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - RNWorklets + - Yoga + - RNReanimated/common (4.7.0): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-debug + - React-Fabric + - React-featureflags + - React-graphics + - React-hermes + - React-ImageManager + - React-jsi + - React-NativeModulesApple + - React-RCTFabric + - React-renderercss + - React-rendererdebug + - React-utils + - ReactCodegen + - ReactCommon/turbomodule/bridging + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - RNWorklets + - Yoga + - RNReanimated/view (4.7.0): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-debug + - React-Fabric + - React-featureflags + - React-graphics + - React-hermes + - React-ImageManager + - React-jsi + - React-NativeModulesApple + - React-RCTFabric + - React-renderercss + - React-rendererdebug + - React-utils + - ReactCodegen + - ReactCommon/turbomodule/bridging + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - RNWorklets + - Yoga + - RNScreens (4.26.0): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-debug + - React-Fabric + - React-featureflags + - React-graphics + - React-ImageManager + - React-jsi + - React-NativeModulesApple + - React-RCTFabric + - React-RCTImage + - React-renderercss + - React-rendererdebug + - React-utils + - ReactCodegen + - ReactCommon/turbomodule/bridging + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - RNScreens/common (= 4.26.0) + - Yoga + - RNScreens/common (4.26.0): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-debug + - React-Fabric + - React-featureflags + - React-graphics + - React-ImageManager + - React-jsi + - React-NativeModulesApple + - React-RCTFabric + - React-RCTImage + - React-renderercss + - React-rendererdebug + - React-utils + - ReactCodegen + - ReactCommon/turbomodule/bridging + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - Yoga + - RNWorklets (0.13.0): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-debug + - React-Fabric + - React-featureflags + - React-graphics + - React-hermes + - React-ImageManager + - React-jsi + - React-NativeModulesApple + - React-RCTFabric + - React-renderercss + - React-rendererdebug + - React-utils + - ReactCodegen + - ReactCommon/turbomodule/bridging + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - RNWorklets/apple (= 0.13.0) + - RNWorklets/common (= 0.13.0) + - Yoga + - RNWorklets/apple (0.13.0): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-debug + - React-Fabric + - React-featureflags + - React-graphics + - React-hermes + - React-ImageManager + - React-jsi + - React-NativeModulesApple + - React-RCTFabric + - React-renderercss + - React-rendererdebug + - React-utils + - ReactCodegen + - ReactCommon/turbomodule/bridging + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - Yoga + - RNWorklets/common (0.13.0): + - hermes-engine + - RCTRequired + - RCTTypeSafety + - React-Core + - React-Core-prebuilt + - React-debug + - React-Fabric + - React-featureflags + - React-graphics + - React-hermes + - React-ImageManager + - React-jsi + - React-NativeModulesApple + - React-RCTFabric + - React-renderercss + - React-rendererdebug + - React-utils + - ReactCodegen + - ReactCommon/turbomodule/bridging + - ReactCommon/turbomodule/core + - ReactNativeDependencies + - Yoga + - Yoga (0.0.0) + +DEPENDENCIES: + - "EXConstants (from `../../../node_modules/.bun/expo-constants@57.0.19+19c046550412b028/node_modules/expo-constants/ios`)" + - "Expo (from `../../../node_modules/.bun/expo@57.0.24+ea9bb3aa1309ed75/node_modules/expo`)" + - "ExpoAsset (from `../../../node_modules/.bun/expo-asset@57.0.18+d556132523c82a78/node_modules/expo-asset/ios`)" + - "ExpoDomWebView (from `../../../node_modules/.bun/@expo+dom-webview@57.0.1+ea9bb3aa1309ed75/node_modules/@expo/dom-webview/ios`)" + - "ExpoFileSystem (from `../../../node_modules/.bun/expo-file-system@57.0.7+19c046550412b028/node_modules/expo-file-system/ios`)" + - "ExpoFont (from `../../../node_modules/.bun/expo-font@57.0.4+19c046550412b028/node_modules/expo-font/ios/ExpoFont.podspec`)" + - "ExpoGlassEffect (from `../../../node_modules/.bun/expo-glass-effect@57.0.3+19c046550412b028/node_modules/expo-glass-effect/ios`)" + - "ExpoKeepAwake (from `../../../node_modules/.bun/expo-keep-awake@57.0.2+eb4ac7e61371bf55/node_modules/expo-keep-awake/ios`)" + - "ExpoLinking (from `../../../node_modules/.bun/expo-linking@57.0.10+19c046550412b028/node_modules/expo-linking/ios`)" + - "ExpoLogBox (from `../../../node_modules/.bun/@expo+log-box@57.0.4+ea9bb3aa1309ed75/node_modules/@expo/log-box`)" + - "ExpoModulesCore (from `../../../node_modules/.bun/expo-modules-core@57.0.18+767a9c693c958264/node_modules/expo-modules-core/ExpoModulesCore.podspec`)" + - "ExpoModulesJSI (from `../../../node_modules/.bun/expo-modules-jsi@57.1.0+8506924eb558072f/node_modules/expo-modules-jsi/apple`)" + - "ExpoModulesWorklets (from `../../../node_modules/.bun/expo-modules-core@57.0.18+767a9c693c958264/node_modules/expo-modules-core/ExpoModulesWorklets.podspec`)" + - "ExpoModulesWorkletsAdapter (from `../../../node_modules/.bun/expo-modules-core@57.0.18+767a9c693c958264/node_modules/expo-modules-core`)" + - "ExpoRouter (from `../../../node_modules/.bun/expo-router@57.0.22+d2181faf96e93633/node_modules/expo-router/ios`)" + - "ExpoSplashScreen (from `../../../node_modules/.bun/expo-splash-screen@57.0.9+ea9bb3aa1309ed75/node_modules/expo-splash-screen/ios`)" + - "ExpoSQLite (from `../../../node_modules/.bun/expo-sqlite@57.0.3+ea9bb3aa1309ed75/node_modules/expo-sqlite/ios`)" + - "ExpoSymbols (from `../../../node_modules/.bun/expo-symbols@57.0.3+1138ba06700891df/node_modules/expo-symbols/ios`)" + - "ExpoSystemUI (from `../../../node_modules/.bun/expo-system-ui@57.0.4+ea9bb3aa1309ed75/node_modules/expo-system-ui/ios`)" + - "ExpoUI (from `../../../node_modules/.bun/@expo+ui@57.0.19+c113d424be308d4d/node_modules/@expo/ui/ios`)" + - "FBLazyVector (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/Libraries/FBLazyVector`)" + - "hermes-engine (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`)" + - "RCTDeprecation (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactApple/Libraries/RCTFoundation/RCTDeprecation`)" + - "RCTRequired (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/Libraries/Required`)" + - "RCTSwiftUI (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactApple/RCTSwiftUI`)" + - "RCTSwiftUIWrapper (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactApple/RCTSwiftUIWrapper`)" + - "RCTTypeSafety (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/Libraries/TypeSafety`)" + - "React (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/`)" + - "React-callinvoker (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/callinvoker`)" + - "React-Core (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/`)" + - "React-Core-prebuilt (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/React-Core-prebuilt.podspec`)" + - "React-Core/RCTWebSocket (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/`)" + - "React-CoreModules (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/React/CoreModules`)" + - "React-cxxreact (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/cxxreact`)" + - "React-debug (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/debug`)" + - "React-defaultsnativemodule (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/nativemodule/defaults`)" + - "React-domnativemodule (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/nativemodule/dom`)" + - "React-Fabric (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon`)" + - "React-FabricComponents (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon`)" + - "React-FabricImage (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon`)" + - "React-featureflags (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/featureflags`)" + - "React-featureflagsnativemodule (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/nativemodule/featureflags`)" + - "React-graphics (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/renderer/graphics`)" + - "React-hermes (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/hermes`)" + - "React-idlecallbacksnativemodule (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/nativemodule/idlecallbacks`)" + - "React-ImageManager (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/renderer/imagemanager/platform/ios`)" + - "React-intersectionobservernativemodule (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/nativemodule/intersectionobserver`)" + - "React-jserrorhandler (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/jserrorhandler`)" + - "React-jsi (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/jsi`)" + - "React-jsiexecutor (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/jsiexecutor`)" + - "React-jsinspector (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/jsinspector-modern`)" + - "React-jsinspectorcdp (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/jsinspector-modern/cdp`)" + - "React-jsinspectornetwork (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/jsinspector-modern/network`)" + - "React-jsinspectortracing (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/jsinspector-modern/tracing`)" + - "React-jsitooling (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/jsitooling`)" + - "React-jsitracing (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/hermes/executor/`)" + - "React-logger (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/logger`)" + - "React-Mapbuffer (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon`)" + - "React-microtasksnativemodule (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/nativemodule/microtasks`)" + - "React-mutationobservernativemodule (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/nativemodule/mutationobserver`)" + - "react-native-safe-area-context (from `../../../node_modules/.bun/react-native-safe-area-context@5.9.1+8506924eb558072f/node_modules/react-native-safe-area-context`)" + - "React-NativeModulesApple (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios`)" + - "React-networking (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/networking`)" + - "React-oscompat (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/oscompat`)" + - "React-perflogger (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/reactperflogger`)" + - "React-performancecdpmetrics (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/performance/cdpmetrics`)" + - "React-performancetimeline (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/performance/timeline`)" + - "React-RCTActionSheet (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/Libraries/ActionSheetIOS`)" + - "React-RCTAnimation (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/Libraries/NativeAnimation`)" + - "React-RCTAppDelegate (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/Libraries/AppDelegate`)" + - "React-RCTBlob (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/Libraries/Blob`)" + - "React-RCTFabric (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/React`)" + - "React-RCTFBReactNativeSpec (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/React`)" + - "React-RCTImage (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/Libraries/Image`)" + - "React-RCTLinking (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/Libraries/LinkingIOS`)" + - "React-RCTNetwork (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/Libraries/Network`)" + - "React-RCTRuntime (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/React/Runtime`)" + - "React-RCTSettings (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/Libraries/Settings`)" + - "React-RCTText (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/Libraries/Text`)" + - "React-RCTVibration (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/Libraries/Vibration`)" + - "React-rendererconsistency (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/renderer/consistency`)" + - "React-renderercss (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/renderer/css`)" + - "React-rendererdebug (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/renderer/debug`)" + - "React-RuntimeApple (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/runtime/platform/ios`)" + - "React-RuntimeCore (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/runtime`)" + - "React-runtimeexecutor (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/runtimeexecutor`)" + - "React-RuntimeHermes (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/runtime`)" + - "React-runtimescheduler (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/renderer/runtimescheduler`)" + - "React-timing (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/timing`)" + - "React-utils (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/utils`)" + - "React-viewtransitionnativemodule (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/nativemodule/viewtransition`)" + - "React-webperformancenativemodule (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/nativemodule/webperformance`)" + - ReactAppDependencyProvider (from `build/generated/ios/ReactAppDependencyProvider`) + - ReactCodegen (from `build/generated/ios/ReactCodegen`) + - "ReactCommon/turbomodule/core (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon`)" + - "ReactNativeDependencies (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/third-party-podspecs/ReactNativeDependencies.podspec`)" + - "RNCAsyncStorage (from `../../../node_modules/.bun/@react-native-async-storage+async-storage@2.2.0+8506924eb558072f/node_modules/@react-native-async-storage/async-storage`)" + - "RNCMaskedView (from `../../../node_modules/.bun/@react-native-masked-view+masked-view@0.3.2+8506924eb558072f/node_modules/@react-native-masked-view/masked-view`)" + - "RNGestureHandler (from `../../../node_modules/.bun/react-native-gesture-handler@3.3.0+8506924eb558072f/node_modules/react-native-gesture-handler`)" + - "RNReanimated (from `../../../node_modules/.bun/react-native-reanimated@4.7.0+767a9c693c958264/node_modules/react-native-reanimated`)" + - "RNScreens (from `../../../node_modules/.bun/react-native-screens@4.26.0+8506924eb558072f/node_modules/react-native-screens`)" + - "RNWorklets (from `../../../node_modules/.bun/react-native-worklets@0.13.0+234f64bc8c9e4262/node_modules/react-native-worklets`)" + - "Yoga (from `../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/yoga`)" + +EXTERNAL SOURCES: + EXConstants: + :path: "../../../node_modules/.bun/expo-constants@57.0.19+19c046550412b028/node_modules/expo-constants/ios" + Expo: + :path: "../../../node_modules/.bun/expo@57.0.24+ea9bb3aa1309ed75/node_modules/expo" + ExpoAsset: + :path: "../../../node_modules/.bun/expo-asset@57.0.18+d556132523c82a78/node_modules/expo-asset/ios" + ExpoDomWebView: + :path: "../../../node_modules/.bun/@expo+dom-webview@57.0.1+ea9bb3aa1309ed75/node_modules/@expo/dom-webview/ios" + ExpoFileSystem: + :path: "../../../node_modules/.bun/expo-file-system@57.0.7+19c046550412b028/node_modules/expo-file-system/ios" + ExpoFont: + :podspec: "../../../node_modules/.bun/expo-font@57.0.4+19c046550412b028/node_modules/expo-font/ios/ExpoFont.podspec" + ExpoGlassEffect: + :path: "../../../node_modules/.bun/expo-glass-effect@57.0.3+19c046550412b028/node_modules/expo-glass-effect/ios" + ExpoKeepAwake: + :path: "../../../node_modules/.bun/expo-keep-awake@57.0.2+eb4ac7e61371bf55/node_modules/expo-keep-awake/ios" + ExpoLinking: + :path: "../../../node_modules/.bun/expo-linking@57.0.10+19c046550412b028/node_modules/expo-linking/ios" + ExpoLogBox: + :path: "../../../node_modules/.bun/@expo+log-box@57.0.4+ea9bb3aa1309ed75/node_modules/@expo/log-box" + ExpoModulesCore: + :podspec: "../../../node_modules/.bun/expo-modules-core@57.0.18+767a9c693c958264/node_modules/expo-modules-core/ExpoModulesCore.podspec" + ExpoModulesJSI: + :path: "../../../node_modules/.bun/expo-modules-jsi@57.1.0+8506924eb558072f/node_modules/expo-modules-jsi/apple" + ExpoModulesWorklets: + :podspec: "../../../node_modules/.bun/expo-modules-core@57.0.18+767a9c693c958264/node_modules/expo-modules-core/ExpoModulesWorklets.podspec" + ExpoModulesWorkletsAdapter: + :path: "../../../node_modules/.bun/expo-modules-core@57.0.18+767a9c693c958264/node_modules/expo-modules-core" + ExpoRouter: + :path: "../../../node_modules/.bun/expo-router@57.0.22+d2181faf96e93633/node_modules/expo-router/ios" + ExpoSplashScreen: + :path: "../../../node_modules/.bun/expo-splash-screen@57.0.9+ea9bb3aa1309ed75/node_modules/expo-splash-screen/ios" + ExpoSQLite: + :path: "../../../node_modules/.bun/expo-sqlite@57.0.3+ea9bb3aa1309ed75/node_modules/expo-sqlite/ios" + ExpoSymbols: + :path: "../../../node_modules/.bun/expo-symbols@57.0.3+1138ba06700891df/node_modules/expo-symbols/ios" + ExpoSystemUI: + :path: "../../../node_modules/.bun/expo-system-ui@57.0.4+ea9bb3aa1309ed75/node_modules/expo-system-ui/ios" + ExpoUI: + :path: "../../../node_modules/.bun/@expo+ui@57.0.19+c113d424be308d4d/node_modules/@expo/ui/ios" + FBLazyVector: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/Libraries/FBLazyVector" + hermes-engine: + :podspec: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec" + :tag: hermes-v250829098.0.17 + RCTDeprecation: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactApple/Libraries/RCTFoundation/RCTDeprecation" + RCTRequired: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/Libraries/Required" + RCTSwiftUI: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactApple/RCTSwiftUI" + RCTSwiftUIWrapper: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactApple/RCTSwiftUIWrapper" + RCTTypeSafety: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/Libraries/TypeSafety" + React: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/" + React-callinvoker: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/callinvoker" + React-Core: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/" + React-Core-prebuilt: + :podspec: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/React-Core-prebuilt.podspec" + React-CoreModules: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/React/CoreModules" + React-cxxreact: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/cxxreact" + React-debug: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/debug" + React-defaultsnativemodule: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/nativemodule/defaults" + React-domnativemodule: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/nativemodule/dom" + React-Fabric: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon" + React-FabricComponents: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon" + React-FabricImage: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon" + React-featureflags: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/featureflags" + React-featureflagsnativemodule: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/nativemodule/featureflags" + React-graphics: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/renderer/graphics" + React-hermes: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/hermes" + React-idlecallbacksnativemodule: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/nativemodule/idlecallbacks" + React-ImageManager: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/renderer/imagemanager/platform/ios" + React-intersectionobservernativemodule: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/nativemodule/intersectionobserver" + React-jserrorhandler: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/jserrorhandler" + React-jsi: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/jsi" + React-jsiexecutor: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/jsiexecutor" + React-jsinspector: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/jsinspector-modern" + React-jsinspectorcdp: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/jsinspector-modern/cdp" + React-jsinspectornetwork: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/jsinspector-modern/network" + React-jsinspectortracing: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/jsinspector-modern/tracing" + React-jsitooling: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/jsitooling" + React-jsitracing: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/hermes/executor/" + React-logger: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/logger" + React-Mapbuffer: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon" + React-microtasksnativemodule: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/nativemodule/microtasks" + React-mutationobservernativemodule: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/nativemodule/mutationobserver" + react-native-safe-area-context: + :path: "../../../node_modules/.bun/react-native-safe-area-context@5.9.1+8506924eb558072f/node_modules/react-native-safe-area-context" + React-NativeModulesApple: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios" + React-networking: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/networking" + React-oscompat: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/oscompat" + React-perflogger: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/reactperflogger" + React-performancecdpmetrics: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/performance/cdpmetrics" + React-performancetimeline: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/performance/timeline" + React-RCTActionSheet: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/Libraries/ActionSheetIOS" + React-RCTAnimation: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/Libraries/NativeAnimation" + React-RCTAppDelegate: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/Libraries/AppDelegate" + React-RCTBlob: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/Libraries/Blob" + React-RCTFabric: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/React" + React-RCTFBReactNativeSpec: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/React" + React-RCTImage: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/Libraries/Image" + React-RCTLinking: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/Libraries/LinkingIOS" + React-RCTNetwork: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/Libraries/Network" + React-RCTRuntime: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/React/Runtime" + React-RCTSettings: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/Libraries/Settings" + React-RCTText: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/Libraries/Text" + React-RCTVibration: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/Libraries/Vibration" + React-rendererconsistency: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/renderer/consistency" + React-renderercss: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/renderer/css" + React-rendererdebug: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/renderer/debug" + React-RuntimeApple: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/runtime/platform/ios" + React-RuntimeCore: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/runtime" + React-runtimeexecutor: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/runtimeexecutor" + React-RuntimeHermes: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/runtime" + React-runtimescheduler: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/renderer/runtimescheduler" + React-timing: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/timing" + React-utils: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/utils" + React-viewtransitionnativemodule: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/nativemodule/viewtransition" + React-webperformancenativemodule: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/react/nativemodule/webperformance" + ReactAppDependencyProvider: + :path: build/generated/ios/ReactAppDependencyProvider + ReactCodegen: + :path: build/generated/ios/ReactCodegen + ReactCommon: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon" + ReactNativeDependencies: + :podspec: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/third-party-podspecs/ReactNativeDependencies.podspec" + RNCAsyncStorage: + :path: "../../../node_modules/.bun/@react-native-async-storage+async-storage@2.2.0+8506924eb558072f/node_modules/@react-native-async-storage/async-storage" + RNCMaskedView: + :path: "../../../node_modules/.bun/@react-native-masked-view+masked-view@0.3.2+8506924eb558072f/node_modules/@react-native-masked-view/masked-view" + RNGestureHandler: + :path: "../../../node_modules/.bun/react-native-gesture-handler@3.3.0+8506924eb558072f/node_modules/react-native-gesture-handler" + RNReanimated: + :path: "../../../node_modules/.bun/react-native-reanimated@4.7.0+767a9c693c958264/node_modules/react-native-reanimated" + RNScreens: + :path: "../../../node_modules/.bun/react-native-screens@4.26.0+8506924eb558072f/node_modules/react-native-screens" + RNWorklets: + :path: "../../../node_modules/.bun/react-native-worklets@0.13.0+234f64bc8c9e4262/node_modules/react-native-worklets" + Yoga: + :path: "../../../node_modules/.bun/react-native@0.86.3+8506924eb558072f/node_modules/react-native/ReactCommon/yoga" + +SPEC CHECKSUMS: + EXConstants: 2dc4473aff5574eccaccb9f3eefe6d95247e5d38 + Expo: c04c9bde6ce9344f6da189e3d594c34884bba88b + ExpoAsset: a917b756b2e4fe12cef1ac3bca5fd849ddb2b919 + ExpoDomWebView: beaec034e51bd028428b98bb1f2633ab79c6d095 + ExpoFileSystem: 28778f942725170102f7c6cf4dee05a526ddacd0 + ExpoFont: f8198a952ba2ff53c9b393b5269ea435f232cfc3 + ExpoGlassEffect: ac454a05346de8610d61dc1324d624893ca22d14 + ExpoKeepAwake: 72af0b3be3615e59bc819d26061ff4e06b155ee0 + ExpoLinking: 15c8ddb0eb4a778950712ea4a6feedf021778852 + ExpoLogBox: 80957303325cd4439137765c90a87d7f22aaf2ff + ExpoModulesCore: f6f823d4541dbbf7e90a84ef807fc64372c7a857 + ExpoModulesJSI: 9df8e7c9719f59e8c001ec33611774137fc1484a + ExpoModulesWorklets: 986cf72c18400743869b4642d243115f831e404d + ExpoModulesWorkletsAdapter: c33403b9806b1f5d88218978f44364db327d4c98 + ExpoRouter: 3a8e63a51be53961b03f331c33108629090cf667 + ExpoSplashScreen: e771da4f26d550ea4fd067d8fb942657e47bb846 + ExpoSQLite: 72e6ada0504a27cd043eb1bf172db70485a761b6 + ExpoSymbols: 37a3a6e5847edb08b83a5ee04d3b46525e205f00 + ExpoSystemUI: 05ee8d4aaba1b6af330f3621e19b39ff9f21e718 + ExpoUI: 98d4650d9d32daaf772597adc76525c645b1ff76 + FBLazyVector: 2138c6c2ab66c31bf5754dc18097fbc498a49c7f + hermes-engine: 1d1364aef43f16448ba890d64226be0ef32516fe + RCTDeprecation: 96f68ebf33f8762466b01d57d6e873c4f30efb07 + RCTRequired: 166eed8ad6d8440e73e56d09a9090366609823d2 + RCTSwiftUI: e818198d11928a78c2b2afe281d072171dab617f + RCTSwiftUIWrapper: b9457f8613a1d0c8146c08844a04154702ff8809 + RCTTypeSafety: efc19e6b92931abf0b68b064212323a258a5f019 + React: 52dce66f71097ed7a4968673d95eeb8095ded74e + React-callinvoker: afa0525ab27f4ffbb4c377f855fe9368edb099bc + React-Core: fdb67992e049f2526ade3e258c21b8404e7943a3 + React-Core-prebuilt: 9abc518a8aa7aa4fa3bbbe52bc825bcd9fb3c3ce + React-CoreModules: 456d91152aa283ddc6ae8abfcec3292af88912f6 + React-cxxreact: 73a20c0dde5ec221f98d5e4da0e71349ab48353d + React-debug: d06757ac6c78b84af0c31e513a83662d6b8d0ac7 + React-defaultsnativemodule: ad832e8ce045ef01ea586834b1732c3d4d4d5d86 + React-domnativemodule: 7d1bd200df2d58c2f61d416cf16838c0c9fbb06c + React-Fabric: 363e0524d0724a17afbcba653da4f3398f41236e + React-FabricComponents: d41c87cd39ccf6c4c1df7f726ced22db1f90f072 + React-FabricImage: b4fb0ebc0a2e6fabfd8de8b3fa441331bda99403 + React-featureflags: 1c88b4566806604500a8a9fdf9ad0108c2e9d541 + React-featureflagsnativemodule: dab00693f49c6629f186dedcc3cdaeadd094972f + React-graphics: 991a75fa954a20d0297580dc7fd4e365982cef3b + React-hermes: 65cfbf62d8d31c1e69f3556ff6836a2890cf4a62 + React-idlecallbacksnativemodule: 492f6da9e5a2fa37e2ac0c3a7447302a342d42c2 + React-ImageManager: 02effe13f7b0ca3a7282ee364a8691cd789b9726 + React-intersectionobservernativemodule: 91b54a39a2e7187b9caf62e8b7310aa2d0026679 + React-jserrorhandler: 91985482e35b0b102febda42168ee71946db9958 + React-jsi: 69052b2d1958c9069a143f1637f382b933917b43 + React-jsiexecutor: b9b98ea432f58ee2899a60204f090d0bc8d48313 + React-jsinspector: 75119552df2413c48d33e9f0a72836b30c1ccb14 + React-jsinspectorcdp: 8e65995e9083f7bce0839d3169f6f2d304049e2e + React-jsinspectornetwork: 7e8375e27430cc7694c52fb904db2b9118194480 + React-jsinspectortracing: 643bd9d6f9dc64ea9b28b0e915b4fb0b9b0b1b90 + React-jsitooling: b7ec4b982dfc62f744587deeb1948b983f9edaa4 + React-jsitracing: 8d2f0c8d6d81324606b6d55b946cb443a0c5a425 + React-logger: b9bf04943233973fece220497f0784eaad409b3a + React-Mapbuffer: 3c805ea54675b00ef1755f23b3c1fccf34962b93 + React-microtasksnativemodule: 97a771dbbb4315c71579995b53e4e3e351a99d89 + React-mutationobservernativemodule: 530bff1bba9511a5133e3cf8170e3b2c0df49e89 + react-native-safe-area-context: 8368d1052ccc8fe8725adfb6a83498c8bdb48250 + React-NativeModulesApple: 2b658272ca69df0694cf5d54f9510aa7c33977bc + React-networking: 6be0b80e18e710dd30e77b04838ec46666a7bb78 + React-oscompat: cea7c66df8076bd97e95885d7f584b86afffde41 + React-perflogger: 9110ba33a4aa70c708e9d50aeca040e6f2aefaf7 + React-performancecdpmetrics: d9c07c4855c5a975cc7abc482fcb086e8a87abd1 + React-performancetimeline: 336af57802d9cdb4ac079774007677031c891fe0 + React-RCTActionSheet: aeb20277150454e9020517c6a2cb70410d4856d9 + React-RCTAnimation: 8453deeb01d0f284202c9670b5f7d827575b4967 + React-RCTAppDelegate: 5e9c748cc138decd9045683d8987700d824a99ff + React-RCTBlob: e6c01cae3eeb7e63a55b12f72b7dfcfd8236b4b2 + React-RCTFabric: deab07276af1b74b0b8d0772a9a58cac15785312 + React-RCTFBReactNativeSpec: 83d67909e5c67b460bec8851d8413a8ce1ecc6b2 + React-RCTImage: ec8488bc119d7e5d3209f85be3ebda7e4a937c61 + React-RCTLinking: b6ff56c2f206127d49d338262418c097ea306ad0 + React-RCTNetwork: 08d71b365278511a9bb07885b4a54bdc510d99bf + React-RCTRuntime: 634c58094cc601bc2a63ef38b2389cf81143fbcb + React-RCTSettings: 372551bc9f30d26890f5c5fd569dcd15243c656c + React-RCTText: 62cff7e93aeb3c06e3634f1c59984e8c5322b542 + React-RCTVibration: 2e8c1630ae80c092f437db9638a03715f616ac03 + React-rendererconsistency: e8b244c284931cac80a30ce754d77f6c64e528f9 + React-renderercss: 97791244f7ff7a2a060d07acbf240261d4a0519c + React-rendererdebug: 9d023ca26ed3daf60e7b7615729bb7ba6027a96a + React-RuntimeApple: 2daf515379135ccd5e3af5306c90f7827428f4ca + React-RuntimeCore: 637867058de3e0ae7f1ef2653cd0e01c4c850d71 + React-runtimeexecutor: a5cdf5961ec221a40e6612f35bd1e23f84fd9702 + React-RuntimeHermes: 390a5605857f207c8261c75fd4a296ead9aeee0f + React-runtimescheduler: 1be91f9ec0417bb69bd8dfabbe11b07147b24538 + React-timing: bbb861d02c9bcee3e9c08c51a38f59d27c0904ce + React-utils: 28c555b582a9607a938cc0f47b5a7600db42393a + React-viewtransitionnativemodule: 3977270cf367fd1562221047e2358a26da174f2d + React-webperformancenativemodule: fb203d77856165582e519855fc13773a2855f9a6 + ReactAppDependencyProvider: bb350d1333fd459c1aabe782088419a9b8894d3a + ReactCodegen: adfd6f38dc4684fd5c0c72d45afeec6422191e15 + ReactCommon: 02f6a489d5eb4ab79d7deba5cd4434e0ba351a07 + ReactNativeDependencies: 6738e602b46fd24aa453cd58267ec3bb8bf29d27 + RNCAsyncStorage: 2ad919e88b8bc2cd80e8697ce66d04d006743283 + RNCMaskedView: eb2b2e538afa907f05a5848a1a1ac26092e6fec9 + RNGestureHandler: fe183fe6d00211abee16d680e277a2ac50e45e73 + RNReanimated: fe9c44b338878bdae36eee36587e90191a8c97fa + RNScreens: 5586f63b3b1f35c42806069aecf842dc4a980300 + RNWorklets: 6a6f3cd0c633865a68f2853fa179829cf358aecc + Yoga: 18b74b3ade30bebc1904004dfaceae1dd02a330a + +PODFILE CHECKSUM: 0381281c59fa81647b307a7727b5f8f77f438db6 + +COCOAPODS: 1.17.0 diff --git a/apps/mobile/native/README.md b/apps/mobile/native/README.md new file mode 100644 index 0000000..3622410 --- /dev/null +++ b/apps/mobile/native/README.md @@ -0,0 +1,9 @@ +# Native dependency lock + +`Podfile.lock` was refreshed by CocoaPods 1.17.0 from source commit `65ae823fe7eb5778c812aa1164c0e1ced5984480` in [dependency-only run 36360477119](https://github.com/HemSoft/yahtzee/actions/runs/36360477119). The reviewed diff changes only Expo FileSystem's external source from a precompiled podspec to its source directory. No versions or spec checksums changed. That refresh intentionally stopped before compilation. + +The retrieved lock's SHA-256 is `77627085e3c13dc603feac806a0288268a993c18278193b4c5ed02dcee98c500`, using LF bytes. Its external sources point to the locked workspace packages and generated codegen directories, not workstation paths. The inspected native modules include Expo 57.0.24, Expo SQLite 57.0.3, AsyncStorage 2.2.0 for legacy preference import, React Native 0.86.3 and its declared navigation/runtime dependencies. There are no Apple signing credentials in this directory. + +The [native runner](../../../scripts/ios-native/run.mjs) copies this lock into a newly generated Expo project and uses `pod install --deployment`. It also checks the generated lock against source. Do not edit dependency versions or checksums by hand. + +For an intentional dependency update, use a fresh macOS checkout with the documented toolchain and run `bun scripts/ios-native/run.mjs --refresh-pods`. Review the replacement in `reports/native/Podfile.lock`, commit it here, and repeat normal qualification. Refresh-only mode always stops before compilation. A missing or changed lock remains a non-passing result until reviewed source matches. See the [qualification guide](../../../docs/native-simulator.md) for tool versions and evidence limits. diff --git a/apps/mobile/package.json b/apps/mobile/package.json index d1c2abd..c3a5154 100644 --- a/apps/mobile/package.json +++ b/apps/mobile/package.json @@ -1,12 +1,19 @@ { "name": "@yahtzee/mobile", - "version": "0.1.0", + "version": "1.0.0", "private": true, "main": "expo-router/entry", + "expo": { + "autolinking": { + "ios": { + "buildFromSource": ["expo-file-system"] + } + } + }, "scripts": { "start": "expo start", - "android": "expo start --android", - "ios": "expo start --ios", + "android": "expo run:android", + "ios": "expo run:ios", "web": "expo start --web", "typecheck": "tsc --noEmit", "build": "expo export --platform android --max-workers 2 --output-dir ../../reports/mobile/android && expo export --platform ios --max-workers 2 --output-dir ../../reports/mobile/ios" @@ -15,14 +22,17 @@ "@expo/metro-runtime": "57.0.16", "@react-native-async-storage/async-storage": "2.2.0", "@yahtzee/game-engine": "workspace:*", - "@yahtzee/ui": "workspace:*", - "convex": "1.46.0", "expo": "57.0.24", "expo-asset": "57.0.18", + "expo-build-properties": "57.0.21", "expo-constants": "57.0.19", + "expo-file-system": "57.0.7", "expo-linking": "57.0.10", "expo-router": "57.0.22", + "expo-splash-screen": "57.0.9", + "expo-sqlite": "57.0.3", "expo-status-bar": "57.0.1", + "expo-system-ui": "57.0.4", "react": "19.2.3", "react-native": "0.86.3", "react-native-safe-area-context": "5.9.1", diff --git a/apps/mobile/src/local/LocalProvider.tsx b/apps/mobile/src/local/LocalProvider.tsx new file mode 100644 index 0000000..360fcf1 --- /dev/null +++ b/apps/mobile/src/local/LocalProvider.tsx @@ -0,0 +1,28 @@ +import React, { createContext, useContext, useEffect, useMemo, useState, useSyncExternalStore, type ReactNode } from "react"; +import { Appearance, Platform, useColorScheme } from "react-native"; +import { createPlatformStorage } from "./platformStorage"; +import { createLocalStore, type LocalStore, type LocalView } from "./store"; +import { nativeColors } from "../ui/colors"; +import type { NativeColors } from "../ui/palette"; + +interface LocalContext { store: LocalStore; view: LocalView; dark: boolean; colors: NativeColors } +const Context = createContext(null); + +export function LocalProvider({ children }: { children: ReactNode }) { + const [store] = useState(() => createLocalStore(createPlatformStorage())); + const view = useSyncExternalStore(store.subscribe, store.getSnapshot, store.getSnapshot); + const system = useColorScheme(); + const preference = view.data?.preferences.appearance ?? "system"; + const dark = preference === "dark" || (preference === "system" && system === "dark"); + const colors = useMemo(() => nativeColors(dark), [dark]); + useEffect(() => { void store.load(); }, [store]); + useEffect(() => { + if (Platform.OS !== "web") Appearance.setColorScheme(preference === "system" ? "unspecified" : preference); + }, [preference]); + return {children}; +} +export function useLocalGame() { + const context = useContext(Context); + if (!context) throw new Error("LocalProvider is required"); + return context; +} diff --git a/apps/mobile/src/local/diagnostics.ts b/apps/mobile/src/local/diagnostics.ts new file mode 100644 index 0000000..0deaed3 --- /dev/null +++ b/apps/mobile/src/local/diagnostics.ts @@ -0,0 +1,12 @@ +interface DiagnosticFields { + version: string; + build: string; + platform: string; + osVersion: string; + windowClass: "compact" | "expanded"; +} + +/** Explicit fields only. Never stringify a store snapshot or an error/log object here. */ +export function diagnosticText(fields: DiagnosticFields): string { + return `Dice game ${fields.version}, build ${fields.build}\nPlatform: ${fields.platform} ${fields.osVersion}\nWindow: ${fields.windowClass}\nStorage schema: 1; scoring rules: 2\nNo names, scores, game IDs or saved data are included.`; +} diff --git a/apps/mobile/src/local/keys.ts b/apps/mobile/src/local/keys.ts new file mode 100644 index 0000000..088591d --- /dev/null +++ b/apps/mobile/src/local/keys.ts @@ -0,0 +1,2 @@ +/** Dependency-free wire key, shared with browser/native qualification tools. */ +export const SAVE_KEY = "hemsoft-local-dice-v1"; diff --git a/apps/mobile/src/local/platformStorage.native.ts b/apps/mobile/src/local/platformStorage.native.ts new file mode 100644 index 0000000..3266999 --- /dev/null +++ b/apps/mobile/src/local/platformStorage.native.ts @@ -0,0 +1,15 @@ +import AsyncStorage from "@react-native-async-storage/async-storage"; +import * as SQLite from "expo-sqlite"; +import { Directory } from "expo-file-system"; +import { createSqliteStorage, DATABASE_NAME, removeDatabaseFiles } from "./sqliteStorage"; + +function databaseFiles() { + const directory = new Directory(SQLite.defaultDatabaseDirectory); + // Do not use exists: it can also be false when access is denied. + if (!directory.parentDirectory.list().some((entry) => entry.name === directory.name)) return []; + return directory.list().map((entry) => entry.name); +} +export const createPlatformStorage = () => createSqliteStorage({ + open: () => SQLite.openDatabaseAsync(DATABASE_NAME, { useNewConnection: true }), + remove: () => removeDatabaseFiles(SQLite.deleteDatabaseAsync, databaseFiles), +}, AsyncStorage); diff --git a/apps/mobile/src/local/platformStorage.ts b/apps/mobile/src/local/platformStorage.ts new file mode 100644 index 0000000..7dc6956 --- /dev/null +++ b/apps/mobile/src/local/platformStorage.ts @@ -0,0 +1,4 @@ +import AsyncStorage from "@react-native-async-storage/async-storage"; + +/** Web development/fixture adapter; native builds select platformStorage.native.ts. */ +export const createPlatformStorage = () => AsyncStorage; diff --git a/apps/mobile/src/local/save.ts b/apps/mobile/src/local/save.ts new file mode 100644 index 0000000..0423ca0 --- /dev/null +++ b/apps/mobile/src/local/save.ts @@ -0,0 +1,134 @@ +import { calculateTotal, calculateMaxPossibleScore, getCategories, getMaxCategoryScore, type CategoryId, type GameLog, type HighScores, type WireGame } from "@yahtzee/game-engine"; + +export { SAVE_KEY } from "./keys"; +export const MODES = [5, 6, 8, 10] as const; +export interface Preferences { + name: string; + recentNames: string[]; + appearance: "system" | "light" | "dark"; + diceCount: number; + aiOpponents: number; +} +export interface ActiveGame { game: WireGame; revision: number; startedAt: string } +export interface LocalSave { + schemaVersion: 1; + rulesVersion: 2; + preferences: Preferences; + active: ActiveGame | null; + history: GameLog; + highScores: HighScores; +} + +export function emptySave(): LocalSave { + return { schemaVersion: 1, rulesVersion: 2, + preferences: { name: "", recentNames: [], appearance: "system", diceCount: 5, aiOpponents: 0 }, + active: null, history: { entries: [] }, highScores: { entries: [] } }; +} +function object(value: unknown): value is Record { + return typeof value === "object" && value !== null && !Array.isArray(value); +} +function integer(value: unknown, low: number, high: number): value is number { + return typeof value === "number" && Number.isSafeInteger(value) && value >= low && value <= high; +} +function text(value: unknown, max = 100): value is string { + return typeof value === "string" && value.trim().length > 0 && value.length <= max && Array.from(value).every((char) => char.charCodeAt(0) >= 32 && char.charCodeAt(0) !== 127); +} +function mode(value: unknown): value is number { return typeof value === "number" && MODES.some((n) => n === value); } +function date(value: unknown): value is string { + return typeof value === "string" && Number.isFinite(Date.parse(value)) && new Date(value).toISOString() === value; +} +function unique(values: unknown[]): boolean { return new Set(values).size === values.length; } + +export function validPreferences(value: unknown): value is Preferences { + if (!object(value)) return false; + const names = value.recentNames; + return (value.name === "" || text(value.name, 32)) && Array.isArray(names) && names.length <= 5 + && names.every((name) => text(name, 32)) && unique(names) + && typeof value.appearance === "string" && ["system", "light", "dark"].includes(value.appearance) + && mode(value.diceCount) && integer(value.aiOpponents, 0, 3); +} +function scorecard(value: unknown, diceCount: number, complete: boolean): boolean { + if (!object(value)) return false; + const allowed = getCategories(diceCount).map((category) => category.id as string); + const entries = Object.entries(value); + return (!complete || entries.length === allowed.length) && entries.every(([key, score]) => + allowed.includes(key) && integer(score, 0, getMaxCategoryScore(key as CategoryId, diceCount))); +} +function gamePlayers(value: unknown, diceCount: number, round: number, finished: boolean): boolean { + if (!Array.isArray(value) || value.length < 1 || value.length > 4) return false; + return value.every((player, index) => object(player) && text(player.id) && text(player.name, 32) + && player.isAi === (index !== 0) && scorecard(player.scores, diceCount, finished) + && (finished || Object.keys(player.scores as object).length === round - 1)) + && unique(value.map((player: Record) => player.id)); +} +function gameDice(value: Record, diceCount: number): boolean { + return Array.isArray(value.dice) && value.dice.length === diceCount && value.dice.every((die) => integer(die, 1, 6)) + && Array.isArray(value.held) && value.held.length <= diceCount && unique(value.held) + && value.held.every((index) => integer(index, 0, diceCount - 1)); +} +function wireGame(value: unknown): boolean { + if (!object(value) || !mode(value.diceCount)) return false; + const rounds = getCategories(value.diceCount).length; + if (!integer(value.currentRound, 1, rounds) || typeof value.status !== "string" || !["playing", "finished"].includes(value.status)) return false; + if (!gamePlayers(value.players, value.diceCount, value.currentRound, value.status === "finished")) return false; + const players = value.players as unknown[]; + return text(value.id) && value.maxRolls === 3 && value.totalRounds === rounds && integer(value.rollsLeft, 0, value.status === "finished" ? 3 : 2) + && integer(value.currentPlayerIndex, 0, players.length - 1) + && (value.status === "finished" ? value.currentRound === rounds : value.currentPlayerIndex === 0) + && gameDice(value, value.diceCount); +} +function activeGame(value: unknown): boolean { + return value === null || (object(value) && wireGame(value.game) + && integer(value.revision, 0, Number.MAX_SAFE_INTEGER) && date(value.startedAt)); +} +function resultPlayer(value: unknown, diceCount: number): boolean { + if (!object(value) || !text(value.name, 32) || typeof value.isAi !== "boolean" || !scorecard(value.scores, diceCount, true)) return false; + return value.score === calculateTotal({ id: "saved", name: value.name, scores: value.scores as Partial> }, diceCount).grandTotal; +} +function result(value: unknown): boolean { + if (!object(value) || !mode(value.diceCount) || !Array.isArray(value.players)) return false; + const diceCount = value.diceCount; + return text(value.id) && date(value.startedAt) && date(value.completedAt) && integer(value.durationSeconds, 0, Number.MAX_SAFE_INTEGER) + && value.players.length >= 1 && value.players.length <= 4 && value.players.every((player) => resultPlayer(player, diceCount)) + && value.players.some((player: Record) => player.name === value.winnerName); +} +function highScore(value: unknown): boolean { + if (!object(value) || !mode(value.diceCount)) return false; + return text(value.gameId) && text(value.playerName, 32) && typeof value.isAi === "boolean" && date(value.dateRecorded) + && integer(value.score, 0, calculateMaxPossibleScore({ id: "saved", name: "saved", scores: {} }, value.diceCount)) && integer(value.rankOriginal, 1, 10) && integer(value.rankCurrent, 1, 10); +} +function results(value: Record): boolean { + if (!object(value.history) || !object(value.highScores)) return false; + const history = value.history.entries, scores = value.highScores.entries; + if (!Array.isArray(history) || history.length > 500 || !history.every(result)) return false; + if (!Array.isArray(scores) || scores.length > 40 || !scores.every(highScore)) return false; + if (!unique(history.map((entry: Record) => entry.id))) return false; + if (!unique(scores.map((entry: Record) => JSON.stringify([entry.gameId, entry.playerName, entry.isAi])))) return false; + return MODES.every((diceCount) => { + const rows = scores.filter((entry: Record) => entry.diceCount === diceCount); + return rows.length <= 10 && rows.every((entry: Record, i) => entry.rankCurrent === i + 1 && (i === 0 || rows[i - 1].score >= entry.score)); + }); +} + +/** Never repair an unknown or damaged document by overwriting it with defaults. */ +export function decodeSave(raw: string): LocalSave { + if (raw.length > 4_000_000) throw new Error("Local save is too large. Your data has not been changed."); + const value: unknown = JSON.parse(raw); + if (!object(value) || value.schemaVersion !== 1 || value.rulesVersion !== 2 || !validPreferences(value.preferences) + || !activeGame(value.active) || !results(value)) throw new Error("Local save is damaged or uses unsupported rules. Your data has not been changed."); + const save = value as unknown as LocalSave; + if (save.active) { + const recorded = save.history.entries.some((entry) => entry.id === save.active!.game.id); + if ((save.active.game.status === "finished") !== recorded) throw new Error("Active game and completion record disagree. Your data has not been changed."); + } + return save; +} + +/** One-time migration of the old native client's local preferences, not server results. */ +export function migratePreferences(namesRaw: string | null, appearanceRaw: string | null): LocalSave { + const save = emptySave(); + const names: unknown = namesRaw === null ? [] : JSON.parse(namesRaw); + const preferences = { ...save.preferences, recentNames: names, appearance: appearanceRaw ?? "system" }; + if (!validPreferences(preferences)) throw new Error("Saved preferences could not be read. Your data has not been changed."); + return { ...save, preferences: { ...preferences, name: preferences.recentNames[0] ?? "" } }; +} diff --git a/apps/mobile/src/local/sqliteStorage.ts b/apps/mobile/src/local/sqliteStorage.ts new file mode 100644 index 0000000..15dea64 --- /dev/null +++ b/apps/mobile/src/local/sqliteStorage.ts @@ -0,0 +1,80 @@ +import { SAVE_KEY } from "./keys"; +import type { StoragePort } from "./store"; + +export const DATABASE_NAME = "hemsoft-local-dice.db"; +export interface SqlConnection { + execAsync(sql: string): Promise; + runAsync(sql: string, ...parameters: string[]): Promise; + getFirstAsync(sql: string, ...parameters: string[]): Promise; + closeAsync(): Promise; +} +export interface SqlFactory { + open(): Promise; + remove(): Promise; +} + +async function initialize(database: SqlConnection) { + const integrity = await database.getFirstAsync<{ quick_check: string }>("PRAGMA quick_check"); + if (integrity?.quick_check !== "ok") throw new Error("Local database is damaged. Your data has not been reset."); + const version = await database.getFirstAsync<{ user_version: number }>("PRAGMA user_version"); + if (version?.user_version !== 0 && version?.user_version !== 1) throw new Error("Local database uses an unsupported version. Your data has not been reset."); + if (version.user_version === 0) await initializeEmpty(database); + // Validate the expected table before changing any settings on an existing database. + await database.getFirstAsync("SELECT key, value FROM local_save LIMIT 1"); + await database.execAsync("PRAGMA journal_mode = WAL; PRAGMA synchronous = FULL;"); +} +async function initializeEmpty(database: SqlConnection) { + const existing = await database.getFirstAsync<{ name: string }>("SELECT name FROM sqlite_master WHERE name NOT LIKE 'sqlite_%' LIMIT 1"); + if (existing) throw new Error("Unrecognized local database. Your data has not been reset."); + await database.execAsync("BEGIN IMMEDIATE; CREATE TABLE local_save (key TEXT PRIMARY KEY NOT NULL, value TEXT NOT NULL); PRAGMA user_version = 1; COMMIT;"); +} + +/** Single-document SQL commits. Only an explicit reset can remove the dedicated database. */ +export function createSqliteStorage(factory: SqlFactory, legacy: StoragePort) { + let connection: Promise | null = null; + let initialized = false; + const close = async () => { + const database = await connection?.catch(() => null); + if (database) await database.closeAsync(); + connection = null; + initialized = false; + }; + const ready = async () => { + connection ??= factory.open(); + const database = await connection; + if (!initialized) { await initialize(database); initialized = true; } + return database; + }; + return { + close, + async getItem(key: string) { + if (key !== SAVE_KEY) return legacy.getItem(key); + // Explicit load/reload gets a new connection and checks the on-disk database. + await close(); + const row = await (await ready()).getFirstAsync<{ value: unknown }>("SELECT value FROM local_save WHERE key = ?", key); + if (!row) return null; + if (typeof row.value !== "string") throw new Error("Local save is not text. Your data has not been reset."); + return row.value; + }, + async setItem(key: string, value: string) { + if (key !== SAVE_KEY) return legacy.setItem(key, value); + await (await ready()).runAsync("INSERT INTO local_save (key, value) VALUES (?, ?) ON CONFLICT(key) DO UPDATE SET value = excluded.value", key, value); + }, + async removeItem(key: string) { + if (key !== SAVE_KEY) return legacy.removeItem(key); + await (await ready()).runAsync("DELETE FROM local_save WHERE key = ?", key); + }, + async reset() { await close(); await factory.remove(); }, + }; +} + +/** Expo shares deletion error codes. Only a successful directory listing proves absence. */ +export async function removeDatabaseFiles(remove: (name: string) => Promise, list: () => string[] | Promise) { + const owned = ["", "-wal", "-shm", "-journal"].map((suffix) => DATABASE_NAME + suffix); + const present = await list(); + for (const name of owned.filter((name) => present.includes(name))) { + try { await remove(name); } + catch (error) { if ((await list()).includes(name)) throw error; } + } + if ((await list()).some((name) => owned.includes(name))) throw new Error("Local database deletion was not confirmed."); +} diff --git a/apps/mobile/src/local/store.ts b/apps/mobile/src/local/store.ts new file mode 100644 index 0000000..eaab999 --- /dev/null +++ b/apps/mobile/src/local/store.ts @@ -0,0 +1,131 @@ +import { addGameLogEntry, applySessionMove, fromWire, newSessionGame, updateHighScores, type Move } from "@yahtzee/game-engine"; +import { decodeSave, emptySave, migratePreferences, MODES, SAVE_KEY, validPreferences, type LocalSave, type Preferences } from "./save"; + +export interface StoragePort { + getItem(key: string): Promise; + setItem(key: string, value: string): Promise; + removeItem(key: string): Promise; + /** Confirm durable absence of dedicated storage. Failures may follow partial deletion. UI confirmation is required. */ + reset?(): Promise; +} +export interface LocalView { + /** Reload/reset replaces unsaved UI drafts as well as the document. Not persisted. */ + generation: number; + data: LocalSave | null; + busy: boolean; + error: string | null; + canRetry: boolean; + retryReset: boolean; +} +type Pending = { data: LocalSave; bytes: string; reset: boolean }; +type Start = { name: string; diceCount: number; aiOpponents: number }; +const LEGACY_KEYS = ["yahtzee-recent-names", "yahtzee-theme"]; +const clone = (value: T): T => JSON.parse(JSON.stringify(value)) as T; + +function begin(data: LocalSave, options: Start, id: string): LocalSave { + const name = options.name.trim(); + const preferences = { ...data.preferences, ...options, name, + recentNames: [name, ...data.preferences.recentNames.filter((entry) => entry !== name)].slice(0, 5) }; + if (!name || !validPreferences(preferences) || !MODES.some((mode) => mode === options.diceCount)) throw new Error("Choose a supported mode and a name of 1 to 32 characters."); + if (data.active) throw new Error("Resume or discard the saved game before starting another."); + if (data.history.entries.some((entry) => entry.id === id) || data.highScores.entries.some((entry) => entry.gameId === id)) throw new Error("Could not create a unique game. Try again."); + const game = newSessionGame(name, options.diceCount, options.aiOpponents); + game.id = id; + return { ...data, preferences, active: { game, revision: 0, startedAt: new Date().toISOString() } }; +} +function nextMove(data: LocalSave, move: Move): LocalSave { + if (!data.active) throw new Error("No saved game is active."); + const game = applySessionMove(data.active.game, move); + const active = { ...data.active, game, revision: data.active.revision + 1 }; + if (game.status !== "finished") return { ...data, active }; + if (data.history.entries.some((entry) => entry.id === game.id)) throw new Error("This result has already been saved."); + const state = fromWire(game); + const history = addGameLogEntry(data.history, state, active.startedAt); + history.entries = history.entries.slice(-500); + // A wall-clock correction must not make a valid result unreadable. + history.entries.at(-1)!.durationSeconds = Math.max(0, history.entries.at(-1)!.durationSeconds); + return { ...data, active, history, highScores: updateHighScores(data.highScores, state) }; +} + +/** Acknowledgment follows a complete write or confirmed deletion. Failed writes retain exact bytes for retry. */ +export function createLocalStore(storage: StoragePort, newId = () => `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}-${Math.random().toString(36).slice(2)}`) { + let view: LocalView = { generation: 0, data: null, busy: false, error: null, canRetry: false, retryReset: false }; + let pending: Pending | null = null; + const listeners = new Set<() => void>(); + const publish = (patch: Partial) => { + view = { ...view, ...patch }; + for (const listener of listeners) listener(); + }; + const stage = (data: LocalSave, reset = false) => { + const bytes = JSON.stringify(data); + pending = { data: decodeSave(bytes), bytes, reset }; + }; + const writePending = async () => { + if (!pending) throw new Error("No save is waiting to be retried."); + const transaction = pending; + if (transaction.reset) { + // Finish fallible legacy cleanup before deleting the only durable document. + for (const key of LEGACY_KEYS) await storage.removeItem(key); + } + if (transaction.reset && storage.reset) { + try { await storage.reset(); } + catch { + // A partial deletion cannot leave a stale game presented as saved. + publish({ data: null }); + throw new Error("Reset did not finish. Some local data may already have been deleted. Retry reset or reload to check."); + } + // Absence is the committed empty state. Recreating it here adds an unsafe post-commit failure. + } else await storage.setItem(SAVE_KEY, transaction.bytes); + pending = null; + publish({ data: transaction.data, error: null, canRetry: false, retryReset: false, generation: view.generation + Number(transaction.reset) }); + }; + const attempt = async (operation: () => Promise): Promise => { + if (view.busy) return false; + publish({ busy: true, error: null }); + try { + await operation(); + return true; + } catch (error) { + publish({ error: error instanceof Error ? error.message : "Local storage is unavailable.", canRetry: pending !== null, retryReset: pending?.reset ?? false }); + return false; + } finally { publish({ busy: false }); } + }; + const update = (build: (data: LocalSave) => LocalSave) => attempt(async () => { + if (pending) throw new Error("Retry the pending save or reload the last saved data first."); + if (!view.data) throw new Error("Saved data is not available. Retry loading or choose an explicit reset."); + stage(build(clone(view.data))); + await writePending(); + }); + const load = () => attempt(async () => { + // Explicit reload abandons an unacknowledged in-memory move, never the saved document. + pending = null; + publish({ data: null, canRetry: false, retryReset: false, generation: view.generation + 1 }); + const raw = await storage.getItem(SAVE_KEY); + if (raw !== null) { + const data = decodeSave(raw); + pending = null; + publish({ data, canRetry: false }); + return; + } + const data = migratePreferences(await storage.getItem(LEGACY_KEYS[0]), await storage.getItem(LEGACY_KEYS[1])); + stage(data); + await writePending(); + }); + return { + load, + getSnapshot: () => view, + subscribe: (listener: () => void) => { listeners.add(listener); return () => { listeners.delete(listener); }; }, + start: (options: Start) => update((data) => begin(data, options, newId())), + move: (move: Move) => update((data) => nextMove(data, move)), + retry: () => attempt(writePending), + discard: () => update((data) => ({ ...data, active: null })), + preferences: (patch: Partial) => update((data) => { + const preferences = { ...data.preferences, ...patch }; + if (!validPreferences(preferences)) throw new Error("Invalid local preferences."); + return { ...data, preferences }; + }), + // The UI must confirm deletion of games, results, names and preferences first. + resetAll: () => attempt(async () => { stage(emptySave(), true); await writePending(); }), + }; +} +export type LocalStore = ReturnType; diff --git a/apps/mobile/src/screens/Dice.tsx b/apps/mobile/src/screens/Dice.tsx new file mode 100644 index 0000000..cd4f7f0 --- /dev/null +++ b/apps/mobile/src/screens/Dice.tsx @@ -0,0 +1,33 @@ +import React from "react"; +import { Pressable, StyleSheet, View } from "react-native"; +import { useLocalGame } from "../local/LocalProvider"; +import { Label } from "../ui/controls"; + +const PIPS: Record = { 1: [4], 2: [0, 8], 3: [0, 4, 8], 4: [0, 2, 6, 8], 5: [0, 2, 4, 6, 8], 6: [0, 2, 3, 5, 6, 8] }; +export function Dice() { + const { store, view, colors } = useLocalGame(); + const game = view.data!.active!.game; + const disabled = view.busy || view.canRetry || game.rollsLeft === 0; + return + {game.dice.map((value, index) => { + const held = game.held.includes(index); + return { void store.move({ kind: "hold", index }); }} style={styles.control}> + + {PIPS[value].map((position) => )} + + + ; + })} + ; +} +const styles = StyleSheet.create({ + hand: { flexDirection: "row", flexWrap: "wrap", justifyContent: "center", gap: 12, paddingVertical: 12 }, + control: { minWidth: 52, minHeight: 80, alignItems: "center", gap: 6 }, + face: { width: 56, height: 56, borderRadius: 12, shadowColor: "#000", shadowOffset: { width: 0, height: 4 }, shadowOpacity: 0.16, shadowRadius: 7 }, + pip: { position: "absolute", width: 8, height: 8, borderRadius: 4 }, + hold: { textAlign: "center" }, +}); diff --git a/apps/mobile/src/screens/Help.tsx b/apps/mobile/src/screens/Help.tsx new file mode 100644 index 0000000..fe502f9 --- /dev/null +++ b/apps/mobile/src/screens/Help.tsx @@ -0,0 +1,68 @@ +import React, { useState } from "react"; +import { Linking, Platform, ScrollView, Share, View, useWindowDimensions } from "react-native"; +import appConfig from "../../app.json"; +import { useLocalGame } from "../local/LocalProvider"; +import { diagnosticText } from "../local/diagnostics"; +import { Action, Label, Section, styles } from "../ui/controls"; +import { useConfirmation } from "../ui/useConfirmation"; + +const rules = [ + ["A turn", "The first roll happens when your turn begins. Hold any dice, then reroll the rest up to twice. Choose one unused category to end your turn. A zero scratches that category. AI opponents play automatically after you."], + ["Numbers and bonus", "Add matching dice in Ones through Sixes. Five dice need 63 upper points for a 35-point bonus. Six or eight dice need 84 for a 100-point bonus; ten dice need 105. Only the combined upper score must meet the target."], + ["Pairs and matching dice", "One Pair scores the highest pair. Two Pairs needs two different faces and scores those four dice. Three, Four and Five of a Kind score only the matching dice, using the highest qualifying face. Full House needs a triple and a different pair for 25 points."], + ["Straights and Chance", "Four consecutive faces earn 30 for Small Straight; five earn 40 for Large Straight. All six faces earn 50 for Full Straight. Chance adds every die. The suggestion considers this roll and bonus progress; it is not an optimal strategy."], + ["Larger hands", "Three Pairs needs at least three distinct pairs. Castle needs at least two distinct triples. Tower needs four of one face and two of another. These combinations score the sum of all dice. Maxi Yahtzee requires the entire hand to match for 100 points; five-dice Yahtzee earns 50. There is no separate six-of-a-kind slot in eight- or ten-dice play."], +]; + +export function Help() { + const { store, view, colors } = useLocalGame(); + const { confirm, dialog } = useConfirmation(); + const [error, setError] = useState(null); + const [preview, setPreview] = useState(false); + const { width } = useWindowDimensions(); + const diagnostics = diagnosticText({ version: appConfig.expo.version, build: appConfig.expo.ios.buildNumber, + platform: Platform.OS, osVersion: String(Platform.Version), windowClass: width >= 820 ? "expanded" : "compact" }); + const share = async () => { + try { + await Share.share({ message: diagnostics }); + setError(null); + } catch { setError("Could not open the system share sheet. The app version is shown below."); } + }; + const source = async () => { + try { await Linking.openURL("https://github.com/HemSoft/yahtzee"); setError(null); } + catch { setError("Could not open the source page. Try again when a browser is available."); } + }; + const reset = () => confirm("Delete all local data", "Delete saved gameplay, completed history, high scores, names and appearance preferences on this device? This cannot be undone in the app.", () => { void store.resetAll(); }); + return <> + + + + {rules.map(([title, body]) =>
)} +
+ + +
+
+ + + setPreview(true)} /> + {preview && + + + { void share(); }} /> + setPreview(false)} /> + } + + { void source(); }} /> +
+ {error && } +
+ + + {view.error && } + {view.canRetry && { void store.retry(); }} />} +
+
+ {dialog} + ; +} diff --git a/apps/mobile/src/screens/History.tsx b/apps/mobile/src/screens/History.tsx new file mode 100644 index 0000000..b001792 --- /dev/null +++ b/apps/mobile/src/screens/History.tsx @@ -0,0 +1,27 @@ +import React, { useState } from "react"; +import { FlatList, View } from "react-native"; +import { useLocalGame } from "../local/LocalProvider"; +import { MODES } from "../local/save"; +import { Label, styles } from "../ui/controls"; +import { Choice } from "../ui/Choice"; +import { HighScores } from "./Results"; + +export function History() { + const { view, colors } = useLocalGame(); + const [selection, setSelection] = useState(null); + if (!view.data) return ; + const diceCount = selection ?? view.data.preferences.diceCount; + const entries = [...view.data.history.entries].reverse().filter((entry) => entry.diceCount === diceCount); + return entry.id} + ListHeaderComponent={ + + `${count} dice`)} selected={MODES.findIndex((count) => count === diceCount)} onSelect={(index) => setSelection(MODES[index])} /> + + + } + ListEmptyComponent={} + renderItem={({ item }) => + + {item.players.map((player, index) => )} + } />; +} diff --git a/apps/mobile/src/screens/NativeGameScreen.tsx b/apps/mobile/src/screens/NativeGameScreen.tsx new file mode 100644 index 0000000..c719338 --- /dev/null +++ b/apps/mobile/src/screens/NativeGameScreen.tsx @@ -0,0 +1,53 @@ +import React, { useState } from "react"; +import { ActivityIndicator, Keyboard, View } from "react-native"; +import { SafeAreaView } from "react-native-safe-area-context"; +import { useLocalGame } from "../local/LocalProvider"; +import { Action, Label, styles } from "../ui/controls"; +import { useConfirmation, type Confirm } from "../ui/useConfirmation"; +import { Play } from "./Play"; +import { Results } from "./Results"; +import { Setup } from "./Setup"; + +function SaveStatus({ confirm }: { confirm: Confirm }) { + const { store, view, colors } = useLocalGame(); + if (!view.busy && !view.error) return null; + const reload = () => confirm("Reload saved data", "Reload the last stored document? A move that could not be saved may be lost. Completed stored data is not deleted.", () => { void store.load(); }); + return + {view.busy && } + {view.error && <> + + + {view.canRetry && { void store.retry(); }} />} + { void store.load(); }} /> + } + ; +} +function Content({ playing, start, resume, pause, again, confirm }: { + playing: boolean; start: (name: string) => void; resume: () => void; pause: () => void; again: () => void; confirm: Confirm; +}) { + const { view } = useLocalGame(); + if (!view.data) return ; + if (!playing || !view.data.active) return ; + return view.data.active.game.status === "finished" ? : ; +} +export function NativeGameScreen({ onHistory, onHelp }: { onHistory: () => void; onHelp: () => void }) { + const { store, view, colors } = useLocalGame(); + const [playing, setPlaying] = useState(false); + const { confirm, dialog } = useConfirmation(); + const start = async (name: string) => { + Keyboard.dismiss(); + const preferences = view.data!.preferences; + if (await store.start({ name, diceCount: preferences.diceCount, aiOpponents: preferences.aiOpponents })) setPlaying(true); + }; + const again = async () => { if (await store.discard()) setPlaying(false); }; + return + + + + + + { void start(name); }} resume={() => setPlaying(true)} pause={() => setPlaying(false)} + again={() => { void again(); }} confirm={confirm} /> + {dialog} + ; +} diff --git a/apps/mobile/src/screens/NativeScorecard.tsx b/apps/mobile/src/screens/NativeScorecard.tsx new file mode 100644 index 0000000..4d81164 --- /dev/null +++ b/apps/mobile/src/screens/NativeScorecard.tsx @@ -0,0 +1,57 @@ +import React from "react"; +import { Pressable, StyleSheet, View } from "react-native"; +import { calculateTotal, fromWire, getScorecardCategories, getUpperBonusThreshold, getUpperBonusValue, pickAiCategory, type Category } from "@yahtzee/game-engine"; +import { useLocalGame } from "../local/LocalProvider"; +import { Label, Section } from "../ui/controls"; + +function ScoreRow({ category, suggested }: { category: Category; suggested: boolean }) { + const { store, view, colors } = useLocalGame(); + const game = view.data!.active!.game; + const assigned = game.players[0].scores[category.id]; + const points = assigned ?? category.score(game.dice); + const disabled = view.busy || view.canRetry || assigned !== undefined; + const opponents = game.players.slice(1).map((player) => `${player.name}: ${player.scores[category.id] ?? "not scored"}`).join(" · "); + const ownLabel = assigned === undefined ? `Score ${category.label}, ${points} points${suggested ? ", suggested" : ""}` : `${category.label}, ${points} points recorded`; + const label = opponents ? `${ownLabel}. ${opponents}` : ownLabel; + return { void store.move({ kind: "score", category: category.id }); }} + style={[styles.row, { borderBottomColor: colors.line }]}> + + + {suggested && assigned === undefined && } + + + {game.players.length > 1 && } + ; +} +export function NativeScorecard() { + const { view } = useLocalGame(); + const game = fromWire(view.data!.active!.game); + const suggested = pickAiCategory(game.dice, game.players[0], game.diceCount); + const categories = getScorecardCategories(game.diceCount); + return + {(["upper", "lower"] as const).map((section) =>
+ {categories.filter((category) => category.section === section).map((category) => )} +
)} + +
; +} +export function Bonus() { + const { view } = useLocalGame(); + const game = view.data!.active!.game; + const total = calculateTotal(game.players[0], game.diceCount); + const threshold = getUpperBonusThreshold(game.diceCount); + return + + + + ; +} +const styles = StyleSheet.create({ + row: { padding: 16, minHeight: 56, gap: 8, borderBottomWidth: 0.5 }, + mainRow: { flexDirection: "row", alignItems: "center", gap: 16 }, name: { flex: 1 }, + points: { fontWeight: "600", fontVariant: ["tabular-nums"], textAlign: "right", minWidth: 42 }, + bonus: { gap: 8, paddingVertical: 24, paddingHorizontal: 4 }, +}); diff --git a/apps/mobile/src/screens/Play.tsx b/apps/mobile/src/screens/Play.tsx new file mode 100644 index 0000000..e9c2b80 --- /dev/null +++ b/apps/mobile/src/screens/Play.tsx @@ -0,0 +1,58 @@ +import React, { useEffect } from "react"; +import { AccessibilityInfo, ScrollView, StyleSheet, View, useWindowDimensions } from "react-native"; +import { calculateTotal } from "@yahtzee/game-engine"; +import { useLocalGame } from "../local/LocalProvider"; +import { Action, Label } from "../ui/controls"; +import { Dice } from "./Dice"; +import { NativeScorecard } from "./NativeScorecard"; + +function Deck() { + const { view, colors } = useLocalGame(); + const game = view.data!.active!.game; + const name = game.players[0].name, round = game.currentRound; + useEffect(() => { + AccessibilityInfo.announceForAccessibility(`${name}'s turn. Round ${round}.`); + }, [name, round]); + return + + + + + {game.players.map((player) => + + + )} + ; +} +export function Play({ onPause }: { onPause: () => void }) { + const { store, view, colors } = useLocalGame(); + const game = view.data!.active!.game; + const { width, fontScale } = useWindowDimensions(); + const expanded = width >= 820 && fontScale <= 1.4; + const locked = view.busy || view.canRetry; + const roll = + { void store.move({ kind: "roll" }); }} /> + ; + const controls = <> + + + ; + if (expanded) return + + {controls}{roll} + + + ; + return + {controls} + {roll} + ; +} +const styles = StyleSheet.create({ + screen: { flex: 1 }, content: { padding: 20, gap: 16, paddingBottom: 28 }, + expanded: { flex: 1, flexDirection: "row", maxWidth: 1200, width: "100%", alignSelf: "center" }, + left: { width: 340 }, card: { flex: 1 }, + deck: { padding: 20, borderRadius: 16, gap: 12 }, + player: { gap: 4, paddingTop: 12 }, total: { fontWeight: "600", fontVariant: ["tabular-nums"] }, + roll: { paddingHorizontal: 20, paddingTop: 8, paddingBottom: 12 }, +}); diff --git a/apps/mobile/src/screens/Results.tsx b/apps/mobile/src/screens/Results.tsx new file mode 100644 index 0000000..8143125 --- /dev/null +++ b/apps/mobile/src/screens/Results.tsx @@ -0,0 +1,36 @@ +import React from "react"; +import { ScrollView, View } from "react-native"; +import { calculateTotal, getHighScoresForDiceCount, getPlayerAverageScore } from "@yahtzee/game-engine"; +import { useLocalGame } from "../local/LocalProvider"; +import { Action, Label, Section, styles } from "../ui/controls"; + +export function HighScores({ diceCount }: { diceCount: number }) { + const { view } = useLocalGame(); + const scores = getHighScoresForDiceCount(view.data!.highScores, diceCount); + return
+ + {scores.length ? scores.map((score) => + + + + ) : } +
; +} +export function Results({ onAgain }: { onAgain: () => void }) { + const { view } = useLocalGame(); + const data = view.data!, game = data.active!.game; + const results = game.players.map((player) => ({ player, total: calculateTotal(player, game.diceCount).grandTotal })).sort((a, b) => b.total - a.total); + return + + +
+ {results.map(({ player, total }) => + + + + )} +
+ + +
; +} diff --git a/apps/mobile/src/screens/Setup.tsx b/apps/mobile/src/screens/Setup.tsx new file mode 100644 index 0000000..0ef13fe --- /dev/null +++ b/apps/mobile/src/screens/Setup.tsx @@ -0,0 +1,48 @@ +import React, { useState } from "react"; +import { KeyboardAvoidingView, Platform, ScrollView, TextInput, View } from "react-native"; +import { useLocalGame } from "../local/LocalProvider"; +import { MODES } from "../local/save"; +import { Action, Label, Section, styles } from "../ui/controls"; +import { Choice } from "../ui/Choice"; +import type { Confirm } from "../ui/useConfirmation"; + +export function Setup({ onStart, onResume, confirm }: { onStart: (name: string) => void; onResume: () => void; confirm: Confirm }) { + const { store, view, colors } = useLocalGame(); + const data = view.data!; + const [name, setName] = useState(data.preferences.name); + const locked = view.busy || view.canRetry; + const discard = () => confirm("Discard saved game", "This clears the saved game from the play screen. Completed results and high scores stay on this device.", () => { void store.discard(); }); + const appearance = ["system", "light", "dark"] as const; + return + + + + {data.active ?
+ + + + +
: <> +
+ + {data.preferences.recentNames.map((recent) => setName(recent)} />)} + { void store.preferences({ aiOpponents }); }} /> +
+
+ `${count} dice`)} selected={MODES.findIndex((count) => count === data.preferences.diceCount)} + disabled={locked} onSelect={(index) => { void store.preferences({ diceCount: MODES[index] }); }} /> + +
+ onStart(name)} /> + } +
+ { void store.preferences({ appearance: appearance[index] }); }} /> +
+
+
; +} diff --git a/apps/mobile/src/ui/Choice.tsx b/apps/mobile/src/ui/Choice.tsx new file mode 100644 index 0000000..508fe64 --- /dev/null +++ b/apps/mobile/src/ui/Choice.tsx @@ -0,0 +1,25 @@ +import React, { useState } from "react"; +import { Pressable, View } from "react-native"; +import { useLocalGame } from "../local/LocalProvider"; +import { Label, styles } from "./controls"; +import { showChoice } from "./showChoice"; + +export function Choice({ title, options, selected, onSelect, disabled = false }: { + title: string; options: string[]; selected: number; onSelect: (index: number) => void; disabled?: boolean; +}) { + const [expanded, setExpanded] = useState(false); + const { colors, dark } = useLocalGame(); + const select = (index: number) => { onSelect(index); setExpanded(false); }; + const open = () => { if (!showChoice(title, options, selected, select, dark)) setExpanded(!expanded); }; + return + + + + {expanded && options.map((label, index) => select(index)} style={styles.row}> + + )} + ; +} diff --git a/apps/mobile/src/ui/colors.ios.ts b/apps/mobile/src/ui/colors.ios.ts new file mode 100644 index 0000000..1f8f06b --- /dev/null +++ b/apps/mobile/src/ui/colors.ios.ts @@ -0,0 +1,11 @@ +import { DynamicColorIOS, PlatformColor } from "react-native"; +import { fallbackColors, type NativeColors } from "./palette"; + +export function nativeColors(dark: boolean): NativeColors { + return { ...fallbackColors(dark), + page: PlatformColor("systemGroupedBackground"), surface: PlatformColor("secondarySystemGroupedBackground"), + text: PlatformColor("label"), muted: PlatformColor("secondaryLabel"), line: PlatformColor("separator"), + error: PlatformColor("systemRed"), + tint: DynamicColorIOS({ light: "#92431f", dark: "#ffba93", highContrastLight: "#672909", highContrastDark: "#ffc3a4" }), + }; +} diff --git a/apps/mobile/src/ui/colors.ts b/apps/mobile/src/ui/colors.ts new file mode 100644 index 0000000..97f9429 --- /dev/null +++ b/apps/mobile/src/ui/colors.ts @@ -0,0 +1 @@ +export { fallbackColors as nativeColors } from "./palette"; diff --git a/apps/mobile/src/ui/confirmation.ios.ts b/apps/mobile/src/ui/confirmation.ios.ts new file mode 100644 index 0000000..b5361a3 --- /dev/null +++ b/apps/mobile/src/ui/confirmation.ios.ts @@ -0,0 +1,6 @@ +import { Alert } from "react-native"; + +export function showConfirmation(title: string, message: string, accept: () => void): boolean { + Alert.alert(title, message, [{ text: "Cancel", style: "cancel" }, { text: title, style: "destructive", onPress: accept }]); + return true; +} diff --git a/apps/mobile/src/ui/confirmation.ts b/apps/mobile/src/ui/confirmation.ts new file mode 100644 index 0000000..7076916 --- /dev/null +++ b/apps/mobile/src/ui/confirmation.ts @@ -0,0 +1,3 @@ +export function showConfirmation(_title: string, _message: string, _accept: () => void): boolean { + return false; +} diff --git a/apps/mobile/src/ui/controls.tsx b/apps/mobile/src/ui/controls.tsx new file mode 100644 index 0000000..9e91cfa --- /dev/null +++ b/apps/mobile/src/ui/controls.tsx @@ -0,0 +1,44 @@ +import React, { type ReactNode } from "react"; +import { Pressable, StyleSheet, Text, View, type ColorValue, type TextProps } from "react-native"; +import { useLocalGame } from "../local/LocalProvider"; + +const type = { + title: { fontSize: 28, fontWeight: "700" as const }, + heading: { fontSize: 20, fontWeight: "600" as const }, + body: { fontSize: 17 }, + caption: { fontSize: 15 }, +}; +const ramps = { title: "title1", heading: "title3", body: "body", caption: "subheadline" } as const; +export function Label({ children, kind = "body", muted = false, color, ...props }: TextProps & { + children: ReactNode; kind?: keyof typeof type; muted?: boolean; color?: ColorValue; +}) { + const { colors } = useLocalGame(); + return {children}; +} +export function Action({ label, onPress, disabled = false, primary = false, destructive = false, testID }: { + label: string; onPress: () => void; disabled?: boolean; primary?: boolean; destructive?: boolean; testID?: string; +}) { + const { colors } = useLocalGame(); + const color = destructive ? colors.error : primary ? colors.actionText : colors.tint; + return [styles.action, { backgroundColor: primary ? colors.action : "transparent", opacity: disabled ? 0.45 : pressed ? 0.7 : 1 }]}> + + ; +} +export function Section({ title, children }: { title: string; children: ReactNode }) { + const { colors } = useLocalGame(); + return + + {children} + ; +} +export const styles = StyleSheet.create({ + action: { minHeight: 48, minWidth: 48, justifyContent: "center", alignItems: "center", paddingHorizontal: 16, paddingVertical: 12, borderRadius: 12 }, + actionText: { fontWeight: "600", textAlign: "center", flexShrink: 1 }, + section: { gap: 10, marginTop: 22 }, sectionTitle: { paddingHorizontal: 4 }, + group: { borderRadius: 14, overflow: "hidden" }, + row: { padding: 16, minHeight: 48 }, + screen: { flex: 1 }, scroll: { padding: 20, paddingBottom: 28, gap: 16, width: "100%", maxWidth: 1100, alignSelf: "center" }, +}); diff --git a/apps/mobile/src/ui/palette.ts b/apps/mobile/src/ui/palette.ts new file mode 100644 index 0000000..ba5b944 --- /dev/null +++ b/apps/mobile/src/ui/palette.ts @@ -0,0 +1,19 @@ +import type { ColorValue } from "react-native"; + +export interface NativeColors { + page: ColorValue; surface: ColorValue; text: ColorValue; muted: ColorValue; + line: ColorValue; tint: ColorValue; error: ColorValue; deck: ColorValue; + deckText: ColorValue; die: ColorValue; pip: ColorValue; held: ColorValue; + action: ColorValue; actionText: ColorValue; +} +/** Non-iOS fallback and the deliberately game-specific brand colors. */ +export function fallbackColors(dark: boolean): NativeColors { + return { + page: dark ? "#182521" : "#eff2ee", surface: dark ? "#23352e" : "#ffffff", + text: dark ? "#edf1e7" : "#203a34", muted: dark ? "#b4c4b6" : "#576a61", + line: dark ? "#465e4c" : "#ccd7cd", tint: dark ? "#ffba93" : "#92431f", + error: dark ? "#ffd0c5" : "#9c342c", deck: dark ? "#102f26" : "#1e453a", + deckText: "#f5f4e9", die: "#f5f4e9", pip: "#244033", held: "#cee2af", + action: "#f2a07e", actionText: "#35281f", + }; +} diff --git a/apps/mobile/src/ui/showChoice.ios.ts b/apps/mobile/src/ui/showChoice.ios.ts new file mode 100644 index 0000000..b0ec18c --- /dev/null +++ b/apps/mobile/src/ui/showChoice.ios.ts @@ -0,0 +1,8 @@ +import { ActionSheetIOS } from "react-native"; + +export function showChoice(title: string, options: string[], selected: number, onSelect: (index: number) => void, dark: boolean): boolean { + ActionSheetIOS.showActionSheetWithOptions({ title, message: `Current: ${options[selected]}`, + options: [...options, "Cancel"], cancelButtonIndex: options.length, userInterfaceStyle: dark ? "dark" : "light" }, + (index) => { if (index < options.length) onSelect(index); }); + return true; +} diff --git a/apps/mobile/src/ui/showChoice.ts b/apps/mobile/src/ui/showChoice.ts new file mode 100644 index 0000000..13aff04 --- /dev/null +++ b/apps/mobile/src/ui/showChoice.ts @@ -0,0 +1,4 @@ +/** The non-iOS control expands its options inline. */ +export function showChoice(_title: string, _options: string[], _selected: number, _onSelect: (index: number) => void, _dark: boolean): boolean { + return false; +} diff --git a/apps/mobile/src/ui/useConfirmation.tsx b/apps/mobile/src/ui/useConfirmation.tsx new file mode 100644 index 0000000..9277598 --- /dev/null +++ b/apps/mobile/src/ui/useConfirmation.tsx @@ -0,0 +1,27 @@ +import React, { useState } from "react"; +import { Modal, View } from "react-native"; +import { useLocalGame } from "../local/LocalProvider"; +import { Action, Label } from "./controls"; +import { showConfirmation } from "./confirmation"; + +type Question = { title: string; message: string; accept: () => void }; +export type Confirm = (title: string, message: string, accept: () => void) => void; +export function useConfirmation(): { confirm: Confirm; dialog: React.ReactNode } { + const [question, setQuestion] = useState(null); + const { colors } = useLocalGame(); + const confirm: Confirm = (title, message, accept) => { + if (!showConfirmation(title, message, accept)) setQuestion({ title, message, accept }); + }; + const accept = () => { question?.accept(); setQuestion(null); }; + const dialog = setQuestion(null)}> + + + + + + setQuestion(null)} /> + + + ; + return { confirm, dialog }; +} diff --git a/bun.lock b/bun.lock index 757acbe..e5c3ddf 100644 --- a/bun.lock +++ b/bun.lock @@ -57,19 +57,22 @@ }, "apps/mobile": { "name": "@yahtzee/mobile", - "version": "0.1.0", + "version": "1.0.0", "dependencies": { "@expo/metro-runtime": "57.0.16", "@react-native-async-storage/async-storage": "2.2.0", "@yahtzee/game-engine": "workspace:*", - "@yahtzee/ui": "workspace:*", - "convex": "1.46.0", "expo": "57.0.24", "expo-asset": "57.0.18", + "expo-build-properties": "57.0.21", "expo-constants": "57.0.19", + "expo-file-system": "57.0.7", "expo-linking": "57.0.10", "expo-router": "57.0.22", + "expo-splash-screen": "57.0.9", + "expo-sqlite": "57.0.3", "expo-status-bar": "57.0.1", + "expo-system-ui": "57.0.4", "react": "19.2.3", "react-native": "0.86.3", "react-native-safe-area-context": "5.9.1", @@ -801,6 +804,8 @@ "at-least-node": ["at-least-node@1.0.0", "", {}, "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg=="], + "await-lock": ["await-lock@2.2.2", "", {}, "sha512-aDczADvlvTGajTDjcjpJMqRkOF6Qdz3YbPZm/PyW6tKPkx2hlYBzxMhEywM/tU72HrVZjgl5VCdRuMlA7pZ8Gw=="], + "aws4": ["aws4@1.13.2", "", {}, "sha512-lHe62zvbTB5eEABUVi/AwVh0ZKY9rMMDhmm+eeyuuUQbQ3+J+fONVQOZyj+DdrvD4BY33uYniyRJ4UJIaSKAfw=="], "babel-plugin-polyfill-corejs2": ["babel-plugin-polyfill-corejs2@0.4.17", "", { "dependencies": { "@babel/compat-data": "^7.28.6", "@babel/helper-define-polyfill-provider": "^0.6.8", "semver": "^6.3.1" }, "peerDependencies": { "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" } }, "sha512-aTyf30K/rqAsNwN76zYrdtx8obu0E4KoUME29B1xj+B3WxgvWkp943vYQ+z8Mv3lw9xHXMHpvSPOBxzAkIa94w=="], @@ -1069,6 +1074,8 @@ "expo-asset": ["expo-asset@57.0.18", "", { "dependencies": { "@expo/image-utils": "^0.11.5", "expo-constants": "~57.0.19" }, "peerDependencies": { "expo": "*", "react": "*", "react-native": "*" } }, "sha512-zDIQkUr0NM2S7YRj98Zohf/OBuM1q0o4ctxLz1C1oe4/33lHNLjp+2v3qUtBWVwn0zKka8UGADmS8M+83Wi6pw=="], + "expo-build-properties": ["expo-build-properties@57.0.21", "", { "dependencies": { "@expo/schema-utils": "^57.0.2", "resolve-from": "^5.0.0", "semver": "^7.6.0" }, "peerDependencies": { "expo": "*" } }, "sha512-IF5/FPU4SezMYMupB2gfH6eAu197/oKI6Bn0oOT9UQiAg70BNiiQJ499eV21kIWIOGGPdLHg6XqIV5Zq4Gnn7Q=="], + "expo-constants": ["expo-constants@57.0.19", "", { "dependencies": { "@expo/env": "~2.4.3" }, "peerDependencies": { "expo": "*", "react-native": "*" } }, "sha512-3eK1kZRwCdMizQLlM/PPlPwjaPnB5qKvdRDMBMnB1ZxmvWJBf9TB4uEO4DMMfIPaFUxYFs29dsR5fPr1gh3FTQ=="], "expo-file-system": ["expo-file-system@57.0.7", "", { "peerDependencies": { "expo": "*", "react-native": "*" } }, "sha512-1vkZRadOsIputFDBcclqBa1pO3iXOO6iIsdqJipQWw4V5TSnWgmRTuOF7ro8IzrVue+PHbum++KCG3Tawem4cg=="], @@ -1091,10 +1098,16 @@ "expo-server": ["expo-server@57.0.3", "", {}, "sha512-aK+LdKzauHSGmsOStZtyxdzv0zWssCkxTw3m4QuOhfDSJsZaMRTd9O41d8ixU/QfELTbaJ0oRNcF7JFV/7O9YQ=="], + "expo-splash-screen": ["expo-splash-screen@57.0.9", "", { "dependencies": { "@expo/config-plugins": "~57.0.9", "@expo/image-utils": "^0.11.5", "xml2js": "0.6.0" }, "peerDependencies": { "expo": "*" } }, "sha512-7cKDn7uBwg0RkcmY015/5j9st4msWJ4zQiPmQdVZoppW3cFSbv05n7xhM6CjUU466Tx4VRTqDF21HuIHkmnEtA=="], + + "expo-sqlite": ["expo-sqlite@57.0.3", "", { "dependencies": { "await-lock": "^2.2.2" }, "peerDependencies": { "expo": "*", "react": "*", "react-native": "*" } }, "sha512-gbu9Nwm76DNpSK+MEhCjjjF3/EMyFE96IEDSlfO9jPiF4q48a7bef5EXnWVrwW8rvqCZKYAfSGqSpYNhhhpgIg=="], + "expo-status-bar": ["expo-status-bar@57.0.1", "", { "peerDependencies": { "expo": "*", "react": "*", "react-native": "*" } }, "sha512-Xwaq1gAoVRWx5dPG5VhT5RSbnI9OilhZnO5qoPBnUaBAa5VzRzfdS8q0/bsPt0jR2DKLtGuP0bQ6efMJ4RIMDg=="], "expo-symbols": ["expo-symbols@57.0.3", "", { "dependencies": { "@expo-google-fonts/material-symbols": "^0.4.1", "sf-symbols-typescript": "^2.0.0" }, "peerDependencies": { "expo": "*", "expo-font": "*", "react": "*", "react-native": "*" } }, "sha512-uuK5yHLVR7kExUCrO/ItBvp/kp1maQ9Nkb6KvNy5ZUQnN0NMKwuhJ4GvbfS9N3ACmvCjTT4gKvg4yH5UuKIYNA=="], + "expo-system-ui": ["expo-system-ui@57.0.4", "", { "dependencies": { "@react-native/normalize-colors": "0.86.3", "debug": "^4.3.2" }, "peerDependencies": { "expo": "*", "react-native": "*", "react-native-web": "*" }, "optionalPeers": ["react-native-web"] }, "sha512-z//rxQJzhTNA1PcKrUtWmrd21jAS3nEDu1b0n8B/7LTTR933OcsZYP1HnbaZifuo2ZH/h7nce2Ow61WZ1Ig2bg=="], + "exponential-backoff": ["exponential-backoff@3.1.3", "", {}, "sha512-ZgEeZXj30q+I0EN+CbSSpIyPaJ5HVQD18Z1m+u1FXbAeT94mr1zw50q4q6jiiC447Nl/YTcIYSAftiGqetwXCA=="], "fast-deep-equal": ["fast-deep-equal@3.1.3", "", {}, "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="], @@ -1915,7 +1928,7 @@ "xml2js": ["xml2js@0.6.0", "", { "dependencies": { "sax": ">=0.6.0", "xmlbuilder": "~11.0.0" } }, "sha512-eLTh0kA8uHceqesPqSE+VvO1CDDJWMwlQfB6LuN6T8w6MaDJ8Txm8P7s5cHD0miF0V+GGTZrDQfxPZQVsur33w=="], - "xmlbuilder": ["xmlbuilder@15.1.1", "", {}, "sha512-yMqGBqtXyeN1e3TGYvgNgDVZ3j84W4cwkOXQswghol6APgZWaff9lnbvN7MHYJOiXsvGPXtjTYJEiC9J2wv9Eg=="], + "xmlbuilder": ["xmlbuilder@11.0.1", "", {}, "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA=="], "y18n": ["y18n@5.0.8", "", {}, "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA=="], @@ -2111,6 +2124,8 @@ "@expo/package-manager/chalk": ["chalk@4.1.2", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="], + "@expo/plist/xmlbuilder": ["xmlbuilder@15.1.1", "", {}, "sha512-yMqGBqtXyeN1e3TGYvgNgDVZ3j84W4cwkOXQswghol6APgZWaff9lnbvN7MHYJOiXsvGPXtjTYJEiC9J2wv9Eg=="], + "@expo/prebuild-config/@react-native/normalize-colors": ["@react-native/normalize-colors@0.86.3", "", {}, "sha512-Cv3CDkprb67GrzuaS9BGbBJC/6G4lIw3nyKOHRKTqTTum4bn37y5+R0Z04L8mcbQN85eEohNrRwb7IOM4j6uvg=="], "@expo/xcpretty/chalk": ["chalk@4.1.2", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="], @@ -2227,6 +2242,8 @@ "expo-modules-autolinking/commander": ["commander@7.2.0", "", {}, "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw=="], + "expo-system-ui/@react-native/normalize-colors": ["@react-native/normalize-colors@0.86.3", "", {}, "sha512-Cv3CDkprb67GrzuaS9BGbBJC/6G4lIw3nyKOHRKTqTTum4bn37y5+R0Z04L8mcbQN85eEohNrRwb7IOM4j6uvg=="], + "fbjs/promise": ["promise@7.3.1", "", { "dependencies": { "asap": "~2.0.3" } }, "sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg=="], "filelist/minimatch": ["minimatch@5.1.9", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-7o1wEA2RyMP7Iu7GNba9vc0RWWGACJOCZBJX2GJWip0ikV+wcOsgVuY9uE8CPiyQhkGFSlhuSkZPavN7u1c2Fw=="], @@ -2333,6 +2350,8 @@ "pkijs/@noble/hashes": ["@noble/hashes@1.8.0", "", {}, "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A=="], + "plist/xmlbuilder": ["xmlbuilder@15.1.1", "", {}, "sha512-yMqGBqtXyeN1e3TGYvgNgDVZ3j84W4cwkOXQswghol6APgZWaff9lnbvN7MHYJOiXsvGPXtjTYJEiC9J2wv9Eg=="], + "postject/commander": ["commander@9.5.0", "", {}, "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ=="], "pretty-format/ansi-styles": ["ansi-styles@5.2.0", "", {}, "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA=="], @@ -2387,8 +2406,6 @@ "unzipper/fs-extra": ["fs-extra@11.3.1", "", { "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" } }, "sha512-eXvGGwZ5CL17ZSwHWd3bbgk7UUpF6IFHtP57NYYakPvHOs8GDgDe5KJI36jIJzDkJ6eJjuzRA8eBQb6SkKue0g=="], - "xml2js/xmlbuilder": ["xmlbuilder@11.0.1", "", {}, "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA=="], - "@babel/core/@babel/traverse/@babel/helper-globals": ["@babel/helper-globals@7.29.7", "", {}, "sha512-3nQVUAtvkKH9zahfWgw96Jc/uFOmjACE1kQz82E2lqWmHBgjzbNlsC22nuQTfahmWeQtTq5nQ/4Nnd2A1wj4zA=="], "@babel/generator/@babel/types/@babel/helper-string-parser": ["@babel/helper-string-parser@8.0.6", "", {}, "sha512-+6HYEBnsDRZHJtUTAEfMQd0zMDqdFHS7C+5vAsEZqBUr3vEMWOWlHJ0Jz1gS8jJIlCvLsuA6ivmeoqzH936YcA=="], @@ -2587,10 +2604,14 @@ "@electron/osx-sign/plist/@xmldom/xmldom": ["@xmldom/xmldom@0.9.12", "", {}, "sha512-5AXjrcMClTryPe9LgZrygpB1lj7s0S9E0+W+AHaVKAVyHanafK86iPSvG5xHVSp/jC+VH1UXu0TAEmY279xH7A=="], + "@electron/osx-sign/plist/xmlbuilder": ["xmlbuilder@15.1.1", "", {}, "sha512-yMqGBqtXyeN1e3TGYvgNgDVZ3j84W4cwkOXQswghol6APgZWaff9lnbvN7MHYJOiXsvGPXtjTYJEiC9J2wv9Eg=="], + "@electron/universal/minimatch/brace-expansion": ["brace-expansion@2.1.7", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-uZbew1NqdmPDTMJ8ah1y+b+9QEJrfkXFk3RcTQw3X0jW/xRUvFKsg1CfQdSYGdTbXZWExtU3J3ccxtnfw1Fi0g=="], "@electron/universal/plist/@xmldom/xmldom": ["@xmldom/xmldom@0.9.12", "", {}, "sha512-5AXjrcMClTryPe9LgZrygpB1lj7s0S9E0+W+AHaVKAVyHanafK86iPSvG5xHVSp/jC+VH1UXu0TAEmY279xH7A=="], + "@electron/universal/plist/xmlbuilder": ["xmlbuilder@15.1.1", "", {}, "sha512-yMqGBqtXyeN1e3TGYvgNgDVZ3j84W4cwkOXQswghol6APgZWaff9lnbvN7MHYJOiXsvGPXtjTYJEiC9J2wv9Eg=="], + "@eslint/config-array/minimatch/brace-expansion": ["brace-expansion@1.1.21", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-9zeA+KLZNNzglF2TPKRQEDyx6Yby7daAkuy8MiPzpXPsYDWi/DRM8jmwUDxokQjYqBpv5DgPiwD4h4ZZSy1Ujw=="], "@eslint/eslintrc/ajv/json-schema-traverse": ["json-schema-traverse@0.4.1", "", {}, "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="], @@ -2835,6 +2856,8 @@ "simple-plist/plist/@xmldom/xmldom": ["@xmldom/xmldom@0.9.12", "", {}, "sha512-5AXjrcMClTryPe9LgZrygpB1lj7s0S9E0+W+AHaVKAVyHanafK86iPSvG5xHVSp/jC+VH1UXu0TAEmY279xH7A=="], + "simple-plist/plist/xmlbuilder": ["xmlbuilder@15.1.1", "", {}, "sha512-yMqGBqtXyeN1e3TGYvgNgDVZ3j84W4cwkOXQswghol6APgZWaff9lnbvN7MHYJOiXsvGPXtjTYJEiC9J2wv9Eg=="], + "@babel/helper-create-class-features-plugin/@babel/core/@babel/code-frame/@babel/helper-validator-identifier": ["@babel/helper-validator-identifier@8.0.6", "", {}, "sha512-HYx0YmuchRxRSpnjvcNffnPS8DCauKNmnumIuHG3jnQAVewRA7kfJGwF13ayEpSZs7s4R/oBH4eppuXcAQd5JQ=="], "@babel/helper-create-class-features-plugin/@babel/core/@babel/code-frame/js-tokens": ["js-tokens@10.0.0", "", {}, "sha512-lM/UBzQmfJRo9ABXbPWemivdCW8V2G8FHaHdypQaIy523snUjog0W71ayWXTjiR+ixeMyVHN2XcpnTd/liPg/Q=="], diff --git a/docs/function-risk.md b/docs/function-risk.md index 1933ef5..caa471c 100644 --- a/docs/function-risk.md +++ b/docs/function-risk.md @@ -10,7 +10,7 @@ bun run quality:measure On Linux, install Playwright host dependencies and use `xvfb-run --auto-servernum bun run quality:measure`, as described in [client qualification](client-qualification.md). No deployment or credentials are needed. -The command clears only its generated raw-counter directory, runs instrumented engine/backend tests, runs all six real-client journeys, and writes `reports/quality/report.md`, `report.json` and `functions.json`. The JSON report records the Git revision and dirty state. The function-only file omits volatile metadata so two runs at one revision can be compared directly. Missing unit/backend/client collections, empty collections and mismatched source locations fail the command. +The command clears only its generated raw-counter directory, runs instrumented engine/backend tests, runs the online web/Electron journeys and the offline mobile-source adapter journeys, and writes `reports/quality/report.md`, `report.json` and `functions.json`. The JSON report records the Git revision and dirty state. The function-only file omits volatile metadata so two runs at one revision can be compared directly. Missing unit/backend/client collections, empty collections and mismatched source locations fail the command. The pinned tools are TypeScript 6.0.3, istanbul-lib-instrument 6.0.3 and istanbul-lib-coverage 3.2.2. Bun 1.4.2 runs the tests. Runtime plugins add counters only during qualification; application source and shipped bundles are unchanged. Bun test completion hooks persist unit counters because its runner does not invoke process-exit handlers. Client counters and backend counters are captured before fixture shutdown. @@ -30,7 +30,7 @@ Coverage is a fraction from zero to one. Calculations retain full precision; dis ## Gate and initial review -Scores from 15 through 30 require review. New functions above 30 fail. The three pre-existing exceptions in [the baseline](../quality-baseline.json) have exact measured limits and reasons. An exception cannot worsen, and an improved or removed exception must be lowered or removed. Routine measurement never rewrites the baseline. Do not add exceptions for new code or raise a budget to make a failure disappear; policy changes need explicit review with their measured effect. +Scores from 15 through 30 require review. New functions above 30 fail. The [baseline](../quality-baseline.json) no longer needs legacy exceptions after the web, desktop and native screen extractions. An exception cannot worsen, and an improved or removed exception must be lowered or removed. Routine measurement never rewrites the baseline. Do not add exceptions for new code or raise a budget to make a failure disappear; policy changes need explicit review with their measured effect. Initial source baseline is commit `dc1978768479bd3c37555619d681d40f82fd479f`. None of these production functions changed in the measurement PR. @@ -40,7 +40,7 @@ Initial source baseline is commit `dc1978768479bd3c37555619d681d40f82fd479f`. No | Web App | 34 | 51/54 | 34.19821673525377 | Same constraint as desktop | | Mobile Index | 40 | 61/65 | 40.37287209831589 | Preserve measured risk until screen extraction lowers it | -The desktop/web redesign now shares separate setup, play, and results components. Both app entry components fall below the new-function gate, so their obsolete legacy exceptions were removed. The mobile exception remains unchanged. Current measurements are in `reports/quality/report.md`; the table above records the original baseline, not current desktop/web complexity. +The desktop/web redesign shares setup, play and results components. The native offline interface has separate local-state, setup, play, scorecard, results, history and help modules. All entry components now fall below the new-function gate, so their obsolete legacy exceptions were removed. Current measurements are in `reports/quality/report.md`; the table above records the original baseline, not current complexity. Better coverage alone cannot put complexity 34 or 40 below CRAP 30. These are visible legacy limits, not claims that the components are low-risk. diff --git a/docs/mobile-offline.md b/docs/mobile-offline.md new file mode 100644 index 0000000..ad36fa0 --- /dev/null +++ b/docs/mobile-offline.md @@ -0,0 +1,38 @@ +# Native offline storage + +The iOS and Android app uses the shared rules through a small asynchronous storage interface. Web and Electron keep their existing adapters and online authority. Native gameplay does not construct a Convex client or send results to the online leaderboard. + +## Document and commit boundary + +`apps/mobile/src/local/save.ts` validates a schema-1, rules-2 JSON document under `hemsoft-local-dice-v1`. It contains preferences, one active game with a revision, the last 500 completed games and all-time top tens per mode. Native development currently supports 5, 6, 8 and 10 dice, one human and zero to three AI opponents. These are reversible engineering defaults, not release-scope approval. + +The store computes each move once, including AI turns, and stages its exact serialized document. It publishes state only after storage acknowledges the write. A failed acknowledgment blocks further moves. Retry writes the same bytes; it does not roll again or append another result. Explicit reload reads the stored state and abandons only the pending in-memory move. An unacknowledged move may be absent after process termination. + +Native builds select `platformStorage.native.ts`. Expo SQLite 57.0.3 stores the document as one parameter-bound SQL value in the dedicated `hemsoft-local-dice.db` database. Writes use SQLite autocommit with WAL and `synchronous=FULL`. Database format version 1 is separate from the document/rules versions. Loading checks integrity and the database version before schema or journal changes. Unsupported databases, unreadable storage, invalid JSON and invalid game state produce a visible recovery error rather than a reset. + +The web development adapter uses AsyncStorage's web implementation. Browser journeys are supplementary and do not test native SQLite, UIKit navigation, safe areas or VoiceOver. + +## Why game saves do not use native AsyncStorage + +Inspection of AsyncStorage 2.2.0's iOS implementation found two unsuitable behaviors for this contract. It recreates its in-memory manifest after manifest JSON damage, and it removes an external value file before committing a replacement inline value. A validator above `getItem` cannot reliably detect the first case. Native AsyncStorage remains only for importing the old names/theme preferences. No online scores are imported. No native game document from this branch had shipped before this backend change. + +## Recovery and deletion + +Normal load and failed writes never call the database deletion API. The Help reset requires confirmation. Reset removes the two owned legacy preference keys first, then closes and removes only the dedicated database and its WAL, shared-memory and rollback-journal files. Acknowledged deletion commits an empty state. No fallible replacement write follows it; the next load or change creates a new document. A legacy cleanup error occurs before the durable game is deleted. + +Missing database files are tolerated only after a successful directory listing proves absence. Expo SQLite's iOS module uses `E_SQLITE_DELETE_DATABASE` for missing files, open connections and other deletion errors, so the adapter does not treat that code as proof of absence. The installed Expo FileSystem 57.0.7 module supplies directory listings; listing failures stop reset. The adapter checks for remaining owned files before acknowledging deletion. A database-deletion error may follow partial deletion, so the app hides the potentially stale game and requires retry or explicit reload. It does not present the old data as safely retained. Other keys and apps are untouched. Successful reset/reload clears unsaved UI name drafts; an uncertain explicit reset enters recovery instead of retaining those screens. + +SQLite transaction recovery is not a guarantee against device loss, arbitrary filesystem destruction or faulty storage hardware. The app has no remote backup service or recovery account. Keep damaged bytes available for diagnosis until the user chooses reset. Do not add a catch-and-recreate path for database errors. + +## Backup and uninstall + +The development default uses Expo SQLite's iOS Documents/SQLite directory. It is eligible for standard OS-controlled device backup; the app does not independently sync it. Deleting the app removes its local container. Offloading can retain data, and restoring an older device backup can restore older games and preferences. Reset does not erase existing OS backups. No application-level database encryption is configured. + +Physical backup/restore, uninstall and locked-device behavior still need device qualification. The owner must review the final privacy disclosures before release. These source-level defaults are not an attestation that a particular backup has succeeded. + +## Evidence boundaries + +- `nativePersistence.test.ts` covers validation, staged retries, concurrency, all modes, completion retention and reset at the storage interface. +- `nativeSqlite.test.ts` uses real temporary SQLite files through Bun. It covers corruption preservation, schema rejection, SQL binding, restart, acknowledgment loss and explicit reset. It does not run Expo's native module. +- The [native simulator workflow](native-simulator.md) builds and exercises the actual Expo iOS app, reads its database, compares resume bytes and tests corrupt documents/databases through the native recovery UI. +- Real iPhone/iPad airplane-mode, VoiceOver, interruption, backup and TestFlight acceptance remain separate requirements in [issue 41](https://github.com/HemSoft/yahtzee/issues/41) and [issue 42](https://github.com/HemSoft/yahtzee/issues/42). diff --git a/docs/mobile-privacy-audit.md b/docs/mobile-privacy-audit.md new file mode 100644 index 0000000..4072398 --- /dev/null +++ b/docs/mobile-privacy-audit.md @@ -0,0 +1,57 @@ +# Mobile privacy engineering inventory + +Prepared September 27, 2026 for [issue #48](https://github.com/HemSoft/yahtzee/issues/48). This is an incomplete engineering record, not App Store answers or legal approval. The [policy source](../apps/mobile/PRIVACY.md) is a draft. + +## Observed native package + +The first [native build](https://github.com/HemSoft/yahtzee/actions/runs/36355495021), source `53bbfd32e17481f698db75ec2117440ea9d1d089`, produced an unsigned Release simulator app with Xcode 26.6 and SDK 26.5. Its packaged-app SHA-256 is `90d67f5d24e5135d7057d3a402962145e6e2891a09689d5ee1538d65ff364eda`. The build's [artifact](https://github.com/HemSoft/yahtzee/actions/runs/36355495021/artifacts/10944680287) has limited retention. It is not a signed device archive. + +Reading the actual packaged property lists found: + +- `CFBundleSupportedPlatforms` is `iPhoneSimulator`, with iPhone and iPad device families, minimum iOS 17.0, version 1.0.0 and build 1. +- There are no permission-purpose strings in the app's compiled Info.plist. +- App Transport Security disallows arbitrary loads and permits local networking. This configuration is not a firewall or evidence that the app made no requests. +- `EXUpdatesEnabled` is false. `EXUpdatesCheckOnLaunch` is `ALWAYS`, but that setting does not enable the disabled update mechanism. The app contains its own `main.jsbundle`. +- `ITSAppUsesNonExemptEncryption` is absent. No classification has been asserted. +- Ten privacy manifests are present. Their declared collected-data arrays are empty; none declares tracking. Those declarations alone do not prove actual data flows. + +## Verified packaging finding + +The first app's `ExpoFileSystem_privacy.bundle` contains only its bundle Info.plist. Its `PrivacyInfo.xcprivacy` is absent. The aggregate app manifest also lacks the locked SDK's disk-space reasons and two file-timestamp reasons. + +The installed `expo-file-system` 57.0.7 source does contain the manifest. Its podspec declares that resource bundle. The CocoaPods log identifies Expo FileSystem as precompiled, and the app embeds its precompiled framework. Listing all archive entries ruled out a skipped hardlink or a misplaced file. + +The source manifest declares file-timestamp reasons `0A2A.1` and `3B52.1`, and disk-space reasons `E174.1` and `85F4.1`. These are recorded as upstream SDK declarations, not independently approved reasons for this app. + +The repair opts only `expo-file-system` into source compilation through the SDK 57 Apple autolinker's `buildFromSource` option. [Native build 36361758690](https://github.com/HemSoft/yahtzee/actions/runs/36361758690), source `bc040c05b0a36ca6e4d214bba7dee14ce939dc86`, passed deployment-mode installation and package inspection. Eleven manifests are present. The SDK resource matches upstream, and all four previously missing reasons appear in the aggregate. The retained build's ten artifact hashes verified after download. + +[The inspection tool](../scripts/ios-native/privacy.mjs) compares each new built resource with the locked SDK source and checks those aggregate reasons. It retains observed manifests and purpose strings without supplying legal answers. This passing simulator inspection does not establish signed-archive contents, SDK signatures or network behavior. + +## Data-flow inventory + +| Data or behavior | Source behavior | Remaining evidence | +| --- | --- | --- | +| Player name and five recent names | Local preferences only | Device traffic measurement and reset/uninstall check | +| Active game, dice, holds and opponents | One acknowledged SQLite document, retained for resume | iPhone simulator resume observed on `beff6ec`; physical interruption and airplane-mode checks remain | +| Completed results and local rankings | Last 500 games; top ten entries per mode | Physical retention, backup and restore checks | +| Appearance and game options | Local preferences | Device reset and restore checks | +| Legacy preferences | Import only the two documented old preference keys | Device upgrade fixture if an older native build is distributed | +| Diagnostics | Explicit allowlist; current source previews before sharing | Current native preview/cancel/share behavior and destination checks | +| Public technical feedback | User chooses an external GitHub issue page | Owner-approved private contact and public support copy | +| OS backup | SQLite lives under Documents/SQLite | Real-device backup eligibility, restore and older-data behavior | +| Expo updates | Disabled in the inspected compiled configuration | Recheck the signed candidate and measured traffic | +| SDK telemetry and crash behavior | No app-authored telemetry client; declared manifests inspected | Measure every release SDK, including OS-mediated diagnostics | +| Account, ads, purchases and cloud sync | Not implemented in the native app | Confirm final scope has not changed before declarations | + +See [the persistence boundary](mobile-offline.md) for storage and recovery behavior. The Node, browser and Bun SQLite tests do not replace device evidence. + +## Signed-candidate acceptance still required + +1. Run the same package inspection against the actual signed archive and retain source, archive hash, toolchain, module versions and all manifests. Verify SDK signatures and entitlements separately; the simulator inspection does neither. +2. Measure launch, a complete game, resume, reset, Help, cancelled diagnostics, explicit sharing and external support navigation. Identify which process and destination made each request. Do not treat build-time telemetry settings as a runtime traffic audit. +3. Verify device backup, offload, deletion and restore. Use synthetic names and scores. Preserve existing user data and review captures before sharing. +4. Review the app and SDK encryption use. No application-level database encryption is configured. Platform TLS and SDK code still require classification. An owner must approve export-compliance answers and any supporting documents. +5. Reconcile measured behavior with the privacy policy and App Store declaration matrix. Select the public policy URL and private contact without copying another app's identity or contacts. +6. Recheck [Apple's privacy details](https://developer.apple.com/app-store/app-privacy-details/), [SDK requirements](https://developer.apple.com/support/third-party-SDK-requirements/) and [Expo's privacy guidance](https://docs.expo.dev/guides/apple-privacy/) immediately before submission and after dependency or data-flow changes. + +No missing declaration, contact or legal approval is filled by a guessed value. A manifest comparison proves packaging consistency only. diff --git a/docs/native-simulator.md b/docs/native-simulator.md new file mode 100644 index 0000000..252e0b6 --- /dev/null +++ b/docs/native-simulator.md @@ -0,0 +1,68 @@ +# Unsigned iOS simulator qualification + +The native jobs in [Application quality](../.github/workflows/quality.yml) use standard public GitHub-hosted macOS runners. They do not use Apple credentials, a paid device cloud, signing, upload, TestFlight or App Store submission. The result is a simulator app, not an installable iPhone archive. + +## Inputs + +- macOS 26 runner, with the actual runner image version recorded in the receipt. +- Xcode 26.6, build 17F113, selected explicitly at `/Applications/Xcode_26.6.app`. +- iOS Simulator SDK/runtime 26.5; iPhone 17 and iPad Pro 13-inch M5. +- Node 24.12.0, Bun 1.4.2, CocoaPods 1.17.0 and Java 17. +- Maestro CLI 2.10.0, downloaded from its [versioned release](https://github.com/mobile-dev-inc/Maestro/releases/tag/cli-2.10.0) and checked against SHA-256 `29b675e10cc12080e445e9bfb2e2b4e4dfb9c0f2e30d5884120d258b5e1cd991`. +- The committed Bun lock, Expo app configuration and reviewed CocoaPods lock. + +The workflow checks actual tool versions rather than relying on the runner's default Xcode. Hosted images still change. A changed toolchain requires a reviewed pin update; these commands do not promise bit-identical Xcode output across hosts. + +## Generated native project + +Expo prebuild generates `apps/mobile/ios` from source configuration. This directory is ignored. The runner refuses an existing native directory rather than deleting local work. Run it in a fresh macOS checkout with the listed tools after `bun install --frozen-lockfile --ignore-scripts`: + +```sh +bun scripts/ios-native/run.mjs +``` + +The initial bootstrap retains its generated Podfile.lock as an artifact and remains non-passing until that lock is reviewed and committed at `apps/mobile/native/Podfile.lock`. Subsequent builds copy it into the generated project and use `pod install --deployment`; dependency drift fails the job. For an intentional update, `--refresh-pods` generates a replacement in a fresh checkout. A missing or changed lock stops before compilation and remains non-passing until source matches. Refresh-only mode always stops before compilation, even if the lock did not change. + +For hosted regeneration, apply the `native-pods-refresh` PR label before pushing the dependency change. Download its retained lock, inspect and commit the change, remove the label, then repeat normal qualification. Adding a label alone does not start this workflow, and reruns retain the original event's label snapshot. The refresh job intentionally fails and cannot satisfy the required quality gate. Do not bypass that check or call a bootstrap a qualified release. + +Build configuration is Release, `CODE_SIGNING_ALLOWED=NO`, with an embedded Hermes/JavaScript bundle. The simulator app targets the current host architecture, recorded in the manifest, rather than compiling an unused second simulator slice. It is not a universal Mac distribution. No Metro server is started. The compiled bundle identifier, version, build and minimum iOS 17.0 must match source. The proposed 1.0.0/build 1 and existing development identifiers are not approved public identity or an App Store reservation. + +## Packaged privacy resources + +The runner inspects the actual app's privacy manifests, purpose strings, update configuration and encryption-declaration field. It requires Expo FileSystem's bundled manifest to match the locked SDK source and its API reasons to appear in the aggregate. Only Expo FileSystem opts into source compilation because the inspected SDK 57 precompiled package omitted that resource. See the [engineering inventory](mobile-privacy-audit.md) for the reproduced finding and evidence limits. This check does not approve privacy answers, SDK signatures or export classification. + +## Native interaction matrix + +CI compiles once with `--build-only`, then downloads that same run's artifact into four test jobs: `phone-5`, `phone-6`, `tablet-8` and `tablet-10`. Each runs `--test-group=` after verifying the build's source, workflow run, architecture, Bun lock, app identity and every retained file hash. Archive extraction rejects traversal, links and special files. A stale or refresh-only build cannot feed qualification. Every group remains required by the quality gate. + +Each group completes solo and three-AI games for its mode. Phone 6 and tablet 10 also cover largest text; tablet 10 covers corrupt-document/database recovery. Group tests prove the ten scenarios are assigned exactly once. This avoids repeating compilation and prevents the measured serial workload from exceeding a one-hour job. + +Each job creates and later deletes only its own simulators. First boot has a bounded ten-minute allowance, and captured command output is retained even after timeout. It runs all four modes with solo and three AI opponents, plus a largest-Dynamic-Type start/resume case on both device families. Normal cases cover light/dark and portrait/landscape, complete scoring, native History/Help navigation, cold relaunch and Play Again. + +Each scenario uses one bounded, pinned local stdio MCP driver session for setup, hold/reroll, cold app resume, scoring and results navigation. The viewer is disabled. Authored flow files and geometry-checked interactions share that connection; creating one driver does not replace terminating and relaunching the app. Each start holds a die and rerolls through that session. In expanded play, die gestures stay inside the left scroll pane; compact play uses the shared scroll pane. The die must fit fully inside that pane, and the fixed reroll action must fit inside the play area. Each action is tapped once, without retry. Holding must change only the held index and revision in the real SQLite document. Rerolling must preserve the held face and every other saved field except unheld dice, rolls remaining and revision. UI acknowledgments precede both saved-state comparisons. React Native's iOS checkbox exposes `checkbox, checked, Held` in its accessibility value; the pinned Maestro driver's generic `checked` boolean stays false for that element. + +The landscape phone failure that prompted this guard placed the die at y320..400 behind a footer action. Maestro reported full screen visibility, then its tap at130,360 rerolled instead of holding. The new driver uses the actual pane bounds and checks the persisted effect before any next action. A contract regression and captured-geometry tests cover this failure. They do not substitute for the required native run. + +The native accessibility hierarchy exposes the play View's test ID as a leaf beside its children. Ownership checks therefore accept real ancestry or this leaf-marker shape in the same immediate container, always with full geometric containment. They do not accept a marker from another container. The die must still descend from its actual scroll view. A retained native hierarchy excerpt tests this distinction; the earlier ancestry-only guard stopped all four groups before any hold tap. + +The runner then terminates the process, resumes through the UI and compares the entire document byte-for-byte. Name entry submits the keyboard's Return key. It does not use Maestro's coordinate-swiping keyboard dismissal. Completion first waits for resumed gameplay and the actual score viewport. Its scoring phase retains the scenario's existing driver connection. `inspect_screen` supplies native row and scroll-view rectangles. A row must fit inside its own viewport, clear its top and bottom edges, and be enabled before a semantic tap. Short one-second swipes use coordinates calculated from the current viewport, never fixed device coordinates. Missing rows use the visible category order to choose a direction. Each category has at most 30 inspections; the entire scenario session retains the ten-minute deadline and bounded shutdown. Each inline flow must target the owned application and fit the existing message bound. Executed YAML, inspection snapshots and geometry decisions are retained under the `scenario` prefix. + +This replaces `centerElement`, which accepted One Pair after a swipe moved it behind the toolbar and the tap opened Help. The pinned driver uses a one-sided screen threshold, not scroll-view containment. Its `above` and `below` selectors also compare top positions, not full rectangles. Slowing that gesture alone would leave the unsafe reachability assumption intact. + +Dice, scoring and results phases explicitly foreground the existing app with `launchApp`, `stopApp: false` and `clearState: false`. They do not restart gameplay or reset saved data. All permissions remain denied. Foregrounding alone is not proof that a tap worked. Source `9373563` passed both phone groups in two runs, but its regenerated tablet-eight evidence showed a single tap on a fully reachable die with no UI or saved-state acknowledgment; tablet-ten also missed a setup choice-sheet transition. The previous runner repeatedly changed CLI/MCP drivers between phases. A persistent scenario connection removes those boundaries as a reversible diagnostic experiment, not a proven root-cause repair. It cannot establish acceptance until its own complete native matrix and effects pass; the tablet-ten failure happened within a CLI phase, so persistence might not resolve every missed transition. Diagnostic cancellation scrolls to its action and requires the cancel control and preview to disappear while the Help preview action remains visible. + +Scoring never retries a tap. It requires the recorded-score label and disabled state before the next category, or Game Over after the last one. The generated command, native rectangles, chosen gesture, acknowledgment and ready-to-tap screenshot are retained. Only local device listing, inspection and command execution are allowed through this client. Child environment variables are allowlisted, protocol replies are size/time bounded, and raw replies containing injected environment fields are not logged. Transport and captured-geometry tests do not establish native-runtime acceptance. Completion must produce one history record. Further cases deliberately damage the saved JSON and then the database file, verify preservation after failed loading, cancel reset, and complete an explicit reset through the native alert. + +Maestro taps use accessibility text and test IDs. Die and score gestures derive from the current native viewport geometry, not screenshot-coordinate guesses. Screenshots cover setup, held/rerolled play, resume, results, history, help, diagnostic preview, Play Again and recovery. A simulator recording covers the first scenario, including its completion phase. The status bar is standardized to 9:41 for captures. Test names are synthetic. + +This is not airplane-mode, hardware durability, VoiceOver, Switch Control, iPad Stage Manager window-resize or signed-distribution acceptance. Browser-adapter results do not substitute for the native run. Review actual screenshots in one batch, apply one layout correction batch, then confirm. Functional failures still require diagnosis. + +## Receipts and retention + +`reports/native-evidence/manifest.json` records the exact checked-out source commit, toolchain, runner, device/runtime, scenarios, timestamps and SHA-256 hashes of retained artifacts. Pull requests check out their exact head for native captures. The runner freezes working files from `reports/native` into `reports/native-evidence` before hashing and upload. Size and hash come from the same copied bytes. Later writes from detached XCTest processes cannot change that snapshot. An always-run workflow step also freezes partial receipts when execution ends early. The required quality gate includes every native job. A screenshot file's existence alone is not visual review or release approval. + +The build artifact includes the unsigned simulator app, native dependency lock, compiled Info.plist and privacy inspection. Each test-group artifact includes screenshots, a recording, test reports, synthetic database snapshots and the verified build reference. Raw hidden debug trees are excluded by the uploader and the published hash inventory. Known Maestro driver logs are copied into ordinary artifact files after credential-value/header redaction, including on failure. The interaction client also retains bounded, redacted stderr and the latest native hierarchy; it captures the screen on failure without repeating a hold, reroll or scoring action. DerivedData and installed Pods are not uploaded. Retention is one day to keep storage bounded. Download current-head evidence before it expires, inspect it, and attach the selected images and recording to the PR's Validation section. + +These engineering PNGs can contain alpha channels even when every pixel is opaque. They are not ready for App Store upload merely because a native test passed. See [screenshot validation](ios-screenshot-validation.md) for the separate format checks and remaining capture requirements. + +References: [GitHub macOS 26 runner inventory](https://github.com/actions/runner-images/blob/main/images/macos/macos-26-Readme.md), [Maestro local CLI](https://docs.maestro.dev/maestro-cli/maestro-cli-commands-and-options.md), [Expo SQLite](https://docs.expo.dev/versions/v57.0.0/sdk/sqlite/). diff --git a/packages/game-engine/src/game.ts b/packages/game-engine/src/game.ts index 6e759f8..9519139 100644 --- a/packages/game-engine/src/game.ts +++ b/packages/game-engine/src/game.ts @@ -116,7 +116,7 @@ const MAX_SCORE_TABLE: Record = { "maxi-yahtzee": 100, }; -function getMaxCategoryScore(catId: CategoryId, diceCount: number): number { +export function getMaxCategoryScore(catId: CategoryId, diceCount: number): number { const entry = MAX_SCORE_TABLE[catId]; return typeof entry === "function" ? entry(diceCount) : entry; } diff --git a/packages/game-engine/src/index.ts b/packages/game-engine/src/index.ts index 43a89e4..f7bbe33 100644 --- a/packages/game-engine/src/index.ts +++ b/packages/game-engine/src/index.ts @@ -1,4 +1,6 @@ export { createOfflineBackend } from "./offline"; +export { getScorecardCategories } from "./presentation"; +export { newSessionGame, applySessionMove, fromWire, toWire, type WireGame, type Move } from "./session"; export { rollDie, rollDice, reroll } from "./dice"; export { upperScore, @@ -31,6 +33,7 @@ export { createGame, calculateTotal, calculateMaxPossibleScore, + getMaxCategoryScore, getUpperBonus, isGameComplete, getAvailableCategories, diff --git a/packages/game-engine/src/presentation.ts b/packages/game-engine/src/presentation.ts new file mode 100644 index 0000000..4726a34 --- /dev/null +++ b/packages/game-engine/src/presentation.ts @@ -0,0 +1,17 @@ +import { getCategories, type CategoryId } from "./scoring"; + +// Presentation only. Keep the scoring registry's AI tie-breaking order unchanged. +const DISPLAY_AFTER: Partial> = { + "two-pairs": "three-pairs", + "four-of-a-kind": "five-of-a-kind", + "full-house": "castle", + "large-straight": "full-straight", +}; +export function getScorecardCategories(diceCount: number) { + const categories = getCategories(diceCount); + const moved = new Set(Object.values(DISPLAY_AFTER)); + return categories.filter((category) => !moved.has(category.id)).flatMap((category) => { + const extra = categories.find((candidate) => candidate.id === DISPLAY_AFTER[category.id]); + return extra ? [category, extra] : [category]; + }); +} diff --git a/packages/game-engine/tests/nativeDiagnostics.test.ts b/packages/game-engine/tests/nativeDiagnostics.test.ts new file mode 100644 index 0000000..f5141dc --- /dev/null +++ b/packages/game-engine/tests/nativeDiagnostics.test.ts @@ -0,0 +1,13 @@ +import { expect, test } from "bun:test"; +import { diagnosticText } from "../../../apps/mobile/src/local/diagnostics"; + +test("diagnostics serialize only the explicit nonpersonal allowlist", () => { + const input = { version: "1.0.0", build: "1", platform: "ios", osVersion: "26.5", windowClass: "compact" as const, + name: "PRIVATE NAME", scores: "PRIVATE SCORES", gameId: "PRIVATE ID", logs: "PRIVATE LOGS", credentials: "PRIVATE CREDENTIALS" }; + const text = diagnosticText(input); + expect(text).toContain("Dice game 1.0.0, build 1"); + expect(text).toContain("Platform: ios 26.5"); + expect(text).toContain("Window: compact"); + expect(text).not.toContain("PRIVATE"); + expect(text).toContain("No names, scores, game IDs or saved data are included."); +}); diff --git a/packages/game-engine/tests/nativePersistence.test.ts b/packages/game-engine/tests/nativePersistence.test.ts new file mode 100644 index 0000000..1fa3585 --- /dev/null +++ b/packages/game-engine/tests/nativePersistence.test.ts @@ -0,0 +1,245 @@ +import { describe, expect, test } from "bun:test"; +import { createLocalStore, type StoragePort } from "../../../apps/mobile/src/local/store"; +import { decodeSave, emptySave, migratePreferences, SAVE_KEY } from "../../../apps/mobile/src/local/save"; +import { getCategories } from "../src/scoring"; + +function fixture(initial: Record = {}) { + const values = new Map(Object.entries(initial)); + const state = { fail: null as "before" | "after" | null, readFailure: false, removeFailure: false, pause: Promise.resolve(), attempts: [] as string[] }; + const port: StoragePort = { + async getItem(key) { if (state.readFailure) throw new Error("Storage cannot be read"); return values.get(key) ?? null; }, + async setItem(key, value) { + state.attempts.push(value); await state.pause; + if (state.fail === "before") throw new Error("Storage full"); + values.set(key, value); + if (state.fail === "after") throw new Error("Write acknowledgment lost"); + }, + async removeItem(key) { if (state.removeFailure) throw new Error("Removal failed"); values.delete(key); }, + }; + let id = 0; + return { values, state, port, store: createLocalStore(port, () => `local-${++id}`), recreate: () => createLocalStore(port, () => `local-${++id}`) }; +} +const options = { name: "Guest", diceCount: 5, aiOpponents: 0 }; +const clone = (value: T): T => JSON.parse(JSON.stringify(value)) as T; + +describe("durable native storage boundary, without a native-runtime claim", () => { + test("migrates only legacy local preferences and preserves their original keys", async () => { + const f = fixture({ "yahtzee-recent-names": '["Ada","Lin"]', "yahtzee-theme": "dark" }); + let notices = 0; + const unsubscribe = f.store.subscribe(() => { notices++; }); + expect(await f.store.load()).toBe(true); + expect(f.store.getSnapshot().data?.preferences.name).toBe("Ada"); + expect(f.store.getSnapshot().data?.preferences.appearance).toBe("dark"); + expect(f.values.get("yahtzee-recent-names")).toBe('["Ada","Lin"]'); + expect(f.store.getSnapshot().data?.history.entries).toEqual([]); + expect(notices).toBeGreaterThan(0); unsubscribe(); + expect(await f.store.preferences({ appearance: "system", diceCount: 10 })).toBe(true); + const restarted = f.recreate(); await restarted.load(); + expect(restarted.getSnapshot().data?.preferences.diceCount).toBe(10); + expect(await restarted.preferences({ appearance: "purple" } as never)).toBe(false); + }); + + test("acknowledged dice, holds, rolls and revision survive process recreation", async () => { + const f = fixture(); await f.store.load(); await f.store.start(options); + expect(await f.store.move({ kind: "hold", index: 0 })).toBe(true); + const held = f.store.getSnapshot().data!.active!.game.dice[0]; + expect(await f.store.move({ kind: "roll" })).toBe(true); + const saved = clone(f.store.getSnapshot().data!); + expect(saved.active!.game.dice[0]).toBe(held); + expect(saved.active!.game.held).toEqual([0]); + expect(saved.active!.revision).toBe(2); + const resumed = f.recreate(); expect(await resumed.load()).toBe(true); + expect(resumed.getSnapshot().data).toEqual(saved); + expect(await resumed.start(options)).toBe(false); + expect(await resumed.discard()).toBe(true); + expect(await resumed.start({ ...options, name: "Next" })).toBe(true); + }); + + test("failed writes block other moves and retry the exact staged bytes", async () => { + const f = fixture(); await f.store.load(); await f.store.start({ ...options, aiOpponents: 3 }); + const before = clone(f.store.getSnapshot().data!); + f.state.fail = "before"; + expect(await f.store.move({ kind: "score", category: "chance" })).toBe(false); + const staged = f.state.attempts.at(-1)!; + expect(f.store.getSnapshot().data).toEqual(before); + expect(await f.store.move({ kind: "roll" })).toBe(false); + expect(f.store.getSnapshot().canRetry).toBe(true); + f.state.fail = null; + expect(await f.store.retry()).toBe(true); + expect(f.state.attempts.at(-1)).toBe(staged); + expect(f.store.getSnapshot().data).toEqual(JSON.parse(staged)); + expect(await f.store.retry()).toBe(false); + }); + + test("slow saves reject overlapping actions rather than racing acknowledged state", async () => { + const f = fixture(); await f.store.load(); + let release!: () => void; + f.state.pause = new Promise((resolve) => { release = resolve; }); + const starting = f.store.start(options); + expect(f.store.getSnapshot().busy).toBe(true); + expect(await f.store.start(options)).toBe(false); + expect(f.store.getSnapshot().data?.active).toBeNull(); + release(); expect(await starting).toBe(true); + expect(f.store.getSnapshot().data?.active?.revision).toBe(0); + }); + + for (const diceCount of [5, 6, 8, 10]) for (const aiOpponents of [0, 3]) { + test(`${diceCount} dice / ${aiOpponents} AI completes once after a write-then-error and restart`, async () => { + const f = fixture(); await f.store.load(); + expect(await f.store.start({ ...options, diceCount, aiOpponents })).toBe(true); + const categories = getCategories(diceCount); + for (const category of categories.slice(0, -1)) expect(await f.store.move({ kind: "score", category: category.id })).toBe(true); + f.state.fail = "after"; + expect(await f.store.move({ kind: "score", category: categories.at(-1)!.id })).toBe(false); + expect(f.store.getSnapshot().error).toBe("Write acknowledgment lost"); + expect(f.store.getSnapshot().canRetry).toBe(true); + const exactBytes = f.values.get(SAVE_KEY)!; + f.state.fail = null; + const restarted = f.recreate(); expect(await restarted.load()).toBe(true); + const saved = restarted.getSnapshot().data!; + expect(saved.active?.game.status).toBe("finished"); + expect(saved.history.entries).toHaveLength(1); + expect(saved.highScores.entries).toHaveLength(aiOpponents + 1); + expect(await restarted.move({ kind: "roll" })).toBe(false); + expect(f.values.get(SAVE_KEY)).toBe(exactBytes); + expect(await f.store.retry()).toBe(true); + expect(f.values.get(SAVE_KEY)).toBe(exactBytes); + expect(await restarted.discard()).toBe(true); + expect(restarted.getSnapshot().data?.history.entries).toHaveLength(1); + }); + } + + test("unavailable and corrupt storage never become an implicit empty save", async () => { + const damaged = '{"schemaVersion":999}'; + const f = fixture({ [SAVE_KEY]: damaged }); + expect(await f.store.load()).toBe(false); + expect(await f.store.start(options)).toBe(false); + expect(f.values.get(SAVE_KEY)).toBe(damaged); + expect(f.state.attempts).toHaveLength(0); + expect(await f.store.resetAll()).toBe(true); + expect(f.store.getSnapshot().data).toEqual(emptySave()); + f.state.readFailure = true; + expect(await f.store.load()).toBe(false); + expect(f.store.getSnapshot().data).toBeNull(); + expect(await f.store.start(options)).toBe(false); + f.state.readFailure = false; + expect(await f.store.load()).toBe(true); + }); + + test("appearance enums reject coerced values and preserve the damaged document", async () => { + for (const appearance of [["system"], [["dark"]], ["light"], null, {}, true, 0]) { + const raw = JSON.stringify({ ...emptySave(), preferences: { ...emptySave().preferences, appearance } }); + expect(() => decodeSave(raw)).toThrow("Local save is damaged"); + const f = fixture({ [SAVE_KEY]: raw }); + expect(await f.store.load()).toBe(false); + expect(f.store.getSnapshot().data).toBeNull(); + expect(f.values.get(SAVE_KEY)).toBe(raw); + expect(f.state.attempts).toHaveLength(0); + } + }); + + test("game-status enums reject coerced values before exposing an unusable active game", async () => { + const valid = fixture(); await valid.store.load(); await valid.store.start(options); + const saved = valid.store.getSnapshot().data!; + for (const status of [["playing"], [["playing"]], ["finished"], null, {}, true, 0]) { + const raw = JSON.stringify({ ...saved, active: { ...saved.active!, game: { ...saved.active!.game, status } } }); + expect(() => decodeSave(raw)).toThrow("Local save is damaged"); + const f = fixture({ [SAVE_KEY]: raw }); + expect(await f.store.load()).toBe(false); + expect(f.store.getSnapshot().data).toBeNull(); + expect(await f.store.move({ kind: "roll" })).toBe(false); + expect(f.values.get(SAVE_KEY)).toBe(raw); + expect(f.state.attempts).toHaveLength(0); + } + }); + + test("a failed first save or explicit reset can be retried without losing unapproved data", async () => { + const f = fixture({ "yahtzee-theme": "dark" }); + f.state.fail = "before"; + expect(await f.store.load()).toBe(false); + expect(f.store.getSnapshot().canRetry).toBe(true); + expect(f.values.get("yahtzee-theme")).toBe("dark"); + f.state.fail = null; expect(await f.store.retry()).toBe(true); + await f.store.start(options); + f.state.removeFailure = true; + expect(await f.store.resetAll()).toBe(false); + expect(f.store.getSnapshot().data?.active).not.toBeNull(); + f.state.removeFailure = false; + expect(await f.store.retry()).toBe(true); + expect(f.values.has("yahtzee-theme")).toBe(false); + expect(f.store.getSnapshot().data).toEqual(emptySave()); + }); + + test("UI draft generations change on reload and only acknowledged resets", async () => { + const f = fixture(); + expect(f.store.getSnapshot().generation).toBe(0); + await f.store.load(); + expect(f.store.getSnapshot().generation).toBe(1); + await f.store.preferences({ appearance: "dark" }); + expect(f.store.getSnapshot().generation).toBe(1); + f.state.fail = "after"; + expect(await f.store.resetAll()).toBe(false); + expect(f.store.getSnapshot().generation).toBe(1); + f.state.fail = null; + expect(await f.store.retry()).toBe(true); + expect(f.store.getSnapshot().generation).toBe(2); + expect(JSON.parse(f.values.get(SAVE_KEY)!)).not.toHaveProperty("generation"); + await f.store.load(); + expect(f.store.getSnapshot().generation).toBe(3); + }); + + test("explicit reload abandons only the unacknowledged move and honors the actual saved document", async () => { + const f = fixture(); await f.store.load(); await f.store.start(options); + const before = f.values.get(SAVE_KEY); + f.state.fail = "before"; await f.store.move({ kind: "roll" }); + f.state.fail = null; + expect(await f.store.load()).toBe(true); + expect(f.store.getSnapshot().canRetry).toBe(false); + expect(JSON.stringify(f.store.getSnapshot().data)).toBe(before); + for (const patch of [{ name: " " }, { name: "x".repeat(33) }, { diceCount: 2 }, { aiOpponents: 4 }]) { + await f.store.discard(); expect(await f.store.start({ ...options, ...patch })).toBe(false); + } + expect(await f.store.move({ kind: "roll" })).toBe(false); + }); + + test("keeps history at 500 and per-mode scores at ten without reusing a completed ID", async () => { + const f = fixture(); await f.store.load(); await f.store.start(options); + for (const category of getCategories(5)) await f.store.move({ kind: "score", category: category.id }); + const saved = clone(f.store.getSnapshot().data!); + expect(() => decodeSave(JSON.stringify({ ...saved, history: { entries: [] } }))).toThrow("disagree"); + saved.active = null; + const entry = saved.history.entries[0], score = saved.highScores.entries[0]; + saved.history.entries = Array.from({ length: 500 }, (_, i) => ({ ...entry, id: `history-${i}` })); + saved.highScores.entries = Array.from({ length: 10 }, (_, i) => ({ ...score, gameId: `score-${i}`, rankCurrent: i + 1 })); + f.values.set(SAVE_KEY, JSON.stringify(saved)); + const duplicate = createLocalStore(f.port, () => "history-0"); await duplicate.load(); + expect(await duplicate.start(options)).toBe(false); + expect(duplicate.getSnapshot().error).toContain("unique game"); + const next = f.recreate(); expect(await next.load()).toBe(true); + expect(await next.start(options)).toBe(true); + for (const category of getCategories(5)) expect(await next.move({ kind: "score", category: category.id })).toBe(true); + expect(next.getSnapshot().data?.history.entries).toHaveLength(500); + expect(next.getSnapshot().data?.history.entries[0].id).toBe("history-1"); + expect(next.getSnapshot().data?.highScores.entries).toHaveLength(10); + expect(() => decodeSave(JSON.stringify({ ...saved, history: { entries: [...saved.history.entries, entry] } }))).toThrow(); + expect(() => decodeSave(JSON.stringify({ ...saved, highScores: { entries: [...saved.highScores.entries, { ...score, gameId: "eleventh" }] } }))).toThrow(); + }); + + test("restore rejects malformed, unsupported and out-of-bounds state without mutating it", async () => { + const f = fixture(); await f.store.load(); await f.store.start(options); + const save = f.store.getSnapshot().data!; + const variants = [ + { ...save, rulesVersion: 1 }, { ...save, schemaVersion: 2 }, + { ...save, preferences: { ...save.preferences, recentNames: ["Ada", "Ada"] } }, + { ...save, active: { ...save.active, revision: -1 } }, + { ...save, active: { ...save.active, game: { ...save.active!.game, held: [0, 0] } } }, + { ...save, active: { ...save.active, game: { ...save.active!.game, dice: [9] } } }, + { ...save, active: { ...save.active, game: { ...save.active!.game, currentRound: 99 } } }, + { ...save, history: { entries: [null] } }, { ...save, highScores: { entries: [null] } }, + ]; + for (const value of [null, [], ...variants]) expect(() => decodeSave(JSON.stringify(value))).toThrow(); + expect(() => decodeSave(" ".repeat(4_000_001))).toThrow("too large"); + expect(() => migratePreferences('["bad\\nname"]', null)).toThrow(); + expect(() => migratePreferences('not JSON', null)).toThrow(); + }); +}); diff --git a/packages/game-engine/tests/nativeSqlite.test.ts b/packages/game-engine/tests/nativeSqlite.test.ts new file mode 100644 index 0000000..e53385d --- /dev/null +++ b/packages/game-engine/tests/nativeSqlite.test.ts @@ -0,0 +1,253 @@ +import { afterEach, describe, expect, test } from "bun:test"; +import { Database } from "bun:sqlite"; +import { mkdtempSync, readdirSync, readFileSync, rmSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { createSqliteStorage, DATABASE_NAME, removeDatabaseFiles, type SqlConnection } from "../../../apps/mobile/src/local/sqliteStorage"; +import { createLocalStore, type StoragePort } from "../../../apps/mobile/src/local/store"; +import { emptySave, SAVE_KEY } from "../../../apps/mobile/src/local/save"; +import { getCategories } from "../src/scoring"; + +const cleanups: (() => void)[] = []; +afterEach(() => { for (const cleanup of cleanups.splice(0)) cleanup(); }); +function fixture() { + const directory = mkdtempSync(join(tmpdir(), "local-dice-sqlite-")); + const path = join(directory, DATABASE_NAME); + const connections: Database[] = []; + const values = new Map([["yahtzee-theme", "dark"], ["unrelated", "keep"]]); + const state = { openFailure: false, writeFailure: false, lostAck: false, closeFailure: false, removeFailure: false, removeAckLost: false, legacyRemoveFailure: false, deletes: 0, writes: [] as string[], integrity: undefined as string | null | undefined }; + const legacy: StoragePort = { + async getItem(key) { return values.get(key) ?? null; }, + async setItem(key, value) { values.set(key, value); }, + async removeItem(key) { if (state.legacyRemoveFailure) throw new Error("Legacy storage unavailable"); values.delete(key); }, + }; + const factory = { + async open(): Promise { + if (state.openFailure) throw new Error("Database unavailable"); + const db = new Database(path); connections.push(db); + return { + async execAsync(sql) { db.exec(sql); }, + async getFirstAsync(sql: string, ...parameters: string[]): Promise { + if (sql === "PRAGMA quick_check" && state.integrity !== undefined) return (state.integrity === null ? null : { quick_check: state.integrity }) as T | null; + return db.query(sql).get(...parameters) as T | null; + }, + async runAsync(sql, ...parameters) { + state.writes.push(parameters[1]); + if (state.writeFailure) throw new Error("Storage full"); + const result = db.run(sql, ...parameters); + if (state.lostAck) throw new Error("Write acknowledgment lost"); + return result; + }, + async closeAsync() { if (state.closeFailure) throw new Error("Cannot close database"); db.close(); }, + }; + }, + async remove() { + state.deletes++; + if (state.removeFailure) throw new Error("Cannot remove database"); + await removeDatabaseFiles(async (name) => { rmSync(join(directory, name)); }, () => readdirSync(directory)); + if (state.removeAckLost) throw new Error("Reset acknowledgment lost"); + }, + }; + cleanups.push(() => { for (const db of connections) db.close(); rmSync(directory, { recursive: true, force: true }); }); + const port = createSqliteStorage(factory, legacy); + return { path, values, state, port, store: createLocalStore(port, () => "sqlite-game"), recreate: () => createSqliteStorage(factory, legacy), db: () => connections.at(-1)! }; +} +const options = { name: "Sam'; DROP TABLE local_save;--", diceCount: 6, aiOpponents: 3 }; + +describe("real SQLite persistence, without an Expo/iOS-runtime claim", () => { + test("commits a complete document, resumes held dice, and recovers one uncertain completion", async () => { + const f = fixture(); expect(await f.store.load()).toBe(true); + expect(f.store.getSnapshot().data?.preferences.appearance).toBe("dark"); + expect(f.db().query("PRAGMA journal_mode").get()).toEqual({ journal_mode: "wal" }); + expect(f.db().query("PRAGMA synchronous").get()).toEqual({ synchronous: 2 }); + expect(await f.store.start(options)).toBe(true); + expect(await f.store.move({ kind: "hold", index: 0 })).toBe(true); + expect(await f.store.move({ kind: "roll" })).toBe(true); + const saved = JSON.stringify(f.store.getSnapshot().data); + await f.port.close(); + const port = f.recreate(); const resumed = createLocalStore(port); + expect(await resumed.load()).toBe(true); + expect(JSON.stringify(resumed.getSnapshot().data)).toBe(saved); + const categories = getCategories(6); + for (const category of categories.slice(0, -1)) expect(await resumed.move({ kind: "score", category: category.id })).toBe(true); + f.state.lostAck = true; + expect(await resumed.move({ kind: "score", category: categories.at(-1)!.id })).toBe(false); + expect(resumed.getSnapshot().error).toBe("Write acknowledgment lost"); + const completedBytes = f.state.writes.at(-1); + f.state.lostAck = false; + expect(await resumed.retry()).toBe(true); + expect(f.state.writes.at(-1)).toBe(completedBytes); + await port.close(); + const restarted = createLocalStore(f.recreate()); + expect(await restarted.load()).toBe(true); + expect(restarted.getSnapshot().data?.history.entries).toHaveLength(1); + expect(restarted.getSnapshot().data?.active?.game.status).toBe("finished"); + }); + + test("does not overwrite a damaged database; only confirmed reset replaces it", async () => { + const f = fixture(); const damaged = Buffer.from("Not a SQLite database. Preserve these bytes."); + writeFileSync(f.path, damaged); + expect(await f.store.load()).toBe(false); + expect(f.store.getSnapshot().data).toBeNull(); + expect(f.state.deletes).toBe(0); + expect(readFileSync(f.path)).toEqual(damaged); + expect(await f.store.load()).toBe(false); + expect(readFileSync(f.path)).toEqual(damaged); + expect(await f.store.resetAll()).toBe(true); + expect(f.store.getSnapshot().data).toEqual(emptySave()); + expect(f.values.has("yahtzee-theme")).toBe(false); + expect(f.values.get("unrelated")).toBe("keep"); + }); + + test("retains malformed document bytes in a valid database", async () => { + const f = fixture(); await f.port.setItem(SAVE_KEY, "{"); + expect(await f.store.load()).toBe(false); + expect(await f.port.getItem(SAVE_KEY)).toBe("{"); + expect(f.state.deletes).toBe(0); + await f.port.setItem(SAVE_KEY, JSON.stringify({ ...emptySave(), schemaVersion: 999 })); + expect(await f.store.load()).toBe(false); + expect(await f.port.getItem(SAVE_KEY)).toContain("999"); + }); + + test("retries unavailable reads and failed writes without replacing acknowledged data", async () => { + const f = fixture(); f.state.openFailure = true; + expect(await f.store.load()).toBe(false); + f.state.openFailure = false; + expect(await f.store.load()).toBe(true); + const before = f.store.getSnapshot().data; + f.state.writeFailure = true; + expect(await f.store.start(options)).toBe(false); + expect(f.store.getSnapshot().data).toEqual(before); + const staged = f.state.writes.at(-1); + f.state.writeFailure = false; + expect(await f.store.retry()).toBe(true); + expect(f.state.writes.at(-1)).toBe(staged); + }); + + test("reset fails visibly on close/removal errors and remains retryable", async () => { + const f = fixture(); await f.store.load(); await f.store.start(options); + const generation = f.store.getSnapshot().generation; + f.state.closeFailure = true; + expect(await f.store.resetAll()).toBe(false); + expect(f.state.deletes).toBe(0); + f.state.closeFailure = false; f.state.removeFailure = true; + expect(await f.store.retry()).toBe(false); + expect(f.store.getSnapshot().generation).toBe(generation); + f.state.removeFailure = false; + expect(await f.store.retry()).toBe(true); + expect(f.store.getSnapshot().data).toEqual(emptySave()); + expect(f.store.getSnapshot().generation).toBe(generation + 1); + }); + + test("legacy cleanup failure happens before the only durable save is deleted", async () => { + const f = fixture(); await f.store.load(); await f.store.start(options); + const before = JSON.stringify(f.store.getSnapshot().data); + f.state.legacyRemoveFailure = true; + expect(await f.store.resetAll()).toBe(false); + expect(f.state.deletes).toBe(0); + expect(await f.port.getItem(SAVE_KEY)).toBe(before); + expect(JSON.stringify(f.store.getSnapshot().data)).toBe(before); + f.state.legacyRemoveFailure = false; + expect(await f.store.retry()).toBe(true); + expect(f.store.getSnapshot().data).toEqual(emptySave()); + }); + + test("acknowledged database deletion commits empty state without a fallible replacement write", async () => { + const f = fixture(); await f.store.load(); await f.store.start(options); + const writes = f.state.writes.length; + f.state.writeFailure = true; + expect(await f.store.resetAll()).toBe(true); + expect(f.state.writes).toHaveLength(writes); + expect(f.store.getSnapshot().data).toEqual(emptySave()); + f.state.writeFailure = false; + const restarted = createLocalStore(f.recreate()); + expect(await restarted.load()).toBe(true); + expect(restarted.getSnapshot().data).toEqual(emptySave()); + }); + + test("uncertain database deletion hides stale data until explicit retry or reload", async () => { + const f = fixture(); await f.store.load(); await f.store.start(options); + const generation = f.store.getSnapshot().generation; + f.state.removeAckLost = true; + expect(await f.store.resetAll()).toBe(false); + expect(f.store.getSnapshot().data).toBeNull(); + expect(f.store.getSnapshot().error).toContain("may already have been deleted"); + expect(f.store.getSnapshot().canRetry).toBe(true); + expect(f.store.getSnapshot().retryReset).toBe(true); + expect(f.store.getSnapshot().generation).toBe(generation); + f.state.removeAckLost = false; + expect(await f.store.retry()).toBe(true); + expect(f.store.getSnapshot().data).toEqual(emptySave()); + expect(f.store.getSnapshot().generation).toBe(generation + 1); + expect(f.store.getSnapshot().retryReset).toBe(false); + }); + + test("rejects unknown database versions and unrecognized schemas without resetting them", async () => { + for (const sql of ["PRAGMA user_version = 9", "CREATE TABLE unknown (value TEXT)", "PRAGMA user_version = 1"]) { + const f = fixture(); const db = new Database(f.path); db.exec(sql); db.close(); + const bytes = readFileSync(f.path); + expect(await f.store.load()).toBe(false); + expect(f.state.deletes).toBe(0); + await f.port.close(); + expect(readFileSync(f.path)).toEqual(bytes); + } + }); + + test("rejects failed integrity checks and non-text documents", async () => { + for (const integrity of ["damaged page", null]) { + const f = fixture(); f.state.integrity = integrity; + expect(await f.store.load()).toBe(false); + expect(f.store.getSnapshot().error).toContain("database is damaged"); + expect(f.state.deletes).toBe(0); + } + const f = fixture(); await f.store.load(); + f.db().exec("UPDATE local_save SET value = X'4142'"); + expect(await f.store.load()).toBe(false); + expect(f.store.getSnapshot().error).toContain("not text"); + }); + + test("routes legacy preferences separately and supports explicit key removal", async () => { + const f = fixture(); await f.port.setItem("legacy", "value"); + expect(await f.port.getItem("legacy")).toBe("value"); + await f.port.removeItem("legacy"); expect(await f.port.getItem("legacy")).toBeNull(); + await f.port.setItem(SAVE_KEY, "{}"); await f.port.removeItem(SAVE_KEY); + expect(await f.port.getItem(SAVE_KEY)).toBeNull(); + }); + + test("reset handles the iOS SDK's shared deletion error code without suppressing real failures", async () => { + const present = new Set([DATABASE_NAME]); + await removeDatabaseFiles(async (name) => { + if (!present.delete(name)) throw Object.assign(new Error(`Database ${name} not found`), { code: "E_SQLITE_DELETE_DATABASE" }); + }, () => [...present]); + expect(present.size).toBe(0); + }); + + test("reset removes only the owned database family and verifies uncertain deletion", async () => { + const names: string[] = []; + const owned = [DATABASE_NAME, DATABASE_NAME + "-wal", DATABASE_NAME + "-shm", DATABASE_NAME + "-journal"]; + const present = new Set([...owned, "unrelated.db"]); + await removeDatabaseFiles(async (name) => { + names.push(name); present.delete(name); + throw Object.assign(new Error("Deletion acknowledgment lost"), { code: "E_SQLITE_DELETE_DATABASE" }); + }, () => [...present]); + expect(names).toEqual(owned); + expect([...present]).toEqual(["unrelated.db"]); + await removeDatabaseFiles(async () => { throw new Error("Must not delete absent files"); }, () => [...present]); + for (const error of [Object.assign(new Error("Permission denied"), { code: "E_SQLITE_DELETE_DATABASE" }), new Error("Database is open"), "unknown failure"]) { + await expect(removeDatabaseFiles(async () => { throw error; }, () => [DATABASE_NAME])).rejects.toEqual(error); + } + }); + + test("reset fails closed when directory inspection fails or deletion leaves files behind", async () => { + let attempts = 0; + const unavailable = new Error("Directory unavailable"); + await expect(removeDatabaseFiles(async () => { attempts++; }, () => { throw unavailable; })).rejects.toEqual(unavailable); + expect(attempts).toBe(0); + let listings = 0; + await expect(removeDatabaseFiles(async () => { throw new Error("Delete failed"); }, () => { + if (listings++ === 0) return [DATABASE_NAME]; + throw unavailable; + })).rejects.toEqual(unavailable); + await expect(removeDatabaseFiles(async () => {}, () => [DATABASE_NAME])).rejects.toThrow("deletion was not confirmed"); + }); +}); diff --git a/packages/ui/src/Scorecard.tsx b/packages/ui/src/Scorecard.tsx index add27ed..7d542b1 100644 --- a/packages/ui/src/Scorecard.tsx +++ b/packages/ui/src/Scorecard.tsx @@ -1,27 +1,10 @@ import React from "react"; import { Icon } from "./Icons"; import { - getCategories, getUpperBonusThreshold, getUpperBonusValue, calculateTotal, calculateMaxPossibleScore, + getScorecardCategories, getUpperBonusThreshold, getUpperBonusValue, calculateTotal, calculateMaxPossibleScore, type CategoryId, type PlayerState, } from "@yahtzee/game-engine"; -// Presentation order only: engine order also decides AI tie-breaking. -const DISPLAY_AFTER: Partial> = { - "two-pairs": "three-pairs", - "four-of-a-kind": "five-of-a-kind", - "full-house": "castle", - "large-straight": "full-straight", -}; - -function getScorecardCategories(diceCount: number) { - const categories = getCategories(diceCount); - const moved = new Set(Object.values(DISPLAY_AFTER)); - return categories.filter((category) => !moved.has(category.id)).flatMap((category) => { - const extra = categories.find((candidate) => candidate.id === DISPLAY_AFTER[category.id]); - return extra ? [category, extra] : [category]; - }); -} - interface ScorecardProps { players: PlayerState[]; currentPlayerIndex: number; diff --git a/playwright.config.ts b/playwright.config.ts index 8c30245..1c7c04c 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -5,7 +5,11 @@ export default defineConfig({ timeout: 45_000, retries: 0, outputDir: "reports/clients/artifacts", reporter: [["list"], ["json", { outputFile: "reports/clients/results.json" }]], - projects: [{ name: "web" }, { name: "desktop" }, { name: "mobile-web-adapter" }], + projects: [ + { name: "web", testMatch: ["**/journeys.spec.ts", "**/design.spec.ts"] }, + { name: "desktop", testMatch: "**/journeys.spec.ts" }, + { name: "mobile-web-adapter", testMatch: "**/native.spec.ts" }, + ], use: { baseURL: "http://127.0.0.1:5187" }, webServer: { command: process.env.TEST_COVERAGE === "1" diff --git a/quality-baseline.json b/quality-baseline.json index e0c5707..b7fd3dc 100644 --- a/quality-baseline.json +++ b/quality-baseline.json @@ -1,9 +1,4 @@ { "version": 1, - "legacy": { - "apps/mobile/app/index.tsx::/Index#1": { - "maxCrap": 40.37287209831589, - "reason": "Existing at dc197876. Native-screen component has complexity 40 and 61/65 observed branch arms through the declared web adapter. Keep this limit until screen extraction lowers it." - } - } + "legacy": {} } diff --git a/scripts/ios-assets/check.test.mjs b/scripts/ios-assets/check.test.mjs new file mode 100644 index 0000000..feeb298 --- /dev/null +++ b/scripts/ios-assets/check.test.mjs @@ -0,0 +1,40 @@ +import test from "node:test"; +import assert from "node:assert/strict"; +import { readFileSync } from "node:fs"; +import { createHash } from "node:crypto"; +import { PNG } from "pngjs"; + +const folder = new URL("../../apps/mobile/assets/", import.meta.url); +const manifest = JSON.parse(readFileSync(new URL("provenance.json", folder), "utf8")); +const config = JSON.parse(readFileSync(new URL("../../apps/mobile/app.json", import.meta.url), "utf8")).expo; +const hash = (bytes) => createHash("sha256").update(bytes).digest("hex"); +test("editable source and all four raster exports match their recorded inputs", () => { + assert.equal(manifest.sourceSha256, hash(readFileSync(new URL("icon-source.svg", folder), "utf8").replace(/\r\n/g, "\n"))); + assert.deepEqual(manifest.exports.map((image) => image.file).sort(), ["icon-dark.png", "icon-tinted.png", "icon.png", "launch-mark.png"]); + for (const image of manifest.exports) { + const bytes = readFileSync(new URL(image.file, folder)); + assert.equal(hash(bytes), image.sha256); + const png = PNG.sync.read(bytes, { checkCRC: true }); + assert.equal(png.width, 1024); assert.equal(png.height, 1024); + assert.equal(image.width, png.width); assert.equal(image.height, png.height); + let transparent = false; + for (let index = 0; index < png.data.length; index += 4) { + if (png.data[index + 3] !== 255) transparent = true; + if (image.file === "icon-tinted.png") { + assert.equal(png.data[index], png.data[index + 1]); assert.equal(png.data[index], png.data[index + 2]); + } + } + assert.equal(transparent, image.transparencyAllowed, image.file); + } +}); +test("native configuration resolves the intended icons and launch mark", () => { + assert.equal(config.icon, "./assets/icon.png"); + assert.deepEqual(config.ios.icon, { light: "./assets/icon.png", dark: "./assets/icon-dark.png", tinted: "./assets/icon-tinted.png" }); + const splash = config.plugins.find((plugin) => Array.isArray(plugin) && plugin[0] === "expo-splash-screen")[1]; + assert.equal(splash.image, "./assets/launch-mark.png"); + assert.equal(splash.dark.image, splash.image); + assert.equal(config.ios.supportsTablet, true); + assert.equal(config.ios.requireFullScreen, false); + assert.equal(config.orientation, "default"); + assert.equal(config.userInterfaceStyle, "automatic"); +}); diff --git a/scripts/ios-assets/generate.mjs b/scripts/ios-assets/generate.mjs new file mode 100644 index 0000000..3882db0 --- /dev/null +++ b/scripts/ios-assets/generate.mjs @@ -0,0 +1,34 @@ +import { readFileSync, writeFileSync, mkdtempSync, rmSync } from "node:fs"; +import { fileURLToPath } from "node:url"; +import { join } from "node:path"; +import { tmpdir } from "node:os"; +import { execFileSync } from "node:child_process"; +import { createHash } from "node:crypto"; + +const folder = fileURLToPath(new URL("../../apps/mobile/assets/", import.meta.url)); +const source = readFileSync(join(folder, "icon-source.svg"), "utf8").replace(/\r\n/g, "\n"); +const renderer = execFileSync("magick", ["-version"], { encoding: "utf8" }).split(/\r?\n/)[0]; +const variants = [ + { file: "icon.png", role: "ios-light-and-app-store", colors: {} }, + { file: "icon-dark.png", role: "ios-dark", colors: { "#1e453a": "#10251e", "#f5f4e9": "#cee2af" } }, + { file: "icon-tinted.png", role: "ios-tinted", colors: { "#1e453a": "#0b0b0b", "#f5f4e9": "#e8e8e8", "#244033": "#161616", "#92431f": "#606060" } }, + { file: "launch-mark.png", role: "launch-and-android-foreground", colors: {}, transparent: true }, +]; +const temporary = mkdtempSync(join(tmpdir(), "dice-assets-")); +try { + for (const variant of variants) { + let svg = source.replace(/#[0-9a-f]{6}/g, (color) => variant.colors[color] ?? color); + if (variant.transparent) svg = svg.replace(/ {2} createHash("sha256").update(bytes).digest("hex"); + writeFileSync(join(folder, "provenance.json"), JSON.stringify({ + schemaVersion: 1, origin: "Repository-authored SVG geometry, adapted from the game's pip controls", + source: "icon-source.svg", sourceSha256: hash(source), sourceNormalization: "LF", + renderer, generator: "scripts/ios-assets/generate.mjs", publicIdentityApproved: false, + externalArtwork: [], fonts: [], sound: [], + exports: variants.map(({ file, role, transparent }) => ({ file, role, width: 1024, height: 1024, transparencyAllowed: !!transparent, sha256: hash(readFileSync(join(folder, file))) })), + }, null, 2) + "\n"); +} finally { rmSync(temporary, { recursive: true, force: true }); } diff --git a/scripts/ios-native/artifact.mjs b/scripts/ios-native/artifact.mjs new file mode 100644 index 0000000..475c20c --- /dev/null +++ b/scripts/ios-native/artifact.mjs @@ -0,0 +1,60 @@ +import assert from "node:assert/strict"; +import { mkdtempSync, readFileSync } from "node:fs"; +import { join } from "node:path"; +import { tmpdir } from "node:os"; + +export function safeArtifactPath(path) { + return typeof path === "string" && path.length > 0 && !/^[./\\]|[:\\\r\n\0]/.test(path) && !path.split("/").includes(".."); +} +export function verifyBuild(build, expected) { + assert.equal(build.schemaVersion, 1); + assert.equal(build.kind, "unsigned-ios-simulator-build"); + assert.equal(build.status, "passed"); + assert.equal(build.source, expected.source, "Native app source differs from the checked-out tests."); + assert.equal(build.architecture, expected.architecture); + assert.equal(build.bunLockSha256, expected.bunLockSha256); + if (expected.runId) assert.equal(build.runId, expected.runId, "Native app must come from this workflow run."); + assert.equal(build.podInstallMode, "deployment"); + assert.equal(build.podLockNeedsReview, false); + assert.deepEqual(build.privacy?.errors, []); + assert(build.app?.directory?.endsWith(".app") && !/[/\\\r\n]/.test(build.app.directory)); + assert.equal(build.app.bundleId, expected.config.ios.bundleIdentifier); + assert.equal(build.app.version, expected.config.version); + assert.equal(build.app.build, expected.config.ios.buildNumber); + assert(Array.isArray(build.artifacts) && build.artifacts.length > 0); + const paths = new Set(); + for (const artifact of build.artifacts) { + assert(safeArtifactPath(artifact.path), "Unsafe native artifact path."); + assert(!paths.has(artifact.path), "Duplicate native artifact path."); paths.add(artifact.path); + assert(/^[a-f0-9]{64}$/.test(artifact.sha256) && Number.isSafeInteger(artifact.bytes) && artifact.bytes >= 0); + } + assert(paths.has("unsigned-simulator.app.tar.gz")); +} +export function verifyArchivePaths(list, directory) { + assert(list.length > 0); + for (const path of list) { + assert(safeArtifactPath(path) && (path === `${directory}/` || path.startsWith(`${directory}/`)), "Archive escapes its app directory."); + } +} +export function loadBuiltSimulator({ root, run, hash, receipt, architecture }) { + const input = join(root, "reports/native-build"); + const build = JSON.parse(readFileSync(join(input, "manifest.json"), "utf8")); + const config = JSON.parse(readFileSync(join(root, "apps/mobile/app.json"), "utf8")).expo; + verifyBuild(build, { source: receipt.source, architecture, bunLockSha256: receipt.bunLockSha256, runId: receipt.runId, config }); + for (const artifact of build.artifacts) { + const bytes = readFileSync(join(input, artifact.path)); + assert.equal(bytes.length, artifact.bytes); assert.equal(hash(bytes), artifact.sha256, `Native artifact changed: ${artifact.path}`); + } + const archive = join(input, "unsigned-simulator.app.tar.gz"); + verifyArchivePaths(run("tar", ["-tzf", archive], { capture: true }).split("\n"), build.app.directory); + const entries = run("tar", ["-tvzf", archive], { capture: true }).split("\n"); + assert(entries.every((line) => /^[d-]/.test(line)), "Archive contains links or special files."); + const directory = mkdtempSync(join(tmpdir(), "dice-qualified-app-")); + run("tar", ["-xzf", archive, "-C", directory], { log: "unpack.log" }); + const app = join(directory, build.app.directory); + assert.equal(hash(readFileSync(join(app, "main.jsbundle"))), build.app.jsBundleSha256); + receipt.app = build.app; + receipt.build = { source: build.source, runId: build.runId, runAttempt: build.runAttempt, artifactSha256: hash(readFileSync(archive)), manifestSha256: hash(readFileSync(join(input, "manifest.json"))) }; + receipt.privacy = { errors: [], evidence: "Source-bound native-build artifact privacy-inspection.json" }; + return { app, bundleId: build.app.bundleId }; +} diff --git a/scripts/ios-native/artifact.test.mjs b/scripts/ios-native/artifact.test.mjs new file mode 100644 index 0000000..bcdfb43 --- /dev/null +++ b/scripts/ios-native/artifact.test.mjs @@ -0,0 +1,29 @@ +import assert from "node:assert/strict"; +import { test } from "node:test"; +import { safeArtifactPath, verifyArchivePaths, verifyBuild } from "./artifact.mjs"; + +const expected = { source: "a".repeat(40), architecture: "arm64", bunLockSha256: "b".repeat(64), runId: "123", + config: { version: "1.0.0", ios: { bundleIdentifier: "com.example.dice", buildNumber: "1" } } }; +const valid = () => ({ schemaVersion: 1, kind: "unsigned-ios-simulator-build", status: "passed", source: expected.source, + architecture: expected.architecture, bunLockSha256: expected.bunLockSha256, runId: expected.runId, podInstallMode: "deployment", podLockNeedsReview: false, + privacy: { errors: [] }, app: { directory: "Dice.app", bundleId: "com.example.dice", version: "1.0.0", build: "1" }, + artifacts: [{ path: "unsigned-simulator.app.tar.gz", bytes: 100, sha256: "c".repeat(64) }] }); + +test("only a passing deployment-mode build from the same source, workflow and architecture can feed native tests", () => { + assert.doesNotThrow(() => verifyBuild(valid(), expected)); + for (const [key, value] of Object.entries({ source: "other", runId: "other", architecture: "x86_64", status: "failed", + podInstallMode: "refresh-only", podLockNeedsReview: true, bunLockSha256: "other", kind: "unsigned-ios-simulator-tests" })) { + assert.throws(() => verifyBuild({ ...valid(), [key]: value }, expected), key); + } + const drift = valid(); drift.privacy.errors.push("missing SDK manifest"); assert.throws(() => verifyBuild(drift, expected)); + const identity = valid(); identity.app.build = "2"; assert.throws(() => verifyBuild(identity, expected)); +}); + +test("artifact inventories and archive members cannot traverse outside the owned app", () => { + for (const path of ["../outside", "/outside", "C:/outside", "a/../../outside", "a\\outside", ".hidden", "a\nother"]) assert.equal(safeArtifactPath(path), false, path); + assert.doesNotThrow(() => verifyArchivePaths(["Dice.app/", "Dice.app/Frameworks/Example.framework/Example"], "Dice.app")); + for (const path of ["Other.app/Info.plist", "Dice.app/../outside", "/Dice.app/Info.plist"]) assert.throws(() => verifyArchivePaths([path], "Dice.app")); + const duplicate = valid(); duplicate.artifacts.push(duplicate.artifacts[0]); assert.throws(() => verifyBuild(duplicate, expected)); + const unsafe = valid(); unsafe.artifacts[0].path = "../outside"; assert.throws(() => verifyBuild(unsafe, expected)); + const missing = valid(); missing.artifacts = []; assert.throws(() => verifyBuild(missing, expected)); +}); diff --git a/scripts/ios-native/build.mjs b/scripts/ios-native/build.mjs new file mode 100644 index 0000000..5206f5e --- /dev/null +++ b/scripts/ios-native/build.mjs @@ -0,0 +1,40 @@ +import assert from "node:assert/strict"; +import { copyFileSync, existsSync, readFileSync, readdirSync } from "node:fs"; +import { join } from "node:path"; +import { tmpdir } from "node:os"; +import { inspectNativePrivacy } from "./privacy.mjs"; + +export function buildSimulator({ root, output, run, hash, receipt, architecture, refreshPodLock }) { + const appRoot = join(root, "apps/mobile"); + assert(!existsSync(join(appRoot, "ios")), "Use a fresh checkout. Existing native project files were not removed."); + run("node", ["node_modules/expo/bin/cli", "prebuild", "--platform", "ios", "--no-install"], { cwd: appRoot, log: "prebuild.log" }); + const ios = join(appRoot, "ios"); const sourceLock = join(appRoot, "native/Podfile.lock"); + receipt.bootstrapPodLock = !existsSync(sourceLock); + receipt.podInstallMode = refreshPodLock ? "refresh-only" : receipt.bootstrapPodLock ? "bootstrap" : "deployment"; + if (!receipt.bootstrapPodLock) copyFileSync(sourceLock, join(ios, "Podfile.lock")); + run("pod", ["install", ...(receipt.bootstrapPodLock || refreshPodLock ? [] : ["--deployment"])], { cwd: ios, log: "pods.log" }); + copyFileSync(join(ios, "Podfile.lock"), join(output, "Podfile.lock")); + receipt.podLockNeedsReview = receipt.bootstrapPodLock || !readFileSync(sourceLock).equals(readFileSync(join(ios, "Podfile.lock"))); + copyFileSync(join(ios, "Podfile.properties.json"), join(output, "Podfile.properties.json")); + assert(!refreshPodLock && !receipt.podLockNeedsReview, "Dependency-only run: review reports/native/Podfile.lock, commit changes to apps/mobile/native, then run normal qualification."); + const workspaces = readdirSync(ios).filter((name) => name.endsWith(".xcworkspace")); assert.equal(workspaces.length, 1); + const scheme = workspaces[0].slice(0, -".xcworkspace".length); + const derived = join(tmpdir(), `dice-derived-${process.pid}`); + run("xcodebuild", ["-workspace", join(ios, workspaces[0]), "-scheme", scheme, "-configuration", "Release", "-sdk", "iphonesimulator", + "-destination", "generic/platform=iOS Simulator", "-derivedDataPath", derived, `ARCHS=${architecture}`, "ONLY_ACTIVE_ARCH=YES", "CODE_SIGNING_ALLOWED=NO", "build"], { log: "build.log", timeout: 2400000 }); + const products = join(derived, "Build/Products/Release-iphonesimulator"); + const apps = readdirSync(products).filter((name) => name.endsWith(".app")); assert.equal(apps.length, 1); + const app = join(products, apps[0]); const info = join(app, "Info.plist"); + const config = JSON.parse(readFileSync(join(appRoot, "app.json"), "utf8")).expo; + const plist = (key) => run("/usr/libexec/PlistBuddy", ["-c", `Print :${key}`, info], { capture: true }); + const bundleId = plist("CFBundleIdentifier"); assert.equal(bundleId, config.ios.bundleIdentifier); + assert.equal(plist("CFBundleShortVersionString"), config.version); assert.equal(plist("CFBundleVersion"), config.ios.buildNumber); + assert.equal(plist("MinimumOSVersion"), "17.0"); assert(existsSync(join(app, "main.jsbundle")), "Release app must contain its own JS bundle."); + receipt.app = { directory: apps[0], bundleId, version: config.version, build: config.ios.buildNumber, minimumOS: "17.0", jsBundleSha256: hash(readFileSync(join(app, "main.jsbundle"))) }; + run("tar", ["-czf", join(output, "unsigned-simulator.app.tar.gz"), "-C", products, apps[0]], { log: "package.log" }); + copyFileSync(info, join(output, "built-Info.plist")); + receipt.privacy = inspectNativePrivacy(app, appRoot, output); + assert.deepEqual(receipt.privacy.errors, [], "Native SDK privacy resources or aggregate declarations are incomplete."); + assert.equal(run("git", ["status", "--porcelain"], { capture: true }), "", "Prebuild changed tracked source. Review it before qualification."); + return { app, bundleId }; +} diff --git a/scripts/ios-native/dice.mjs b/scripts/ios-native/dice.mjs new file mode 100644 index 0000000..11a5d7e --- /dev/null +++ b/scripts/ios-native/dice.mjs @@ -0,0 +1,43 @@ +import assert from "node:assert/strict"; +import { assertHeld, diePosition, rollPosition, screenElements, uniqueElement } from "./geometry.mjs"; + +async function reach(kind, position, { inspect, run, record }) { + for (let attempt = 0; attempt < 30; attempt++) { + await run([{ waitForAnimationToEnd: { timeout: 5000 } }]); + const decision = position(await inspect()); record({ kind, attempt, ...decision }); + if (decision.action === "tap") return; + if (decision.action === "swipe") await run([{ swipe: { start: decision.start, end: decision.end, duration: decision.duration } }]); + } + throw new Error(`Native ${kind} did not become reachable within 30 inspections.`); +} + +/** Never retry a toggle or a random roll. Check UI acknowledgment and exact saved effects. */ +export async function holdAndReroll({ readSave, ...io }) { + const { inspect, run, capture, record } = io; + await run([{ launchApp: { stopApp: false, clearState: false, permissions: { all: "deny" } } }, + { extendedWaitUntil: { visible: { id: "reroll-action", text: "Re-roll \\(2\\)" }, timeout: 15000 } }]); + const before = await readSave("before-hold"); + assert.equal(before.active?.revision, 0, "Expected a newly started game."); + assert.equal(before.active.game.rollsLeft, 2); assert.deepEqual(before.active.game.held, []); + await reach("die", diePosition, io); await capture("die-ready"); + await run([{ tapOn: { id: "die-0", enabled: true, retryTapIfNoChange: false } }, + { extendedWaitUntil: { visible: { id: "die-0", text: ".*checked, Held" }, timeout: 15000 } }]); + assertHeld(await inspect()); + const held = await readSave("after-hold"), expected = structuredClone(before); + expected.active.game.held = [0]; expected.active.revision++; + assert.deepEqual(held, expected, "Holding must change only the held index and revision."); + record({ kind: "die", action: "acknowledged", revision: held.active.revision }); + await reach("reroll", rollPosition, io); await capture("reroll-ready"); + await run([{ tapOn: { id: "reroll-action", enabled: true, retryTapIfNoChange: false } }, + { extendedWaitUntil: { visible: { id: "reroll-action", text: "Re-roll \\(1\\)" }, timeout: 15000 } }]); + const afterScreen = await inspect(); assertHeld(afterScreen); + assert.equal(uniqueElement(screenElements(afterScreen), "reroll-action").a11y, "Re-roll (1)", "Native reroll was not acknowledged."); + const rolled = await readSave("after-reroll"), dice = rolled.active.game.dice; + assert.equal(dice.length, before.active.game.dice.length); + assert(dice.every((face) => Number.isInteger(face) && face >= 1 && face <= 6)); + assert.equal(dice[0], before.active.game.dice[0], "Reroll changed the held die."); + expected.active.game.dice = dice; expected.active.game.rollsLeft = 1; expected.active.revision++; + assert.deepEqual(rolled, expected, "Reroll must preserve all other saved state."); + record({ kind: "reroll", action: "acknowledged", revision: rolled.active.revision }); + await capture("held-and-rerolled"); +} diff --git a/scripts/ios-native/dice.test.mjs b/scripts/ios-native/dice.test.mjs new file mode 100644 index 0000000..3a84cc5 --- /dev/null +++ b/scripts/ios-native/dice.test.mjs @@ -0,0 +1,131 @@ +import assert from "node:assert/strict"; +import test from "node:test"; +import { readFileSync } from "node:fs"; +import { diePosition, rollPosition, assertHeld } from "./geometry.mjs"; +import { holdAndReroll } from "./dice.mjs"; + +function screen(top = 320, held = false, rolls = 2) { + // Bounds from the 930a70 phone-five landscape failure. The original die tap + // at130,360 struck the fixed reroll button despite 100% screen visibility. + return { ui_schema: { platform: "ios", defaults: { enabled: true, checked: false } }, elements: [ + { rid: "play-viewport", b: "[62,126][812,381]", c: [ + { rid: "dice-viewport", b: "[62,126][402,314]", c: [ + { rid: "die-0", b: `[102,${top}][158,${top + 80}]`, val: held ? "checkbox, checked, Held" : "checkbox, unchecked, Not held", checked: false }, + ] }, + { rid: "score-viewport", b: "[402,126][812,381]" }, + { rid: "reroll-action", b: "[82,322][382,370]", a11y: `Re-roll (${rolls})` }, + ] }, + ] }; +} +const nodes = (value) => value.elements[0].c; + +test("a die behind the reroll footer requires a swipe inside the left pane", () => { + const decision = diePosition(screen()); + assert.equal(decision.action, "swipe"); assert.equal(decision.direction, "down"); + assert.equal(Number(decision.start.split(",")[0]), 232); + for (const point of [decision.start, decision.end]) { + const [x, y] = point.split(",").map(Number); + assert(x > 62 && x < 402 && y > 126 && y < 314); + } + assert.equal(diePosition(screen(180)).action, "tap"); + assert.equal(diePosition(screen(100)).direction, "up"); +}); +test("compact play uses the shared viewport and held acknowledgment uses native value", () => { + const compact = screen(180); nodes(compact)[0].rid = "score-viewport"; nodes(compact).splice(1, 1); + assert.equal(diePosition(compact).action, "tap"); + assertHeld(screen(180, true)); // Maestro's checked boolean is false for this RN checkbox. + assert.throws(() => assertHeld(screen(180)), /not acknowledged/); + assert.throws(() => diePosition(screen(180, true)), /already-held/); +}); +test("die and reroll geometry fails closed on unrelated, clipped, duplicate or malformed targets", () => { + const unrelated = screen(180), die = nodes(unrelated)[0].c.pop(); nodes(unrelated).push(die); + assert.throws(() => diePosition(unrelated), /outside its scroll view/); + const duplicate = screen(180); nodes(duplicate)[0].c.push({ ...nodes(duplicate)[0].c[0] }); + assert.throws(() => diePosition(duplicate), /found 2/); + const clipped = screen(180); nodes(clipped)[0].b = "[62,100][402,314]"; + assert.throws(() => diePosition(clipped), /outside the play area/); + const small = screen(180); nodes(small)[0].b = "[62,126][402,215]"; + assert.throws(() => diePosition(small), /too small/); + const bad = screen(180); nodes(bad)[0].c[0].enabled = "true"; + assert.throws(() => diePosition(bad), /Invalid die enabled/); + const disabled = screen(180); nodes(disabled)[0].c[0].enabled = false; + assert.equal(diePosition(disabled).action, "wait"); + assert.equal(rollPosition(screen(180)).action, "tap"); + assert.throws(() => rollPosition(screen(180, false, 1)), /Unexpected reroll/); + const hiddenRoll = screen(180); nodes(hiddenRoll)[2].b = "[82,360][382,408]"; + assert.throws(() => rollPosition(hiddenRoll), /outside the play area/); +}); + +test("native flattened play markers require the same immediate accessibility container", () => { + const native = JSON.parse(readFileSync(new URL("./fixtures/play-accessibility-siblings.json", import.meta.url), "utf8")); + assert.equal(diePosition(native).action, "tap"); + assert.equal(rollPosition(native).action, "tap"); + const detached = structuredClone(native); + const marker = detached.elements[0].c.splice(1, 1)[0]; + detached.elements.push({ b: detached.elements[0].b, c: [marker] }); + assert.throws(() => diePosition(detached), /outside the play area/); + assert.throws(() => rollPosition(detached), /outside the play area/); + const outsideScroll = structuredClone(native); + const pane = outsideScroll.elements[0].c[0], content = pane.c[0].c[0].c[0]; + outsideScroll.elements[0].c.push(content.c.pop()); + assert.throws(() => diePosition(outsideScroll), /outside its scroll view/); +}); + +function harness(options = {}) { + let top = 320, held = false, rolls = 2, inspections = 0; + const data = { preferences: { name: "Fixture" }, active: { revision: 0, game: { id: "fixture", dice: [5, 2, 3, 4, 6], held: [], rollsLeft: 2 } } }; + const calls = [], taps = [], stages = [], records = []; + return { calls, taps, stages, records, inspections: () => inspections, + io: { + inspect: async () => { inspections++; return screen(top, held, rolls); }, + run: async (commands) => { + calls.push(commands); + const swipe = commands[0].swipe; + if (swipe && !options.stuck) top += Number(swipe.end.split(",")[1]) - Number(swipe.start.split(",")[1]); + const tap = commands[0].tapOn; + if (!tap) return; + assert.equal(tap.retryTapIfNoChange, false); taps.push(tap.id); + if (tap.id === "die-0") { + assert.equal(diePosition(screen(top)).action, "tap"); + held = !options.noAcknowledgment; data.active.revision++; + if (options.wrongHoldSave) data.active.game.rollsLeft--; + else data.active.game.held = [0]; + } else { + assert.equal(tap.id, "reroll-action"); rolls = 1; + data.active.game.rollsLeft = 1; data.active.revision++; + if (options.changeHeldDie) data.active.game.dice[0] = 6; + if (options.changeOtherData) data.preferences.name = "Unexpected change"; + } + }, + readSave: async (stage) => { stages.push(stage); return structuredClone(data); }, + capture: async () => {}, record: (value) => records.push(value), + }, + }; +} +test("holding and rerolling tap once each after containment and verify exact saved effects", async () => { + const flow = harness(); await holdAndReroll(flow.io); + assert.deepEqual(flow.taps, ["die-0", "reroll-action"]); + assert.deepEqual(flow.calls[0][0], { launchApp: { stopApp: false, clearState: false, permissions: { all: "deny" } } }); + assert.deepEqual(flow.stages, ["before-hold", "after-hold", "after-reroll"]); + assert.equal(flow.records.filter((item) => item.action === "acknowledged").length, 2); + // Unheld random dice may legitimately roll the same faces again. +}); +test("missing UI or save acknowledgment never retries the hold or advances to reroll", async () => { + for (const options of [{ noAcknowledgment: true }, { wrongHoldSave: true }]) { + const flow = harness(options); + await assert.rejects(holdAndReroll(flow.io), /not acknowledged|Holding must change/); + assert.deepEqual(flow.taps, ["die-0"]); + } +}); +test("reroll must retain the held die and every unrelated saved field", async () => { + for (const options of [{ changeHeldDie: true }, { changeOtherData: true }]) { + const flow = harness(options); + await assert.rejects(holdAndReroll(flow.io), /changed the held die|preserve all other/); + assert.deepEqual(flow.taps, ["die-0", "reroll-action"]); + } +}); +test("stuck dice geometry is bounded without any speculative tap", async () => { + const flow = harness({ stuck: true }); + await assert.rejects(holdAndReroll(flow.io), /30 inspections/); + assert.equal(flow.inspections(), 30); assert.deepEqual(flow.taps, []); +}); diff --git a/scripts/ios-native/driverLogs.mjs b/scripts/ios-native/driverLogs.mjs new file mode 100644 index 0000000..337ad51 --- /dev/null +++ b/scripts/ios-native/driverLogs.mjs @@ -0,0 +1,22 @@ +import { existsSync, lstatSync, readFileSync, readdirSync, writeFileSync } from "node:fs"; +import { join } from "node:path"; + +export function redactDriverLog(text, env) { + let result = text.replace(/(authorization:\s*bearer\s+)\S+/gi, "$1"); + for (const [name, value] of Object.entries(env)) { + if (/(token|password|secret|credential|private.*key)/i.test(name) && typeof value === "string" && value.length >= 8) result = result.split(value).join(""); + } + return result; +} +/** Retain only the known driver log, not an entire hidden directory or its links. */ +export function retainDriverLogs(debug, destination, name, env) { + const tests = join(debug, ".maestro/tests"); + if (!existsSync(tests) || !lstatSync(tests).isDirectory()) return; + let index = 0; + for (const entry of readdirSync(tests, { withFileTypes: true })) { + if (!entry.isDirectory()) continue; + const source = join(tests, entry.name, "maestro.log"); + if (!existsSync(source) || !lstatSync(source).isFile()) continue; + writeFileSync(join(destination, `${name}-driver-${index++}.log`), redactDriverLog(readFileSync(source, "utf8"), env)); + } +} diff --git a/scripts/ios-native/driverLogs.test.mjs b/scripts/ios-native/driverLogs.test.mjs new file mode 100644 index 0000000..4a3667f --- /dev/null +++ b/scripts/ios-native/driverLogs.test.mjs @@ -0,0 +1,23 @@ +import assert from "node:assert/strict"; +import { mkdtempSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { test } from "node:test"; +import { redactDriverLog, retainDriverLogs } from "./driverLogs.mjs"; + +test("driver evidence redacts credential environment values and authorization headers", () => { + assert.equal(redactDriverLog("tap at 20,40 synthetic-secret-value Authorization: Bearer synthetic-token", { RUNTIME_TOKEN: "synthetic-secret-value", ORDINARY: "tap at" }), + "tap at 20,40 Authorization: Bearer "); +}); +test("only known driver logs become non-hidden uploaded evidence", () => { + const directory = mkdtempSync(join(tmpdir(), "native-driver-log-")); + try { + retainDriverLogs(directory, directory, "start", {}); + const source = join(directory, ".maestro/tests/run"); mkdirSync(source, { recursive: true }); + writeFileSync(join(source, "maestro.log"), "target score-ones"); + writeFileSync(join(source, "unrelated.json"), "not evidence"); + retainDriverLogs(directory, directory, "start", {}); + assert.equal(readFileSync(join(directory, "start-driver-0.log"), "utf8"), "target score-ones"); + assert.deepEqual(readdirSync(directory).sort(), [".maestro", "start-driver-0.log"]); + } finally { rmSync(directory, { recursive: true, force: true }); } +}); diff --git a/scripts/ios-native/fixtures/play-accessibility-siblings.json b/scripts/ios-native/fixtures/play-accessibility-siblings.json new file mode 100644 index 0000000..503e73d --- /dev/null +++ b/scripts/ios-native/fixtures/play-accessibility-siblings.json @@ -0,0 +1,22 @@ +{ + "provenance": { + "source": "8fbf38678d536e0fa51b3c987ea84e9b428a89cf", + "run": "https://github.com/HemSoft/yahtzee/actions/runs/36381288453", + "scenario": "phone-6-solo-dark", + "note": "Relevant branches of hold-screen-latest.json. The play marker and its controls are accessibility siblings." + }, + "ui_schema": { "platform": "ios", "defaults": { "enabled": true, "checked": false } }, + "elements": [{ + "b": "[0,116][402,874]", + "c": [ + { + "rid": "score-viewport", "b": "[0,164][402,772]", + "c": [{ "b": "[0,164][402,772]", "c": [{ "b": "[0,164][402,2095]", "c": [{ "b": "[0,164][402,2095]", "c": [ + { "rid": "die-0", "b": "[71,358][127,438]", "a11y": "Die 1, showing 4", "val": "checkbox, unchecked, Not held" } + ] }] }] }] + }, + { "rid": "play-viewport", "b": "[0,164][402,840]" }, + { "rid": "reroll-action", "b": "[20,780][382,828]", "a11y": "Re-roll (2)" } + ] + }] +} diff --git a/scripts/ios-native/flows.mjs b/scripts/ios-native/flows.mjs new file mode 100644 index 0000000..9d6bfe3 --- /dev/null +++ b/scripts/ios-native/flows.mjs @@ -0,0 +1,63 @@ +const command = (name, value) => `- ${name}${value === undefined ? "" : `: ${JSON.stringify(value)}`}`; +const visible = (text) => command("assertVisible", text); +const tap = (text) => command("tapOn", { text, enabled: true }); +const scroll = (element) => command("scrollUntilVisible", { element, direction: "DOWN", timeout: 60000, visibilityPercentage: 100 }); +const shot = (name) => command("takeScreenshot", name); +const header = (bundleId, commands) => `appId: ${JSON.stringify(bundleId)}\n---\n${commands.join("\n")}\n`; + +export function startFlow(bundleId, scenario) { + return header(bundleId, [command("launchApp", { clearState: true, permissions: { all: "deny" } }), + command("setOrientation", scenario.orientation), visible("A little time for dice."), + tap("Help"), visible("How to play"), tap("Done"), visible("A little time for dice."), shot("setup"), + scroll({ text: "Your name" }), tap("Your name"), command("eraseText"), command("inputText", "Local tester"), command("pressKey", "enter"), + scroll({ text: "AI opponents" }), tap("AI opponents"), tap(scenario.ai ? "3 AI" : "Solo"), + scroll({ text: "Dice count" }), tap("Dice count"), tap(`${scenario.dice} dice`), + scroll({ text: "Start Game" }), tap("Start Game"), visible("Re-roll \\(2\\)"), shot("started-game")]); +} +export function resumeFlow(bundleId) { + return header(bundleId, [command("launchApp", { permissions: { all: "deny" } }), + scroll({ text: "Resume Game" }), tap("Resume Game"), visible("Re-roll \\(1\\)"), shot("resumed")]); +} +export function completeStartFlow(bundleId) { + return header(bundleId, [command("launchApp", { permissions: { all: "deny" } }), scroll({ text: "Resume Game" }), tap("Resume Game"), + visible("Re-roll \\(1\\)"), command("waitForAnimationToEnd", { timeout: 5000 }), command("assertVisible", { id: "score-viewport" }), shot("ready-to-score")]); +} +export function completeEndFlow(bundleId, previewDiagnostics = false) { + return header(bundleId, [command("launchApp", { stopApp: false, clearState: false, permissions: { all: "deny" } }), + visible("Game Over!"), shot("results"), tap("History"), visible("Local history"), shot("history"), + command("launchApp", { permissions: { all: "deny" } }), scroll({ text: "Review saved result" }), tap("Review saved result"), + visible("Game Over!"), tap("Help"), visible("How to play"), shot("help"), + ...(previewDiagnostics ? [scroll({ text: "Preview diagnostics" }), tap("Preview diagnostics"), scroll({ id: "diagnostics-preview" }), + command("assertVisible", { id: "diagnostics-preview" }), shot("diagnostics-preview"), scroll({ text: "Cancel preview" }), tap("Cancel preview"), + command("assertNotVisible", "Cancel preview"), command("assertNotVisible", { id: "diagnostics-preview" }), visible("Preview diagnostics"), shot("diagnostics-cancelled")] : []), tap("Done"), + scroll({ text: "Play Again" }), tap("Play Again"), scroll({ text: "Start Game" }), shot("play-again")]); +} +export function emptyRelaunchFlow(bundleId) { + return header(bundleId, [command("launchApp", { clearState: false, stopApp: true }), visible("A little time for dice."), shot("empty-after-reset-relaunch")]); +} +export function corruptFlow(bundleId, reset = false) { + const commands = [command("launchApp", { permissions: { all: "deny" } }), visible("Your saved data has not been reset."), shot("recovery")]; + if (reset) commands.push(tap("Help"), scroll({ text: "Delete all local data" }), tap("Delete all local data"), tap("Cancel"), + tap("Delete all local data"), command("tapOn", { text: "Delete all local data", index: 1 }), tap("Done"), scroll({ text: "Start Game" }), shot("explicit-reset")); + return header(bundleId, commands); +} + +export const GROUPS = ["phone-5", "phone-6", "tablet-8", "tablet-10"]; +export function scenariosForGroup(group) { + if (!GROUPS.includes(group)) throw new Error(`Unknown native qualification group: ${group}`); + const large = group === "phone-6" ? "phone-largest-text" : group === "tablet-10" ? "tablet-largest-text" : null; + return scenarios.filter((scenario) => scenario.id.startsWith(`${group}-`) || scenario.id === large); +} + +export const scenarios = [ + { id: "phone-5-solo-light", device: "iPhone 17", dice: 5, ai: 0, appearance: "light", orientation: "PORTRAIT" }, + { id: "phone-5-ai-dark-wide", device: "iPhone 17", dice: 5, ai: 3, appearance: "dark", orientation: "LANDSCAPE_LEFT" }, + { id: "phone-6-solo-dark", device: "iPhone 17", dice: 6, ai: 0, appearance: "dark", orientation: "PORTRAIT" }, + { id: "phone-6-ai-light", device: "iPhone 17", dice: 6, ai: 3, appearance: "light", orientation: "PORTRAIT" }, + { id: "tablet-8-solo-light", device: "iPad Pro 13-inch (M5)", dice: 8, ai: 0, appearance: "light", orientation: "PORTRAIT" }, + { id: "tablet-8-ai-dark-wide", device: "iPad Pro 13-inch (M5)", dice: 8, ai: 3, appearance: "dark", orientation: "LANDSCAPE_LEFT" }, + { id: "tablet-10-solo-dark", device: "iPad Pro 13-inch (M5)", dice: 10, ai: 0, appearance: "dark", orientation: "PORTRAIT" }, + { id: "tablet-10-ai-light-wide", device: "iPad Pro 13-inch (M5)", dice: 10, ai: 3, appearance: "light", orientation: "LANDSCAPE_LEFT" }, + { id: "phone-largest-text", device: "iPhone 17", dice: 6, ai: 3, appearance: "dark", orientation: "PORTRAIT", largeText: true }, + { id: "tablet-largest-text", device: "iPad Pro 13-inch (M5)", dice: 10, ai: 3, appearance: "light", orientation: "PORTRAIT", largeText: true }, +]; diff --git a/scripts/ios-native/flows.test.mjs b/scripts/ios-native/flows.test.mjs new file mode 100644 index 0000000..1b400b3 --- /dev/null +++ b/scripts/ios-native/flows.test.mjs @@ -0,0 +1,83 @@ +import assert from "node:assert/strict"; +import { test } from "node:test"; +import { startFlow, resumeFlow, completeStartFlow, completeEndFlow, corruptFlow, emptyRelaunchFlow, scenarios, GROUPS, scenariosForGroup } from "./flows.mjs"; + +function parse(flow) { + const [header, body] = flow.trim().split("\n---\n"); + assert.equal(JSON.parse(header.slice("appId: ".length)), "com.hemsoft.yahtzee"); + return body.split("\n").map((line) => { + const match = /^- ([a-zA-Z]+)(?:: (.*))?$/.exec(line); assert(match, line); + return { command: match[1], value: match[2] === undefined ? undefined : JSON.parse(match[2]) }; + }); +} +test("native matrix covers every mode with solo and three AI, both devices/themes and largest text", () => { + const completed = scenarios.filter((item) => !item.largeText); + assert.equal(completed.length, 8); + for (const dice of [5, 6, 8, 10]) for (const ai of [0, 3]) assert(completed.some((item) => item.dice === dice && item.ai === ai)); + assert.equal(new Set(scenarios.filter((item) => item.largeText).map((item) => item.device)).size, 2); + assert.deepEqual(new Set(scenarios.map((item) => item.appearance)), new Set(["light", "dark"])); + assert(scenarios.some((item) => item.device.startsWith("iPad") && item.orientation === "LANDSCAPE_LEFT")); +}); +test("bounded native groups cover every scenario exactly once and never mix device families", () => { + const grouped = GROUPS.flatMap(scenariosForGroup); + assert.deepEqual(grouped.map((item) => item.id).sort(), scenarios.map((item) => item.id).sort()); + assert.equal(new Set(grouped.map((item) => item.id)).size, scenarios.length); + for (const group of GROUPS) { + const items = scenariosForGroup(group); + assert.equal(new Set(items.map((item) => item.device)).size, 1); + assert.equal(items.filter((item) => !item.largeText).length, 2); + } + assert.throws(() => scenariosForGroup("unknown")); +}); +test("generated flows use valid JSON-in-YAML commands and real semantic controls", () => { + for (const scenario of scenarios) { + const steps = parse(startFlow("com.hemsoft.yahtzee", scenario)); + assert.deepEqual(steps[0].value, { clearState: true, permissions: { all: "deny" } }); + assert(steps.some((step) => step.command === "tapOn" && step.value?.text === `${scenario.dice} dice`)); + assert(!steps.some((step) => step.command === "tapOn" && step.value?.id === "die-0")); + assert(steps.some((step) => step.command === "assertVisible" && new RegExp(step.value).test("Re-roll (2)"))); + } + const resumed = parse(resumeFlow("com.hemsoft.yahtzee")); + assert.equal(resumed[0].value.clearState, undefined); + assert(resumed.some((step) => step.value?.text === "Resume Game")); + const completed = parse(completeEndFlow("com.hemsoft.yahtzee")); + assert.deepEqual(completed[0], { command: "launchApp", value: { stopApp: false, clearState: false, permissions: { all: "deny" } } }); + assert(completed.some((step) => step.command === "assertVisible" && step.value === "Game Over!")); + const preview = parse(completeEndFlow("com.hemsoft.yahtzee", true)); + assert(preview.some((step) => step.command === "assertVisible" && step.value?.id === "diagnostics-preview")); + assert(preview.some((step) => step.value?.text === "Cancel preview")); +}); +test("diagnostic cancellation scrolls to its action and requires the preview to disappear", () => { + const steps = parse(completeEndFlow("com.hemsoft.yahtzee", true)); + const cancel = steps.findIndex((step) => step.command === "tapOn" && step.value?.text === "Cancel preview"); + assert(cancel > 0); + assert.deepEqual(steps[cancel - 1], { command: "scrollUntilVisible", value: { element: { text: "Cancel preview" }, direction: "DOWN", timeout: 60000, visibilityPercentage: 100 } }); + assert.deepEqual(steps[cancel + 1], { command: "assertNotVisible", value: "Cancel preview" }); + assert.deepEqual(steps[cancel + 2], { command: "assertNotVisible", value: { id: "diagnostics-preview" } }); + assert.deepEqual(steps[cancel + 3], { command: "assertVisible", value: "Preview diagnostics" }); +}); +test("native name entry submits the keyboard instead of issuing dismissal swipes", () => { + const steps = parse(startFlow("com.hemsoft.yahtzee", scenarios[0])); + assert(!steps.some((step) => step.command === "hideKeyboard")); + assert(steps.some((step) => step.command === "pressKey" && step.value === "enter")); +}); +test("scoring starts only after resume settles and exposes its actual viewport", () => { + const steps = parse(completeStartFlow("com.hemsoft.yahtzee")); + const ready = steps.findIndex((step) => step.command === "assertVisible" && step.value === "Re-roll \\(1\\)"); + assert(ready >= 0); + assert.equal(steps[ready + 1].command, "waitForAnimationToEnd"); + assert.deepEqual(steps[ready + 2].value, { id: "score-viewport" }); + assert(!steps.some((step) => step.value?.centerElement || step.value?.id?.startsWith("score-") && step.command === "tapOn")); +}); +test("corruption flow never clears state and reset includes cancellation first", () => { + const relaunch = parse(emptyRelaunchFlow("com.hemsoft.yahtzee")); + assert.deepEqual(relaunch[0].value, { clearState: false, stopApp: true }); + assert(relaunch.some((step) => step.command === "assertVisible" && step.value === "A little time for dice.")); + for (const reset of [false, true]) { + const steps = parse(corruptFlow("com.hemsoft.yahtzee", reset)); + assert.equal(steps[0].value.clearState, undefined); + assert(steps.some((step) => step.value === "Your saved data has not been reset.")); + assert.equal(steps.some((step) => step.value?.text === "Cancel"), reset); + if (reset) assert(steps.findIndex((step) => step.value?.text === "Cancel") < steps.findIndex((step) => step.value?.index === 1)); + } +}); diff --git a/scripts/ios-native/geometry.mjs b/scripts/ios-native/geometry.mjs new file mode 100644 index 0000000..0f910b6 --- /dev/null +++ b/scripts/ios-native/geometry.mjs @@ -0,0 +1,110 @@ +import assert from "node:assert/strict"; + +export function bounds(value) { + const match = /^\[(-?\d+),(-?\d+)\]\[(-?\d+),(-?\d+)\]$/.exec(value ?? ""); + assert(match, "Missing or invalid native bounds."); + const [left, top, right, bottom] = match.slice(1).map(Number); + assert([left, top, right, bottom].every((n) => Number.isSafeInteger(n) && Math.abs(n) <= 100000), "Invalid native coordinate."); + assert(right > left && bottom > top, "Native bounds must have positive area."); + return { left, top, right, bottom, width: right - left, height: bottom - top }; +} +export function screenElements(screen) { + assert.equal(screen.ui_schema?.platform, "ios", "Expected a native iOS hierarchy."); + assert.equal(screen.ui_schema?.defaults?.enabled, true, "Unexpected native enabled default."); + const result = []; + function visit(nodes, parents = []) { + assert(Array.isArray(nodes) && parents.length < 64, "Invalid native hierarchy."); + for (const node of nodes) { + assert(result.length < 10000, "Native hierarchy exceeds its bound."); + const item = { ...node, enabled: node.enabled ?? true, parents, rect: bounds(node.b) }; + result.push(item); + if (node.c) visit(node.c, [...parents, item]); + } + } + visit(screen.elements); + return result; +} +export function uniqueElement(elements, id, required = true) { + const matches = elements.filter((node) => node.rid === id); + assert(matches.length <= 1 && (!required || matches.length === 1), `Expected one native ${id}; found ${matches.length}.`); + return matches[0]; +} +const within = (row, viewport, margin = 8) => row.left >= viewport.left && row.right <= viewport.right && row.top >= viewport.top + margin && row.bottom <= viewport.bottom - margin; +const intersects = (row, viewport) => row.bottom > viewport.top && row.top < viewport.bottom && row.right > viewport.left && row.left < viewport.right; + +/** Uses the actual scroll view, not Maestro's whole-screen visibility/one-sided centering. */ +export function scorePosition(screen, id, categories) { + const elements = screenElements(screen); + const viewportNode = uniqueElement(elements, "score-viewport"); + const viewport = viewportNode.rect; + assert(viewport.width >= 80 && viewport.height >= 100, "Score viewport is too small to exercise."); + const target = uniqueElement(elements, `score-${id}`, false); + if (target) { + assert(target.parents.includes(viewportNode), "Score target is outside its scroll view."); + assert(!/points recorded/.test(target.a11y ?? ""), "Refusing to score an already recorded category."); + assert(target.enabled === true || target.enabled === false, "Invalid enabled state."); + if (!target.enabled) return { action: "wait", id, viewport, target: target.rect }; + assert(target.rect.width <= viewport.width && target.rect.height <= viewport.height - 16, "Score target cannot fit in its viewport."); + if (within(target.rect, viewport)) return { action: "tap", id, viewport, target: target.rect }; + } + const index = categories.indexOf(id); assert(index >= 0, "Unknown score category."); + const visible = elements.filter((node) => node.parents.includes(viewportNode) && node.rid?.startsWith("score-") && intersects(node.rect, viewport)) + .map((node) => categories.indexOf(node.rid.slice(6))).filter((value) => value >= 0); + let direction; + if (target) direction = target.rect.top < viewport.top + 8 ? "up" : "down"; + else if (visible.length === 0 || index > Math.max(...visible)) direction = "down"; + else { assert(index < Math.min(...visible), "Missing target among visible score rows."); direction = "up"; } + return viewportSwipe(viewport, target?.rect ?? null, id, direction); +} + +function viewportSwipe(viewport, target, id, direction) { + const distance = Math.round(viewport.height * 0.18); + const x = Math.round((viewport.left + viewport.right) / 2), middle = (viewport.top + viewport.bottom) / 2; + const delta = direction === "down" ? distance : -distance; + return { action: "swipe", id, viewport, target, direction, + start: `${x},${Math.round(middle + delta / 2)}`, end: `${x},${Math.round(middle - delta / 2)}`, duration: 1000 }; +} + +export function assertRecorded(screen, id) { + const node = uniqueElement(screenElements(screen), `score-${id}`); + assert.match(node.a11y ?? "", /points recorded/, `Native score ${id} was not acknowledged.`); + assert.equal(node.enabled, false, "Recorded score must no longer accept input."); +} + +function inPlayHierarchy(node, root) { + if (node.parents.includes(root)) return true; + // iOS exposes this nonaccessible RN View's testID as a leaf sibling of its + // children. Accept that observed shape only inside the same direct container. + return !root.c?.length && root.parents.length > 0 && node.parents.at(-1) === root.parents.at(-1); +} + +export function diePosition(screen) { + const elements = screenElements(screen); + const root = uniqueElement(elements, "play-viewport"); + const viewportNode = uniqueElement(elements, "dice-viewport", false) ?? uniqueElement(elements, "score-viewport"); + const viewport = viewportNode.rect, target = uniqueElement(elements, "die-0"); + assert(inPlayHierarchy(viewportNode, root) && within(viewport, root.rect, 0), "Dice viewport is outside the play area."); + assert(viewport.width >= 80 && viewport.height >= 100, "Dice viewport is too small to exercise."); + assert(target.parents.includes(viewportNode), "Die is outside its scroll view."); + assert(target.enabled === true || target.enabled === false, "Invalid die enabled state."); + if (!target.enabled) return { action: "wait", viewport, target: target.rect }; + assert.equal(target.val, "checkbox, unchecked, Not held", "Refusing to toggle an already-held or unknown die state."); + assert(target.rect.width <= viewport.width && target.rect.height <= viewport.height - 16, "Die cannot fit in its viewport."); + if (within(target.rect, viewport)) return { action: "tap", viewport, target: target.rect }; + return viewportSwipe(viewport, target.rect, "die-0", target.rect.top < viewport.top + 8 ? "up" : "down"); +} + +export function rollPosition(screen) { + const elements = screenElements(screen), root = uniqueElement(elements, "play-viewport"), target = uniqueElement(elements, "reroll-action"); + assert(inPlayHierarchy(target, root) && within(target.rect, root.rect), "Reroll is outside the play area."); + assert.equal(target.a11y, "Re-roll (2)", "Unexpected reroll state before the single tap."); + assert(target.enabled === true || target.enabled === false, "Invalid reroll enabled state."); + return { action: target.enabled ? "tap" : "wait", viewport: root.rect, target: target.rect }; +} + +export function assertHeld(screen) { + const node = uniqueElement(screenElements(screen), "die-0"); + // RN's iOS checkbox exposes its state in value; Maestro's generic checked + // boolean remains false. Both forms were inspected in actual native evidence. + assert.equal(node.val, "checkbox, checked, Held", "Native die hold was not acknowledged."); +} diff --git a/scripts/ios-native/geometry.test.mjs b/scripts/ios-native/geometry.test.mjs new file mode 100644 index 0000000..723fe9b --- /dev/null +++ b/scripts/ios-native/geometry.test.mjs @@ -0,0 +1,89 @@ +import assert from "node:assert/strict"; +import { readFileSync } from "node:fs"; +import { test } from "node:test"; +import { bounds, screenElements, scorePosition, assertRecorded } from "./geometry.mjs"; +import { scoreCategories } from "./scoring.mjs"; + +const row = (id, top, extra = {}) => ({ rid: `score-${id}`, a11y: `Score ${id}, 0 points`, b: `[20,${top}][382,${top + 56}]`, ...extra }); +const screen = (rows, viewport = "[0,164][402,772]") => ({ ui_schema: { platform: "ios", defaults: { enabled: true } }, elements: [ + { b: "[0,0][402,874]", c: [{ rid: "score-viewport", b: viewport, c: rows }] }, +] }); + +test("the actual scoring caller uses the viewport-aware driver in both layouts", () => { + const play = readFileSync(new URL("../../apps/mobile/src/screens/Play.tsx", import.meta.url), "utf8"); + assert.equal((play.match(/testID="score-viewport"/g) ?? []).length, 2); + const runner = readFileSync(new URL("./run.mjs", import.meta.url), "utf8"); + assert.match(runner, /await nativeInteraction\(/); + assert.match(runner, /await exerciseScenario\(/); + const scenario = readFileSync(new URL("./scenario.mjs", import.meta.url), "utf8"); + assert.match(scenario, /await scoreCategories\(/); + assert.doesNotMatch(runner, /completeFlow\(/); +}); +test("dice and reroll interactions expose their own bounds and use the checked driver", () => { + const play = readFileSync(new URL("../../apps/mobile/src/screens/Play.tsx", import.meta.url), "utf8"); + assert.match(play, /testID="dice-viewport"/); + assert.equal((play.match(/testID="play-viewport"/g) ?? []).length, 2); + assert.match(play, /testID="reroll-action"/); + const runner = readFileSync(new URL("./run.mjs", import.meta.url), "utf8"); + assert.match(runner, /await exerciseScenario\(/); + const scenario = readFileSync(new URL("./scenario.mjs", import.meta.url), "utf8"); + assert.match(scenario, /await holdAndReroll\(/); + const flows = readFileSync(new URL("./flows.mjs", import.meta.url), "utf8"); + assert.doesNotMatch(flows, /tapOn.*id: "die-0"/); +}); +test("captured footer and toolbar overshoots do not count as reachable scores", () => { + // Captured row bounds from 027459 and 22d76f2; viewport is a representative phone fixture. + const footer = scorePosition(screen([row("ones", 750)]), "ones", ["ones"]); + const toolbar = scorePosition(screen([row("one-pair", 115)]), "one-pair", ["one-pair"]); + assert.equal(footer.action, "swipe"); assert.equal(footer.direction, "down"); + assert.equal(toolbar.action, "swipe"); assert.equal(toolbar.direction, "up"); + assert.equal(scorePosition(screen([row("ones", 238)]), "ones", ["ones"]).action, "tap"); + // Maestro's one-sided 70% check accepts the observed y143 center despite the toolbar. + assert(143 < 874 / 2 + Math.floor(874 / 5)); +}); +test("positioning follows the native viewport, missing-row order and enabled state", () => { + assert.equal(scorePosition(screen([row("chance", 250)]), "ones", ["ones", "chance"]).direction, "up"); + assert.equal(scorePosition(screen([row("ones", 250)]), "chance", ["ones", "chance"]).direction, "down"); + assert.equal(scorePosition(screen([row("ones", 250, { enabled: false })]), "ones", ["ones"]).action, "wait"); + assert.throws(() => scorePosition(screen([row("ones", 250, { a11y: "Ones, 0 points recorded", enabled: false })]), "ones", ["ones"]), /already recorded/); + const tablet = screen([{ rid: "score-ones", b: "[440,900][1000,960]" }], "[420,164][1032,1332]"); + assert.equal(scorePosition(tablet, "ones", ["ones"]).action, "tap"); + assert.throws(() => scorePosition(screen([row("ones", 160)] , "[0,164][300,772]"), "ones", ["ones"]), /cannot fit/); +}); +test("malformed, duplicate and unrelated geometry fails closed", () => { + for (const value of [null, "[0,0][0,0]", "[0,0][2.5,4]", "[0,0][200000,3]"]) assert.throws(() => bounds(value)); + assert.throws(() => screenElements({ ui_schema: { platform: "android" } })); + assert.throws(() => scorePosition(screen([row("ones", 250), row("ones", 310)]), "ones", ["ones"]), /found 2/); + const outside = screen([]); outside.elements.push(row("ones", 250)); + assert.throws(() => scorePosition(outside, "ones", ["ones"]), /outside its scroll view/); + assert.throws(() => assertRecorded(screen([row("ones", 250)]), "ones"), /not acknowledged/); +}); + +test("scoring repairs overshoot, taps once inside bounds, and requires application acknowledgment", async () => { + let top = 115, finished = false, taps = 0; + const decisions = [], calls = []; + await scoreCategories({ categories: ["one-pair"], + inspect: async () => finished ? screen([{ b: "[20,200][382,256]", a11y: "Game Over!" }]) : screen([row("one-pair", top)]), + run: async (commands) => { + calls.push(commands); + const swipe = commands[0].swipe; + if (swipe) top += Number(swipe.end.split(",")[1]) - Number(swipe.start.split(",")[1]); + if (commands[0].tapOn) { + assert(top >= 172 && top + 56 <= 764); assert.equal(commands[0].tapOn.retryTapIfNoChange, false); + assert.equal(commands[1].extendedWaitUntil.visible.text, "Game Over!"); taps++; finished = true; + } + }, capture: async () => {}, record: (item) => decisions.push(item), + }); + assert.deepEqual(calls[0], [{ launchApp: { stopApp: false, clearState: false, permissions: { all: "deny" } } }]); + assert.equal(taps, 1); assert(calls.some((commands) => commands[0].swipe)); + assert.equal(decisions.at(-1).action, "acknowledged"); +}); +test("lack of score acknowledgment never triggers another tap; stuck geometry is bounded", async () => { + let taps = 0; + const options = { categories: ["ones", "chance"], inspect: async () => screen([row("ones", 250)]), + run: async (commands) => { if (commands[0].tapOn) taps++; }, capture: async () => {}, record: () => {} }; + await assert.rejects(scoreCategories(options), /not acknowledged/); assert.equal(taps, 1); + let inspections = 0; + await assert.rejects(scoreCategories({ ...options, categories: ["ones"], inspect: async () => { inspections++; return screen([row("ones", 750)]); } }), /30 inspections/); + assert.equal(inspections, 30); assert.equal(taps, 1); +}); diff --git a/scripts/ios-native/interaction.mjs b/scripts/ios-native/interaction.mjs new file mode 100644 index 0000000..9979f04 --- /dev/null +++ b/scripts/ios-native/interaction.mjs @@ -0,0 +1,45 @@ +import assert from "node:assert/strict"; +import { appendFileSync, writeFileSync } from "node:fs"; +import { join } from "node:path"; +import { localMaestro } from "./mcp.mjs"; +import { redactDriverLog } from "./driverLogs.mjs"; + +/** One bounded local driver session for the owned simulator. */ +export async function nativeInteraction({ device, bundleId, directory, prefix, env, capture, exercise, openSession = localMaestro }) { + assert(["complete", "hold", "scenario"].includes(prefix), "Unknown native interaction phase."); + let diagnostics = "", sequence = 0; + const deadline = Date.now() + 600000; + const childEnv = Object.fromEntries(Object.entries(env).filter(([key]) => + /^(PATH|HOME|USER|LOGNAME|SHELL|TMPDIR|TMP|TEMP|JAVA_HOME|DEVELOPER_DIR|LANG|LC_ALL|MAESTRO_CLI_NO_ANALYTICS|MAESTRO_DISABLE_UPDATE_CHECK|MAESTRO_CLI_ANALYSIS_NOTIFICATION_DISABLED|MAESTRO_DRIVER_STARTUP_TIMEOUT)$/.test(key))); + let client; + async function call(name, args) { assert(Date.now() < deadline, "Native interaction exceeded ten minutes."); return client.call(name, args); } + async function inspect() { + const screen = await call("inspect_screen", { device_id: device }); + writeFileSync(join(directory, `${prefix}-screen-latest.json`), JSON.stringify(screen, null, 2) + "\n"); + return screen; + } + async function runFlow(yaml) { + assert(typeof yaml === "string" && yaml.length <= 262144 && yaml.startsWith(`appId: ${JSON.stringify(bundleId)}\n---\n`), "Flow must target the owned application."); + writeFileSync(join(directory, `${prefix}-step-${String(++sequence).padStart(3, "0")}.yaml`), yaml); + const result = await call("run", { device_id: device, yaml }); + assert.equal(result.success, true, "Native interaction command failed."); + } + async function run(commands) { + const yaml = `appId: ${JSON.stringify(bundleId)}\n---\n` + commands.map((command) => { + const [[name, value]] = Object.entries(command); return `- ${name}: ${JSON.stringify(value)}`; + }).join("\n") + "\n"; + await runFlow(yaml); + } + try { + client = await openSession({ cwd: directory, env: childEnv, deadline, onStderr: (text) => { diagnostics += text.slice(0, Math.max(0, 262144 - diagnostics.length)); } }); + const devices = await call("list_devices", {}); + assert(devices.devices?.some((item) => item.device_id === device && item.platform === "ios" && item.connected === true), "Owned simulator is not connected to Maestro."); + await exercise({ inspect, run, runFlow, capture, record: (value) => appendFileSync(join(directory, `${prefix}-geometry.jsonl`), JSON.stringify(value) + "\n") }); + } catch (error) { + try { await capture(`${prefix}-failure`); } catch { /* Preserve the original error; the runner also reads the saved document. */ } + throw error; + } finally { + try { await client?.close(); } + finally { writeFileSync(join(directory, `${prefix}-mcp.log`), redactDriverLog(diagnostics, env)); } + } +} diff --git a/scripts/ios-native/interaction.test.mjs b/scripts/ios-native/interaction.test.mjs new file mode 100644 index 0000000..b7a3951 --- /dev/null +++ b/scripts/ios-native/interaction.test.mjs @@ -0,0 +1,64 @@ +import assert from "node:assert/strict"; +import { mkdtempSync, readFileSync, readdirSync, rmSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import test from "node:test"; +import { nativeInteraction } from "./interaction.mjs"; +import { startFlow, resumeFlow } from "./flows.mjs"; + +function harness() { + const directory = mkdtempSync(join(tmpdir(), "native-session-")), calls = [], captures = []; + let opened = 0, closed = 0, childEnv; + const options = { directory, device: "owned", bundleId: "fixture.app", prefix: "scenario", env: { PATH: "fixture-path", GITHUB_TOKEN: "fixture-secret", UNRELATED: "not-forwarded" }, + capture: async (name) => captures.push(name), + openSession: async ({ env, deadline, onStderr }) => { + opened++; childEnv = env; + assert(deadline > Date.now() && deadline <= Date.now() + 600000); + onStderr("GITHUB_TOKEN=fixture-secret\n"); + return { call: async (name, args) => { + calls.push({ name, args }); + if (name === "list_devices") return { devices: [{ device_id: "owned", platform: "ios", connected: true }] }; + if (name === "inspect_screen") return { ui_schema: { platform: "ios" }, elements: [] }; + return { success: true, env_vars: { GITHUB_TOKEN: "fixture-secret" } }; + }, close: async () => { closed++; } }; + } }; + return { options, calls, captures, state: () => ({ opened, closed, childEnv }), cleanup: () => rmSync(directory, { recursive: true }) }; +} +test("multiple authored flows and inspections use exactly one owned bounded session", async () => { + const flow = harness(); + try { + await nativeInteraction({ ...flow.options, exercise: async (io) => { + await io.runFlow(startFlow("fixture.app", { ai: 0, dice: 5, orientation: "PORTRAIT" })); + await io.run([{ waitForAnimationToEnd: { timeout: 5000 } }]); + await io.inspect(); await io.runFlow(resumeFlow("fixture.app")); + io.record({ action: "fixture" }); + } }); + const { opened, closed, childEnv } = flow.state(); + assert.equal(opened, 1); assert.equal(closed, 1); assert.deepEqual(childEnv, { PATH: "fixture-path" }); + assert.deepEqual(flow.calls.map((item) => item.name), ["list_devices", "run", "run", "inspect_screen", "run"]); + assert.equal(readdirSync(flow.options.directory).filter((name) => name.endsWith(".yaml")).length, 3); + assert(!readFileSync(join(flow.options.directory, "scenario-mcp.log"), "utf8").includes("fixture-secret")); + assert.deepEqual(flow.captures, []); + } finally { flow.cleanup(); } +}); +test("failure preserves its phase screenshot and closes the same session without replay", async () => { + const flow = harness(); + try { + await assert.rejects(nativeInteraction({ ...flow.options, exercise: async (io) => { + await io.run([{ tapOn: { id: "die-0", retryTapIfNoChange: false } }]); throw new Error("Not acknowledged"); + } }), /Not acknowledged/); + assert.equal(flow.state().opened, 1); assert.equal(flow.state().closed, 1); + assert.equal(flow.calls.filter((item) => item.name === "run").length, 1); + assert.deepEqual(flow.captures, ["scenario-failure"]); + } finally { flow.cleanup(); } +}); +test("unbound or oversized authored flows cannot reach the driver", async () => { + for (const yaml of [resumeFlow("another.app"), 'appId: "fixture.app"\n---\n' + "x".repeat(262144)]) { + const flow = harness(); + try { + await assert.rejects(nativeInteraction({ ...flow.options, exercise: (io) => io.runFlow(yaml) }), /owned application/); + assert.equal(flow.calls.filter((item) => item.name === "run").length, 0); + assert.equal(flow.state().closed, 1); + } finally { flow.cleanup(); } + } +}); diff --git a/scripts/ios-native/mcp.mjs b/scripts/ios-native/mcp.mjs new file mode 100644 index 0000000..6896db6 --- /dev/null +++ b/scripts/ios-native/mcp.mjs @@ -0,0 +1,90 @@ +import assert from "node:assert/strict"; +import { spawn } from "node:child_process"; +import { setTimeout as delay } from "node:timers/promises"; + +/** Bounded local JSON-RPC transport. Never persist raw responses or injected environment values. */ +export function rpcClient(child, { timeoutMs = 300000, maxBytes = 8 * 1024 * 1024, deadline = Infinity } = {}) { + let nextId = 0, buffer = "", failure = null, closing = false; + const pending = new Map(); + function fail(error) { + failure ??= error; + for (const entry of pending.values()) { clearTimeout(entry.timer); entry.reject(failure); } + pending.clear(); + } + function send(message) { child.stdin.write(JSON.stringify(message) + "\n"); } + function receive(line) { + const message = JSON.parse(line); + assert.equal(message.jsonrpc, "2.0", "Invalid local JSON-RPC version."); + if (message.method) { + if (message.id !== undefined) send({ jsonrpc: "2.0", id: message.id, error: { code: -32601, message: "Server requests are not supported." } }); + return; + } + const entry = pending.get(message.id); assert(entry, "Unexpected local JSON-RPC response."); + clearTimeout(entry.timer); pending.delete(message.id); + if (message.error) entry.reject(new Error(`Local JSON-RPC error ${message.error.code ?? "unknown"}.`)); + else if (!Object.hasOwn(message, "result")) entry.reject(new Error("Local JSON-RPC response has no result.")); + else entry.resolve(message.result); + } + child.stdout.setEncoding("utf8"); + child.stdout.on("data", (chunk) => { + if (failure) return; + try { + buffer += chunk; assert(Buffer.byteLength(buffer) <= maxBytes, "Local JSON-RPC output exceeded its bound."); + let newline; + while ((newline = buffer.indexOf("\n")) >= 0) { + const line = buffer.slice(0, newline).trim(); buffer = buffer.slice(newline + 1); + if (line) receive(line); + } + } catch (error) { fail(error); } + }); + child.on("error", fail); child.stdin.on("error", fail); + const stopped = new Promise((resolve) => child.once("close", (code, signal) => { + fail(new Error(`Local Maestro exited: ${code ?? signal}.`)); resolve(); + })); + function request(method, params) { + if (failure || closing) return Promise.reject(failure ?? new Error("Local Maestro is closing.")); + return new Promise((resolve, reject) => { + const id = ++nextId; + const timer = setTimeout(() => fail(new Error(`Local Maestro ${method} timed out.`)), Math.max(1, Math.min(timeoutMs, deadline - Date.now()))); + pending.set(id, { resolve, reject, timer }); + try { send({ jsonrpc: "2.0", id, method, params }); } catch (error) { fail(error); } + }); + } + async function close() { + if (closing) return stopped; + closing = true; fail(new Error("Local Maestro session closed.")); child.stdin.end(); + const controller = new AbortController(); + try { + await Promise.race([stopped, delay(60000, undefined, { signal: controller.signal }).then(() => { + child.kill("SIGKILL"); throw new Error("Local Maestro did not close within 60 seconds."); + })]); + } finally { controller.abort(); } + } + return { request, notify: (method) => send({ jsonrpc: "2.0", method }), close }; +} + +const localTools = new Set(["list_devices", "inspect_screen", "run"]); +export async function localMaestro({ cwd, env, onStderr, deadline, start = spawn }) { + const child = start("maestro", ["mcp", "--no-viewer", "--working-dir", cwd], { cwd, env, stdio: ["pipe", "pipe", "pipe"] }); + // Collect sanitized diagnostics at the caller; do not mix stderr into the protocol channel. + child.stderr.setEncoding("utf8"); child.stderr.on("data", onStderr); + const client = rpcClient(child, { deadline }); + try { + const hello = await client.request("initialize", { protocolVersion: "2024-11-05", capabilities: {}, clientInfo: { name: "native-qualification", version: "1" } }); + assert.equal(hello.serverInfo?.name, "maestro", "Unexpected local automation server."); + assert(["2024-11-05", "2025-03-26", "2025-06-18"].includes(hello.protocolVersion), "Unsupported local protocol version."); + client.notify("notifications/initialized"); + } catch (error) { await client.close(); throw error; } + async function call(name, args = {}) { + assert(localTools.has(name), "Only local native qualification tools are permitted."); + const result = await client.request("tools/call", { name, arguments: args }); + if (result.isError) { + onStderr(`\nLocal ${name} error: ${JSON.stringify(result.content).slice(0, 8192)}\n`); + throw new Error(`Local Maestro ${name} failed; see the retained phase MCP log.`); + } + assert.equal(result.content?.length, 1, "Unexpected local tool response."); + assert.equal(result.content[0].type, "text", "Expected local JSON text."); + return JSON.parse(result.content[0].text); + } + return { call, close: client.close }; +} diff --git a/scripts/ios-native/mcp.test.mjs b/scripts/ios-native/mcp.test.mjs new file mode 100644 index 0000000..2b86d16 --- /dev/null +++ b/scripts/ios-native/mcp.test.mjs @@ -0,0 +1,71 @@ +import assert from "node:assert/strict"; +import { EventEmitter } from "node:events"; +import { PassThrough } from "node:stream"; +import { test } from "node:test"; +import { localMaestro, rpcClient } from "./mcp.mjs"; + +function processFixture(reply = () => {}) { + const child = new EventEmitter(); + child.stdin = new PassThrough(); child.stdout = new PassThrough(); child.stderr = new PassThrough(); + const messages = []; + child.stdin.on("data", (bytes) => { + for (const line of bytes.toString().trim().split("\n")) { const message = JSON.parse(line); messages.push(message); reply(message, child); } + }); + child.stdin.on("finish", () => child.emit("close", 0, null)); + child.kill = () => child.emit("close", null, "SIGKILL"); + return { child, messages }; +} +const respond = (child, id, result) => child.stdout.write(JSON.stringify({ jsonrpc: "2.0", id, result }) + "\n"); + +test("local RPC supports fragmented UTF-8 replies, notifications and rejects server actions", async () => { + const { child, messages } = processFixture(); + const client = rpcClient(child, { timeoutMs: 1000 }); + const pending = client.request("test", { bounded: true }); + const bytes = Buffer.from(JSON.stringify({ jsonrpc: "2.0", id: 1, result: { word: "café" } }) + "\n"); + for (const byte of bytes) child.stdout.write(Buffer.from([byte])); + assert.deepEqual(await pending, { word: "café" }); + child.stdout.write(JSON.stringify({ jsonrpc: "2.0", method: "unexpected", id: "server-1" }) + "\n"); + assert.equal(messages.at(-1).error.code, -32601); + client.notify("notifications/initialized"); assert.equal(messages.at(-1).method, "notifications/initialized"); + await client.close(); await assert.rejects(client.request("closed", {})); +}); +test("local RPC fails closed on malformed, oversized, timed-out and exited sessions", async () => { + for (const payload of ["not json\n", JSON.stringify({ jsonrpc: "1.0", id: 1, result: {} }) + "\n", "x".repeat(1025)]) { + const { child } = processFixture(); const client = rpcClient(child, { timeoutMs: 1000, maxBytes: 1024 }); + const result = client.request("test", {}); child.stdout.write(payload); + await assert.rejects(result); await assert.rejects(client.request("again", {})); await client.close(); + } + const { child } = processFixture(); const client = rpcClient(child, { timeoutMs: 5 }); + await assert.rejects(client.request("test", {}), /timed out/); await client.close(); + const ended = processFixture(); const exited = rpcClient(ended.child); + const pending = exited.request("test", {}); ended.child.emit("close", 7, null); + await assert.rejects(pending, /exited: 7/); await exited.close(); +}); +test("local server handshake, selected JSON result and local-only tool allowlist", async () => { + const fixture = processFixture((message, child) => { + if (message.method === "initialize") respond(child, message.id, { serverInfo: { name: "maestro" }, protocolVersion: "2024-11-05" }); + if (message.method === "tools/call") respond(child, message.id, { content: [{ type: "text", text: JSON.stringify({ devices: [] }) }] }); + }); + const stderr = []; + const client = await localMaestro({ cwd: "/owned", env: {}, onStderr: (text) => stderr.push(text), start: (exe, args, options) => { + assert.equal(exe, "maestro"); assert.deepEqual(args, ["mcp", "--no-viewer", "--working-dir", "/owned"]); + assert.equal(options.cwd, "/owned"); return fixture.child; + } }); + fixture.child.stderr.write("diagnostic"); assert.deepEqual(stderr, ["diagnostic"]); + assert.deepEqual(await client.call("list_devices"), { devices: [] }); + const count = fixture.messages.length; + await assert.rejects(client.call("run_on_cloud", {}), /Only local/); + assert.equal(fixture.messages.length, count); await client.close(); +}); +test("unknown server and error tool result cannot establish successful qualification", async () => { + const wrong = processFixture((message, child) => { + if (message.method === "initialize") respond(child, message.id, { serverInfo: { name: "unknown" }, protocolVersion: "2024-11-05" }); + }); + await assert.rejects(localMaestro({ cwd: "/owned", env: {}, onStderr: () => {}, start: () => wrong.child }), /Unexpected local/); + const fixture = processFixture((message, child) => { + if (message.method === "initialize") respond(child, message.id, { serverInfo: { name: "maestro" }, protocolVersion: "2024-11-05" }); + if (message.method === "tools/call") respond(child, message.id, { isError: true, content: [{ type: "text", text: "failure" }] }); + }); + const client = await localMaestro({ cwd: "/owned", env: {}, onStderr: () => {}, start: () => fixture.child }); + await assert.rejects(client.call("run", { yaml: "invalid" }), /run failed/); await client.close(); +}); diff --git a/scripts/ios-native/privacy.mjs b/scripts/ios-native/privacy.mjs new file mode 100644 index 0000000..5aed657 --- /dev/null +++ b/scripts/ios-native/privacy.mjs @@ -0,0 +1,60 @@ +import { createHash } from "node:crypto"; +import { spawnSync } from "node:child_process"; +import { readFileSync, readdirSync, writeFileSync } from "node:fs"; +import { createRequire } from "node:module"; +import { dirname, join } from "node:path"; +import { isDeepStrictEqual } from "node:util"; + +export function privacyErrors(manifests, upstream) { + const errors = []; + const sdk = manifests.find((item) => item.path === "ExpoFileSystem_privacy.bundle/PrivacyInfo.xcprivacy"); + if (!sdk) errors.push("Expo FileSystem privacy manifest is missing from its built resource bundle."); + else if (!isDeepStrictEqual(sdk.fields, upstream)) errors.push("Built Expo FileSystem privacy declarations differ from the locked SDK source."); + const aggregate = manifests.find((item) => item.path === "PrivacyInfo.xcprivacy"); + for (const api of upstream.NSPrivacyAccessedAPITypes ?? []) { + const declared = aggregate?.fields.NSPrivacyAccessedAPITypes?.find((item) => item.NSPrivacyAccessedAPIType === api.NSPrivacyAccessedAPIType); + for (const reason of api.NSPrivacyAccessedAPITypeReasons ?? []) { + if (!declared?.NSPrivacyAccessedAPITypeReasons?.includes(reason)) errors.push(`Aggregate lacks ${api.NSPrivacyAccessedAPIType} reason ${reason}.`); + } + } + return errors; +} + +function manifestPaths(directory, prefix = "") { + return readdirSync(directory, { withFileTypes: true }).flatMap((entry) => { + const relative = prefix + entry.name; + if (entry.isSymbolicLink()) throw new Error(`Inspect unexpected native bundle symlink before qualification: ${relative}`); + if (entry.isDirectory()) return manifestPaths(join(directory, entry.name), relative + "/"); + return entry.isFile() && entry.name === "PrivacyInfo.xcprivacy" ? [relative] : []; + }); +} + +function readPlist(path) { + const result = spawnSync("/usr/bin/plutil", ["-convert", "json", "-o", "-", path], { encoding: "utf8", timeout: 30000, maxBuffer: 1024 * 1024 }); + if (result.error) throw result.error; + if (result.status !== 0) throw new Error(`Cannot inspect property list: ${path}`); + return JSON.parse(result.stdout); +} + +export function inspectNativePrivacy(app, appRoot, output) { + const require = createRequire(join(appRoot, "package.json")); + const expoRequire = createRequire(require.resolve("expo/package.json")); + const sdkRoot = dirname(expoRequire.resolve("expo-file-system/package.json")); + const source = join(sdkRoot, "ios/PrivacyInfo.xcprivacy"); + const digest = (path) => createHash("sha256").update(readFileSync(path)).digest("hex"); + const manifests = manifestPaths(app).sort().map((path) => ({ path, sha256: digest(join(app, path)), fields: readPlist(join(app, path)) })); + const upstream = readPlist(source); + const info = readPlist(join(app, "Info.plist")); + const report = { + kind: "static-native-privacy-inspection", manifests, + sdk: { package: "expo-file-system", version: JSON.parse(readFileSync(join(sdkRoot, "package.json"), "utf8")).version, sourceSha256: digest(source), fields: upstream }, + purposeStrings: Object.fromEntries(Object.entries(info).filter(([key]) => key.endsWith("UsageDescription"))), + transportSecurity: info.NSAppTransportSecurity ?? null, + encryptionDeclaration: info.ITSAppUsesNonExemptEncryption ?? null, + expoUpdates: readPlist(join(app, "Expo.plist")), + errors: privacyErrors(manifests, upstream), + limits: ["Not a measurement of network traffic", "Not a signed-archive or SDK-signature audit", "Not App Store privacy or export-compliance approval"], + }; + writeFileSync(join(output, "privacy-inspection.json"), JSON.stringify(report, null, 2) + "\n"); + return report; +} diff --git a/scripts/ios-native/privacy.test.mjs b/scripts/ios-native/privacy.test.mjs new file mode 100644 index 0000000..a707457 --- /dev/null +++ b/scripts/ios-native/privacy.test.mjs @@ -0,0 +1,36 @@ +import assert from "node:assert/strict"; +import { readFileSync } from "node:fs"; +import { test } from "node:test"; +import { privacyErrors } from "./privacy.mjs"; + +const upstream = { NSPrivacyTracking: false, NSPrivacyCollectedDataTypes: [], NSPrivacyAccessedAPITypes: [ + { NSPrivacyAccessedAPIType: "NSPrivacyAccessedAPICategoryDiskSpace", NSPrivacyAccessedAPITypeReasons: ["E174.1", "85F4.1"] }, +] }; +const complete = () => [ + { path: "PrivacyInfo.xcprivacy", fields: structuredClone(upstream) }, + { path: "ExpoFileSystem_privacy.bundle/PrivacyInfo.xcprivacy", fields: structuredClone(upstream) }, +]; + +test("native privacy check accepts matching SDK and aggregate declarations without asserting legal approval", () => { + assert.deepEqual(privacyErrors(complete(), upstream), []); +}); + +test("an empty SDK resource bundle cannot pass because another manifest covers the same API", () => { + assert.match(privacyErrors(complete().slice(0, 1), upstream).join("\n"), /missing from its built resource bundle/); +}); + +test("SDK drift and incomplete aggregate reasons remain errors", () => { + const manifests = complete(); + manifests[1].fields.NSPrivacyTracking = true; + manifests[0].fields.NSPrivacyAccessedAPITypes[0].NSPrivacyAccessedAPITypeReasons.pop(); + const errors = privacyErrors(manifests, upstream); + assert.equal(errors.length, 2); + assert.match(errors[0], /differ from the locked SDK/); + assert.match(errors[1], /85F4.1/); + assert.equal(privacyErrors([], upstream).length, 3); +}); + +test("Expo FileSystem opts out of the precompiled package that omitted its manifest", () => { + const pkg = JSON.parse(readFileSync(new URL("../../apps/mobile/package.json", import.meta.url), "utf8")); + assert.deepEqual(pkg.expo?.autolinking?.ios?.buildFromSource, ["expo-file-system"]); +}); diff --git a/scripts/ios-native/run.mjs b/scripts/ios-native/run.mjs new file mode 100644 index 0000000..e82f437 --- /dev/null +++ b/scripts/ios-native/run.mjs @@ -0,0 +1,188 @@ +import assert from "node:assert/strict"; +import { spawn, spawnSync } from "node:child_process"; +import { createHash } from "node:crypto"; +import { appendFileSync, closeSync, existsSync, mkdirSync, openSync, readFileSync, writeFileSync } from "node:fs"; +import { join, resolve } from "node:path"; +import { setTimeout as delay } from "node:timers/promises"; +import { getScorecardCategories } from "../../packages/game-engine/src/presentation.ts"; +import { decodeSave } from "../../apps/mobile/src/local/save.ts"; +import { corruptFlow, emptyRelaunchFlow, scenarios, GROUPS, scenariosForGroup } from "./flows.mjs"; +import { nativeInteraction } from "./interaction.mjs"; +import { exerciseScenario } from "./scenario.mjs"; +import { buildSimulator } from "./build.mjs"; +import { loadBuiltSimulator } from "./artifact.mjs"; +import { retainDriverLogs } from "./driverLogs.mjs"; +import { snapshotEvidence } from "./snapshot.mjs"; + +assert.equal(process.platform, "darwin", "Native qualification requires macOS, Xcode and iOS simulators."); +assert(["arm64", "x64"].includes(process.arch), "Unsupported simulator host architecture."); +const architecture = process.arch === "arm64" ? "arm64" : "x86_64"; +const args = process.argv.slice(2); +assert(args.every((arg) => ["--build-only", "--refresh-pods", ...GROUPS.map((group) => `--test-group=${group}`)].includes(arg)), "Unknown native qualification argument."); +const groupArgs = args.filter((arg) => arg.startsWith("--test-group=")); assert(groupArgs.length <= 1); +const group = groupArgs[0]?.slice("--test-group=".length); +const refreshPodLock = args.includes("--refresh-pods"); +const buildOnly = args.includes("--build-only") || refreshPodLock; +assert(!(group && buildOnly), "Build and test-only modes cannot be combined."); +const selectedScenarios = group ? scenariosForGroup(group) : scenarios; +const root = resolve(import.meta.dirname, "../.."); +const output = join(root, "reports/native"); +const publishedOutput = join(root, "reports/native-evidence"); +assert(!existsSync(output) && !existsSync(publishedOutput), "Use a fresh checkout. Existing native evidence was not overwritten."); +mkdirSync(output, { recursive: true }); +const env = { ...process.env, DEVELOPER_DIR: "/Applications/Xcode_26.6.app/Contents/Developer", EXPO_NO_TELEMETRY: "1", + MAESTRO_CLI_NO_ANALYTICS: "true", MAESTRO_DISABLE_UPDATE_CHECK: "true", MAESTRO_CLI_ANALYSIS_NOTIFICATION_DISABLED: "true", MAESTRO_DRIVER_STARTUP_TIMEOUT: "300000" }; +const hash = (bytes) => createHash("sha256").update(bytes).digest("hex"); +const json = (path, value) => writeFileSync(path, JSON.stringify(value, null, 2) + "\n"); +function run(executable, commandArgs, { cwd = root, capture = false, timeout = 1800000, log = "commands.log" } = {}) { + console.log(`$ ${executable} ${commandArgs.join(" ")}`); + const fd = openSync(join(output, log), "a"); + let result; + try { result = spawnSync(executable, commandArgs, { cwd, env, encoding: "utf8", timeout, killSignal: "SIGKILL", maxBuffer: 16 * 1024 * 1024, stdio: ["ignore", capture ? "pipe" : fd, fd] }); } + finally { closeSync(fd); } + if (capture && result.stdout) appendFileSync(join(output, log), result.stdout); + if (result.error) throw result.error; + assert.equal(result.status, 0, `${executable} failed with ${result.status}; see ${log}`); + return result.stdout?.trim() ?? ""; +} +const sim = (...commandArgs) => run("xcrun", ["simctl", ...commandArgs], { capture: true, timeout: commandArgs[0] === "bootstatus" ? 600000 : 180000 }); +const receipt = { schemaVersion: 1, kind: buildOnly ? "unsigned-ios-simulator-build" : "unsigned-ios-simulator-tests", status: "running", source: run("git", ["rev-parse", "HEAD"], { capture: true }), + startedAt: new Date().toISOString(), runId: process.env.GITHUB_RUN_ID ?? null, runAttempt: process.env.GITHUB_RUN_ATTEMPT ?? null, + runnerImage: process.env.ImageVersion ?? null, architecture, group: group ?? null, scenarios: [], + limits: ["Not a signed device archive", "Not TestFlight or physical-device evidence", "No airplane-mode or VoiceOver acceptance claim", "Public identity and release approvals remain unset", "Raw hidden debug trees are excluded; selected driver logs are sanitized and retained"] }; +const checkpoint = () => json(join(output, "manifest.json"), receipt); +checkpoint(); +const ownedDevices = []; +let recording = null; +async function stopRecording() { + if (!recording) return; + const child = recording; recording = null; + if (child.exitCode !== null) { assert.equal(child.exitCode, 0, "Simulator recording exited with an error."); return; } + const stopped = new Promise((done) => child.once("close", done)); + const controller = new AbortController(); + child.kill("SIGINT"); + try { await Promise.race([stopped, delay(15000, undefined, { signal: controller.signal }).then(() => { child.kill("SIGKILL"); throw new Error("Simulator recording did not stop."); })]); } + finally { controller.abort(); } +} +function flow(device, directory, name, content) { + const file = join(directory, `${name}.yaml`); writeFileSync(file, content); + const debug = join(directory, `${name}-debug`); + try { + run("maestro", ["--device", device, "test", "--test-output-dir", join(directory, name), "--debug-output", debug, + "--format", "JUNIT", "--output", join(directory, `${name}.xml`), file], { timeout: 600000, log: `${name}-${directory.split(/[\\/]/).at(-1)}.log` }); + } finally { retainDriverLogs(debug, directory, name, env); } +} +function saved(device, bundleId, directory, stage) { + const container = sim("get_app_container", device, bundleId, "data"); + const database = join(container, "Documents/SQLite/hemsoft-local-dice.db"); + const rows = JSON.parse(run("sqlite3", ["-readonly", "-json", database, "SELECT value FROM local_save WHERE key = 'hemsoft-local-dice-v1'"], { capture: true })); + assert.equal(rows.length, 1); + const bytes = rows[0].value; + const data = decodeSave(bytes); + writeFileSync(join(directory, `${stage}-save.json`), bytes + "\n"); + return { bytes, data, database }; +} +function corruption(device, bundleId) { + const directory = join(output, "corrupt-save"); mkdirSync(directory); + const current = saved(device, bundleId, directory, "before-corruption"); sim("terminate", device, bundleId); + run("sqlite3", [current.database, "UPDATE local_save SET value = 'damaged-save'"], { capture: true }); + flow(device, directory, "corrupt", corruptFlow(bundleId)); + assert.equal(run("sqlite3", ["-readonly", current.database, "SELECT value FROM local_save"], { capture: true }), "damaged-save"); + flow(device, directory, "reset", corruptFlow(bundleId, true)); + assert(!existsSync(current.database), "Confirmed reset must remove the damaged database."); + flow(device, directory, "reset-relaunch", emptyRelaunchFlow(bundleId)); + const reset = saved(device, bundleId, directory, "after-reset"); assert.equal(reset.data.active, null); assert.equal(reset.data.history.entries.length, 0); + sim("terminate", device, bundleId); + run("sqlite3", [reset.database, "PRAGMA wal_checkpoint(TRUNCATE)"], { capture: true }); + const damaged = Buffer.from("Native database corruption fixture. Preserve until explicit reset."); + writeFileSync(reset.database, damaged); + flow(device, directory, "corrupt-database", corruptFlow(bundleId)); + assert.deepEqual(readFileSync(reset.database), damaged); + flow(device, directory, "reset-database", corruptFlow(bundleId, true)); + assert(!existsSync(reset.database), "Confirmed reset must remove the damaged database."); + flow(device, directory, "reset-database-relaunch", emptyRelaunchFlow(bundleId)); + assert.equal(saved(device, bundleId, directory, "after-database-reset").data.history.entries.length, 0); + receipt.nativeCorruptionAndReset = "passed"; +} +async function exercise(app, bundleId) { + const runtime = "com.apple.CoreSimulator.SimRuntime.iOS-26-5"; + const types = JSON.parse(sim("list", "devicetypes", "--json")).devicetypes; + const devices = new Map(); + for (const name of new Set(selectedScenarios.map((scenario) => scenario.device))) { + const type = types.find((item) => item.name === name); assert(type, `Missing simulator type ${name}`); + const device = sim("create", `Dice-${process.pid}-${name}`, type.identifier, runtime); ownedDevices.push(device); devices.set(name, device); + } + let booted = null; + for (const [index, scenario] of selectedScenarios.entries()) { + const device = devices.get(scenario.device); + receipt.phase = `prepare-${scenario.id}`; checkpoint(); + if (booted !== device) { + if (booted) sim("shutdown", booted); + sim("boot", device); sim("bootstatus", device, "-b"); booted = device; + sim("spawn", device, "defaults", "write", "NSGlobalDomain", "AppleLanguages", "-array", "en"); + sim("spawn", device, "defaults", "write", "NSGlobalDomain", "AppleLocale", "-string", "en_US"); + sim("install", device, app); + } + sim("ui", device, "appearance", scenario.appearance); + sim("ui", device, "content_size", scenario.largeText ? "accessibility-extra-extra-extra-large" : "large"); + sim("status_bar", device, "override", "--time", "9:41", "--batteryState", "charged", "--batteryLevel", "100"); + const directory = join(output, scenario.id); mkdirSync(directory, { recursive: true }); + const result = { ...scenario, udid: device, runtime, locale: "en-US", status: "running" }; receipt.scenarios.push(result); + receipt.phase = `start-${scenario.id}`; checkpoint(); + if (index === 0) recording = spawn("xcrun", ["simctl", "io", device, "recordVideo", "--codec=h264", join(directory, "native-resume.mp4")], { env, stdio: "ignore" }); + let resumedBytes; + await nativeInteraction({ device, bundleId, directory, prefix: "scenario", env, + capture: (name) => sim("io", device, "screenshot", join(directory, `${name}.png`)), + exercise: async (io) => { + resumedBytes = await exerciseScenario({ bundleId, scenario, io, + categories: getScorecardCategories(scenario.dice).map((category) => category.id), + readSave: (stage) => saved(device, bundleId, directory, stage), + terminate: () => sim("terminate", device, bundleId), + phase: (name) => { receipt.phase = `${name}-${scenario.id}`; checkpoint(); } }); + } }); + await stopRecording(); + result.status = "passed"; result.resumeDocumentSha256 = hash(resumedBytes); checkpoint(); + } + if (!group || group === "tablet-10") { receipt.phase = "corruption-and-reset"; checkpoint(); corruption(booted, bundleId); } + assert.equal(receipt.scenarios.length, selectedScenarios.length); + assert(receipt.scenarios.every((scenario) => scenario.status === "passed")); +} +try { + assert.equal(run("git", ["status", "--porcelain"], { capture: true }), "", "Use a clean source checkout."); + receipt.toolchain = { + xcode: run("xcodebuild", ["-version"], { capture: true }), sdk: run("xcrun", ["--sdk", "iphonesimulator", "--show-sdk-version"], { capture: true }), + node: run("node", ["--version"], { capture: true }), bun: run("bun", ["--version"], { capture: true }), + cocoapods: run("pod", ["--version"], { capture: true }), ruby: run("ruby", ["--version"], { capture: true }), + maestro: buildOnly ? null : run("maestro", ["--version"], { capture: true }), + }; + assert.match(receipt.toolchain.xcode, /^Xcode 26\.6\nBuild version 17F113$/); + assert.equal(receipt.toolchain.sdk, "26.5"); assert.equal(receipt.toolchain.node, "v24.12.0"); + assert.equal(receipt.toolchain.bun, "1.4.2"); assert.equal(receipt.toolchain.cocoapods, "1.17.0"); + if (!buildOnly) assert.match(receipt.toolchain.maestro, /2\.10\.0/); + receipt.bunLockSha256 = hash(readFileSync(join(root, "bun.lock"))); + receipt.phase = group ? "verify-built-app" : "build"; checkpoint(); + const context = { root, output, run, hash, receipt, architecture, refreshPodLock }; + const { app, bundleId } = group ? loadBuiltSimulator(context) : buildSimulator(context); + checkpoint(); + if (!buildOnly) await exercise(app, bundleId); + receipt.phase = "complete"; receipt.status = "passed"; +} catch (error) { + receipt.status = "failed"; receipt.error = error instanceof Error ? error.message : String(error); process.exitCode = 1; + for (const scenario of receipt.scenarios) if (scenario.status === "running") scenario.status = "failed"; + const failed = receipt.scenarios.at(-1); + if (failed && receipt.app) { + try { saved(failed.udid, receipt.app.bundleId, join(output, failed.id), "failure"); } + catch (snapshotError) { receipt.failureSaveError = String(snapshotError); } + } + console.error(receipt.error); +} finally { + try { await stopRecording(); } catch (error) { receipt.recordingError = String(error); receipt.status = "failed"; process.exitCode = 1; } + for (const device of ownedDevices) { + // Only devices created by this process are shut down or deleted. + spawnSync("xcrun", ["simctl", "shutdown", device], { env, stdio: "ignore", timeout: 60000, killSignal: "SIGKILL" }); + const removed = spawnSync("xcrun", ["simctl", "delete", device], { env, stdio: "ignore", timeout: 60000, killSignal: "SIGKILL" }); + if (removed.status !== 0) { (receipt.cleanupErrors ??= []).push(device); receipt.status = "failed"; process.exitCode = 1; } + } + receipt.finishedAt = new Date().toISOString(); checkpoint(); + snapshotEvidence(output, publishedOutput, receipt); +} diff --git a/scripts/ios-native/scenario.mjs b/scripts/ios-native/scenario.mjs new file mode 100644 index 0000000..a137247 --- /dev/null +++ b/scripts/ios-native/scenario.mjs @@ -0,0 +1,28 @@ +import assert from "node:assert/strict"; +import { startFlow, resumeFlow, completeStartFlow, completeEndFlow } from "./flows.mjs"; +import { holdAndReroll } from "./dice.mjs"; +import { scoreCategories } from "./scoring.mjs"; + +/** Keep one driver across navigation phases, but still cold-relaunch the app itself. */ +export async function exerciseScenario({ bundleId, scenario, categories, readSave, terminate, phase, io }) { + phase("start"); await io.runFlow(startFlow(bundleId, scenario)); + phase("hold"); await holdAndReroll({ ...io, readSave: async (stage) => (await readSave(stage)).data }); + const before = await readSave("before-relaunch"); + assert.equal(before.data.active.game.diceCount, scenario.dice); + assert.equal(before.data.active.game.players.length, scenario.ai + 1); + assert.deepEqual(before.data.active.game.held, [0]); assert.equal(before.data.active.game.rollsLeft, 1); + await terminate(); + phase("resume"); await io.runFlow(resumeFlow(bundleId)); + const after = await readSave("after-relaunch"); assert.equal(after.bytes, before.bytes, "Cold relaunch changed the saved document."); + if (!scenario.largeText) { + phase("complete"); + const preview = ["phone-5-solo-light", "tablet-8-solo-light"].includes(scenario.id); + await io.runFlow(completeStartFlow(bundleId)); + await scoreCategories({ categories, ...io }); + await io.runFlow(completeEndFlow(bundleId, preview)); + const completed = await readSave("completed"); + assert.equal(completed.data.active, null); assert.equal(completed.data.history.entries.length, 1); + assert.equal(completed.data.highScores.entries.length, scenario.ai + 1); + } + return before.bytes; +} diff --git a/scripts/ios-native/scenario.test.mjs b/scripts/ios-native/scenario.test.mjs new file mode 100644 index 0000000..65d084a --- /dev/null +++ b/scripts/ios-native/scenario.test.mjs @@ -0,0 +1,79 @@ +import assert from "node:assert/strict"; +import test from "node:test"; +import { exerciseScenario } from "./scenario.mjs"; + +function harness({ changedResume = false, missingCompletion = false, failedHold = false } = {}) { + const scenario = { id: "tablet-8-solo-light", ai: 0, dice: 8, orientation: "PORTRAIT" }; + let data = { active: { revision: 0, game: { diceCount: 8, players: [{}], dice: [3, 5, 4, 1, 6, 2, 2, 6], held: [], rollsLeft: 2 } }, history: { entries: [] }, highScores: { entries: [] } }; + let finished = false, recorded = false, terminated = 0; + const phases = [], stages = [], flows = [], taps = []; + const screen = () => ({ ui_schema: { platform: "ios", defaults: { enabled: true } }, elements: finished ? [ + { b: "[0,0][1032,1376]", a11y: "Game Over!" }, + ] : [{ rid: "play-viewport", b: "[0,134][1032,1356]", c: [ + { rid: "dice-viewport", b: "[0,134][340,1288]", c: [{ rid: "die-0", b: "[40,328][96,408]", val: data.active.game.held.length ? "checkbox, checked, Held" : "checkbox, unchecked, Not held" }] }, + { rid: "reroll-action", b: "[20,1296][320,1344]", a11y: `Re-roll (${data.active.game.rollsLeft})` }, + { rid: "score-viewport", b: "[340,134][1032,1356]", c: [ + { rid: "score-ones", b: "[360,234][1012,290]", a11y: recorded ? "Ones, 0 points recorded" : "Ones, 0 points", enabled: !recorded }, + { rid: "score-chance", b: "[360,300][1012,356]", a11y: "Chance, 0 points" }, + ] }, + ] }] }); + return { phases, stages, flows, taps, terminated: () => terminated, + options: { bundleId: "fixture.app", scenario, categories: ["ones", "chance"], phase: (name) => phases.push(name), + terminate: async () => { terminated++; }, + readSave: async (stage) => { + stages.push(stage); + if (changedResume && stage === "after-relaunch") return { data: structuredClone(data), bytes: "changed bytes" }; + return { data: structuredClone(data), bytes: JSON.stringify(data) }; + }, + io: { inspect: async () => screen(), capture: async () => {}, record: () => {}, + runFlow: async (yaml) => { + flows.push(yaml); + if (yaml.includes('"Play Again"')) { + assert(finished); + if (!missingCompletion) data = { active: null, history: { entries: [{}] }, highScores: { entries: [{}] } }; + } + }, + run: async (commands) => { + const tap = commands[0].tapOn; if (!tap) return; + assert.equal(tap.retryTapIfNoChange, false); taps.push(tap.id); + if (tap.id === "die-0") { if (!failedHold) { data.active.game.held = [0]; data.active.revision++; } } + else if (tap.id === "reroll-action") { data.active.game.rollsLeft = 1; data.active.revision++; } + else if (tap.id === "score-ones") recorded = true; + else if (tap.id === "score-chance") finished = true; + else assert.fail("Unexpected state-changing tap"); + }, + }, + }, + }; +} +test("one scenario preserves real cold relaunch, exact document and complete-game effects", async () => { + const flow = harness(); const bytes = await exerciseScenario(flow.options); + assert.equal(flow.terminated(), 1); + assert.deepEqual(flow.phases, ["start", "hold", "resume", "complete"]); + assert.deepEqual(flow.taps, ["die-0", "reroll-action", "score-ones", "score-chance"]); + assert.deepEqual(flow.stages, ["before-hold", "after-hold", "after-reroll", "before-relaunch", "after-relaunch", "completed"]); + assert.equal(flow.flows.length, 4); + assert(flow.flows.at(-1).includes("diagnostics-preview")); + assert.equal(JSON.parse(bytes).active.game.held[0], 0); +}); +test("largest-text scenarios still hold, reroll and resume without claiming a complete game", async () => { + const flow = harness(); flow.options.scenario.largeText = true; + await exerciseScenario(flow.options); + assert.equal(flow.terminated(), 1); assert.deepEqual(flow.phases, ["start", "hold", "resume"]); + assert.deepEqual(flow.taps, ["die-0", "reroll-action"]); assert.equal(flow.flows.length, 2); +}); +test("missing hold acknowledgment never reaches reroll or a cold relaunch", async () => { + const flow = harness({ failedHold: true }); + await assert.rejects(exerciseScenario(flow.options), /not acknowledged/); + assert.deepEqual(flow.taps, ["die-0"]); assert.equal(flow.terminated(), 0); +}); +test("changed saved bytes after relaunch stop before any scoring", async () => { + const flow = harness({ changedResume: true }); + await assert.rejects(exerciseScenario(flow.options), /Cold relaunch changed/); + assert.deepEqual(flow.taps, ["die-0", "reroll-action"]); +}); +test("navigation success cannot stand in for the persisted completion and Play Again effects", async () => { + const flow = harness({ missingCompletion: true }); + await assert.rejects(exerciseScenario(flow.options)); + assert.deepEqual(flow.taps, ["die-0", "reroll-action", "score-ones", "score-chance"]); +}); diff --git a/scripts/ios-native/scoring.mjs b/scripts/ios-native/scoring.mjs new file mode 100644 index 0000000..e3b0675 --- /dev/null +++ b/scripts/ios-native/scoring.mjs @@ -0,0 +1,26 @@ +import assert from "node:assert/strict"; +import { scorePosition, assertRecorded, screenElements } from "./geometry.mjs"; + +export async function scoreCategories({ categories, inspect, run, capture, record }) { + assert(categories.length > 0 && categories.length <= 20 && new Set(categories).size === categories.length); + await run([{ launchApp: { stopApp: false, clearState: false, permissions: { all: "deny" } } }]); + for (const [index, id] of categories.entries()) { + assert(/^[a-z][a-z0-9-]*$/.test(id), "Invalid score identifier."); + let ready = false; + for (let attempt = 0; attempt < 30; attempt++) { + await run([{ waitForAnimationToEnd: { timeout: 5000 } }]); + const decision = scorePosition(await inspect(), id, categories); record({ index, attempt, ...decision }); + if (decision.action === "tap") { ready = true; break; } + if (decision.action === "swipe") await run([{ swipe: { start: decision.start, end: decision.end, duration: decision.duration } }]); + } + assert(ready, `Score ${id} did not become reachable within 30 inspections.`); + await capture(`score-${id}-ready`); + const last = index === categories.length - 1; + await run([{ tapOn: { id: `score-${id}`, enabled: true, retryTapIfNoChange: false } }, + { extendedWaitUntil: { visible: last ? { text: "Game Over!" } : { id: `score-${id}`, text: ".* points recorded.*" }, timeout: 15000 } }]); + const after = await inspect(); + if (last) assert(screenElements(after).some((node) => node.a11y === "Game Over!" || node.txt === "Game Over!"), "Native game did not finish."); + else assertRecorded(after, id); + record({ index, id, action: "acknowledged", last }); + } +} diff --git a/scripts/ios-native/snapshot.mjs b/scripts/ios-native/snapshot.mjs new file mode 100644 index 0000000..8ea6cbb --- /dev/null +++ b/scripts/ios-native/snapshot.mjs @@ -0,0 +1,45 @@ +import assert from "node:assert/strict"; +import { createHash } from "node:crypto"; +import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs"; +import { dirname, join, resolve } from "node:path"; +import { pathToFileURL } from "node:url"; + +/** Detached XCTest writers may outlive Maestro. Upload immutable copies, not their live log paths. */ +export function snapshotEvidence(input, output, receipt) { + assert(!existsSync(output), "Existing published native evidence was not overwritten."); + mkdirSync(output, { recursive: true }); + const artifacts = []; + function copy(directory, prefix = "") { + for (const entry of readdirSync(directory, { withFileTypes: true })) { + if (entry.name.startsWith(".")) continue; + const path = prefix + entry.name; + if (entry.isDirectory()) { copy(join(directory, entry.name), path + "/"); continue; } + if (!entry.isFile() || path === "manifest.json") continue; + // Size and hash come from the same read, even if the source keeps growing. + const bytes = readFileSync(join(directory, entry.name)); + const destination = join(output, path); + mkdirSync(dirname(destination), { recursive: true }); writeFileSync(destination, bytes); + artifacts.push({ path, bytes: bytes.length, sha256: createHash("sha256").update(bytes).digest("hex") }); + } + } + copy(input); + const published = { ...receipt, evidenceSnapshotAt: new Date().toISOString(), artifacts }; + writeFileSync(join(output, "manifest.json"), JSON.stringify(published, null, 2) + "\n"); + return published; +} +function main() { + const root = resolve(import.meta.dirname, "../.."); + const input = join(root, "reports/native"); const output = join(root, "reports/native-evidence"); + if (existsSync(output)) { + assert(existsSync(join(output, "manifest.json")), "Published evidence is incomplete; existing files were not overwritten."); + console.log("Native evidence is already frozen."); return; + } + const manifest = join(input, "manifest.json"); + if (!existsSync(manifest)) { console.log("Native qualification did not create a receipt."); return; } + const receipt = JSON.parse(readFileSync(manifest, "utf8")); + if (receipt.status === "running") { + receipt.status = "failed"; receipt.error = "Native process ended before finalizing evidence."; + } + snapshotEvidence(input, output, receipt); +} +if (process.argv[1] && import.meta.url === pathToFileURL(resolve(process.argv[1])).href) main(); diff --git a/scripts/ios-native/snapshot.test.mjs b/scripts/ios-native/snapshot.test.mjs new file mode 100644 index 0000000..f1f022f --- /dev/null +++ b/scripts/ios-native/snapshot.test.mjs @@ -0,0 +1,26 @@ +import assert from "node:assert/strict"; +import { createHash } from "node:crypto"; +import { mkdtempSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { test } from "node:test"; +import { snapshotEvidence } from "./snapshot.mjs"; + +test("late same-size XCTest log rewrites cannot change published evidence or its hash inventory", () => { + const root = mkdtempSync(join(tmpdir(), "native-evidence-")); + try { + const input = join(root, "working"); const output = join(root, "published"); + mkdirSync(join(input, "flow/.maestro"), { recursive: true }); + writeFileSync(join(input, "flow/driver.log"), "initial"); + writeFileSync(join(input, "flow/.maestro/private.log"), "excluded"); + writeFileSync(join(input, "manifest.json"), "working checkpoint"); + const receipt = snapshotEvidence(input, output, { schemaVersion: 1, status: "failed", source: "test-source" }); + writeFileSync(join(input, "flow/driver.log"), "changed"); + assert.equal(readFileSync(join(output, "flow/driver.log"), "utf8"), "initial"); + assert.deepEqual(receipt.artifacts, [{ path: "flow/driver.log", bytes: 7, sha256: createHash("sha256").update("initial").digest("hex") }]); + assert.deepEqual(readdirSync(join(output, "flow")), ["driver.log"]); + assert.equal(JSON.parse(readFileSync(join(output, "manifest.json"))).status, "failed"); + assert.throws(() => snapshotEvidence(input, output, {}), /not overwritten/); + assert.equal(readFileSync(join(output, "flow/driver.log"), "utf8"), "initial"); + } finally { rmSync(root, { recursive: true, force: true }); } +}); diff --git a/tests/clients/fixtures.ts b/tests/clients/fixtures.ts new file mode 100644 index 0000000..0953f55 --- /dev/null +++ b/tests/clients/fixtures.ts @@ -0,0 +1,76 @@ +import { test as base, type TestInfo } from "playwright/test"; +import type { ElectronApplication, Page } from "playwright"; +import { createRequire } from "node:module"; +import { join, resolve } from "node:path"; +import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs"; +import { createHash } from "node:crypto"; +import { tmpdir } from "node:os"; +import { execFileSync } from "node:child_process"; +import { expect } from "playwright/test"; +export { expect }; +const require = createRequire(import.meta.url); +export const origin = "http://127.0.0.1:5187"; +export const desktopApplications = new WeakMap(); + +export async function saveCoverage(page: Page, info: TestInfo, stage = "final") { + if (process.env.TEST_COVERAGE !== "1") return; + const data = await page.evaluate(() => (globalThis as typeof globalThis & { __coverage__?: object }).__coverage__); + if (!data || !Object.keys(data).length) throw new Error("Client coverage collection is empty"); + const folder = resolve("reports/quality/raw"); mkdirSync(folder, { recursive: true }); + const id = createHash("sha256").update(info.testId).digest("hex").slice(0, 16); + writeFileSync(resolve(folder, `client-${id}-${stage}.json`), JSON.stringify(data)); + const response = await fetch(`${origin}/coverage`); + if (!response.ok) throw new Error("Backend coverage collection failed"); + writeFileSync(resolve(folder, "backend.json"), JSON.stringify(await response.json())); +} +export const test = base.extend<{ client: Page }>({ + client: async ({ playwright }, runWithPage, info) => { + info.annotations.push({ type: "commit", description: execFileSync("git", ["rev-parse", "HEAD"], { encoding: "utf8" }).trim() }); + info.annotations.push({ type: "dirty", description: String(!!execFileSync("git", ["status", "--porcelain"], { encoding: "utf8" }).trim()) }); + if (info.project.name === "desktop") { + const env: Record = Object.fromEntries(Object.entries(process.env) + .filter((entry): entry is [string, string] => entry[1] !== undefined)); + env.ELECTRON_RENDERER_URL = `${origin}/desktop`; + delete env.ELECTRON_RUN_AS_NODE; + const profile = mkdtempSync(join(tmpdir(), "yahtzee-client-")); + try { + const app = await playwright._electron.launch({ + executablePath: require("../../apps/desktop/node_modules/electron"), + args: [resolve("apps/desktop"), `--user-data-dir=${profile}`], env, + recordVideo: { dir: info.outputPath("videos") }, + }); + try { + const page = await app.firstWindow(); + desktopApplications.set(page, app); + await app.context().tracing.start({ screenshots: true, snapshots: true }); + try { + await page.waitForLoadState(); + expect(await app.evaluate(({ app: application }) => application.getPath("userData"))).toBe(profile); + expect(await page.evaluate(() => (window as Window & { platform?: { name: string } }).platform?.name)).toBe("electron"); + await runWithPage(page); + } finally { + try { await saveCoverage(page, info); } + finally { await app.context().tracing.stop({ path: info.outputPath("trace.zip") }); } + } + } finally { await app.close(); } + } finally { rmSync(profile, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }); } + } else { + const browser = await playwright.chromium.launch(); + try { + const context = await browser.newContext({ + viewport: info.project.name === "web" ? { width: 1280, height: 900 } : { width: 390, height: 844 }, + recordVideo: { dir: info.outputPath("videos") }, + }); + try { + await context.tracing.start({ screenshots: true, snapshots: true }); + const page = await context.newPage(); + try { await runWithPage(page); } + finally { + try { await saveCoverage(page, info); } + finally { await context.tracing.stop({ path: info.outputPath("trace.zip") }); } + } + } finally { await context.close(); } + } finally { await browser.close(); } + } + }, +}); diff --git a/tests/clients/journeys.spec.ts b/tests/clients/journeys.spec.ts index 96f8452..348e8f8 100644 --- a/tests/clients/journeys.spec.ts +++ b/tests/clients/journeys.spec.ts @@ -1,17 +1,7 @@ -import { test as base, expect, type TestInfo } from "playwright/test"; -import type { ElectronApplication, Page } from "playwright"; -import { createRequire } from "node:module"; -import { join, resolve } from "node:path"; -import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs"; -import { createHash } from "node:crypto"; -import { tmpdir } from "node:os"; -import { execFileSync } from "node:child_process"; +import type { Page } from "playwright"; +import { test, expect, origin, desktopApplications } from "./fixtures"; import { getCategories } from "../../packages/game-engine/src/scoring"; -const require = createRequire(import.meta.url); -const origin = "http://127.0.0.1:5187"; -const desktopApplications = new WeakMap(); - async function expectNoDocumentOverflow(page: Page) { const metrics = await page.evaluate(() => ({ clientHeight: document.documentElement.clientHeight, @@ -73,73 +63,9 @@ async function expectMinimumWindowFallback(page: Page) { await page.setViewportSize({ width: 944, height: 685 }); } -async function saveCoverage(page: Page, info: TestInfo) { - if (process.env.TEST_COVERAGE !== "1") return; - const data = await page.evaluate(() => (globalThis as typeof globalThis & { __coverage__?: object }).__coverage__); - if (!data || !Object.keys(data).length) throw new Error("Client coverage collection is empty"); - const folder = resolve("reports/quality/raw"); mkdirSync(folder, { recursive: true }); - const id = createHash("sha256").update(info.testId).digest("hex").slice(0, 16); - writeFileSync(resolve(folder, `client-${id}.json`), JSON.stringify(data)); - const response = await fetch(`${origin}/coverage`); - if (!response.ok) throw new Error("Backend coverage collection failed"); - writeFileSync(resolve(folder, "backend.json"), JSON.stringify(await response.json())); -} -const test = base.extend<{ client: Page }>({ - client: async ({ playwright }, runWithPage, info) => { - info.annotations.push({ type: "commit", description: execFileSync("git", ["rev-parse", "HEAD"], { encoding: "utf8" }).trim() }); - info.annotations.push({ type: "dirty", description: String(!!execFileSync("git", ["status", "--porcelain"], { encoding: "utf8" }).trim()) }); - if (info.project.name === "desktop") { - const env: Record = Object.fromEntries(Object.entries(process.env) - .filter((entry): entry is [string, string] => entry[1] !== undefined)); - env.ELECTRON_RENDERER_URL = `${origin}/desktop`; - delete env.ELECTRON_RUN_AS_NODE; - const profile = mkdtempSync(join(tmpdir(), "yahtzee-client-")); - try { - const app = await playwright._electron.launch({ - executablePath: require("../../apps/desktop/node_modules/electron"), - args: [resolve("apps/desktop"), `--user-data-dir=${profile}`], env, - recordVideo: { dir: info.outputPath("videos") }, - }); - try { - const page = await app.firstWindow(); - desktopApplications.set(page, app); - await app.context().tracing.start({ screenshots: true, snapshots: true }); - try { - await page.waitForLoadState(); - expect(await app.evaluate(({ app: application }) => application.getPath("userData"))).toBe(profile); - expect(await page.evaluate(() => (window as Window & { platform?: { name: string } }).platform?.name)).toBe("electron"); - await runWithPage(page); - } finally { - try { await saveCoverage(page, info); } - finally { await app.context().tracing.stop({ path: info.outputPath("trace.zip") }); } - } - } finally { await app.close(); } - } finally { rmSync(profile, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }); } - } else { - const browser = await playwright.chromium.launch(); - try { - const context = await browser.newContext({ - viewport: info.project.name === "web" ? { width: 1280, height: 900 } : { width: 390, height: 844 }, - recordVideo: { dir: info.outputPath("videos") }, - }); - try { - await context.tracing.start({ screenshots: true, snapshots: true }); - const page = await context.newPage(); - try { await runWithPage(page); } - finally { - try { await saveCoverage(page, info); } - finally { await context.tracing.stop({ path: info.outputPath("trace.zip") }); } - } - } finally { await context.close(); } - } finally { await browser.close(); } - } - }, -}); - for (const diceCount of [5, 6]) { test(`${diceCount} dice: complete, retry, reconnect, play again and cancel`, async ({ client, request }, info) => { - const mobile = info.project.name === "mobile-web-adapter"; - const route = mobile ? "mobile" : info.project.name; + const route = info.project.name; const errors: string[] = []; client.on("pageerror", (error) => errors.push(error.message)); await request.post("/control", { data: { reset: true } }); await client.goto(`${origin}/${route}`); @@ -147,7 +73,7 @@ for (const diceCount of [5, 6]) { const textbox = client.getByRole("textbox"); await textbox.fill(name); await client.getByRole("button", { name: "1 AI", exact: true }).click(); - await client.getByRole("button", { name: mobile ? String(diceCount) : diceCount === 5 ? "Classic (5)" : "Extended (6)", exact: true }).click(); + await client.getByRole("button", { name: diceCount === 5 ? "Classic (5)" : "Extended (6)", exact: true }).click(); if (diceCount === 6) await client.getByRole("button", { name: "Switch to dark mode" }).click(); if (info.project.name === "desktop") await expectNoDocumentOverflow(client); await client.screenshot({ path: info.outputPath("setup.png"), fullPage: true }); @@ -162,12 +88,10 @@ for (const diceCount of [5, 6]) { await expectMinimumWindowFallback(client); await expectNoDocumentOverflow(client); } - if (!mobile) { - const lowerOrder = diceCount === 5 - ? ["One Pair", "Two Pairs", "Three of a Kind", "Four of a Kind", "Full House", "Small Straight", "Large Straight", "Yahtzee", "Chance"] - : ["One Pair", "Two Pairs", "Three Pairs", "Three of a Kind", "Four of a Kind", "Five of a Kind", "Full House", "Castle", "Small Straight", "Large Straight", "Full Straight", "Chance", "Tower", "Maxi Yahtzee"]; - await expect(client.locator(".score-section.lower .yahtzee-score-action")).toHaveText(lowerOrder); - } + const lowerOrder = diceCount === 5 + ? ["One Pair", "Two Pairs", "Three of a Kind", "Four of a Kind", "Full House", "Small Straight", "Large Straight", "Yahtzee", "Chance"] + : ["One Pair", "Two Pairs", "Three Pairs", "Three of a Kind", "Four of a Kind", "Five of a Kind", "Full House", "Castle", "Small Straight", "Large Straight", "Full Straight", "Chance", "Tower", "Maxi Yahtzee"]; + await expect(client.locator(".score-section.lower .yahtzee-score-action")).toHaveText(lowerOrder); const firstDie = client.getByRole("button", { name: /^Die showing / }).first(); const heldValue = await firstDie.getAttribute("aria-label"); await firstDie.click(); @@ -175,7 +99,7 @@ for (const diceCount of [5, 6]) { await client.getByRole("button", { name: "Re-roll (2)", exact: true }).click(); await expect(client.getByRole("button", { name: "Re-roll (1)", exact: true })).toBeEnabled(); expect(await firstDie.getAttribute("aria-label")).toBe(`${heldValue}, held`); - if (!mobile) await expect(firstDie).toHaveAttribute("aria-pressed", "true"); + await expect(firstDie).toHaveAttribute("aria-pressed", "true"); await client.context().setOffline(true); await client.getByRole("button", { name: "Re-roll (1)", exact: true }).click(); @@ -202,7 +126,7 @@ for (const diceCount of [5, 6]) { expect(committed.logs).toHaveLength(1); expect(committed.receiptCount).toBe(2); await client.getByRole("button", { name: "Retry move", exact: true }).click(); await expect(client.getByText("Game Over!", { exact: true })).toBeVisible(); - await expect(client.getByText(`${mobile ? "🏅 " : ""}High Scores (${diceCount} dice)`, { exact: true })).toBeVisible(); + await expect(client.getByText(`High Scores (${diceCount} dice)`, { exact: true })).toBeVisible(); for (const player of committed.logs[0].players) { await expect(client.getByText(`${player.score} pts`, { exact: false }).first()).toBeVisible(); } @@ -218,7 +142,7 @@ for (const diceCount of [5, 6]) { await request.post("/control", { data: { delay: 600 } }); const delayed = client.waitForResponse((response) => response.url().endsWith("/rpc") && response.request().postDataJSON()?.name === "games:move"); await client.getByRole("button", { name: "Re-roll (2)", exact: true }).click(); - await client.getByRole("button", { name: mobile ? "✕ Quit Game" : "Quit Game", exact: true }).click(); + await client.getByRole("button", { name: "Quit Game", exact: true }).click(); await textbox.fill("Replacement guest"); await client.getByRole("button", { name: "Start Game", exact: true }).click(); await expect(client.getByText(/Replacement guest's turn/)).toBeVisible(); diff --git a/tests/clients/mobile.tsx b/tests/clients/mobile.tsx index b88d269..debd5fc 100644 --- a/tests/clients/mobile.tsx +++ b/tests/clients/mobile.tsx @@ -1,4 +1,23 @@ -import React from "react"; +import React, { useState } from "react"; import { createRoot } from "react-dom/client"; -import Index from "../../apps/mobile/app/index"; -createRoot(document.getElementById("root")!).render(); +import { LocalProvider } from "../../apps/mobile/src/local/LocalProvider"; +import { NativeGameScreen } from "../../apps/mobile/src/screens/NativeGameScreen"; +import { History } from "../../apps/mobile/src/screens/History"; +import { Help } from "../../apps/mobile/src/screens/Help"; +import { Action } from "../../apps/mobile/src/ui/controls"; + +// Exercises native screen source through react-native-web, not UIKit navigation. +function Fixture() { + const [screen, setScreen] = useState("play"); + return +
+ setScreen("history")} onHelp={() => setScreen("help")} /> +
+ {screen !== "play" &&
+ setScreen("play")} /> + {screen === "history" ? : } +
} +
; +} +document.body.style.margin = "0"; +createRoot(document.getElementById("root")!).render(); diff --git a/tests/clients/native-safe-area.tsx b/tests/clients/native-safe-area.tsx new file mode 100644 index 0000000..e40c4a8 --- /dev/null +++ b/tests/clients/native-safe-area.tsx @@ -0,0 +1,6 @@ +import React from "react"; +import { View, type ViewProps } from "react-native"; +// Zero-inset browser adapter. It is not evidence of native safe-area behavior. +export function SafeAreaView({ edges: _edges, ...props }: ViewProps & { edges?: string[] }) { + return ; +} diff --git a/tests/clients/native-storage.ts b/tests/clients/native-storage.ts index 4f7f59f..6d48989 100644 --- a/tests/clients/native-storage.ts +++ b/tests/clients/native-storage.ts @@ -1,5 +1,15 @@ -// Browser adapter for the mobile-source fixture, not a native storage test. +// Browser-only adapter and fault injection. These controls are not in native builds. +export interface StorageFaults { reads: number; writes: number; acknowledgments: number; removes: number; delay: number } +declare global { interface Window { __nativeStorage: StorageFaults } } +window.__nativeStorage = { reads: 0, writes: 0, acknowledgments: 0, removes: 0, delay: 0 }; +function fail(kind: "reads" | "writes" | "acknowledgments" | "removes") { + if (window.__nativeStorage[kind] > 0) { window.__nativeStorage[kind]--; throw new Error(`Injected storage ${kind} failure`); } +} export default { - async getItem(key: string) { return localStorage.getItem(key); }, - async setItem(key: string, value: string) { localStorage.setItem(key, value); }, + async getItem(key: string) { fail("reads"); return localStorage.getItem(key); }, + async setItem(key: string, value: string) { + if (window.__nativeStorage.delay) await new Promise((done) => setTimeout(done, window.__nativeStorage.delay)); + fail("writes"); localStorage.setItem(key, value); fail("acknowledgments"); + }, + async removeItem(key: string) { fail("removes"); localStorage.removeItem(key); }, }; diff --git a/tests/clients/native.spec.ts b/tests/clients/native.spec.ts new file mode 100644 index 0000000..0968f61 --- /dev/null +++ b/tests/clients/native.spec.ts @@ -0,0 +1,150 @@ +import type { Page } from "playwright"; +import { test, expect, origin, saveCoverage } from "./fixtures"; +import { getScorecardCategories, calculateTotal } from "../../packages/game-engine/src"; +import { SAVE_KEY } from "../../apps/mobile/src/local/keys"; +import type { LocalSave } from "../../apps/mobile/src/local/save"; +import type { StorageFaults } from "./native-storage"; + +async function saved(page: Page): Promise { + return page.evaluate((key) => JSON.parse(localStorage.getItem(key)!), SAVE_KEY); +} +async function faults(page: Page, patch: Partial) { + await page.evaluate((value) => Object.assign(window.__nativeStorage, value), patch); +} +async function choose(page: Page, field: string, value: string) { + await page.getByRole("button", { name: field, exact: true }).click(); + await page.getByRole("radio", { name: value, exact: true }).click(); + await expect(page.getByRole("button", { name: field, exact: true })).toHaveAttribute("aria-valuetext", value); +} +async function confirm(page: Page, label: string) { + await page.getByRole("button", { name: label, exact: true }).click(); + await page.getByRole("button", { name: label, exact: true }).last().click(); +} + +for (const diceCount of [5, 6, 8, 10]) { + test(`offline native source adapter: ${diceCount} dice, resume, exact retry and completion`, async ({ client, request }, info) => { + const errors: string[] = [], rpcs: string[] = []; + client.on("pageerror", (error) => errors.push(error.message)); + client.on("request", (request) => { if (request.url().endsWith("/rpc")) rpcs.push(request.url()); }); + await request.post("/control", { data: { reset: true } }); + await client.goto(`${origin}/mobile`); + await client.getByRole("textbox", { name: "Your name" }).fill(`Local ${diceCount}`); + const ai = diceCount === 6 || diceCount === 10 ? 3 : 0; + await choose(client, "AI opponents", ai ? "3 AI" : "Solo"); + await choose(client, "Dice count", `${diceCount} dice`); + if (diceCount === 6) await choose(client, "Appearance", "Dark"); + await client.context().setOffline(true); + await client.getByRole("button", { name: "Start Game", exact: true }).click(); + const roll = client.getByRole("button", { name: "Re-roll (2)", exact: true }); + await expect(roll).toBeEnabled(); + await expect(client.getByRole("checkbox")).toHaveCount(diceCount); + if (diceCount === 8) await client.setViewportSize({ width: 1024, height: 768 }); + const die = client.getByTestId("die-0"), label = await die.getAttribute("aria-label"); + await die.click(); await expect(die).toBeChecked(); + await expect(roll).toBeEnabled(); await roll.click(); + await expect(client.getByRole("button", { name: "Re-roll (1)", exact: true })).toBeEnabled(); + expect(await die.getAttribute("aria-label")).toBe(label); + const checkpoint = await saved(client); + await saveCoverage(client, info, "before-resume"); + await client.context().setOffline(false); await client.reload(); + await client.getByRole("button", { name: "Resume Game", exact: true }).click(); + await expect(client.getByRole("button", { name: "Re-roll (1)", exact: true })).toBeEnabled(); + expect(await saved(client)).toEqual(checkpoint); + await expect(client.getByTestId("die-0")).toBeChecked(); + await client.context().setOffline(true); + await faults(client, { writes: 1 }); + await client.getByRole("button", { name: "Re-roll (1)", exact: true }).click(); + await expect(client.getByRole("alert")).toContainText("Injected storage writes failure"); + await expect(client.getByTestId("score-ones")).toBeDisabled(); + expect(await saved(client)).toEqual(checkpoint); + await client.getByRole("button", { name: "Retry save", exact: true }).click(); + await expect(client.getByRole("button", { name: "Re-roll (0)", exact: true })).toBeDisabled(); + expect((await saved(client)).active!.revision).toBe(checkpoint.active!.revision + 1); + if (diceCount === 6) await client.screenshot({ path: info.outputPath("adapter-active-dark.png") }); + const categories = getScorecardCategories(diceCount); + for (const [index, category] of categories.slice(0, -1).entries()) { + const action = client.getByTestId(`score-${category.id}`); + await expect(action).toBeEnabled(); + if (!index) { await action.focus(); await client.keyboard.press("Enter"); } else await action.click(); + await expect(client.getByText(`Round ${index + 2} / ${categories.length}`, { exact: true })).toBeVisible(); + } + await faults(client, { acknowledgments: 1 }); + await client.getByTestId(`score-${categories.at(-1)!.id}`).click(); + await expect(client.getByRole("alert")).toContainText("Injected storage acknowledgments failure"); + const committed = await saved(client); + expect(committed.active!.game.status).toBe("finished"); + expect(committed.history.entries).toHaveLength(1); + expect(committed.highScores.entries).toHaveLength(ai + 1); + await expect(client.getByText("Game Over!", { exact: true })).toHaveCount(0); + await client.getByRole("button", { name: "Retry save", exact: true }).click(); + await expect(client.getByText("Game Over!", { exact: true })).toBeVisible(); + expect(await saved(client)).toEqual(committed); + for (const player of committed.active!.game.players) { + const score = calculateTotal(player, diceCount).grandTotal; + await expect(client.getByText(`${score} pts`, { exact: true }).first()).toBeVisible(); + } + if (diceCount === 6) await client.screenshot({ path: info.outputPath("adapter-results-dark.png") }); + await client.getByRole("button", { name: "History", exact: true }).click(); + await expect(client.getByText("Recent games", { exact: true })).toBeVisible(); + await choose(client, "Dice count", diceCount === 5 ? "6 dice" : "5 dice"); + await expect(client.getByText("No completed games in this mode yet.").first()).toBeVisible(); + await client.getByRole("button", { name: "Done", exact: true }).click(); + await client.getByRole("button", { name: "Play Again", exact: true }).click(); + await expect(client.getByRole("button", { name: "Start Game", exact: true })).toBeVisible(); + await client.getByRole("button", { name: "Start Game", exact: true }).click(); + await expect(client.getByRole("button", { name: "Re-roll (2)", exact: true })).toBeEnabled(); + await faults(client, { delay: 500 }); + await client.getByTestId("die-0").click(); + await expect(client.getByRole("button", { name: "Pause Game", exact: true })).toBeDisabled(); + await expect(client.getByRole("button", { name: "Pause Game", exact: true })).toBeEnabled(); + await faults(client, { delay: 0 }); + await client.getByRole("button", { name: "Pause Game", exact: true }).click(); + await confirm(client, "Discard saved game"); + await expect(client.getByRole("button", { name: "Start Game", exact: true })).toBeVisible(); + expect((await saved(client)).history.entries).toHaveLength(1); + expect((await (await request.get("/inspect")).json()).logs).toHaveLength(0); + expect(rpcs).toEqual([]); expect(errors).toEqual([]); + }); +} + +test("native adapter recovery does not silently replace damaged data; reset clears even unsaved name text", async ({ client }, info) => { + await client.addInitScript((key) => { + localStorage.setItem(key, '{"schemaVersion":999}'); + localStorage.setItem("yahtzee-theme", "dark"); localStorage.setItem("unrelated", "keep"); + }, SAVE_KEY); + await client.goto(`${origin}/mobile`); + await expect(client.getByRole("alert")).toContainText("damaged or uses unsupported rules"); + await client.getByRole("button", { name: "Try loading again", exact: true }).click(); + expect(await client.evaluate((key) => localStorage.getItem(key), SAVE_KEY)).toBe('{"schemaVersion":999}'); + await client.getByRole("button", { name: "Help", exact: true }).click(); + await client.getByRole("button", { name: "Delete all local data", exact: true }).click(); + await client.getByRole("button", { name: "Cancel", exact: true }).click(); + expect(await client.evaluate((key) => localStorage.getItem(key), SAVE_KEY)).toBe('{"schemaVersion":999}'); + await faults(client, { removes: 1 }); + await confirm(client, "Delete all local data"); + await expect(client.getByRole("alert").last()).toContainText("Injected storage removes failure"); + await expect(client.getByRole("button", { name: "Retry reset", exact: true }).last()).toBeVisible(); + await client.getByRole("button", { name: "Done", exact: true }).click(); + await expect(client.getByText("The reset did not finish. Retry continues the confirmed deletion.")).toBeVisible(); + await client.getByRole("button", { name: "Help", exact: true }).click(); + await client.getByRole("button", { name: "Retry reset", exact: true }).last().click(); + await client.getByRole("button", { name: "Done", exact: true }).click(); + await expect(client.getByRole("textbox", { name: "Your name" })).toHaveValue(""); + expect(await client.evaluate(() => localStorage.getItem("unrelated"))).toBe("keep"); + expect(await client.evaluate(() => localStorage.getItem("yahtzee-theme"))).toBeNull(); + await client.getByRole("textbox", { name: "Your name" }).fill("Unsaved private name"); + await choose(client, "Appearance", "Light"); + await expect(client.getByRole("textbox", { name: "Your name" })).toHaveValue("Unsaved private name"); + await client.getByRole("button", { name: "Help", exact: true }).click(); + await expect(client.getByTestId("diagnostics-preview")).toHaveCount(0); + await client.getByRole("button", { name: "Preview diagnostics", exact: true }).click(); + await expect(client.getByTestId("diagnostics-preview")).toContainText("build 1"); + await expect(client.getByTestId("diagnostics-preview")).not.toContainText("Unsaved private name"); + await client.getByRole("button", { name: "Cancel preview", exact: true }).click(); + await expect(client.getByTestId("diagnostics-preview")).toHaveCount(0); + await confirm(client, "Delete all local data"); + await client.getByRole("button", { name: "Done", exact: true }).click(); + await expect(client.getByRole("textbox", { name: "Your name" })).toHaveValue(""); + expect((await saved(client)).preferences.appearance).toBe("system"); + await client.screenshot({ path: info.outputPath("adapter-reset.png") }); +}); diff --git a/tests/clients/server.ts b/tests/clients/server.ts index 050da00..3cb193c 100644 --- a/tests/clients/server.ts +++ b/tests/clients/server.ts @@ -36,6 +36,7 @@ for (const client of ["web", "desktop", "mobile"]) { }); build.onResolve({ filter: /^convex\/react$/ }, () => ({ path: resolve("tests/clients/backend-client.tsx") })); build.onResolve({ filter: /^react-native$/ }, () => ({ path: require.resolve("react-native-web") })); + build.onResolve({ filter: /^react-native-safe-area-context$/ }, () => ({ path: resolve("tests/clients/native-safe-area.tsx") })); build.onResolve({ filter: /^@react-native-async-storage\/async-storage$/ }, () => ({ path: resolve("tests/clients/native-storage.ts") })); } }], }); diff --git a/tests/clients/tsconfig.json b/tests/clients/tsconfig.json index f02d2e0..3612909 100644 --- a/tests/clients/tsconfig.json +++ b/tests/clients/tsconfig.json @@ -1,5 +1,5 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { "noEmit": true, "rootDir": "../..", "types": ["bun", "node"] }, + "compilerOptions": { "noEmit": true, "rootDir": "../..", "types": ["bun", "node"], "paths": { "react-native": ["../../apps/mobile/node_modules/react-native"] } }, "include": ["./**/*.ts", "./**/*.tsx", "../offline/**/*.ts", "../../playwright.config.ts"] }