Skip to content

Preserve typed Playground command output for plugin-state verification #2236

Description

@chubes4

Problem

BET-19 recipe setup succeeds in a prepared WPCOM/Playground runtime, including plugin activation, but final active_plugins verification fails after the result reaches the cached CLI boundary:

Unexpected token '\u0000' ... is not valid JSON

The wordpress.plugin-state command returns the raw PlaygroundRunResponse from server.playground.run(). That response can expose text through a lazily backed transport result. A later cache/CLI JSON parse can then observe NUL/binary bytes rather than the command's JSON payload.

#2048 / 789b5aa5 repaired the equivalent temporary WP-CLI wrapper path by snapshotting response.text before it crosses the cleanup boundary. Plugin-state does not take that path, so it remains vulnerable. Runtime service output aliases (#2147, #2228) are unrelated typed environment-binding repairs.

Expected contract

Materialize Playground command responses at the runtime boundary: preserve text, exitCode, and errors as plain typed values before they escape runPlaygroundCommand. Do not strip arbitrary bytes or retry JSON parsing. The plugin-state JSON producer continues to serialize the normalized active_plugins array.

Regression coverage

Add a focused runtime fixture whose direct Playground command response changes to NUL-containing output after the command boundary. Execute wordpress.ensure-plugin-active or wordpress.plugin-state, then assert the returned result is the original JSON and JSON.parse succeeds after the deferred invalid output becomes observable.

Scope checked

  • GitHub open/closed issues and PRs: no BET-19, active_plugins, NUL, or output-alias repair covers this path.
  • Local branches: fix/2048-wp-cli-json-result (789b5aa5) is merged into main and covers only temporary WP-CLI wrappers.
  • verify/bet19-wpcom-runtime is the canonical SSI migration branch, not this bug.

AI assistance

  • Model: OpenAI GPT-5.6 Terra
  • Tool: OpenCode
  • Used for: Investigated the runtime boundary and drafted this issue. Chris Huber remains responsible for review and prioritization.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions