Skip to content

Fix error message compliance in runs_on_validation, frontmatter_extraction_metadata, reactions, call_workflow_validation, and ambient_folders - #52177

Merged
pelikhan merged 2 commits into
mainfrom
copilot/squad-plan-fix-error-message-compliance-yet-again
Aug 11, 2026
Merged

Fix error message compliance in runs_on_validation, frontmatter_extraction_metadata, reactions, call_workflow_validation, and ambient_folders#52177
pelikhan merged 2 commits into
mainfrom
copilot/squad-plan-fix-error-message-compliance-yet-again

Conversation

Copilot AI commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

The lint-error-messages workflow flagged five pkg/workflow files as low-compliance with the repo's error-message style guide ([what's wrong]. [what's expected]. [example]), relying instead on standalone negative wording like invalid, must, cannot without actionable guidance.

Changes

  • runs_on_validation.go — rewrote all 6 type-mismatch messages for runs-on to state the actual type received, the expected shape, and a YAML example
  • frontmatter_extraction_metadata.go — reworded tracker-id length/character validation and tools.timeout/tools.startup-timeout type errors to include expected constraints and examples
  • reactions.go — rewrote reaction value/type validation errors to list valid options and a usage example instead of bare must be one of
  • call_workflow_validation.go — added expected on.workflow_call YAML snippet to the two messages missing it
  • ambient_folders.go — reworded type, empty-value, path-traversal, and character-validation errors with expected format and examples

No behavior or control-flow changes — only error message text. Existing unit tests asserting on exact error strings were updated to match the new wording.

Before/after example:

// Before
fmt.Errorf("invalid runs-on type %T: expected string, array of strings, or object", value)

// After
fmt.Errorf("runs-on has type %T, expected a string, array of strings, or object. Example: runs-on: ubuntu-latest", value)

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix error message compliance in multiple files Fix error message compliance in runs_on_validation, frontmatter_extraction_metadata, reactions, call_workflow_validation, and ambient_folders Aug 11, 2026
Copilot AI requested a review from pelikhan August 11, 2026 23:21
@pelikhan
pelikhan marked this pull request as ready for review August 11, 2026 23:22
Copilot AI balanced review requested due to automatic review settings August 11, 2026 23:22
@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Ponytail Reviewer completed successfully!

Reviewed PR #52177 for over-engineering. This PR only rewords existing error message strings to comply with the style guide ([what's wrong]. [what's expected]. [example]) — no new abstractions, structures, control flow, or logic were introduced. Lean already. Ship.

Generated by Ponytail Reviewer for #52177

@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Design Decision Gate 🏗️ completed the design decision gate check.

No ADR enforcement needed: PR #52177 does not have the 'implementation' label and has only 36 new lines of code in business logic directories (threshold: 100).

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

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

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

PR Code Quality Reviewer completed the code quality review.

Warning

Threat Detection Engine Failure — The analysis engine could not complete. This is a tooling failure, not a security finding.

What happened

The threat detection engine failed to produce results.

Review the workflow run logs for details.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • api.individual.githubcopilot.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "api.individual.githubcopilot.com"

See Network Configuration for more information.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

No new test functions were added in this PR. Changes are limited to updating error message assertions in existing tests (frontmatter_types_test.go, runs_on_validation_test.go, tracker_id_test.go) to match new error message compliance standards. These are test expectation updates, not behavioral test additions.

🧪 Test quality analysis by Test Quality Sentinel

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

The changes consistently improve error messages across runs_on_validation, frontmatter_extraction_metadata, reactions, call_workflow_validation, and ambient_folders to follow the 'has X, expected Y. Example: ...' pattern. Tests are updated to match the new message fragments. No logic changes, no security concerns. LGTM.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 · 18.1 AIC · ⌖ 6.22 AIC · ⊞ 5.4K

@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 and /diagnosing-bugs — approving with one minor note on test specificity.

📋 Key Themes & Highlights

Key Themes

  • Error message quality: All changes consistently follow the repo's style guide pattern — field name, actual type/value, expected constraint, YAML example. Well done.
  • Test updates: Test assertions are updated to match the new wording throughout. One case (tracker-id) loosened the assertion to a very generic substring; see inline comment.

Positive Highlights

  • ✅ Pure message-text change — no control-flow or logic mutations, easy to verify
  • ✅ Multiline YAML examples in call_workflow_validation error messages are a nice touch
  • ✅ Consistent pattern applied across all five files

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 · 20.7 AIC · ⌖ 6.49 AIC · ⊞ 7K
Comment /matt to run again

},
{
name: "Tracker-id too long (129 chars)",
frontmatter: map[string]any{"tracker-id": strings.Repeat("a", 129)},

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] Test assertions loosened to generic substrings.

