Skip to content

Commit f15bfde

Browse files
authored
Merge pull request #830 from Automattic/release/0.8.0
Release wp-codebox 0.8.0
2 parents 1f1d37c + 389e5e6 commit f15bfde

12 files changed

Lines changed: 95 additions & 27 deletions

package-lock.json

Lines changed: 7 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "wp-codebox-workspace",
3-
"version": "0.7.3",
3+
"version": "0.8.0",
44
"private": true,
55
"type": "module",
66
"exports": {
@@ -36,6 +36,8 @@
3636
"prepare": "npm run build",
3737
"postinstall": "node scripts/normalize-playground-sqlite-package.mjs",
3838
"package:wordpress-plugin": "tsx scripts/build-wordpress-plugin-zip.ts",
39+
"package-distribution-smoke": "tsx scripts/package-distribution-smoke.ts",
40+
"package-installed-binary-smoke": "tsx scripts/package-installed-binary-smoke.ts",
3941
"release:package": "tsx scripts/package-release-artifact.ts",
4042
"artifact-export-links-smoke": "tsx scripts/artifact-export-links-smoke.ts",
4143
"browser-visual-compare-dimension-drift-smoke": "tsx scripts/browser-visual-compare-dimension-drift-smoke.ts",

packages/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@automattic/wp-codebox-cli",
3-
"version": "0.7.3",
3+
"version": "0.8.0",
44
"description": "WP Codebox CLI — secure WordPress code execution from anywhere. Run disposable Playground sandboxes from any host: CLI, CI, mobile, Node service, or WP plugin.",
55
"type": "module",
66
"bin": {

packages/runtime-core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@automattic/wp-codebox-core",
3-
"version": "0.7.3",
3+
"version": "0.8.0",
44
"type": "module",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

packages/runtime-playground/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@automattic/wp-codebox-playground",
3-
"version": "0.7.3",
3+
"version": "0.8.0",
44
"type": "module",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

packages/runtime-playground/src/playground-cli-runner.ts

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ export async function startPlaygroundCliServer(spec: RuntimeCreateSpec, mounts:
7272
source: "pre-resolved" as const,
7373
invalidArchives: [],
7474
}
75-
const localAssetServer = wordpressStartupAsset?.localPath ? await serveLocalStartupAsset(wordpressStartupAsset.localPath) : undefined
76-
const port = spec.preview?.port ? 0 : await availablePlaygroundPortRange()
7775
const blueprintSummary = summarizeBlueprint(spec.environment.blueprint)
7876
if (blueprintSummary.steps > 0) {
7977
emitProgress("preview:applying-blueprint", "running", "Applying site setup", blueprintSummary)
@@ -85,7 +83,8 @@ export async function startPlaygroundCliServer(spec: RuntimeCreateSpec, mounts:
8583
emitProgress("preview:activating-dependencies", "running", "Activating site features", blueprintSummary)
8684
}
8785

88-
const server = await runPlaygroundCliWithoutProcessExit(async () => {
86+
const server = await startPlaygroundCliWithDynamicPortRetry(async (port) => {
87+
const localAssetServer = wordpressStartupAsset?.localPath ? await serveLocalStartupAsset(wordpressStartupAsset.localPath) : undefined
8988
try {
9089
return await runCLI({
9190
command: "server",
@@ -109,7 +108,7 @@ export async function startPlaygroundCliServer(spec: RuntimeCreateSpec, mounts:
109108
} finally {
110109
await localAssetServer?.close()
111110
}
112-
})
111+
}, Boolean(spec.preview?.port))
113112

114113
emitProgress("preview:connecting-client", "running", "Connecting preview", {
115114
localUrl: server.serverUrl,
@@ -143,6 +142,24 @@ export async function startPlaygroundCliServer(spec: RuntimeCreateSpec, mounts:
143142
}
144143
}
145144

145+
async function startPlaygroundCliWithDynamicPortRetry(callback: (port: number) => Promise<PlaygroundCliServer>, fixedPreviewPort: boolean): Promise<PlaygroundCliServer> {
146+
const attempts = fixedPreviewPort ? 1 : 6
147+
for (let attempt = 1; attempt <= attempts; attempt++) {
148+
const port = fixedPreviewPort ? 0 : await availablePlaygroundPortRange()
149+
try {
150+
return await runPlaygroundCliWithoutProcessExit(() => callback(port))
151+
} catch (error) {
152+
if (!fixedPreviewPort && attempt < attempts && errorHasCode(error, "EADDRINUSE")) {
153+
continue
154+
}
155+
156+
throw error
157+
}
158+
}
159+
160+
throw new Error("WordPress Playground CLI could not find an available dynamic port")
161+
}
162+
146163
function previewDetail(spec: RuntimeCreateSpec): Record<string, unknown> {
147164
return {
148165
hasPublicUrl: Boolean(spec.preview?.publicUrl),

packages/wordpress-plugin/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
"description": "WP Codebox parent-site abilities — secure coding environments inside WordPress via disposable Playground sandboxes.",
55
"scripts": {
66
"zip": "tsx ../../scripts/build-wordpress-plugin-zip.ts"
7-
}
7+
},
8+
"version": "0.8.0"
89
}

packages/wordpress-plugin/wp-codebox.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: WP Codebox
44
* Plugin URI: https://github.com/Automattic/wp-codebox
55
* Description: Secure coding environments inside WordPress. WordPress ability surface for launching disposable WP Codebox Playground sandboxes that can't touch your host site.
6-
* Version: 0.7.3
6+
* Version: 0.8.0
77
* Requires at least: 6.9
88
* Requires PHP: 8.2
99
* Author: Automattic
@@ -15,7 +15,7 @@
1515
die;
1616
}
1717

18-
define( 'WP_CODEBOX_PLUGIN_VERSION', '0.7.3' );
18+
define( 'WP_CODEBOX_PLUGIN_VERSION', '0.8.0' );
1919
define( 'WP_CODEBOX_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
2020
define( 'WP_CODEBOX_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
2121

scripts/agent-sandbox-code-smoke.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ async function main() {
4848
schema: "wp-codebox/sandbox-tool-policy/v1",
4949
version: 1,
5050
tools: [
51-
{ id: "datamachine/workspace-read", runtime_tool_id: "workspace_read", execution_location: "sandbox", transport_visibility: "sandbox", allowed: true },
52-
{ id: "datamachine/workspace-write", runtime_tool_id: "workspace_write", execution_location: "sandbox", transport_visibility: "sandbox", allowed: true },
53-
{ id: "datamachine/workspace-edit", runtime_tool_id: "workspace_edit", execution_location: "sandbox", transport_visibility: "sandbox", allowed: true },
54-
{ id: "datamachine/workspace-git-status", runtime_tool_id: "workspace_git_status", execution_location: "parent", transport_visibility: "parent", allowed: false },
51+
{ id: "datamachine/workspace-read", runtime_tool_id: "workspace_read", execution_location: "sandbox", transport_visibility: "sandbox", allowed: true, runtime: { environment: "runtime_local", capability_scope: "runtime_local" } },
52+
{ id: "datamachine/workspace-write", runtime_tool_id: "workspace_write", execution_location: "sandbox", transport_visibility: "sandbox", allowed: true, runtime: { environment: "runtime_local", capability_scope: "runtime_local" } },
53+
{ id: "datamachine/workspace-edit", runtime_tool_id: "workspace_edit", execution_location: "sandbox", transport_visibility: "sandbox", allowed: true, runtime: { environment: "runtime_local", capability_scope: "runtime_local" } },
54+
{ id: "datamachine/workspace-git-status", runtime_tool_id: "workspace_git_status", execution_location: "parent", transport_visibility: "parent", allowed: false, runtime: { environment: "control_plane", capability_scope: "control_plane" } },
5555
],
5656
metadata: { source: "smoke" },
5757
},
@@ -130,7 +130,7 @@ async function main() {
130130
schema: "wp-codebox/sandbox-tool-policy/v1",
131131
version: 1,
132132
tools: [
133-
{ id: "datamachine/workspace-read", runtime_tool_id: "workspace_read", execution_location: "sandbox", transport_visibility: "sandbox", allowed: true },
133+
{ id: "datamachine/workspace-read", runtime_tool_id: "workspace_read", execution_location: "sandbox", transport_visibility: "sandbox", allowed: true, runtime: { environment: "runtime_local", capability_scope: "runtime_local" } },
134134
],
135135
metadata: { source: "smoke" },
136136
}),

scripts/browser-html-capture-smoke.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ await writeFile(recipePath, `${JSON.stringify({
2828
extra_plugins: [
2929
{
3030
source: "./html-capture-fixture",
31-
pluginFile: "html-capture-fixture/html-capture-fixture.php",
31+
plugin_file: "html-capture-fixture/html-capture-fixture.php",
3232
activate: true,
3333
},
3434
],
@@ -56,7 +56,7 @@ const output = await runCli([
5656

5757
assert.equal(output.success, true, output.error?.message ?? "recipe-run failed")
5858
assert.ok(output.artifacts?.directory, "recipe-run should return an artifact directory")
59-
assert.equal(output.executions?.[0]?.command, "wordpress.capture-html")
59+
assert.ok(output.executions?.some((execution: { command?: string }) => execution.command === "wordpress.capture-html"), "workflow executions should include wordpress.capture-html")
6060

6161
const artifactDirectory = output.artifacts.directory
6262
const htmlPath = join(artifactDirectory, "files", "browser", "snapshot.html")

0 commit comments

Comments
 (0)