Skip to content

Split audit report implementation into focused files - #76622

Merged
pelikhan merged 5 commits into
mainfrom
copilot/file-diet-refactor-audit-report
Nov 11, 2026
Merged

pelikhan merged 5 commits into
mainfrom
copilot/file-diet-refactor-audit-report

Conversation

Copilot AI commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

pkg/cli/audit_report.go had grown to 1,201 lines, combining report types, data assembly, file extraction, and step-log error scanning.

  • Types: Move report data types and MCPToolSummary sync methods into audit_report_types.go.
  • File extraction: Move file and manifest helpers into audit_report_files.go.
  • Step errors: Move step-log scanning and error extraction into audit_step_errors.go.
  • Audit assembly: Keep data assembly and audit-building logic in audit_report.go.

Copilot AI linked an issue Nov 10, 2026 that may be closed by this pull request
1 of 5 tasks
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor pkg/cli/audit_report.go for improved structure Split audit report implementation into focused files Nov 10, 2026
Copilot AI requested a review from gh-aw-bot November 10, 2026 22:27
return []ValidationIssue{{
Type: "agent_failure",
File: "agent-stdio.log",
Message: agentExcerpt,
@pelikhan
pelikhan marked this pull request as ready for review November 10, 2026 23:21
Copilot AI dynamic review requested due to automatic review settings November 10, 2026 23:21
@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Specification Reviewer completed successfully!

PR Specification 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 PR Specification Reviewer · gpt56 · ~3 AIC · ⌖ ~1 AIC · ◇ ~1 AIC · ⊞ 1.6K · ◷

Generated by PR Specification Reviewer for #76622

@github-actions

github-actions Bot commented Nov 10, 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 Nov 10, 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 · routed: gpt61 medium · ~4 AIC · ⌖ ~1 AIC · ◇ ~1 AIC · ⊞ 181 · ◷

Generated by Ponytail Reviewer for #76622

@github-actions

This comment has been minimized.

@github-actions

github-actions Bot commented Nov 10, 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 Nov 10, 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 · routed: haiku55 xhigh · ~2 AIC · ⌖ ~2 AIC · ◇ ~1 AIC · ⊞ 7.2K · ◷

🧪 Test quality analysis by Test Quality Sentinel

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

Reviewed the refactor diff. I found no new actionable correctness, performance, or maintainability issues in the changed lines. The existing sensitive-log disclosure concern is already present in the moved implementation and is covered by the existing review comment; I did not duplicate it. The specialist pass was unavailable because its file-read attempt was rejected by tool permissions, so this verdict is based on the independent diff review.

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

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.

🟢 Approval recommended

No active review issues are identified for this focused refactor, which is described as preserving the existing package API and behavior.

No open issues 🎉

What changed in this PR

Refactors the audit report implementation into focused files while preserving the existing package API and behavior.

Changes:

  • Moved audit report data structures and MCP summary synchronization methods into audit_report_types.go.
  • Moved file, manifest, and duration helpers into audit_report_files.go.
  • Moved workflow step-log scanning and error extraction into audit_step_errors.go.
  • Retained audit assembly and report-building logic in audit_report.go.
File Description
pkg/​cli/​audit_step_errors.go Contains workflow step-log scanning and failure-message extraction helpers.
pkg/​cli/​audit_report.go Retains audit data assembly and report-building logic after the refactor.
pkg/​cli/​audit_report_types.go Contains audit report data models and MCP tool summary synchronization methods.
pkg/​cli/​audit_report_files.go Contains downloaded-file, manifest, file-description, and duration helpers.

Review effort: Lite (auto)

@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/76622-split-audit-report-into-focused-files.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 this branch. It was generated from the PR diff and linked issue [file-diet] Refactor pkg/cli/audit_report.go (1201 lines) #76514.

  2. Complete the missing sections. Confirm the Deciders field and replace the [TODO: verify] markers in the alternatives rationale.

  3. Commit the finalized ADR to docs/adr/ on this branch.

  4. Reference the ADR in this PR body by adding a line such as:

    ADR: ADR-76622: Split Audit Report Implementation into Focused Files (link unavailable: invalid HTTPS URL)

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

i️ Why this gate fired

The volume check counts added lines in business-logic directories such as pkg/: 894 lines across four files. Most of them are relocated code. After whitespace normalization, every removed line from pkg/cli/audit_report.go reappears in the new files. If a maintainer judges this pure file split to be non-architectural, they can say so on this PR. The gate rules themselves are unchanged.

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · pi · routed: haiku55 xhigh · ~3 AIC · ⌖ ~2 AIC · ⊞ 8.5K · ◷
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 /codebase-design and /tdd to a pure file split. Approving, with one optional navigability nit inline.

📋 Key Themes & Highlights

Verification

  • The removed and added lines match as multisets. The only net additions are blank lines, import blocks, and package headers, so the move is verbatim.
  • go build ./pkg/cli/ passes, and the changed files are gofmt-clean.
  • Targeted audit tests (go test ./pkg/cli/ -run Audit|ExtractAgent|...) pass.

Positive Highlights

  • ✅ Responsibilities are split along clear seams: types, file extraction, and step-error scanning.
  • ✅ audit_report.go drops from 1,201 lines to about 330.

Notes

  • The shared ghaLogTimestampPrefixPattern now lives in audit_step_errors.go, but audit_engine_steps.go also uses it. See the inline comment.
  • The bot-flagged excerpt disclosure concern at audit_step_errors.go:241 is pre-existing logic that moved here unchanged. It is not a regression from this PR.

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

Comment thread pkg/cli/audit_step_errors.go Outdated
"github.com/github/gh-aw/pkg/stringutil"
)

var ghaLogTimestampPrefixPattern = regexp.MustCompile(`^\d{4}-\d{2}-\d{2}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.

[/codebase-design] ghaLogTimestampPrefixPattern is declared in this file, but audit_engine_steps.go:848 also depends on it, so its owner is no longer obvious from that file.

💡 Suggested change

The pattern is a log-line parsing detail, and audit_engine_steps.go is the other consumer. Consider declaring it next to the timestamp handling in audit_engine_steps.go, or in another spot both files can find easily. This is a navigability nit. The build and targeted tests pass as-is.

@copilot please address this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved the shared pattern beside parseGHALogTimestamp in b3ea068. Focused audit tests pass.

return nil
}

content, err := os.ReadFile(lastStep.path)
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (pkg/cli/audit_step_errors.go:17): address unresolved feedback - Review comment

Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering.

Structured data
{
  "completed_task": 0,
  "head": "d52184a6004ee81ff8f63af6b7fa070b0f1bbbae",
  "kind": "requested",
  "schema_version": "1",
  "state": "3d942b756995d70df154e6d54e76f46db62f59adce04a94de1fb9bcce233b17e",
  "work": [
    "99cd77d8dd2f817f4617e172931f575171b0436c6ae47ac2d3ed5aecf94714e0"
  ],
  "workflow": "pr-sous-chef"
}

Generated by 👨🍳 PR Sous Chef · pi · routed: haiku55 xhigh · ~3 AIC · ⌖ ~2 AIC · ⊞ 6.9K · ◷
Comment /souschef to run again

Copilot AI and others added 2 commits November 11, 2026 00:47
…actor-audit-report

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

Copilot AI commented Nov 11, 2026

Copy link
Copy Markdown
Contributor Author

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:...

Merged main in d83defa and addressed the review in b3ea068. Focused tests pass; the final gate reports four pre-existing custom-linter findings in unchanged lines of audit_engine_steps.go.

@pelikhan
pelikhan merged commit 60bd49c into main Nov 11, 2026
56 checks passed
@pelikhan
pelikhan deleted the copilot/file-diet-refactor-audit-report branch November 11, 2026 02:45
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v1.2.3

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/audit_report.go (1201 lines)

5 participants