Refactor parser import/path helpers to eliminate wasm/native drift and duplicate logic#53895
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
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
|
@copilot Please refresh this PR for maintainer review and then run the Current maintainer-visible next steps:
|
Refreshed PR #53895 at head Handoff for maintainers:
Still needed: maintainer review/approval. |
|
Triage: category= Non-draft, CI green (29/32 checks passed), reduces wasm/native duplication across 9 files. AI reviewer left comments — please address before merge.
|
pkg/parserhad duplicated wasm/non-wasm implementations for remote path resolution and workflowspec detection, and those copies had drifted (notably inisRepositoryImport). 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
pkg/parser/remote_path_predicates.gofor shared, platform-agnostic helpers:isUnderWorkflowsDirectoryisCustomAgentFileisRepositoryImportIsWorkflowSpecfindGitHubFoldercomputeIncludeResolveAndSecurityBasesremote_resolve_path.go,remote_fetch_wasm.go, andremote_workflow_spec.go.isWorkflowSpecalias and calledIsWorkflowSpecdirectly.Behavioral drift fix (
isRepositoryImport)githubnext/gh-aw.dev.Duplicate
path#sectionhelper removalsplitPathAndSectioninpkg/parser/path_section.go.splitImportPathAndSection,splitIncludePathAndSection, andstripImportSectioncallsites.Duplicate frontmatter extraction removal
extractFrontmatterForTopologicalSort.extractFrontmatterForImportin topological import resolution and consumedresult.Frontmatter.Targeted test update
TestIsRepositoryImportto cover dotted repository names as valid repository imports.