Add regression test confirming top-level roles: is rejected by schema validation - #56981
Merged
Merged
Conversation
3 tasks
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix top-level roles field being ignored in frontmatter
Add regression test confirming top-level Aug 29, 2026
roles: is rejected by schema validation
pelikhan
marked this pull request as ready for review
August 29, 2026 22:07
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused test accurately covers the reported validation behavior and expected diagnostic.
Pull request overview
Adds regression coverage confirming misplaced top-level roles configuration is rejected before workflow compilation proceeds.
Changes:
- Tests schema rejection of top-level
roles. - Verifies guidance points users to
on.roles.
File summaries
| File | Description |
|---|---|
pkg/parser/schema_location_test.go |
Adds the schema-validation regression case. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Contributor
|
🎉 This pull request is included in a new release. Release: |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Top-level
roles:was believed to be silently ignored byextractRoles(), falling back to default roles[admin, maintainer, write]with no warning — a risky gap if an author expected it to restrict access.Investigation showed this is already handled correctly end-to-end: schema validation (
additionalProperties: falseat the top level,rolesonly defined underon) rejects a top-levelroles:field beforeextractRoles()is ever invoked, producingUnknown property: roles ... 'roles' belongs under 'on'. Docs already documentroles:exclusively underon:. The only real gap was test coverage at the validation/compile level (existing tests only covered the low-levelextractRoles()fallback behavior, not that the field is actually rejected upfront).TestValidateMainWorkflowFrontmatterWithSchemaAndLocation_AdditionalPropertiesinpkg/parser/schema_location_test.goasserting that a top-levelroles:field fails schema validation with the message'roles' belongs under 'on'.No production code changes were required — the described behavior was already fixed by existing schema validation.