stagehand icon indicating copy to clipboard operation
stagehand copied to clipboard

fix(core): honor v3 piercer debug option

Open kiranmagic7 opened this issue 6 months ago • 4 comments

Summary

  • Make installV3ShadowPiercer derive DEBUG from opts.debug ?? false instead of hardcoding it to true.
  • Add regression coverage for omitted debug staying silent and for idempotent reinstalls updating the stored debug state.

Why

V3ShadowPatchOptions.debug is currently ignored, so piercer install/attachShadow logs emit even when debug is omitted or false. This makes the option ineffective.

Fixes #1996.

Tests

  • pnpm --filter @browserbasehq/stagehand run gen-version ✅
  • pnpm --filter @browserbasehq/stagehand run build-dom-scripts ✅
  • pnpm --filter @browserbasehq/stagehand run build:esm ✅
  • pnpm --filter @browserbasehq/stagehand test:core packages/core/dist/esm/tests/unit/v3-shadow-piercer-debug.test.js ✅ (Vitest: 1 file, 2 tests)
  • pnpm exec vitest run --config vitest.esm.config.mjs dist/esm/tests/unit/v3-shadow-piercer-debug.test.js ✅ (Vitest: 1 file, 2 tests)
  • pnpm exec prettier --check packages/core/lib/v3/dom/piercer.runtime.ts packages/core/tests/unit/v3-shadow-piercer-debug.test.ts ✅
  • pnpm exec eslint packages/core/lib/v3/dom/piercer.runtime.ts packages/core/tests/unit/v3-shadow-piercer-debug.test.ts ✅
  • pnpm --filter @browserbasehq/stagehand run typecheck ✅
  • pnpm changeset status --since origin/main ✅

Compatibility / risk

  • Default installV3ShadowPiercer() is quiet unless debug: true is provided, matching the option semantics.
  • Existing idempotent installs still reuse state and now correctly update that state's debug flag from opts.debug.
  • No dependency changes or public API shape changes.

kiranmagic7 avatar May 22 '26 00:05 kiranmagic7

🦋 Changeset detected

Latest commit: 7c062e64aa4feed4b1b4d038d98646037a5791e5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@browserbasehq/stagehand Patch
@browserbasehq/browse-cli Patch
@browserbasehq/stagehand-evals Patch
@browserbasehq/stagehand-server-v3 Patch
@browserbasehq/stagehand-server-v4 Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar May 22 '26 00:05 changeset-bot[bot]

This PR is from an external contributor and must be approved by a stagehand team member with write access before CI can run. Approving the latest commit mirrors it into an internal PR owned by the approver. If new commits are pushed later, the internal PR stays open but is marked stale until someone approves the latest external commit and refreshes it.

github-actions[bot] avatar May 22 '26 00:05 github-actions[bot]

Friendly follow-up: this is still waiting on approval of the latest external contributor commit so CI can run. The current head remains scoped to the v3 piercer debug option path, includes a changeset, and the automated review reported no issues. Happy to adjust anything maintainers want changed.

kiranmagic7 avatar Jun 01 '26 15:06 kiranmagic7

Friendly follow-up: this is still waiting on approval of the latest external contributor commit so CI can run. The branch remains scoped to honoring the v3 piercer debug option, includes the changeset, and the automated review did not find issues. Happy to adjust anything maintainers want changed.

kiranmagic7 avatar Jun 05 '26 15:06 kiranmagic7