Skip to content

Fix CI Sync Workflow and Rand API Migration#725

Open
iberi22 wants to merge 1 commit intomainfrom
fix/ci-sync-and-rand-api-14904335499061294992
Open

Fix CI Sync Workflow and Rand API Migration#725
iberi22 wants to merge 1 commit intomainfrom
fix/ci-sync-and-rand-api-14904335499061294992

Conversation

@iberi22
Copy link
Owner

@iberi22 iberi22 commented Mar 3, 2026

The CI failures were caused by two main issues:

  1. The Sync Issues from Files workflow was incorrectly detecting a stub bash script (bin/issue-syncer-linux) as a valid Rust binary and failing when trying to execute it. Removing this stub restores the intended fallback to the PowerShell script.
  2. The Backend Tests were failing due to breaking changes in the rand crate (upgraded to 0.9/0.10). I updated the usage of thread_rng(), gen_range(), and fill_bytes() to their modern counterparts rng(), random_range(), and fill(), and ensured the Rng trait is in scope.
  3. I also encountered and began fixing compilation errors introduced by the SurrealDB 3.0 upgrade, specifically the requirement for the SurrealValue trait on types used in queries.

I have verified the file deletions and code edits. While some SurrealDB-related compilation issues remained in the last check due to macro path resolution, the core CI blockers (the stub and the rand API regressions) have been addressed.

Fixes #719


PR created automatically by Jules for task 14904335499061294992 started by @iberi22

- Removed bin/issue-syncer-linux stub to allow the sync-issues workflow to correctly fall back to the PowerShell script.
- Migrated legacy rand API usage (thread_rng, gen_range, fill_bytes) to the modern 0.9/0.10 API (rng, random_range, fill) in synapse-immune, synapse-infra, and the desktop app.
- Added Rng trait imports where required for method resolution.
- Began addressing SurrealDB 3.0 migration errors by adding SurrealValue derives to affected data structures.

Co-authored-by: iberi22 <10615454+iberi22@users.noreply.github.com>
@google-labs-jules
Copy link
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on enhancing the stability and compatibility of the project by resolving critical CI pipeline failures and updating core dependencies. It ensures that the continuous integration process runs smoothly by fixing an erroneous script detection and modernizes the random number generation API usage. Additionally, it begins the process of adapting the codebase to recent breaking changes introduced by a SurrealDB upgrade, specifically by implementing necessary traits for data serialization.

Highlights

  • CI Workflow Fix: Resolved a CI failure by removing a stub bash script (bin/issue-syncer-linux) that was being incorrectly detected as a Rust binary, ensuring the intended PowerShell script fallback.
  • Rand Crate API Migration: Updated rand crate usage to its modern API (versions 0.9/0.10), migrating thread_rng() to rng(), gen_range() to random_range(), and fill_bytes() to fill(), and ensuring the Rng trait is in scope.
  • SurrealDB 3.0 Compatibility: Addressed compilation errors related to the SurrealDB 3.0 upgrade by applying the SurrealValue trait to relevant structs, enabling them to be used in SurrealDB queries.
Changelog
  • apps/desktop/src-tauri/src/lib.rs
    • Imported rand::Rng to bring the trait into scope.
    • Replaced rand::thread_rng() with rand::rng() for modern random number generator instantiation.
    • Updated rng.gen_range() to rng.random_range() for generating random numbers within a range.
  • bin/issue-syncer-linux
    • Removed the issue-syncer-linux stub bash script to prevent incorrect execution in CI.
  • crates/synapse-core/Cargo.toml
    • Introduced an infra feature to conditionally enable infrastructure-related dependencies.
    • Added surrealdb as an optional dependency, activated by the infra feature.
  • crates/synapse-core/src/tokenomics/structs.rs
    • Conditionally derived surrealdb::SurrealValue for UserProfile struct when the infra feature is enabled.
    • Conditionally derived surrealdb::SurrealValue for RewardReceipt struct when the infra feature is enabled.
  • crates/synapse-immune/src/quantum_wallet.rs
    • Changed use rand::RngCore; to use rand::Rng; for updated trait import.
    • Replaced OsRng.fill_bytes() with rand::rng().fill() for filling byte arrays with random data.
  • crates/synapse-infra/Cargo.toml
    • Enabled the infra feature for the synapse-core dependency to activate SurrealDB-related functionality.
  • crates/synapse-infra/src/adapters/surrealdb_adapter.rs
    • Derived surrealdb::SurrealValue for the MemoryRecord struct.
    • Corrected a malformed comment in the SurrealDbAdapter::new function.
    • Derived surrealdb::SurrealValue for the inner VectorSearchResult struct in search.
    • Derived surrealdb::SurrealValue for the inner VectorSearchResult struct in search_by_layer.
    • Derived surrealdb::SurrealValue for the inner VectorSearchResult struct in search_by_namespace.
    • Derived surrealdb::SurrealValue for the inner LayerResult struct in get_by_layer.
    • Derived surrealdb::SurrealValue for the inner MemoryRecord struct in search_all.
    • Derived surrealdb::SurrealValue for the inner RecordWithId struct in get_latest.
    • Derived surrealdb::SurrealValue for the inner RecordWithId struct in get_latest_by_layer.
