fix(pi): strengthen final release proof

This commit is contained in:
2026-08-24 15:47:57 +08:00
parent c7e777246e
commit df1151b5eb
19 changed files with 1120 additions and 149 deletions

View File

@@ -88,6 +88,11 @@ import {
createCodingComposition,
resolveCodingPiRuntimePaths,
} from '../api/coding-composition';
import {
finishFinalAsarPressureProof,
runFinalAsarExtensionProof,
startFinalAsarPressureProof,
} from '../coding-runtime/pi/release-proof';
// Diagnostic package: force Chromium networking onto HTTP/1.1 for transport A/B testing.
app.commandLine.appendSwitch('disable-http2');
@@ -875,8 +880,31 @@ export async function runLocalPreviewPreflightE2E(
}
}
type PiReleaseProofAction = 'extension' | 'pressure.start' | 'pressure.finish';
export async function runPiReleaseProofE2E(action: PiReleaseProofAction) {
if (!isE2EMode) throw new Error('PI release proof is unavailable');
const appPath = app.getAppPath();
const packagedMain = {
isPackaged: app.isPackaged,
appPath,
appPathUsesAsar: app.isPackaged && /[\\/]app\.asar$/i.test(appPath),
};
if (action === 'extension') {
return { action, packagedMain, extension: await runFinalAsarExtensionProof() };
}
if (action === 'pressure.start') {
return { action, packagedMain, pressure: await startFinalAsarPressureProof() };
}
return { action, packagedMain, pressure: await finishFinalAsarPressureProof() };
}
if (isE2EMode) {
(globalThis as typeof globalThis & {
__niancodeRunLocalPreviewPreflightE2E?: typeof runLocalPreviewPreflightE2E;
__niancodeRunPiReleaseProofE2E?: typeof runPiReleaseProofE2E;
}).__niancodeRunLocalPreviewPreflightE2E = runLocalPreviewPreflightE2E;
(globalThis as typeof globalThis & {
__niancodeRunPiReleaseProofE2E?: typeof runPiReleaseProofE2E;
}).__niancodeRunPiReleaseProofE2E = runPiReleaseProofE2E;
}