Skip to content

Conversation

@IGN-Styly
Copy link
Member

@IGN-Styly IGN-Styly commented Aug 12, 2025

Summary by CodeRabbit

  • New Features

    • Project converted to a multi-crate workspace with engine and library crates.
    • Pluggable module system for discovering, validating, loading, and running modules.
    • New event system with core events (start, auth, admin auth, cgrpc) and handler registration utilities.
    • Persistent task queues with serialization, verification, and periodic cleanup.
    • Configuration loader and improved startup/logging flows.
    • Added procedural/macro support to simplify event and handler integration.
  • Tests

    • End-to-end tests for event handling and task lifecycle.
  • Docs

    • Added a license document.
  • Chores

    • Updated repository ignore rules.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 12, 2025

Walkthrough

Converted the root crate into a Rust workspace and added two member crates (engine, enginelib) with a proc-macro crate; implemented enginelib core (API, config, events, tasks, plugin loader, macros), added engine manifest, tests, build script, license, and minor .gitignore edits.

Changes

Cohort / File(s) Summary of changes
Git ignore updates
./.gitignore
Added duplicate ignore entries (e.g., debug/, target/, repeated **/*.rs.bk) — only additions to ignore rules.
Workspace conversion
./Cargo.toml
Root manifest converted to a workspace (resolver = "3"), members: engine, enginelib, enginelib/macros; removed root [package]/[dependencies].
Engine crate manifest
engine/Cargo.toml
New engine crate manifest with package metadata and runtime/build dependencies (clap, tokio, tonic, prost, druid, enginelib via git, etc.).
Enginelib crate setup
enginelib/Cargo.toml, enginelib/build.rs, enginelib/LICENSE.md
New library crate manifest, vergen_gix build script emitting build metadata, and added Grand Engineering License file.
Procedural macros crate
enginelib/macros/Cargo.toml, enginelib/macros/src/lib.rs
New proc-macro crate macros implementing attribute macros (metadata, module) and Verifiable derive.
Core library surface & prelude
enginelib/src/lib.rs, enginelib/src/prelude.rs
Exposed modules (api, config, event, events, macros, plugin, prelude, task), added type aliases, constants, Registry trait, and prelude re-exports.
Macros for events
enginelib/src/macros.rs
Added register_event! and RegisterEventHandler! macros to register events and generate handler types/impls.
Configuration loader
enginelib/src/config.rs
Added Config & ConfigTomlServer with TOML parsing from config.toml, defaults, and error fallback logging.
Event infrastructure
enginelib/src/event.rs
Introduced Event, EventHandler, EventCTX traits, EventBus, EngineEventRegistry and EngineEventHandlerRegistry, and dispatch logic.
Core event definitions & wiring
enginelib/src/events/mod.rs, enginelib/src/events/*.rs
Added Events manager, helper ID(), and event implementations: auth_event, admin_auth_event, cgrpc_event, start_event plus registration macros and init wiring.
Task subsystem
enginelib/src/task.rs
Added Task and Verifiable traits, Runner enum, in-memory queues (TaskQueue, ExecutingTaskQueue, SolvedTasks), StoredTask types, TaskRegistry trait, and serialization interfaces.
Engine API & lifecycle
enginelib/src/api.rs
Added EngineAPI struct (config, queues, registry, event_bus, sled DB, lib manager), init/sync/periodic-clear routines, logger setup, and EngineTaskRegistry.
Plugin system
enginelib/src/plugin.rs
Added dynamic plugin loader: LibraryMetadata, LibraryInstance, LibraryManager, module extraction/loading, version checks, and run invocation.
Tests
enginelib/tests/event_tests.rs
Added tests verifying ID helper, event registration/handling, task registration/execution/serialization, using EngineAPI::test_default.

Sequence Diagram(s)

sequenceDiagram
  participant Main as Engine (main)
  participant API as EngineAPI
  participant CFG as Config
  participant DB as sled::Db
  participant LM as LibraryManager
  participant EV as Events/EventBus

  Main->>API: EngineAPI::test_default()/new
  Main->>API: init()
  API->>API: setup_logger()
  API->>CFG: Config::new()
  API->>DB: init/open sled
  API->>API: init_db()
  API->>LM: load_modules()
  API->>EV: Events::init_auth()
  API->>EV: Events::init()
  API-->>Main: Ready
Loading
sequenceDiagram
  participant Caller as Engine code
  participant EV as Events
  participant Bus as EventBus
  participant Reg as Handler Registry
  participant H1 as Handler A
  participant H2 as Handler B

  Caller->>EV: Emit AuthEvent(..., output)
  EV->>Bus: handle(ID("core","auth_event"), &mut event)
  Bus->>Reg: lookup handlers by ID
  alt handlers found
    Reg-->>Bus: [H1, H2]
    Bus->>H1: handle(event)
    Bus->>H2: handle(event)
  else none
    Bus-->>Bus: debug: no handlers
  end
  EV-->>Caller: result via shared output (Arc<RwLock<...>>)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Poem

A rabbit taps its tiny paw, enthused by CI’s light,
New crates hop in, events take wing, tasks queue up just right.
Plugins bloom like clover leaves, config hums along,
Bincode dreams and sleddy streams, a workspace growing strong.
With twitching nose I ship this patch—ka-thump!—the merge is on. 🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 84d5ece and e8ec1d4.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (3)
  • Cargo.toml (1 hunks)
  • enginelib/Cargo.toml (1 hunks)
  • enginelib/src/plugin.rs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • enginelib/Cargo.toml
  • Cargo.toml
  • enginelib/src/plugin.rs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Analyze (actions)
  • GitHub Check: Analyze (rust)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch migration

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
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: 42

♻️ Duplicate comments (2)
enginelib/tests/event_tests.rs (2)

156-158: Duplicate: Unnecessary return statement and unused parameter

Same issue as mentioned above - unnecessary return statement and unused parameter in from_toml.

Apply this diff:

-fn from_toml(&self, d: String) -> Box<dyn Task> {
-    return Box::new(self.clone());
-}
+fn from_toml(&self, _d: String) -> Box<dyn Task> {
+    Box::new(self.clone())
+}

203-205: Duplicate: Unnecessary return statement and unused parameter

Same issue as mentioned above - unnecessary return statement and unused parameter in from_toml.

Apply this diff:

-fn from_toml(&self, d: String) -> Box<dyn Task> {
-    return Box::new(self.clone());
-}
+fn from_toml(&self, _d: String) -> Box<dyn Task> {
+    Box::new(self.clone())
+}
🧹 Nitpick comments (17)
enginelib/macros/Cargo.toml (3)

2-2: Rename crate from “macros” to a unique, descriptive name (e.g., “enginelib-macros”).

“macros” is overly generic and likely to cause confusion/collisions if published. A unique name improves clarity across the workspace.

Apply this diff:

-[package]
-name = "macros"
+[package]
+name = "enginelib-macros"

Follow-up:

  • Update any dependent crates to reference the new crate name.
  • If you prefer underscores for the Rust import name, “enginelib-macros” will still be imported as enginelib_macros in code.

4-4: Edition 2024 requires enforcing an MSRV; add rust-version and verify toolchain support.

Pinning MSRV prevents build failures for users without a toolchain that supports Edition 2024.

Apply this diff (adjust the version if you target a different MSRV):

 [package]
 name = "enginelib-macros"
 version = "0.1.0"
 edition = "2024"
+rust-version = "1.82"

Would you like me to verify which minimal stable Rust version you’re targeting, and align this value accordingly?


8-10: Consider relaxing dependency versions to caret ranges for easier updates.

Exact patch pins increase maintenance friction without clear benefit here. Using caret ranges keeps you within the same major series while allowing patch/minor updates.

Apply this diff:

 [dependencies]
-proc-macro2 = "1.0.93"
-quote = "1.0.38"
-syn = "2.0.100"
+proc-macro2 = "1.0"
+quote = "1.0"
+syn = "2.0"
.gitignore (1)

12-20: Remove duplicated ignore rules for debug/, target/, and rs.bk.

The duplicates add noise and potential confusion without any effect.

Apply this diff:

-debug/
-target/
-
-# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
-# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
-
-# These are backup files generated by rustfmt
-**/*.rs.bk
+# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
+# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html

Note: The root target/ ignore already covers all members in a workspace, so additional duplicates are unnecessary.

enginelib/LICENSE.md (1)

3-6: Tighten grammar, spelling, and consistency (license/licence, entity phrasing).

Small edits improve clarity and professionalism without changing intent.

Apply this diff:

-This licence will use the term GE to refer to GrandEngineering.
+This license uses the acronym “GE” to refer to Grand Engineering.

-[GE](https://github.com/GrandEngineering) reserve all rights and [GE](https://github.com/GrandEngineering) also reserves the rights to restrain individuals abilities to use this software and its code. The points below outline what you can, cannot and must do when dealing with the
-contents of this repository. Licenses for commercial use can only be granted by [GE](https://github.com/GrandEngineering)
+[GE](https://github.com/GrandEngineering) reserves all rights and may restrict an individual’s or entity’s ability to use this software and its code. The points below outline what you can, cannot, and must do when dealing with the contents of this repository. Licenses for commercial use can only be granted by [GE](https://github.com/GrandEngineering).

-* Use this SOFTWARE commercially/for profit without a License given by [GE](https://github.com/GrandEngineering)
+* Use this software commercially/for profit without a license granted by [GE](https://github.com/GrandEngineering).

-Licenses are granted on a individual entity basis, for person or entity, if you require a license please contact GrandEngineering at styly.smithing@gmail.com.
-Commercial licences may come with a fee, which may be one time or on a time basis.
-Licensing terms are done in a per entity/individual basis trying to follow a company/individual needs.
+Licenses are granted on a per-entity basis. If you require a license, please contact Grand Engineering at styly.smithing@gmail.com.
+Commercial licenses may include a fee, which may be one-time or time-based.
+Licensing terms are tailored on a per-entity or per-individual basis to align with organizational needs.

Also applies to: 15-17, 31-33

enginelib/build.rs (1)

5-23: Prefer Result-returning main and “?” over unwraps in build.rs.

This improves error reporting and avoids opaque panics during build.

Apply this diff:

-fn main() {
+fn main() -> Result<(), Box<dyn std::error::Error>> {
@@
-    let build = BuildBuilder::all_build().unwrap();
-    let cargo = CargoBuilder::all_cargo().unwrap();
-    let git = GixBuilder::all_git().unwrap();
-    let rustc = RustcBuilder::all_rustc().unwrap();
+    let build = BuildBuilder::all_build()?;
+    let cargo = CargoBuilder::all_cargo()?;
+    let rustc = RustcBuilder::all_rustc()?;
+    #[cfg(feature = "build-metadata-git")]
+    let git = GixBuilder::all_git()?;
@@
-    Emitter::default()
-        .add_instructions(&build)
-        .unwrap()
-        .add_instructions(&cargo)
-        .unwrap()
-        .add_instructions(&rustc)
-        .unwrap()
-        .add_instructions(&git)
-        .unwrap()
-        .emit()
-        .unwrap();
+    let mut emitter = Emitter::default();
+    emitter.add_instructions(&build)?;
+    emitter.add_instructions(&cargo)?;
+    emitter.add_instructions(&rustc)?;
+    #[cfg(feature = "build-metadata-git")]
+    emitter.add_instructions(&git)?;
+    emitter.emit()?;
+    Ok(())
 }
enginelib/src/config.rs (1)

1-1: Remove unnecessary and potentially confusing use std::u32 import

Primitive types are in the prelude; u32::MAX does not require importing std::u32. Keeping this may trigger deprecation lints.

Apply this diff:

-use std::{fs, io::Error, u32};
+use std::{fs, io::Error};
enginelib/Cargo.toml (1)

26-28: Consider not forcing codegen-units = 1 in dev

This makes debug builds significantly slower. Keep it for release if you need determinism, but allow faster dev cycles.

Apply this diff:

 [profile.release]
 codegen-units = 1 # Make builds deterministic
 [profile.dev]
-codegen-units = 1 # Make builds deterministic
+# Use higher codegen units in dev for faster builds
+# (Remove entirely to use rustc defaults)
+codegen-units = 256
enginelib/src/events/start_event.rs (2)

7-8: Remove unused import

LibraryManager isn’t used in this module.

Apply this diff:

-    plugin::{LibraryManager, LibraryMetadata},
+    plugin::LibraryMetadata,

24-27: Avoid needless clone on freshly constructed ID

ID("core", "start_event") returns an owned Identifier; cloning it is redundant.

Apply this diff:

-                id: ID("core", "start_event").clone(),
+                id: ID("core", "start_event"),
engine/Cargo.toml (1)

27-27: Inconsistent version specification for tonic-prost

The dependency tonic-prost uses version "0.14.0" with explicit patch version, while all other related tonic dependencies use "0.14" without the patch version. This inconsistency could lead to version resolution issues.

Apply this diff for consistency:

-tonic-prost = "0.14.0"
+tonic-prost = "0.14"
enginelib/src/events/mod.rs (1)

52-56: Potential inefficiency with empty default entries

The initialization creates empty default entries for all registered tasks across three different collections. This could lead to memory overhead if there are many task types that are rarely used.

Consider lazy initialization of these entries when tasks are actually created or accessed:

-for (id, tsk) in api.task_registry.tasks.iter() {
-    api.task_queue.tasks.entry(id.clone()).or_default();
-    api.executing_tasks.tasks.entry(id.clone()).or_default();
-    api.solved_tasks.tasks.entry(id.clone()).or_default();
-}
+// Initialize task collections lazily when tasks are actually used
+// This can be done in the respective queue/collection methods
enginelib/tests/event_tests.rs (1)

119-121: Unnecessary return statement and unused parameter

The from_toml implementation has an unnecessary explicit return statement and doesn't use the parameter d.

Apply this diff to simplify:

-fn from_toml(&self, d: String) -> Box<dyn Task> {
-    return Box::new(self.clone());
-}
+fn from_toml(&self, _d: String) -> Box<dyn Task> {
+    Box::new(self.clone())
+}
enginelib/src/lib.rs (1)

12-12: Typo in type alias name

The type alias RawIdentier has a typo - it should be RawIdentifier.

Apply this diff to fix the typo:

-pub type RawIdentier = String;
+pub type RawIdentifier = String;

Note: Ensure to update all usages of this type alias throughout the codebase.

enginelib/src/event.rs (1)

9-10: Remove inappropriate comment

The comment on lines 9-10 is unprofessional and should be removed or replaced with a constructive technical explanation.

-// The Actual Fuck
-// this fucking piece of god given code saves so much time and wastes soo much time
+// Type-erased event handling with unsafe downcasting for performance
enginelib/src/api.rs (2)

139-147: Consistency: use snake_case and keep assignments consistent with init()

Variable naming deviates from Rust conventions, and while you assign the manager here (good), keep naming aligned with init/init_packer.

Apply this diff:

-        let mut newLibManager = LibraryManager::default();
-        newLibManager
+        let mut new_lib_manager = LibraryManager::default();
+        new_lib_manager
             .load_library("./target/release/libengine_core.so", api)
             .unwrap();
-        api.lib_manager = newLibManager;
+        api.lib_manager = new_lib_manager;

21-30: Minor: use imported type alias for Db in struct field

You import use sled::Db; but declare pub db: sled::Db. For consistency/readability, use the alias.

Apply this diff:

-    pub db: sled::Db,
+    pub db: Db,
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d4ea7f9 and 84d5ece.

⛔ Files ignored due to path filters (4)
  • Cargo.lock is excluded by !**/*.lock
  • engine/Cargo.lock is excluded by !**/*.lock
  • enginelib/Cargo.lock is excluded by !**/*.lock
  • enginelib/macros/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (22)
  • .gitignore (1 hunks)
  • Cargo.toml (1 hunks)
  • engine/Cargo.toml (1 hunks)
  • enginelib/Cargo.toml (1 hunks)
  • enginelib/LICENSE.md (1 hunks)
  • enginelib/build.rs (1 hunks)
  • enginelib/macros/Cargo.toml (1 hunks)
  • enginelib/macros/src/lib.rs (1 hunks)
  • enginelib/src/api.rs (1 hunks)
  • enginelib/src/config.rs (1 hunks)
  • enginelib/src/event.rs (1 hunks)
  • enginelib/src/events/admin_auth_event.rs (1 hunks)
  • enginelib/src/events/auth_event.rs (1 hunks)
  • enginelib/src/events/cgrpc_event.rs (1 hunks)
  • enginelib/src/events/mod.rs (1 hunks)
  • enginelib/src/events/start_event.rs (1 hunks)
  • enginelib/src/lib.rs (1 hunks)
  • enginelib/src/macros.rs (1 hunks)
  • enginelib/src/plugin.rs (1 hunks)
  • enginelib/src/prelude.rs (1 hunks)
  • enginelib/src/task.rs (1 hunks)
  • enginelib/tests/event_tests.rs (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (16)
enginelib/Cargo.toml (2)
src/bin/client.rs (1)
  • proto (6-8)
src/bin/server.rs (2)
  • EngineService (31-33)
  • proto (25-29)
enginelib/build.rs (1)
build.rs (1)
  • main (3-11)
enginelib/tests/event_tests.rs (5)
enginelib/src/events/mod.rs (1)
  • ID (11-13)
enginelib/src/api.rs (1)
  • test_default (54-76)
enginelib/src/event.rs (6)
  • clone_box (38-38)
  • cancel (39-39)
  • is_cancelled (40-40)
  • get_id (41-41)
  • as_any (42-42)
  • as_any_mut (43-43)
enginelib/src/events/cgrpc_event.rs (6)
  • clone_box (63-65)
  • cancel (67-69)
  • is_cancelled (70-72)
  • get_id (73-75)
  • as_any (76-78)
  • as_any_mut (80-82)
enginelib/src/task.rs (8)
  • clone_box (41-41)
  • get_id (40-40)
  • to_toml (70-70)
  • to_bytes (66-66)
  • serialize (82-82)
  • from_bytes (68-68)
  • deserialize (83-83)
  • from_toml (69-69)
enginelib/src/events/admin_auth_event.rs (4)
enginelib/src/events/mod.rs (1)
  • ID (11-13)
enginelib/src/event.rs (7)
  • get_event (13-16)
  • clone_box (38-38)
  • cancel (39-39)
  • is_cancelled (40-40)
  • get_id (41-41)
  • as_any (42-42)
  • as_any_mut (43-43)
enginelib/src/events/cgrpc_event.rs (6)
  • clone_box (63-65)
  • cancel (67-69)
  • is_cancelled (70-72)
  • get_id (73-75)
  • as_any (76-78)
  • as_any_mut (80-82)
enginelib/src/events/auth_event.rs (6)
  • clone_box (71-73)
  • cancel (75-77)
  • is_cancelled (78-80)
  • get_id (81-83)
  • as_any (84-86)
  • as_any_mut (88-90)
enginelib/src/lib.rs (3)
enginelib/src/event.rs (2)
  • register (81-87)
  • get (89-91)
enginelib/src/api.rs (2)
  • register (171-178)
  • get (180-182)
enginelib/src/task.rs (2)
  • register (80-80)
  • get (81-81)
enginelib/macros/src/lib.rs (4)
enginelib/src/task.rs (2)
  • verify (37-37)
  • deserialize (83-83)
enginelib/src/api.rs (2)
  • bincode (198-198)
  • bincode (235-235)
enginelib/tests/event_tests.rs (3)
  • bincode (117-117)
  • bincode (172-172)
  • bincode (219-219)
src/bin/client.rs (1)
  • proto (6-8)
enginelib/src/events/auth_event.rs (4)
enginelib/src/events/mod.rs (1)
  • ID (11-13)
enginelib/src/event.rs (6)
  • clone_box (38-38)
  • cancel (39-39)
  • is_cancelled (40-40)
  • get_id (41-41)
  • as_any (42-42)
  • as_any_mut (43-43)
enginelib/src/events/cgrpc_event.rs (6)
  • clone_box (63-65)
  • cancel (67-69)
  • is_cancelled (70-72)
  • get_id (73-75)
  • as_any (76-78)
  • as_any_mut (80-82)
enginelib/src/events/admin_auth_event.rs (6)
  • clone_box (104-106)
  • cancel (108-110)
  • is_cancelled (111-113)
  • get_id (114-116)
  • as_any (117-119)
  • as_any_mut (121-123)
engine/Cargo.toml (3)
src/bin/server.rs (3)
  • proto (25-29)
  • EngineService (31-33)
  • main (579-601)
src/bin/client.rs (2)
  • proto (6-8)
  • main (11-20)
build.rs (1)
  • main (3-11)
enginelib/src/events/mod.rs (8)
enginelib/src/events/auth_event.rs (1)
  • AuthEvent (49-67)
enginelib/tests/event_tests.rs (1)
  • id (18-20)
enginelib/src/events/admin_auth_event.rs (1)
  • AdminAuthEvent (82-100)
enginelib/src/config.rs (1)
  • new (31-43)
enginelib/src/api.rs (1)
  • init (77-85)
enginelib/src/events/cgrpc_event.rs (1)
  • CgrpcEvent (43-59)
enginelib/src/events/start_event.rs (1)
  • StartEvent (20-35)
src/bin/server.rs (3)
  • EngineService (31-33)
  • cgrpc (291-329)
  • proto (25-29)
enginelib/src/macros.rs (4)
enginelib/tests/event_tests.rs (1)
  • id (18-20)
enginelib/src/events/mod.rs (1)
  • ID (11-13)
enginelib/src/event.rs (6)
  • register (81-87)
  • clone (76-78)
  • handle (17-23)
  • handle (47-47)
  • handle (96-111)
  • get_event (13-16)
enginelib/src/lib.rs (1)
  • register (16-16)
Cargo.toml (1)
build.rs (1)
  • main (3-11)
enginelib/src/events/start_event.rs (4)
enginelib/src/events/mod.rs (1)
  • ID (11-13)
enginelib/src/event.rs (6)
  • clone_box (38-38)
  • cancel (39-39)
  • is_cancelled (40-40)
  • get_id (41-41)
  • as_any (42-42)
  • as_any_mut (43-43)
enginelib/src/events/cgrpc_event.rs (6)
  • clone_box (63-65)
  • cancel (67-69)
  • is_cancelled (70-72)
  • get_id (73-75)
  • as_any (76-78)
  • as_any_mut (80-82)
enginelib/src/events/auth_event.rs (6)
  • clone_box (71-73)
  • cancel (75-77)
  • is_cancelled (78-80)
  • get_id (81-83)
  • as_any (84-86)
  • as_any_mut (88-90)
enginelib/src/config.rs (2)
enginelib/src/api.rs (1)
  • default (33-51)
src/bin/server.rs (3)
  • proto (25-29)
  • EngineService (31-33)
  • main (579-601)
enginelib/src/task.rs (5)
enginelib/src/events/cgrpc_event.rs (2)
  • get_id (73-75)
  • clone_box (63-65)
enginelib/src/events/auth_event.rs (2)
  • get_id (81-83)
  • clone_box (71-73)
enginelib/src/events/start_event.rs (2)
  • get_id (50-52)
  • clone_box (39-41)
enginelib/src/lib.rs (2)
  • register (16-16)
  • get (17-17)
enginelib/src/api.rs (2)
  • register (171-178)
  • get (180-182)
enginelib/src/api.rs (6)
enginelib/src/task.rs (4)
  • deserialize (83-83)
  • serialize (82-82)
  • register (80-80)
  • get (81-81)
enginelib/src/config.rs (2)
  • default (14-21)
  • new (31-43)
enginelib/src/events/mod.rs (1)
  • init (51-81)
enginelib/src/event.rs (2)
  • register (81-87)
  • get (89-91)
enginelib/src/lib.rs (2)
  • register (16-16)
  • get (17-17)
src/bin/server.rs (4)
  • EngineService (31-33)
  • main (579-601)
  • delete_task (36-131)
  • proto (25-29)
enginelib/src/plugin.rs (3)
enginelib/src/api.rs (1)
  • default (33-51)
enginelib/macros/src/lib.rs (1)
  • metadata (5-12)
src/bin/server.rs (1)
  • EngineService (31-33)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Rust project - latest (stable)
  • GitHub Check: Analyze (rust)
🔇 Additional comments (10)
enginelib/LICENSE.md (1)

8-17: Policy inconsistency: “Fork and modify … distributed publicly” vs “You CANNOT share this software without express permission.”

These statements conflict. If sharing is prohibited without permission, public forks/modifications contradict that policy. Please clarify the intended licensing behavior.

Would you like me to draft a reconciled “You CAN/You CANNOT” section based on your intent (e.g., source-available vs open-source with specific restrictions)?

enginelib/build.rs (1)

5-23: Clarification: Protobuf compilation still occurs in engine/build.rs

The search shows that engine/build.rs (not enginelib/build.rs) contains the tonic_prost_build::configure()…compile_protos(&["proto/engine.proto"], &["proto"])?; step. The enginelib/build.rs was refactored solely to emit build metadata via vergen_gix and never handled protobuf codegen. No changes are needed.

Likely an incorrect or invalid review comment.

enginelib/Cargo.toml (1)

4-4: Confirm Rust Edition 2024 requires Rust 1.85 or newer
Rust Edition 2024 is only supported on the stable toolchain from rustc 1.85 (February 2025) onward. Please ensure your CI and developers are using Rust 1.85+; builds on earlier versions will error when parsing edition = "2024".

enginelib/src/events/mod.rs (1)

23-49: Good authentication handler registration with token-based security

The implementation properly handles both token-protected and unprotected scenarios for admin authentication, with appropriate conditional logic based on configuration.

enginelib/src/events/cgrpc_event.rs (1)

35-35: Equality comparison for handler_id is valid

The Identifier type is defined in enginelib/src/lib.rs as:

pub type Identifier = (String, String);

Since id is constructed as a (String, String) tuple, the comparison

if id == event.handler_id {}

is correct and will succeed when both elements match.
No change needed here.

Likely an incorrect or invalid review comment.

enginelib/src/macros.rs (1)

3-9: LGTM! Clean macro implementation for event registration

The register_event macro provides a clean abstraction for registering events with the event bus, properly using the Registry trait and Arc for shared ownership.

enginelib/src/plugin.rs (1)

159-166: LGTM! Proper error handling for module execution

Good error handling pattern for the unsafe module run function execution with clear error messages.

enginelib/src/event.rs (1)

95-111: LGTM! Well-structured event handling with proper instrumentation

The handle method is well-implemented with proper tracing instrumentation and clear debug messages for missing handlers.

enginelib/src/api.rs (1)

170-183: LGTM: Task registry implementation matches generic Registry contract

The register/get implementations are correct, clone_box usage is appropriate, and logging is helpful.

enginelib/src/task.rs (1)

86-90: LGTM: Clone for Box via clone_box

Trait-object cloning via clone_box is implemented correctly. This is consistent with returning boxed clones from the registry.

Comment on lines +3 to +23
use vergen_gix::{BuildBuilder, CargoBuilder, Emitter, GixBuilder, RustcBuilder};

fn main() {
// NOTE: This will output everything, and requires all features enabled.
// NOTE: See the specific builder documentation for configuration options.
let build = BuildBuilder::all_build().unwrap();
let cargo = CargoBuilder::all_cargo().unwrap();
let git = GixBuilder::all_git().unwrap();
let rustc = RustcBuilder::all_rustc().unwrap();

Emitter::default()
.add_instructions(&build)
.unwrap()
.add_instructions(&cargo)
.unwrap()
.add_instructions(&rustc)
.unwrap()
.add_instructions(&git)
.unwrap()
.emit()
.unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

⚠️ Potential issue

Build will fail unless vergen-gix “git” feature is enabled; either gate GixBuilder usage or enable the feature.

You’re unconditionally using GixBuilder::all_git(), which is compiled behind the “git” feature in vergen-gix. If enginelib/Cargo.toml only enables build, cargo, rustc features (as indicated), this will not compile.

Two options:

  1. Enable “git” in enginelib/Cargo.toml build-dependencies:
# enginelib/Cargo.toml
[build-dependencies]
vergen-gix = { version = "0.1", features = ["build", "cargo", "rustc", "git"] }
  1. Or gate git-specific code with a crate feature and forward it to vergen-gix:
# enginelib/Cargo.toml
[features]
build-metadata-git = ["vergen-gix/git"]

[build-dependencies]
vergen-gix = { version = "0.1", features = ["build", "cargo", "rustc"] }
-use vergen_gix::{BuildBuilder, CargoBuilder, Emitter, GixBuilder, RustcBuilder};
+use vergen_gix::{BuildBuilder, CargoBuilder, Emitter, RustcBuilder};
+#[cfg(feature = "build-metadata-git")]
+use vergen_gix::GixBuilder;

@@
-    let git = GixBuilder::all_git().unwrap();
+    #[cfg(feature = "build-metadata-git")]
+    let git = GixBuilder::all_git().unwrap();
@@
-        .add_instructions(&git)
-        .unwrap()
+        #[cfg(feature = "build-metadata-git")]
+        {
+            Emitter::default()
+                .add_instructions(&git)
+                .unwrap();
+        }
🤖 Prompt for AI Agents
In enginelib/build.rs around lines 3-23 you unconditionally call
GixBuilder::all_git(), but that type is compiled only when vergen-gix’s "git"
feature is enabled; fix by either (A) enabling the "git" feature in
enginelib/Cargo.toml build-dependencies so vergen-gix is built with
["build","cargo","rustc","git"], or (B) gate the git-specific code behind a
crate feature (e.g. build-metadata-git) and wrap the GixBuilder usage in
#[cfg(feature = "build-metadata-git")] while adding a features entry that
forwards to vergen-gix/git (i.e. build-metadata-git = ["vergen-gix/git"]) so the
code only compiles when that feature is enabled.

Comment on lines +1 to +2
pub use macros;
pub use tracing::{error, instrument, warn};
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Re-export procedural macros explicitly so downstream crates can use them ergonomically

pub use macros; re-exports the crate root, but does not necessarily expose proc-macro names as expected by users (e.g., #[derive(Verifiable)], #[metadata], #[module]). Re-export the macro items by name.

Apply this diff:

-pub use macros;
+pub use macros::{metadata, module, Verifiable};

The tracing re-exports look fine.

If you intend consumers to just use enginelib::prelude::*; and then write #[derive(Verifiable)] or #[metadata], please confirm this works in your downstream crates after the change. I can generate a quick script to assert usage across the repo.


🏁 Script executed:

#!/usr/bin/env bash
# Script to locate downstream usage of enginelib’s prelude and procedural macros
set -euo pipefail

echo "=== Looking for #[derive(Verifiable)] occurrences ==="
rg -n "#\\[derive\\(Verifiable\\)" || echo "No derive(Verifiable) usages found"

echo "=== Looking for #[metadata] occurrences ==="
rg -n "#\\[metadata\\]" || echo "No metadata macro usages found"

echo "=== Looking for #[module] occurrences ==="
rg -n "#\\[module\\]" || echo "No module macro usages found"

echo "=== Looking for imports of enginelib::prelude ==="
rg -n "use enginelib::prelude" || echo "No prelude imports found"

Length of output: 823


🏁 Script executed:

#!/usr/bin/env bash
# Verify that the procedural macros metadata, module, and Verifiable are defined
set -euo pipefail

echo "=== Checking for proc_macro_derive(Verifiable) ==="
rg -n "#\\[proc_macro_derive\\(Verifiable\\)" -A 1 || echo "No Verifiable derive macro found"

echo "=== Checking for proc_macro_attribute(metadata) ==="
rg -n "#\\[proc_macro_attribute\\(metadata\\)" -A 1 || echo "No metadata attribute macro found"

echo "=== Checking for proc_macro_attribute(module) ==="
rg -n "#\\[proc_macro_attribute\\(module\\)" -A 1 || echo "No module attribute macro found"

Length of output: 809


Explicitly export the defined proc-macro

pub use macros; re-exports the entire macros crate root, but only the Verifiable derive macro is currently defined. For downstream ergonomics, export it by name:

  • enginelib/src/prelude.rs (lines 1–2):

    -pub use macros;
    +pub use macros::Verifiable;

The tracing re-exports are fine.
Please verify that #[derive(Verifiable)] still resolves correctly after this change.

📝 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
pub use macros;
pub use tracing::{error, instrument, warn};
pub use macros::Verifiable;
pub use tracing::{error, instrument, warn};
🤖 Prompt for AI Agents
In enginelib/src/prelude.rs around lines 1 to 2, the file currently does a
blanket re-export of the macros crate which is unnecessary; replace the blanket
re-export with an explicit export of the derive macro by name (e.g. export
Verifiable from the macros crate), keep the existing tracing re-exports
unchanged, and then verify by building/running tests that #[derive(Verifiable)]
still resolves correctly downstream.

Copy link
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.

Review continued from previous batch...

@IGN-Styly IGN-Styly merged commit e8ec1d4 into main Aug 14, 2025
7 checks passed
@IGN-Styly IGN-Styly deleted the migration branch August 14, 2025 13:49
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