Files
orca/mobile/src/test-support/census-source-files.ts
T
Jinwoo Hong 86f6258d54 refactor(mobile): delete native screens the OTA shell no longer reaches (#29979)
* fix(mobile): wall hosts that cannot serve the page instead of opening native screens

* refactor(mobile): drop the native-route state and the shell fallback prop; unknown routes say unavailable

* test(mobile): read the nullable page route refusal in its policy test

* refactor(mobile): every build is the OTA shell; drop the native/OTA build switch

The owner retired the native-screen fallback with no emergency native build, so
EXPO_PUBLIC_MOBILE_SHELL, mobileShellBuildKind, shellSwitchDecision, the Metro
cache-key suffix and both release workflows' shell input go. Every host route
mounts the shell; a route naming no screen the shell could open gets the
existing refusal screen instead of a native screen.

Claude-Session: https://claude.ai/code/session_6cea92f6

* refactor(mobile): delete native screens the OTA shell no longer reaches

With every build the OTA shell, these native siblings run nowhere: the
native-executed closure (index.js plus every non-web route) does not reach
them, and the page resolves their .web siblings. Each .web sibling takes the
plain name, its web-overrides entry goes, and the native-only rich Markdown
editor and Mermaid WebView generators and their outputs go with them.

Kept: native siblings the node test suite still renders shared screens
through (terminal WebView, browser frame path, clipboard, dictation, media
picker, live input, snapshot budget, input styles).

Claude-Session: https://claude.ai/code/session_6cea92f6

* test(mobile): drop the phone-preview comparison the deleted native sibling held

Claude-Session: https://claude.ai/code/session_6cea92f6

* refactor(mobile): drop the dead web route, flag-era comments and the one-value shell kind

The host route files no longer switch, so their comments say what they do now:
a route naming no screen shows the unavailable screen. app/h/[hostId]/web.tsx
duplicated index.tsx and nothing linked to it, so it and its stack entry go
(the bundle sweep is re-measured: 77 scripts at 15 routes). Diagnostics print
the bridge protocol on its own instead of a shell kind that has one value.

Claude-Session: https://claude.ai/code/session_6cea92f6

* refactor(mobile): one host for the rich editor, plain Text, and drop two unused native deps

MobileSelectableText was react-native's Text, so callers use Text. The rich
Markdown editor's host-facing seams (messages, URL prompt, keyboard inset) are
required now that the page is its only host; the WebView defaults go. Comments
that described deleted native components are rewritten, and
expo-image-manipulator and react-native-uitextview leave package.json and the
lockfile.

Claude-Session: https://claude.ai/code/session_6cea92f6
2026-10-17 02:23:51 -07:00

45 lines
2.1 KiB
TypeScript

import { readdirSync } from 'node:fs'
import { join } from 'node:path'
/**
* Build output, which a source census reads as source and must not.
*
* The lists of record are `mobile/package.json`'s postinstall, which names every generator, and
* `mobile/.gitignore`, which names every file they write. Both change, so the shape is what this
* rule is about and the count below is a reading rather than a fence. At this one: three
* generators, four `*.generated.ts` files under `mobile/src`.
*
* The 3.5 MB mermaid page engine and the xterm engine are vendored code, and most of what a walk
* over this tree returns by weight is generated. A census that parses them parses minified
* third-party code looking for call sites nobody in this repo wrote and nobody can move, and pays
* the whole parse to find them: five of those files is what
* took `rpc-params-contract-type-only-boundary` from 1.5 s to over its 5 s timeout in CI.
*
* The terminal document bundle is this repo's own emitted text rather than vendored code, and its
* sources are walked as the ordinary TypeScript modules they are built from.
*
* The generator that writes each one is ordinary source and is still walked, which is where a real
* reach into whatever a census is fencing would be.
*/
export function isGeneratedSource(name: string): boolean {
return /\.generated\.tsx?$/.test(name)
}
/**
* Every file under `directory`, absolute, without `node_modules` or build output.
*
* Nine censuses in this tree held a copy of this walk, and two of them had grown a private opinion
* about generated files while the rest had none. What each census counts as *interesting* — which
* extensions, whether test files are in — stays its own business, because they genuinely disagree;
* what counts as a source file at all does not.
*/
export function censusSourceFiles(directory: string): string[] {
return readdirSync(directory, { withFileTypes: true }).flatMap((entry) => {
const path = join(directory, entry.name)
if (entry.isDirectory()) {
return entry.name === 'node_modules' ? [] : censusSourceFiles(path)
}
return isGeneratedSource(entry.name) ? [] : [path]
})
}