修复桌面壳对根门禁 label 字面量的断言
Project CI / Frontend tests (push) Successful in 4m24s
Project CI / Native shell tests (push) Successful in 7m34s
Project CI / Backend tests (push) Successful in 7m36s
Project CI / Repository checks (push) Successful in 2m45s
Project CI / AI game creator shell web tests (push) Successful in 2m15s
Project CI / AI game creator shell Rust tests (push) Successful in 15m27s

run 2095 的 Native shell tests 红了,失败点是 desktop-shell 的 typecheck:
apps/desktop-shell/scripts/check-config.mjs 断言根门禁脚本必须包含
`console.log('[check:native-shells] desktop-release-binary-artifact')` 字面量,
而拆分时我把 label 挪进了公共打印函数 runNativeShellGate(group, label, gate),
源码里不再有这个字面量,断言随即报
「root native shell gate must keep desktop release artifact check」。

- runNativeShellGate 收窄为 (group, gate):label 改回各门禁执行体里的字面量打印,
  分组能力、日志格式与 `--groups=` 语义都不变,外部按字面量做的快照断言继续有效。
- 在该函数旁注明不要把 label 抽成变量:apps/desktop-shell 与 apps/mobile-shell 的
  check-config 都会读取根脚本源码做字面量断言。

验证:node --check 通过;contract 分组通过(groups=contract + OK);mobile-shell
check-config exit 0;desktop-shell check-config 已越过第 740-777 行的根脚本断言
(本机只卡在本机不存在的 Tauri 生成产物目录,Linux CI 不受影响);
vitest scripts/project-ci-workflow.test.ts 11 passed;eslint 通过。

