qwen-code/scripts/tests
qqqys 2a57f86198
fix(ci): gate the fork signal on fields the review payload delivers (#9469)
* fix(ci): gate the fork signal on fields the review payload delivers

`qwen-autofix-fork-signal.yml` gated on
`github.event.pull_request.maintainer_can_modify == true`. That field does
not exist in a `pull_request_review` payload: the event carries the SIMPLE
pull-request object, and `maintainer_can_modify` — like `mergeable`,
`additions`, and `changed_files` — ships only on the full object the
`pull_request` event sends. The expression evaluated to null on every
delivery, `null == true` is false, and the job's `if` could never hold.

Measured on the repository: across the 300 runs between the bridge shipping
(#8676, 2026-08-07) and this change, 290 skipped, 7 cancelled, 1
action_required, and 0 success. Not one signal ever reached its step, so the
bridge behind it has never fired either — every fork-PR review has been
served by the scheduled scan alone, which is exactly the throttled backstop
this bridge exists to get ahead of.

The consent check is not lost, and does not move: the bridge already re-reads
it live (`gh pr view --json maintainerCanModify`, then
`select(… .maintainerCanModify == true)`), and that read was always the
authoritative one — consent can be withdrawn between the review and the
dispatch, so a payload copy could only ever have been a stale early-out. The
signal job cannot make that call itself: it holds `permissions: {}`, no
secrets and no checkout, deliberately, because it runs on a fork-triggered
event.

What the removal does cost is one signal + bridge run and one PR read for a
takeover-labeled fork PR whose author has turned maintainer edits off, where
the gate previously intended to spend nothing. Ordinary contributor fork PRs
are unaffected — the bot-authored-or-takeover-labeled conjunct still excludes
them.

Also adds a regression test asserting the gate references no full-object-only
field. A gate like this fails silently: the job's entire body is one echo, so
"never opens" and "no fork review happened to qualify" look identical from
outside, which is why this went twelve days unnoticed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* test(ci): match the full-object-only guard on a word boundary (R1-1)

The guard asserted the signal gate references no full-object-only field via
bare substring containment, but four deny-list entries are strict prefixes of
fields the simple pull-request object DOES deliver: `merged` in `merged_at`,
`commits` in `commits_url`, `comments` in `comments_url`, `review_comments` in
`review_comments_url`. A future edit adding a legal conjunct such as
`github.event.pull_request.merged_at == null` would turn the suite red with a
message blaming a full-object-only field — pushing the author to drop the
conjunct or weaken the guard itself.

Anchor each check on a word boundary, and add a test that pins the matcher's
discrimination on all four prefix pairs so the substring form cannot come back
unnoticed.

* test(ci): see full-object fields through the index operator (R2-1)

The full-object-only guard matched `pull_request.<field>` literally, so it
only saw the `.` property de-reference. GitHub Actions reaches the same
property through the documented `[ ]` index operator, on any segment of the
path, and `github.event.pull_request['maintainer_can_modify'] == true`
evaluates exactly as the dot form did: the field is absent from the simple
`pull_request_review` payload, `null == true` is false, and the gate never
opens. The guard stayed green through it — a silent replay of the incident
this PR fixes, invisible to the test written to catch it.

Rewrite the index form to the dot form before matching rather than
enumerating spellings, so one matcher covers every combination of the two at
any depth. The word-boundary anchor from R1-1 is unchanged, so the four
delivered fields the deny-list names prefix (`merged_at`, `commits_url`,
`comments_url`, `review_comments_url`) still pass in every spelling.

A `fromJSON(toJSON(github.event.pull_request))` round-trip still evades this;
no textual guard catches that one, and the comment says so.

Mutation-verified, each mutant reddening the tests that pin it:

| mutant | result |
|---|---|
| normalization removed (identity) | 2 failed — bracket and mixed spellings go unseen |
| word boundary dropped | 1 failed — `merged_at` rejected as `merged` |

`npx vitest run --config ./scripts/tests/vitest.config.ts
scripts/tests/qwen-autofix-fork-bridge-workflow.test.js` -> 12 passed (12).
eslint and prettier clean.

* test(ci): pin the fork-signal guard's bracket-whitespace tolerance

R3-1: `asDotAccess` rewrites `pull_request['field']` to the dot form before
matching, and its regex deliberately tolerates whitespace inside the index
(`\[\s*…\s*\]`) because GitHub Actions accepts
`github.event.pull_request[ 'maintainer_can_modify' ]` as a legal expression.
No spelling in `referenceSpellings` carried that whitespace, so the tolerance
was unpinned: deleting both `\s*` left all 12 tests green, and a later gate
edit written in the spaced form would have reached the same absent field and
restored the always-false gate this PR fixes.

Add the spaced-bracket spelling, which both index-operator tests consume.

Mutation-verified: with the two `\s*` deleted from `asDotAccess`, this file
now fails 2 tests ("rejects a full-object field without rejecting the fields
it prefixes" and "sees a full-object field through the index operator");
before this commit the same mutation left 12 passed.

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-22 18:47:00 +00:00
..
acp-serve-boundary-guard.test.js refactor(cli): keep acp-integration off serve internals (#8084) (#9144) 2026-08-22 12:39:08 +00:00
ai-release-notes-workflow.test.js chore(ci): Disable install scripts in release CI and guard security-checks workflow (#9577) 2026-08-21 03:48:03 +00:00
audit-runtime-critical.test.js ci: run Windows merge queue tests on ECS (#8386) 2026-08-05 12:14:42 +00:00
build-and-publish-image-workflow.test.js ci(autofix): restore sandbox image flow (#6261) 2026-07-03 15:30:58 +00:00
capture-tmux-ci.test.js ci: install tmux and zip tooling on the Linux test lane, and pin it (#8792) 2026-08-11 05:47:39 +00:00
check-build-status.test.js fix(review): report what the transcripts prove; build the roster in one call (#7033) 2026-07-18 00:43:57 +00:00
check-i18n.test.ts fix(cli): localize approval mode UI labels (#6592) 2026-07-11 00:07:03 +00:00
check-voice-guard-sync.test.js feat(voice): support trusted private ASR base URLs (#8350) 2026-08-06 14:04:57 +00:00
chrome-extension-package.test.js fix(ci): cover release integration regressions (#5994) 2026-06-29 11:54:11 +00:00
ci-flaky-rerun-workflow.test.js fix(ci): stop dropping agent settings in resolve and follow-up workflows (#9252) 2026-08-16 03:27:00 +00:00
ci-flaky-rerun.test.js feat(ci): auto-open a deflake fix issue for confirmed flaky tests (#7231) 2026-07-19 16:49:29 +00:00
clean-package-build-artifacts.test.js test(core): stabilize file history eviction test (#6637) 2026-07-10 06:39:52 +00:00
cli-entry.test.js fix(cli): preserve Qwen Review startup version in footers (#8431) 2026-08-04 14:58:56 +00:00
comment-attachment-guard-workflow.test.js ci: route trusted-author fork PRs and no-checkout jobs to the ECS pool (#8502) 2026-08-04 03:48:24 +00:00
cross-package-contracts.test.js refactor(cli): keep acp-integration off serve internals (#8084) (#9144) 2026-08-22 12:39:08 +00:00
desktop-oss-workflow.test.js fix(desktop): harden release pipeline (#9009) 2026-08-12 16:38:12 +00:00
dev.test.js fix(review): report what the transcripts prove; build the roster in one call (#7033) 2026-07-18 00:43:57 +00:00
e2e-workflow.test.js fix(ci): keep the post-merge E2E signal on main alive (#7795) 2026-07-28 11:54:52 +00:00
generate-changelog.test.js feat(release): user-facing bilingual digest for release notes (#9216) 2026-08-17 00:12:04 +00:00
generate-release-notes.test.js feat(release): user-facing bilingual digest for release notes (#9216) 2026-08-17 00:12:04 +00:00
get-release-version-python-sdk.test.js feat(sdk-python): add network timeouts to release version helper (#3833) 2026-05-05 19:25:00 +08:00
get-release-version.test.js fix(ci): force-push release branch so retries replace failed attempts (#9076) (#9082) 2026-08-16 16:33:14 +00:00
install-script.test.js fix(install): avoid Get-FileHash for Windows checksums (#9112) 2026-08-14 01:12:08 +00:00
integration-vitest-config.test.ts fix(tests): apply integration worker limits to forks (#8689) 2026-08-08 00:53:33 +00:00
issue-triage-ownership-workflow.test.js ci: remove broken legacy scheduled PR triage workflow (#8434) 2026-08-03 10:20:42 +00:00
lint.test.js fix(ci): cache downloaded linters on ECS runners (#9001) 2026-08-13 05:13:23 +00:00
live-host-oss-workflow.test.js fix(ci): restore Live Host release mirroring (#8917) 2026-08-11 07:08:26 +00:00
main-ci-failure-issue-workflow.test.js fix(ci): keep the post-merge E2E signal on main alive (#7795) 2026-07-28 11:54:52 +00:00
no-ak-integration-ci.test.js feat(web-shell): add transcript contract prevalidation (#9388) 2026-08-19 14:13:12 +00:00
no-core-root-barrel-config.test.js refactor(core): remove root barrel self-imports and enforce the boundary (#9635) 2026-08-22 13:42:10 +00:00
no-core-root-barrel-import.test.js refactor(core): remove root barrel self-imports and enforce the boundary (#9635) 2026-08-22 13:42:10 +00:00
package-assets.test.js fix(review): harden the pipeline against four live-run failures (#9086) 2026-08-14 04:38:49 +00:00
package-scripts.test.js feat(autofix): audit the approach instead of stopping on growth-budget breach (#9262) 2026-08-21 04:54:07 +00:00
pr-force-push-reminder-workflow.test.js ci(autofix): run agents on dedicated ECS runners (#6207) 2026-07-03 07:40:07 +00:00
pr-self-report-label.test.js feat(autofix): escalate stopped takeover PRs and age out unanswered pauses (#8960) 2026-08-15 17:32:23 +00:00
qwen-autofix-fork-bridge-workflow.test.js fix(ci): gate the fork signal on fields the review payload delivers (#9469) 2026-08-22 18:47:00 +00:00
qwen-autofix-workflow.test.js fix(autofix): pass CI=true through the gate's env -i launches (#9649) 2026-08-22 12:30:42 +00:00
qwen-fleet-shepherd-workflow.test.js fix(ci): stop counting wedged queued runs as in-flight in the shepherd (#9518) 2026-08-20 13:37:22 +00:00
qwen-pr-review-workflow.test.js fix(review): stop the fallback comment from firing on superseded runs (#9716) 2026-08-22 15:38:34 +00:00
qwen-repo-hygiene-workflow.test.js fix(ci): route workflow label mutations through REST (#8761) 2026-08-09 15:05:15 +00:00
qwen-resolve-workflow.test.js fix(ci): keep the review workflow under the expression-length limit (#8720) 2026-08-08 05:53:35 +00:00
qwen-triage-finalize-workflow.test.js fix(ci): rename triage status marker to avoid duplicate-guard collision (#7723) 2026-07-26 15:51:22 +00:00
qwen-triage-workflow.test.js fix(ci): heal a symlinked workspace instead of wedging the runner on it (#9498) 2026-08-20 13:54:36 +00:00
release-helpers.test.js refactor: extract shared release helper utilities (#3834) 2026-05-05 10:15:17 +08:00
release-sdk-workflow.test.js fix(ci): skip empty SDK release PR (#6861) 2026-07-14 13:19:42 +00:00
release-workflow.test.js fix(ci): force-push release branch so retries replace failed attempts (#9076) (#9082) 2026-08-16 16:33:14 +00:00
review-source-digest.test.ts refactor(cli): consolidate shared helpers ahead of the legacy audit skill (#9345) 2026-08-19 14:53:44 +00:00
review-worktree-cleanup-workflow.test.js fix(ci): clean review worktrees after cancellation (#8474) 2026-08-05 02:39:36 +00:00
sandbox-command.test.js fix(scripts): avoid shell injection in sandbox command detection (#6108) 2026-07-01 16:20:40 +08:00
sdk-java-workflow.test.js ci: route trusted-author fork PRs and no-checkout jobs to the ECS pool (#8502) 2026-08-04 03:48:24 +00:00
sdk-node-exporter-stub.test.js chore(deps): Clear high-severity CVE baseline and harden the security gate (#9584) 2026-08-21 07:43:32 +00:00
security-workflows.test.js chore(deps): Clear high-severity CVE baseline and harden the security gate (#9584) 2026-08-21 07:43:32 +00:00
serve-ab-workflow.test.js fix(ci): heal a symlinked workspace instead of wedging the runner on it (#9498) 2026-08-20 13:54:36 +00:00
serve-fast-path-bundle-check.test.js feat(ci): fail the startup bundle check when the CLI entry is hoisted into a chunk (#8203) 2026-07-31 08:57:57 +00:00
start.test.js fix(review): report what the transcripts prove; build the roster in one call (#7033) 2026-07-18 00:43:57 +00:00
test-setup.ts feat(installer): add standalone archive installation (#3776) 2026-05-11 13:25:48 +08:00
update-ecs-runner-qwen-workflow.test.js fix(ci): reconcile ECS runner updater on workflow changes (#8373) 2026-08-02 09:25:17 +00:00
upload-aliyun-oss-assets.test.js feat(installer): add standalone hosted install and uninstall flow (#3828) 2026-05-21 11:57:10 +08:00
verify-capture.test.js fix(ci): avoid verify capture color conflict (#8236) 2026-07-31 14:15:40 +00:00
vitest-global-setup.test.js fix(devx): fail with actionable message when unit-test build prerequisites are missing (#9149) (#9171) 2026-08-18 13:19:09 +00:00
vitest.config.ts fix(ci): back-port the checkout-heal wipe guard to the triage and serve-ab wipes (#9277) 2026-08-18 06:49:40 +00:00
workflow-helpers.js ci: run Windows merge queue tests on ECS (#8386) 2026-08-05 12:14:42 +00:00
workflow-size.test.js chore(ci): migrate autofix prose to the design record and ratchet growth (#9677) 2026-08-22 16:31:56 +00:00
workspaces.test.js feat(desktop): Add desktop app package with Qwen ACP SDK integration (#3778) 2026-06-11 21:57:20 +08:00