Skip to content

Conversation

@cussrox
Copy link
Contributor

@cussrox cussrox commented Oct 5, 2025

No description provided.

@codecov
Copy link

codecov bot commented Oct 5, 2025

Codecov Report

❌ Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 72.22%. Comparing base (a3d8329) to head (7b8bbdc).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
cmd/jsoncompact/main.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master      #23       +/-   ##
===========================================
- Coverage   85.00%   72.22%   -12.78%     
===========================================
  Files           4        5        +1     
  Lines         280      504      +224     
===========================================
+ Hits          238      364      +126     
- Misses         23      121       +98     
  Partials       19       19               
Flag Coverage Δ
unittests 72.22% <50.00%> (-12.78%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vearutop vearutop merged commit 196f7bd into swaggest:master Oct 5, 2025
6 of 8 checks passed
Copy link

@llamapreview llamapreview bot left a comment

Choose a reason for hiding this comment

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

AI Code Review by LlamaPReview

🎯 TL;DR & Recommendation

Recommendation: Request Changes

This PR updates CI workflows but introduces critical risks: test coverage analysis now depends on GitHub API which may fail, and release tooling uses non-deterministic Go versions leading to inconsistent results.

🌟 Strengths

  • Updates dependencies and linter configurations to newer versions.
  • Maintains test success across multiple Go versions.
Priority File Category Impact Summary Anchors
P1 .github/workflows/test-unit.yml Testing Test coverage depends on GitHub API, may fail method:gocovdiff search:pull_request.diff
P1 .github/workflows/gorelease.yml Architecture Non-deterministic Go version in release tooling constant:GO_VERSION search:stable
P2 .github/workflows/release-assets.yml Architecture Debug binaries uploaded without build clarity search:linux_amd64_dbg method:upload-release-asset
P2 .golangci.yml Maintainability Linter config may introduce noise and maintenance burden
P2 equal.go Maintainability Uses deprecated bytes.Replace instead of ReplaceAll method:bytes.Replace search:gocritic,staticcheck
P2 cmd/jsoncompact/main.go Maintainability Blanket nolint directive could hide issues method:fmt.Fprintln search:nolint

🔍 Notable Themes

  • Multiple CI workflow changes introduce external dependencies and non-deterministic behavior, increasing failure risks.
  • Maintainability issues with linter configurations and directives could lead to technical debt and hidden problems.

📈 Risk Diagram

This diagram illustrates the new test coverage analysis flow and its dependency on GitHub API.

sequenceDiagram
    participant CI as CI System
    participant GA as GitHub API
    participant GC as gocovdiff Tool
    CI->>GA: Fetch PR diff (with token)
    GA-->>CI: Return diff or error
    CI->>GC: Analyze coverage with diff file
    GC-->>CI: Coverage report
    note over CI,GA: R1(P1): Dependency on GitHub API may fail due to rate limits or permissions
Loading

💡 Have feedback? We'd love to hear it in our GitHub Discussions.
✨ This review was generated by LlamaPReview Advanced, which is free for all open-source projects. Learn more.

Comment on lines +80 to +85
curl -sLO https://github.com/vearutop/gocovdiff/releases/download/v1.4.2/linux_amd64.tar.gz && tar xf linux_amd64.tar.gz && rm linux_amd64.tar.gz
gocovdiff_hash=$(git hash-object ./gocovdiff)
[ "$gocovdiff_hash" == "8e507e0d671d4d6dfb3612309b72b163492f28eb" ] || (echo "::error::unexpected hash for gocovdiff, possible tampering: $gocovdiff_hash" && exit 1)
git fetch origin master ${{ github.event.pull_request.base.sha }}
REP=$(./gocovdiff -cov unit.coverprofile -gha-annotations gha-unit.txt -delta-cov-file delta-cov-unit.txt -target-delta-cov ${TARGET_DELTA_COV})
[ "$gocovdiff_hash" == "c37862c73a677e5a9c069470287823ab5bbf0244" ] || (echo "::error::unexpected hash for gocovdiff, possible tampering: $gocovdiff_hash" && exit 1)
# Fetch PR diff from GitHub API.
curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -H "Accept: application/vnd.github.v3.diff" https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }} > pull_request.diff
REP=$(./gocovdiff -diff pull_request.diff -mod github.com/$GITHUB_REPOSITORY -cov unit.coverprofile -gha-annotations gha-unit.txt -delta-cov-file delta-cov-unit.txt -target-delta-cov ${TARGET_DELTA_COV})
Copy link

Choose a reason for hiding this comment

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

P1 | Confidence: High

The test coverage analysis now fetches PR diff via GitHub API instead of using git fetch, which changes the fundamental approach to determining code changes. This introduces a dependency on GitHub API rate limits and authentication that wasn't present before. The new method may fail if the GitHub token lacks permissions or if API limits are exceeded, potentially breaking the coverage analysis workflow. The removal of git fetch also means the analysis no longer has access to the actual base commit files, which could lead to inaccurate coverage calculations.

Comment on lines +12 to 20
GO_VERSION: stable
jobs:
gorelease:
runs-on: ubuntu-latest
steps:
- name: Install Go stable
if: env.GO_VERSION != 'tip'
uses: actions/setup-go@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
Copy link

Choose a reason for hiding this comment

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

P1 | Confidence: High

The change replaces specific Go version pinning (1.20.x) with 'stable', which introduces non-deterministic build behavior. This could cause the gorelease tool to analyze the code against different Go versions over time, potentially leading to inconsistent API compatibility reports. For a release tooling workflow, deterministic behavior is critical to ensure consistent analysis results across different runs.

Suggested change
GO_VERSION: stable
jobs:
gorelease:
runs-on: ubuntu-latest
steps:
- name: Install Go stable
if: env.GO_VERSION != 'tip'
uses: actions/setup-go@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
env:
GO_VERSION: 1.21.x # Pin to a specific supported version

Evidence: constant:GO_VERSION, search:stable

}

expected = bytes.Replace(expected, []byte(`"`+k+`"`), j, -1) //nolint:gocritic // To support go1.11.
expected = bytes.Replace(expected, []byte(`"`+k+`"`), j, -1) //nolint:gocritic,staticcheck // To support go1.11.
Copy link

Choose a reason for hiding this comment

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

P2 | Confidence: High

The added staticcheck nolint directive suppresses a legitimate lint warning about using deprecated functionality (bytes.Replace with -1 count). Since the project now uses Go 1.17+ (per go.mod), this should be updated to use bytes.ReplaceAll() for better clarity and forward compatibility, as the current approach relies on deprecated behavior.

Suggested change
expected = bytes.Replace(expected, []byte(`"`+k+`"`), j, -1) //nolint:gocritic,staticcheck // To support go1.11.
expected = bytes.ReplaceAll(expected, []byte(`"`+k+`"`), j)

Evidence: method:bytes.Replace, search:gocritic,staticcheck

input = flag.Arg(0)
if input == "" {
_, _ = fmt.Fprintln(flag.CommandLine.Output(), "Missing input path argument, use `-` for stdin.")
_, _ = fmt.Fprintln(flag.CommandLine.Output(), "Missing input path argument, use `-` for stdin.") //nolint
Copy link

Choose a reason for hiding this comment

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

P2 | Confidence: High

The blanket nolint directive suppresses all linter warnings without specifying which linter or warning is being ignored. This makes the code harder to maintain and could hide legitimate issues. Specific linters should be named in the nolint directive to ensure only intended warnings are suppressed.

Suggested change
_, _ = fmt.Fprintln(flag.CommandLine.Output(), "Missing input path argument, use `-` for stdin.") //nolint
_, _ = fmt.Fprintln(flag.CommandLine.Output(), "Missing input path argument, use `-` for stdin.") //nolint:errcheck

Evidence: method:fmt.Fprintln, search:nolint

Comment on lines +34 to +41
- name: Upload linux_amd64_dbg.tar.gz
if: hashFiles('linux_amd64_dbg.tar.gz') != ''
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./linux_amd64_dbg.tar.gz
asset_name: linux_amd64_dbg.tar.gz
asset_content_type: application/tar+gzip
Copy link

Choose a reason for hiding this comment

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

P2 | Confidence: Medium

Speculative: The addition of debug binary uploads suggests the build process now generates debug artifacts, but there's no corresponding change in the Makefile to show how these are built. Without seeing the build configuration changes, it's unclear if debug symbols are properly stripped from release binaries or if debug builds follow security best practices (e.g., not including sensitive information).

Comment on lines 5 to +10
linters:
enable-all: true
default: all
disable:
- nilnil
- tparallel
- goerr113
- err113
Copy link

Choose a reason for hiding this comment

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

P2 | Confidence: Medium

The linter configuration switches from enabling specific linters to enabling all and then disabling many. This approach may catch more issues but could introduce noise from linters not suited to this codebase. The extensive disable list (28+ linters) suggests the 'enable all' approach might not be optimal for this project's coding style and could make the configuration harder to maintain.

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.

2 participants