Skip to content

Unify skill reference parsing and classification - #51473

Merged
pelikhan merged 5 commits into
mainfrom
copilot/duplicate-code-skill-ref-parsing
Aug 9, 2026
Merged

Unify skill reference parsing and classification#51473
pelikhan merged 5 commits into
mainfrom
copilot/duplicate-code-skill-ref-parsing

Conversation

Copilot AI commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Skill references were parsed independently during frontmatter validation and compile-time SHA pinning, allowing accepted syntax and resolution behavior to drift.

  • Shared classification
    • Introduce parseSkillRefSpec for local paths, expressions, valid remote specs, empty refs, and full SHA refs.
  • Validation and resolution
    • Consume the shared result for validation and pinning decisions.
    • Skip resolution for malformed remote specs rather than reparsing partial values.
  • Activation checkout
    • Reuse the classifier when selecting local skill sparse-checkout paths.
  • Coverage
    • Add parser cases for local paths, expressions, malformed remotes, unpinned refs, and SHA-pinned refs.
parsed := parseSkillRefSpec(spec)
if !parsed.isRemote || parsed.isFullSHA {
    return spec
}

run: https://github.com/github/gh-aw/actions/runs/31293411688> Generated by 👨‍🍳 PR Sous Chef · gpt54 · 3.76 AIC · ⌖ 6.55 AIC · ⊞ 8.5K ·

Comment /souschef to run again

Copilot AI and others added 2 commits August 8, 2026 22:09
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] Refactor duplicate skill ref parsing in validation and resolution Unify skill reference parsing and classification Aug 8, 2026
Copilot AI requested a review from pelikhan August 8, 2026 22:12
@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

PR Triage

  • Category: refactor
  • Risk: medium (touches skill-ref parsing/validation/resolution shared logic; small diff, 4 files, 90+/44-)
  • Score: 45/100 (impact 20, urgency 10, quality 15)
  • CI: unknown — no check-run data returned yet; PR still draft
  • Recommendation: defer — draft status, still in progress; revisit once marked ready for review and CI reports.

Generated by 🔧 PR Triage Agent · auto · 51 AIC · ⌖ 2.57 AIC · ⊞ 8K ·

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Nice refactor unifying skill reference parsing and classification into a single parseSkillRefSpec source of truth. Good problem framing, focused scope limited to skill reference handling, and new tests covering malformed/unpinned/SHA-pinned reference cases. Looks aligned with project quality standards and ready for review.

Generated by ✅ Contribution Check · auto · 60.5 AIC · ⌖ 4.64 AIC · ⊞ 8.8K ·

@pelikhan
pelikhan marked this pull request as ready for review August 9, 2026 03:11
Copilot AI balanced review requested due to automatic review settings August 9, 2026 03:11
@github-actions

github-actions Bot commented Aug 9, 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 9, 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 9, 2026

Copy link
Copy Markdown
Contributor

Ponytail Reviewer completed successfully!

Reviewed PR #51473 for over-engineering (ponytail-review skill). The diff unifies three duplicated parsing implementations into a single parseSkillRefSpec function/struct, reducing duplication rather than adding complexity. No speculative abstractions, dead flexibility, or hand-rolled stdlib replacements found. Lean already. Ship.

Generated by Ponytail Reviewer for #51473

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

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

No ADR enforcement needed: PR #51473 does not have the 'implementation' label and has ≤100 new lines of code in business logic directories (90 additions detected across 4 files).

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

🧪 Test quality analysis by Test Quality Sentinel

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

Unifies skill-reference classification across validation, SHA resolution, and activation checkout.

Changes:

  • Adds a shared parsed skill-reference representation.
  • Reuses classification for validation, pinning, and local checkout paths.
  • Adds parser coverage for major reference forms.
Show a summary per file
File Description
pkg/workflow/skills_frontmatter.go Adds shared parsing and classification.
pkg/workflow/skills_ref_resolution.go Uses parsed refs for SHA pinning.
pkg/workflow/skills_frontmatter_test.go Tests reference classifications.
pkg/workflow/compiler_activation_job.go Reuses classification for local checkout paths.

Review details

Tip

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

  • Files reviewed: 4/4 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread pkg/workflow/skills_frontmatter.go Outdated

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

Clean refactor. The unified parsedSkillRefSpec struct correctly replaces the scattered isLocalSkillRef calls and inline strings.Cut logic. The behavioral change in resolveSkillRefSpec (now gating on parsed.isRemote instead of just hasAt) is a correctness improvement — malformed remote specs are now skipped consistently rather than only partially filtered. The new TestParseSkillRefSpec table covers the key classification cases. No issues found.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 · 19.1 AIC · ⌖ 9.24 AIC · ⊞ 5.5K

@github-actions github-actions Bot mentioned this pull request Aug 9, 2026
@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

🧪 Test Quality Sentinel — PR #51473

