Skip to content

docs(rules): fix live tool-verify procedure for Workers vitest env gap#95

Merged
nemolize merged 1 commit into
mainfrom
docs/e2e-rule-live-pat-fix
Jun 11, 2026
Merged

docs(rules): fix live tool-verify procedure for Workers vitest env gap#95
nemolize merged 1 commit into
mainfrom
docs/e2e-rule-live-pat-fix

Conversation

@nemolize

Copy link
Copy Markdown
Owner

Corrects the project rule .claude/rules/tool-e2e-handler-capture.md, whose live-verification procedure didn't actually work.

Why

The old rule said to write a test/_verify_*.test.js vitest spec that injects a live PAT via new Octokit({ auth: process.env.GITHUB_PERSONAL_ACCESS_TOKEN }). But every spec in this repo runs in the @cloudflare/vitest-pool-workers isolate, whose process.env is not Node's process env — so the PAT is undefined and live calls fail with 401. Neither a shell-exported PAT, secrets.required, CLOUDFLARE_INCLUDE_PROCESS_ENV, nor a temporary .dev.vars fixes it. Discovered while verifying the #8 Phase-5 write tools.

What changed

  • Live-PAT verification now runs as a standalone scripts/_verify_*.mjs via pnpm dlx tsx (real Node process.env), not a vitest spec. Notes that node --experimental-strip-types can't resolve the .js.ts imports.
  • New gotcha section documenting the Workers-pool process.env gap and why the usual env routes don't fix it.
  • Adds an error-path verification approach for write/mutating tools (completed-run 409, no-trigger-workflow 422) so a live binding is confirmed without a real CI mutation.

Doc-only change to a rule file; no code or test changes.

The Workers vitest pool isolate does not expose Node's process.env, so a
test/_verify_*.test.js spec injecting a live PAT 401s. Switch the procedure
to a standalone scripts/_verify_*.mjs run via `pnpm dlx tsx`, document the
gotcha, and add an error-path approach for write tools (completed-run 409,
no-trigger-workflow 422) to avoid real CI mutations. Discovered while
verifying the #8 Phase-5 write tools.
@nemolize nemolize merged commit 402fd01 into main Jun 11, 2026
4 checks passed
@nemolize nemolize deleted the docs/e2e-rule-live-pat-fix branch June 11, 2026 02:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant