Skip to content

feat(#375): external-analyzer CI support for the reusable workflow and gaze init --ci - #422

Merged
jflowers merged 5 commits into
unbound-force:mainfrom
jflowers:opsx/ci-external-analyzer-support
Nov 26, 2026
Merged

jflowers merged 5 commits into
unbound-force:mainfrom
jflowers:opsx/ci-external-analyzer-support

Conversation

@jflowers

Copy link
Copy Markdown
Collaborator

Summary

External-analyzer CI support for the reusable gaze AI-report workflow and gaze init --ci, so non-Go repositories run the same CI quality-report pipeline as Go projects.

The reusable workflow (.github/workflows/reusable_gaze_ai_report.yml) gains six optional workflow_call inputs — analyzer, language, packages, setup, node-version, and python-version — with Go-preserving defaults: conditional toolchain setup steps, an env-indirected analyzer-install snippet, conditional --analyzer/--language argument assembly (coverprofile dropped in analyzer mode, positional packages argument), and a skipped-report path that validates coverage-artifact arrival in both modes.

gaze init --ci now detects package.json and pyproject.toml (go.mod still wins) and scaffolds ready-to-run Node and Python caller workflows: quoted toolchain pins (Node 24 LTS / Python 3.12), lockfile-backed installs, coverage staging that survives upload-artifact least-common-ancestor stripping (Node), if-no-files-found: error on uploads, and analyzer installation in the report job via the setup input.

Tests cover variant detection, golden files rendered through the production seam, YAML structure, pin parity with the reusable workflow, end-to-end scaffolding, and the full workflow input/step/step-order contract.

Closes #375

Note: this branch is 1 commit behind main — no rebase was performed, to preserve the council-reviewed commits as pushed. It merges without conflict; the behind count is informational.

How to Test

Full CI-parity suite:

go build ./... && go test -race -count=1 -short ./... && golangci-lint run

Focused tests for this change:

go test -race -count=1 -run 'TestRun_CI|TestRenderCIWorkflowTemplate|TestDetectCIVariant|TestCIWorkflow_' ./internal/scaffold/ ./cmd/gaze/.

YAML lint on the workflow, templates, and goldens:

PYENV_VERSION=3.10.19 yamllint -c .yamllint.yml \
  .github/workflows/reusable_gaze_ai_report.yml \
  internal/scaffold/assets/ci/*.yml \
  internal/scaffold/testdata/golden-gaze-ai-report*.yml

How to Demo

Manual end-to-end scaffolding — in a temp dir containing only a package.json:

go run ./cmd/gaze init --ci

Then inspect the generated .github/workflows/gaze-ai-report.yml: it sets up Node 24, runs npm ci, stages the coverage upload so upload-artifact's least-common-ancestor stripping cannot drop it, passes analyzer/packages/node-version/setup inputs to the reusable workflow, and leaves thresholds commented out for later calibration.

Key Files Changed

File Change
.github/workflows/reusable_gaze_ai_report.yml Six optional analyzer inputs, conditional toolchain/setup steps, analyzer-mode argument assembly
internal/scaffold/scaffold.go gaze init --ci variant detection (go.mod, package.json, pyproject.toml) and Node/Python template rendering
internal/scaffold/assets/ci/gaze-ai-report-node.yml New Node caller workflow template
internal/scaffold/assets/ci/gaze-ai-report-python.yml New Python caller workflow template
internal/scaffold/ci_test.go Variant detection, golden rendering, YAML structure, pin-parity tests
cmd/gaze/ci_workflow_test.go Reusable-workflow input/step/step-order contract tests
cmd/gaze/main.go CLI wiring for the new variants
docs/guides/ci-integration.md, docs/reference/cli/init.md, README.md Consumer documentation for analyzer-mode CI
openspec/changes/ci-external-analyzer-support/ Proposal, design, delta specs, and tasks

17 files changed, +2065 / −80.

Known Issues

The review council returned APPROVE WITH ADVISORIES after 4 iterations; the remaining advisories are all LOW severity and deferred with durable follow-up handles:


This PR was generated by /uf.finale (AI-assisted).

…lt, single renderer seam, step-order pins

- defaultNodeVersion 20 → 24 (Node 20 reached EOL 2026-04-30); golden,
  docs, and test pins updated together, EOL currency note added
- delete the now test-only renderCIWorkflowTemplate; Go golden and
  structure tests render through renderCIWorkflowTemplateForVariant,
  the same seam the write path uses for every variant
- placeholder-residue check is now a generic dunder-token scan, so a
  cross-variant placeholder cannot vanish via empty substitution
- pin Set up Python with.python-version passthrough (Node already had it)
- assert the gaze-ai-report job's step order: toolchains < Setup
  analyzer < Run gaze AI report < Report skipped, Download coverage
  before both report steps (release_workflow_test.go gate-order
  precedent)
- Python template upload sets if-no-files-found: error so a missing
  coverage.xml fails at the cause, not downstream
- printCISkipWarning names all three recognized markers instead of
  prescribing go mod init to non-Go users
- document detectCIVariant's deliberate Stat-error semantics
- design.md records the analyzer-mode execution residual risk
…n inputs, pin guards and exits, follow-up issues

- complete the Node 24 doc sweep missed spots: reusable workflow input
  description, ci-integration inputs table, init.md fixed-versions
  bullet, design.md D5 and proposal.md narrative (all said 20)
- quote the with-block version placeholders in both templates
  (node-version: "24", python-version: "3.12") — unquoted values are
  YAML integer/float scalars feeding type: string inputs, and a hand
  edit of 3.10 parses as float 3.1; goldens and docs examples updated
- Node template upload sets if-no-files-found: error: the staging
  mkdir -p still creates .gaze-artifact when coverage/ is empty, so
  the upload must fail loudly instead of deferring to the download
- pin the assembly guards (if [ -n "$ANALYZER" ] / $LANGUAGE) and
  the enforcement pairings (::error:: message + exit 1) in the
  reusable-workflow contract test — detection without enforcement is
  the ci-gate-integrity failure class (unbound-force#101/unbound-force#108/unbound-force#116)
- pin the skip warning's three-marker phrase so the remedy text
  cannot regress to Go-only guidance
- deepen the python and go-mod-wins e2e subtests to assert the same
  Created-list reporting contract as the node subtest
- docs: external-analyzers example pins @v2.6.0 and states the
  input-surface requirement (older tags fail at workflow load)
- follow-up issues filed: unbound-force#419 (variant pin floor), unbound-force#420
  (analyzer-mode canary)
@jflowers
jflowers enabled auto-merge (rebase) November 26, 2026 22:30

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

Council Review: APPROVE WITH ADVISORIES

8/8 reviewers succeeded (7 APPROVE, 1 APPROVE WITH ADVISORIES). No CRITICAL or HIGH findings; 3 LOW advisories, all from the SRE reviewer.

Findings (all LOW — advisory, non-blocking)

  1. Node template assumes an npm lockfile — internal/scaffold/assets/ci/gaze-ai-report-node.yml:48. npm ci requires a committed package-lock.json; variant detection keys only on package.json, so pnpm/yarn/bun projects scaffold a workflow whose first install step fails. The file is user-owned/editable and the npm error is actionable.
  2. Python template installs unpinned test tooling — internal/scaffold/assets/ci/gaze-ai-report-python.yml:48. pip install pytest pytest-cov floats to latest, diverging from the Go (go.mod) and Node (lockfile) variants; an upstream major release can break a consumer's scaffolded CI with no local change.
  3. Analyzer-mode path has no CI execution — .github/workflows/reusable_gaze_ai_report.yml:194. The dogfood job exercises Go mode only; verification is static contract tests. Tracked by #420 (analyzer-mode canary).

CI Status

All checks pass: CI OK (aggregate), Unit + Integration (Go 1.24/1.25), E2E (Go 1.24/1.25), MegaLinter, Gaze AI Report; Gitleaks/Auto-merge skipped as expected for a code PR.

Pre-flight

ci-aware mode: go test, golangci-lint, yamllint all covered by passing CI checks — no local execution needed. Verdict PASS.

This review was generated by /uf.review-pr (AI-assisted).

@jflowers
jflowers merged commit f75c0ea into unbound-force:main Nov 26, 2026
11 checks passed
@jflowers
jflowers deleted the opsx/ci-external-analyzer-support branch November 26, 2026 23:39
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.

feat: CI support for external analyzers (non-Go repos) in the reusable AI-report workflow and gaze init --ci

2 participants