ci: unblock change-policy on the merge PR

Two fork-vs-upstream gaps surfaced when PR Quality ran against
8d914596 (the upstream v0.4.1 merge):

1. `bun run check:policy` failed with `Cannot find package 'yaml'`
   because the change-policy job in pr-quality.yml had no
   `bun install` step. Other lanes (server-checks, desktop-checks,
   adapter-checks, coverage-checks) all install root deps before
   running their checks; change-policy was the outlier. Upstream's
   release-update-metadata.test.ts started importing `yaml` from
   the root package.json, so the missing install step finally bit.
   Fix: add the missing `bun install` step. Lockfile already pins
   yaml@2.8.3, so this is a no-op everywhere else.

2. Two assertions in scripts/pr/release-workflow.test.ts were
   written against the upstream identity (NanmiCoder/cc-haha) but
   commit 3cbed50c on this fork repointed desktop/package.json
   `homepage` and `build.publish.owner` to 706412584/cc-haha
   without updating the tests. The merge brought the upstream
   tests forward and the fork-only desktop config conflict was
   immediately. Both assertions are now fork-friendly:
     - homepage: regex `https://github.com/<owner>/cc-haha`
     - publish: explicit github provider + repo cc-haha, owner
       can be any non-empty identifier.
   Author name/email and Linux maintainer assertions are kept
   strict because commit 3cbed50c intentionally preserved them.

Tested:
  - `bun run check:policy` locally: 81/83 pass. The single
    remaining failure (`release workflow records macOS signing
    state and warns for unsigned builds`) is a Windows-only CRLF
    mismatch in a regex that uses `fi\n` against a workflow file
    with CRLF line endings. CI runs on Ubuntu and the test passes
    upstream, so this does not block the PR.

Confidence: high
Scope-risk: narrow (CI workflow + test, no product code touched).
This commit is contained in:
你的姓名 2026-06-11 03:10:51 +08:00
parent 8d91459610
commit d59819c5c3
2 changed files with 18 additions and 6 deletions

View File

@ -37,6 +37,9 @@ jobs:
with: with:
bun-version: latest bun-version: latest
- name: Install root dependencies
run: bun install
- name: Run policy tests - name: Run policy tests
run: bun run check:policy run: bun run check:policy

View File

@ -81,7 +81,11 @@ describe('release desktop workflow', () => {
} }
expect(desktopPackage.description).toBeTruthy() expect(desktopPackage.description).toBeTruthy()
expect(desktopPackage.homepage).toBe('https://github.com/NanmiCoder/cc-haha') // This fork (706412584/cc-haha) republishes desktop builds under its own
// GitHub homepage while keeping NanmiCoder's author attribution. Upstream
// (NanmiCoder/cc-haha) uses its own homepage; both are valid release-time
// shapes, so accept either.
expect(desktopPackage.homepage).toMatch(/^https:\/\/github\.com\/[^/]+\/cc-haha$/)
expect(desktopPackage.author?.name).toBe('NanmiCoder') expect(desktopPackage.author?.name).toBe('NanmiCoder')
expect(desktopPackage.author?.email).toBe('relakkes@gmail.com') expect(desktopPackage.author?.email).toBe('relakkes@gmail.com')
expect(desktopPackage.build?.linux?.maintainer).toBe('NanmiCoder <relakkes@gmail.com>') expect(desktopPackage.build?.linux?.maintainer).toBe('NanmiCoder <relakkes@gmail.com>')
@ -305,13 +309,18 @@ describe('release desktop workflow', () => {
} }
} }
expect(desktopPackage.build.publish).toEqual([ // The fork (706412584/cc-haha) republishes desktop builds under its own
{ // GitHub owner; upstream (NanmiCoder/cc-haha) uses its own. Both are
// valid release-time shapes — we only require that publish is pinned to
// GitHub with explicit owner/repo (no autodetect from git remote).
expect(desktopPackage.build.publish).toHaveLength(1)
expect(desktopPackage.build.publish?.[0]).toEqual(
expect.objectContaining({
provider: 'github', provider: 'github',
owner: 'NanmiCoder', owner: expect.stringMatching(/^[\w-]+$/),
repo: 'cc-haha', repo: 'cc-haha',
}, }),
]) )
expect(desktopPackage.build.mac?.publish).toBeUndefined() expect(desktopPackage.build.mac?.publish).toBeUndefined()
expect(desktopPackage.build.win?.publish).toBeUndefined() expect(desktopPackage.build.win?.publish).toBeUndefined()
expect(desktopPackage.build.linux?.publish).toBeUndefined() expect(desktopPackage.build.linux?.publish).toBeUndefined()