Skip to content

Split compilation pipeline into focused stages - #80754

Merged
pelikhan merged 8 commits into
mainfrom
copilot/file-diet-refactor-compile-pipeline-again
Nov 24, 2026
Merged

pelikhan merged 8 commits into
mainfrom
copilot/file-diet-refactor-compile-pipeline-again

Conversation

@gh-aw-bot

@gh-aw-bot gh-aw-bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

The compilation pipeline combined file orchestration, batch scanners, notices, purge, and post-processing in one large file. This refactor separates those responsibilities and removes duplicated per-file compilation logic.

  • Pipeline stages: Share compilation bookkeeping, scanner input collection, and result handling across specific-file and directory compilation.
  • File organization: Move batch tools, notices, purge, and post-processing into focused files.
  • Regression coverage: Add tests for stage bookkeeping, scanner inputs, cancellation, unemitted locks, and error precedence.

The refactor preserves the public API and existing compilation behavior.

gh-aw-bot and others added 5 commits November 24, 2026 16:17
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
@gh-aw-bot gh-aw-bot changed the title [WIP] Refactor pkg/cli/compile_pipeline.go into focused files Split compilation pipeline into focused stages Nov 24, 2026
compileOrchestrationLog.Printf("Failed to format MCP compile progress: %v", err)
return
}
if err := writeSensitiveFile(progressPath, []byte(output)); err != nil {
@pelikhan
pelikhan marked this pull request as ready for review November 24, 2026 18:24
Copilot AI adaptive review requested due to automatic review settings November 24, 2026 18:24
@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Specification Reviewer completed successfully!

PR Specification Reviewer

Outcome: reported_action

The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken.

The [aw] No-Op Runs tracker omits agent messages. The category uses structured run status, not interpretation of agent prose.

No-op message

Review of captured head 1275d16 was superseded by PR head 2670e49 before publication; pending specification edits were discarded and no review was submitted.

Generated by PR Specification Reviewer for #80754 · copilot · gpt56 · ~5 AIC · ⌖ ~1 AIC · ⊞ 1.8K · history

@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

🧪 Test quality analysis by Test Quality Sentinel · copilot · routed: haiku55 xhigh · ~5 AIC · ⌖ ~2 AIC · ⊞ 7.4K · history

@github-actions

github-actions Bot commented Nov 24, 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 · copilot · routed: haiku55 xhigh · ~11 AIC · ⌖ ~2 AIC · ⊞ 5.1K · history

@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

PR Code Quality Reviewer

Outcome: reported_action

The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken.

The [aw] No-Op Runs tracker omits agent messages. The category uses structured run status, not interpretation of agent prose.

No-op message

Completed PR #80754 review: submitted one unified no-findings review and recorded the outcome in review-history.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt56 · ~4 AIC · ⌖ ~1 AIC · ⊞ 1.7K · history

@github-actions

github-actions Bot commented Nov 24, 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.

The [aw] No-Op Runs tracker omits agent messages. The category uses structured run status, not interpretation of agent prose.

No-op message

Lean already. Ship.

Generated by Ponytail Reviewer for #80754 · codex · routed: gpt61 medium · ~5 AIC · ⌖ ~1 AIC · ⊞ 176 · history

@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

🏗️ Design Decision Gate — ADR Required

This PR makes significant changes to core business logic (>100 new lines) but does not have a linked Architecture Decision Record (ADR).

📄 Draft ADR committed: docs/adr/80754-split-compile-pipeline-into-focused-stages.md. Review and complete it before merging.

🔒 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 could not infer, refine the decision rationale, and list real alternatives you considered.

  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-80754: Split Compilation Pipeline into Focused Stages (link unavailable: invalid HTTPS URL)

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

🔍 Points to confirm in the draft
  • The diff regenerates 71 .lock.yml files that change the pinned Claude Code CLI version from 2.1.331 to 2.1.325. This is unrelated to the split and needs confirmation or a revert.
  • The public-API and behavior-preservation claim comes from the PR description and is not independently verified in the draft.
📋 Michael Nygard ADR Format Reference

An ADR must contain these four sections to be complete: Context, Decision, Alternatives Considered, and Consequences.

References: §45459243449

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · pi · routed: haiku55 xhigh · ~3 AIC · ⌖ ~2 AIC · ⊞ 6.6K · history
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.

No blocking findings. The refactor preserves the existing compilation-stage behavior in the changed code; the specialist pass found no actionable correctness regression on changed lines.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~4 AIC · ⌖ ~1 AIC · ⊞ 1.7K
Comment /review to run again

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (review-history)
{"id":"ldg-145b95e3-08b3-46fd-81a6-28348dde43cb","parents":[],"payload":{"id":"ldg-b49b1b7c-4040-403a-b540-bbe219623e41","operation":"append","value":{"finding_count":0,"head_sha":"1275d16cc5be02ec19b5b444fa604ee682584885","outcome":"no_findings"}},"sha":"sha256:bf22783e6c32a0cfcbfe5b53a819588034dcc9a396d13e1e8927931474cad86e","timestamp":"2026-11-24T18:34:34.317Z","type":"ledger_append","version":1}
History

@github-actions

Copy link
Copy Markdown
Contributor

🧪 Test Quality Sentinel Report

✅ Test Quality Score: 100/100 — Excellent

Analyzed 4 test(s): 4 design, 0 implementation, 0 violation(s).

📊 Metrics (4 tests)
Metric Value
Analyzed 4 (Go: 4, JS: 0)
✅ Design 4 (100%)
⚠️ Implementation 0 (0%)
Edge/error coverage 4 (100%)
Duplicate clusters 0
Inflation No (105 test lines vs 124 production lines in compile_pipeline_stages.go, 0.85:1)
🚨 Violations 0
Test File Classification Issues
TestCompilePipelineStageRecordsFiles pkg/cli/compile_pipeline_stages_test.go:17 design, high_value White-box on unexported stage.batch fields (the routing contract it checks is behavioral); covers the failure fallback message
TestCompilePipelineStageSkipsUnemittedLocks :59 design, high_value Table-driven with 3 edge rows (no-emit, empty path, missing file)
TestCompilePipelineStageCancellation :85 design, high_value Asserts context.Canceled and that no work was done
TestCompilationResultErrorPrecedence :96 design, high_value 5 scenarios, 4 error paths, pins which error wins
⚠️ Flagged Tests (0 scoring, 1 non-scoring note)

All 4 tests: 24 assert/require calls and none carries a custom failure message (red flag 8). Many sibling tests in pkg/cli include them, for example access_log_test.go has 52 of 61 assert calls with a message. Failures print only the default testify diff. Suggested fix: add a message to the key assertions. This does not change the score or verdict.

Verdict

✅ passed. 0% implementation tests (threshold: 30%). No hard violations: (go/redacted):build !integration is on line 1, there are no mock libraries, and forbidden_mocks=0.

Note: go test execution was denied by the sandbox during this review, so this assessment is static and does not verify pass/fail status.

References: §45459243261

🧪 Test quality analysis by Test Quality Sentinel · copilot · routed: haiku55 xhigh · ~5 AIC · ⌖ ~2 AIC · ⊞ 7.4K · history
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: 100/100. 0% implementation tests (threshold: 30%). No hard violations. Static review only: test execution was denied by the sandbox.

🧪 Test quality analysis by Test Quality Sentinel · copilot · routed: haiku55 xhigh · ~5 AIC · ⌖ ~2 AIC · ⊞ 7.4K
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.

The split keeps the public behavior. Error precedence is unchanged (strict grant, then batch tool, then failures, then development diagnostics), and the directory-path errorCount increment for strict or batch failures is preserved. go vet ./pkg/cli/ and the new targeted tests pass.

The remaining points are design and coverage suggestions, not defects:

  • compilePipelineStage carries batch-option accumulation alongside the compile loop.
  • findDirectoryWorkflows returns two positional strings, and finishDirectory takes seven parameters.
  • The new tests do not reach the directory finish path or the dry-run workflowDir selection.

The existing writeMCPCompileProgress comment still applies to the moved code.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~11 AIC · ⌖ ~2 AIC · ⊞ 5.1K
Comment /matt to run again

workflows []*workflow.WorkflowData
resultIndexes []int
compiledLockFiles []string
batch batchToolsOptions

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.

[/codebase-design] compilePipelineStage now mixes three concerns: the compile loop, result bookkeeping, and batch-option accumulation through the batch field. recordFile fills batch through a long run of if config.X blocks, and both callers set batch.workflowDir late. Consider a small method (for example, collectBatchInputs) so the stage stays a sequencing seam and lock-file routing lives in one place. @copilot please address this.

// zizmor, poutine, actionlint disabled per-file (batched instead)
},
)
func findDirectoryWorkflows(workflowDir string, verbose bool) (string, string, []string, error) {

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.

[/improve-codebase-architecture] findDirectoryWorkflows returns (string, string, []string, error), and the first two strings are gitRoot and workflowsDir. The caller at line 113 destructures them by position, so swapping them still compiles. A small named struct (for example, directoryWorkflows{gitRoot, workflowsDir, mdFiles}) would make the order explicit. @copilot please address this.

return gitRoot, workflowsDir, mdFiles, nil
}

