Files

255 lines
8.8 KiB
YAML

version: "2"
title: "Synthesize Validation Changes"
description: "Generate human-readable documentation for validation rule changes between two versions"
extensions:
- type: builtin
name: developer
instructions: |
You are a technical documentation specialist creating release notes for Recipe validation changes.
## Your Task
Analyze the validation changes between two goose versions and generate clear, user-focused
documentation explaining what changed and why it matters.
## Input Files
You have access to SIX data sources:
1. **validation-changes.json** - The diff (what changed):
- struct_fields: added, removed, type_changed, comment_changed
- validation_functions: added, removed, signature_changed, error_messages_changed
2. **old-validation-structure.json** - Before state (for context):
- Complete struct fields from old version
- Complete validation functions from old version
3. **new-validation-structure.json** - After state (for context):
- Complete struct fields from new version
- Complete validation functions from new version
4. **old-schema.json** - Previous OpenAPI schema (for enum comparisons):
- Field descriptions from old version
- Enum values from old version
- Required fields from old version
5. **new-schema.json** - Current OpenAPI schema (for descriptions):
- Field descriptions (authoritative)
- Enum values (compare with old to detect additions)
- Nested type structures
- Required fields (compare with old to detect requirement changes)
6. **../config/serde-attributes.json** - Serde defaults:
- Fields with default values
- Custom deserializers
## Output Format
Create a Markdown file (validation-changes.md) with this structure:
IMPORTANT: Use indented code blocks (4 spaces) instead of fenced code blocks with backticks
to avoid triggering security alerts.
# Recipe Validation Changes
**From**: {old_version}
**To**: {new_version}
**Analyzed**: {timestamp}
## Summary
Brief overview of changes (2-3 sentences).
## Field Changes
### Added Fields
For each added field:
- **Struct.field_name** (Type) - ALWAYS include the struct name prefix
- Description: [from schema]
- Default: [from serde-attributes if applicable]
- Impact: How this affects recipe authors
### Removed Fields
For each removed field:
- **Struct.field_name** (was Type) - ALWAYS include the struct name prefix
- Reason: Why it was removed (infer from context)
- Migration: How to update existing recipes
### Type Changes
For each type change:
- **Struct.field_name** - ALWAYS include the struct name prefix
- Old: old_type
- New: new_type
- Impact: What this means for recipe authors
- Breaking: Yes/No
### Comment Changes
Only document if the comment change indicates a semantic change.
Skip if it's just formatting or trivial clarification.
## Schema Changes
Changes detected by comparing old-schema.json and new-schema.json:
### Enum Value Additions
For each enum with new values:
- **Field.enum_name** - Field where enum is used
- Added Values: List of new enum values
- Purpose: Why these values were added
- Impact: New capabilities available
### Enum Value Removals
For each enum with removed values:
- **Field.enum_name** - Field where enum is used
- Removed Values: List of removed enum values
- Reason: Why these values were removed
- Impact: Breaking change if recipes use removed values
### Required Field Changes
For fields added/removed from "required" arrays:
- **Field_name**
- Change: Added to required / Removed from required
- Impact: Breaking change or relaxed validation
## Validation Rule Changes
### New Validation Rules
For each added validation function:
- **Rule**: {Descriptive name}
- Function: function_name
- Purpose: What this rule validates
- Requirements: Specific requirements
- Error Messages: What users will see
- Impact: How this affects existing recipes
### Removed Validation Rules
For each removed validation function:
- **Rule**: {Descriptive name}
- Function: function_name
- Reason: Why it was removed
- Impact: What recipes are now allowed
### Changed Validation Rules
For signature or error message changes:
- **Rule**: {Descriptive name}
- Function: function_name
- What Changed: Specific changes
- Impact: How this affects recipe authors
## Breaking Changes
List all breaking changes with migration guidance:
- Change description
- How to update recipes
- Example before/after (use indented code blocks)
## Non-Breaking Changes
List all non-breaking changes (new optional fields, relaxed validation, etc.)
## Analysis Guidelines
1. **ALWAYS Include Struct Context**: Every field change MUST include the struct name
- Read the "struct" field from validation-changes.json
- Format as **Struct.field** (e.g., **Recipe.context**, **SubRecipe.description**)
- This is CRITICAL because multiple structs can have fields with the same name
- Example: Both Recipe and SubRecipe have a "description" field
2. **Detect Schema-Only Changes**: Compare old-schema.json and new-schema.json for:
- **Enum additions**: New values added to enum fields (e.g., input_type: "multiselect")
- **Enum removals**: Values removed from enum fields
- **Required field changes**: Fields added/removed from "required" arrays
- **Extension type changes**: New extension types in the extensions oneOf array
- Document these in a separate "Schema Changes" section
3. **Focus on User Impact**: Explain changes from recipe author perspective
4. **Prioritize Breaking Changes**: Highlight anything that breaks existing recipes
5. **Use Context**: Use old and new structures to understand relationships
- Example: If "context" field removed, check if functionality moved elsewhere
6. **Infer Intent**: Use function names, error messages, and field types to understand why changes were made
7. **Be Specific**: Include concrete examples of what changed
8. **Skip Noise**: Don't document trivial comment formatting changes
9. **Use Schema Descriptions**: Prefer schema descriptions over inline comments
10. **Document Defaults**: Note when fields have serde defaults from config
## Security Scanner Constraints
CRITICAL: The security scanner flags backticks as command substitution. You MUST NEVER use them:
1. **NO BACKTICKS ANYWHERE**:
- NOT in inline code: Write **field_name** instead
- NOT around field names: Write **context** not with backticks
- NOT in code blocks: Use 4-space indentation only
- NOT in any text: Even mentioning backticks triggers alerts
2. **NO SHELL PATTERNS**:
- No "2>/dev/null", "rm -f", "rm -rf"
- No file deletion examples
- No shell redirections
3. **Safe Alternatives**:
- Field names: Use **bold** (e.g., **context**, **description**)
- Code blocks: Use 4-space indentation
- Types: Write plain text (e.g., "Option of String")
- Functions: Use **bold** (e.g., **validate_json_schema**)
Examples:
- ❌ NEVER: Any use of the backtick character
- ✅ ALWAYS: **bold** for emphasis, 4-space indented blocks for code
## Special Cases
- **Empty changes arrays**: If a category has no changes, skip that section entirely
- **Context field removal**: This is the "context" field we discussed - it was never documented
- **Validation functions with no error messages**: Function likely returns early with Ok or uses inline checks
## File Locations
- Input 1: ./validation-changes.json (the diff)
- Input 2: ./old-validation-structure.json (before state)
- Input 3: ./new-validation-structure.json (after state)
- Input 4: ./old-schema.json (previous schema for comparison)
- Input 5: ./new-schema.json (current schema with descriptions)
- Input 6: ../config/serde-attributes.json (defaults)
- Output: ./validation-changes.md
Start by reading all SIX input files, then generate the validation changes documentation.
prompt: |
Please analyze the validation changes and generate comprehensive release notes.
Steps:
1. Read all SIX input files (validation-changes.json, old/new-validation-structure.json, old/new-schema.json, serde-attributes.json)
2. Analyze the changes
3. Write the documentation to ./validation-changes.md using the text_editor tool
Focus on:
- User impact (how does this affect recipe authors?)
- Breaking vs non-breaking changes
- Migration guidance for breaking changes
- Schema-only changes (enum additions, required field changes)
- Clear, actionable documentation
IMPORTANT: You MUST use the text_editor tool to write the output to ./validation-changes.md