Skip to content

feat: add 4 agentic code quality workflows - #2417

Merged
lpcox merged 5 commits into
mainfrom
copilot/continuous-code-quality-refactor
May 3, 2026
Merged

feat: add 4 agentic code quality workflows#2417
lpcox merged 5 commits into
mainfrom
copilot/continuous-code-quality-refactor

Conversation

Copilot AI commented May 3, 2026

Copy link
Copy Markdown
Contributor

As src/docker-manager.ts (3,900+ lines), src/cli.ts (1,700+ lines), and related files grow, duplication, dead exports, and coverage gaps accumulate silently. This adds four scheduled agentic workflows to catch these issues continuously.

New workflows

  • duplicate-code-detector.md — Daily + on-demand. Runs jscpd + grep-based pattern analysis across src/**/*.ts and containers/**/*.js. Files issues with side-by-side evidence and concrete extraction suggestions (≤5 issues/run, expires 30d).

  • test-coverage-reporter.md — Daily + on push to main. Runs npm run test:coverage, builds a per-file table, and separately flags security-critical paths (host-iptables.ts, squid-config.ts, domain-patterns.ts). Posts a GitHub Discussion with trends and prioritized recommendations. Complements the existing test-coverage-improver (which writes tests); this one reports only.

  • refactoring-scanner.md — Daily + on-demand. Classifies files by line count (>2,000 = must split), analyzes logical sections in oversized files for mixed responsibilities, and flags deeply nested / overly long functions. Files issues with proposed split plans (≤5/run, expires 60d).

  • export-audit.md — On push to main + on-demand. Uses ts-prune + grep to find unused exports, validates naming conventions (PascalCase types, camelCase functions), runs madge for circular deps, and checks test import paths. Files issues with specific symbol names and recommended fixes (≤5/run, expires 30d).

Design notes

All four workflows use read-only permissions; write operations go through safe-outputs. Each checks for existing open issues/discussions before creating new ones to stay idempotent. All compiled to .lock.yml via gh aw compile + postprocess-smoke-workflows.ts.

Copilot AI added 2 commits May 3, 2026 01:15
- duplicate-code-detector.md: weekly scan for near-duplicate code blocks,
  files issues for high-impact deduplication opportunities
- test-coverage-reporter.md: weekly + on push to main, reports coverage
  trends as GitHub Discussions
- refactoring-scanner.md: weekly scan for oversized/mixed-responsibility
  files, files refactoring issues
- export-audit.md: on push to main, detects unused exports, naming
  inconsistencies, circular deps, wrong test imports

All compiled to .lock.yml via gh aw compile and post-processed.

Agent-Logs-Url: https://github.com/github/gh-aw-firewall/sessions/28e98601-c6b6-425c-9141-a0d0c455ec04
Copilot AI changed the title [WIP] Refactor codebase for improved quality and test coverage feat: add 4 agentic code quality workflows May 3, 2026
Copilot AI requested a review from lpcox May 3, 2026 01:18
Copilot finished work on behalf of lpcox May 3, 2026 01:18
@github-actions

This comment has been minimized.

@lpcox
lpcox marked this pull request as ready for review May 3, 2026 02:19
@lpcox
lpcox requested a review from Mossaka as a code owner May 3, 2026 02:19
Copilot AI review requested due to automatic review settings May 3, 2026 02:19
@github-actions

github-actions Bot commented May 3, 2026

Copy link
Copy Markdown
Contributor

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 85.76% 85.84% 📈 +0.08%
Statements 85.64% 85.72% 📈 +0.08%
Functions 88.11% 88.11% ➡️ +0.00%
Branches 78.65% 78.69% 📈 +0.04%
📁 Per-file Coverage Changes (1 files)
File Lines (Before → After) Statements (Before → After)
src/docker-manager.ts 87.4% → 87.7% (+0.29%) 87.0% → 87.3% (+0.27%)

Coverage comparison generated by scripts/ci/compare-coverage.ts

@lpcox

lpcox commented May 3, 2026

Copy link
Copy Markdown
Collaborator

@copilot update duplicate-code-detector.md, refactoring-scanner.md, and test-coverage-reporter.md to run on a daily basis

…age-reporter to daily schedule

Agent-Logs-Url: https://github.com/github/gh-aw-firewall/sessions/6bcb659e-1e94-4f2d-9d14-4071b8c26f60

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>

Copilot AI commented May 3, 2026

Copy link
Copy Markdown
Contributor Author

@copilot update duplicate-code-detector.md, refactoring-scanner.md, and test-coverage-reporter.md to run on a daily basis

Done in f866d3c. duplicate-code-detector, refactoring-scanner, and test-coverage-reporter all now run on a daily schedule (the lock files show cron expressions that fire once per day).

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/actions/github-script/git/ref/tags/v9
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v9 --jq [.object.sha, .object.type] | @tsv (http block)