Score: 82/100 ✅ Excellent

Summary: One new behavioral test function (TestParseSkillRefSpec) was added, covering the new unified parseSkillRefSpec parser introduced in this refactor. The test is table-driven with 6 subtests, uses require.Equal exhaustively, and includes edge cases (malformed remote, expression syntax, SHA-pinned vs. unpinned). No violations found.


Metrics

Metric Value
New test functions 1 (TestParseSkillRefSpec, 6 subtests)
Design tests 1/1 (100%)
Tests with edge cases 1/1 (100%)
Duplicate clusters 0
Test inflation ratio 0.6:1 (29 test lines / 48 prod lines) ✅
Build tag (go/redacted):build !integration
Go mock libraries None ✅
Implementation tests 0/1 (0%) — threshold: 30%

📋 Per-test classification
Test Contract Value Design? Flags
TestParseSkillRefSpec/local path behavioral_contract high_value design_test
TestParseSkillRefSpec/bare expression behavioral_contract high_value design_test
TestParseSkillRefSpec/expression behavioral_contract high_value design_test
TestParseSkillRefSpec/malformed remote behavioral_contract high_value design_test
TestParseSkillRefSpec/unpinned remote behavioral_contract high_value design_test
TestParseSkillRefSpec/SHA-pinned remote behavioral_contract high_value design_test
⚠️ Minor findings

Assertion failure messages absent: All require.Equal calls in TestParseSkillRefSpec lack a descriptive failure context string (e.g. require.Equal(t, tt.local, parsed.isLocal, "isLocal mismatch for spec %q", tt.spec)). When a subtest fails, the output shows only field names, not which spec caused the failure. Recommend adding tt.name or the spec value as a message argument.

This is a style recommendation, not a blocking violation.


No violations detected. Implementation-test ratio: 0% (threshold: 30%).

References: PR #51473

🧪 Test quality analysis by Test Quality Sentinel · sonnet46 · 40.1 AIC · ⌖ 7.83 AIC · ⊞ 7.7K ·
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: 82/100. 0% implementation tests (threshold: 30%). No violations found.

@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 /codebase-design — approving with one minor test-coverage note.

📋 Key Themes & Highlights

Positive Highlights

  • Single source of truth: parseSkillRefSpec cleanly replaces scattered strings.Cut / strings.HasPrefix logic across three call sites — a textbook deep-module improvement.
  • Behaviour preserved: validation rules, warning messages, and resolution paths are identical; only the parsing mechanism is unified.
  • Imports cleaned up: removing strings and gitutil from skills_ref_resolution.go correctly narrows each package's dependency surface.
  • Good test coverage: six table-driven cases cover local, expression, malformed-remote, unpinned, and SHA-pinned specs.

Finding

  • One inline comment: missing empty-spec case in TestParseSkillRefSpec (minor, non-blocking).

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 · 33.4 AIC · ⌖ 7.54 AIC · ⊞ 7.1K
Comment /matt to run again

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
parsed := parseSkillRefSpec(tt.spec)
require.Equal(t, tt.local, parsed.isLocal)

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] The TestParseSkillRefSpec table is missing an empty-spec case (spec: ""). parseSkillRefSpec has an explicit early-return for trimmed == "", so it is a distinct code path that should be covered.

💡 Suggested test row
{name: "empty", spec: ""},

Without this entry, a future change to the early-return branch would silently regress.

@copilot please address this.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot Please refresh this branch if needed, address any remaining review feedback, and run the pr-finisher skill.

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

…seSkillRefSpec

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

Copilot AI commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Please refresh this branch if needed, address any remaining review feedback, and run the pr-finisher skill.

Generated by [👨‍🍳 PR Sous Chef](https://github.com/github/gh-aw/actions/...

Addressed the review feedback: moved expression detection before the local-path classification in parseSkillRefSpec, so specs like skills/${{ inputs.name }} (expressions without @) are correctly classified as isExpression=true rather than isLocal=true. Added a corresponding test case. Commit: fix: detect expressions before classifying no-@ specs as local in parseSkillRefSpec

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

PR Triage

  • Category: refactor
  • Risk: medium
  • Priority: medium
  • Score: 55/100 (impact 30 + urgency 10 + quality 15)
  • Recommended action: fast_track
    Batch: lockfile-regen-cluster\n
    Large shared-parsing refactor, already approved 3x by automation, but mergeable_state blocked and no CI - needs human unblock/merge decision.

Generated by 🔧 PR Triage Agent · auto · 58.3 AIC · ⌖ 2.48 AIC · ⊞ 8K ·

@pelikhan
pelikhan merged commit 91243c5 into main Aug 9, 2026
27 checks passed
@pelikhan
pelikhan deleted the copilot/duplicate-code-skill-ref-parsing branch August 9, 2026 11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[duplicate-code] Duplicate Code: Skill ref parsing duplicated between validation and resolution

4 participants