Automattic / Automattic/wp-codebox
Browser SDK v1 facade omits materializer methods top-level (setFrontendAdminBarVisible, ensureDirectory, writeFile, runRecipe)
- Dominant language
- TypeScript
- Stars
- 16
- Forks
- 4
- Avg merge
- 59m
- Merged PRs (30d)
- 131
Description
## Problem
`browserSdkFacade` (packages/wordpress-plugin/assets/browser-runtime.js:456) exposes some operations as top-level v1 members (`startBrowserPreview`, `runBrowserSessionRecipe`, `bootExecutableBrowserSession`, …) but others only inside the frozen `v1.methods` map (line ~477): `setFrontendAdminBarVisible`, `ensureDirectory`, `writeFile`, `runRecipe`, and possibly more.
Studio Native's browser materializer — per its documented contract — calls these as top-level `window.wpCodeboxBrowser.v1.` and fails closed: `WP Codebox browser SDK v1 is missing setFrontendAdminBarVisible.` This blocks the entire preview boot on the Studio Native dogfood runtime, caught by the new headless product-flow e2e (chubes4/studio-native#941/#943). Consumer-side smokes were source-shape assertions, so the gap was invisible until a real browser exercised the flow.
## Fix shape
Expose the full sanctioned method set top-level on the v1 facade (thin passthroughs like the existing entries), keeping `v1.methods` as-is. Audit the studio-native materializer's consumed set (`ensureDirectory`, `writeFile`, `runBrowserSessionRecipe`, `consumeContainedSiteSync`, `runRecipe`, `setFrontendAdminBarVisible`) and cover the facade surface with a real facade test (not source-shape matching).
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in packages/wordpress-plugin/assets/browser-runtime.js at browserSdkFacade around lines 456 and 477, then inspect the studio-native materializer's consumed method set. Verify the v1 facade exposes ensureDirectory, writeFile, runBrowserSessionRecipe, consumeContainedSiteSync, runRecipe, and setFrontendAdminBarVisible at the top level while retaining v1.methods, and add a real facade test rather than a source-shape assertion.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100