Skip to content

fix(workflow): accept schema-supported frontmatter shapes - #71809

Merged
pelikhan merged 3 commits into
mainfrom
pelikhan-legendary-waffle
Oct 25, 2026
Merged

pelikhan merged 3 commits into
mainfrom
pelikhan-legendary-waffle

Conversation

@pelikhan

@pelikhan pelikhan commented Oct 25, 2026 •

Copy link
Copy Markdown
Collaborator

Schema-supported frontmatter forms can fail typed parsing, producing a generic warning and dropping the entire typed configuration. This fixes the shape mismatches found in the public workflow sweep without suppressing genuine invalid-input diagnostics.

Changes

  • Normalize scalar custom safe-output job dependencies to string slices without mutating raw frontmatter.
  • Preserve single-object and array cache configurations, including round trips, while rejecting invalid cache shapes.
  • Parse daily AI Credits objects and numeric, K/M-suffixed, expression, and disable-sentinel credit limits into the existing typed threshold fields. Keep daily guardrail settings in raw frontmatter and leave ordinary templatable integer parsing unchanged.
  • Add schema-backed parsing, invalid-input warning, non-mutation, and compiled-output regression coverage.

ADR: ADR-71809: Accept Schema-Supported Frontmatter Shapes in Typed Parsing (proposed).

Validation

Build, formatting, focused frontmatter and adjacent credit/safe-job tests, impacted unit tests, and change-scoped custom lint passed. Go lint passed with zero issues. All 348 local workflows compiled with zero generic frontmatter parse warnings; no workflows were executed.

The full validation gate is not green: the workflow drift check reports differences in 27 generated lock files, including upstream-managed workflows. The check restored all lock files, and this PR contains only the parsing fixes, regression tests, and the design decision record. No permissions or checkout-exemption changes are included.

Preserve typed config for scalar safe-job needs, cache arrays, daily credit objects, and K/M credit budgets without weakening ordinary templatable integers or invalid-input warnings.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@pelikhan
pelikhan marked this pull request as ready for review October 25, 2026 04:03
Copilot AI max review requested due to automatic review settings October 25, 2026 04:03
@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Ponytail Reviewer

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Ponytail Reviewer · gpt56 · ~8 AIC · ⌖ ~6 AIC · ⊞ 14.8K · ◷

Generated by Ponytail Reviewer for #71809

@github-actions

github-actions Bot commented Oct 25, 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 Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Test Quality Sentinel · sonnet50 · ~15 AIC · ⌖ ~16 AIC · ◇ ~7 AIC · ⊞ 12.7K · ◷

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft.

Commit pushed: 3267c3a

🏗️ ADR gate enforced by Design Decision Gate 🏗️

Comment thread pkg/workflow/aic_limit_parser.go Resolved
@github-actions

Copy link
Copy Markdown
Contributor

🏗️ Design Decision Gate — ADR Required

This PR makes significant changes to core business logic (305 new lines in pkg/) but does not link an Architecture Decision Record (ADR).

📄 Draft ADR committed: docs/adr/71809-accept-schema-supported-frontmatter-shapes-in-typed-parsing.md. Review and complete it before merging.

The draft records this decision: typed frontmatter parsing accepts every shape the schema allows by adapting at the decode boundary. In detail, scalar needs: values are normalized to slices, Cache is widened to any and checked by a shape validator, and the credit limits are captured as json.RawMessage and parsed by parseFrontmatterAICLimit. TemplatableInt32 parsing for other fields stays unchanged.

🔒 This PR cannot merge until an ADR is linked in the PR body.

📋 What to do next
  1. Review the draft ADR committed to your branch. It was generated from the PR diff.
  2. Complete the missing sections. Add context the AI couldn't infer, refine the rationale, and confirm the alternatives (custom UnmarshalJSON on the shared types, lenient decoding, narrowing the schema).
  3. Commit the finalized ADR to docs/adr/ on your branch.
  4. Reference the ADR in this PR body by adding a line such as:

    ADR: ADR-71809: Accept Schema-Supported Frontmatter Shapes in Typed Parsing

Once an ADR is linked in the PR body, this gate will re-run and check that the implementation matches the decision.

❓ Why ADRs Matter

"AI made me procrastinate on key design decisions. Because refactoring was cheap, I could always say 'I'll deal with this later.' Deferring decisions corroded my ability to think clearly."

ADRs create a searchable, permanent record of why the codebase looks the way it does.

📋 Michael Nygard ADR Format Reference

An ADR must contain these four sections to be considered complete:

  • Context: What is the problem? What forces are at play?
  • Decision: What did you decide? Why?
  • Alternatives Considered: What else could have been done?
  • Consequences: What are the trade-offs (positive and negative)?

All ADRs are stored in docs/adr/ as Markdown files named by PR number.

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · pi · opus55 · ~33 AIC · ⌖ ~41 AIC · ⊞ 1.9K · ◷
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.

Review: no blocking issues found

The frontmatter shape handling and regression coverage look internally consistent on the changed lines. I did not identify an actionable correctness, security, or performance defect requiring a merge block. This was a static review; tests were not executed.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~7 AIC · ⌖ ~1 AIC · ⊞ 1.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.

Skills-Based Review 🧠

Applied /diagnosing-bugs and /tdd (per pr-triage classification: bug_fix). The fix correctly widens parsing to accept schema-supported shapes (needs: scalar, cache: array, max-ai-credits/max-daily-ai-credits K/M-suffix/expression/object forms) that were previously rejected by strict typed unmarshal — verified against main_workflow_schema.json and docs/src/content/docs/reference/{cost-management,safe-outputs}.md, confirming no scope-creep. go build and the full new test suite pass.

