Conversation
…n parser - Added 'default: eyes' to reaction field in main_workflow_schema.json - Added isValidReaction() helper function to validate reaction values - Added validation when parsing reaction field to reject invalid values - Added TestInvalidReactionValue test to verify validation works correctly This ensures that invalid reaction values are caught early with helpful error messages, and documents the default behavior in the schema.
pelikhan
reviewed
Oct 23, 2025
pkg/workflow/compiler.go
Outdated
| } | ||
|
|
||
| // isValidReaction checks if a reaction value is valid according to the schema | ||
| func isValidReaction(reaction string) bool { |
Contributor
) * Initial plan * Remove .serena directory and move isValidReaction to reactions.go Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
pelikhan
reviewed
Oct 23, 2025
pkg/workflow/compiler.go
Outdated
| if reactionStr, ok := reactionValue.(string); ok { | ||
| // Validate reaction value | ||
| if !isValidReaction(reactionStr) { | ||
| validValues := []string{"+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", "eyes"} |
Contributor
There was a problem hiding this comment.
@copilot add function in reactions.go to get the list of valid entries, computed from the keys of validReactions
Contributor
…ally (#2244) * Initial plan * Add getValidReactions function to compute valid reaction list from validReactions map Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.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.
Q Workflow Optimization Report
Summary
This pull request addresses the request from
@pelikhanto add a default "eyes" value to the reaction field in the schema and implement reaction value validation in the parser.Changes Made
1. Schema Enhancement (pkg/parser/schemas/main_workflow_schema.json)
"default": "eyes"to thereactionfield in the JSON schema2. Parser Validation (pkg/workflow/compiler.go)
isValidReaction()helper function to validate reaction values against the allowed set+1,-1,laugh,confused,heart,hooray,rocket,eyesparseOnSection()to check reaction values when parsing3. Test Coverage (pkg/workflow/compiler_test.go)
TestInvalidReactionValuetest to verify that:Benefits
Example Error Message
Before this change, an invalid reaction value would be silently ignored or cause unexpected behavior.
After this change:
Testing
All changes have been tested with:
TestInvalidReactionValueverifying validation works correctlyValidation
✅ Schema changes are minimal and surgical
✅ Validation logic matches the schema enum values exactly
✅ Error messages are user-friendly and informative
✅ Test coverage ensures the feature works as expected
Notes