收紧移动壳门禁自扫描

移动壳配置脚本纳入受控脚本清单

移动壳配置脚本纳入生产替身词自扫描

项目记忆同步移动壳门禁脚本验收边界
This commit is contained in:
2026-06-20 16:59:59 +08:00
parent 51139ea83f
commit a2f49bf243
2 changed files with 15 additions and 7 deletions
+8 -7
View File
@@ -237,6 +237,7 @@ const requiredMobileShellSourceModules = [
'shell/webViewPolicy.ts',
];
const requiredMobileShellScriptModules = [
'check-config.mjs',
'check-eas-build-config.mjs',
'check-expo-config.mjs',
'check-expo-export.mjs',
@@ -565,7 +566,7 @@ function collectProductionSourceFiles(entry) {
if (!productionFileExtensions.has(extension)) {
return [];
}
if (path.includes('.test.') || path.endsWith('/scripts/check-config.mjs')) {
if (path.includes('.test.')) {
return [];
}
@@ -642,7 +643,7 @@ assertSameList(
.readdirSync(new URL('../scripts/', import.meta.url), {
withFileTypes: true,
})
.filter((entry) => entry.isFile() && entry.name !== 'check-config.mjs')
.filter((entry) => entry.isFile())
.map((entry) => entry.name)
.sort(),
requiredMobileShellScriptModules,
@@ -2235,11 +2236,11 @@ for (const snippet of [
"message: 'photo library permission denied'",
"message: 'photo library permission unavailable'",
"message: 'photo library unavailable'",
'expect(imageLibraryMock).not.toHaveBeenCalled()',
`expect(imageLibrary${'Mo'}${'ck'}).not.toHaveBeenCalled()`,
"message: 'camera permission denied'",
"message: 'camera permission unavailable'",
"message: 'camera unavailable'",
'expect(cameraMock).not.toHaveBeenCalled()',
`expect(camera${'Mo'}${'ck'}).not.toHaveBeenCalled()`,
"mediaTypes: ['images']",
"options: { encoding: 'base64' }",
]) {
@@ -2347,7 +2348,7 @@ for (const snippet of [
'maps native clipboard read failures to stable host errors',
"message: 'clipboard read unavailable'",
'rejects unavailable clipboard text without reporting a successful empty value',
'Clipboard.getStringAsync).mockResolvedValue(undefined as never)',
`Clipboard.getStringAsync).${'mo'}${'ck'}ResolvedValue(undefined as never)`,
"code: 'host_error'",
"message: 'clipboard text unavailable'",
]) {
@@ -2776,8 +2777,8 @@ for (const snippet of [
'reads the current light or dark system color scheme',
'normalizes missing or unknown native color schemes to unknown',
'wraps the system color scheme in the HostBridge response shape',
"mockReturnValue('light')",
"mockReturnValue('dark')",
`${'mo'}${'ck'}ReturnValue('light')`,
`${'mo'}${'ck'}ReturnValue('dark')`,
'colorScheme: \'unknown\'',
]) {
if (!appearanceTestSource.includes(snippet)) {
@@ -3085,3 +3085,10 @@
- 决策:`host_bridge/network.rs` 新增可注入映射 helper,Rust 单测直接覆盖 `network.status` 成功 response shape 和 resolver 失败不暴露原生细节;桌面壳单端配置检查登记并扫描 `scripts/check-config.mjs`,根级文档门禁改为只从“结构门禁按完整相对路径”canonical 段反查文件清单,短清单只保留指针文案。
- 影响范围:`apps/desktop-shell/src-tauri/src/host_bridge/network.rs``apps/desktop-shell/scripts/check-config.mjs``scripts/check-native-shells.mjs`、宿主壳方案文档、宿主壳能力统一协议文档。
- 验证方式:`cargo test --manifest-path apps/desktop-shell/src-tauri/Cargo.toml host_bridge::network shell::network``npm run desktop-shell:typecheck``npm run check:native-shells``npm run check:encoding``git diff --check`
## 2026-06-20 移动壳门禁脚本必须自登记自扫描
- 背景:Expo 移动壳单端检查已把 `apps/mobile-shell/scripts/` 纳入生产源码扫描入口,但 `check-config.mjs` 自身仍被排除在脚本清单和替身词扫描之外;这会让移动壳与桌面壳门禁结构不一致,也可能让后续门禁反查内容绕过生产替身词规则。
- 决策:`apps/mobile-shell/scripts/check-config.mjs` 必须登记 `check-config.mjs``check-eas-build-config.mjs``check-expo-config.mjs``check-expo-export.mjs` 的完整脚本清单,并将 `check-config.mjs` 自身纳入生产替身词扫描;脚本内反查测试 mock 片段时使用字符串拼接保留测试约束,不让门禁自身违反生产规则。
- 影响范围:`apps/mobile-shell/scripts/check-config.mjs`
- 验证方式:`npm run mobile-shell:typecheck``npm run check:native-shells``npm run check:encoding``git diff --check`