Skip to content

Raise error-message compliance for workflow validation batch (5 files) - #52174

Merged
pelikhan merged 5 commits into
mainfrom
copilot/squad-plan-fix-error-message-compliance-again
Aug 12, 2026
Merged

Raise error-message compliance for workflow validation batch (5 files)#52174
pelikhan merged 5 commits into
mainfrom
copilot/squad-plan-fix-error-message-compliance-again

Conversation

Copilot AI commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

This PR updates a targeted batch of workflow validation errors to match the repository’s error-message standard: clear failure, expected input, and a concrete correction example. Scope is limited to the five files identified by the lint-error-messages run, with no validation flow/control changes.

  • validation_helpers.go (shared validators)

    • Reworded range and mount-format/mode errors to include expected constraints and copy-pasteable examples.
    • Kept internal callback-contract failures explicit while making remediation guidance concise.
  • utc_offset.go (UTC parsing/normalization)

    • Unified malformed/out-of-range offset failures behind consistent user-facing guidance.
    • Added expected format/range context and YAML-style usage example (utc: "-08:00").
  • templatables.go (templatable scalar coercion)

    • Upgraded bool/int templatable unmarshalling errors to include accepted forms and concrete field examples.
    • Clarified 0–100 bound failures with direct corrective examples.
  • safe_outputs_validation.go (safe-outputs policy validation)

    • Reworked invalid safe-outputs.urls and target errors to enumerate accepted values plus valid YAML examples.
    • Improved merge-pull-request label/glob validation failures with field-local examples.
    • Ensured generated target examples use valid handler keys in YAML snippets.
  • model_costs_pricing_validation.go (default AI credits pricing)

    • Converted non-positive pricing field failures to NewValidationError(...) with structured reason + suggestion.
    • Added actionable examples for input, output, cache_read, and cache_write.

Example of the new pattern applied:

return fmt.Errorf(
  "safe-outputs.urls: invalid value %q. Expected one of: %q, %q. Example:\n  safe-outputs:\n    urls: %q",
  config.URLs,
  SafeOutputsURLsPolicyAllowedOnly,
  SafeOutputsURLsPolicyAllowedOrCodeRegion,
  SafeOutputsURLsPolicyAllowedOnly,
)

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 19.5 AIC · ⌖ 9.23 AIC · ⊞ 8.5K ·
Comment /souschef to run again

Copilot AI and others added 2 commits August 11, 2026 23:23
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 error message compliance in specified files Raise error-message compliance for workflow validation batch (5 files) Aug 11, 2026
Copilot AI requested a review from pelikhan August 11, 2026 23:33
@pelikhan
pelikhan marked this pull request as ready for review August 11, 2026 23:40
Copilot AI balanced review requested due to automatic review settings August 11, 2026 23:40

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 provide expected inputs and corrective examples.

Changes:

  • Expands validation error guidance across five production files.
  • Introduces structured pricing validation errors.
  • Adds or strengthens error-message tests.
Show a summary per file
File Description
pkg/workflow/validation_helpers.go Expands shared validator errors.
pkg/workflow/validation_helpers_test.go Checks range-error examples.
pkg/workflow/utc_offset.go Unifies UTC offset guidance.
pkg/workflow/utc_offset_test.go Tests malformed-offset messages.
pkg/workflow/templatables.go Improves scalar coercion errors.
pkg/workflow/templatables_bool_or_int_test.go Checks corrective examples.
pkg/workflow/safe_outputs_validation.go Expands policy validation guidance.
pkg/workflow/safe_outputs_validation_merge_pull_request_test.go Tests merge-policy examples.
pkg/workflow/safe_outputs_urls_validation_test.go Tests URL-policy examples.
pkg/workflow/safe_outputs_target_validation_test.go Tests target examples.
pkg/workflow/model_costs_pricing_validation.go Adds structured pricing errors.
pkg/workflow/model_costs_pricing_validation_test.go Checks pricing examples.

Review details

Tip

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

Suppressed comments (3)

pkg/workflow/validation_helpers.go:154

  • This revised error breaks the exact assertion in validation_helpers_test.go:704, which still expects the old message ending at mount kind 2. Update that assertion for the new contract so make test-unit can pass.
			return fmt.Errorf("internal error: onInvalid callback returned nil for mount kind %d. Expected a non-nil error for invalid mount kinds. Example: return an error like \"safe-outputs.mounts[0] has an invalid entry\" when kind is invalid", kind)

pkg/workflow/templatables.go:79

  • The non-expression-string path has the same hard-coded timeout-minutes guidance even when this type is decoding max-ai-credits, max-daily-ai-credits, max-tool-denials, timeout, or startup-timeout. Use the actual consuming field or a field-neutral example.
		return fmt.Errorf("timeout-minutes must be an integer or a GitHub Actions expression, got string %q. Expected an integer literal or an expression string. Example: timeout-minutes: 30 or timeout-minutes: ${{ inputs.timeout }}", s)