If you need me to access, download, or install something from one of these locations, you can either:

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

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

Adds four new agentic code-quality workflows to continuously surface duplication, refactoring candidates, unused exports/cycles, and coverage regressions as the TypeScript + container JS codebase grows.

Changes:

  • Introduces scheduled/on-demand workflows for duplicate detection, refactoring scanning, export auditing, and coverage reporting.
  • Adds corresponding compiled .lock.yml workflow files for each new workflow.
Show a summary per file
File Description
.github/workflows/test-coverage-reporter.md New workflow definition + prompt for generating a coverage trend discussion.
.github/workflows/test-coverage-reporter.lock.yml Compiled/locked GitHub Actions workflow for coverage reporter.
.github/workflows/refactoring-scanner.md New workflow definition + prompt for identifying refactoring candidates.
.github/workflows/refactoring-scanner.lock.yml Compiled/locked workflow for refactoring scanner.
.github/workflows/export-audit.md New workflow definition + prompt for unused exports / naming / circular deps audit.
.github/workflows/export-audit.lock.yml Compiled/locked workflow for export audit.
.github/workflows/duplicate-code-detector.md New workflow definition + prompt for jscpd + pattern-based duplication scanning.
.github/workflows/duplicate-code-detector.lock.yml Compiled/locked workflow for duplicate-code detector.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 8/8 changed files
  • Comments generated: 11

Comment thread .github/workflows/export-audit.md Outdated
description: |
Workflow triggered on every push to main that audits the TypeScript and JavaScript
surface of the codebase: unused exports, inconsistent naming conventions, circular
dependencies, and test files importing from incorrect modules. files actionable issues
description: |
Daily workflow that scans the codebase for duplicate and near-duplicate code blocks,
copy-paste patterns, and repeated logic sequences in TypeScript source and JavaScript
container code. files actionable issues for high-impact deduplication opportunities
Comment on lines +19 to +27
network:
allowed:
- node

tools:
github:
toolsets: [issues]
bash: true

Comment thread .github/workflows/export-audit.md Outdated
Comment on lines +42 to +46
run: npm ci 2>&1 | tail -5

- name: Build TypeScript
id: build
run: npm run build 2>&1 | tail -10
Comment thread .github/workflows/export-audit.md Outdated
Comment on lines +54 to +56
grep -rn "^export\s\+\(function\|class\|const\|let\|var\|type\|interface\|enum\)" src/ --include="*.ts" | \
grep -v "\.test\.ts" | \
sed 's|.*export\s\+\(function\|class\|const\|let\|var\|type\|interface\|enum\)\s\+\([a-zA-Z_][a-zA-Z0-9_]*\).*|\2|' | \
Comment on lines +44 to +51
run: npm ci 2>&1 | tail -5

- name: Build
run: npm run build 2>&1 | tail -5

- name: Run coverage
id: coverage
run: npm run test:coverage 2>&1 | tail -20
Comment on lines +28 to +31
tools:
github:
toolsets: [repos, actions]
bash: true
Comment on lines +20 to +27
network:
allowed:
- node

tools:
github:
toolsets: [issues]
bash: true
echo "FUNCTION_COUNTS<<EOF"
for f in src/*.ts; do
[ -f "$f" ] || continue
count=$(grep -c "^\s*\(export \)\?\(async \)\?function\|^\s*\(export \)\?const [a-zA-Z].*=\s*\(async \)\?(" "$f" 2>/dev/null || echo 0)
Comment on lines +19 to +27
network:
allowed:
- node

tools:
github:
toolsets: [issues]
bash: true

@lpcox

lpcox commented May 3, 2026

Copy link
Copy Markdown
Collaborator

@copilot address the review feedback on .md files. ignore any feedback on .lock.yml files

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Copilot AI commented May 3, 2026

Copy link
Copy Markdown
Contributor Author

@copilot address the review feedback on .md files. ignore any feedback on .lock.yml files

Done in b12804a. Changes made to the .md files (lock files regenerated automatically):

  • Grammar: Capitalised Files after the full stop in descriptions of duplicate-code-detector, refactoring-scanner, and export-audit
  • Network: Added github to network.allowed in duplicate-code-detector, refactoring-scanner, and export-audit so GitHub API calls for issue creation succeed
  • set -o pipefail: Added to all piped npm ...| tail commands in export-audit and test-coverage-reporter so npm failures are no longer masked
  • \s[[:space:]]: Fixed non-portable whitespace class in grep/sed steps in export-audit and refactoring-scanner
  • discussions toolset: Added toolsets: [discussions] and discussions: read permission to test-coverage-reporter so it can check for existing discussions before creating new ones
  • Stale description: Fixed "Runs weekly on a schedule" → "Runs daily on a schedule" in test-coverage-reporter

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/actions/github-script/git/ref/tags/v9
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v9 --jq [.object.sha, .object.type] | @tsv (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot finished work on behalf of lpcox May 3, 2026 02:29
@github-actions

This comment has been minimized.

@github-actions

github-actions Bot commented May 3, 2026

Copy link
Copy Markdown
Contributor

Smoke Test Results:

✅ GitHub MCP: #2401, #2398
✅ Playwright: github.com page loaded
✅ File Writing: smoke-test-claude-25267744263.txt created
✅ Bash Tool: Verified

Status: PASS

💥 [THE END] — Illustrated by Smoke Claude

@github-actions

This comment has been minimized.

@github-actions

github-actions Bot commented May 3, 2026

Copy link
Copy Markdown
Contributor

PR titles:

  • unavailable: GitHub MCP/safeinputs-gh not available
  • unavailable: GitHub MCP/safeinputs-gh not available
    GitHub MCP review ❌
    safeinputs-gh PR query ❌
    Playwright title ✅
    Tavily search ❌
    File write/read ✅
    Build AWF ✅
    Discussion comment ❌
    Overall: FAIL

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • registry.npmjs.org

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "registry.npmjs.org"

See Network Configuration for more information.

🔮 The oracle has spoken through Smoke Codex

@github-actions

github-actions Bot commented May 3, 2026

Copy link
Copy Markdown
Contributor

🏗️ Build Test Suite Results

Ecosystem Project Build/Install Tests Status
Bun elysia 1/1 passed ✅ PASS
Bun hono 1/1 passed ✅ PASS
C++ fmt N/A ✅ PASS
C++ json N/A ✅ PASS
Deno oak N/A 1/1 passed ✅ PASS
Deno std N/A 1/1 passed ✅ PASS
.NET hello-world N/A ✅ PASS
.NET json-parse N/A ✅ PASS
Go color 1/1 passed ✅ PASS
Go env 1/1 passed ✅ PASS
Go uuid 1/1 passed ✅ PASS
Java gson 1/1 passed ✅ PASS
Java caffeine 1/1 passed ✅ PASS
Node.js clsx passed ✅ PASS
Node.js execa passed ✅ PASS
Node.js p-limit passed ✅ PASS
Rust fd 1/1 passed ✅ PASS
Rust zoxide 1/1 passed ✅ PASS

Overall: 8/8 ecosystems passed — ✅ PASS

Generated by Build Test Suite for issue #2417 · ● 493.8K ·

@github-actions

github-actions Bot commented May 3, 2026

Copy link
Copy Markdown
Contributor

Smoke Test Results — Services Connectivity

Check Result
Redis PING ❌ Timeout (no response)
PostgreSQL pg_isready ❌ No response
PostgreSQL SELECT 1 ❌ No response

Overall: FAIL

host.docker.internal is not reachable from this runner environment — service containers appear unavailable or the hostname does not resolve to an accessible address.

🔌 Service connectivity validated by Smoke Services

@lpcox
lpcox enabled auto-merge (squash) May 3, 2026 03:47
@lpcox
lpcox disabled auto-merge May 3, 2026 03:48
@lpcox
lpcox merged commit d525132 into main May 3, 2026
61 of 65 checks passed
@lpcox
lpcox deleted the copilot/continuous-code-quality-refactor branch May 3, 2026 03:48
@github-actions

github-actions Bot commented May 3, 2026

Copy link
Copy Markdown
Contributor

🔬 Smoke Test Results

Test Status
GitHub MCP (list PRs)
GitHub.com connectivity (HTTP)
File write/read ❌ (template vars not expanded)

Overall: FAIL — pre-step template variables ($\{\{ steps.smoke-data.outputs.* }}) were not substituted; file test could not be verified.

PR: "feat: add 4 agentic code quality workflows" — author @Copilot, assignees @lpcox @Copilot

📰 BREAKING: Report filed by Smoke Copilot

@github-actions

github-actions Bot commented May 3, 2026

Copy link
Copy Markdown
Contributor

Smoke Test: Copilot BYOK (Offline) Mode

Test Result
GitHub MCP (list PRs) ✅ PR #2417 returned
GitHub.com connectivity ⚠️ Pre-step data unavailable (template not expanded)
File write/read ⚠️ Pre-step data unavailable (template not expanded)
BYOK inference (agent → api-proxy → api.githubcopilot.com) ✅ Responding now

Running in BYOK offline mode (COPILOT_OFFLINE=true) via api-proxy → api.githubcopilot.com.

Author: @Copilot · Assignees: @lpcox, @Copilot

Overall: PASS (core BYOK path verified ✅)

🔑 BYOK report filed by Smoke Copilot BYOK

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.

Continuous code quality: agentic workflows for refactoring, deduplication, and test coverage

3 participants