You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tracking follow-up feedback for the Git integration PR series. I scanned the visible stack context around #11, #12, #13, #14, #16-#26, #28, and #29; this issue should collect findings by PR as review continues.
Some items below appear to be addressed by later stacked PRs, but they are still listed under #11 because they are observable in #11 as submitted.
For valid branch names, any failure in source inference, COW clone, apply, publish, config rewrite, or branches.txt write leaves the pushed ref in .forkpress/cow/git. After rename($tmp, $dest_storage), failures can also leave published storage or a public link because the catch block only removes $tmp:
error_log("ForkPress COW git created branch '$branch' from '$source'");
return$dest_public;
} catch (\Throwable$e) {
cow_git_remove_tree($tmp);
throw$e;
Expected follow-up: restore pre_receive_refs for any post-receive apply failure, and roll back any published storage/public branch paths after the staging directory has been renamed. Add tests for a valid branch push that fails after the Git ref is written and after branch storage is published.
Resync the Git view before returning a successful push.
The new e2e coverage edits database.sql during Git-created branch creation, but only verifies that the runtime branch did not materialize database.sql:
That means the remote ref can temporarily point at the client-pushed commit containing ignored database.sql edits, while the materialized preview ignored those edits. A later fetch may normalize the ref, but immediately after forkpress commit the client and server-visible snapshot can disagree.
Expected follow-up: after a successful apply, resnapshot the affected branches and update refs before returning success. Add coverage that the remote database.sql is regenerated, ignored paths disappear from the Git view immediately, and the checkout is not left dirty/diverged after forkpress commit.
Coordinate Git-created branch mutations with the COW operation lock.
[codex] Allow Git pushes to create COW branches #11 protects .forkpress/cow/git with git.lock, but branch creation also mutates materialized branch storage, public branch links, wp-config.php, and branches.txt:
Those mutations need to be serialized with other COW branch lifecycle operations and with request-side reads of materialized branch trees. Otherwise a Git push can race forkpress branch create, agents setup, reset/delete follow-ups, or a preview request and expose half-published state.
Expected follow-up: put Git apply/create under the same COW branch operation lock used by the CLI/runtime branch lifecycle paths, and cover a blocked request or concurrent branch operation in tests.
Treat file apply failures as hard errors before publishing/listing a branch.
cow_git_apply_wp_files() ignores the return values from file_put_contents() and unlink():
PHP warnings do not make this path fail reliably. During Git-created branch creation, a failed write into the staging tree can still lead to publishing the branch and rewriting branches.txt, producing an incomplete preview branch that Git reported as pushed successfully.
Expected follow-up: check write/delete results, throw with path context, and keep the branch unpublished on any apply error. Add tests for unwritable files or path-shape conflicts during apply.
Use the same branch-name reservations as the other Git/branch creation paths.
COW Git-created branches accept any single-label regex match:
// Reject reserved names that would conflict with HTTP routing.
if (in_array(strtolower($branch_name), $reserved, true)) {
thrownew \RuntimeException(
"refusing to push to reserved branch name '$branch_name' (conflicts with routing)"
);
}
Expected follow-up: centralize or mirror the reservation check for COW Git-created branches, and make sure COW CLI branch creation follows the same rule if it does not already.
Open Question
Source inference selects an existing ForkPress branch from Git history, then clones that branch's current live storage. If a user fetched origin/main, the source branch's database changed, and then the user pushed a new branch based on the older fetched commit, [codex] Allow Git pushes to create COW branches #11 will apply the older pushed WordPress tree onto a clone of the current live database. Should Git-created branches require the pushed fork point to be the current source tip, or should the stale-base/database behavior be documented explicitly?
Tracking follow-up feedback for the Git integration PR series. I scanned the visible stack context around #11, #12, #13, #14, #16-#26, #28, and #29; this issue should collect findings by PR as review continues.
Some items below appear to be addressed by later stacked PRs, but they are still listed under #11 because they are observable in #11 as submitted.
PR #11: Allow Git pushes to create COW branches
Review target: #11 /
9423bb45c6e6c9a8c12ef7d2da69a9b68d4c0388.Findings
Restore Git refs and branch storage on post-receive failures.
GitEndpointmutates the persistent Git refs before COW materialization runs, but the general post-receive failure path only returns HTTP 500:forkpress/scripts/git_server/cow_server.php
Lines 80 to 112 in 9423bb4
The only ref restore path is the unsupported-name branch:
forkpress/scripts/git_server/cow_server.php
Lines 265 to 266 in 9423bb4
For valid branch names, any failure in source inference, COW clone, apply, publish, config rewrite, or
branches.txtwrite leaves the pushed ref in.forkpress/cow/git. Afterrename($tmp, $dest_storage), failures can also leave published storage or a public link because the catch block only removes$tmp:forkpress/scripts/git_server/cow_server.php
Lines 367 to 384 in 9423bb4
Expected follow-up: restore
pre_receive_refsfor any post-receive apply failure, and roll back any published storage/public branch paths after the staging directory has been renamed. Add tests for a valid branch push that fails after the Git ref is written and after branch storage is published.Resync the Git view before returning a successful push.
The new e2e coverage edits
database.sqlduring Git-created branch creation, but only verifies that the runtime branch did not materializedatabase.sql:forkpress/tests/test_cow_strategy_e2e.sh
Lines 97 to 105 in 9423bb4
In [codex] Allow Git pushes to create COW branches #11, post-receive applies the WordPress files and then flushes the buffered receive-pack response without regenerating the COW Git snapshot:
forkpress/scripts/git_server/cow_server.php
Lines 90 to 115 in 9423bb4
That means the remote ref can temporarily point at the client-pushed commit containing ignored
database.sqledits, while the materialized preview ignored those edits. A later fetch may normalize the ref, but immediately afterforkpress committhe client and server-visible snapshot can disagree.Expected follow-up: after a successful apply, resnapshot the affected branches and update refs before returning success. Add coverage that the remote
database.sqlis regenerated, ignored paths disappear from the Git view immediately, and the checkout is not left dirty/diverged afterforkpress commit.Coordinate Git-created branch mutations with the COW operation lock.
[codex] Allow Git pushes to create COW branches #11 protects
.forkpress/cow/gitwithgit.lock, but branch creation also mutates materialized branch storage, public branch links,wp-config.php, andbranches.txt:forkpress/scripts/git_server/cow_server.php
Lines 46 to 58 in 9423bb4
forkpress/scripts/git_server/cow_server.php
Lines 367 to 379 in 9423bb4
Those mutations need to be serialized with other COW branch lifecycle operations and with request-side reads of materialized branch trees. Otherwise a Git push can race
forkpress branch create, agents setup, reset/delete follow-ups, or a preview request and expose half-published state.Expected follow-up: put Git apply/create under the same COW branch operation lock used by the CLI/runtime branch lifecycle paths, and cover a blocked request or concurrent branch operation in tests.
Treat file apply failures as hard errors before publishing/listing a branch.
cow_git_apply_wp_files()ignores the return values fromfile_put_contents()andunlink():forkpress/scripts/git_server/cow_server.php
Lines 635 to 650 in 9423bb4
PHP warnings do not make this path fail reliably. During Git-created branch creation, a failed write into the staging tree can still lead to publishing the branch and rewriting
branches.txt, producing an incomplete preview branch that Git reported as pushed successfully.Expected follow-up: check write/delete results, throw with path context, and keep the branch unpublished on any apply error. Add tests for unwritable files or path-shape conflicts during apply.
Use the same branch-name reservations as the other Git/branch creation paths.
COW Git-created branches accept any single-label regex match:
forkpress/scripts/git_server/cow_server.php
Lines 837 to 839 in 9423bb4
Other integration paths already reserve names such as
www,admin,api,mail,localhost, andwpbecause they conflict with routing:forkpress/scripts/git_server/server.php
Lines 487 to 492 in 9423bb4
Expected follow-up: centralize or mirror the reservation check for COW Git-created branches, and make sure COW CLI branch creation follows the same rule if it does not already.
Open Question
origin/main, the source branch's database changed, and then the user pushed a new branch based on the older fetched commit, [codex] Allow Git pushes to create COW branches #11 will apply the older pushed WordPress tree onto a clone of the current live database. Should Git-created branches require the pushed fork point to be the current source tip, or should the stale-base/database behavior be documented explicitly?Verification Run
On the PR #11 head worktree:
php -l scripts/git_server/cow_server.phpphp -l runtime/router_cow.phpbash -n tests/test_cow_strategy_e2e.shgit diff --check aa9d633d335a40901f67cac0993af14461e059d1..HEADFORKPRESS_RUNTIME_BUNDLE=/dev/null cargo test -p forkpress(28 passed)Not run for this review pass:
make test-all, musl release build, or the full COW e2e script.