Skip to content

schema: allow required-category in safe-outputs.create-discussion and add regression coverage#39640

Merged
pelikhan merged 3 commits into
mainfrom
copilot/deep-report-add-required-category
Jun 16, 2026
Merged

schema: allow required-category in safe-outputs.create-discussion and add regression coverage#39640
pelikhan merged 3 commits into
mainfrom
copilot/deep-report-add-required-category

Conversation

Copilot AI commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

CreateDiscussionsConfig supports required-category, but the create-discussion schema branch did not declare it while enforcing additionalProperties: false. That caused valid configs using close-older-discussions + required-category to fail strict validation.

  • Schema alignment

    • Updated /home/runner/work/gh-aw/gh-aw/pkg/parser/schemas/main_workflow_schema.json to include required-category in safe-outputs.create-discussion.properties.
    • Kept it grouped with the close-older-* controls it influences.
  • Schema examples

    • Extended create-discussion.examples to show required-category used with close-older-discussions, so editor/schema consumers surface the intended pairing.
  • Regression coverage

    • Added TestMainWorkflowSchema_CreateDiscussionRequiredCategoryAllowed in /home/runner/work/gh-aw/gh-aw/pkg/parser/schema_test.go to assert this config validates successfully.
safe-outputs:
  create-discussion:
    category: reports
    close-older-discussions: true
    required-category: reports

@github-actions

Copy link
Copy Markdown
Contributor

Hey @Copilot 👋 — thanks for picking up this schema consistency fix! Aligning required-category under the create-discussion branch in main_workflow_schema.json is a clean, well-scoped change and the issue writeup gives strong context to work from.

This PR is still a [WIP] draft with no files changed yet, so a couple of things to keep in mind before it's ready for review:

  • Add the schema changepkg/parser/schemas/main_workflow_schema.json needs required-category (string) added to the create-discussion object branch (around line 5621), matching the pattern already used under close-discussion (~line 5808). The schema must remain additionalProperties: false.
  • Add or update tests — once the schema is updated, a test that validates a create-discussion config containing required-category should be added (or updated if one already exists) to confirm strict schema validation passes.
  • Update the PR description — replace the placeholder opening with a concrete summary of what was changed and why, so reviewers have a quick orientation.

If you need a nudge on the implementation, here's a ready-to-use prompt:

Fix the schema inconsistency described in issue #39598:
1. Open pkg/parser/schemas/main_workflow_schema.json.
2. Locate the `create-discussion` object branch (around line 5621, additionalProperties: false).
3. Add a `required-category` property (type: string) to that branch, mirroring the definition already present under the `close-discussion` branch (~line 5808).
4. Add or update a test (likely in pkg/parser/ or a schema validation test file) that exercises a `create-discussion` config with `required-category` set and asserts it passes strict schema validation.
5. Update the PR body with a short summary of what was changed and why.

Generated by ✅ Contribution Check ·

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add required-category to create-discussion schema schema: add required-category to create-discussion branch Jun 16, 2026
Copilot AI requested a review from pelikhan June 16, 2026 18:45
@pelikhan pelikhan marked this pull request as ready for review June 16, 2026 20:12
Copilot AI review requested due to automatic review settings June 16, 2026 20:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-discussion schema to accept required-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

@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

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.

@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

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.

@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

@github-actions github-actions Bot mentioned this pull request Jun 16, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-discussion examples block does not demonstrate required-category; close-discussion already has one. A short addition would close the documentation gap.

Positive Highlights

  • ✅ Correct placement — new field is positioned adjacent to close-older-key and the other close-older-* fields, making the grouping clear.
  • ✅ Description is precise — explains both what the field does and when it applies (close-older-discussions being 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": {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@pelikhan

Copy link
Copy Markdown
Collaborator

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title schema: add required-category to create-discussion branch schema: allow required-category in safe-outputs.create-discussion and add regression coverage Jun 16, 2026
@pelikhan pelikhan merged commit 46f9688 into main Jun 16, 2026
36 checks passed
@pelikhan pelikhan deleted the copilot/deep-report-add-required-category branch June 16, 2026 22:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants