Skip to content

Refuse a form with more distinct sections than letters [patch] - #427

Merged
matt-edmondson merged 1 commit into
mainfrom
fix/314-form-letter-limit
Oct 14, 2026
Merged

matt-edmondson merged 1 commit into
mainfrom
fix/314-form-letter-limit

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Fixes #314

What changed

Form.Of gave each structurally distinct section the letter 'A' + index with no upper bound. The 27th distinct section was labelled '[', which Form.Parse rejects, so Parse(ToString()) failed on a Form the library had produced.

This takes the fail-fast option from the issue, which triage named as the smaller change:

  • Form.Of throws ArgumentException when an arrangement has more than 26 structurally distinct sections.
  • The limit is exposed as Form.MaxDistinctSections and documented on Form.Of and Arrangement.Form.
  • Repeats of earlier sections still label normally, so a 27-section arrangement with only 26 distinct structures works.

Tests

FormTests gains three cases:

  • 26 distinct sections give A–Z, and the result round-trips through Parse.
  • 27 distinct sections throw. This test fails on main with "no exception was thrown".
  • 26 distinct sections plus one repeat give A–Z followed by A.

All 354 Music tests pass. The local Sonar build reports nothing in the changed files.

🤖 Generated with Claude Code

https://claude.ai/code/session_01SWJoWcEC3BuVS7pSPco7mA


Generated by Claude Code

Form.Of labelled the 27th structurally distinct section '[', which
Form.Parse rejects, so Parse(ToString()) failed for a Form the library
produced. Of now throws ArgumentException past 26 distinct sections,
exposed as Form.MaxDistinctSections.

Fixes #314

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SWJoWcEC3BuVS7pSPco7mA
@sonarqubecloud

Copy link
Copy Markdown

@matt-edmondson
matt-edmondson merged commit b73ba10 into main Oct 14, 2026
15 checks passed
@matt-edmondson
matt-edmondson deleted the fix/314-form-letter-limit branch October 14, 2026 01:17
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.

Form.Of labels the 27th distinct section '[' so Form.Parse(form.ToString()) fails to round-trip

2 participants