Repository navigation
fix: stream large site apply scripts through stdin - #193
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Applying a native page can put the mutation script over Linux's single-argument limit. The CLI then reports an uncertain transport outcome after earlier dependency imports, without creating the page.
Solution
The default local transport sends the unchanged PHP script through
wp eval-file -on stdin. Explicit transport callbacks keep their existingevalargument contract. Identity checks, ownership checks, markers and readback stay in the same script.src/site/apply-wpcli.tssiteApplyWpCli/runWithInputsiteApplyWpCliDiff
3 files, +66 / -8.
Testing & verification
Reviewed revision:
d3703262dcaf11545b04334ba51aa5200f32c43e· Environment: local macOS Node, OrbStack Linux CLI, WordPress 7.1 / PHP 8.4.npm test -- dev/test/site-apply.test.ts: 26 passed.npm run typecheck: passed.npm run verify: 974 passed, 4 skipped, 1 failed in the unrelated discovered-strictsite compileCLI case. Its standalone canonical reproduction returned 0; the fullsite-cli.test.tsfocused rerun passed all 4 cases. The failing assertion now preserves child output. The full local run remains failed.Actual general CLI apply created a native page and a subsequent apply updated it through the stdin transport. The creation resumed a retained partial operation after explicit operator reconciliation of known absent page writes; it is not a clean one-shot bootstrap result.
An equal-sized benign argument failed in the Linux container with
argument list too long, establishing the transport limit separately from application behavior.npm run build,npm run check:private,npm run pack:check: passed.Exact-head CI 38300397477: Node 22.13/24, packed consumer, WordPress proof and CI scope passed.
Not verified: the failed local full-suite case has no confirmed cause, although both clean CI runs passed. No production apply or release.
Risk / rollout
Wrappers around WP-CLI must forward stdin (for example
docker exec -i). Callback transports retain their contract. Detection: transport errors still stop the apply and retain operation evidence. Rollback: revert this commit; that restores the argument-size failure and does not undo prior WordPress writes.