-
Notifications
You must be signed in to change notification settings - Fork 36
Document strict mode enforcement areas and CLI flag in schema #4232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f1bdc4c
Initial plan
Copilot b149ca2
Document strict mode comprehensively in JSON schema and CLI help
Copilot 45e1425
Add test to verify strict mode schema documentation completeness
Copilot 680143c
Merge branch 'main' into copilot/document-cli-strict-mode
pelikhan 6dfdb00
Fix Go formatting in schema_strict_documentation_test.go
Copilot 976862c
Merge branch 'main' into copilot/document-cli-strict-mode
pelikhan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| package parser | ||
|
|
||
| import ( | ||
| "encoding/json" | ||
| "os" | ||
| "strings" | ||
| "testing" | ||
| ) | ||
|
|
||
| // TestStrictFieldSchemaDocumentation verifies that the strict field in the schema | ||
| // contains comprehensive documentation about all enforcement areas and CLI usage | ||
| func TestStrictFieldSchemaDocumentation(t *testing.T) { | ||
| // Read the main workflow schema | ||
| schemaPath := "schemas/main_workflow_schema.json" | ||
| schemaContent, err := os.ReadFile(schemaPath) | ||
| if err != nil { | ||
| t.Fatalf("Failed to read schema file: %v", err) | ||
| } | ||
|
|
||
| // Parse the schema | ||
| var schema map[string]interface{} | ||
| if err := json.Unmarshal(schemaContent, &schema); err != nil { | ||
| t.Fatalf("Failed to parse schema JSON: %v", err) | ||
| } | ||
|
|
||
| // Get the properties section | ||
| properties, ok := schema["properties"].(map[string]interface{}) | ||
| if !ok { | ||
| t.Fatal("Schema properties section not found or invalid") | ||
| } | ||
|
|
||
| // Get the strict field | ||
| strictField, ok := properties["strict"].(map[string]interface{}) | ||
| if !ok { | ||
| t.Fatal("Strict field not found in schema properties") | ||
| } | ||
|
|
||
| // Get the description | ||
| description, ok := strictField["description"].(string) | ||
| if !ok { | ||
| t.Fatal("Strict field description not found or not a string") | ||
| } | ||
|
|
||
| // Verify that description contains key elements | ||
| requiredElements := []string{ | ||
| "Write Permissions", | ||
| "Network Configuration", | ||
| "Action Pinning", | ||
| "MCP Network", | ||
| "Deprecated Fields", | ||
| "gh aw compile --strict", | ||
| "CLI flag takes precedence", | ||
| "safe-outputs", | ||
| } | ||
|
|
||
| for _, element := range requiredElements { | ||
| if !strings.Contains(description, element) { | ||
| t.Errorf("Strict field description missing required element: %q\nDescription: %s", element, description) | ||
| } | ||
| } | ||
|
|
||
| // Verify description contains documentation link | ||
| if !strings.Contains(description, "https://") { | ||
| t.Error("Strict field description should contain a documentation link") | ||
| } | ||
|
|
||
| // Verify type is boolean | ||
| fieldType, ok := strictField["type"].(string) | ||
| if !ok || fieldType != "boolean" { | ||
| t.Errorf("Strict field type should be 'boolean', got: %v", fieldType) | ||
| } | ||
|
|
||
| t.Logf("✓ Strict field description is comprehensive (%d chars)", len(description)) | ||
| } |
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.