Skip to content

Reject unused top-level command in main workflow frontmatter schema#31750

Merged
pelikhan merged 2 commits into
mainfrom
copilot/remove-unused-command-schema-field
May 12, 2026
Merged

Reject unused top-level command in main workflow frontmatter schema#31750
pelikhan merged 2 commits into
mainfrom
copilot/remove-unused-command-schema-field

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 12, 2026

Bug Fix

A top-level command field was accepted by schema validation but ignored by compilation, creating a silent misconfiguration path. This change aligns schema behavior with actual parser/compiler semantics (on.slash_command / deprecated on.command under on).

What was the bug?

  • Top-level command was defined in pkg/parser/schemas/main_workflow_schema.json but not consumed anywhere in frontmatter extraction.
  • Workflows using:
    command: my-cmd
    could validate successfully while never triggering as intended.

How did you fix it?

  • Schema alignment
    • Removed top-level command from /pkg/parser/schemas/main_workflow_schema.json.
  • Regression coverage
    • Added TestValidateMainWorkflowFrontmatterWithSchemaAndLocation_RejectsTopLevelCommand in /pkg/parser/schema_location_test.go to enforce rejection of command at the top level.

Testing

  • Added targeted validation coverage for the rejected shape:
frontmatter := map[string]any{
  "on":      "push",
  "command": "my-cmd",
}
err := ValidateMainWorkflowFrontmatterWithSchemaAndLocation(frontmatter, "/test/workflow.md")
// expects: Unknown property: command

Copilot AI changed the title [WIP] Remove unused top-level command schema field Reject unused top-level command in main workflow frontmatter schema May 12, 2026
@pelikhan pelikhan marked this pull request as ready for review May 12, 2026 17:04
Copilot AI review requested due to automatic review settings May 12, 2026 17:04
@pelikhan pelikhan merged commit c82cefa into main May 12, 2026
@pelikhan pelikhan deleted the copilot/remove-unused-command-schema-field branch May 12, 2026 17:04
Copilot stopped work on behalf of pelikhan due to an error May 12, 2026 17:04
Copilot AI requested a review from pelikhan May 12, 2026 17:04
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a schema/compiler mismatch where a top-level command field could pass JSON schema validation but be ignored at compile time, creating a silent misconfiguration. It aligns the main workflow frontmatter schema with the actual trigger semantics (on.slash_command / deprecated on.command) and adds a regression test to prevent reintroducing the issue.

Changes:

  • Removed the top-level command property from pkg/parser/schemas/main_workflow_schema.json so it is rejected as an unknown field.
  • Added a unit test asserting schema validation rejects top-level command with an “Unknown property” error.
  • Minor formatting-only changes in a JSON data file and Go test file.
Show a summary per file
File Description
pkg/workflow/data/ecosystem_domains.json Formatting-only change to the gh-aw domain list (single-line array).
pkg/parser/schemas/main_workflow_schema.json Removes top-level command from schema properties to ensure validation rejects it.
pkg/parser/schema_location_test.go Adds regression test verifying top-level command is rejected during schema validation.
pkg/cli/init_test.go Formatting-only (gofmt-style indentation) changes in tests.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 3/4 changed files
  • Comments generated: 0

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.

[deep-report] Remove unused top-level command schema field (silent acceptance bug)

3 participants