Skip to content

Conversation

@pRizz
Copy link
Owner

@pRizz pRizz commented Feb 4, 2026

Summary

This PR improves test reliability by making tests gracefully handle missing binaries and sandboxed/elevated environments where privileged port binding succeeds. It also ensures the Rust binary is built before running Node tests.

Changes

  • Add cargo build -p opencode-cloud to the test-node justfile recipe to ensure the Rust binary is available before Node tests run
  • Replace hard error in CLI parity tests with conditional skip when Rust binary is missing, with a helpful warning message logged at module load time
  • Add can_bind_privileged_ports() helper function in both packages/cli-rust/src/commands/start.rs and packages/cli-rust/src/wizard/network.rs to detect sandboxed/elevated environments
  • Update privileged port tests to skip gracefully when running in environments where privileged ports are bindable (root, sandboxed, or elevated capabilities), preventing false failures

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • Refactoring (no functional changes)

Testing

These changes improve test robustness:

  • CLI parity tests now skip with a warning instead of failing when the Rust binary hasn't been built
  • Privileged port tests skip in sandboxed/elevated environments instead of failing unexpectedly
  • The test-node recipe now ensures the Rust binary is built before attempting to run tests

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings

Related Issues

Addresses test flakiness in CI/CD environments and sandboxed test runners.

https://claude.ai/code/session_01Nd43wo7HKi3qL4NHg9sRGD

- Add cargo build to test-node justfile recipe to ensure Rust binary
  exists before running Node CLI parity tests
- Add describe.skipIf() in cli-parity.test.ts to gracefully skip tests
  with a warning when Rust binary is missing instead of throwing errors
- Add can_bind_privileged_ports() helper to detect sandboxed/elevated
  environments where privileged port binding succeeds
- Skip privileged port tests in network.rs and start.rs when running
  in sandbox environments (fixes issue #21)

Closes #21

https://claude.ai/code/session_01Nd43wo7HKi3qL4NHg9sRGD
Ignore Node.js module compilation cache directory that gets created
during pnpm install.

https://claude.ai/code/session_01Nd43wo7HKi3qL4NHg9sRGD
@pRizz pRizz merged commit d2eb4a5 into main Feb 4, 2026
4 checks passed
@pRizz pRizz deleted the claude/fix-sandbox-test-issue-2xsQ5 branch February 4, 2026 04:23
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.

3 participants