-
Notifications
You must be signed in to change notification settings - Fork 0
Migration #35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughConverted 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
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
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<...>>)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
⏰ 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)
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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 parameterSame 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 parameterSame 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_macrosin 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.htmlNote: 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 confusinguse std::u32importPrimitive types are in the prelude;
u32::MAXdoes not require importingstd::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 forcingcodegen-units = 1in devThis 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 = 256enginelib/src/events/start_event.rs (2)
7-8: Remove unused import
LibraryManagerisn’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-prostThe dependency
tonic-prostuses 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 entriesThe 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 methodsenginelib/tests/event_tests.rs (1)
119-121: Unnecessary return statement and unused parameterThe
from_tomlimplementation has an unnecessary explicit return statement and doesn't use the parameterd.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 nameThe type alias
RawIdentierhas a typo - it should beRawIdentifier.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 commentThe 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 performanceenginelib/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 fieldYou import
use sled::Db;but declarepub 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
⛔ Files ignored due to path filters (4)
Cargo.lockis excluded by!**/*.lockengine/Cargo.lockis excluded by!**/*.lockenginelib/Cargo.lockis excluded by!**/*.lockenginelib/macros/Cargo.lockis 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 inengine/build.rsThe search shows that
engine/build.rs(notenginelib/build.rs) contains thetonic_prost_build::configure()…compile_protos(&["proto/engine.proto"], &["proto"])?;step. Theenginelib/build.rswas refactored solely to emit build metadata viavergen_gixand 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 parsingedition = "2024".enginelib/src/events/mod.rs (1)
23-49: Good authentication handler registration with token-based securityThe 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 forhandler_idis validThe
Identifiertype is defined inenginelib/src/lib.rsas:pub type Identifier = (String, String);Since
idis constructed as a(String, String)tuple, the comparisonif 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 registrationThe
register_eventmacro 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 executionGood 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 instrumentationThe
handlemethod 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 contractThe 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_boxTrait-object cloning via
clone_boxis implemented correctly. This is consistent with returning boxed clones from the registry.
| 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(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
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:
- Enable “git” in enginelib/Cargo.toml build-dependencies:
# enginelib/Cargo.toml
[build-dependencies]
vergen-gix = { version = "0.1", features = ["build", "cargo", "rustc", "git"] }- 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.
| pub use macros; | ||
| pub use tracing::{error, instrument, warn}; |
There was a problem hiding this comment.
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.
| 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.
There was a problem hiding this 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...
Summary by CodeRabbit
New Features
Tests
Docs
Chores