You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by "testikun (via GitHub)" <gi...@apache.org> on 2026/08/24 11:00:37 UTC
[PR] refactor(windows): reuse packaged verifier for rollback [maka]
testikun opened a new pull request, #3707:
URL: https://github.com/apache/maka/pull/3707
## Summary
Replace the rollback verifier's private `assertLaunchable` CDP wrapper with the existing `verifyPackagedWindowsApp` authority, using the explicit `legacy-baseline` contract for restored pre-upgrade installations.
The rollback-specific filesystem, registry, backup, recovery, fail-closed, and `.onInstFailed` assertions are unchanged. The duplicate process/renderer/version plumbing is removed, and a focused harness test pins the delegation contract.
Fixes #3575
## Verification
- `node --test scripts/verify-windows-harness.test.mjs` — 40 passed
- `npm --workspace @maka/eval run build` — passed (required release-test fixture)
- `node --test scripts/product-release.test.mjs scripts/verify-windows-harness.test.mjs` — 66 passed
- `npm run lint` — passed
- `npx biome check scripts/verify-windows-installer-rollback.mjs scripts/verify-windows-harness.test.mjs` — passed
- `node --check` for both changed scripts and `git diff --check` — passed
- The real Windows installer rollback gate was not run locally because this workspace is macOS; it remains the authoritative Windows CI check.
- The repository-wide `npm run typecheck` currently reports unrelated errors in unmodified Runtime Host, CLI, UI, and Desktop files on the latest `main`.
### 中文摘要
本 PR 复用已有的 packaged-app verifier 来验证回滚后的旧版本安装,固定使用 `legacy-baseline` 契约,删除重复的 CDP/进程/版本检查代码;所有备份、注册表、失败恢复和 `.onInstFailed` 回滚行为保持不变,并补充了 delegation 回归测试。
## AI use
Select exactly one:
- [ ] No generative tool made a substantive contribution
- [x] Generative tooling made a substantive contribution
Tool(s) and scope: OpenAI Codex analyzed issue #3575, designed the bounded verifier-reuse slice, implemented the two-script change, added the regression test, and ran the listed verification. The human contributor remains responsible for review and submission.
## Checklist
- [x] Tests cover the change and fail without it
- [ ] Lint, format, typecheck and the affected suites pass locally
Does this PR entail a change in behavior?
- [ ] Yes — described under Summary above
- [x] No
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] refactor(windows): reuse packaged verifier for rollback [maka]
Posted by "Astro-Han (via GitHub)" <gi...@apache.org>.
Astro-Han commented on code in PR #3707:
URL: https://github.com/apache/maka/pull/3707#discussion_r3859080670
##########
scripts/verify-windows-installer-rollback.mjs:
##########
@@ -173,43 +168,23 @@ $entries | ForEach-Object { Remove-Item -LiteralPath $_.Path -Recurse -Force }
});
}
-async function assertLaunchable(installedExecutable, workingDirectory, expectedVersion) {
- const home = join(workingDirectory, 'home');
- const userData = join(workingDirectory, 'user-data');
- const userEnv = isolatedUserEnv(home);
- await mkdir(home, { recursive: true });
- await mkdir(userData, { recursive: true });
- await mkdir(userEnv.APPDATA, { recursive: true });
- await mkdir(userEnv.LOCALAPPDATA, { recursive: true });
- const child = spawn(
- installedExecutable,
- ['--remote-debugging-port=0', `--user-data-dir=${userData}`, '--enable-logging=stderr'],
- {
- cwd: workingDirectory,
- env: { ...process.env, MAKA_SKIP_SHELL_ENV: '1', ...userEnv },
- stdio: ['ignore', 'ignore', 'pipe'],
- },
- );
- let stderr = '';
- child.stderr.setEncoding('utf8');
- child.stderr.on('data', (chunk) => {
- stderr = `${stderr}${chunk}`.slice(-16_384);
- });
- try {
- const cdpPort = await waitForDevToolsPort(child);
- const target = await findRendererTarget(cdpPort, child);
- await waitForUsableRenderer(target.webSocketDebuggerUrl, child, {
- description: 'Restored app renderer',
- }).catch((error) => {
- throw new Error(`${error.message}${stderr.trim() ? `\n${stderr.trim()}` : ''}`, {
- cause: error,
- });
- });
- const productVersion = await readInstalledProductVersion(installedExecutable);
- assertWindowsProductVersion(productVersion, expectedVersion);
- } finally {
- await stopChild(child);
- }
+export async function verifyRestoredWindowsInstallation(
+ installDirectory,
+ workingDirectory,
+ expectedVersion,
+ { verifyApp = verifyPackagedWindowsApp, run } = {},
+) {
+ await mkdir(workingDirectory, { recursive: true });
+ const options = {
+ // The rollback verifier restores the candidate installer, not the pinned
+ // upgrade baseline. The candidate is built from the current tree and must
+ // therefore satisfy the current packaged-artifact contract.
+ artifactContract: 'current',
Review Comment:
**P2 — the delegation widens the rollback gate with work the verifier already proved redundant three steps earlier.**
`verifyPackagedWindowsApp` with `artifactContract: 'current'` is not a launch check. It runs `assertPackagedResources`, `assertPackagedDependencyClosure`, the PE machine check, the sandbox broker `--self-probe`, `experiments/windows-sandbox/stdio-relay-smoke.ps1` through pwsh, `verifyWindowsSandboxWorkerE2E`, the node-pty conpty smoke, and `smokePackagedRenderer` with `verifyMaximizeRestore: true`. The deleted `assertLaunchable` did one of those.
All of the added work is provably redundant here. Three steps above this call, `verifyWindowsInstallerRollback` asserts the restored tree is **byte-identical** to the pre-upgrade manifest (`0 differing files across N entries`) and that no residue remains. Those exact bytes were already put through the full current contract by the "Verify the Windows release" step earlier in the same `package` job. Re-verifying the sandbox worker E2E on bytes just proven identical adds no evidence about rollback.
The cost is small but real — the rollback step went from 133s and 147s on two recent `main`-branch runs to 168s here — and the more important cost is failure attribution: a regression in the packaged sandbox, the stdio relay, or node-pty now fails the *rollback* gate. That is the specific argument #3575 item 4 used to reject folding the two verifiers together, and it applies to this narrower reuse too.
The smaller version reuses the same authority without widening anything:
```js
await smokePackagedRenderer(installedExecutable, { workingDirectory });
assertWindowsProductVersion(
await readInstalledProductVersion(installedExecutable, { run }),
candidateVersion,
);
```
`smokePackagedRenderer` is what `assertLaunchable` was a copy of — same `--remote-debugging-port=0` and `--user-data-dir` isolation, same `isolatedUserEnv`, same 16 KiB stderr capture appended to the failure — and this file already imports from `verify-packaged-app.mjs`. `readInstalledProductVersion` uses the identical PowerShell expression `verifyPackagedWindowsApp` uses for the version resource, and it plus `assertWindowsProductVersion` are already called eight times in this file. That deletes the same duplicate plumbing #3575 targeted, keeps the gate's meaning unchanged, and needs one added import.
Not blocking — what is here is green and correct. But #3575 scoped this as "no behavior change", and as written it is a behavior change to a release gate.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] refactor(windows): reuse packaged verifier for rollback [maka]
Posted by "Astro-Han (via GitHub)" <gi...@apache.org>.
Astro-Han commented on code in PR #3707:
URL: https://github.com/apache/maka/pull/3707#discussion_r3859080670
##########
scripts/verify-windows-installer-rollback.mjs:
##########
@@ -173,43 +168,23 @@ $entries | ForEach-Object { Remove-Item -LiteralPath $_.Path -Recurse -Force }
});
}
-async function assertLaunchable(installedExecutable, workingDirectory, expectedVersion) {
- const home = join(workingDirectory, 'home');
- const userData = join(workingDirectory, 'user-data');
- const userEnv = isolatedUserEnv(home);
- await mkdir(home, { recursive: true });
- await mkdir(userData, { recursive: true });
- await mkdir(userEnv.APPDATA, { recursive: true });
- await mkdir(userEnv.LOCALAPPDATA, { recursive: true });
- const child = spawn(
- installedExecutable,
- ['--remote-debugging-port=0', `--user-data-dir=${userData}`, '--enable-logging=stderr'],
- {
- cwd: workingDirectory,
- env: { ...process.env, MAKA_SKIP_SHELL_ENV: '1', ...userEnv },
- stdio: ['ignore', 'ignore', 'pipe'],
- },
- );
- let stderr = '';
- child.stderr.setEncoding('utf8');
- child.stderr.on('data', (chunk) => {
- stderr = `${stderr}${chunk}`.slice(-16_384);
- });
- try {
- const cdpPort = await waitForDevToolsPort(child);
- const target = await findRendererTarget(cdpPort, child);
- await waitForUsableRenderer(target.webSocketDebuggerUrl, child, {
- description: 'Restored app renderer',
- }).catch((error) => {
- throw new Error(`${error.message}${stderr.trim() ? `\n${stderr.trim()}` : ''}`, {
- cause: error,
- });
- });
- const productVersion = await readInstalledProductVersion(installedExecutable);
- assertWindowsProductVersion(productVersion, expectedVersion);
- } finally {
- await stopChild(child);
- }
+export async function verifyRestoredWindowsInstallation(
+ installDirectory,
+ workingDirectory,
+ expectedVersion,
+ { verifyApp = verifyPackagedWindowsApp, run } = {},
+) {
+ await mkdir(workingDirectory, { recursive: true });
+ const options = {
+ // The rollback verifier restores the candidate installer, not the pinned
+ // upgrade baseline. The candidate is built from the current tree and must
+ // therefore satisfy the current packaged-artifact contract.
+ artifactContract: 'current',
Review Comment:
**P2 — the delegation widens the rollback gate with work the verifier already proved redundant three steps earlier.**
`verifyPackagedWindowsApp` with `artifactContract: 'current'` is not a launch check. It runs `assertPackagedResources`, `assertPackagedDependencyClosure`, the PE machine check, the sandbox broker `--self-probe`, `experiments/windows-sandbox/stdio-relay-smoke.ps1` through pwsh, `verifyWindowsSandboxWorkerE2E`, the node-pty conpty smoke, and `smokePackagedRenderer` with `verifyMaximizeRestore: true`. The deleted `assertLaunchable` did one of those.
All of the added work is provably redundant here. Three steps above this call, `verifyWindowsInstallerRollback` asserts the restored tree is **byte-identical** to the pre-upgrade manifest (`0 differing files across N entries`) and that no residue remains. Those exact bytes were already put through the full current contract by the "Verify the Windows release" step earlier in the same `package` job. Re-verifying the sandbox worker E2E on bytes just proven identical adds no evidence about rollback.
The cost is small but real — the rollback step went from 133s and 147s on two recent `main`-branch runs to 168s here — and the more important cost is failure attribution: a regression in the packaged sandbox, the stdio relay, or node-pty now fails the *rollback* gate. That is the specific argument #3575 item 4 used to reject folding the two verifiers together, and it applies to this narrower reuse too.
The smaller version reuses the same authority without widening anything:
```js
await smokePackagedRenderer(installedExecutable, { workingDirectory });
assertWindowsProductVersion(
await readInstalledProductVersion(installedExecutable, { run }),
candidateVersion,
);
```
`smokePackagedRenderer` is what `assertLaunchable` was a copy of — same `--remote-debugging-port=0` and `--user-data-dir` isolation, same `isolatedUserEnv`, same 16 KiB stderr capture appended to the failure — and this file already imports from `verify-packaged-app.mjs`. `readInstalledProductVersion` uses the identical PowerShell expression `verifyPackagedWindowsApp` uses for the version resource, and it plus `assertWindowsProductVersion` are already called eight times in this file. That deletes the same duplicate plumbing #3575 targeted, keeps the gate's meaning unchanged, and needs one added import.
Not blocking — what is here is green and correct. But #3575 scoped this as "no behavior change", and as written it is a behavior change to a release gate.
---
> **Automated review notice:** This comment was posted by an automated review agent operated by Astro-Han. It is not an independent human review and does not replace one.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] refactor(windows): reuse packaged verifier for rollback [maka]
Posted by "testikun (via GitHub)" <gi...@apache.org>.
testikun commented on PR #3707:
URL: https://github.com/apache/maka/pull/3707#issuecomment-5408534792
Follow-up fix pushed in `89234bcc4`.
The first Windows failure was caused by the rollback path passing the current candidate installation to `verifyPackagedWindowsApp` with the `legacy-baseline` contract, which required the retired `bundled-git.json`. That is now `artifactContract: current`.
The next Windows run exposed a second integration detail from the verifier reuse: the old rollback-only launcher created the smoke working directory implicitly, while the shared verifier writes `packaged-sandbox-manifest.json` directly into it. The rollback helper now creates that directory explicitly before delegation.
Local verification: `node --test scripts/verify-windows-harness.test.mjs`, `npm run format:check`, and `npm run lint` pass.
<details><summary>简体中文</summary>
回滚验证现在使用 current 契约,并在调用共享 verifier 前显式创建 smoke 目录,修复了 Git 资源误检和 `ENOENT packaged-sandbox-manifest.json` 两个 CI 失败。
</details>
Generated-by: OpenAI Codex
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] refactor(windows): reuse packaged verifier for rollback [maka]
Posted by "testikun (via GitHub)" <gi...@apache.org>.
testikun commented on code in PR #3707:
URL: https://github.com/apache/maka/pull/3707#discussion_r3859206879
##########
scripts/verify-windows-installer-rollback.mjs:
##########
@@ -173,43 +168,23 @@ $entries | ForEach-Object { Remove-Item -LiteralPath $_.Path -Recurse -Force }
});
}
-async function assertLaunchable(installedExecutable, workingDirectory, expectedVersion) {
- const home = join(workingDirectory, 'home');
- const userData = join(workingDirectory, 'user-data');
- const userEnv = isolatedUserEnv(home);
- await mkdir(home, { recursive: true });
- await mkdir(userData, { recursive: true });
- await mkdir(userEnv.APPDATA, { recursive: true });
- await mkdir(userEnv.LOCALAPPDATA, { recursive: true });
- const child = spawn(
- installedExecutable,
- ['--remote-debugging-port=0', `--user-data-dir=${userData}`, '--enable-logging=stderr'],
- {
- cwd: workingDirectory,
- env: { ...process.env, MAKA_SKIP_SHELL_ENV: '1', ...userEnv },
- stdio: ['ignore', 'ignore', 'pipe'],
- },
- );
- let stderr = '';
- child.stderr.setEncoding('utf8');
- child.stderr.on('data', (chunk) => {
- stderr = `${stderr}${chunk}`.slice(-16_384);
- });
- try {
- const cdpPort = await waitForDevToolsPort(child);
- const target = await findRendererTarget(cdpPort, child);
- await waitForUsableRenderer(target.webSocketDebuggerUrl, child, {
- description: 'Restored app renderer',
- }).catch((error) => {
- throw new Error(`${error.message}${stderr.trim() ? `\n${stderr.trim()}` : ''}`, {
- cause: error,
- });
- });
- const productVersion = await readInstalledProductVersion(installedExecutable);
- assertWindowsProductVersion(productVersion, expectedVersion);
- } finally {
- await stopChild(child);
- }
+export async function verifyRestoredWindowsInstallation(
+ installDirectory,
+ workingDirectory,
+ expectedVersion,
+ { verifyApp = verifyPackagedWindowsApp, run } = {},
+) {
+ await mkdir(workingDirectory, { recursive: true });
+ const options = {
+ // The rollback verifier restores the candidate installer, not the pinned
+ // upgrade baseline. The candidate is built from the current tree and must
+ // therefore satisfy the current packaged-artifact contract.
+ artifactContract: 'current',
Review Comment:
Addressed in `540f2f578`, rebased onto the latest `apache/main` (`45ca7c0c9`).
The rollback path now reuses `smokePackagedRenderer` plus the shared Windows product-version assertion only. It no longer invokes the full `verifyPackagedWindowsApp` contract, so sandbox/stdio/node-pty/dependency checks remain owned by the earlier package verification step. The rollback-specific byte-identical tree, registry, backup, recovery, and fail-closed checks are unchanged.
I also updated the PR body to remove the stale `legacy-baseline` claim and document the narrowed boundary. The focused harness suite passes 42/42 and lint/format/script checks pass locally; the Windows installer gate remains CI-authoritative because this workspace is macOS.
简体中文:已在 `540f2f578` 修复并基于最新主干重放。回滚流程现在只复用 renderer smoke 和版本校验,不再重复完整 packaged-app 检查;PR 描述也已同步更新。
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] refactor(windows): reuse packaged verifier for rollback [maka]
Posted by "testikun (via GitHub)" <gi...@apache.org>.
testikun commented on code in PR #3707:
URL: https://github.com/apache/maka/pull/3707#discussion_r3859223541
##########
scripts/verify-windows-installer-rollback.mjs:
##########
@@ -173,43 +168,23 @@ $entries | ForEach-Object { Remove-Item -LiteralPath $_.Path -Recurse -Force }
});
}
-async function assertLaunchable(installedExecutable, workingDirectory, expectedVersion) {
- const home = join(workingDirectory, 'home');
- const userData = join(workingDirectory, 'user-data');
- const userEnv = isolatedUserEnv(home);
- await mkdir(home, { recursive: true });
- await mkdir(userData, { recursive: true });
- await mkdir(userEnv.APPDATA, { recursive: true });
- await mkdir(userEnv.LOCALAPPDATA, { recursive: true });
- const child = spawn(
- installedExecutable,
- ['--remote-debugging-port=0', `--user-data-dir=${userData}`, '--enable-logging=stderr'],
- {
- cwd: workingDirectory,
- env: { ...process.env, MAKA_SKIP_SHELL_ENV: '1', ...userEnv },
- stdio: ['ignore', 'ignore', 'pipe'],
- },
- );
- let stderr = '';
- child.stderr.setEncoding('utf8');
- child.stderr.on('data', (chunk) => {
- stderr = `${stderr}${chunk}`.slice(-16_384);
- });
- try {
- const cdpPort = await waitForDevToolsPort(child);
- const target = await findRendererTarget(cdpPort, child);
- await waitForUsableRenderer(target.webSocketDebuggerUrl, child, {
- description: 'Restored app renderer',
- }).catch((error) => {
- throw new Error(`${error.message}${stderr.trim() ? `\n${stderr.trim()}` : ''}`, {
- cause: error,
- });
- });
- const productVersion = await readInstalledProductVersion(installedExecutable);
- assertWindowsProductVersion(productVersion, expectedVersion);
- } finally {
- await stopChild(child);
- }
+export async function verifyRestoredWindowsInstallation(
+ installDirectory,
+ workingDirectory,
+ expectedVersion,
+ { verifyApp = verifyPackagedWindowsApp, run } = {},
+) {
+ await mkdir(workingDirectory, { recursive: true });
+ const options = {
+ // The rollback verifier restores the candidate installer, not the pinned
+ // upgrade baseline. The candidate is built from the current tree and must
+ // therefore satisfy the current packaged-artifact contract.
+ artifactContract: 'current',
Review Comment:
Follow-up: I amended the same change to `7f548a541` to restore the real `Generated-by: OpenAI Codex` commit trailer required by the repository. The code and tests are unchanged.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] refactor(windows): reuse packaged verifier for rollback [maka]
Posted by "Astro-Han (via GitHub)" <gi...@apache.org>.
Astro-Han merged PR #3707:
URL: https://github.com/apache/maka/pull/3707
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] refactor(windows): reuse packaged verifier for rollback [maka]
Posted by "Astro-Han (via GitHub)" <gi...@apache.org>.
Astro-Han commented on PR #3707:
URL: https://github.com/apache/maka/pull/3707#issuecomment-5406471902
Looks good, CI is running.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org