Skip to content

Stream large staged files into Playground without whole-file base64 allocation #1990

Description

@chubes4

Problem

WP Codebox staged-file materialization base64-encodes and submits an entire file through one Playground PHP evaluation. A valid 65.7 MB SSI artifact therefore exhausts the fixed 256 MB PHP limit before any recipe workflow step executes.

This blocks the canonical FSE Pilot Build Theme Figma-to-WordPress acceptance fixture. The isolated single-fixture recovery fails identically.

Deterministic evidence

  • FSE artifact.json: 65,696,394 bytes.
  • Failed allocation: 87,595,192 bytes.
  • Exact relationship: 65,696,394 * 4 / 3 = 87,595,192, proving whole-file base64 expansion.
  • Staged FSE source: 49,268,534 bytes.
  • Fisiostetic control artifact: 11,379,992 bytes and succeeds under the same runtime.
  • Failure: Allowed memory size of 268435456 bytes exhausted (tried to allocate 87595192 bytes) in /internal/eval.php on line 7.
  • Both batch and isolated recovery have executions: []; no SSI import or WordPress operation starts.

Reproduction

From current Automattic/static-site-importer and a Blocks Engine checkout containing the FSE transform:

node tools/run-fig-fixture-e2e.mjs \
  --blocks-engine /path/to/blocks-engine \
  --blocks-engine-php-transformer-path /path/to/blocks-engine \
  --fixture "/path/to/🛠️ FSE Pilot Build Theme.fig" \
  --output-directory /tmp/fse-current-e2e \
  --expected-fixture-count 1 --batch-size 1 --concurrency 1 \
  --min-native-rate 1 --run

The generated replay command in ssi-matrix/summary.json reproduces the same failure.

Owning path

packages/runtime-playground/src/mount-materialization.ts reads staged sources fully, creates whole-file base64/string copies, and sends them through Playground writeFile / PHP fallback materialization.

Expected behavior

Materialize large staged files with bounded peak memory, using chunked truncate/append writes or an equivalent streaming primitive. Preserve exact bytes and existing mount semantics. Add a regression above the current practical 256 MB-runtime threshold that proves:

  • byte-identical materialization;
  • bounded per-write payload size;
  • no whole-file base64 allocation;
  • compatibility for text and binary staged files;
  • actionable bounded diagnostics on failure.

Raising PHP memory to 512 MB can validate the diagnosis but is not the durable repair.

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