Implement randomized schema test#227
Merged
Merged
Conversation
Benchmark ResultBenchmark diff with base branchBenchmark result |
8436946 to
512a35d
Compare
002bfaa to
b1c3718
Compare
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR implements a randomized schema testing framework that generates random STEF schemas and validates the code generation pipeline. It also fixes several bugs discovered during the implementation.
- Adds a new
TestRandomizedSchematest that generates random schemas using a configurable seed for reproducibility - Fixes template logic for handling enum types in arrays and multimap SetKey methods
- Adds schema pretty-printing functionality to help debug failing test cases
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| stefc/templates/go/multimap.go.tmpl | Fixes conditional logic for generating SetKey method based on primitive types |
| stefc/templates/go/array.go.tmpl | Adds enum support in CopyFromSlice and fixes storage type conversion in mutateRandom |
| stefc/generator/testdata/enum_array.stef | Adds test data file for enum array functionality |
| stefc/generator/generator_test.go | Implements randomized schema generator and test infrastructure |
| stefc/generator/compileschema.go | Improves type resolution for arrays and adds enum validation |
| go/pkg/schema/schema_prettyprint_test.go | Adds comprehensive tests for schema pretty-printing functionality |
| go/pkg/schema/schema.go | Implements PrettyPrint method for converting schemas back to SDL format |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
b1c3718 to
3dec842
Compare
maheshkanote
approved these changes
Oct 11, 2025
Collaborator
maheshkanote
left a comment
There was a problem hiding this comment.
@tigrannajaryan this is interesting way of verifying the stef schemas.
8ad734c to
7fbd9a1
Compare
Resolves #183 This adds a new TestRandomizedSchema that generates a schema using random number generator, then compiles and runs the tests for the schema. The new test revealed a number of bugs. I fixed a few of the smaller ones. There are more bugs, but I don't want to overload this PR. For now TestRandomizedSchema does not fail the build when it finds a buggy schema, but merely logs it. After this PR is merged I will fix every failing schema one by one.
7fbd9a1 to
21a9929
Compare
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.
Resolves #183
This adds a new TestRandomizedSchema that generates a schema using random number generator, then compiles and runs the tests for the schema.
The new test revealed a number of bugs. I fixed a few of the smaller ones. There are more bugs but I don't want to overload this PR. For now TestRandomizedSchema does not fail the build when it finds a buggy schema, but merely logs it. After this PR is merged I will fix every failing schema one by one.