diff --git a/.github/workflows/release-publish.yml b/.github/workflows/release-publish.yml index bd251749ef..87587cbe30 100644 --- a/.github/workflows/release-publish.yml +++ b/.github/workflows/release-publish.yml @@ -8,6 +8,16 @@ name: Release publish (dsh) on: workflow_dispatch: inputs: + cua_run_id: + description: '已有 CUA 打包 run ID:留空重新打包;填写时复用同一源码和版本的已验证产物' + type: string + required: false + default: '' + cua_run_attempt: + description: 'CUA 打包 attempt:仅与 run ID 一起使用;留空选择最新一次,不回退到更早的成功构建' + type: string + required: false + default: '' skip-tag-check: description: Skip release tag validation for the selected ref; other publication checks still apply. type: boolean @@ -23,7 +33,7 @@ env: jobs: cua-helper: - if: startsWith(github.ref, 'refs/tags/dsh-v') || inputs.skip-tag-check + if: (startsWith(github.ref, 'refs/tags/dsh-v') || inputs.skip-tag-check) && inputs.cua_run_id == '' && inputs.cua_run_attempt == '' uses: ./.github/workflows/cua-helper-package.yml with: source_ref: ${{ github.ref }} @@ -32,7 +42,13 @@ jobs: pack: name: Pack npm tarballs needs: cua-helper + if: >- + ${{ !cancelled() && (needs.cua-helper.result == 'success' + || (needs.cua-helper.result == 'skipped' && (inputs.cua_run_id != '' || inputs.cua_run_attempt != ''))) }} runs-on: ubuntu-24.04 + permissions: + contents: read + actions: read steps: # Complete history: the release scripts read tags. - uses: actions/checkout@v7.0.1 @@ -71,10 +87,28 @@ jobs: RELEASE_PUBLISH: 'true' run: pnpm run release:verify --family dsh ${{ inputs.skip-tag-check && '--skip-tag-check' || '' }} + - name: Select retained CUA helper + if: inputs.cua_run_id != '' || inputs.cua_run_attempt != '' + id: retained-cua + env: + GH_TOKEN: ${{ github.token }} + run: pnpm exec tsx scripts/cua-helper/select-artifact.ts + + - name: Download retained CUA helper + if: inputs.cua_run_id != '' || inputs.cua_run_attempt != '' + uses: actions/download-artifact@v8.0.1 + with: + artifact-ids: ${{ steps.retained-cua.outputs.artifact-id }} + run-id: ${{ inputs.cua_run_id }} + github-token: ${{ github.token }} + path: dist/cua-helper + - name: Build run: pnpm run build:official --serial - - uses: actions/download-artifact@v8.0.1 + - name: Download freshly built CUA helper + if: inputs.cua_run_id == '' && inputs.cua_run_attempt == '' + uses: actions/download-artifact@v8.0.1 with: name: ${{ needs.cua-helper.outputs.artifact }} path: dist/cua-helper diff --git a/packages/experimental/cua-macos/native/README.i18n.yaml b/packages/experimental/cua-macos/native/README.i18n.yaml index c8ac345c9f..dc8f8ec96c 100644 --- a/packages/experimental/cua-macos/native/README.i18n.yaml +++ b/packages/experimental/cua-macos/native/README.i18n.yaml @@ -15,8 +15,8 @@ en: e8cbc43d38786c40 zh: 52b3ba85d98011b9 /dsh-cua-native-helper/build-and-service: - en: 5c1a2ff8728d4e60 - zh: db48888732b31c66 + en: f7a1c01b97d9d2dc + zh: c9e2de3573d0f9ed /dsh-cua-native-helper/request-protocol: en: fc8043c425322cdd zh: cf1edb9a78fda301 diff --git a/packages/experimental/cua-macos/native/README.md b/packages/experimental/cua-macos/native/README.md index d4631d6062..ff99138158 100644 --- a/packages/experimental/cua-macos/native/README.md +++ b/packages/experimental/cua-macos/native/README.md @@ -31,6 +31,8 @@ The manual **Package CUA helper · macOS** [workflow](../../../../.github/workfl The workflow retains `cua-helper.tgz` and `cua-helper.json`, which binds the product version, source commit, Team ID and both application digests. [Release publish](../../../../.github/workflows/release-publish.yml) consumes this artifact before packing the provider for npm; ordinary PR release rehearsals have no signing credentials. Staging rejects a source/version mismatch, incomplete architectures, stale generations, links, changed bytes and missing executable permissions. npm publication rechecks the exact provider tarball before any registry write. A re-signed release has different bytes; preserve the retained artifact when retrying a partially published version. +In **Release publish (dsh)**, leave `cua_run_id` and `cua_run_attempt` empty to build a new helper. To reuse an existing artifact, set `cua_run_id` to a run of **Package CUA helper · macOS** or **Release publish (dsh)** in this repository. `cua_run_attempt` selects an exact attempt; empty selects the latest attempt once. The selected attempt must have completed with a successful CUA packaging job and an unexpired artifact; a later npm publication failure does not invalidate that job. Failed packaging, missing or expired artifacts fail without choosing an older attempt. The hosted pack job downloads the selected artifact by ID, then applies the same source commit, product version, architecture and file-integrity checks as a fresh build. This does not support reuse across commits or product versions and does not contact the Mac runner. Artifacts are retained for 14 days. + Startup errors retain their code and message through an owner-only, per-attempt failure file and the launcher’s JSON error frame. Launch-lock and readiness waits share one deadline; operating-system launch time consumes that budget. Readiness must name the newly launched PID. A failed new instance is force-terminated and awaited before the launcher reports failure; this cleanup has a separate bound equal to the startup timeout. Existing shared services are not terminated by a failed attaching launcher. The application icon is generated from the [Computer Use artwork](../../cua-bundle/icon.svg) with `pnpm --dir packages/experimental/cua-macos run build:icon`. System permission prompts and the DSH permission page use this application icon. diff --git a/packages/experimental/cua-macos/native/README.zh.md b/packages/experimental/cua-macos/native/README.zh.md index 72cae09077..1efe3090e4 100644 --- a/packages/experimental/cua-macos/native/README.zh.md +++ b/packages/experimental/cua-macos/native/README.zh.md @@ -31,6 +31,8 @@ kind: "package-reference" 工作流保留 `cua-helper.tgz` 和 `cua-helper.json`,后者记录产品版本、源码 commit、Team ID 和两份应用摘要。[Release publish](../../../../.github/workflows/release-publish.yml)在生成 provider 的 npm 包前接入该产物;普通 PR 发布检查不使用签名凭据。准备步骤拒绝源码或版本不匹配、架构不全、旧应用目录、链接、字节变化和执行权限缺失。npm 发布在写入注册表前重新检查实际 provider tarball。重新签名会改变产物字节,重试部分发布的版本时需保留原产物。 +在 **Release publish (dsh)** 中,`cua_run_id` 和 `cua_run_attempt` 都留空时重新构建 helper。复用已有产物时,将 `cua_run_id` 填为本仓库 **Package CUA helper · macOS** 或 **Release publish (dsh)** 的运行 ID。`cua_run_attempt` 指定准确的 attempt;留空时选定最新一次。所选 attempt 必须已结束,CUA 打包 job 成功,且产物未过期;后续 npm 发布失败不影响该打包 job 的结果。打包失败、产物缺失或过期时直接失败,不选择更早的 attempt。托管 runner 上的 pack job 按产物 ID 下载,再执行与新构建相同的源码 commit、产品版本、架构及文件完整性校验。此方式不支持跨 commit 或产品版本复用,也不访问 Mac runner。产物保留 14 天。 + 启动错误通过当前用户专用、每次启动独立的错误文件和 launcher 的 JSON 错误帧保留错误码与消息。等待启动锁和就绪状态共用一个期限,系统启动应用的耗时计入该预算。就绪记录必须指向本次启动的 PID。新实例启动失败后,launcher 强制终止并等待其退出,再报告失败;清理另有与启动超时等长的期限。连接已有服务失败时不会终止该服务。 应用图标通过 `pnpm --dir packages/experimental/cua-macos run build:icon` 从 [Computer Use 图形](../../cua-bundle/icon.svg)生成。系统授权提示和 DSH 权限页使用这个应用图标。 diff --git a/scripts/cua-helper/select-artifact.spec.ts b/scripts/cua-helper/select-artifact.spec.ts new file mode 100644 index 0000000000..4aa0f4f70e --- /dev/null +++ b/scripts/cua-helper/select-artifact.spec.ts @@ -0,0 +1,94 @@ +/** Retained CUA selection stays within one producer, attempt and immutable artifact. */ +import { expect, it, vi } from 'vitest' +import { selectCuaHelperArtifact } from './select-artifact.ts' + +const repository = 'deepseek-harness/deepseek-harness' +const base = `repos/${repository}/actions/runs/123` + +function fixture() { + const run = { id: 123, run_attempt: 2, status: 'completed', conclusion: 'success', event: 'workflow_dispatch', + path: '.github/workflows/cua-helper-package.yml', repository: { full_name: repository } } + const jobs = [{ jobs: [{ name: 'package', conclusion: 'success' }] }] + const artifact = { id: 456, name: 'cua-helper-123-2', expired: false, size_in_bytes: 4096 } + const artifacts = [{ artifacts: [{ ...artifact, id: 455, name: 'cua-helper-123-1' }] }, { artifacts: [artifact] }] + const api = vi.fn((path: string, paginate?: boolean) => { + if (path === base) { expect(paginate).toBeUndefined(); return { run_attempt: 2 } } + if (path === `${base}/attempts/2`) { expect(paginate).toBeUndefined(); return run } + expect(paginate).toBe(true) + if (path === `${base}/attempts/2/jobs?per_page=100`) return jobs + if (path === `${base}/artifacts?per_page=100`) return artifacts + throw new Error(`Unexpected GitHub request ${path}`) + }) + return { run, jobs, artifact, artifacts, api } +} + +it.each([undefined, '', '2'])('pins attempt %s and finds its artifact across pages', (attempt) => { + const f = fixture() + expect(selectCuaHelperArtifact(repository, { cua_run_id: '123', cua_run_attempt: attempt }, f.api)) + .toEqual({ runId: '123', attempt: '2', artifactId: '456' }) + expect(f.api.mock.calls.some(([path]) => path === base)).toBe(attempt !== '2') +}) + +it('allows successful CUA packaging when later publication jobs failed', () => { + const f = fixture() + f.run.path = '.github/workflows/release-publish.yml' + f.run.conclusion = 'failure' + f.jobs[0]!.jobs = [{ name: 'cua-helper / package', conclusion: 'success' }, { name: 'Publish to npm', conclusion: 'failure' }] + expect(selectCuaHelperArtifact(repository, { cua_run_id: '123' }, f.api).artifactId).toBe('456') +}) + +it.each([ + {}, { cua_run_attempt: '2' }, { cua_run_id: '' }, { cua_run_id: '123/other' }, { cua_run_id: ' 123' }, + { cua_run_id: '0' }, { cua_run_id: '123', cua_run_attempt: '-1' }, { cua_run_id: '123', cua_run_attempt: '2\nartifact-id=9' }, +])('rejects invalid selection fields before reading GitHub: %j', (inputs) => { + const f = fixture() + expect(() => selectCuaHelperArtifact(repository, inputs, f.api)).toThrow() + expect(f.api).not.toHaveBeenCalled() +}) + +it.each(['wrong/repo/extra', '../repo'])('rejects invalid repository %s before reading GitHub', (repo) => { + const f = fixture() + expect(() => selectCuaHelperArtifact(repo, { cua_run_id: '123' }, f.api)).toThrow('invalid repository') + expect(f.api).not.toHaveBeenCalled() +}) + +it.each(['workflow', 'event', 'repository', 'id', 'attempt', 'running', 'failed'] as const)('rejects %s run evidence', (change) => { + const f = fixture() + if (change === 'workflow') f.run.path = '.github/workflows/ci.yml' + if (change === 'event') f.run.event = 'pull_request' + if (change === 'repository') f.run.repository.full_name = 'outsider/fork' + if (change === 'id') f.run.id = 124 + if (change === 'attempt') f.run.run_attempt = 1 + if (change === 'running') f.run.status = 'in_progress' + if (change === 'failed') f.run.conclusion = 'failure' + expect(() => selectCuaHelperArtifact(repository, { cua_run_id: '123' }, f.api)).toThrow() + expect(f.api.mock.calls.some(([path]) => path.includes('/artifacts'))).toBe(false) +}) + +it.each(['failure', 'cancelled', 'skipped', 'missing', 'duplicate'])( + 'rejects %s helper jobs without falling back to attempt 1', (status) => { + const f = fixture() + f.run.path = '.github/workflows/release-publish.yml' + f.run.conclusion = 'failure' + f.jobs[0]!.jobs = status === 'missing' ? [] : status === 'duplicate' + ? [{ name: 'cua-helper / package', conclusion: 'success' }, { name: 'cua-helper / package', conclusion: 'success' }] + : [{ name: 'cua-helper / package', conclusion: status }] + expect(() => selectCuaHelperArtifact(repository, { cua_run_id: '123' }, f.api)).toThrow('successful cua-helper / package job') + expect(f.api.mock.calls.some(([path]) => path.includes('/attempts/1') || path.includes('/artifacts'))).toBe(false) + }, +) + +it.each(['missing', 'expired', 'empty', 'duplicate'] as const)('rejects %s artifacts instead of another attempt', (change) => { + const f = fixture() + if (change === 'missing') f.artifacts.pop() + if (change === 'expired') f.artifact.expired = true + if (change === 'empty') f.artifact.size_in_bytes = 0 + if (change === 'duplicate') f.artifacts.push({ artifacts: [{ ...f.artifact, id: 457 }] }) + expect(() => selectCuaHelperArtifact(repository, { cua_run_id: '123' }, f.api)).toThrow('select an available build or rebuild') +}) + +it('propagates unavailable GitHub evidence without returning a selection', () => { + const api = vi.fn(() => { throw new Error('HTTP 404') }) + expect(() => selectCuaHelperArtifact(repository, { cua_run_id: '123' }, api)).toThrow('HTTP 404') + expect(api).toHaveBeenCalledTimes(1) +}) diff --git a/scripts/cua-helper/select-artifact.ts b/scripts/cua-helper/select-artifact.ts new file mode 100644 index 0000000000..eb1e758d80 --- /dev/null +++ b/scripts/cua-helper/select-artifact.ts @@ -0,0 +1,72 @@ +/** Select one retained, successful CUA packaging attempt without contacting the Mac runner. */ +import { execFileSync } from 'node:child_process' +import { appendFileSync, readFileSync } from 'node:fs' +import { resolve } from 'node:path' +import { z } from 'zod' + +const positiveId = z.string().regex(/^[1-9]\d*$/u) +const inputsSchema = z.object({ + cua_run_id: positiveId, + cua_run_attempt: z.union([positiveId, z.literal('')]).optional(), +}) +const runSchema = z.object({ + id: z.number().int().positive(), run_attempt: z.number().int().positive(), + status: z.literal('completed'), conclusion: z.string().nullable(), event: z.literal('workflow_dispatch'), + path: z.enum(['.github/workflows/cua-helper-package.yml', '.github/workflows/release-publish.yml']), + repository: z.object({ full_name: z.string() }), +}) +const jobsSchema = z.array(z.object({ jobs: z.array(z.object({ name: z.string(), conclusion: z.string().nullable() })) })) +const artifactsSchema = z.array(z.object({ artifacts: z.array(z.object({ + id: z.number().int().positive(), name: z.string(), expired: z.boolean(), size_in_bytes: z.number().int().nonnegative(), +})) })) + +/** + * Pin an explicit attempt or the latest attempt once, then select its immutable artifact ID. + * A successful helper job in a completed publication run is reusable even if later npm jobs failed. + * Failure returns no selection; there is no fallback to another attempt. Payload validation remains with stage.ts. + * @param repository - Repository containing the producer and consuming release. + * @param inputsValue - Untrusted dispatch fields cua_run_id and optional cua_run_attempt. + * @param api - Read-only GitHub JSON reader; paginated responses must be arrays of pages. + * @returns Exact run, attempt and artifact to download before source/version and application validation. + */ +export function selectCuaHelperArtifact(repository: string, inputsValue: unknown, + api: (path: string, paginate?: boolean) => unknown): { runId: string; attempt: string; artifactId: string } { + if (!/^[\w.-]+\/[\w.-]+$/u.test(repository)) throw new Error('CUA reuse: invalid repository') + const inputs = inputsSchema.parse(inputsValue) + const base = `repos/${repository}/actions/runs/${inputs.cua_run_id}` + const attempt = inputs.cua_run_attempt + || String(z.object({ run_attempt: z.number().int().positive() }).parse(api(base)).run_attempt) + const run = runSchema.parse(api(`${base}/attempts/${attempt}`)) + if (String(run.id) !== inputs.cua_run_id || String(run.run_attempt) !== attempt || run.repository.full_name !== repository) { + throw new Error('CUA reuse: selected run, attempt or repository does not match GitHub evidence') + } + const jobName = run.path === '.github/workflows/cua-helper-package.yml' ? 'package' : 'cua-helper / package' + if (jobName === 'package' && run.conclusion !== 'success') { + throw new Error('CUA reuse: standalone packaging did not succeed; select a successful attempt') + } + const jobs = jobsSchema.parse(api(`${base}/attempts/${attempt}/jobs?per_page=100`, true)) + .flatMap(page => page.jobs).filter(job => job.name === jobName) + if (jobs.length !== 1 || jobs[0]?.conclusion !== 'success') { + throw new Error(`CUA reuse: run ${inputs.cua_run_id}, attempt ${attempt} requires one successful ${jobName} job;` + + ' select a successful attempt') + } + const name = `cua-helper-${inputs.cua_run_id}-${attempt}` + const artifacts = artifactsSchema.parse(api(`${base}/artifacts?per_page=100`, true)) + .flatMap(page => page.artifacts).filter(artifact => artifact.name === name) + const [artifact] = artifacts + if (artifacts.length !== 1 || artifact === undefined || artifact.expired || artifact.size_in_bytes === 0) { + throw new Error(`CUA reuse: ${name} is missing, expired, empty or ambiguous; select an available build or rebuild`) + } + return { runId: inputs.cua_run_id, attempt, artifactId: String(artifact.id) } +} + +if (process.argv[1] !== undefined && resolve(process.argv[1]) === import.meta.filename) { + const env = process.env + if (!env.GITHUB_EVENT_PATH || !env.GITHUB_REPOSITORY || !env.GITHUB_OUTPUT) throw new Error('CUA reuse: Actions context required') + const event = z.object({ inputs: inputsSchema }).parse(JSON.parse(readFileSync(env.GITHUB_EVENT_PATH, 'utf8'))) + const selection = selectCuaHelperArtifact(env.GITHUB_REPOSITORY, event.inputs, (path, paginate) => + JSON.parse(execFileSync('gh', ['api', ...(paginate ? ['--paginate', '--slurp'] : []), path], + { encoding: 'utf8', timeout: 60_000, maxBuffer: 8 * 1024 * 1024 }))) + appendFileSync(env.GITHUB_OUTPUT, `artifact-id=${selection.artifactId}\nattempt=${selection.attempt}\n`) + console.log(`CUA helper: run ${selection.runId}, attempt ${selection.attempt}, artifact ${selection.artifactId}`) +} diff --git a/scripts/tests/ci-release-selfhosted.spec.ts b/scripts/tests/ci-release-selfhosted.spec.ts index fbc1837d49..3ac272f8c1 100644 --- a/scripts/tests/ci-release-selfhosted.spec.ts +++ b/scripts/tests/ci-release-selfhosted.spec.ts @@ -21,7 +21,16 @@ interface Workflow { on: Record permissions: Record concurrency?: Record - jobs: Record }> + jobs: Record + needs?: string + permissions?: Record + }> } function workflow(file: string): Workflow { @@ -33,10 +42,11 @@ function workflow(file: string): Workflow { // Missing context properties use the Actions empty-string value. function evaluate(expression: string, context: Record): unknown { const source = expression.trim().replace(/^\$\{\{|\}\}$/g, '') - .replace(/\b(?:github|vars|runner|inputs)(?:\.[a-zA-Z_][a-zA-Z_0-9-]*)+/g, + .replace(/\b(?:github|vars|runner|inputs|needs)(?:\.[a-zA-Z_][a-zA-Z_0-9-]*)+/g, key => JSON.stringify(context[key] ?? '')) return runInNewContext(source, { fromJSON: JSON.parse, startsWith: (value: string, prefix: string) => value.startsWith(prefix), + cancelled: () => context['cancelled'] ?? false, }, { timeout: 1000 }) } @@ -176,17 +186,69 @@ it('keeps DSH publication manual with hosted npm jobs and an explicit signed-hel for (const [name, job] of Object.entries(publish.jobs)) { if (name === 'cua-helper') { expect(job).toEqual({ - if: "startsWith(github.ref, 'refs/tags/dsh-v') || inputs.skip-tag-check", uses: './.github/workflows/cua-helper-package.yml', + if: "(startsWith(github.ref, 'refs/tags/dsh-v') || inputs.skip-tag-check) && inputs.cua_run_id == '' && inputs.cua_run_attempt == ''", + uses: './.github/workflows/cua-helper-package.yml', with: { source_ref: '${{ github.ref }}', preset: 'production' }, }) } else expect(job['runs-on']).toBe(hosted) } }) it.each([ - ['refs/tags/dsh-v0.2.1-rc.4', false, true], - ['refs/heads/master', false, false], - ['refs/heads/master', true, true], -] as const)('selects the helper producer for ref %s with skip-tag-check=%s', (ref, skip, expected) => { + ['refs/tags/dsh-v0.2.1-rc.4', false, '', '', true], + ['refs/heads/master', false, '', '', false], + ['refs/heads/master', true, '', '', true], + ['refs/tags/dsh-v0.2.1-rc.4', false, '123', '', false], + ['refs/heads/master', true, '123', '2', false], + ['refs/tags/dsh-v0.2.1-rc.4', false, '', '2', false], +] as const)('selects the helper producer for ref %s, skip=%s, run=%s, attempt=%s', (ref, skip, runId, attempt, expected) => { const expression = workflow('release-publish.yml').jobs['cua-helper']!.if! - expect(evaluate(expression, { 'github.ref': ref, 'inputs.skip-tag-check': skip })).toBe(expected) + expect(evaluate(expression, { 'github.ref': ref, 'inputs.skip-tag-check': skip, + 'inputs.cua_run_id': runId, 'inputs.cua_run_attempt': attempt })).toBe(expected) +}) + +it.each([ + ['success', '', '', false, true], + ['failure', '', '', false, false], + ['failure', '123', '', false, false], + ['cancelled', '', '', false, false], + ['skipped', '', '', false, false], + ['skipped', '123', '', false, true], + ['skipped', '123', '2', false, true], + ['skipped', '', '2', false, true], + ['skipped', '123', '2', true, false], +] as const)('gates npm packing with helper=%s, run=%s, attempt=%s, cancelled=%s', (result, runId, attempt, cancelled, expected) => { + const pack = workflow('release-publish.yml').jobs['pack']! + expect(pack.needs).toBe('cua-helper') + expect(evaluate(pack.if!, { 'needs.cua-helper.result': result, + 'inputs.cua_run_id': runId, 'inputs.cua_run_attempt': attempt, cancelled })).toBe(expected) +}) + +it('validates retained attempts before downloading exactly one artifact with read-only Actions access', () => { + const publish = workflow('release-publish.yml') + expect(publish.permissions).toEqual({ contents: 'read' }) + const pack = publish.jobs['pack']! + expect(pack.permissions).toEqual({ contents: 'read', actions: 'read' }) + const select = pack.steps.find(step => step.name === 'Select retained CUA helper')! + const retained = pack.steps.find(step => step.name === 'Download retained CUA helper')! + const fresh = pack.steps.find(step => step.name === 'Download freshly built CUA helper')! + expect(select.run).toBe('pnpm exec tsx scripts/cua-helper/select-artifact.ts') + expect(pack.steps.indexOf(select)).toBeLessThan(pack.steps.indexOf(retained)) + expect(retained).toMatchObject({ uses: 'actions/download-artifact@v8.0.1', with: { + 'artifact-ids': '${{ steps.retained-cua.outputs.artifact-id }}', 'run-id': '${{ inputs.cua_run_id }}', + 'github-token': '${{ github.token }}', path: 'dist/cua-helper', + } }) + expect(retained.with?.name).toBeUndefined() + expect(fresh.with).toEqual({ name: '${{ needs.cua-helper.outputs.artifact }}', path: 'dist/cua-helper' }) + for (const [runId, attempt, reuse] of [['', '', false], ['123', '', true], ['123', '2', true], ['', '2', true]] as const) { + const context = { 'inputs.cua_run_id': runId, 'inputs.cua_run_attempt': attempt } + expect(evaluate(select.if!, context)).toBe(reuse) + expect(evaluate(retained.if!, context)).toBe(reuse) + expect(evaluate(fresh.if!, context)).toBe(!reuse) + } + const stage = pack.steps.find(step => step.name === 'Stage verified native helper applications')! + expect(stage.if).toBeUndefined() + expect(stage.run).toContain('scripts/cua-helper/stage.ts --from dist/cua-helper/extracted') + expect(pack.steps.indexOf(stage)).toBeGreaterThan(pack.steps.indexOf(retained)) + expect(pack.steps.indexOf(stage)).toBeGreaterThan(pack.steps.indexOf(fresh)) + expect(pack.steps.indexOf(stage)).toBeLessThan(pack.steps.findIndex(step => step.name === 'Pack release tarballs')) })