feat(parser): widen note dialects (DD/MM dates, weekday headers, space/slash sets, @ bw) - #44
Merged
Merged
Conversation
…sts, @ bodyweight
…der warnings Two-value bodyweight slash rep-lists like "pullups 12/10" (and 10/8) were dropped entirely — no sets, no warning — when both values were <=12, because the bare-slash branch rejected them via a looksLikeNumericDate guard that mis-read "12/10" as a DD/MM date. Inside parseSets the text is always set-text on a line that already has an exercise name, so the date guard was wrong here: drop it (and the now-unused helper). Date headers are still matched at line-start in segment.ts / fields.ts. collectInlineRemainders split set-text on commas and flagged any token with letters as an unparsed inline entry, falsely flooding the Review UI with one warning per exercise for the new space/scheme/slash set formats (the exercise name stays in the first comma-segment). It now reuses the set tokenizer's own recognizers (new isFullySetTokens) to strip recognized set tokens before deciding a segment is an unparsed alpha remainder. Genuine inline secondary exercises (e.g. "then archers x 10") are still flagged. Also tidy parseToken's weight-only carrier branch contract comment. Tests: add pullups 12/10 and 10/8 (2-set bodyweight, no data loss), a dips 20/15 case, and a no-false-warning assertion on the messy-dialect note while keeping the archers x 10 warning assertion.
…out date
In a full note, a bodyweight exercise line like "pullups 12/10" was mis-read as
the workout DATE (2026-12-10) and the exercise was dropped: date extraction ran
on the exercise line and chrono greedily interpreted the mid-line "12/10" as a
date. This violates the dialect spec §3 (dates are matched only at
header/line-start, never mid-line on an exercise line).
Three reinforcing fixes:
- parseNotes: parse each line as an exercise up front and skip date extraction
when the line yields an exercise (parsed.length > 0). This is more precise than
a !looksLikeSetLine guard, which would wrongly skip the date on the
"19:10, Saturday, 20 Jun 2026" time-prefixed header (that line trips the colon
branch of looksLikeSetLine yet is a real date header, not an exercise).
- looksLikeSetLine: recognise a two-value bodyweight slash rep-list after an
exercise name ("pullups 12/10"), excluding weekday-led numeric date headers
("mon 14/10") so those still date correctly.
- fields.ts extractDate: strip bare numeric slash/dash date tokens before the
chrono fallback so a mid-line "12/10" can never be read as 10 Dec even if
chrono is reached. Named-month dates ("26 Aug 2024") are unaffected; the
line-start numeric form is still handled by parseNumericDDMM.
Integration test: a 3-line note (wed legs / pullups 12/10 / squat 140 x5x5)
asserts the legs session is undated (not 2026-12-10) and keeps BOTH pullups
(2 bodyweight sets, reps 12/10) and squat — locking the regression the unit
test missed. mon 14/10 push @ 88kg still dates to 14 Oct.
This was referenced Jun 23, 2026
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.
Widens the deterministic notes parser to handle four more freeform dialects a live smoke test proved it dropped — no LLM, web-only, no regression to the existing dialect.
Adds
mon 14/10,14/10/24,Wed 5/4(day>12 unambiguous; explicit DD/MM path ahead of chrono).wed legs,Monday push.100x5 102.5x5 105x4, slash rep-lists60kg 5/5/4+ bodyweight12/10/12/10/8,WEIGHT NxMscheme140 x5x5. Carried-weight preserved.@-bodyweight:@ 88kg,@88.Determinism
Parser stays pure — current-year threaded in from the call boundary (
pipeline.ts), noDate.now()insrc/parser/*.Review-driven fixes (caught before merge)
pullups 12/10) → fixed.12/10no longer stolen as the workout date.Verification
371 tests pass (+19). Smoke on the messy note: 2 workouts, all exercises + weights, correct DD/MM date, bodyweight, 0 false warnings.
Spec:
docs/superpowers/specs/2026-06-23-parser-dialects-design.md