Skip to content

Playground staged files retain only the first 256 KiB chunk #2240

Description

@chubes4

Problem

WP Codebox 0.19.0 reports successful staged-file materialization but a direct local Playground recipe retains exactly the first 262,144 bytes of a larger input. Canonical SSI fixture 20-switchback-woocommerce-extra-hard stages an 816,867-byte artifact.json; the mounted runtime copy is exactly 262,144 bytes and invalid JSON, so dependency discovery fails before import with The --artifact file must contain a JSON object.

This regresses or incompletely preserves the chunked materialization contract from #1990 / PR #1993. Current materializePlaygroundStagedFiles() reads 256 KiB chunks and reports each write, but the resulting runtime file contains only chunk one. The immutable fixture must remain unchanged.

Reproduction

Run the SSI canonical matrix directly with fixture 20 and wp-codebox 0.19.0. Compare:

  • host artifact: 816,867 bytes
  • runtime files/mounts/2/artifact.json: 262,144 bytes
  • runtime command failure: invalid artifact JSON

Direct evidence was produced under /var/folders/lr/c_cmmt7s0592m4njz99v5yb40000gn/T/opencode/ssi-full-875-880-598c6898/dependency-discovery/002-20-switchback-woocommerce-extra-hard/.

Acceptance

  • Staged files larger than one chunk materialize byte-identically in Playground.
  • Append writes remain durable across successive Playground PHP evaluations.
  • Materialization verifies final byte count and SHA-256, not only each write call's returned byte count.
  • Regression coverage exercises a non-multiple-of-256-KiB text/JSON file and a binary file.
  • A partial/truncated runtime result fails immediately with bounded expected/actual size and digest diagnostics.
  • Canonical fixture 20 passes dependency discovery without fixture changes.

AI assistance

OpenAI gpt-5.6-sol via OpenCode and a general OpenCode subagent ran the immutable canonical matrix directly, compared host and runtime artifacts, and isolated the exact 256 KiB truncation boundary. Chris Huber directed the investigation and remains responsible for the issue and resulting change.

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