Skip to content

fix(desktop): refresh contract manifests and gate Windows artifact upload - #2000

Closed
E2ern1ty wants to merge 1 commit into
oceanbase:masterfrom
E2ern1ty:fix/desktop-contract-drift-1995
Closed

E2ern1ty wants to merge 1 commit into
oceanbase:masterfrom
E2ern1ty:fix/desktop-contract-drift-1995

Conversation

@E2ern1ty

Copy link
Copy Markdown

Fixes #1995.

Problem

openapi/powercontext.yaml changed in #1933 (0867144c), but the checked-in Desktop contract outputs were not regenerated. Both manifests still pinned the stale SHA-256 7e1c301b… while the current normalized spec hashes to c4571e4b…, so pnpm --dir desktop generate:check (and therefore pnpm lint) fails on current master (666b043a). On the Windows packaging workflow, that early failure skipped installer construction, and the unconditional if: always() artifact upload then reported a second, misleading if-no-files-found error about missing files.

Changes

  • Regenerated desktop/ui/src/generated/operations.ts and desktop/src-tauri/src/transport/operations.json via pnpm --dir desktop generate. The operation set is unchanged; only the pinned contract identity moves to c4571e4b…, matching the spec on master.
  • Gated the desktop-windows-internal-unsigned artifact upload on the installer build step outcome (steps.installer.outcome == 'success' with !cancelled()):
    • an earlier validation failure no longer produces the missing-files error, so the original failure stays visible;
    • a successful build still fails on missing artifacts (if-no-files-found: error retained);
    • when the installer was built but a later step (e.g. the smoke test) fails, the package and reports are still uploaded for diagnosis.

Verification

On macOS, against 666b043a plus this change:

  • pnpm --dir desktop generate:check — passes (previously failed with Contract drift: ui/src/generated/operations.ts).
  • pnpm --dir desktop lint — passes (oxlint, generate:check, icons:check, format:check).
  • pnpm --dir desktop typecheck — passes.
  • pnpm --dir desktop test — 28/28 pass.
  • .github/workflows/desktop.yml parses as valid YAML; the upload-step gating logic was reviewed against the four cases above (early validation failure, build failure, post-build failure, success).

The full Windows packaging workflow itself can only be exercised on GitHub's Windows runners via this PR.

…load

Regenerate the frontend and native operation manifests from the current
openapi/powercontext.yaml. The spec changed in oceanbase#1933 but the checked-in
contract outputs kept the stale SHA-256, so 'pnpm generate:check' (and
therefore 'pnpm lint') failed on current master.

Gate the Windows packaging artifact upload on the installer build step
succeeding. When an earlier validation step fails, the installer is
never built, and the unconditional upload added a misleading
if-no-files-found error on top of the original failure. Successful
builds still reject missing artifacts, and a built installer is still
uploaded for diagnosis when a later smoke test fails.

Fixes oceanbase#1995
@CLAassistant

CLAassistant commented Oct 14, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@hidb4ai hidb4ai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hidb4ai

hidb4ai commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.

@@ -1,5 +1,5 @@
{
"contractSha256": "7e1c301bf7f2ac51781280959efd0b2d92511ddeadee8314ba1683d956c93cc7",
"contractSha256": "c4571e4bd59833451e3091ee604e836d185643b0b0d9fa08dceb8eea43060cbf",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] 摘要刷新对本 base 正确,但 master 的 openapi 又已前进,合并前需要再生成一次

已独立复核:本 head 的 openapi/powercontext.yaml(LF 归一化后)sha256 = c4571e4b...,与两处签入清单一致;base 666b043a 的 spec 同为 c4571e4b...,证实 7e1c301b... 是 base 上遗留的漂移,本 PR 修复方向正确。workflow 门控的四种情形(早失败/构建失败/构建后失败/成功)语义也核对无误:安装包构建成功但 smoke 失败时仍上传产物,早失败不再制造 if-no-files-found 二次报错。

需要注意:当前 master 的 openapi 已经变为 sha256 b5631d32...(master 自己签入的清单与新 spec 一致,master 本身无漂移),所以本分支当前对 master 是 DIRTY。解决冲突后必须再跑一次 pnpm --dir desktop generate 刷新这两处清单,否则 generate:check 会以同样的方式再次失败——本 PR 修的是移动目标,建议 rebase 后以最新 master 为基准重算。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

更正:上面关于「master 的 openapi 已变为 b5631d32...、合并前必须再生成」的判断是错误的,原因是我的本地镜像引用了过期的 master 快照。已用最新 master(7f38426e)重新取证:

  • 当前 master 的 openapi sha256 = c4571e4b...,与本 PR 签入的两处清单完全一致;
  • 清单刷新已经由 feat(kimi-code): add Hook runtime observations #1988(68970cc1)先合入 master,issue bug(desktop): stale contract hashes fail Windows validation #1995 已关闭——本 PR 的「刷新清单」一半已与 master 重复,当前 DIRTY 冲突正是两侧把同一个 SHA 写进同一行的平凡冲突;
  • master 的 desktop.yml 上传步骤仍是 if: always()(步骤已改名为 "Upload installer and acceptance evidence"),所以「按安装包构建结果门控上传」这一半仍然有效、仍有价值。

建议:rebase 到当前 master 后去掉两处清单改动(master 已含相同值),保留并适配 workflow 门控改动到新的步骤布局。对错误评论带来的误导致歉。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] master 已由同一修复推进到新哈希,本 head 的值现在是回退

补充本轮实测证据(base 666b043a 之后 master 已前进 40 个提交):

  • master openapi/powercontext.yaml(LF 归一化)sha256 = e43c7034b6930688c350c68af5e7bd6083b123783b92d0a50eebbebd45aa7da7;master 的 operations.ts 与 operations.json 都已同步为该值。
  • master 新增 tests/test_desktop_contract.py::test_desktop_contract_identity_matches_openapi(由 fix(desktop): refresh contract hashes and prevent validation drift #1996 合入),逐字比较清单里的 contractSha256 与 sha256(openapi),两处清单都在参数化范围内。
  • 本 head 两个清单写的是 c4571e4b…,等于 merge-base 666b043a 上的 openapi 摘要。

因此结论不只是"合并前需要再生成一次":若以本 head 的值解决 operations.json / operations.ts 的冲突,合并后的 tests 作业会在这条用例上直接失败,pnpm --dir desktop generate:check 同样失败,而 master 现状是通过的。定级随之从 P2 上调为 P1(合入即让现有门禁变红)。

建议:pnpm --dir desktop generate 后按当前 master 重新生成两个清单,或在 #1996 已覆盖同一问题的情况下关闭本 PR,只保留 workflow 那部分改动单独提交。

@hidb4ai

hidb4ai commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

please update & resolve conflicts

@hireview001 hireview001 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Resolve merge conflicts with the target branch.

@AlexStocks AlexStocks added the 1.4.1 v1.4.1 release tracking label Oct 17, 2026
# Only enforce artifact presence once the installer was actually built;
# after an earlier validation failure there is nothing to upload and the
# missing-files error would mask the original failure.
if: ${{ !cancelled() && steps.installer.outcome == 'success' }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] 该条件的前提对 upload-artifact@v7 不成立,且会在 installer 失败时丢弃已产出的诊断证据

两点核对结果:

  1. 前提不成立。本仓这一处上传没有设置 if-no-files-found,而锁定的 cf430e03(v7)在该 SHA 的 action.yml 里对该输入写的是 default: 'warn'——缺文件只告警、不失败,因此 if: always() 不会额外制造掩盖原始失败的第二个错误。PR 正文中"if-no-files-found: error retained"与实际文件不符:该 with: 块里没有这一行。
  2. 跳过上传会丢证据。steps.installer.outcome == 'success' 为假时整步跳过,但此前步骤已经产出了 .artifacts/ci-compatibility.json(desktop/tests/fixture_qualification.py)、real-server.json、real-cli.json,这些正是判断 installer 构建失败原因所需的输入,跳过上传后它们不再进入运行记录。

建议保留 if: always();若希望显式表达严格性就写 if-no-files-found: warn(与本文件第二处上传一致),空上传报错问题已由默认值覆盖。这样 installer 失败时仍能拿到前置验收证据。

@hidb4ai

hidb4ai commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

please update & resolve conflicts

@E2ern1ty

Copy link
Copy Markdown
Author

Closing as superseded — re-verified against current master (e4efb39b):

Thanks for the reviews and the thorough verification. Nothing of value remains in this diff, so an empty rebase isn't worth anyone's CI time. Apologies for the slow response on resolving the conflicts.

@E2ern1ty E2ern1ty closed this Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1.4.1 v1.4.1 release tracking

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(desktop): stale contract hashes fail Windows validation

5 participants