Three cases now assert on 'unsupported character' instead of the prior 'tracker-id contains invalid character'. The new string is generic enough that an unrelated validation path could satisfy it, weakening regression detection.

Consider anchoring with the field name: errorMsg: "tracker-id has unsupported character"

@copilot please address this.

@github-actions

Copy link
Copy Markdown
Contributor

🧪 Test Quality Sentinel Report

Test Quality Score: N/A — Test Maintenance Only

No new test functions were added in this PR. Changes are limited to updating error message assertions in existing tests to match new error message compliance standards.

📊 Analysis Summary
Signal Value
Modified test files 3
New test functions 0
Modified test functions 0
Change type Test expectation updates only
🚨 Violations 0

Modified Files:

  • pkg/workflow/frontmatter_types_test.go — Updated 3 error message assertions
  • pkg/workflow/runs_on_validation_test.go — Updated 3 error message assertions
  • pkg/workflow/tracker_id_test.go — Updated 5 error message assertions

Verdict

passed. This PR updates existing test expectations to align with new error message standards in production code. No new behavioral tests to evaluate; no violations detected.

🧪 Test quality analysis by Test Quality Sentinel · haiku45 · 22.1 AIC · ⌖ 2.81 AIC · ⊞ 7.6K ·
Comment /review to run again

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

✅ Test Quality Sentinel: N/A — Test Maintenance Only. No new test functions were added in this PR. Changes are limited to updating error message assertions in existing tests to match new error message compliance standards. No violations detected.

@pelikhan
pelikhan merged commit 11b9b2a into main Aug 11, 2026
84 of 94 checks passed
@pelikhan
pelikhan deleted the copilot/squad-plan-fix-error-message-compliance-yet-again branch August 11, 2026 23:30

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

Updates workflow validation errors to be more actionable and align with the repository’s error-message style guide.

Changes:

  • Adds expected formats, valid options, and YAML examples to validation errors.
  • Reports received types and values more clearly.
  • Updates affected test expectations.
Show a summary per file
File Description
pkg/workflow/tracker_id_test.go Updates tracker ID error assertions.
pkg/workflow/runs_on_validation.go Improves runs-on validation messages.
pkg/workflow/runs_on_validation_test.go Updates runs-on error assertions.
pkg/workflow/reactions.go Improves reaction configuration errors.
pkg/workflow/frontmatter_types_test.go Updates frontmatter validation assertions.
pkg/workflow/frontmatter_extraction_metadata.go Improves tracker and timeout errors.
pkg/workflow/call_workflow_validation.go Adds valid workflow_call examples.
pkg/workflow/ambient_folders.go Improves ambient-folder validation errors.

Review details

Tip

Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Suppressed comments (2)

pkg/workflow/ambient_folders.go:61

  • This type-mismatch message does not identify the received entry type, leaving users unable to distinguish which kind of value caused validation to fail. Include %T with value, as the updated type errors elsewhere in this PR do.
			return nil, errors.New("ambient-folders entry has an unsupported type, expected a string folder path. Example: ambient-folders: [docs, src/lib]")

pkg/workflow/ambient_folders.go:78

  • The stated constraint does not match validation: paths such as docs/../src contain .. but are accepted after filepath.Clean, while . is rejected without containing either forbidden form. Describe the actual normalized-path requirement rather than telling users that all .. is disallowed.
			return nil, fmt.Errorf("ambient-folders entry %q is not a relative path within the repository, expected a relative folder path without '..' or a leading '/'. Example: ambient-folders: [docs, src/lib]", folder)
  • Files reviewed: 8/8 changed files
  • Comments generated: 4
  • Review effort level: Balanced

default:
frontmatterMetadataLog.Printf("Invalid tools.timeout type: %T", timeoutValue)
return "", fmt.Errorf("tools.timeout must be an integer or a GitHub Actions expression, got %T", timeoutValue)
return "", fmt.Errorf("tools.timeout has type %T, expected an integer or a GitHub Actions expression. Example:\ntools:\n timeout: 60", timeoutValue)
return nil
}
return fmt.Errorf("call-workflow: workflow '%s' does not support workflow_call trigger (must include 'workflow_call' in the 'on' section)", workflowName)
return fmt.Errorf("call-workflow: workflow '%s' does not support the workflow_call trigger, expected 'workflow_call' in the 'on' section. Example:\non:\n workflow_call:", workflowName)
}
} else {
return nil, errors.New("ambient-folders must be an array of folder paths")
return nil, errors.New("ambient-folders has an unsupported type, expected an array of folder path strings. Example: ambient-folders: [docs, src/lib]")
}
default:
return fmt.Errorf("invalid runs-on object key %q: expected only group or labels", key)
return fmt.Errorf("runs-on object key '%s' is not supported, expected 'group' or 'labels'. Example: runs-on:\n group: my-runner-group\n labels: [self-hosted]", key)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

3 participants