func (stage *compilePipelineStage) finishDirectory(ctx context.Context, gitRoot, workflowsDir string, mdFiles []string, purgeData *purgeTrackingData, strictGrantErr, batchToolErr error) ([]*workflow.WorkflowData, error) {

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.

[/codebase-design] finishDirectory takes seven parameters, and several (gitRoot, workflowsDir, mdFiles, purgeData) are state the caller already has. finishSpecific repeats the same notice, diagnostics, post-processing, and output sequence. Passing the directory state as one value and extracting that shared sequence into a helper would keep both finish paths aligned. @copilot please address this.

"github.com/stretchr/testify/require"
)

func TestCompilePipelineStageRecordsFiles(t *testing.T) {

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] Coverage gap: these tests cover compile bookkeeping, unemitted locks, cancellation, and compilationResultError precedence. None of them reaches finishDirectory, which holds the directory-only errorCount increment for strict or batch failures and the purge step. The dry-run workflowDir selection at compile_pipeline.go:142-144 is also untested. A table test for finishDirectory or a direct test of the workflowDir choice would protect those branches. @copilot please address this.

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (spec-review-history)
{"id":"ldg-a40c78b6-880d-4de7-8006-242ec3dbd7a8","parents":[],"payload":{"id":"ldg-7ffa69b2-6754-4906-bc6f-47757c9436ac","operation":"append","value":{"finding_count":0,"head_sha":"1275d16cc5be02ec19b5b444fa604ee682584885","outcome":"incomplete"}},"sha":"sha256:b34405664582a239a561e0ef14a2d5bb4141d688016a92ab42ffbf4fb968fac5","timestamp":"2026-11-24T18:41:15.711Z","type":"ledger_append","version":1}
History