Co-authored-by: DotCraft <273930855+dotcraft-ai@users.noreply.github.com>
This commit is contained in:
2026-09-14 16:26:10 +08:00
parent 20f109027a
commit 11beb65c36
+106 -125
View File
@@ -136,12 +136,11 @@ function runsNativeShellGateGroup(group) {
return requestedNativeShellGroups.includes(group);
}
function runNativeShellGate(group, label, gate) {
function runNativeShellGate(group, gate) {
if (!runsNativeShellGateGroup(group)) {
return;
}
console.log(`[check:native-shells] ${label}`);
gate();
}
@@ -227,11 +226,14 @@ function assertRootNativeShellCheckScripts() {
}
}
runNativeShellGate(
'contract',
'root-native-shell-check-scripts',
assertRootNativeShellCheckScripts,
);
// 每个门禁在自己的执行体里打印 `[check:native-shells] <label>`:这些 label 是字面量,
// 壳侧的 check-config(如 apps/desktop-shell/scripts/check-config.mjs 对
// desktop-release-binary-artifact 的校验)会按字面量断言它们仍然存在,因此不要把
// label 抽成变量或挪进公共打印函数。
runNativeShellGate('contract', () => {
console.log('[check:native-shells] root-native-shell-check-scripts');
assertRootNativeShellCheckScripts();
});
function assertNativeShellDependencyVersionGuardrails() {
for (const snippet of [
"const rootPackageLockPath = new URL('../../../package-lock.json', import.meta.url)",
@@ -279,11 +281,12 @@ function assertNativeShellDependencyVersionGuardrails() {
}
}
runNativeShellGate(
'contract',
'native-shell-dependency-version-guardrails',
assertNativeShellDependencyVersionGuardrails,
);
runNativeShellGate('contract', () => {
console.log(
'[check:native-shells] native-shell-dependency-version-guardrails',
);
assertNativeShellDependencyVersionGuardrails();
});
const h5HostBridgeCallChainWrapperFiles = [
'src/hooks/useHostNavigationCanGoBack.ts',
'src/components/platform-entry/platformProfileHostClipboard.ts',
@@ -5162,140 +5165,118 @@ for (const step of steps) {
}
}
runNativeShellGate(
'release',
'desktop-release-binary-artifact',
assertDesktopReleaseBinaryArtifact,
);
runNativeShellGate('release', () => {
console.log('[check:native-shells] desktop-release-binary-artifact');
assertDesktopReleaseBinaryArtifact();
});
runNativeShellGate(
'contract',
'host-bridge-layer-layout',
assertHostBridgeLayerLayout,
);
runNativeShellGate('contract', () => {
console.log('[check:native-shells] host-bridge-layer-layout');
assertHostBridgeLayerLayout();
});
runNativeShellGate(
'contract',
'native-shell-capability-plan',
assertNativeShellCapabilityPlan,
);
runNativeShellGate('contract', () => {
console.log('[check:native-shells] native-shell-capability-plan');
assertNativeShellCapabilityPlan();
});
runNativeShellGate(
'contract',
'external-url-protocol-parity',
assertExternalUrlProtocolParity,
);
runNativeShellGate('contract', () => {
console.log('[check:native-shells] external-url-protocol-parity');
assertExternalUrlProtocolParity();
});
runNativeShellGate(
'contract',
'wechat-mini-program-route-parity',
assertWechatMiniProgramRouteParity,
);
runNativeShellGate('contract', () => {
console.log('[check:native-shells] wechat-mini-program-route-parity');
assertWechatMiniProgramRouteParity();
});
runNativeShellGate(
'contract',
'wechat-mini-program-capability-flows',
assertWechatMiniProgramCapabilityFlows,
);
runNativeShellGate('contract', () => {
console.log('[check:native-shells] wechat-mini-program-capability-flows');
assertWechatMiniProgramCapabilityFlows();
});
runNativeShellGate(
'contract',
'expo-mobile-capability-flows',
assertExpoMobileCapabilityFlows,
);
runNativeShellGate('contract', () => {
console.log('[check:native-shells] expo-mobile-capability-flows');
assertExpoMobileCapabilityFlows();
});
runNativeShellGate(
'contract',
'tauri-desktop-capability-flows',
assertTauriDesktopCapabilityFlows,
);
runNativeShellGate('contract', () => {
console.log('[check:native-shells] tauri-desktop-capability-flows');
assertTauriDesktopCapabilityFlows();
});
runNativeShellGate(
'contract',
'h5-native-app-route-flows',
assertH5NativeAppRouteFlows,
);
runNativeShellGate('contract', () => {
console.log('[check:native-shells] h5-native-app-route-flows');
assertH5NativeAppRouteFlows();
});
runNativeShellGate(
'contract',
'wechat-payment-result-boundaries',
assertWechatPaymentResultBoundaries,
);
runNativeShellGate('contract', () => {
console.log('[check:native-shells] wechat-payment-result-boundaries');
assertWechatPaymentResultBoundaries();
});
runNativeShellGate(
'contract',
'wechat-auth-failure-boundaries',
assertWechatAuthFailureBoundaries,
);
runNativeShellGate('contract', () => {
console.log('[check:native-shells] wechat-auth-failure-boundaries');
assertWechatAuthFailureBoundaries();
});
runNativeShellGate(
'contract',
'wechat-web-view-page-event-boundaries',
assertWechatWebViewPageEventBoundaries,
);
runNativeShellGate('contract', () => {
console.log('[check:native-shells] wechat-web-view-page-event-boundaries');
assertWechatWebViewPageEventBoundaries();
});
runNativeShellGate(
'contract',
'wechat-share-grid-failure-boundaries',
assertWechatShareGridFailureBoundaries,
);
runNativeShellGate('contract', () => {
console.log('[check:native-shells] wechat-share-grid-failure-boundaries');
assertWechatShareGridFailureBoundaries();
});
runNativeShellGate(
'contract',
'desktop-navigation-event-boundaries',
assertDesktopNavigationEventBoundaries,
);
runNativeShellGate('contract', () => {
console.log('[check:native-shells] desktop-navigation-event-boundaries');
assertDesktopNavigationEventBoundaries();
});
runNativeShellGate(
'contract',
'h5-host-bridge-event-subscription-gates',
assertH5HostBridgeEventSubscriptionGates,
);
runNativeShellGate('contract', () => {
console.log('[check:native-shells] h5-host-bridge-event-subscription-gates');
assertH5HostBridgeEventSubscriptionGates();
});
runNativeShellGate(
'contract',
'h5-host-bridge-payload-boundaries',
assertH5HostBridgePayloadBoundaries,
);
runNativeShellGate('contract', () => {
console.log('[check:native-shells] h5-host-bridge-payload-boundaries');
assertH5HostBridgePayloadBoundaries();
});
runNativeShellGate(
'contract',
'h5-native-app-transport-timeout-boundaries',
assertH5NativeAppTransportTimeoutBoundaries,
);
runNativeShellGate('contract', () => {
console.log(
'[check:native-shells] h5-native-app-transport-timeout-boundaries',
);
assertH5NativeAppTransportTimeoutBoundaries();
});
runNativeShellGate(
'contract',
'h5-native-app-message-source-boundaries',
assertH5NativeAppMessageSourceBoundaries,
);
runNativeShellGate('contract', () => {
console.log('[check:native-shells] h5-native-app-message-source-boundaries');
assertH5NativeAppMessageSourceBoundaries();
});
runNativeShellGate(
'contract',
'h5-native-app-transport-facade-boundary',
assertH5NativeAppTransportFacadeBoundary,
);
runNativeShellGate('contract', () => {
console.log('[check:native-shells] h5-native-app-transport-facade-boundary');
assertH5NativeAppTransportFacadeBoundary();
});
runNativeShellGate(
'contract',
'generated-native-shell-artifact-boundary',
() => {
assertNoTrackedGeneratedNativeShellArtifacts();
assertGeneratedNativeShellArtifactsAreIgnored();
},
);
runNativeShellGate('contract', () => {
console.log('[check:native-shells] generated-native-shell-artifact-boundary');
assertNoTrackedGeneratedNativeShellArtifacts();
assertGeneratedNativeShellArtifactsAreIgnored();
});
runNativeShellGate(
'contract',
'ai-game-creator-shell-user-dev-boundary',
assertAiGameCreatorShellUserDevBoundary,
);
runNativeShellGate('contract', () => {
console.log('[check:native-shells] ai-game-creator-shell-user-dev-boundary');
assertAiGameCreatorShellUserDevBoundary();
});
runNativeShellGate(
'contract',
'production-shell-dev-scaffold-scan',
assertNoProductionShellDevScaffoldTerms,
);
runNativeShellGate('contract', () => {
console.log('[check:native-shells] production-shell-dev-scaffold-scan');
assertNoProductionShellDevScaffoldTerms();
});
console.log(
`[check:native-shells] groups=${requestedNativeShellGroups.join(',')}`,