Skip to content

Split strength-then-metcon workouts into separate segments - #1814

Open
Yanchek99 wants to merge 1 commit into
masterfrom
worktree-fix-strength-metcon-split
Open

Split strength-then-metcon workouts into separate segments#1814
Yanchek99 wants to merge 1 commit into
masterfrom
worktree-fix-strength-metcon-split

Conversation

@Yanchek99

Copy link
Copy Markdown
Owner

Problem

Workout 405 (CF-260422) was scraped incorrectly — reported by the site owner as "wrong scheme/structure."

The real crossfit.com WOD for 2026-04-22 is two parts:

Overhead squat 8-8-8-8 reps        ← strength, load-scored
Then,
AMRAP 6 min:                       ← metcon, rep-scored
  40 overhead squats
  30 deficit push-ups

Production collapsed it into a single 6-minute AMRAP named "Overhead squat" containing the four literal 8-rep strength sets plus the 40 OHS + 30 deficit push-ups — the strength work got counted as part of the metcon.

Root cause

Workout structure comes entirely from the LLM's JSON (config.workout_parser = :llm). The system prompt only endorsed segment-splitting for explicitly labeled parts ("Part A/Part B", "Buy-in"), so the Then, strength→conditioning boundary — a very common CrossFit format — got merged. The one deterministic lifting-set correction only fires when the whole workout is weight-scored, so it didn't catch this either. The data model already supports the correct two-segment shape (e.g. "City 100", "Dallas 5").

Change

  • system_prompt.rb — new rule: a strength/lifting scheme immediately followed by a distinct conditioning piece is two segments (boundary = change of scheme, often Then,/blank line), each carrying its own rounds/time_seconds/interval_scheme; the workout score_type follows the scored conditioning piece, not weight. Plus a reconciling clause on the existing lifting-set rule for the multi-part case.
  • llm_parser_test.rb — regression test locking the two-segment shape the builder must produce from the corrected output.
  • .rubocop.yml — excluded the prose-only prompt module from Metrics/ModuleLength (length tracks extraction guidance, not code complexity), matching the repo's existing length-exclusion pattern.

Verification

  • llm_parser_test — 10 runs, 0 failures
  • workout-extraction + scrape-job + rake suite — 44 runs, 0 failures
  • rubocop — clean

Note: the parser test stubs the LLM (as the whole suite does), so it documents/guards the target shape but can't prove the prompt now elicits the split. That needs a live check:

bin/rails "cf_wod:fetch[2026-04-22]"

Once confirmed, re-scrape prod to fix the data:

bin/rails "cf_wod:scrape[2026-04-22]"

🤖 Generated with Claude Code

CF-260422 (workout 405) is a strength piece ("Overhead squat 8-8-8-8
reps") followed by "Then," + a distinct 6-minute AMRAP. The LLM parser
merged both into a single AMRAP segment, sweeping the four 8-rep strength
sets in alongside the metcon movements.

The system prompt only endorsed segment-splitting for explicitly labeled
parts ("Part A/Part B"), so the "Then," strength-to-conditioning boundary
got collapsed. Teach the prompt that a strength/lifting scheme immediately
followed by a distinct conditioning piece is two parts -- one segment each,
each carrying its own scheme -- with the workout score_type following the
scored conditioning piece rather than "weight". Reconcile the existing
lifting-set rule for the multi-part case.

Add a regression test locking the two-segment shape the builder must
produce from the corrected output, and exclude the prose-only prompt
module from Metrics/ModuleLength (its length tracks guidance, not code
complexity), matching the repo's existing length-exclusion pattern.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@railway-app

railway-app Bot commented Jul 27, 2026

Copy link
Copy Markdown

🚅 Deployed to the wod-tracker-pr-1814 environment in wod-tracker

Service Status Web Updated (UTC)
web 😴 Sleeping (View Logs) Web Jul 31, 2026 at 2:02 pm
worker ✅ Success (View Logs) Jul 31, 2026 at 1:53 pm

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