Skip to content

[codex] Use routed WP helper for E2E post creation#60

Merged
adamziel merged 1 commit into
trunkfrom
codex/e2e-routed-post-helper
May 16, 2026
Merged

[codex] Use routed WP helper for E2E post creation#60
adamziel merged 1 commit into
trunkfrom
codex/e2e-routed-post-helper

Conversation

@adamziel
Copy link
Copy Markdown
Contributor

What it does

Replaces create_branch_post's admin-editor nonce scrape with a test-only mu-plugin endpoint that creates real published posts via wp_insert_post() on the routed branch host.

Rationale

The merge E2E needs real WordPress content on branch hosts, but the old helper depended on /wp-admin/post-new.php returning an authenticated editor shell. CI was getting an unauthenticated page for a UI-created branch, so the test failed before it could exercise the branch merge behavior.

Implementation

Adds forkpress-e2e-post.php during the COW E2E setup. create_branch_post now calls /?forkpress_e2e_post=create&title=... with the target branch Host header and validates the JSON response.

The WP UI create/merge path still uses the real admin actions and nonces; this only removes cookie/nonce bootstrapping from test post creation.

Testing instructions

bash -n tests/cow/e2e.sh
git diff --check
umask 022; make test-cow

make test-cow passed locally. A first run without umask 022 failed because PHP could not create temporary /tmp lock directories, then passed with the expected umask.

@adamziel adamziel force-pushed the codex/e2e-routed-post-helper branch 2 times, most recently from fc17658 to 97ad0aa Compare May 15, 2026 20:27
@adamziel adamziel force-pushed the codex/e2e-routed-post-helper branch from 97ad0aa to 44cae3d Compare May 15, 2026 20:45
@adamziel
Copy link
Copy Markdown
Contributor Author

Follow-up from the failed mac-cow-e2e aarch64-apple-darwin run:

  • The 302 was WordPress redirecting ui-created to /wp-admin/install.php, meaning the newly published branch was not using its final branch database path at runtime.
  • Root cause: create_cow_branch_from_tree() bootstrapped wp-config.php while the branch still lived under the branch-create-stage-* directory, then renamed the tree to its final branch path.
  • Fix: after publishing the staged tree, rerun the lightweight COW bootstrap against the public/final branch root before writing the branch list.
  • Added E2E assertions that UI-created and CLI-created branch wp-config.php files point at /<branch>/wp-content/database/.ht.sqlite and do not retain branch-create-stage paths.

Local verification run after the fix:

bash -n tests/cow/e2e.sh
git diff --check
cargo test -p forkpress-storage
FORKPRESS_RUNTIME_BUNDLE=/dev/null cargo test -p forkpress-cli
make test-cow

@adamziel adamziel force-pushed the codex/e2e-routed-post-helper branch from 44cae3d to f9284a0 Compare May 15, 2026 21:00
@adamziel
Copy link
Copy Markdown
Contributor Author

adamziel commented May 15, 2026

Updated this PR with two E2E hardening changes after the macOS aarch64 failure:

  • added a test-only mu-plugin that makes WordPress admin update checks deterministic and blocks WordPress.org update probes during the COW E2E UI branch flow
  • added a ui-merge-metadata.json failure dump so a future UI merge status failure prints the latest merge run and first conflict rows

Focused verification run locally:

  • bash -n tests/cow/e2e.sh
  • git diff --check

CI has restarted on f9284a0.

@adamziel
Copy link
Copy Markdown
Contributor Author

Additional focused local verification after the deterministic-admin E2E patch:\n\n- make test-cow passed\n\nThis covers the PHP COW merge suite, Git server tests, WordPress branch UI action tests, router path tests, and router lock tests.

@adamziel
Copy link
Copy Markdown
Contributor Author

CI status note: the restarted COW E2E jobs have not reached the COW steps yet.

Current PR #60 run metadata shows these jobs still in Build production dist bundle:

  • linux-cow-e2e
  • mac-cow-e2e aarch64-apple-darwin
  • mac-cow-e2e x86_64-apple-darwin

The release workflow's standalone build aarch64-apple-darwin job has passed, along with both Linux release builds and Windows. So the prior UI-merge metadata-status failure has not yet been re-exercised by the macOS COW E2E job on this commit.

@adamziel adamziel force-pushed the codex/e2e-routed-post-helper branch from f9284a0 to b2c38fe Compare May 15, 2026 21:11
@adamziel
Copy link
Copy Markdown
Contributor Author

Updated again after the CI jobs remained in Build production dist bundle without reaching the COW E2E steps.

This adds two release-gate diagnostics:

  • scripts/build-dist.sh now prints phase markers around static-php-cli doctor/download/build work.
  • CI/release build-dist steps now have explicit timeouts, so a stuck PHP runtime build fails boundedly instead of consuming the job indefinitely.

Focused verification:

  • bash -n scripts/build-dist.sh
  • make test-release
  • git diff --check

New PR #60 head: b2c38fe.

@adamziel
Copy link
Copy Markdown
Contributor Author

Updated PR #60 with a targeted merge-policy fix for the macOS COW E2E failure seen at b2c38fe:

  • wp_usermeta.session_tokens is now treated as target-local WordPress auth/session state. Source-side token updates, deletes, and source-only token rows are kept out of the target branch instead of producing review conflicts or importing branch-local login state.
  • Added a regression that merges real wp_posts content while both branches mutate session_tokens, verifies the target token stays local, verifies source-only tokens are not imported, and verifies no wp_usermeta conflicts are recorded.

Local verification on the restored worktree:

umask 022; php -l scripts/cow/merge.php
umask 022; php -l tests/cow/merge.php
umask 022; git diff --check
umask 022; php tests/cow/merge.php

php tests/cow/merge.php passed with 2919 assertions. CI has restarted on 34fd959.

@adamziel
Copy link
Copy Markdown
Contributor Author

Additional local verification completed on 34fd959:

umask 022; make test-cow

Passed locally. This covers:

  • COW Git server: 252 passed
  • COW merge suite: 2919 assertions
  • branch UI, router path, and router lock checks

Latest PR status check: CI is still running; Windows checks have already passed, macOS and Linux COW jobs are still in progress.

@adamziel
Copy link
Copy Markdown
Contributor Author

Follow-up hardening pushed at a48d3f0: the real WordPress semantic E2E merge now requires status: completed and checks that the semantic-source -> semantic-target merge run recorded zero merge_conflicts.

This removes the previous tolerance for completed_with_conflicts, so volatile/runtime-state conflicts like the wp_usermeta.session_tokens issue can no longer hide behind successful object-graph assertions.

Focused checks for the E2E script update:

umask 022; bash -n tests/cow/e2e.sh
umask 022; git diff --check

@adamziel
Copy link
Copy Markdown
Contributor Author

Documented the new clean semantic merge gate in docs/merge-reliability.md at 6f81833. The objective audit now records that the real WordPress semantic E2E must complete with zero merge conflicts, so the evidence matrix matches the stricter test gate.

Check run for the doc update:

umask 022; git diff --check

@adamziel adamziel force-pushed the codex/e2e-routed-post-helper branch 14 times, most recently from 854be38 to c8a0ac2 Compare May 16, 2026 01:15
@adamziel adamziel force-pushed the codex/e2e-routed-post-helper branch from c8a0ac2 to 87f8442 Compare May 16, 2026 01:33
@adamziel adamziel changed the base branch from codex/wp-ui-nonce-e2e-helper to trunk May 16, 2026 01:34
@adamziel adamziel merged commit 3956408 into trunk May 16, 2026
@JanJakes JanJakes mentioned this pull request May 16, 2026
adamziel pushed a commit that referenced this pull request May 16, 2026
## Release `v0.1.15`

Version bump and release metadata update for `v0.1.15`.

**Changelog draft:**
* Fix Homebrew tap update detection
* Document release and install paths
* Document latest aarch64 mac release gate evidence
([#62](#62))
* Harden WP UI nonce E2E helper
([#49](#49))
* Use routed WP helper for E2E post creation
([#60](#60))
* Keep session tokens target-local during COW merges
([#63](#63))
* Cover remote cache branch merge E2E
([#61](#61))
* Add fast COW merge smoke gate
([#64](#64))
* Document latest merge release gate evidence
([#65](#65))
* Cover pre-metadata Git push crash recovery
([#66](#66))
* Document fast COW Git merge gates
([#67](#67))
* Cover Git-created pre-list crash E2E
([#68](#68))
* Cover incomplete generated media metadata
([#69](#69))
* Add focused COW ID-band gate
([#70](#70))
* Add focused COW stale-audit gate
([#71](#71))
* Add focused COW schema review gate
([#72](#72))
* Add focused COW plugin validator gate
([#73](#73))
* Add focused COW filesystem gate
([#74](#74))
* Add focused COW explicit ID gate
([#75](#75))
* Add focused COW branch birth gate
([#76](#76))
* Expand focused COW filesystem gate
([#77](#77))
* Expand focused COW media validator gate
([#78](#78))
* Expand focused COW stale audit gate
([#79](#79))
* Expand focused COW plugin validator gate
([#80](#80))
* Expand focused COW schema review gate
([#81](#81))
* Expand focused COW ID-band gate
([#82](#82))
* Expand focused COW media validator gate
([#83](#83))
* Expand focused COW schema dependency gate
([#84](#84))
* Expand focused COW filesystem symlink gate
([#85](#85))
* Expand focused COW branch birth cleanup gate
([#86](#86))
* Expand focused COW plugin validator contract gate
([#87](#87))
* Expand focused COW explicit ID gate
([#88](#88))
* Expand focused COW stale audit gate
([#89](#89))
* Add focused COW WordPress semantic validator gate
([#90](#90))
* Expand focused COW WordPress semantic validator gate
([#91](#91))
* Expand focused COW WordPress media reference gate
([#92](#92))
* Expand focused COW WordPress image block gate
([#93](#93))
* Expand focused COW WordPress term relationship gate
([#94](#94))
* Expand focused COW WordPress option reference gate
([#95](#95))
* Expand focused COW plugin serialized validator gate
([#96](#96))
* Expand focused COW media unsafe path gate
([#97](#97))
* Expand focused COW branch birth file-base gate
([#98](#98))
* Expand focused COW plain IPK ID-band gate
([#99](#99))
* Expand focused COW schema trigger ordering gate
([#100](#100))
* Expand focused COW stale audit keyless gate
([#101](#101))
* Expand focused COW stale audit missing row gate
([#102](#102))
* Expand focused COW media unsafe path gate
([#103](#103))
* Expand focused COW media duplicate ownership gate
([#104](#104))
* Expand focused COW media invalid metadata gate
([#105](#105))
* Expand focused COW media missing generated-file gate
([#106](#106))
* Expand focused COW plugin JSON reference gate
([#107](#107))
* Expand focused COW media dimension drift gate
([#108](#108))
* Expand focused COW media generated filename gate
([#109](#109))
* Expand focused COW filesystem directory delete gate
([#110](#110))
* Add fast router branch action gate
([#111](#111))
* Expand focused filesystem binary conflict gate
([#112](#112))
* Expand focused branch birth file-base gate
([#113](#113))
* Expand focused explicit ID band gate
* Expand focused media metadata gate
* Expand focused stale audit semantic gate
* Expand focused plugin file validator gate
* Expand focused schema dependency gate
* Expand focused ID-band reuse gate
* Expand focused media metadata gate
* Expand focused filesystem symlink gate
* Expand focused stale audit option gate
* Expand focused stale audit identity gate
* Expand focused schema index gate
* Add focused branch UI test gates
* Expand focused stale audit semantic gate
* Add page merge smoke regression
* Add semantic fast COW test target
* Add WordPress comment reference validator coverage
* Document comment validator finding shape
* Cover plugin validator source evidence drift
* Clarify stale audit plugin and schema boundaries
* Add schema index stale audit evidence
* Add schema object stale audit evidence
* Add schema table restore stale audit evidence
* Add schema table rebuild stale audit evidence

**Full changelog:**
v0.1.14...release/v0.1.15

## Next steps

1. **Review** the changes in this pull request.
2. **Push** any additional edits to this branch (`release/v0.1.15`).
3. **Merge** this pull request to publish `v0.1.15`.

Merging will automatically build ForkPress binaries, create a GitHub
release, and update the Homebrew formula.

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant