15 KiB
CHRNX Character-Led Sections Implementation Plan
For agentic workers: REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (
- [ ]) syntax for tracking.
Goal: Apply the approved mockup's alter-ego effect consistently across CHRNX section openings, center primary titles, and repair compressed podcast layouts.
Architecture: Add a small reusable character-stage class contract to existing WordPress patterns and dynamic topic heroes, while preserving their semantic content order. Reuse the current allowlisted responsive media helper and generated assets; CSS owns the shared frame, themed variants, layering, and responsive behavior.
Tech Stack: WordPress 6.9 block theme, PHP, CSS, PHPUnit, Node smoke tests, Playwright, wp-env/Colima.
Task 1: Define shared character-stage markup
Files:
-
Modify:
patterns/home-projects.php -
Modify:
patterns/home-music.php -
Modify:
patterns/music-landing.php -
Modify:
patterns/podcast-landing.php -
Modify:
patterns/about.php -
Modify:
blocks/topic-hero/render.php -
Test:
tests/php/PatternsTest.php -
Test:
tests/php/BlockRenderingTest.php -
Test:
tests/smoke/visual-integration.test.mjs -
Add failing tests for this exact block-valid API: each opening contains one
.chrnx-character-stage, with exactly three direct children ordered.chrnx-character-stage__atmosphere[aria-hidden=true],.chrnx-character-stage__content, and.chrnx-character-stage__art; optional.chrnx-character-facetsfollows the stage, never sits inside it. The content layer contains the existing primary heading/copy/list in original semantic order. The art layer contains exactly one primary responsive<picture>. Home Projects places its decorative.chrnx-character-stage__secondary-artinside the atmosphere layer; Home/Home Landing Music likewise places.chrnx-character-stage__collageinside atmosphere; About places Life in primary art and Literature/Gaming in the later facets region. -
Add parse/serialize/editor-fidelity assertions on rendered pattern
$content:parse_blocks( $content )finds no freeform corruption,serialize_blocks( parse_blocks( $content ) )reparses to the same ordered block-name tree, every pattern retains one intended primary heading and no H1, and existing content strings/order remain present. Never parse the PHP source itself. -
Add unknown/show render RED tests: an unknown
topic="future-topic"outputs a labeled.chrnx-topic-heroplus decorative.chrnx-topic-hero__fallback;/show/silicon-ranch/uses Podcasts art but keepsSilicon Ranchas the visible title. -
Run
PATH=/opt/homebrew/opt/docker/bin:$PATH npm run test:php -- --filter 'PatternsTest|BlockRenderingTest'andnpm run test:smoke; expect failures for missing shared classes, absent unknown fallback, and show art mapping. -
Minimally wrap or class existing pattern content to implement the exact API. In
music-landing.php, replace the raw collage JPEG withchrnx_get_topic_portrait_markup( 'music-collage', __( 'The No Names collage', 'chrnx' ), 'chrnx-character-stage__collage' ); it must retain meaningful nonempty alt, intrinsic dimensions, lazy loading, and AVIF/WebP sources. Other decorative portraits/collages retainalt=""plusaria-hidden="true"; the meaningful isolated Music portrait retains its approved nonempty alt. -
Re-run the two exact commands; expect focused PHP and smoke PASS. Run
npm run phpcsand commitrefactor: unify CHRNX character stages.
Task 2: Implement the mockup character effect
Files:
-
Modify:
assets/css/components.css -
Test:
tests/e2e/visual-states.spec.mjs -
Test:
tests/smoke/visual-integration.test.mjs -
Add failing browser contracts at 375/768/1440/2560 in explicit light/dark for every Home/Projects/Music/Podcasts/About/show/topic stage: primary art bounding-box width is 35–48% of its stage on desktop and at least 62% on mobile; art bottom is within 2px of stage bottom; mobile content top precedes art top; content, art, subsequent cards, and facets do not intersect; document and stage have no horizontal overflow.
-
Add human-inspection captures/contracts for visible face, torso, and defining prop. Automated tests additionally require the foreground
<picture>to paint above atmosphere/secondary layers by computedz-index, a non-none shadow/filter or mask, and zero eager below-fold character requests. -
Add a long-copy regression that expands each representative content layer by 4x so translated content grows the frame instead of covering the character; assert text contrast at least 4.5:1 in both explicit themes. Add reduced-motion static-equivalence and no-JS visibility/containment checks.
-
Run
PATH=/opt/homebrew/opt/docker/bin:$PATH npx playwright test tests/e2e/visual-states.spec.mjs --project=chromium --grep 'character stage'; expect failures for current tiny/floating/stacked portraits and missing class API. -
Implement the shared 55/45 desktop stage and text-first mobile stage with themed halo, wash, collage fragments, grounded shadow, and per-topic accent variables.
-
Ensure the Music musician remains foreground over the lazy collage and About facets remain visually secondary.
-
Re-run the exact Playwright command expecting PASS, then run
npm run lint:css,npm run lint:js,uv run --with pillow --with pytest pytest tests/assets/test_alter_ego_assets.py -q, andPATH=/opt/homebrew/opt/docker/bin:$PATH npm run test:php -- --filter ResponsiveMediaTest; all must PASS. Commitstyle: apply CHRNX character-led sections.
Task 3: Center primary titles without harming reading alignment
Files:
-
Modify:
assets/css/components.css -
Test:
tests/e2e/visual-states.spec.mjs -
Test:
tests/smoke/templates.test.mjs -
Add failing tests for this exact positive selector matrix:
.chrnx-entry--page > .wp-block-post-title,.chrnx-entry--single > .wp-block-post-title,.chrnx-archive > .wp-block-query-title,.chrnx-search-results > .wp-block-query-title,.chrnx-entry--page .chrnx-home-projects .chrnx-character-stage__content > h2,.chrnx-music-landing .chrnx-character-stage__content > h2,.chrnx-podcast-landing .chrnx-character-stage__content > h2,.chrnx-about .chrnx-character-stage__content > h2, and.chrnx-topic-hero__titlecomputetext-align:centerwith auto inline margins. -
Add negative assertions that
.chrnx-entry__meta,.chrnx-page-kicker, paragraphs, form labels,.chrnx-home .chrnx-home-projects .chrnx-character-stage__content > h2, every other.chrnx-home > section > h2, project/release headings, and card headings remainstart/left aligned. Assert the single content measure remains 70ch and metadata still wraps without overflow at 200% root text. -
Run
PATH=/opt/homebrew/opt/docker/bin:$PATH npx playwright test tests/e2e/visual-states.spec.mjs --project=chromium --grep 'primary title alignment'; expect current page/post/search/title failures. -
Add narrowly scoped selectors and balanced margins; do not use a global heading centering rule.
-
Re-run the exact Playwright command expecting PASS, then run
npm run test:smoke,npm run lint:css, andPATH=/opt/homebrew/opt/docker/bin:$PATH npx playwright test tests/e2e/visual-states.spec.mjs --project=chromium --grep 'primary title alignment|long.*title'; require PASS in explicit light/dark mobile and 200% root-text cases. Commitstyle: center CHRNX primary titles.
Task 4: Repair podcast character and card geometry
Files:
-
Modify:
assets/css/components.css -
Modify:
blocks/latest-podcast/style.cssonly if its base media rule must change -
Modify:
tests/fixtures/posts.json -
Test:
tests/e2e/visual-states.spec.mjs -
Test:
tests/php/BlockRenderingTest.php -
Test:
tests/smoke/visual-integration.test.mjs -
Extend the existing eligible
post-podcast-episodefixture with a deliberately long podcast title and excerpt while preservingtopic=podcasts,show=silicon-ranch, canonical metadata, and exact total fixture count. Add smoke assertions proving this is the eligible long-card case. -
Add a failing regression reproducing the screenshot: require an unobstructed Podcasts portrait,
.chrnx-podcast-card__contentwidth at least equal to an offscreen DOM probe with the same computed font family/size andwidth:28ch,min-width:0, media within its bounds, normal title/excerpt/badge wrapping, no clipping, and a content-aware stack when the viewport cannot preserve both columns. -
Add mobile missing-media plus long title/excerpt/badge cases; metadata is not part of this card and is explicitly out of this geometry contract.
-
Run
npm run test:smokeandPATH=/opt/homebrew/opt/docker/bin:$PATH npx playwright test tests/e2e/visual-states.spec.mjs --project=chromium --grep 'long podcast composition'; expect fixture/geometry failures. -
Fix grid
minmax()geometry, media bounds, stacking breakpoint, and portrait/card separation without hiding content. -
Re-run those commands expecting PASS, then run
PATH=/opt/homebrew/opt/docker/bin:$PATH npx playwright test tests/e2e/visual-states.spec.mjs --project=chromium --project=firefox --project=webkit --grep 'long podcast composition',PATH=/opt/homebrew/opt/docker/bin:$PATH npm run test:php -- --filter BlockRenderingTest,npm run lint:css, andnpm run lint:js; all must PASS. Commitfix: preserve CHRNX podcast composition.
Task 5: Visual approval and full regression
Files:
-
Modify:
scripts/capture-visual-review.mjs -
Test:
tests/smoke/visual-integration.test.mjs -
Create ignored:
tmp/imagegen/character-led-*.png -
Add a failing bounded-capture contract with stage crops for Home Projects, Home Music, Projects, Music, Podcasts, About,
/show/silicon-ranch/, long Podcast card, post-title, and all seven/topic/{research,code,literature,music,podcasts,life,gaming}/mappings. Every mapped stage is captured at 375x812, 768x1024, 1440x900, and 2560x1440 in explicit light/dark. Preserve the current fresh-browser-per-capture isolation regression: every image launches and closes its own Chromium instance so dark-to-light compositing state cannot leak. -
For unknown fallback only, navigate Chromium to
http://localhost:8888/topic/code/so WordPress has loaded its generatedglobal-styles-inline-css, block-support CSS, theme styles, and local font declarations. Obtain fallback markup without persistent content usingPATH=/opt/homebrew/opt/docker/bin:$PATH npx wp-env run cli --env-cwd=wp-content/themes/chrnx -- wp eval '$attributes=array("topic"=>"future-topic","headingLevel"=>2); ob_start(); include get_theme_file_path("blocks/topic-hero/render.php"); echo base64_encode(ob_get_clean());' | sed -n '/^[A-Za-z0-9+\/=]\+$/p' | tail -1, decode it in the capture process, and replace only the existing.chrnx-topic-heroelement via DOM APIs. Wait fordocument.fonts.ready, every linked stylesheet to report a loaded sheet, and two animation frames before capture. This creates no Page/term/post, keeps the 7-page/12-post invariant, retains the real local page URL/styles/fonts, and is captured undercharacter-led-unknown-fallback-*. -
Run
npm run test:smoke -- --test-name-pattern='character-led capture'; expect FAIL before script expansion and PASS afterward. Generatetmp/imagegen/character-led-*.pngwithout committing PNGs. -
Inspect every capture for correct character, consistent scale/effect, centered primary title, readable card copy, containment, and footer/header regressions.
-
Run
PATH=/opt/homebrew/opt/docker/bin:$PATH npm test; expect smoke/lints/PHPCS/Jest/PHPUnit/160 Playwright tests (plus new tests) PASS with only documented axe skips. This preserves existing keyboard, permalink, WCAG, theme-preference, no-JS, and reduced-motion coverage. -
Run
./scripts/seed-test-content.sh default; then runPATH=/opt/homebrew/opt/docker/bin:$PATH npx wp-env run cli -- wp eval '$rows=get_posts(array("post_type"=>array("page","post"),"post_status"=>"any","posts_per_page"=>-1,"meta_key"=>"_chrnx_fixture_key")); $map=array(); foreach($rows as $row){$key=get_post_meta($row->ID,"_chrnx_fixture_key",true); if($key){$map[$key]=(int)$row->ID;}} ksort($map); global $wp_rewrite; echo wp_json_encode(array("fixtures"=>$map,"pages"=>count(array_filter($rows,fn($p)=>"page"===$p->post_type)),"posts"=>count(array_filter($rows,fn($p)=>"post"===$p->post_type)),"scenario"=>get_option("_chrnx_fixture_featured_limit","default"),"subscribe"=>(int)get_option("chrnx_subscribe_page_id"),"subscribe_status"=>get_post_status((int)get_option("chrnx_subscribe_page_id")),"option_permalink"=>get_option("permalink_structure"),"live_permalink"=>$wp_rewrite->permalink_structure));' | sed -n '/^{/p' > "${TMPDIR%/}/chrnx-character-fixtures-1.json". Repeat seed and command intochrnx-character-fixtures-2.json; runcmpand require exit 0, 19 keys, 7 pages, 12 posts, default scenario, published Subscribe, and both permalink fields/%postname%/. -
Run
TMP_REBUILD="$(mktemp -d "${TMPDIR%/}/chrnx-character.XXXXXX")"; ./scripts/build-responsive-images.sh "$TMP_REBUILD"; compare all generated files byte-for-byte withassets/images/generated, then remove only the validatedchrnx-character.*directory. -
Set
PROBE_DIR="$(mktemp -d "${TMPDIR%/}/chrnx-character-http.XXXXXX")"andPOST_URL="$(PATH=/opt/homebrew/opt/docker/bin:$PATH npx wp-env run cli -- wp eval '$p=get_posts(array("post_type"=>"post","post_status"=>"publish","posts_per_page"=>1,"meta_key"=>"_chrnx_fixture_key")); echo get_permalink($p[0]);' 2>/dev/null | sed -n 's/^\(http[^[:space:]]*\).*$/\1/p' | tail -1)". For/,/projects/,/music/,/podcasts/,/about/,/show/silicon-ranch/, all seven topic URLs,/?s=expressive, and$POST_URL, runcurl -sS -o "$PROBE_DIR/<stable-name>.html" -w '%{http_code}' <url>and require200; require/definitely-missing-character-stage/to return404. Run! rg -n 'PHP (Warning|Notice|Fatal)|Stack trace' "$PROBE_DIR"andgit diff --check. SetBASE_REF="$(git merge-base HEAD main)", exportgit diff --name-only -z "$BASE_REF"...HEAD > "${TMPDIR%/}/chrnx-character-files.zlist", and pass that NUL-delimited list to an exact secrets/absolute-path scan forapi[_-]?key|secret|token|/Users/chrnx|var_dump|print_r; require no matches. Reviewconsole\.(log|warn|error)separately: only the capture script's intentional CLI filename/dimension logging is allowed; production PHP/JS/CSS must contain none. Delete only the validated temp files/directories. -
Present
localhost:8888and exact capture paths for human visual approval before local merge. Do not push, deploy, or publish.