Skip to content

Comments

fix: build command error and incorrect rule stub#1368

Merged
hwbrzzl merged 1 commit intov1.17.xfrom
bowen/fix-build-command-and-rule-stub
Feb 3, 2026
Merged

fix: build command error and incorrect rule stub#1368
hwbrzzl merged 1 commit intov1.17.xfrom
bowen/fix-build-command-and-rule-stub

Conversation

@hwbrzzl
Copy link
Contributor

@hwbrzzl hwbrzzl commented Feb 3, 2026

Greptile Overview

Greptile Summary

This PR fixes two critical issues: a build command error and incorrect validation stub signatures.

Build Command Fix (console/console/build_command.go)

  • Fixed incorrect ldflags syntax that was missing proper quoting
  • Added -s -w flags to strip debug information and reduce binary size
  • Changed from -ldflags -extldflags -static to -ldflags "-s -w -extldflags -static"
  • The old syntax would be parsed incorrectly by the Go compiler, treating each flag as a separate argument

Validation Stub Fix (validation/console/stubs.go)

  • Updated Rule and Filter stub templates to match updated interface contracts
  • Added context.Context parameter to Passes() and Message() methods in Rule stub
  • Added context.Context parameter to Handle() method in Filter stub
  • Added missing context imports to both stubs
  • These changes ensure generated validation rules and filters match the current contracts/validation interfaces

Tests Updated (console/console/build_command_test.go)

  • All test expectations updated to reflect the corrected build command format
  • Ensures tests pass with the new ldflags syntax

Confidence Score: 5/5

  • This PR is safe to merge - fixes critical bugs with proper test coverage
  • All changes are bug fixes with corresponding test updates, no new functionality added, and both fixes address real issues (broken build command syntax and outdated stub signatures)
  • No files require special attention

Important Files Changed

Filename Overview
console/console/build_command.go Fixed ldflags syntax by adding quotes and strip flags (-s -w) for smaller binaries
console/console/build_command_test.go Updated test expectations to match corrected ldflags command format
validation/console/stubs.go Added context.Context parameter to Rule and Filter stubs to match interface contracts

Sequence Diagram

sequenceDiagram
    participant User
    participant BuildCommand
    participant generateCommand
    participant Process
    participant GoCompiler

    User->>BuildCommand: Execute build command with --static flag
    BuildCommand->>BuildCommand: Check production environment
    alt Production environment
        BuildCommand->>User: Request confirmation
        User-->>BuildCommand: Confirm
    end
    BuildCommand->>User: Prompt for target OS (if not provided)
    User-->>BuildCommand: Select OS
    BuildCommand->>generateCommand: Call with name and static=true
    generateCommand->>generateCommand: Build args array
    generateCommand->>generateCommand: Add -ldflags "-s -w -extldflags -static"
    alt name provided
        generateCommand->>generateCommand: Add -o flag with name
    end
    generateCommand-->>BuildCommand: Return command string
    BuildCommand->>Process: Set environment (CGO_ENABLED=0, GOOS, GOARCH)
    BuildCommand->>Process: Execute go build with ldflags
    Process->>GoCompiler: Run build with static linking flags
    GoCompiler-->>Process: Build result
    alt Build failed
        Process-->>BuildCommand: Return error
        BuildCommand->>User: Display error
    else Build succeeded
        Process-->>BuildCommand: Return success
        BuildCommand->>User: Display success message
    end
Loading

@hwbrzzl hwbrzzl requested a review from a team as a code owner February 3, 2026 08:06
@hwbrzzl hwbrzzl changed the base branch from master to v1.17.x February 3, 2026 08:07
@codecov
Copy link

codecov bot commented Feb 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.66%. Comparing base (dcede4e) to head (d97dedd).
⚠️ Report is 1 commits behind head on v1.17.x.

Additional details and impacted files
@@           Coverage Diff            @@
##           v1.17.x    #1368   +/-   ##
========================================
  Coverage    68.66%   68.66%           
========================================
  Files          281      281           
  Lines        17696    17698    +2     
========================================
+ Hits         12151    12153    +2     
  Misses        5043     5043           
  Partials       502      502           

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

@hwbrzzl hwbrzzl merged commit 2649a5e into v1.17.x Feb 3, 2026
20 of 22 checks passed
@hwbrzzl hwbrzzl deleted the bowen/fix-build-command-and-rule-stub branch February 3, 2026 08:20
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.

1 participant