Left 3 minor, non-blocking inline suggestions — approving as the changes are solid and well-tested.

📋 Key Themes & Highlights

Key Themes

  • Implicit nil-safety invariant (aic_limit_parser.go): the object-form recursion's limit.String() call is safe only because an outer check happens to mirror an inner short-circuit condition — not a live bug, but fragile to future edits.
  • Test traceability (frontmatter_shapes_test.go): 4 new test functions give strong shape-based coverage (positive/negative/round-trip), but none anchor back to the 'public workflow sweep' failures cited in the PR description.
  • Two parsing paths for needs (frontmatter_normalization.go vs safe_jobs.go): correct and tested, but worth a comment explaining why typed-unmarshal normalization and manual map parsing both exist for the same field.

Positive Highlights

  • ✅ config.Cache type widening (map[string]any → any) correctly matches the schema's documented oneOf (object or array) and doesn't affect runtime cache-step generation, which reads from raw YAML separately.
  • ✅ Comprehensive new test file covers supported shapes, AI-credit edge cases (K/M suffix, expressions, -1 sentinel, object form), and invalid-shape rejection.
  • ✅ Raw frontmatter is not mutated during needs normalization — a clean, side-effect-free approach.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · sonnet50 · ~180 AIC · ⌖ ~16 AIC · ⊞ 10.2K
Comment /matt to run again

Comment thread pkg/workflow/aic_limit_parser.go Resolved
Comment thread pkg/workflow/frontmatter_shapes_test.go Resolved

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.

🔵 Needs a closer look

The reported drift in 27 generated lock files leaves compiler-output compatibility unresolved and requires maintainer review.

1 open issue
What changed in this PR

This PR aligns gh-aw’s typed frontmatter parsing with schema-supported forms, preventing valid configurations from being dropped after generic parse warnings.

Changes:

  • Normalize scalar safe-job dependencies without modifying raw frontmatter.
  • Support cache objects and arrays, expanded credit-limit syntax, and daily-credit objects.
  • Add regression coverage for valid shapes, invalid inputs, round trips, and compiled output.
File Description
pkg/​workflow/​frontmatter_types.go Allow multiple cache shapes and clarify the normalized daily-credit field.
pkg/​workflow/​frontmatter_shapes_test.go Test parsing, non-mutation, round trips, warnings, and compiled output.
pkg/​workflow/​frontmatter_parsing.go Decode credit limits separately and validate cache shapes.
pkg/​workflow/​frontmatter_normalization.go Normalize scalar safe-job dependencies using cloned maps.
pkg/​workflow/​aic_limit_parser.go Parse credit-specific scalar syntax and daily-credit objects.

Review effort: Max

Comment thread pkg/workflow/aic_limit_parser.go Resolved
Guard recursive credit parsing, clarify object-value errors, remove sensitive input from diagnostics and suffix-helper logs, anchor public-sweep regressions, and finalize the proposed ADR.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@pelikhan

Copy link
Copy Markdown
Collaborator Author

In response to #71809 (comment):

No code change is needed for this status-only notice. I have not treated reported_no_action as validation evidence; the focused regression checks and their limitations are documented separately.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

In response to #71809 (comment):

The three actionable inline suggestions from this review have been accepted: explicit nil safety, a public-sweep regression anchor, and an explanation of the two dependency parsing paths. Each inline thread has its own implementation reply.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

In response to #71809 (comment):

No code change is needed for this completion notice or its no-blocking-issues review. The follow-up batch preserves the existing validation boundaries and addresses the separately reported parser and documentation feedback.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

In response to #71809 (comment):

No code change is needed for this status-only notice, and reported_no_action is not being treated as proof of coverage. Added concrete sweep-provenance and parser-error/debug-redaction regressions and ran the focused suites independently.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

In response to #71809 (comment):

Accepted the draft for review and finalized the ADR's context, rationale, alternatives, and consequences. It remains Proposed pending maintainer acceptance and is now linked in the PR body.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

In response to #71809 (comment):

Accepted. Completed the ADR, documented the three alternatives and trade-offs, retained Proposed status, and added its link to the PR body; the existing generated-lock drift limitation remains explicit.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

In response to #71809 (comment):

Confirmed: this is the earlier response to the status-only Ponytail notice, not a new change request. No additional code or validation is needed for this acknowledgement.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

In response to #71809 (comment):

Confirmed: commit c4f6cbd contains the three accepted review improvements, and their inline threads are resolved. This acknowledgement adds no further implementation request.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

In response to #71809 (comment):

Confirmed: the original completion notice and this response require no additional changes. The parser and documentation feedback was handled in the previous batch.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

In response to #71809 (comment):

Confirmed: the prior batch added and ran the sweep-provenance and diagnostic-redaction regressions. This response is an acknowledgement, not a new test requirement.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

In response to #71809 (comment):

Confirmed: the finalized proposed ADR is committed and linked in the current PR body. This acknowledgement needs no additional documentation changes.

@pelikhan

Copy link
Copy Markdown
Collaborator Author

In response to #71809 (comment):

The ADR requirement is already satisfied by the finalized, linked document, including its alternatives and trade-offs. This prior response adds no new work, and the generated-lock drift limitation remains documented.

@pelikhan
pelikhan merged commit c56fa9e into main Oct 25, 2026
81 checks passed
@pelikhan
pelikhan deleted the pelikhan-legendary-waffle branch October 25, 2026 04:53
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.93.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants