qwen-code/scripts/tests
易良 11e629b3a1
perf(export): split the transcript renderer's embedded CSS into a versioned asset (#11485)
* perf(export): split the transcript renderer's embedded CSS into a versioned asset

The export renderer carried the web-shell component stylesheet as a ~2.3 MB
string literal, so every reader parsed and compiled 4.1 MB of JS (56% of it dead
CSS) before a transcript could render. Lift that literal out at export build
time into a version-pinned, SRI-protected export-transcript-document.css served
from unpkg and loaded via a nonce-bearing <link>, dropping the renderer JS to
~1.83 MB.

The transform is an esbuild onLoad plugin in the web-templates export build that
strips the injected CSS constant from web-shell's dist/transcript.js; web-shell
source and runtime behavior are untouched. The document's fail-closed load-error
path is extended to the stylesheet so a missing CSS asset fails the same way as
a missing renderer.

* fix(export): match the transcript CSS entry on Windows paths too

esbuild hands plugin callbacks the platform-native absolute path, so the
extract-transcript-css `onLoad` filter never matched on Windows: the callback
did not run, `extractedTranscriptCss.css` stayed undefined, and the mandatory
extraction guard below aborted the build. That build is not platform-gated —
`scripts/prepare.js` runs it from `prepare`, so `npm ci` itself would fail on
every Windows contributor and on the windows-latest legs of test_windows and
desktop-release.

Widen the separator to `[\\/]`, keeping the `transcript\.js$` tail so the
barred `web-shell/dist/index.js` package root still does not match. The filter
moves to transcript-css-entry.mjs because build.mjs is a top-level-await script
with no harness — the same reason scripts/sdk-node-exporter-stub.js exists — so
scripts/tests/transcript-css-entry-filter.test.js can pin both separators.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Patrol-Run: qwen-pr-closeout/jmtufhms2u4

* fix(export): latch a stylesheet failure ahead of the parser block

The `<link id="transcript-stylesheet">` sits in `<head>` while the `window`
error listener that catches its failure is registered by an inline script in
`<body>`. Chromium parser-blocks that script on the pending stylesheet, so when
the CSS failure settles first the error event is dispatched with no listener to
receive it: nothing marks the render as failed, both renderComplete guards in
document-main.tsx pass, React mounts the transcript without any of the
component CSS, and the requestAnimationFrame stamps
`data-render-complete="true"`. The reviewer measured this fail-open above
roughly 2.1 MB of document HTML (272 of the 1,000 permitted blocks) for a 404,
an SRI rejection, a truncated body and a destroyed socket alike, and fail-closed
for a *late* failure — so size, not failure kind, decides it.

Latch the failure in `<head>` before the `<link>` is parsed and act on the latch
from the existing body IIFE. The head script only records: `showLoadError()`
writes `document.body.dataset` and `#app`, neither of which exists while the
parser is still in `<head>`. It carries `nonce="__EXPORT_NONCE__"` because the
document CSP allows no inline script, which is safe — `formatters/html.ts:53`
replaces every occurrence. The listener is capture-phase because resource error
events do not bubble.

Not the `link.sheet === null` variant: the reviewer measured `sheet` non-null
for a 404, a truncated body and a destroyed socket, so it only detects SRI
rejection.

scripts/tests/export-transcript-document-template.test.js pins the position,
the nonce, the capture phase and the record-only shape; all five cases go red
against the unpatched template. The behavioural witness (real Chromium, large
document, instant CSS abort) belongs to the playwright transcript gate, which
is out of budget on this host.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Patrol-Run: qwen-pr-closeout/jmtufhms2u4

* fix(scripts): name the missing export renderer assets, pin the CSS gate

The bundle copy became all-or-nothing over two artifacts but its `else` warning
still named only the renderer, so the one new way to reach that branch — a tree
built before the split, then `npm run bundle`d without rebuilding web-templates,
which has the JS and no CSS — told the operator to go looking for a
`export-transcript-document.js` that was sitting right there, and silently
discarded it. List the paths that are actually absent, matching the sibling Web
Shell warning twenty lines above. Stays warn-and-skip: prepare-package.js is the
release gate.

Also pin that release gate. Every fixture that reached `preparePackage` staged
`dist/export-transcript-document.css` unconditionally, so deleting the new
required-path entry left the whole test:scripts lane green; a release built with
`npm ci --ignore-scripts` would then publish documents whose stylesheet 404s on
unpkg for that version. `verifyBundleArtifacts` reports through console.error +
process.exit(1) rather than a throw, so the new case stubs exit instead of
copying the audio-capture sibling's `toThrow` idiom.

Both cases were flip-checked: restoring the old warning text, and deleting the
CSS line from prepare-package.js, each turn their case red.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Patrol-Run: qwen-pr-closeout/jmtufhms2u4

* fix(export): pin the stylesheet-failure id contract and sync the design docs

The <head> latch, the body listener and the <link> each spell
'transcript-stylesheet' independently and nothing compared them, so renaming
either listener's id left the whole suite green while the latch recorded
nothing - reinstating the fail-open the latch was added to close. Derive the id
from the <link> and assert both listeners compare against it. Verified red under
both mutations: latch id -> 'transcript-renderer' (1 failed | 5 passed), and the
mirror with the body listener's id wrong and the latch intact (same).

Both design docs still specified the two shapes the previous round replaced: the
forward-slash-only onLoad filter that never matches on Windows, and the
body-listener-only fail-closed extension. Section 1 now quotes the shipped
TRANSCRIPT_CSS_ENTRY_FILTER and names transcript-css-entry.mjs, section 2
describes the <head> latch (position, nonce, capture phase, record-only),
section 3 names the module-level render guard, and "Files affected" lists the
three omitted files. EN and zh-CN are updated in the same commit.

Also correct the shape-guard comment in build.mjs: the document nonces every
<style> created through document.createElement, so the CSP would not block an
un-stripped duplicate, and a 367-byte regrowth stays inside both byte budgets.
That throw is the only guard on the duplicate-injection path.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Patrol-Run: qwen-pr-closeout/jmtuo29vduf

* fix(export): close out transcript CSS review comments

* fix(export): tighten transcript CSS closeout

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

