Spun out of #30 so that tracking issue can be closed. #30's own acceptance criteria are met; this was listed there as deferred follow-up work — and the duplication it anticipated did in fact materialize.
Problem
The prefix-modifier range rule is expressed twice.
UriTemplateVarSpec defines the bounds as named constants and validates against them:
src/Chatter.Rest.UriTemplates/UriTemplateVarSpec.cs:39 — internal const int MaxPrefixLength = 9999;
:99 — if (length < MinPrefixLength || length > MaxPrefixLength)
UriTemplateParser re-implements the same rule with hardcoded literals:
src/Chatter.Rest.UriTemplates/UriTemplateParser.cs:134 — if (!int.TryParse(suffix, out var prefixLen) || prefixLen < 1 || prefixLen > 9999)
:112 and :137 — the bounds are also spelled out in the message text
The two agree today. Nothing enforces that they keep agreeing.
Requested change
Have UriTemplateParser use UriTemplateVarSpec.MinPrefixLength / MaxPrefixLength rather than literals, and interpolate them into the exception messages so the text cannot drift from the check either.
Behavior-preserving refactor; no observable change, no version bump beyond whatever the touched src/ path already requires per CLAUDE.md.
Spun out of #30 so that tracking issue can be closed. #30's own acceptance criteria are met; this was listed there as deferred follow-up work — and the duplication it anticipated did in fact materialize.
Problem
The prefix-modifier range rule is expressed twice.
UriTemplateVarSpecdefines the bounds as named constants and validates against them:src/Chatter.Rest.UriTemplates/UriTemplateVarSpec.cs:39—internal const int MaxPrefixLength = 9999;:99—if (length < MinPrefixLength || length > MaxPrefixLength)UriTemplateParserre-implements the same rule with hardcoded literals:src/Chatter.Rest.UriTemplates/UriTemplateParser.cs:134—if (!int.TryParse(suffix, out var prefixLen) || prefixLen < 1 || prefixLen > 9999):112and:137— the bounds are also spelled out in the message textThe two agree today. Nothing enforces that they keep agreeing.
Requested change
Have
UriTemplateParseruseUriTemplateVarSpec.MinPrefixLength/MaxPrefixLengthrather than literals, and interpolate them into the exception messages so the text cannot drift from the check either.Behavior-preserving refactor; no observable change, no version bump beyond whatever the touched
src/path already requires per CLAUDE.md.