Skip to content

Feature/cleanup and plaintiff damages#80

Closed
mikepsinn wants to merge 3 commits into
mainfrom
feature/cleanup-and-plaintiff-damages
Closed

Feature/cleanup and plaintiff damages#80
mikepsinn wants to merge 3 commits into
mainfrom
feature/cleanup-and-plaintiff-damages

Conversation

@mikepsinn

@mikepsinn mikepsinn commented May 13, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • Added educational link to website footer.
  • Improvements

    • Enhanced visual testing workflow for improved screenshot consistency across test runs.
    • Restructured internal task management system for better maintainability.
  • Chores

    • Updated CI/CD workflow to publish visual review artifacts to preview environment.
    • Removed obsolete internal code modules.

mikepsinn and others added 3 commits May 10, 2026 23:25
The 643-line optimize-earth-page-context + optimize-earth-grounding
cluster was scaffolded for an autonomous-task-generation agent loop
that never landed in any code path. Every consumer of `CORE_PAGE_CONTEXT`,
`buildActionFollowThroughRoots`, the growth/contact/system children, and
`enrichTaskTreeWithManualGrounding` turned out to be... their own test
files. Pure ceremony.

Removed:
- packages/web/src/lib/optimize-earth-page-context.ts (422 lines)
- packages/web/src/lib/optimize-earth-grounding.server.ts (48 lines)
- ...page-context.test.ts (120 lines)
- ...grounding.server.test.ts (53 lines)
- 12 unused `OPTIMIZE_EARTH_*` task-key constants + 5 builders from
  packages/db/src/task-keys.ts (~54 lines)

If autonomous task generation ever becomes a real priority, the rebuild
will start from the concrete inputs the campaign actually has at that
moment, not from this stale scaffold.

Also surfaces the Full Manual link in the War on Disease footer's
"Learn Something" column — previously only the Optimitron variant
exposed it. The active campaign site is `warondisease.org`; not having
the manual on its way to readers from there was a gap.

TODO.md updated to reflect PR #71 outcomes (managed-data sync done,
dashboard simplified, plaintiff damages surface confirmed shipped,
allowsUserSubtasks parked) and to add the planned post-vote forward
email + email-screenshot visual review items.

The /listen page on the manual returns 404 today
(`https://manual.warondisease.org/listen` 404; `/podcast/` resolves but
is a different surface). Not adding a nav link until the URL exists.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
LiveCounter rendered a real ticking value during the visual-regression
spec, so every screenshot capture saw a different millisecond of the
counter and Argos surfaced false-positive diffs on every page that
embeds it (/employees, /presidents, signer rows, dashboards).

The spec already supports `data-visual-mask="dynamic"` + the placeholder
attribute — death-counter and money-counter both use it correctly. This
component had a non-standard `data-volatile="..."` attribute that the
spec doesn't recognize, so the mask never applied.

Match the established pattern so screenshots capture a stable
placeholder (`123,456` / `$123,456,789,012`) instead of live values.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The previous setup used `actions/upload-pages-artifact` +
`actions/deploy-pages`, which atomically replaces the entire Pages site
each deployment. Combined with the workflow's `rm -rf "$pages_root"`,
every PR's CI run wiped every other PR's visual review URL — clicking
the "Visual review" check on an older PR returned 404 the moment any
other PR's CI finished.

Switch to `peaceiris/actions-gh-pages@v4` with `keep_files: true`,
writing to a long-lived `gh-pages` branch. Each PR's content lands at
`pr-<N>/<short_sha>/` (the URL the commit status posts) AND at
`pr-<N>/latest/` (a stable per-PR link). Other PRs' directories on the
branch are preserved.

The job's `contents` permission moves from `read` to `write` so the
action can push to gh-pages. `pages: write` / `id-token: write` are
removed — they were only needed by the old deploy-pages flow.

One-time repo setup (manual): Settings → Pages → Source must be set to
"Deploy from a branch" with branch `gh-pages`. The action creates the
branch on its first successful run.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 13, 2026 21:48
@mikepsinn mikepsinn closed this May 13, 2026
@coderabbitai

coderabbitai Bot commented May 13, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 32762a6d-1ca5-413f-a7d3-f2f36eb6d585

📥 Commits

Reviewing files that changed from the base of the PR and between f5f002f and 2531e8f.

📒 Files selected for processing (9)
  • .github/workflows/ci.yml
  • TODO.md
  • packages/db/src/task-keys.ts
  • packages/web/src/components/tasks/live-counter.tsx
  • packages/web/src/lib/optimize-earth-grounding.server.test.ts
  • packages/web/src/lib/optimize-earth-grounding.server.ts
  • packages/web/src/lib/optimize-earth-page-context.test.ts
  • packages/web/src/lib/optimize-earth-page-context.ts
  • packages/web/src/lib/site.ts

📝 Walkthrough

Walkthrough

This PR consolidates multiple code cleanup and workflow updates: it refactors the visual review publishing pipeline to use per-PR gh-pages directories, removes deprecated optimize-earth autonomous-task modules and their associated task-key registry entries, stabilizes live-counter screenshots for visual regression testing, adds a new accountability task-key builder, updates task planning status, and wires a manual paper link into the site footer.

Changes

Visual Review and Test Stabilization

Layer / File(s) Summary
Per-PR gh-pages publishing workflow
.github/workflows/ci.yml
web-validate job permissions are updated to contents: write. The old Pages deployment actions are replaced with a per-PR directory structure under packages/web/output/playwright/pages-per-pr/pr-<number>, seeded with .nojekyll and root index.html, and published via peaceiris/actions-gh-pages@v4 with keep_files: true. Step outputs wire short_sha and publish_dir for downstream use.
Live-counter visual regression masking
packages/web/src/components/tasks/live-counter.tsx
Counter markup adds data-visual-mask="dynamic" and data-visual-placeholder attributes (currency or integer string depending on mode) to replace nondeterministic tick values during e2e screenshot capture, replacing the prior data-volatile attribute.

Optimize-Earth System Cleanup

Layer / File(s) Summary
Removal of optimize-earth autonomous-task modules
packages/web/src/lib/optimize-earth-page-context.ts, packages/web/src/lib/optimize-earth-grounding.server.ts
Deleted buildActionFollowThroughRoots, enrichOptimizeEarthBootstrapRoots, ManualGroundingRetriever, and enrichTaskTreeWithManualGrounding functions and interfaces along with their helper logic for task-tree impact scaling, grounding retrieval, and follow-through task generation.
Removal of optimize-earth test suites
packages/web/src/lib/optimize-earth-page-context.test.ts, packages/web/src/lib/optimize-earth-grounding.server.test.ts
Deleted Vitest coverage for the removed buildActionFollowThroughRoots and enrichTaskTreeWithManualGrounding implementations.
Task-key registry cleanup
packages/db/src/task-keys.ts
Removed entire optimize-earth task-key section including OPTIMIZE_EARTH_TASK_KEY_PREFIX, static key constants (OPTIMIZE_EARTH_WEAPONIZE_OVERDUE_TASK_LIST_KEY, etc.), prefix array, and buildOptimizeEarth* key builder functions.

Accountability Task Key Registry

Layer / File(s) Summary
Accountability task-key builder
packages/db/src/task-keys.ts
Added ACCOUNTABILITY_TASK_KEY_PREFIX and exported buildAccountabilityTaskKey(countryCode, activitySlug) to format accountability task keys as accountability:<lowercased countryCode>:<activitySlug>.

Documentation and Site Updates

Layer / File(s) Summary
Task planning and visual review requirements
TODO.md
Marked UI presentation (step 5) as complete; explicitly parked allowsUserSubtasks schema column pending public subtask roadmap entry. Replaced logged-in dashboard item with shipped focused share-surface description (PR #71). Added decided post-vote email behavior (single triggered email on counted votes, no reminder drips). Expanded visual-review workflow section with requirements (cache-busted gallery, email-template screenshots, SHA-pinned commits, deterministic stability, flagging expectations). Marked /plaintiffs/page.tsx damages surface complete with $10.6M NPV and $25.2M lifetime cohort display.
Manual paper link in footer
packages/web/src/lib/site.ts
Added fullManualPaperLink import and wired it into the War on Disease UI footer "Learn Something" column items.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

Possibly related PRs

  • mikepsinn/optimitron#72: Aligned deletions of optimize-earth-page-context/optimize-earth-grounding modules and task-key exports, plus the WoD footer fullManualPaperLink addition.
  • mikepsinn/optimitron#32: Both PRs wire the accountability task key namespace; main PR adds/exports buildAccountabilityTaskKey, while #32 uses it in leader-accountability and task flows.
  • mikepsinn/optimitron#68: Both modify the .github/workflows/ci.yml visual-review publishing pipeline—main PR changes per-PR gh-pages directory flow, while #68 adjusts visual baseline seeding/resolution.

Poem

🐰 Hops through cleanup with glee,
Visual tests now stable as can be!
Optimize-Earth retires with care,
Accountability tasks take the stair.
Per-PR pages dance on gh-pages branch,
A rabbit's refactor—done with a crunch! 🌿

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/cleanup-and-plaintiff-damages

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mikepsinn mikepsinn deleted the feature/cleanup-and-plaintiff-damages branch May 13, 2026 21:49

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2531e8f317

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +73 to +78
data-visual-mask="dynamic"
data-visual-placeholder={
mode === "currency"
? VISUAL_REVIEW_CURRENCY_PLACEHOLDER
: VISUAL_REVIEW_INTEGER_PLACEHOLDER
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Retain volatile marker on live counters

Add back a data-volatile attribute on this <span> (e.g., money/count) instead of replacing it entirely with visual-mask attrs. The copy-preview pipeline (packages/web/scripts/render-pages-to-markdown.ts, extractPage) only normalizes nodes selected by [data-volatile]; without that marker, live counter text is captured as wall-clock values, so page.logged-*.md outputs churn between runs and obscure real copy diffs.

Useful? React with 👍 / 👎.

@mikepsinn mikepsinn removed the request for review from Copilot May 13, 2026 22:12
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