---------

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-09-10 07:15:32 +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 refactor(ci): extract release workflow scripts (#11165) 2026-09-08 07:09:09 +00:00
audit-runtime-critical.test.js ci: run Windows merge queue tests on ECS (#8386) 2026-08-05 12:14:42 +00:00
brand-create-safety.test.js feat(desktop-shell): restore the brand builder skill for the Tauri shell (#10164) 2026-08-27 12:47:50 +00:00
build-and-publish-image-workflow.test.js ci(ecs): file an issue when the runner fleet update fails (#10445) 2026-09-01 17:41:00 +00:00
build-sandbox-output.test.js fix(release): stop hiding sandbox build failures and check the prepared package early (#10784) 2026-09-02 11:38:33 +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(cli): scope startup warnings to dev sessions (#8456) 2026-08-29 13:22:34 +00:00
check-core-subpath-exports.test.js perf(cli): import core modules directly instead of the package root (#10957) 2026-09-06 11:21:50 +00:00
check-i18n.test.ts fix(cli): localize approval mode UI labels (#6592) 2026-07-11 00:07:03 +00:00
check-tui-dep-direction.test.js feat(cli): OpenTUI migration infra batch — locked deps, dependency-direction arch check, framework-neutral streaming model (#10134) 2026-08-28 02:44:46 +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 fix(ci): read the CI patrol's status rollup one PR at a time (#10861) 2026-09-03 03:21:03 +00:00
ci-platform-lanes.test.js feat(web-shell): Improve split-view session navigation (#11250) 2026-09-08 17:33:19 +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
copy-bundle-openTui-assets.test.js fix(desktop): unblock macOS and Linux desktop packaging (#11518) 2026-09-10 03:33:27 +00:00
core-subpath-exports-resolution.test.js perf(cli): let tests resolve core modules individually (#10917) 2026-09-06 10:20:05 +00:00
cross-package-contracts.test.js feat: delegate a subagent turn to an external agent over ACP (Claude Code first) (#11003) 2026-09-10 03:13:05 +00:00
cua-driver-release-workflow.test.js fix(cua): restore legacy Windows installer compatibility (#10792) 2026-09-02 09:13:49 +00:00
desktop-oss-workflow.test.js fix(desktop): harden release pipeline (#9009) 2026-08-12 16:38:12 +00:00
dev.test.js perf(cli): import core modules directly instead of the package root (#10957) 2026-09-06 11:21:50 +00:00
e2e-shard-retry.test.js fix(ci): isolate subprocess-heavy E2E from fork pressure (#11388) 2026-09-08 15:45:07 +00:00
e2e-workflow.test.js fix(ci): isolate serve route E2E from fork pressure (#11389) (#11391) 2026-09-09 02:08:08 +00:00
event-loop-yield.test.js fix(ci): yield the event loop between script tests to avoid vitest RPC timeouts (#10037) (#10050) 2026-08-26 07:11:15 +00:00
export-html-from-chatrecord-jsonl.test.js fix(web-shell): close the four deferred #9812 review follow-ups (#11107) 2026-09-05 23:40:57 +00:00
export-html-import-meta-guard.test.js fix(web-shell): make the workspace provider guard self-diagnosing and reload on root retry (#11421) 2026-09-10 06:33:33 +00:00
export-transcript-document-template.test.js perf(export): split the transcript renderer's embedded CSS into a versioned asset (#11485) 2026-09-10 07:15:32 +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 refactor(ci): extract release workflow scripts (#11165) 2026-09-08 07:09:09 +00:00
install-script.test.js perf(export): split the transcript renderer's embedded CSS into a versioned asset (#11485) 2026-09-10 07:15:32 +00:00
integration-tsconfig-core-paths-sync.test.js perf(cli): import core modules directly instead of the package root (#10957) 2026-09-06 11:21:50 +00:00
integration-vitest-config.test.ts ci: serialize integration tests on shared ECS runners (#10567) 2026-08-31 01:20:35 +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 ci: make the Prettier lane a real gate (#11117) 2026-09-07 00:44:01 +00:00
live-host-oss-workflow.test.js fix(live): restore Live Host after desktop removal (#9994) 2026-08-25 12:32:31 +00:00
main-ci-failure-issue-workflow.test.js fix(ci): name the failing job when a main CI run reports no test result (#10855) 2026-09-03 21:09:36 +00:00
no-ak-integration-ci.test.js feat(web-shell): Improve split-view session navigation (#11250) 2026-09-08 17:33:19 +00:00
no-config-object-create-config.test.js refactor(core): centralize worktree config derivation (#9915) 2026-08-27 12:28:08 +00:00
no-config-object-create.test.js refactor(core): centralize worktree config derivation (#9915) 2026-08-27 12:28:08 +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 perf(cli): import core modules directly instead of the package root (#10957) 2026-09-06 11:21:50 +00:00
no-core-utils-upward-import.test.js perf(cli): import core modules directly instead of the package root (#10957) 2026-09-06 11:21:50 +00:00
no-utils-upward-import-config.test.js refactor(cli): enforce utils leaf-layer dependency direction (#9146) (#9737) 2026-08-23 14:41:49 +00:00
no-utils-upward-import.test.js refactor(cli): enforce utils leaf-layer dependency direction (#9146) (#9737) 2026-08-23 14:41:49 +00:00
package-assets.test.js perf(export): split the transcript renderer's embedded CSS into a versioned asset (#11485) 2026-09-10 07:15:32 +00:00
package-scripts.test.js refactor(ci): extract release workflow scripts (#11165) 2026-09-08 07:09:09 +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 feat(autofix): run one bounded self-review before an address-review commit (A/B) (#11516) 2026-09-10 05:26:56 +00:00
qwen-fleet-shepherd-workflow.test.js fix(ci): salvage superseded review runs and hold the loop's report-time base refresh (#10123) 2026-09-06 05:51:06 +00:00
qwen-pr-review-workflow.test.js fix(ci): salvage superseded review runs and hold the loop's report-time base refresh (#10123) 2026-09-06 05:51:06 +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): salvage superseded review runs and hold the loop's report-time base refresh (#10123) 2026-09-06 05:51:06 +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(triage): make Stage 1-pre subsumption check large-file safe (#10396) 2026-09-02 09:25:52 +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): space PR creation from release to avoid secondary rate limit (#11444) 2026-09-09 12:59:56 +00:00
release-workflow.test.js fix(ci): reap release integration containers (#11330) 2026-09-08 09:48:05 +00:00
review-artifact-upload.test.js fix(ci): run /resolve without the container sandbox and pin its CLI version (#10428) 2026-08-31 07:37:15 +00:00
review-source-digest.test.ts refactor(cli): enforce utils leaf-layer dependency direction (#9146) (#9737) 2026-08-23 14:41:49 +00:00
review-worktree-cleanup-workflow.test.js feat(web-shell): Improve split-view session navigation (#11250) 2026-09-08 17:33:19 +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 fix(release): stop one flaky test from failing a stable release (#10842) 2026-09-03 03:39:37 +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-checks-audit-retry.test.js fix(ci): retry a registry-side npm audit failure instead of reporting it as a CVE (#11006) 2026-09-04 15:52:20 +00:00
security-workflows.test.js ci: schedule dependency audits and use native secret protection (#11005) 2026-09-05 01:08:43 +00:00
serve-ab-workflow.test.js ci: stabilize tests under shared ECS host contention (#10552) 2026-08-30 14:38:54 +00:00
serve-fast-path-bundle-check.test.js fix(core): keep no-follow reads protected where O_NOFOLLOW is missing (#10007) 2026-08-31 09:57:46 +00:00
start.test.js fix(cli): scope startup warnings to dev sessions (#8456) 2026-08-29 13:22:34 +00:00
test-setup.ts fix(ci): yield the event loop between script tests to avoid vitest RPC timeouts (#10037) (#10050) 2026-08-26 07:11:15 +00:00
text-capture-core-loader-sync.test.js perf(cli): import core modules directly instead of the package root (#10957) 2026-09-06 11:21:50 +00:00
transcript-css-entry-filter.test.js perf(export): split the transcript renderer's embedded CSS into a versioned asset (#11485) 2026-09-10 07:15:32 +00:00
unit-vitest-configs.test.ts ci: give every workspace the shared-pool test timeout, not just five (#10915) 2026-09-07 09:02:39 +00:00
update-dependency-audit-issue.test.js ci: schedule dependency audits and use native secret protection (#11005) 2026-09-05 01:08:43 +00:00
upload-aliyun-oss-assets.test.js fix(release): cap Vitest workers in the quality_scripts lane (#10755) (#10760) 2026-09-02 12:21:31 +00:00
verify-capture.test.js test(ci): make verify-capture fallback assertion rasterization-safe (#10758) 2026-09-06 08:46:27 +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): stop the scripts-suite timeout knob from failing open on an empty value (#10910) 2026-09-06 01:00:42 +00:00
vscode-companion-no-webui-config.test.js refactor(vscode-ide-companion): complete the WebShell UI cutover (#9811) 2026-08-29 16:37:47 +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 ci: split lint and static checks out of the Test job (#10756) 2026-09-03 03:53:57 +00:00
workspaces.test.js ci: give every workspace the shared-pool test timeout, not just five (#10915) 2026-09-07 09:02:39 +00:00