fix: ci/cd tests#76
Conversation
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 23 minutes and 54 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
WalkthroughCI workflow removes local and ephemeral validator startup; test script gains robust validator handling, TTY support, improved readiness checks, log capture, and cluster override behavior; Anchor projects switch provider cluster to localnet, update program IDs, add deploy keypair artifacts, and adjust gitignore entries. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.github/workflows/test-examples.yml (1)
43-45: 🧹 Nitpick | 🔵 TrivialPin the MagicBlock Ephemeral Validator to a specific version.
Using
@latestin CI workflows silently picks up new major/minor versions on every run, producing non-reproducible builds that fail for reasons unrelated to code changes. Pin to a known-good version (e.g.,0.8.3) and use Dependabot/Renovate for automated updates.Suggested change
- name: Install MagicBlock Ephemeral Validator run: | - npm install -g `@magicblock-labs/ephemeral-validator`@latest + npm install -g `@magicblock-labs/ephemeral-validator`@0.8.3🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/test-examples.yml around lines 43 - 45, The CI step "Install MagicBlock Ephemeral Validator" currently installs `@magicblock-labs/ephemeral-validator`@latest which causes non-reproducible builds; change the installer to use a pinned, known-good version (for example replace `@latest` with `@0.8.3`) in the step named "Install MagicBlock Ephemeral Validator" and rely on Dependabot/Renovate to automate future updates.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/test-examples.yml:
- Around line 52-62: The CI runs plain `anchor test` which starts Anchor's local
validator and then conflicts with fullstack-test.sh's validator management;
modify the "Test anchor-counter" step to invoke `anchor test
--skip-local-validator --skip-build --skip-deploy` (so fullstack-test.sh keeps
control of the validator lifecycle) while keeping the preceding `yarn install`
and working directory change; reference the `anchor test` invocation, the
`fullstack-test.sh` script, and the Anchor.toml cluster="localnet" behavior when
making the change.
In `@fullstack-test.sh`:
- Around line 258-265: The else branch after the check for
/tmp/ephemeral-validator.log is misleading because it runs only when the file
does not exist; update the message to reflect that the log was not produced
(e.g., echo "No startup log found at /tmp/ephemeral-validator.log — the process
may not have produced output") or simply remove the else branch entirely; locate
the if block that tests [ -f /tmp/ephemeral-validator.log ] and adjust the echo
in the else branch accordingly.
---
Outside diff comments:
In @.github/workflows/test-examples.yml:
- Around line 43-45: The CI step "Install MagicBlock Ephemeral Validator"
currently installs `@magicblock-labs/ephemeral-validator`@latest which causes
non-reproducible builds; change the installer to use a pinned, known-good
version (for example replace `@latest` with `@0.8.3`) in the step named "Install
MagicBlock Ephemeral Validator" and rely on Dependabot/Renovate to automate
future updates.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 818b231d-4e92-43a3-9267-e67d35438bf0
📒 Files selected for processing (2)
.github/workflows/test-examples.ymlfullstack-test.sh
- Wrap ephemeral-validator in a pty (python3) so its mandatory ratatui/crossterm TUI sees a controlling terminal; without one it silently exits 0 before binding port 7799, both in CI and when invoked from a non-tty bg job. - Move test endpoint env vars (PROVIDER_ENDPOINT, EPHEMERAL_PROVIDER_ENDPOINT, TEE_PROVIDER_ENDPOINT, ROUTER_ENDPOINT, WS variants) to the workflow step so the test runner doesn't fall back to devnet defaults. Tests read these directly; setting them inside fullstack-test.sh leaked project conventions into the script. - Set anchor-counter Anchor.toml cluster to "localnet" so the merge of main into this branch keeps localnet (was reverting to "devnet" via 3-way merge). - Commit private-/public-counter program keypairs and update .gitignore so deploy doesn't fail with DeclaredProgramIdMismatch on fresh clones; declare_id!() values now match the committed keypairs (no anchor keys sync needed). - fullstack-test.sh: wait for the upstream validator to be producing slots (commitment=processed) before starting ephemeral-validator; portable sed -E for slot extraction (BSD vs GNU); harden the kill of anchor's pre-flight validator with SIGTERM->SIGKILL and a port-free poll; honor --provider.cluster override from the anchor CLI; print mb-test-validator log on ephemeral failure with ANSI codes stripped. - Workflow: set kernel inotify limits ahead of time, raise nofile via prlimit in the same step as anchor test (prlimit on $$ doesn't propagate across GitHub Actions step shells).
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/test-examples.yml:
- Around line 57-69: anchor-counter's package.json lacks the
`@magicblock-labs/ephemeral-validator` dependency, so running yarn install before
anchor test won't install the binaries required by ../fullstack-test.sh; update
anchor-counter/package.json by adding "@magicblock-labs/ephemeral-validator":
"0.8.8" to the "dependencies" (not devDependencies) so the ephemeral-validator
and mb-test-validator binaries are available when running anchor test
--provider.cluster localnet.
In `@anchor-counter/programs/public-counter/src/lib.rs`:
- Line 6: Update the hardcoded program ID constants in
anchor-counter/app/src/App.tsx: replace the values assigned to
PUBLIC_COUNTER_PROGRAM and PRIVATE_COUNTER_PROGRAM with the new declared IDs
from the on-chain program (public: A4D1N6zdiwtAFr7mQcHkNbk2yXmDcpvovvU5D27kZoGv,
private: 7Y2rYVGqRY31m7ogMHjmtdRMUjeWakoJ6iVx12i6voCY) so PDA derivation and
program client instantiation use the correct program IDs (search for the
PUBLIC_COUNTER_PROGRAM and PRIVATE_COUNTER_PROGRAM constants and update their
PublicKey string literals accordingly).
In `@fullstack-test.sh`:
- Around line 323-343: Add a fast preflight check to ensure python3 is available
before running the background wrapper: test for the `python3` binary (used by
the `python3 -c '...'` invocation that runs `pty.spawn`) and fail with a clear
error if missing so the script doesn't silently continue; then keep launching
the wrapper and capture its PID in `EPHEMERAL_VALIDATOR_PID=$!` as before. Also
add a brief inline comment near `EPHEMERAL_VALIDATOR_PID`/`cleanup` explaining
that `pty.spawn()` does not forward signals to the spawned `ephemeral-validator`
process, so `cleanup` must still kill the validator itself (e.g. via the
existing `pkill -f "ephemeral-validator"`) rather than relying on terminating
the python wrapper.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: fa09895e-92f2-4d8f-83cf-aae7e5477f8c
⛔ Files ignored due to path filters (1)
anchor-counter/yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (9)
.github/workflows/test-examples.yml.gitignoreanchor-counter/.gitignoreanchor-counter/Anchor.tomlanchor-counter/programs/private-counter/src/lib.rsanchor-counter/programs/public-counter/src/lib.rsanchor-counter/target/deploy/private_counter-keypair.jsonanchor-counter/target/deploy/public_counter-keypair.jsonfullstack-test.sh
- Tests construct wsEndpoint by replacing http:// → ws:// while keeping the RPC port. Solana convention uses RPC on port N and WS on N+1, so http://127.0.0.1:8899 was producing ws://127.0.0.1:8899 instead of ws://127.0.0.1:8900, leading to TransactionExpiredTimeoutError when sendAndConfirm couldn't subscribe for confirmation. - Honor explicit WS_ENDPOINT / EPHEMERAL_WS_ENDPOINT / TEE_WS_ENDPOINT env vars and fall back to undefined (web3.js auto-derive, which correctly bumps the port). - Workflow: pass the matching WS env vars so localnet runs subscribe to the right port.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5731f2aa2a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| [provider] | ||
| cluster = "devnet" | ||
| cluster = "localnet" |
There was a problem hiding this comment.
Keep default cluster aligned with test endpoint defaults
Changing the default provider cluster to localnet makes anchor test enter the local-validator path by default, but the test files still default their base-layer RPC to devnet when PROVIDER_ENDPOINT is unset (anchor-counter/tests/public-counter.ts and private-counter.ts), and fullstack-test.sh does not export PROVIDER_ENDPOINT/WS_ENDPOINT for local runs. In a normal local invocation (cd anchor-counter && anchor test), this now deploys programs to localnet while the test client sends transactions to devnet, which leads to consistent failures unless callers manually set extra env vars.
Useful? React with 👍 / 👎.
Summary by CodeRabbit