Skip to content

fix(ci): build Go wrapper from source on CI runner#71

Open
KooshaPari wants to merge 1 commit into
mainfrom
fix/policystack-go-wrapper
Open

fix(ci): build Go wrapper from source on CI runner#71
KooshaPari wants to merge 1 commit into
mainfrom
fix/policystack-go-wrapper

Conversation

@KooshaPari

@KooshaPari KooshaPari commented Jun 24, 2026

Copy link
Copy Markdown
Owner

User description

Root cause


CodeAnt-AI Description

Prevent CI failures caused by an incompatible Go wrapper binary

What Changed

  • CI now builds the Go wrapper on the runner before tests run, so the executable matches the Linux environment used in CI
  • Test runs no longer trust a prebuilt wrapper binary if Go is available; they rebuild it from source instead
  • If the Go build fails, the output is shown in the test logs to make the failure easier to diagnose

Impact

✅ Fewer CI failures from wrong-platform binaries
✅ Fewer exec format errors on Linux runners
✅ Clearer build failures in test logs

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

@codeant-ai

codeant-ai Bot commented Jun 24, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@KooshaPari, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 39 minutes and 9 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more credits in the billing tab to continue.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 27441d1b-dfa6-4f2d-ac93-24863a56d336

📥 Commits

Reviewing files that changed from the base of the PR and between ea89e9a and 7a2a7c0.

📒 Files selected for processing (4)
  • .github/workflows/ci.yml
  • .gitignore
  • tests/test_policy_contract.py
  • wrappers/go/policy-wrapper
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/policystack-go-wrapper
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch fix/policystack-go-wrapper

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codeant-ai codeant-ai Bot added the size:S This PR changes 10-29 lines, ignoring generated files label Jun 24, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request updates the .gitignore to ignore Go wrapper binaries and modifies the test suite to always rebuild the Go binary from source when the go compiler is available, printing stdout and stderr on failure. The review feedback suggests returning binary.exists() as a fallback when go is not installed to avoid failing tests unnecessarily, and refactoring the error printing to use the already imported sys module instead of an inline import.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines 641 to 642
if shutil.which("go") is None:
return False

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

If go is not installed on the system/runner but a pre-existing binary already exists (for example, if it was built in a previous CI pipeline step and carried over to a minimal test container), returning False will unnecessarily skip or fail the tests. Since the binary is now git-ignored, any existing binary is highly likely to have been built locally for the correct architecture.

Consider returning binary.exists() when go is not available to allow using the pre-existing binary as a fallback.

Suggested change
if shutil.which("go") is None:
return False
if shutil.which("go") is None:
return binary.exists()

Comment on lines +652 to +653
print(build.stdout)
print(build.stderr, file=__import__("sys").stderr)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Since sys is already imported at the top of the file (line 10), you can reference sys.stderr directly instead of using __import__("sys").stderr.

Suggested change
print(build.stdout)
print(build.stderr, file=__import__("sys").stderr)
print(build.stdout)
print(build.stderr, file=sys.stderr)

@sonarqubecloud

Copy link
Copy Markdown

Comment on lines +636 to +640
# Always rebuild from source when `go` is available. Trusting a
# pre-existing binary is unsafe because it may have been built on a
# different OS/arch (e.g. macOS arm64 committed into the repo) and
# would raise OSError: [Errno 8] Exec format error on linux-amd64
# CI runners. The Go module has no external deps, so this is fast.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: Add an FR trace reference (for example via # @trace FR-..., a @pytest.mark.requirement("FR-..."), or a docstring trace) in this modified test area so the file satisfies the repository's mandatory test-to-requirement traceability rule. [custom_rule]

Severity Level: Minor ⚠️

Why it matters? 🤔

The repository rule requires test files and new test functions to include an FR trace marker, requirement annotation, docstring trace, or FR-based test name. The modified test area shown here contains only explanatory comments and no FR-XXX-NNN reference or equivalent trace marker, so the violation is real.

Fix in Cursor Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** tests/test_policy_contract.py
**Line:** 636:640
**Comment:**
	*Custom Rule: Add an FR trace reference (for example via `# @trace FR-...`, a `@pytest.mark.requirement("FR-...")`, or a docstring trace) in this modified test area so the file satisfies the repository's mandatory test-to-requirement traceability rule.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S This PR changes 10-29 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants