schema: allow required-category in safe-outputs.create-discussion and add regression coverage#39640
Conversation
|
Hey This PR is still a
If you need a nudge on the implementation, here's a ready-to-use prompt:
|
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
required-category to create-discussion branch
There was a problem hiding this comment.
Pull request overview
This pull request fixes strict schema validation for safe-outputs.create-discussion by adding the missing required-category property to the create-discussion schema branch (which has additionalProperties: false). This aligns the JSON schema with CreateDiscussionsConfig, enabling workflows to configure category filtering when close-older-discussions is enabled.
Changes:
- Extend
safe-outputs.create-discussionschema to acceptrequired-category: <string>. - Document the field inline in the schema with a description matching its close-older-discussions filtering behavior.
Show a summary per file
| File | Description |
|---|---|
| pkg/parser/schemas/main_workflow_schema.json | Adds required-category to create-discussion properties so strict validation permits the config used by close-older-discussions filtering. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 0
|
✅ Test Quality Sentinel completed test quality analysis. No test files were added or modified in this PR. The only changed file is pkg/parser/schemas/main_workflow_schema.json (4 additions, 0 deletions — a JSON schema update). Test Quality Sentinel skipped. |
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. No ADR enforcement needed: PR #39640 does not have the 'implementation' label and has only 4 new lines of code in business logic directories (threshold is 100). Neither Condition A nor Condition B is met. |
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅ |
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /tdd, /diagnose, and /grill-with-docs — approving. The fix is correct and surgical; two minor follow-ups suggested.
📋 Key Themes & Highlights
Key Themes
- Missing regression test: The fix is not covered by a schema-validation test. Given
additionalProperties: false, this field could silently disappear again in a future schema regeneration pass and nothing would catch it until a user hit the validation error. - Missing example: The
create-discussionexamples block does not demonstraterequired-category;close-discussionalready has one. A short addition would close the documentation gap.
Positive Highlights
- ✅ Correct placement — new field is positioned adjacent to
close-older-keyand the otherclose-older-*fields, making the grouping clear. - ✅ Description is precise — explains both what the field does and when it applies (
close-older-discussionsbeing enabled). - ✅ Minimal change — 4 lines, zero deletions, no logic touched. Exactly the right scope for a schema bug fix.
- ✅ Consistent with
close-discussion.required-category— type declaration mirrors the twin field in the sibling branch.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer
| "minLength": 1, | ||
| "pattern": "\\S" | ||
| }, | ||
| "required-category": { |
There was a problem hiding this comment.
[/tdd] This bug fix lacks a regression test — the same copy-omission could silently re-appear.
💡 Suggested test
A targeted schema-validation test (similar to safe_outputs_error_location_test.go) would anchor the fix:
{
name: "create-discussion with required-category is valid",
yamlContent: `on: daily
safe-outputs:
create-discussion:
category: Ideas
close-older-discussions: true
required-category: Ideas`,
expectValid: true,
description: "required-category must be accepted in create-discussion branch",
},Without it, the field could be silently dropped from the schema again (e.g., during a bulk property-list regeneration) and no test would catch it.
There was a problem hiding this comment.
Added a regression test in /home/runner/work/gh-aw/gh-aw/pkg/parser/schema_test.go (TestMainWorkflowSchema_CreateDiscussionRequiredCategoryAllowed) that validates safe-outputs.create-discussion.required-category passes strict schema validation with close-older-discussions: true.
| }, | ||
| "required-category": { | ||
| "type": "string", | ||
| "description": "Required category for matching when close-older-discussions is enabled. Only discussions in this category will be considered when searching for older discussions to close." |
There was a problem hiding this comment.
[/grill-with-docs] The examples array for create-discussion (further down in the file) does not include a required-category usage example, even though close-discussion already has one (required-category: "Ideas"). A short example alongside close-older-discussions: true would make the intended pairing obvious to users.
💡 Suggested addition to examples
{
"title-prefix": "[weekly-report] ",
"category": "Ideas",
"close-older-discussions": true,
"required-category": "Ideas"
}This directly mirrors the motivating use-case from the PR description and helps schema-aware editors surface the field when close-older-discussions is set.
There was a problem hiding this comment.
Added the requested example in /home/runner/work/gh-aw/gh-aw/pkg/parser/schemas/main_workflow_schema.json under create-discussion.examples to show required-category alongside close-older-discussions: true.
|
@copilot run pr-finisher skill |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
required-category to create-discussion branchrequired-category in safe-outputs.create-discussion and add regression coverage
CreateDiscussionsConfigsupportsrequired-category, but thecreate-discussionschema branch did not declare it while enforcingadditionalProperties: false. That caused valid configs usingclose-older-discussions+required-categoryto fail strict validation.Schema alignment
/home/runner/work/gh-aw/gh-aw/pkg/parser/schemas/main_workflow_schema.jsonto includerequired-categoryinsafe-outputs.create-discussion.properties.close-older-*controls it influences.Schema examples
create-discussion.examplesto showrequired-categoryused withclose-older-discussions, so editor/schema consumers surface the intended pairing.Regression coverage
TestMainWorkflowSchema_CreateDiscussionRequiredCategoryAllowedin/home/runner/work/gh-aw/gh-aw/pkg/parser/schema_test.goto assert this config validates successfully.