Repository navigation
fix: rescue colon descriptions with a two-word phrase before the colon - #28
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
commentAsDescriptionNodesonly rescued a colon-containing comment as a description when the phrase before the colon had 3+ words. A two-word phrase likeContact us: support@example.comfell through to being parsed as an unrecognizedkey: valueschema 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.---doc separator, and aFuzzParseHeadCommentfuzz test overcomments.Parseto catch this class of "weird comment text" bug going forward.Test plan
go test ./pkg/schema/comments/... -v— all tests passgo test -fuzz=FuzzParseHeadComment -fuzztime=30s ./pkg/schema/comments/— 156k executions, no crashesgo build ./...andgo vet ./...— clean🤖 Generated with Claude Code