feat(go/M2.2): port czech.ParseMonthReferences #5

Merged
kacerr merged 1 commits from feat/m2-2-parse-month-references into main 2026-05-06 00:07:15 +02:00
Owner

Summary

Ports parse_month_references from scripts/czech_utils.py to Go as internal/domain/czech.ParseMonthReferences.

Three-pass implementation mirroring the Python logic exactly:

  • Numeric slash"11+12/2025", "01/26", plus-split months, 2-digit year → +2000
  • Dot notation"12.2025" (4-digit year required; "1.26" is rejected)
  • Czech month names — range walk with Dec→Jan wrap-around year inference, then standalone pass with m≥10 → defaultYear-1 heuristic. Longest-match alternation (names sorted desc by length) ensures cervenec beats cerven.

35 table-driven tests. All expected outputs verified against the live Python implementation before locking the table (see plan at docs/plans/2026-05-05-2337-go-rewrite-m2-2-parse-month-references.md).

Addresses risk #4 from the parent plan (Czech month parser semantics).

Test plan

  • cd go && go build ./... — clean compile
  • cd go && go test ./internal/domain/czech/... — 35/35 green
  • cd go && go test -race ./... — race-clean
  • make go-lint — clean, gofumpt-formatted
  • All test inputs spot-checked against PYTHONPATH=scripts:. python -c 'from czech_utils import parse_month_references; ...'

🤖 Generated with Claude Code

## Summary Ports `parse_month_references` from `scripts/czech_utils.py` to Go as `internal/domain/czech.ParseMonthReferences`. Three-pass implementation mirroring the Python logic exactly: - **Numeric slash** — `"11+12/2025"`, `"01/26"`, plus-split months, 2-digit year → +2000 - **Dot notation** — `"12.2025"` (4-digit year required; `"1.26"` is rejected) - **Czech month names** — range walk with Dec→Jan wrap-around year inference, then standalone pass with `m≥10 → defaultYear-1` heuristic. Longest-match alternation (names sorted desc by length) ensures `cervenec` beats `cerven`. 35 table-driven tests. All expected outputs verified against the live Python implementation before locking the table (see plan at `docs/plans/2026-05-05-2337-go-rewrite-m2-2-parse-month-references.md`). Addresses risk #4 from the parent plan (Czech month parser semantics). ## Test plan - [x] `cd go && go build ./...` — clean compile - [x] `cd go && go test ./internal/domain/czech/...` — 35/35 green - [x] `cd go && go test -race ./...` — race-clean - [x] `make go-lint` — clean, gofumpt-formatted - [x] All test inputs spot-checked against `PYTHONPATH=scripts:. python -c 'from czech_utils import parse_month_references; ...'` 🤖 Generated with [Claude Code](https://claude.com/claude-code)
kacerr added 1 commit 2026-05-06 00:06:06 +02:00
feat(go/M2.2): port czech.ParseMonthReferences
All checks were successful
Deploy to K8s / deploy (push) Successful in 8s
6d971b61d4
Three-pass regex parser matching python/czech_utils.py parse_month_references:
1. Numeric slash notation — "11+12/2025", "01/26"; 2-digit year → +2000
2. Dot notation — "12.2025" (4-digit year only)
3. Czech month names — range walk (listopad-leden wrap logic) then
   standalone with m≥10 → defaultYear-1 heuristic; longest-match
   alternation (sorted desc by name length) handles cervenec vs cerven

35 table-driven tests, all expected outputs verified against live Python
on 2026-05-05 before locking. Plan at
docs/plans/2026-05-05-2337-go-rewrite-m2-2-parse-month-references.md.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
kacerr merged commit 0a8017fffa into main 2026-05-06 00:07:15 +02:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kacerr/fuj-management#5