Skip to content

Commit cb6939c

Browse files
pajomaclaude
andcommitted
docs(specs,plans): amend #230 — drop we/th aliases, collision risk
#230 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 45a0ec6 commit cb6939c

2 files changed

Lines changed: 6 additions & 7 deletions

File tree

docs/plans/2026-06-01-fix-230-smart-input-week-and-weekday-aliases.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Both bugs are addressed in the #177 tokenizer branch. Bug 1 is already resolved
1515

1616
1. **Verify Bug 1 is resolved** — add regression test: `parseInput("task week Finalize Shoppinglist")``flags="task"`, `text="Finalize Shoppinglist"`, `hasWeek()=true`. No code change needed.
1717

18-
2. **Add 2-letter English aliases to `weekdayVocab()`** — append `'mo', 'tu', 'we', 'th', 'fr'` after the 3-letter English block (`mon/tue/wed/thu/fri/sat/sun`). Longest-first ordering preserved (3-letter tried before 2-letter). `fr` already present in German section; adding it to English section makes intent explicit and matches first (same result from `getDayOfWeekForString`).
18+
2. **Add 2-letter English aliases to `weekdayVocab()`** — append `'mo', 'tu', 'fr'` after the 3-letter English block (`mon/tue/wed/thu/fri/sat/sun`). `we` and `th` excluded: both are high-frequency English words that would destructively consume text. `fr` already present in German section; adding it to English section makes intent explicit (same result from `getDayOfWeekForString`). Longest-first ordering preserved.
1919

2020
3. **Invalidate pattern cache**`_weekdayPatterns` is built lazily from `weekdayVocab()`. Adding entries to the array changes the return value; since the cache is built per `MatchInput` instance, no reset needed.
2121

@@ -33,9 +33,8 @@ Both bugs are addressed in the #177 tokenizer branch. Bug 1 is already resolved
3333
| Bug 1 regression — w15 still numeric | `"w15"` | week=15 |
3434
| 2-letter alias mo | `"mo"` | same offset as `"mon"` |
3535
| 2-letter alias tu | `"tu"` | same offset as `"tue"` |
36-
| 2-letter alias we | `"we"` | same offset as `"wed"` |
37-
| 2-letter alias th | `"th"` | same offset as `"thu"` |
3836
| 2-letter alias fr | `"fr"` | same offset as `"fri"` |
37+
| No alias we/th | `"we"`, `"th"` | text-only (not weekday aliases — collision risk) |
3938
| No regression — task do | `"task do the shopping"` | flag=task, text="the shopping" (do = German Thursday) |
4039

4140
## Dependencies
@@ -46,7 +45,7 @@ Both bugs are addressed in the #177 tokenizer branch. Bug 1 is already resolved
4645

4746
| Risk | Mitigation |
4847
|------|-----------|
49-
| `we`/`th` false-positive on common words | Accepted per spec; tokenizer marks them `ambiguous`, yellow border visible to user |
48+
| `we`/`th` collision with English words | Excluded from aliases — not added |
5049
| `fr` duplication (English + German section) | `getDayOfWeekForString("fr", locale)` returns 5 (Friday) for all locales — result identical |
5150
| `_weekdayPatterns` cache stale | Cache is per-instance, built lazily on first `recognizeWeekday` call — no stale state possible |
5251

docs/specs/2026-06-01-fix-230-smart-input-week-and-weekday-aliases.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Both defects break user-visible output in the current 1.1.0 milestone. The week
1111
## In scope
1212

1313
- Fix `weekPattern` in `MatchInput.getExpression()` so it does not consume any character beyond the week token itself.
14-
- Add `mo`, `tu`, `we`, `th`, `fr` to `getWeekdayPattern()` as recognized English aliases (longest-first ordering; after the 3-letter set).
14+
- Add `mo`, `tu`, `fr` to `getWeekdayPattern()` as recognized English aliases (longest-first ordering; after the 3-letter set). `we` and `th` are excluded — both are high-frequency English words that would destructively consume text (e.g. `"task we need to buy milk"``we` parsed as Wednesday).
1515
- Add regression tests in `src/test/suite/input.test.ts` and/or `week-input.test.ts` covering the exact inputs from the issue report.
1616

1717
## Out of scope
@@ -25,7 +25,7 @@ Both defects break user-visible output in the current 1.1.0 milestone. The week
2525
1. `parseInput("task week Finalize Shoppinglist")``flags="task"`, `text="Finalize Shoppinglist"`, `week` = current week number.
2626
2. `parseInput("task do the shopping")` — behaviour unchanged (deferred; `do` still fires as German Thursday, text = "the shopping"). No regression.
2727
3. `parseInput("mo")``weekday` group matched, `offset` resolves to next/prev Monday relative to today (same as `parseInput("mon")`).
28-
4. Same for `tu`, `we`, `th`, `fr`.
28+
4. Same for `tu`, `fr`. `we` and `th` are NOT added — they collide with common English words.
2929
5. `parseInput("w15")``week=15` (no regression from week-pattern change).
3030
6. `parseInput("week")` alone (no following text) → `hasWeek()` true, no crash.
3131
7. Full test suite green.
@@ -50,7 +50,7 @@ const weekPattern = '(?<week>w(?:eek)?)(?=\\s(?!\\d)|$)';
5050

5151
`getDayOfWeekForString` (dates.ts:86-90) already maps `mo → 1`, `tu → 2`, `we → 3`, `th → 4`, `fr → 5`. `getWeekdayPattern()` only lists 3-letter English forms (`mon`, `tue`, `wed`, `thu`, `fri`), so the 2-letter variants never reach `resolveWeekday`.
5252

53-
Fix: append `'mo', 'tu', 'we', 'th', 'fr'` after the 3-letter English group in the `alternatives` array (longest-first ordering preserved).
53+
Fix: append `'mo', 'tu', 'fr'` after the 3-letter English group in the `alternatives` array (longest-first ordering preserved). `we` and `th` are excluded — `we` is a common English pronoun and would destructively consume words like "we" in `"task we need to buy milk"`; `th` appears at the start of many English words.
5454

5555
## Entities / interfaces
5656

0 commit comments

Comments
 (0)