chore: enforce tidy/manifests checks in test CI#1888
Conversation
|
Caution Review failedPull request was closed or merged during review WalkthroughThe changes implement automated schema generation for ConfigChangeDetail variants by introducing a new Go generator program, refactoring the schema output process to use generated JSON with embedded examples, adding GitHub Actions verification workflow, and exporting internal types for public use in schema generation. Changes
Sequence Diagram(s)sequenceDiagram
participant Dev as Developer
participant Make as Build System
participant Gen as Schema Generator
participant Types as Type System
participant Schema as Schema Output
participant CI as GitHub Actions
Dev->>Make: Execute `make manifests`
Make->>Gen: Run hack/generate-schemas
Gen->>Types: Read ConfigChangeDetailTypes<br/>& ConfigChangeExamples
Types-->>Gen: Return all variants with examples
Gen->>Gen: Reflect types to JSON Schema<br/>Build discriminator oneOf<br/>Inject kind properties
Gen->>Schema: Write change-types.schema.json
Schema-->>Gen: Success
Dev->>Dev: Commit changes
Dev->>CI: Push to main/open PR
CI->>Make: Run `go mod tidy`
Make-->>CI: Verify go.mod/go.sum clean
CI->>Make: Run `make manifests`
Make->>Gen: Generate schemas
Gen->>Schema: Output schema
CI->>CI: Check git diff --exit-code
alt Changes detected
CI-->>Dev: ❌ Workflow fails:<br/>Re-run make manifests locally
else No changes
CI-->>Dev: ✅ Verification passed
end
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Benchstat (RLS)Base: 📊 8 minor regression(s) (all within 5% threshold)
✅ 3 improvement(s)
Full benchstat output |
Benchstat (Other)Base: ✅ 1 improvement(s)
Full benchstat output |
|
264e5f9 to
1fabac2
Compare
…f handwritten Replace handwritten change-types schema with automated generation via reflection and post-processing. This ensures the schema stays in sync with ConfigChangeDetail variants and their examples. Changes: - Add hack/generate-schemas/change_types.go with schema generation logic that reflects the changeDetailsEnvelope, injects kind discriminators, and produces a stable JSON output - Add hack/generate-schemas/change_types_test.go with comprehensive tests for schema generation - Add types/config_changes_examples.go with representative examples for all ConfigChangeDetail variants - Export ConfigChangeDetailTypes and ConfigChangeExamples for use by the schema generator - Update main.go to call generateChangeTypesSchema instead of copying handwritten schema - Regenerate schema/openapi/change-types.schema.json with new examples and stable key ordering - Add Taskfile.yaml with test:migrate and test:bench tasks for local development - Update .gitignore to exclude generated binaries The generated schema now includes per-variant examples and maintains deterministic output across runs.
…ustom comment sources Refactor schema generation to support loading Go doc comments from a different package than the reflected object. This enables code generators and similar tools in main packages to produce schemas with comments from library packages. Introduces GenerateSchemaWithCommentsFrom() as the new public API while keeping GenerateSchema() as a convenience wrapper. The internal generateSchema() function now handles both cases via a commentsFrom parameter. Also fixes embed directive in openapi.go to be more specific (*.json instead of *).
01935f1 to
ba94348
Compare
Summary by CodeRabbit
New Features
Improvements
Chores