Skip to content

feat(pipeline): read percentage ranges "10-20%" as a unit (#112) - #172

Merged
xilec merged 1 commit into
mainfrom
fix/112-percentage-range
Aug 1, 2026
Merged

feat(pipeline): read percentage ranges "10-20%" as a unit (#112)#172
xilec merged 1 commit into
mainfrom
fix/112-percentage-range

Conversation

@xilec

@xilec xilec commented Aug 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • New re_percentage_range() + "Percentage ranges" phase right before
    Percentages: "10-20%" → "от десяти до двадцати процентов" — no bare
    dash, no bare "%" (pipeline: percentage range "10-20%" reads as "десять-двадцать процентов" #112)
  • Decimal bounds ("10.5-20.5%") stay an accepted non-goal (plain ranges
    are integer-only too); behavior there matches the existing range phase
  • Archived OpenSpec change read-percentage-ranges; "Ranges and
    percentages" gains the range-percent reading, "Fixed phase order"
    records the new phase

Reviewer findings folded in

  • Unparsable bounds (> i64) now leave the match untouched instead of
    appending " процентов" to raw digits — same failure mode as
    normalize_percentage
  • Boundary tests pinned: "10 - 20 %" (spaces tolerated),
    "x10-20%" (no range reading — pinned actual behavior, plain
    percentage still claims "20%", pre-existing semantics)

Test plan

  • cargo test — 972 tests, incl. new unit tests + golden fixture
    range_percent (char_map pinned)
  • just lint
  • openspec validate --strict

Closes #112

After the #76 phase swap (Percentages before Ranges) the percentage
phase consumed "20%" first, the range phase never saw "10-20", and the
dash was left bare: "10-20%" read as "десять-двадцать процентов". The
pre-swap output was equally broken ("от десяти до двадцати%").

Add a Percentage ranges phase immediately before Percentages:
`\b(\d+)\s*-\s*(\d+)\s*%` is read via the existing normalize_range plus
the fixed genitive-plural "процентов" (always correct after
"до <genitive>") → "от десяти до двадцати процентов". Unparsable bounds
leave the whole match untouched, mirroring the plain percentage phase.

Closes #112
@xilec
xilec merged commit d0ff074 into main Aug 1, 2026
6 checks passed
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.

pipeline: percentage range "10-20%" reads as "десять-двадцать процентов"

1 participant