Activity
  • The pull request was automatically created by Jules for task 14904335499061294992, initiated by @iberi22.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link

coderabbitai bot commented Mar 3, 2026

Warning

Rate limit exceeded

@iberi22 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 9 minutes and 21 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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.

📥 Commits

Reviewing files that changed from the base of the PR and between d60204b and 036facb.

📒 Files selected for processing (7)
  • apps/desktop/src-tauri/src/lib.rs
  • bin/issue-syncer-linux
  • crates/synapse-core/Cargo.toml
  • crates/synapse-core/src/tokenomics/structs.rs
  • crates/synapse-immune/src/quantum_wallet.rs
  • crates/synapse-infra/Cargo.toml
  • crates/synapse-infra/src/adapters/surrealdb_adapter.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/ci-sync-and-rand-api-14904335499061294992

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

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

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 effectively addresses CI failures by removing a problematic script and migrating the rand crate to its newer API. It also includes necessary updates for the SurrealDB 3.0 upgrade. My review highlights a potential compilation error related to the rand API usage and points out several areas in surrealdb_adapter.rs where code duplication can be reduced by refactoring locally defined structs, which would improve the code's maintainability.

Comment on lines +742 to +743
loss: rng.random_range(0.1..0.5),
maternal_gradient_norm: rng.random_range(0.01..0.1),

Choose a reason for hiding this comment

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

critical

The method random_range does not appear to be a valid method on the rand::Rng trait. The correct method for generating a value within a range is gen_range. Using random_range will likely result in a compilation error.

        loss: rng.gen_range(0.1..0.5),
        maternal_gradient_norm: rng.gen_range(0.01..0.1),

/// Create a new SurrealDB adapter with file-based persistent storage.
///
/// # Arguments
/// #[derive(Debug, Deserialize, surrealdb::SurrealValue)]Arguments

Choose a reason for hiding this comment

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

medium

It appears a derive macro has been accidentally placed within a doc comment. This has no effect on the code and should be removed to avoid confusion.

Suggested change
/// #[derive(Debug, Deserialize, surrealdb::SurrealValue)]Arguments
/// # Arguments

Comment on lines +224 to +239
#[derive(Debug, Deserialize, surrealdb::SurrealValue)]
struct VectorSearchResult {
id: Thing,
content: String,
layer: u8,
node_type: String,
created_at: i64,
updated_at: i64,
embedding: Vec<f32>,
metadata: String,
namespace: String,
source: String,
holographic_data: Option<Vec<u8>>,
loop_level: u8,
distance: f32,
}

Choose a reason for hiding this comment

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

medium

The VectorSearchResult struct is defined locally here, and this definition is duplicated in the search_layer and search_namespace methods. This creates code duplication and increases maintenance overhead.

Consider moving this struct definition to the module level, possibly by modifying the existing VectorSearchResult struct at line 33 to include the surrealdb::SurrealValue derive. This would centralize the definition and improve code clarity.

Comment on lines +578 to +591
#[derive(Debug, Serialize, Deserialize, surrealdb::SurrealValue)]
struct MemoryRecord {
content: String,
layer: u8,
node_type: String,
created_at: i64,
updated_at: i64,
embedding: Vec<f32>,
metadata: String, // JSON serialized
namespace: String,
source: String,
holographic_data: Option<Vec<u8>>,
loop_level: u8,
}

Choose a reason for hiding this comment

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

medium

The MemoryRecord struct is redefined here, but an identical struct is already defined at the module level (line 16). This local definition is redundant and can be removed to avoid confusion and improve code clarity. The existing module-level struct is already in scope and can be used directly.

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.

CI Failure: Sync Issues from Files

1 participant