Skip to content

fix(segment): enforce maxReps exactly - #41

Merged
shadowhand merged 1 commit into
mainfrom
feature/sv-83-maxreps-allows-one-more-repetition-than-declared
Oct 17, 2026
Merged

shadowhand merged 1 commit into
mainfrom
feature/sv-83-maxreps-allows-one-more-repetition-than-declared

Conversation

@shadowhand

Copy link
Copy Markdown
Contributor

Goal

Make a field declared with maxReps: N accept exactly N repetitions, as SV-83 specifies.

Changes

  • Compare the 0-based repetition index against the maximum with >=, so indices 0..N-1 are allowed and the (N+1)th throws OutOfBoundsException.
  • Report the 1-based repetition number in the exception message, with correct singular/plural, so it agrees with the allowed count.
  • Fix the test that enshrined the off-by-one and add coverage for maxReps: 1 and PID|1~2||X.
  • Add a CHANGELOG entry under Fixed.

Refs SV-83

A 0-based repetition index was compared to the 1-based maximum with >, so every capped field accepted one repetition too many. Compare with >= instead, and report the 1-based repetition number in the exception message so it agrees with the allowed count.

Refs SV-83
@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

The Robin Hood of code review

✅ Review done. Nothing worth flagging — looks clean to me.

Push fixes whenever you like, then comment /robin for another pass.

Robin v2.12.0 · antongulin/robin@main (fc0bf91) · agent review: 6 turns · 14 tool calls

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Robin Hood of code review

Heads up: this is a point-in-time review. Push fixes freely, then comment /robin whenever you want another pass.

✅ No issues found

Summary

The change fixes the off-by-one check so capped fields accept no more than their configured repetition count, and reports repetition ordinals consistently as 1-based. The added tests cover both a general cap and parsing a repeated PID. I found no actionable issues in the diff.

@shadowhand
shadowhand merged commit ae62c91 into main Oct 17, 2026
2 checks passed
@shadowhand
shadowhand deleted the feature/sv-83-maxreps-allows-one-more-repetition-than-declared branch October 17, 2026 12:09
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