Conversation
Manual Deploy AvailableYou can trigger a manual deploy of this PR branch to testnet: Alternative: Comment
Comment updated automatically when the PR is synchronized. |
📝 WalkthroughWalkthroughThe changes introduce infrastructure for a new query-filtering-service package into the npm package ecosystem. This includes adding QUERY_FILTERING_SERVICE to the version mapping in getVersions.ts, registering a CLI binary entry and platform-specific optional dependencies in package.json for multiple OS/architecture combinations, creating a TypeScript wrapper that selects the appropriate binary based on the current system, and updating the version alignment script to manage query-filtering-service versions alongside existing packages. Suggested reviewers
✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
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 |
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/packages/npm-package/queryFilteringService.ts:
- Around line 99-108: The version-check currently just returns on failure,
allowing a successful exit; update the failure paths in the version check (the
branch that tests error !== null and the branch that compares binaryVersion !==
PACKAGE_VERSION) to call process.exit(1) after logging the error so the wrapper
exits non-zero on failure. Locate the conditional that references error,
binaryVersion and PACKAGE_VERSION and append a non-zero exit (process.exit(1))
to both failure branches to ensure the process signals failure to the caller.
- Line 8: The PACKAGE_VERSION constant is using a non-existent key
VERSIONS.PRIVATE_EPHEMERAL_VALIDATOR; update the constant to use the correct key
VERSIONS.QUERY_FILTERING_SERVICE (the key returned by getVersions()) so
PACKAGE_VERSION = `query-filtering-service ${VERSIONS.QUERY_FILTERING_SERVICE}`;
ensure you reference the VERSIONS symbol and PACKAGE_VERSION constant when
making the change.
In @.github/version-align.sh:
- Around line 50-55: The if condition is using the wrong guard variable so the
query-filtering-service update never runs; change the guard in the conditional
from private_validator_latest to query_filtering_service_latest (the variable
used in the echo and jq command) so the block executes when
query_filtering_service_latest is set; update the conditional that currently
references private_validator_latest to reference query_filtering_service_latest
in the same if/else block surrounding the jq call that updates
packages/npm-package/package.json.
🪄 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: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 6f8c719d-d047-4c34-b101-151264f8d6f5
📒 Files selected for processing (4)
.github/packages/npm-package/getVersions.ts.github/packages/npm-package/package.json.github/packages/npm-package/queryFilteringService.ts.github/version-align.sh
| import { arch, platform } from "os"; | ||
| import { VERSIONS } from "./getVersions"; | ||
|
|
||
| const PACKAGE_VERSION = `query-filtering-service ${VERSIONS.PRIVATE_EPHEMERAL_VALIDATOR}`; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Verify available VERSIONS keys and current usage sites.
rg -n 'EPHEMERAL_VALIDATOR|QUERY_FILTERING_SERVICE|PRIVATE_EPHEMERAL_VALIDATOR' \
.github/packages/npm-package/getVersions.ts \
.github/packages/npm-package/queryFilteringService.ts \
.github/packages/npm-package/ephemeralValidator.tsRepository: magicblock-labs/magicblock-validator
Length of output: 519
🏁 Script executed:
head -n 30 .github/packages/npm-package/getVersions.tsRepository: magicblock-labs/magicblock-validator
Length of output: 884
Use the correct version key from getVersions().
At line 8, VERSIONS.PRIVATE_EPHEMERAL_VALIDATOR does not exist in the exported mapping; it should be VERSIONS.QUERY_FILTERING_SERVICE.
Proposed fix
-const PACKAGE_VERSION = `query-filtering-service ${VERSIONS.PRIVATE_EPHEMERAL_VALIDATOR}`;
+const PACKAGE_VERSION = `query-filtering-service ${VERSIONS.QUERY_FILTERING_SERVICE}`;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const PACKAGE_VERSION = `query-filtering-service ${VERSIONS.PRIVATE_EPHEMERAL_VALIDATOR}`; | |
| const PACKAGE_VERSION = `query-filtering-service ${VERSIONS.QUERY_FILTERING_SERVICE}`; |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.github/packages/npm-package/queryFilteringService.ts at line 8, The
PACKAGE_VERSION constant is using a non-existent key
VERSIONS.PRIVATE_EPHEMERAL_VALIDATOR; update the constant to use the correct key
VERSIONS.QUERY_FILTERING_SERVICE (the key returned by getVersions()) so
PACKAGE_VERSION = `query-filtering-service ${VERSIONS.QUERY_FILTERING_SERVICE}`;
ensure you reference the VERSIONS symbol and PACKAGE_VERSION constant when
making the change.
| if (error !== null) { | ||
| console.error(`Failed to get version of global binary: ${error}`); | ||
| return; | ||
| } | ||
| if (binaryVersion !== PACKAGE_VERSION) { | ||
| console.error( | ||
| `Globally installed query-filtering-service version is not correct. Expected "${PACKAGE_VERSION}", found "${binaryVersion}".`, | ||
| ); | ||
| return; | ||
| } |
There was a problem hiding this comment.
Return path should exit non-zero on version-check failure.
At Lines 99-108, failures only return, so the wrapper can exit successfully even when no valid binary is run.
Proposed fix
if (error !== null) {
console.error(`Failed to get version of global binary: ${error}`);
- return;
+ process.exit(1);
}
if (binaryVersion !== PACKAGE_VERSION) {
console.error(
`Globally installed query-filtering-service version is not correct. Expected "${PACKAGE_VERSION}", found "${binaryVersion}".`,
);
- return;
+ process.exit(1);
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if (error !== null) { | |
| console.error(`Failed to get version of global binary: ${error}`); | |
| return; | |
| } | |
| if (binaryVersion !== PACKAGE_VERSION) { | |
| console.error( | |
| `Globally installed query-filtering-service version is not correct. Expected "${PACKAGE_VERSION}", found "${binaryVersion}".`, | |
| ); | |
| return; | |
| } | |
| if (error !== null) { | |
| console.error(`Failed to get version of global binary: ${error}`); | |
| process.exit(1); | |
| } | |
| if (binaryVersion !== PACKAGE_VERSION) { | |
| console.error( | |
| `Globally installed query-filtering-service version is not correct. Expected "${PACKAGE_VERSION}", found "${binaryVersion}".`, | |
| ); | |
| process.exit(1); | |
| } |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.github/packages/npm-package/queryFilteringService.ts around lines 99 - 108,
The version-check currently just returns on failure, allowing a successful exit;
update the failure paths in the version check (the branch that tests error !==
null and the branch that compares binaryVersion !== PACKAGE_VERSION) to call
process.exit(1) after logging the error so the wrapper exits non-zero on
failure. Locate the conditional that references error, binaryVersion and
PACKAGE_VERSION and append a non-zero exit (process.exit(1)) to both failure
branches to ensure the process signals failure to the caller.
| if [ -n "$private_validator_latest" ]; then | ||
| echo "Updating query-filtering-service dependencies to version: $query_filtering_service_latest" | ||
| jq --arg version "$query_filtering_service_latest" '.optionalDependencies |= with_entries(if (.key | contains("query-filtering-service")) then .value = $version else . end)' packages/npm-package/package.json > temp.json && mv temp.json packages/npm-package/package.json | ||
| else | ||
| echo "Warning: Could not fetch latest query-filtering-service version from NPM" | ||
| fi |
There was a problem hiding this comment.
Fix the wrong guard variable for query-filtering-service update.
At Line 50, the condition checks private_validator_latest (undefined) instead of query_filtering_service_latest, so this block never runs as intended.
Proposed fix
-if [ -n "$private_validator_latest" ]; then
+if [ -n "$query_filtering_service_latest" ]; then
echo "Updating query-filtering-service dependencies to version: $query_filtering_service_latest"
jq --arg version "$query_filtering_service_latest" '.optionalDependencies |= with_entries(if (.key | contains("query-filtering-service")) then .value = $version else . end)' packages/npm-package/package.json > temp.json && mv temp.json packages/npm-package/package.json
else📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if [ -n "$private_validator_latest" ]; then | |
| echo "Updating query-filtering-service dependencies to version: $query_filtering_service_latest" | |
| jq --arg version "$query_filtering_service_latest" '.optionalDependencies |= with_entries(if (.key | contains("query-filtering-service")) then .value = $version else . end)' packages/npm-package/package.json > temp.json && mv temp.json packages/npm-package/package.json | |
| else | |
| echo "Warning: Could not fetch latest query-filtering-service version from NPM" | |
| fi | |
| if [ -n "$query_filtering_service_latest" ]; then | |
| echo "Updating query-filtering-service dependencies to version: $query_filtering_service_latest" | |
| jq --arg version "$query_filtering_service_latest" '.optionalDependencies |= with_entries(if (.key | contains("query-filtering-service")) then .value = $version else . end)' packages/npm-package/package.json > temp.json && mv temp.json packages/npm-package/package.json | |
| else | |
| echo "Warning: Could not fetch latest query-filtering-service version from NPM" | |
| fi |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.github/version-align.sh around lines 50 - 55, The if condition is using the
wrong guard variable so the query-filtering-service update never runs; change
the guard in the conditional from private_validator_latest to
query_filtering_service_latest (the variable used in the echo and jq command) so
the block executes when query_filtering_service_latest is set; update the
conditional that currently references private_validator_latest to reference
query_filtering_service_latest in the same if/else block surrounding the jq call
that updates packages/npm-package/package.json.
lucacillario
left a comment
There was a problem hiding this comment.
@Dodecahedr0x look at code rabbit comments, the first one and the last one have to be addresseed
Summary by CodeRabbit
Release Notes