修复客户端更新诊断与错误展示

This commit is contained in:
2026-08-13 15:28:14 +08:00
parent a03043d048
commit f05b9d4cb5
5 changed files with 376 additions and 13 deletions

View File

@@ -0,0 +1,130 @@
# Task: Fix Makelore updater diagnostics and release checks
## Identity
- Task ID: 20260813-makelore-updater-client-7d3a9c
- Mode: Feature
- Branch: main
- Worktree: D:\Datas\OthersProjects\makelore
- Base commit: a03043d048826609cb4f8cb7d782bde93e0e77f4
- Owner: codex
- Status: Ready for integration
## Scope
- Correlate the packaged Windows updater failure with the Works Square stable
feed and current platform/architecture resolution.
- Normalize the known missing stable-feed failure into a concise actionable
renderer-facing message while retaining raw diagnostic logging.
- Add focused updater regression coverage without changing download, install,
channel, or credential ownership behavior.
- Remove the duplicate renderer presentation shown by the installed `v1.0.0`
settings screenshot and keep raw stack diagnostics out of the ordinary user
surface while retaining them in Main-process logs.
## Intent And Constraints
- Electron Main remains the sole owner of update feed selection and
electron-updater integration.
- A missing stable updater artifact remains an error/release-readiness problem;
it must not be mislabeled as "already latest".
- Unexpected errors must retain their original messages, and no installer-role
or cross-architecture fallback may be introduced.
- Production recovery requires a separately published updater artifact; client
messaging alone does not repair the update chain.
- The currently installed `v1.0.0` is evidence of the old packaged behavior;
source changes do not affect it until a new client is built and installed.
## Outcome
- Confirmed the packaged Windows client resolves the supported stable target to
`https://square.nianxx.cn/api/app-updates/windows/x64` and that its local log
contains the reported `latest.yml` `HttpError: 404`. The corresponding public
feed currently returns the intentional server-side not-available response.
- Added a narrow renderer-facing normalization for missing Works Square stable
manifests on both Windows (`latest.yml`) and macOS (`latest-mac.yml`). The
concise Chinese message identifies an unpublished platform package and points
to retry/website download without misreporting the client as up to date.
- Raw errors remain logged, emitted, and rethrown; updater status remains
`error`; prerelease OSS feeds and unrelated errors are unchanged.
- Confirmed the screenshot's duplicated output came from one Zustand `error`
value rendered both in the status row and a second error-details card. The
settings page now renders one concise message, hides technical stacks and
URLs behind the existing generic failure copy, and keeps the retry action.
- De-duplicated the Main-process `error` event plus rejected-promise path by
per-invocation check tokens. Concurrent callers sharing one electron-updater
error now produce one renderer error status, while raw logging/rethrow and
later independent retries remain intact.
- Hardened the settings boundary so only concise Chinese user-facing prose is
shown directly. Raw English diagnostics, stacks, URLs, paths, error codes and
structured payloads fall back to the localized generic failure message.
- Confirmed the installed `v1.0.0` `app.asar` predates these source changes.
Built an isolated unsigned `v2.0.0` `win-unpacked` artifact under the user's
temporary directory without replacing the installed application or the
repository's existing `release/` output.
- No release was published. Current evidence shows website installer `0.9.2`,
installed client `1.0.0`, source version `2.0.0`, and unsigned local Windows
artifacts, so production recovery still requires release-owner action.
## Verification
- Regression tests were observed red before each Windows/macOS normalization
change and green afterward.
- `pnpm exec vitest run tests/unit/app-updater.test.ts
tests/unit/update-settings.test.tsx tests/unit/update-store.test.ts
tests/unit/sidebar-update-button.test.tsx`: initially `30 passed` across four
files; the final rerun after review fixes is recorded below.
- `pnpm exec eslint electron/main/updater.ts
src/components/settings/UpdateSettings.tsx
tests/unit/app-updater.test.ts tests/unit/update-settings.test.tsx`: exit
`0`, no findings.
- `pnpm run typecheck`: exit `0`.
- `pnpm run build:vite`: exit `0`; the production Main bundle contains the
normalized Chinese message.
- Isolated `electron-builder --dir` packaging: exit `0`; extracted `app.asar`
reports version `2.0.0`, contains the Main normalization and renderer
sanitizer, and no longer contains the `updates.errorDetails` render key.
- `pnpm test`: updater-related tests pass, but the full suite remains red with
three failures outside the changed updater scope: missing `.opencode/agent`
in `youth-plain-language-skill.test.ts`, plus two
`opencode-manager.test.ts` timing/generation failures. Focused reruns
reproduced the missing-directory failure and one generation failure; no
base-commit run was performed, so they are recorded without attributing their
origin to this task.
- Read-only Authenticode checks report `NotSigned` for the available local
Windows artifacts, including the isolated artifact; none were installed or
uploaded.
- Initial independent read-only review: FAIL with two medium findings covering
concurrent duplicate suppression and denylist-only renderer sanitization.
Both findings were corrected with focused regression tests before final
review.
- Final focused rerun after those corrections: 4 files / 37 tests passed;
typecheck, scoped ESLint, `build:vite`, `git diff --check`, and
`check_doc_drift.py --task-id 20260813-makelore-updater-client-7d3a9c` all
passed.
- Final independent read-only review: PASS with no remaining implementation,
architecture, or test-coverage finding.
## Follow-ups
- Align the authoritative release version, generate final signed/notarized
platform artifacts, publish them to Works Square as updater-role records, and
execute discover/download/restart/install smoke tests from older packages.
- Add a release job that publishes signed stable outputs to Works Square rather
than only the legacy OSS channel, with inactive-first verification and an
explicit activation policy.
- Harden the stable Windows signing job by verifying Authenticode status and
expected publisher after SignPath. Enabling publisher pinning in new clients
requires a staged rollout after the stable feed always serves signed packages.
- Repair the missing `.opencode/agent` fixture and independently diagnose the
two existing opencode-manager concurrency failures before treating the full
test suite as a release gate.
## Promotion Candidates
- After live proof, promote the stable-feed error behavior and release pipeline
requirements to canonical updater/release documentation; keep the external
release gate open until then.
- Consider promoting the UI contract that ordinary updater errors are concise,
non-duplicated, and free of raw stack/URL details; technical diagnostics stay
in Main logs.