收口原生壳请求超时边界

将原生壳请求默认超时和最大超时提升到共享 HostBridge 契约

让 H5 nativeAppHostBridge 复用共享超时边界

增加原生壳门禁拦截本地超时边界重声明

补充原生壳方案和共享决策记录
This commit is contained in:
2026-06-19 13:26:01 +08:00
parent 8aaa5e93e2
commit bd0f566e76
8 changed files with 109 additions and 6 deletions
+32
View File
@@ -1011,6 +1011,35 @@ function assertH5HostBridgePayloadBoundaries() {
}
}
function assertH5NativeAppTransportTimeoutBoundaries() {
const nativeAppHostBridgeSource = fs.readFileSync(
'src/services/host-bridge/nativeAppHostBridge.ts',
'utf8',
);
for (const sharedBoundary of [
'HOST_BRIDGE_DEFAULT_REQUEST_TIMEOUT_MS',
'HOST_BRIDGE_MAX_REQUEST_TIMEOUT_MS',
]) {
if (!nativeAppHostBridgeSource.includes(`${sharedBoundary},`)) {
throw new Error(
`H5 native app transport must import shared timeout boundary ${sharedBoundary}`,
);
}
}
for (const staleTimeoutBoundary of [
'DEFAULT_NATIVE_APP_BRIDGE_TIMEOUT_MS',
'MAX_NATIVE_APP_BRIDGE_TIMEOUT_MS',
]) {
if (nativeAppHostBridgeSource.includes(staleTimeoutBoundary)) {
throw new Error(
`H5 native app transport must not redeclare timeout boundary ${staleTimeoutBoundary}`,
);
}
}
}
function extractDocumentCapabilityList(source, marker) {
const markerIndex = source.indexOf(marker);
if (markerIndex === -1) {
@@ -1662,6 +1691,9 @@ assertH5HostBridgeEventSubscriptionGates();
console.log('[check:native-shells] h5-host-bridge-payload-boundaries');
assertH5HostBridgePayloadBoundaries();
console.log('[check:native-shells] h5-native-app-transport-timeout-boundaries');
assertH5NativeAppTransportTimeoutBoundaries();
console.log('[check:native-shells] production-shell-dev-scaffold-scan');
assertNoProductionShellDevScaffoldTerms();