Skip to content

fix(updater): bind release digests and verify cached update resumes - #117

Open
dwgx wants to merge 5 commits into
RoutineMiku:mainfrom
dwgx:fix/release-digest-and-verified-resume
Open

dwgx wants to merge 5 commits into
RoutineMiku:mainfrom
dwgx:fix/release-digest-and-verified-resume

Conversation

@dwgx

@dwgx dwgx commented Nov 21, 2026 •

Copy link
Copy Markdown

Problem

The downloader changes in #103 can verify a supplied SHA-256 digest, but the release/runtime callers also need to carry the official asset identity through to the download. A retained update directory must be verified against current release metadata before it is resumed.

The app-only update path exposes two additional failures: a release containing only *-app.zip is not selected correctly for resume, and rebuilding that archive incorrectly requires the executable that exists only in a full portable package. The previous asynchronous incremental tests could report success before their assertions completed.

Changes

  • Parse valid GitHub asset SHA-256 digests and pass them to runtime/full-update downloads. Mirror metadata cannot supply or overwrite the official digest; conflicting official digests remove the verification anchor.

  • Verify the retained archive against fresh, matching release metadata and rebuild payloads from verified archive bytes. Missing, stale or mismatched identity declines automatic resume and retains the cached data.

  • Select portable and app-only assets separately from the same metadata response. App-only payloads require their app package metadata, carry mode: 'app', and do not require an executable.

  • Rebuild a manually prepared app payload instead of trusting an old ready marker. Verify manifest files before publishing the rebuilt directory.

  • Coordinate boot resume and manual updates through one ownership gate so cancellation cannot release another update's gate.

  • Await incremental test cases before counting results or exiting, with a controlled delayed-failure mode that must exit nonzero.

  • Add focused release-identity, resume-identity, app-only and preservation regressions.

Relationship to #103

This branch preserves the original #103 commits, including head 414db215a46a493e839ad75d7867a8b63ec87154, as ancestors. It merges the current upstream baseline a4d4a23cdd20d8943703ae172a0c8734ca23b097 and then adds two semantic commits for release identity and verified resume. #103 has not been rebased or force-pushed.

Until #103 is merged, its download changes also appear in this PR's diff.

Validation

On Windows with Node 24.19.0, the candidate tree passed:

  • node test/incremental-test.js: 11 passed.

  • node test/incremental-resume-app-test.js: 11 passed, using real small ZIP fixtures and local HTTP where needed.

  • node test/release-identity-test.js: 18 passed.

  • node test/resume-identity-test.js: 44 passed.

  • node test/range-validation-test.js, node test/issue-hardening-test.js, and the full npm.cmd test command: exit 0.

  • Controlled APKSTART_TEST_LATE_FAIL=1: 11 passed, 1 deliberately failed, native exit 1. The old harness incorrectly exited 0 under the delayed-failure control.

  • An unchanged independent six-case Windows probe failed on the previous resume candidate (the retained Windows baseline record is 3/6) and passed 6/6 on this head, including app-only and dual-asset releases, archive bytes, marker identity and preservation controls.

The public branch has the exact Git tree of the tested candidate 4ce389ffbc560ac08306f7629fb3ade00ad5caeb: f983ffc86532f3212b1af5d4cc01badcd707874e.

Transient Windows rename failures observed during testing were retained in the review records; a bounded retry was added for the payload publication rename. This does not claim every filesystem failure is recoverable.

Scope and remaining verification

This addresses update preparation and resume. It does not claim that the complete real application update/restart cycle or all reports under #98 are resolved. Executing the generated PowerShell apply/rollback helper, real GUI/APK launches, installer flows and large runtime downloads remain separate verification work.

The manual incremental download path still validates the archive against its manifest; this PR does not claim to add a separate official digest anchor for that manifest.

Upstream workflow approval and the fork validation below are separate statuses.

Windows CI verification (2026-11-21)

The existing CI workflow passed on the exact head 79338bb969c9dfed3070010cc9a123078d22bbec in the contributor fork: 44879081182. Both Windows / Node 20 and Node 22 jobs completed successfully, including dependency installation, the test command and the pointer-hook smoke test.

The APK-fixture test self-skipped because no APK fixture / APKSTART_TEST_APK was supplied. The successful workflow does not count that scenario as exercised.

This is a fork CI result for the reviewed commit. It does not change the upstream workflow approval state or establish real GUI, installer, application health or update/restart acceptance.

dwgx added 5 commits November 17, 2026 21:16
downloadMulti 在 dedup/单源检查后、并行探测前早退:无 expectSha256 时走 downloadAnyParallel 逐源整包尝试,换源前 discardPartial,返回 sources:1/multi:false/resumed:false,且不读写 .chunks.json;有锚路径字节不变。新增 6 个无锚/取消/能力保留测试到 range-validation-test.js(RED: 混块与 stale resume 两例失败;GREEN: 19/19)。带宽代价:无锚时不再叠加多镜像带宽,但所有排名源仍逐个可用。auto-test.js:1764/:1808/:1907 re-anchored — old assertions pinned no-anchor cross-mirror mixing (the removed BUG-NOANCHOR contract); capability coverage preserved on the anchored path.
Carry GitHub asset SHA-256 with its source identity into runtime and full update downloads. Preserve unanchored compatibility and avoid applying a GitHub digest to a separately repacked asset.
Validate release identity before rebuilding cached full or incremental payloads, serialize update operations, and preserve verified archives on failure. Select the app asset separately, support app-only archives, and await every asynchronous regression before reporting success.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant