TWO-24747/feat: Local dev harness targets and env plumbing#322
Open
dgjlindsay wants to merge 8 commits into
Open
TWO-24747/feat: Local dev harness targets and env plumbing#322dgjlindsay wants to merge 8 commits into
dgjlindsay wants to merge 8 commits into
Conversation
The compose stack (wordpress + wpcli provisioner + mariadb) already existed — the ticket's 'no structured dev environment' premise predates it. What was actually missing: - .env.example documenting the TWO_* dev variables; docker compose reads .env natively and the WOOCOM_* provisioning knobs are now parameterised with their previous values as defaults. - TWO_BRAND_CODE passthrough to the wordpress and wpcli containers so the brand layer's dev override (TWO-24744) works in the harness. - dev/configure: idempotent wp-cli script applying TWO_API_KEY / TWO_API_BASE_URL onto the gateway settings; wired into first provision and exposed as 'make configure'. - wpcli.sh derives the settings option key from the gateway id instead of hardcoding it (a brand-override dev run would have written the wrong option row). - Makefile dev targets: install/run/configure/logs/stop/clean/ test-unit/test/format. test-unit runs the tests/unit harness from TWO-24744 in a php:8.2 container (the ticket's 'establish PHPUnit baseline' is superseded by that suite). - README quick-start updated. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
🖌 Pre-commit success 🏆DetailsExit code: 0 Author ✍️@dgjlindsay |
Review findings (single-reviewer round): - BLOCKER: parameterising WOOCOM_PLUGIN_CONFIG_JSON defaulted CI's compose to the local-dev config — the gateway under e2e test would seed http://portal.localhost/api with the dummy key while the Playwright harness polls staging. The workflow now writes a .env pinning the rendered staging config before compose up. - The wpcli option-key comment overstated brand-following: it's a static fallback matching the two brand; overlay runs need TWO_GATEWAY_ID set explicitly. - Prettier on README. Reviewer empirically verified the load-bearing claims in the pinned images: mod_php getenv() sees container env (no PassEnv needed), and wp-cli 2.11 supports 'wp option patch'. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
'get' is not a patch action (insert/update/delete only) — the debug echo at the end of dev/configure errored and set -e killed the wpcli bootstrap, which CI's e2e job caught. The getter is 'wp option pluck', now also guarded so a missing subkey cannot kill provisioning. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Combined-chain round 2 (security + post-fix + coherence + cross-plugin panels): - README e2e setup now pins the staging config before compose up — the harness PR changed the compose default to the local config and CI got the fix but the human instructions didn't (a developer following the README would have run staging-keyed tests against a local-config store). - .env.example ships a placeholder API key instead of the real-looking committed sandbox key (rotation of the historical key is a separate team action — it remains in git history and docker/config/local.json). - Brand-file loader: filter-supplied paths must be real .php files inside the plugins/mu-plugins tree (defence in depth on the require sink; co-resident plugins are trusted, this just keeps uploads and other writable paths out of reach). - esc_url on the brand signup link, matching the icon's pattern. - brands/two.php: merchant_signup_url renamed to the cross-plugin canonical sign_up_url (recorded convention; renamed now while the file is fresh rather than deferring the agreed rename another cycle). The WC_Twoinc::MERCHANT_SIGNUP_URL constant keeps its BC spelling. - brands/two.php docblock covers the test-asserted 'code' key; README compose spelling unified. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
What
D1 of the plugin parity plan (TWO-24739 → TWO-24747). Ticket premise correction: the compose stack (wordpress + wpcli provisioner + mariadb, product seeding, plugin activation, config JSON) already existed — this PR adds the missing ergonomics, not the environment.
Stacked on #321 (needs the brand layer's
TWO_BRAND_CODEhandling).How
.env.example→ copy to.env(compose's native env file — the ticket's.env.localspelling diverged from the repo's existing.envconvention; code wins):TWO_API_BASE_URL,TWO_API_KEY,TWO_BRAND_CODE, WooCommerce knobs.TWO_BRAND_CODEinto the WordPress container (PHPgetenv→WC_Twoinc_Brand) and parameterises the provisioning vars with the previous hardcoded values as defaults.dev/configure: idempotent wp-cli script writingTWO_API_KEY/TWO_API_BASE_URLonto the gateway settings; runs at first provision and viamake configure.docker/wpcli.shnow derives the settings option key from the gateway id (was hardcoded — a brand-override run would have seeded the wrong option row).install/run/configure/logs/logs-wpcli/stop/clean/test-unit/test/format.make test-unitruns the TWO-24744 unit harness in aphp:8.2container — the ticket's "establish PHPUnit baseline" is superseded by that suite (deliberately dependency-free; CI already runs it on 7.4+8.2).Test plan
docker compose configvalid;bash -non both scriptsmake test-unitgreen (19/19)make clean && make installprovision on a dev box, checkout loads,make configureround-trips an api-key change🤖 Generated with Claude Code