Skip to content

refactor(ci): simplify crapload workflow using gaze native baseline comparison#340

Open
gxmiranda wants to merge 2 commits into
mainfrom
opsx/simplify-crapload-gaze-native
Open

refactor(ci): simplify crapload workflow using gaze native baseline comparison#340
gxmiranda wants to merge 2 commits into
mainfrom
opsx/simplify-crapload-gaze-native

Conversation

@gxmiranda

Copy link
Copy Markdown

Summary

Replaces custom scripts/compare-crapload.sh (315 lines of bash) with gaze's native gaze crap --baseline comparison, removing ~293 net lines of code.

Closes #328

Changes

Deleted

  • scripts/compare-crapload.sh (315 lines) — all comparison logic (baseline lookup, regression detection, numeric validation, pass/fail) is now native to gaze crap --baseline

Modified

  • reusable_crapload_analysis.yml — replaced two-step pipeline (gaze report + compare-crapload.sh) with:

    • New "Configure baseline settings" step that writes a temporary .gaze.yaml from workflow inputs when consumer repo lacks one (backward compatibility for new-function-threshold and regression-epsilon)
    • gaze crap --baseline invocation for comparison with output extraction via jq
    • Inline PR comment generation via jq + heredoc (preserving <!-- crapload-analysis-marker -->)
    • Kept gaze report for supplementary quality metrics and quadrant data
    • Removed jq path normalization (gaze emits relative paths natively)
    • All 5 workflow outputs preserved with identical semantics
  • tests/test_crapload_package_resolution.py — removed TestCompareCrapload class (5 tests, 203 lines); comparison logic now covered by 34 upstream tests in gaze (compare_test.go, compare_report_test.go)

  • ci_test_crapload.yml — removed scripts/compare-crapload.sh from path triggers

  • specs/001-crapload-workflow/quickstart.md — updated baseline generation to use gaze crap --format=json; removed stale post-comment input reference

  • specs/001-crapload-workflow/data-model.md — removed baseline-lookup.tsv artifact; removed stale post-comment input; updated descriptions

Added

  • CHANGELOG.md — unreleased entry documenting the refactoring
  • openspec/changes/simplify-crapload-gaze-native/ — proposal, design, and tasks artifacts

Design Decisions

Decision Choice Rationale
Quality metrics Keep gaze report gaze crap lacks quality/quadrant data
Workflow inputs Keep + write temp .gaze.yaml Backward compat; gaze has no CLI flags for epsilon/threshold
Comment generation Inline jq + heredoc Preserves artifact contract with ci_crapload.yml
No-baseline quickstart Preserved inline UX parity with original script
Sparse checkout Unchanged Still needed for resolve-go-packages.sh

Migration

  • Consumer repos: No action required. Workflow interface (inputs, outputs, artifacts) is preserved.
  • Gaze version: Consumer repos must use a gaze version with --baseline support. The gaze-version input should specify a minimum version during transition.
  • .gaze.yaml adoption: Consumer repos can optionally commit their own .gaze.yaml to configure epsilon/threshold directly. The workflow respects existing configs.

Validation

  • yamllint passes on changed YAML files
  • ruff passes clean
  • All 95 remaining tests pass (5 TestCompareCrapload tests removed)
  • YAML syntax validated

…omparison

Replace custom scripts/compare-crapload.sh (315 lines) with gaze's
native `gaze crap --baseline` comparison. The workflow now:

- Runs `gaze crap --baseline` for per-function regression detection
- Writes a temporary .gaze.yaml from workflow inputs when the consumer
  repo has no config file (backward compatibility for epsilon/threshold)
- Generates PR comment markdown inline via jq + heredoc
- Keeps `gaze report` for supplementary quality/quadrant data

Removes TestCompareCrapload test class (5 tests, 203 lines) since the
comparison logic is now covered by 34 upstream tests in gaze itself.

Closes #328

Assisted-by: OpenCode (claude-opus-4-6)
Signed-off-by: Gustavo Miranda <[email protected]>
@gxmiranda gxmiranda requested a review from a team as a code owner June 15, 2026 11:45
@gxmiranda gxmiranda self-assigned this Jun 15, 2026
@github-actions

Copy link
Copy Markdown

CRAP Load Analysis

No Go code changes detected in this PR. No CRAP impact.

GAZE_VERSION: ${{ inputs.gaze-version }}
STATUS: ${{ steps.compare.outputs.status }}
run: |
CRAP_JSON="/tmp/crapload-current.json"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should be moved into a separate script. At a certain length/complexity actionlint will start randomly dying when attempting to review this file.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks. Fixed in new commit.

Move the inline PR comment generation (~170 lines) from
reusable_crapload_analysis.yml into scripts/generate-crapload-comment.sh
to prevent actionlint from hanging on large inline bash blocks.

The workflow now calls the external script via the existing sparse
checkout, matching the pattern used by the original compare-crapload.sh.

Assisted-by: OpenCode (claude-opus-4-6)
Signed-off-by: Gustavo Miranda <[email protected]>
@gxmiranda gxmiranda requested a review from trevor-vaughan June 15, 2026 16:48
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.

refactor: simplify crapload workflow using gaze native baseline comparison

2 participants