return nil
}

func writeMCPCompileProgress(progressPath string, results []ValidationResult) {

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.

🟡 Changes recommended

Strict validation can falsely succeed because NoEmit bypasses Actionlint, Zizmor, and Poutine, while runner-guard scans only the first directory in multi-directory batches.

5 open issues
What changed in this PR

Refactors gh-aw’s compilation pipeline into focused stages, addressing #80720’s maintainability goal and reducing duplicated per-file logic.

Changes:

  • Shares compilation bookkeeping and scanner-input collection between specific-file and directory compilation.
  • Separates purge, post-processing and notices, with regression tests for bookkeeping, cancellation and error precedence.
  • Regenerates 28 workflow locks, changing Claude Code runtime pins from 2.1.331 to 2.1.325.
File Description
pkg/​cli/​compile_pipeline_stages.go Adds shared per-file compilation and scanner bookkeeping.
pkg/​cli/​compile_pipeline_stages_test.go Tests bookkeeping, unemitted locks, cancellation and error precedence.
pkg/​cli/​compile_pipeline_purge.go Isolates purge tracking and cleanup operations.
pkg/​cli/​compile_pipeline_postprocess.go Isolates manifest generation, cache maintenance and result output.
pkg/​cli/​compile_pipeline_notices.go Isolates compilation notices, warnings and MCP progress output.
.github/​workflows/​step-name-alignment.lock.yml Changes Claude runtime pin and version metadata.
.github/​workflows/​static-analysis-report.lock.yml Changes Claude runtime pin and version metadata.
.github/​workflows/​smoke-claude-sub-agents.lock.yml Changes Claude runtime pin and version metadata.
.github/​workflows/​smoke-claude-routed.lock.yml Changes Claude runtime pin and version metadata.
.github/​workflows/​smoke-claude-routed-anthropic.lock.yml Changes both Claude installation pins and version metadata.
.github/​workflows/​smoke-claude-dynamic.lock.yml Changes agent and detector Claude pins and metadata.
.github/​workflows/​smoke-claude-copilot.lock.yml Changes Claude runtime pin and version metadata.
.github/​workflows/​smoke-claude-copilot-auto.lock.yml Changes Claude runtime pin and version metadata.
.github/​workflows/​smoke-claude-auto.lock.yml Changes Claude runtime pin and version metadata.
.github/​workflows/​semantic-function-refactor.lock.yml Changes Claude runtime pin and version metadata.
.github/​workflows/​safe-output-health.lock.yml Changes Claude runtime pin and version metadata.
.github/​workflows/​refiner.lock.yml Changes Claude runtime pin and version metadata.
.github/​workflows/​org-health-report.lock.yml Changes Claude runtime pin and version metadata.
.github/​workflows/​lockfile-stats.lock.yml Changes Claude runtime pin and version metadata.
.github/​workflows/​instructions-janitor.lock.yml Changes Claude runtime pin and version metadata.
.github/​workflows/​go-logger.lock.yml Changes Claude runtime pin and version metadata.
.github/​workflows/​github-mcp-tools-report.lock.yml Changes Claude runtime pin and version metadata.
.github/​workflows/​example-workflow-analyzer.lock.yml Changes Claude runtime pin and version metadata.
.github/​workflows/​engine-conformance-claude.lock.yml Changes Claude runtime pin and version metadata.
.github/​workflows/​deployment-incident-monitor.lock.yml Changes Claude runtime pin and version metadata.
.github/​workflows/​delight.lock.yml Changes Claude runtime pin and version metadata.
.github/​workflows/​daily-vulnhunter-scan.lock.yml Changes Claude runtime pin and version metadata.
.github/​workflows/​daily-safeoutputs-git-simulator.lock.yml Changes Claude runtime pin and version metadata.
.github/​workflows/​daily-safe-outputs-conformance.lock.yml Changes Claude runtime pin and version metadata.
.github/​workflows/​daily-grader-audit.lock.yml Changes Claude runtime pin and version metadata.
.github/​workflows/​daily-elixir-credo-snippet-audit.lock.yml Changes Claude runtime pin and version metadata.
.github/​workflows/​daily-byok-ollama-test.lock.yml Changes the Claude detector pin and version metadata.
.github/​workflows/​daily-astrostylelite-markdown-spellcheck.lock.yml Changes Claude runtime pin and version metadata.

Review effort: Max (adaptive)

}
}

if config.Zizmor && !config.NoEmit {
Comment on lines +114 to +129
if config.RunnerGuard && !config.NoEmit {
if err := ctx.Err(); err != nil {
return err
}
workflowDir := opts.workflowDir
if workflowDir == "" && len(opts.lockFilesForDirTools) > 0 {
workflowDir = filepath.Dir(opts.lockFilesForDirTools[0])
}
err := runBatchDirectoryTool("runner-guard", workflowDir, config.Verbose && !config.JSONOutput, config.Strict, runBatchRunnerGuardOnDirectory)
err = opts.recordResult("runner-guard", len(opts.lockFilesForDirTools), err)
if err != nil {
if config.Strict && firstErr == nil {
firstErr = err
}
}
}
run: bash "${RUNNER_TEMP}/gh-aw/actions/install_awf_binary.sh" v0.29.20 --rootless
- name: Install Claude Code CLI
run: npm install -g @anthropic-ai/claude-code@2.1.331
run: npm install -g @anthropic-ai/claude-code@2.1.325
Comment on lines +62 to +64
if resolve && len(*stage.results) == 0 {
appendMCPCachedModelInventoryWarning(stage.config, &result.validationResult)
}
stage.workflows = append(stage.workflows, result.workflowData)
stage.resultIndexes = append(stage.resultIndexes, len(*stage.results))
}
if stage.config.NoEmit || result.lockFile == "" {
@github-actions

Copy link
Copy Markdown
Contributor

🛠️ Agentic Maintenance updated this pull request branch.

View workflow run

compileOrchestrationLog.Printf("Failed to format MCP compile progress: %v", err)
return
}
if err := writeSensitiveFile(progressPath, []byte(output)); err != nil {
@pelikhan
pelikhan merged commit 3232d35 into main Nov 24, 2026
17 of 18 checks passed
@pelikhan
pelikhan deleted the copilot/file-diet-refactor-compile-pipeline-again branch November 24, 2026 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[file-diet] Refactor pkg/cli/compile_pipeline.go (1162 lines)

5 participants