pkg/workflow/model_costs_pricing_validation.go:68

  • This example omits required input and output rates, so copying it produces a different validation error before cache_write is checked. Include both required positive rates to make the suggested YAML valid.
			"Set cache_write to a positive value when you configure it.\n\nExample:\nmodels:\n  default-ai-credits-pricing:\n    cache_write: 0.000001",
  • Files reviewed: 12/12 changed files
  • Comments generated: 5
  • Review effort level: Balanced

func validateMountEntries(mounts []string, onValid func(int, mountParts), onInvalid func(int, string, mountParts, mountValidationKind) error) error {
if onInvalid == nil {
return errors.New("internal error: onInvalid callback must not be nil")
return errors.New("internal error: onInvalid callback must not be nil. Expected a callback that returns an error for each invalid mount entry. Example: provide an onInvalid callback that returns an error for non-OK mount kinds")
Comment thread pkg/workflow/templatables.go Outdated
var templatablesLog = logger.New("workflow:templatables")

const templatableBoolErrorExample = "value must be a boolean or a GitHub Actions expression (e.g. '${{ inputs.flag }}')"
const templatableBoolErrorExample = "value must be a boolean or a GitHub Actions expression. Expected true, false, or an expression string. Example: enabled: true or enabled: ${{ inputs.flag }}"
Comment thread pkg/workflow/templatables.go Outdated
if err := json.Unmarshal(data, &s); err != nil {
templatablesLog.Printf("TemplatableInt32 rejected: not number or string: %s", data)
return fmt.Errorf("timeout-minutes must be an integer or a GitHub Actions expression (e.g. '${{ inputs.timeout }}'), got %s", data)
return fmt.Errorf("timeout-minutes must be an integer or a GitHub Actions expression, got %s. Expected an integer literal or an expression string. Example: timeout-minutes: 30 or timeout-minutes: ${{ inputs.timeout }}", data)
"models.default-ai-credits-pricing.cache_read",
fmt.Sprintf("%g", *p.CachedInput),
fmt.Sprintf("cache_read must be a positive value when set, got %g. Expected a value greater than 0.", *p.CachedInput),
"Set cache_read to a positive value when you configure it.\n\nExample:\nmodels:\n default-ai-credits-pricing:\n cache_read: 0.000001",
Comment thread pkg/workflow/validation_helpers.go Outdated
if value < min || value > max {
return fmt.Errorf("%s must be between %d and %d, got %d",
fieldName, min, max, value)
return fmt.Errorf("%s must be between %d and %d, got %d. Expected an integer in this inclusive range. Example: %s: %d",
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

…bles, complete pricing examples

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

Copilot AI commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

@copilot please address the open review threads below, refresh the branch if needed, and run the pr-finisher skill.

Open review threads (newest first):...

Addressed all 5 review threads in 20ce11b:

  • validateIntRange now renders dotted field paths (e.g. sandbox.mcp.port) as nested YAML instead of an invalid dotted key
  • TemplatableBool/TemplatableInt32 error examples use a field-neutral <field> placeholder instead of hardcoding enabled/timeout-minutes, since these types back many different frontmatter fields
  • cache_read/cache_write pricing examples now include required input/output values
  • Relaxed the onInvalid callback test assertions from EqualError to ErrorContains, fixing the impacted-go-tests and Unit tests (S-Z) CI failures

All targeted tests and go test ./pkg/workflow/... pass; make agent-report-progress-no-test validation is green.

@github-actions

Copy link
Copy Markdown
Contributor

🤖 Triage: PR #52174

Generated by 🔧 PR Triage Agent · auto · 44.5 AIC · ⌖ 2.66 AIC · ⊞ 7.8K ·

@pelikhan

Copy link
Copy Markdown
Collaborator

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please fix the failed check below and run the pr-finisher skill.

Failed checks:

Latest maintainer request:

Please refresh the branch context if needed, then hand back once lint is green.

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 19.5 AIC · ⌖ 9.23 AIC · ⊞ 8.5K ·
Comment /souschef to run again

Copilot AI commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

@copilot lint go https://github.com/github/gh-aw/actions/runs/31549658523/job/93977160602#step:7:1

The lint failure was from commit 20ce11b, before this branch was merged with main. The merge commit 0c71805 already brought in main's fix for the ST1005 violations in call_workflow_validation.go. Verified locally with make golint-incremental BASE_REF=origin/main0 issues. No further changes needed; the branch is already up to date with origin.

@github-actions

Copy link
Copy Markdown
Contributor

Hey 👋 — this PR looks great! It's a well-focused batch addressing error-message compliance across 5 validation files, exactly as scoped in issue #52171. The changes are surgical (error message text only, no logic changes), tests are comprehensive (23 new test cases in utc_offset_test.go plus updates throughout), and the new error-message pattern is consistently applied across all five files.

The PR follows the core team agentic workflow process and aligns with the squad plan. Ready for review! ✨

Generated by ✅ Contribution Check · auto · 51.1 AIC · ⌖ 2.96 AIC · ⊞ 8.8K ·

@pelikhan
pelikhan merged commit 5167052 into main Aug 12, 2026
26 of 27 checks passed
@pelikhan
pelikhan deleted the copilot/squad-plan-fix-error-message-compliance-again branch August 12, 2026 01:26
Copilot stopped work on behalf of gh-aw-bot due to an error August 12, 2026 01:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

4 participants