fix: run src/browser unit tests in CI and stabilize the vendor digest - #238
Open
Agnik47 wants to merge 1 commit into
Open
fix: run src/browser unit tests in CI and stabilize the vendor digest#238Agnik47 wants to merge 1 commit into
Agnik47 wants to merge 1 commit into
Conversation
The `unit` vitest project excluded `src/browser/**/*.test.ts`, and no other project picked them up: `plugin` covers `plugins/*/test/**`, `e2e` lists individual files under `tests/e2e/`, and `smoke` covers `tests/smoke/**`. That left 44 test files (596 tests) covering CDP, snapshots, the Playwright sandbox and the local Cloak runtime out of every CI job. The exclude was introduced in agentrhq#196 rather than agentrhq#216 — that merge only dropped the `clis/**` half of the list after the adapter migration. Dropping the exclude also restores vitest's default excludes (node_modules, dist) and matches the other four projects, none of which set `exclude`. Enabling the tests surfaces a pre-existing Windows failure in `playwright-client-build.test.ts`, which shells out to `build-playwright-sandbox-client.mjs --check`. Two independent causes: - `vendorDigest()` hashes the relative path of each vendored file, built with `path.join()`, so entries hash as `client\artifact.ts` on Windows and `client/artifact.ts` elsewhere. The digest was therefore platform-dependent and could never match the pinned manifest on Windows. Normalizing the separator to `/` is a no-op on POSIX, so the pinned hash is unchanged. - The vendored sources and the generated bundle are compared byte-for-byte, so a CRLF checkout breaks both the digest and the "bundle is up to date" check. `.gitattributes` pins just those paths to LF. Refs agentrhq#231 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
🟢 No documentation gap found — medium confidenceThe automated review found no documentation gap in the supplied changes. This review is advisory and does not block merging. |
12 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The
unitvitest project excludedsrc/browser/**/*.test.ts, and no other project picked those files up —plugincoversplugins/*/test/**,e2elists individual files undertests/e2e/, andsmokecoverstests/smoke/**. The result was that 44 test files / 596 tests covering CDP, snapshots, the Playwright sandbox and the local Cloak runtime ran in no CI job at all.Removing the exclude also restores vitest's default excludes (
node_modules,dist) for that project, and matches the other four projects, none of which setexclude.One small correction to the issue: the exclude came from #196, not #216. #216 only dropped the
clis/**half of the list during the adapter migration:unitexcludec08cb276(init)['clis/**/*.test.{ts,js}']b51cac37(#196)['clis/**/*.test.{ts,js}', 'src/browser/**/*.test.ts']0470ac43(#216)['src/browser/**/*.test.ts']Why the two extra changes are here
Enabling the tests surfaces a pre-existing failure in
src/browser/run/playwright-client-build.test.ts, which shells out tobuild-playwright-sandbox-client.mjs --check. Without fixing it, this PR would turn thewindows-latestunit job red. Two independent causes:1. The vendor digest was platform-dependent.
vendorDigest()hashes each vendored file's relative path, built withpath.join(), so entries hash asclient\artifact.tson Windows andclient/artifact.tseverywhere else. The check could therefore never pass on Windows:Normalizing the separator to
/is a no-op on POSIX, so the pinned hash is unchanged andvendor-manifest.jsonneeds no regeneration.2. The vendored sources and generated bundle are compared byte-for-byte. On a checkout with
core.autocrlf=true(the Git for Windows default, and there was no.gitattributes), CRLF breaks both the digest and the separate "bundle is up to date" comparison — the latter with a misleadingGenerated Playwright QuickJS client is out of dateerror..gitattributespins just those two paths to LF.Both fixes are necessary; I verified each one independently fails without the other.
Related issue: #231
Type of Change
Checklist
Screenshots / Output
npm run typecheck,npm run buildand thegit diff --exit-codegenerated-artifact check all pass.All 44 previously-skipped files now run and pass through the real
unitproject (Windows, Node 22):Full
unitproject, before and after — same pre-existing failures, no new ones:The 4 failing files (
hosted/runner,hosted/files,plugin,docs-sync-review-cli) fail identically on unmodifiedmainon this machine and pass in CI; they're a local environment artifact (my temp dir lives under$HOME, so paths render as~\AppData\...). The twoplugin-project failures (pypi,instagram) also reproduce on cleanmain.One thing I could not verify
I don't have Bun locally, so I could not run the
bun-testjob, which also uses--project unitand will now execute these 44 files.QuickJSHost(WASM viaquickjs-emscripten) and the test that spawnsprocess.execPathlook like the likeliest friction points under Bun. Flagging it rather than assuming — happy to adjust if that job goes red.Notes
playwright-client-build.test.tsitself, which now actually runs on Windows in CI. Adding a dedicated test would mean exportingvendorDigest()out of the provenance script purely for testability — happy to do it if you'd prefer..gitattributesis intentionally scoped to the two byte-sensitive paths rather than a repo-wide* text=auto.