fix: add missing target/target-repo/allowed-repos to safe output schemas#36636
Conversation
The JSON schema for several safe output types was missing properties that the Go code (SafeOutputTargetConfig) and CJS runtime already supported, causing 'Unknown properties' validation errors at compile time. Fixed safe outputs: - resolve-pull-request-review-thread: added target, target-repo, allowed-repos - assign-milestone: added target, allowed-repos - hide-comment: added target, allowed-repos - link-sub-issue: added target, allowed-repos - close-discussion: added allowed-repos - close-pull-request: added allowed-repos - update-discussion: added allowed-repos - update-pull-request: added allowed-repos - mark-pull-request-as-ready-for-review: added allowed-repos - add-reviewer: added allowed-repos - assign-to-agent: added allowed-repos Added comprehensive schema validation test that exercises target, target-repo, and allowed-repos for all 25 safe output types that embed SafeOutputTargetConfig, plus negative tests confirming unknown properties are still rejected.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Pull request overview
This PR fixes JSON schema drift for several safe-outputs configurations by adding missing target, target-repo, and/or allowed-repos properties that the Go workflow compiler/runtime already supports, preventing compile-time "Unknown properties" validation errors for otherwise-valid workflows.
Changes:
- Extend
pkg/parser/schemas/main_workflow_schema.jsonto includetarget/target-repo/allowed-reposon the affected safe output schemas (while keepingadditionalProperties: falsebehavior). - Add unit tests to ensure safe outputs that support these fields are accepted by schema validation and that unknown fields are still rejected.
Show a summary per file
| File | Description |
|---|---|
| pkg/parser/schemas/main_workflow_schema.json | Adds missing target-related properties to multiple safe-output schema definitions to align with existing Go/runtime support. |
| pkg/parser/schema_safe_outputs_target_test.go | Adds regression tests ensuring schemas accept target / target-repo / allowed-repos where supported and still reject unknown fields. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 2
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
|
✅ smoke-ci: safeoutputs CLI comment + comment-memory run (26886641653)
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅ |
|
|
|
🧪 Test Quality Sentinel completed test quality analysis. |
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. |
🧪 Test Quality Sentinel Report✅ Test Quality Score: 80/100 — Excellent
📊 Metrics & Test Classification (2 tests analyzed)
Test Classification Details
Language SupportTests analyzed:
Verdict
📖 Understanding Test ClassificationsDesign Tests (High Value) verify what the system does:
Implementation Tests (Low Value) verify how the system does it:
Goal: Shift toward tests that describe the system's behavioral contract — the promises it makes to its users and collaborators.
|
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /diagnose and /tdd — approving. Root cause is properly addressed (schema–implementation drift), fix is additive with low regression risk, and a purpose-built regression test suite accompanies the change.
📋 Key Themes & Highlights
Key Themes
- Root cause fixed, not just symptom: The
target/target-repo/allowed-reposfields were already supported bySafeOutputTargetConfigin Go and the CJS runtime; adding them to the JSON schema is the correct fix. - Comprehensive positive coverage: All 25 affected safe output types get regression tests — any future schema drift will be caught immediately.
- Minor gap in negative tests: The
additionalProperties: falseguard is only verified for 4 of 25 types (see inline comment). add-commenttest slightly under-specified: Onlytargetis tested;target-repoandallowed-reposare schema-supported but not exercised (see inline comment).
Positive Highlights
- ✅
t.Parallel()throughout — fast test execution - ✅ Clear comment header explaining the regression scenario and why the test exists
- ✅ Both positive and negative test functions in the same file — easy to find
- ✅ Schema changes are surgical and well-described
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 1.4M
| { | ||
| name: "update-issue with target and target-repo", | ||
| safeOutputs: map[string]any{ | ||
| "update-issue": map[string]any{ |
There was a problem hiding this comment.
[/tdd] The add-comment test only exercises target, but the schema also defines target-repo and allowed-repos for this type. Extending the test case to include all three fields would give full parity with the other 24 entries and close a small coverage gap.
💡 Suggested extension
{
name: "add-comment with target, target-repo, and allowed-repos",
safeOutputs: map[string]any{
"add-comment": map[string]any{
"max": 5,
"target": "*",
"target-repo": "github/github",
"allowed-repos": []any{"github/docs"},
},
},
},This also serves as a live spec that add-comment supports cross-repo targeting.
| } | ||
| }) | ||
| } | ||
| } |
There was a problem hiding this comment.
[/tdd] The negative-property test (TestMainWorkflowSchema_SafeOutputsRejectsUnknownProperties) only covers 4 of the 25 types exercised in the positive test. While sampling is pragmatic, the 4 chosen types (resolve-pull-request-review-thread, assign-milestone, hide-comment, link-sub-issue) are a bit arbitrary. Consider adding a few more from distinct schema shapes (e.g. add-comment, push-to-pull-request-branch) to increase confidence that additionalProperties: false holds broadly.
💡 Why this matters
Schema definitions are hand-edited JSON, so it's easy to accidentally omit "additionalProperties": false when adding new property blocks. A broader sample catches that class of drift early.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
🏗️ Design Decision Gate — ADR RequiredThis PR adds 469 new lines in business-logic directories ( 📄 Draft ADR committed:
📋 What to do next
Once an ADR is linked in the PR body, this gate will re-run and verify the implementation matches the decision. ❓ Why ADRs MatterThis change closes a drift between the JSON schema and the Go/CJS runtime — exactly the kind of "why does the schema look this way?" decision future contributors will want recorded. ADRs create a searchable, permanent record of why the codebase looks the way it does. 📋 Michael Nygard ADR Format ReferenceAn ADR must contain these four sections to be considered complete:
ADRs are stored in
|
…mas (#36636) * fix: add missing target/target-repo/allowed-repos to safe output schemas The JSON schema for several safe output types was missing properties that the Go code (SafeOutputTargetConfig) and CJS runtime already supported, causing 'Unknown properties' validation errors at compile time. Fixed safe outputs: - resolve-pull-request-review-thread: added target, target-repo, allowed-repos - assign-milestone: added target, allowed-repos - hide-comment: added target, allowed-repos - link-sub-issue: added target, allowed-repos - close-discussion: added allowed-repos - close-pull-request: added allowed-repos - update-discussion: added allowed-repos - update-pull-request: added allowed-repos - mark-pull-request-as-ready-for-review: added allowed-repos - add-reviewer: added allowed-repos - assign-to-agent: added allowed-repos Added comprehensive schema validation test that exercises target, target-repo, and allowed-repos for all 25 safe output types that embed SafeOutputTargetConfig, plus negative tests confirming unknown properties are still rejected. * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * docs(adr): add draft ADR-36636 for safe-output schema sync Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Co-authored-by: Peli de Halleux <pelikhan@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Summary
Adds missing
target,target-repo, andallowed-reposproperties to the safe-output JSON schema entries that already support them at the Go and CJS runtime layer. Before this fix, valid cross-repository configurations (e.g.target: "*",target-repo: owner/repo) were rejected at compile time withUnknown propertieserrors because the schema declaredadditionalProperties: falsebut omitted those fields.Changes
pkg/parser/schemas/main_workflow_schema.jsonAdded missing schema properties to the following safe output types:
resolve-pull-request-review-threadtarget,target-repo,allowed-reposassign-milestonetarget,allowed-reposhide-commenttarget,allowed-reposlink-sub-issuetarget,allowed-reposclose-discussionallowed-reposupdate-discussionallowed-reposclose-pull-requestallowed-reposmark-pull-request-as-ready-for-reviewallowed-reposadd-reviewerallowed-reposassign-to-agentallowed-reposupdate-pull-requestallowed-reposAlso updated the
resolve-pull-request-review-threaddescription to document cross-repository support.pkg/parser/schema_safe_outputs_target_test.go(new)Adds two test functions:
TestMainWorkflowSchema_SafeOutputsTargetProperties— 25 sub-tests asserting each affected safe output type acceptstarget,target-repo, andallowed-reposin the schema.TestMainWorkflowSchema_SafeOutputsRejectsUnknownProperties— 4 sub-tests assertingadditionalProperties: falseis still enforced (misspelled or unknown keys are rejected).docs/adr/36636-sync-safe-output-schema-with-target-config.md(new)Draft ADR documenting the decision to keep the JSON schema as a faithful mirror of
SafeOutputTargetConfig, the alternatives considered (relaxingadditionalProperties, schema generation from Go structs), and the consequences.Root Cause
The Go parser (
SafeOutputTargetConfig/ParseTargetConfig) and the CJS runtime (repo_helpers.cjs) already acceptedtarget,target-repo, andallowed-reposfor cross-repository operations. The JSON schema — validated withadditionalProperties: false— was the only layer that rejected them, causing spurious compile-time failures for valid workflow configurations.Impact