Skip to content

fix: rescue colon descriptions with a two-word phrase before the colon - #28

Merged
brahmlower merged 2 commits into
mainfrom
brahmlower/fix-colons-in-descriptions
Aug 26, 2026
Merged

brahmlower merged 2 commits into
mainfrom
brahmlower/fix-colons-in-descriptions

Conversation

@brahmlower

Copy link
Copy Markdown
Owner

Summary

  • commentAsDescriptionNodes only rescued a colon-containing comment as a description when the phrase before the colon had 3+ words. A two-word phrase like Contact us: support@example.com fell through to being parsed as an unrecognized key: value schema field and was silently dropped instead. Since no real schema keyword contains a space, any space in the parsed key is now enough to know it's a description.
  • Adds a word-count boundary test pinning the current heuristic (including the known single-word limitation, which is unchanged and documented), a test confirming the same fix applies after a --- doc separator, and a FuzzParseHeadComment fuzz test over comments.Parse to catch this class of "weird comment text" bug going forward.

Test plan

  • go test ./pkg/schema/comments/... -v — all tests pass
  • go test -fuzz=FuzzParseHeadComment -fuzztime=30s ./pkg/schema/comments/ — 156k executions, no crashes
  • go build ./... and go vet ./... — clean

🤖 Generated with Claude Code

brahmlower and others added 2 commits August 26, 2026 05:11
commentAsDescriptionNodes required 3+ words before a colon to treat a
comment as a description rather than a key/value schema field, so a
two-word phrase like "Contact us: support@example.com" fell through to
being parsed as an unrecognized schema field and silently dropped. No
real schema keyword contains a space, so any space in the parsed key
is sufficient to know it's a description.

Also adds a word-count boundary test, a test covering the same fix
applied after a "---" doc separator, and a fuzz test over Parse to
catch this class of "weird comment text" bug going forward.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@brahmlower
brahmlower merged commit 493f6c4 into main Aug 26, 2026
3 checks passed
@brahmlower
brahmlower deleted the brahmlower/fix-colons-in-descriptions branch August 26, 2026 05:23
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