Skip to content

Refactor parser import/path helpers to eliminate wasm/native drift and duplicate logic - #53895

Open
pelikhan with Copilot wants to merge 3 commits into
mainfrom
copilot/refactor-wasm-build-tag-copies
Open

Refactor parser import/path helpers to eliminate wasm/native drift and duplicate logic#53895
pelikhan with Copilot wants to merge 3 commits into
mainfrom
copilot/refactor-wasm-build-tag-copies

Conversation

Copilot AI commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

pkg/parser had duplicated wasm/non-wasm implementations for remote path resolution and workflowspec detection, and those copies had drifted (notably in isRepositoryImport). This change consolidates shared logic into build-tag-free helpers and removes duplicate path/frontmatter helpers in import processing.

  • Wasm/native path and workflowspec logic consolidation

    • Added pkg/parser/remote_path_predicates.go for shared, platform-agnostic helpers:
      • isUnderWorkflowsDirectory
      • isCustomAgentFile
      • isRepositoryImport
      • IsWorkflowSpec
      • findGitHubFolder
      • computeIncludeResolveAndSecurityBases
    • Removed duplicated implementations from remote_resolve_path.go, remote_fetch_wasm.go, and remote_workflow_spec.go.
    • Removed wasm-only isWorkflowSpec alias and called IsWorkflowSpec directly.
    • Preserved wasm-specific behavior where it differs intentionally (virtual FS existence checks, remote import rejection).
  • Behavioral drift fix (isRepositoryImport)

    • Standardized on native behavior for repo-name validation (rejects known file extensions, does not reject all dots).
    • This aligns wasm behavior with native for cases like githubnext/gh-aw.dev.
  • Duplicate path#section helper removal

    • Added shared splitPathAndSection in pkg/parser/path_section.go.
    • Replaced splitImportPathAndSection, splitIncludePathAndSection, and stripImportSection callsites.
  • Duplicate frontmatter extraction removal

    • Removed extractFrontmatterForTopologicalSort.
    • Reused extractFrontmatterForImport in topological import resolution and consumed result.Frontmatter.
  • Targeted test update

    • Extended TestIsRepositoryImport to cover dotted repository names as valid repository imports.
func splitPathAndSection(path string) (string, string) {
	if before, after, ok := strings.Cut(path, "#"); ok {
		return before, after
	}
	return path, ""
}

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 33.9 AIC · ⌖ 8.18 AIC · ⊞ 9.3K ·
Comment /souschef to run again

Copilot AI and others added 2 commits August 19, 2026 03:37
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 wasm build-tag copies to resolve duplication issues Refactor parser import/path helpers to eliminate wasm/native drift and duplicate logic Aug 19, 2026
Copilot AI requested a review from pelikhan August 19, 2026 03:42
@pelikhan
pelikhan marked this pull request as ready for review August 19, 2026 04:05
Copilot AI balanced review requested due to automatic review settings August 19, 2026 04:05

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

Consolidates parser path/import helpers to prevent native/Wasm drift and remove duplicate logic from issue #53888.

Changes:

  • Centralizes remote path predicates and resolution calculations.
  • Reuses shared path-section and frontmatter helpers.
  • Tests dotted repository names as valid imports.
Show a summary per file
File Description
pkg/parser/remote_workflow_spec.go Removes duplicated workflow-spec detection.
pkg/parser/remote_resolve_path.go Uses shared path-resolution helpers.
pkg/parser/remote_path_predicates.go Adds platform-independent parser helpers.
pkg/parser/remote_fetch_wasm.go Aligns Wasm with shared behavior.
pkg/parser/path_section.go Adds shared path-section splitting.
pkg/parser/include_processor.go Uses the shared splitter.
pkg/parser/import_topological.go Reuses shared splitting and frontmatter extraction.
pkg/parser/import_bfs.go Replaces duplicate import splitters.
pkg/parser/frontmatter_utils_test.go Covers dotted repository names.

Review details

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

  • Files reviewed: 9/9 changed files
  • Comments generated: 0
  • Review effort level: Balanced

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot Please refresh this PR for maintainer review and then run the pr-finisher skill.

Current maintainer-visible next steps:

  • This PR has a reviewer summary but no maintainer-facing handoff yet.
  • Please confirm the current head still matches the intended refactor, run the usual final validation, and leave a short handoff comment summarizing what was checked for reviewers.
  • A branch refresh was attempted by sous-chef as well.

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 33.9 AIC · ⌖ 8.18 AIC · ⊞ 9.3K ·
Comment /souschef to run again

Copilot AI commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Please refresh this PR for maintainer review and then run the pr-finisher skill.

Current maintainer-visible next steps:...

Refreshed PR #53895 at head aa630fc and ran pr-finisher.

Handoff for maintainers:

  • Confirmed the current head still matches the intended parser refactor (pkg/parser shared import/path helpers, wasm/native behavior alignment, and targeted test coverage).
  • Review threads: none unresolved; Copilot reviewer summary had 0 generated comments.
  • Local validation: make fmt, make test-unit, make test, make recompile, and make agent-report-progress passed; secret scan found no secrets in changed files. Full make lint was attempted and only failed on unrelated existing testifylint findings outside this PR (pkg/intent, pkg/workflow).
  • CI snapshot: prior visible checks are green/skipped; the current Copilot comment-handling run is still in progress and must be re-triggered/verified by a maintainer if required before merge.

Still needed: maintainer review/approval.

@github-actions

Copy link
Copy Markdown
Contributor

Triage: category=refactor · risk=medium · score=53/100 (impact 25/50, urgency 12/30, quality 16/20)
Recommended action: fast_track

Non-draft, CI green (29/32 checks passed), reduces wasm/native duplication across 9 files. AI reviewer left comments — please address before merge.

Generated by 🔧 PR Triage Agent · auto · 58.8 AIC · ⌖ 2.56 AIC · ⊞ 8.3K ·

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.

[refactor] pkg/parser: wasm build-tag copies have drifted, plus 3 duplicate-function clusters

4 participants