Skip to content

feat: publish query filtering binary#1066

Open
Dodecahedr0x wants to merge 3 commits intomasterfrom
dode/private-er-binairy
Open

feat: publish query filtering binary#1066
Dodecahedr0x wants to merge 3 commits intomasterfrom
dode/private-er-binairy

Conversation

@Dodecahedr0x
Copy link
Copy Markdown
Contributor

@Dodecahedr0x Dodecahedr0x commented Mar 17, 2026

Summary by CodeRabbit

Release Notes

  • New Features
    • Introduced query-filtering-service as a new CLI command available across multiple platforms (macOS and Linux, ARM64 and x64 architectures).
    • Added platform-specific distribution support for seamless installation and execution.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 17, 2026

Manual Deploy Available

You can trigger a manual deploy of this PR branch to testnet:

Deploy to Testnet 🚀

Alternative: Comment /deploy on this PR to trigger deployment directly.

⚠️ Note: Manual deploy requires authorization. Only authorized users can trigger deployments.

Comment updated automatically when the PR is synchronized.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 17, 2026

📝 Walkthrough

Walkthrough

The 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

  • GabrielePicco
✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dode/private-er-binairy
📝 Coding Plan
  • Generate coding plan for human review comments

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 and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between adb60d5 and 7c08e53.

📒 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}`;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 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.ts

Repository: magicblock-labs/magicblock-validator

Length of output: 519


🏁 Script executed:

head -n 30 .github/packages/npm-package/getVersions.ts

Repository: 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.

Suggested change
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.

Comment on lines +99 to +108
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;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

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.

Suggested 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;
}
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.

Comment on lines +50 to +55
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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

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.

Suggested change
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.

Copy link
Copy Markdown
Contributor

@lucacillario lucacillario left a comment

Choose a reason for hiding this comment

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

@Dodecahedr0x look at code rabbit comments, the first one and the last one have to be addresseed

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.

2 participants