Skip to content

feat(events): generate opt-in model event umbrellas - #518

Merged
rapids-bot[bot] merged 5 commits into
rapidsai:mainfrom
johanpel:schema-based-event-import-iterator-model
Aug 4, 2026
Merged

feat(events): generate opt-in model event umbrellas#518
rapids-bot[bot] merged 5 commits into
rapidsai:mainfrom
johanpel:schema-based-event-import-iterator-model

Conversation

@johanpel

@johanpel johanpel commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Description

Generate model markers independently of instrumentation and optionally generate nested, model-wide event enums through Options::umbrella_event.

Generated umbrellas:

  • convert entity and descendant namespace events into ancestor umbrellas;
  • expose the root type through ModelEvents::UmbrellaEvent;
  • work without instrumentation or AnyEvent type erasure.

This also separates shared event/model contracts from instrumentation-specific contracts, records the analyzer package in model provenance, and
makes build-info serialization and sidecar support optional.

Umbrella generation remains disabled by default. Generated Rust name collisions are intentionally reported by the Rust compiler rather than
prevalidated by the generator.

ModelInfo::type_path is removed because analyzer discovery uses the model name, package, and analyzer package. New readers accept legacy sidecars
containing that field; old readers cannot deserialize newly written sidecars without it.

Testing

  • pixi run cargo fmt --all -- --check
  • pixi run cargo test -p quent-events -p quent-instrumentation -p quent-instrumentation-build --all-features
  • pixi run cargo clippy -p quent-events -p quent-instrumentation -p quent-instrumentation-build --all-targets --all-features -- -D warnings
  • pixi run cargo test -p quent-build-info --all-features

Written by Codex.

Related Issues

Part of #491 and #191

Ultimately not needed after migrating analysis to something like analysis-build, but for now this helps migrating the instrumentation / event side over to schema arch.

@johanpel
johanpel force-pushed the schema-based-event-import-iterator-model branch 3 times, most recently from 2fdec36 to 80e3420 Compare August 4, 2026 09:03
Signed-off-by: Johan Peltenburg <johan.peltenburg+code@gmail.com>
@johanpel
johanpel force-pushed the schema-based-event-import-iterator-model branch from 80e3420 to 560774c Compare August 4, 2026 09:27
Signed-off-by: Johan Peltenburg <johan.peltenburg+code@gmail.com>
Signed-off-by: Johan Peltenburg <johan.peltenburg+code@gmail.com>
Signed-off-by: Johan Peltenburg <johan.peltenburg+code@gmail.com>
@johanpel johanpel changed the title feat(events): generate model-wide event types feat(events): generate opt-in model event umbrellas Aug 4, 2026
Signed-off-by: Johan Peltenburg <johan.peltenburg+code@gmail.com>
@johanpel
johanpel marked this pull request as ready for review August 4, 2026 11:38
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

The PR separates model metadata from instrumentation traits, adds shared model and event contracts, generates model and umbrella event code, and migrates runtime and macro integrations to the new APIs.

Model and event contract refactor

Layer / File(s) Summary
Metadata and event contracts
crates/build-info/..., crates/events/...
Build metadata features and conditional sidecar APIs were added. ModelInfo now uses explicit model names, and shared Model and ModelEvents traits were introduced.
Generated models and umbrella events
crates/instrumentation-build/...
Instrumentation generation now emits model types, namespace event enums, optional umbrella events, and event conversions.
Runtime and macro trait integration
crates/instrumentation/..., crates/model/..., crates/model-macros/...
Runtime bounds and re-exports were updated. Generated entities now implement events::Entity, and generated models implement events::Model and events::ModelEvents.
Context and compatibility integration
crates/codegen/..., crates/open/src/viewer.rs
Context setup uses events::Model::model_info(). The compatibility fixture no longer sets the removed type_path field.

Estimated code review effort: 4 (Complex) | ~60 minutes

Possibly related PRs

Suggested labels: feature request

Suggested reviewers: dhruv9vats, mbrobbel, cmatzenbach

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the primary change: opt-in generation of model-wide event umbrella enums.
Description check ✅ Passed The description covers the change, related issues, testing, behavior, compatibility, and optional features; screenshots are not required for this non-UI change.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Note

Quiet mode is enabled, so only the most important comments were posted inline. Other review comments are grouped below.

🟡 Other comments (2)
crates/build-info/src/lib.rs-278-278 (1)

278-278: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Gate the test module on sidecar instead of serde.

The test module uses serde_json throughout, but serde_json is only available when the sidecar feature is enabled. The serde feature alone enables only dep:serde. A build with serde enabled but not sidecar will fail to compile the test module. Change the module guard to sidecar, which already includes serde as a dependency.

Proposed fix
-#[cfg(all(test, feature = "serde"))]
+#[cfg(all(test, feature = "sidecar"))]
 mod tests {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/build-info/src/lib.rs` at line 278, Update the test module’s cfg guard
from the serde feature to the sidecar feature so the module only compiles when
serde_json is available; leave the test implementation unchanged.
crates/events/src/lib.rs-13-15 (1)

13-15: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Document the new public re-exports.

These re-exports expand the public API but have no item documentation.

  • crates/events/src/lib.rs#L13-L15: add docs that describe the build-info, dynamic-attribute, and UUID re-exports.
  • crates/instrumentation/src/lib.rs#L20-L20: add docs that describe the InstrumentedModel re-export.
  • crates/instrumentation/src/lib.rs#L31-L31: add docs that describe the Model and ModelEvents re-exports.

As per path instructions, “New pub items need a doc comment and justified visibility; prefer pub(crate) or doc(hidden) when not part of the curated public API.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/events/src/lib.rs` around lines 13 - 15, Add documentation comments to
the public re-exports across three locations to document their purpose and
visibility. At crates/events/src/lib.rs lines 13-15, add doc comments above each
of the three pub use statements describing what build_info, DynamicAttributes,
and Uuid provide. At crates/instrumentation/src/lib.rs line 20, add a doc
comment above the InstrumentedModel re-export describing its purpose. At
crates/instrumentation/src/lib.rs line 31, add doc comments above the Model and
ModelEvents re-exports describing their purpose. Each comment should clearly
explain what the re-exported item is and why it is part of the public API.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/events/Cargo.toml`:
- Line 12: Move quent-build-info into the root workspace dependencies using the
specified crates/build-info path, then update the dependency declaration in the
events crate to use workspace = true while preserving default-features = false.

---

Other comments:
In `@crates/build-info/src/lib.rs`:
- Line 278: Update the test module’s cfg guard from the serde feature to the
sidecar feature so the module only compiles when serde_json is available; leave
the test implementation unchanged.

In `@crates/events/src/lib.rs`:
- Around line 13-15: Add documentation comments to the public re-exports across
three locations to document their purpose and visibility. At
crates/events/src/lib.rs lines 13-15, add doc comments above each of the three
pub use statements describing what build_info, DynamicAttributes, and Uuid
provide. At crates/instrumentation/src/lib.rs line 20, add a doc comment above
the InstrumentedModel re-export describing its purpose. At
crates/instrumentation/src/lib.rs line 31, add doc comments above the Model and
ModelEvents re-exports describing their purpose. Each comment should clearly
explain what the re-exported item is and why it is part of the public API.
🪄 Autofix

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: QUIET

Plan: Enterprise

Run ID: 052d01be-5aa2-4e24-94cf-d06de3517a66

📥 Commits

Reviewing files that changed from the base of the PR and between d0cc2db and 1d44c04.

⛔ Files ignored due to path filters (2)
  • Cargo.lock is excluded by !**/*.lock, !Cargo.lock
  • crates/instrumentation-build/example/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (22)
  • crates/build-info/Cargo.toml
  • crates/build-info/src/lib.rs
  • crates/codegen/src/cxx_bridge.rs
  • crates/codegen/src/pyo3_bridge.rs
  • crates/events/Cargo.toml
  • crates/events/src/lib.rs
  • crates/instrumentation-build/src/lib.rs
  • crates/instrumentation-build/src/model.rs
  • crates/instrumentation-build/src/namespace.rs
  • crates/instrumentation-build/src/runtime/context.rs
  • crates/instrumentation-build/src/runtime/mod.rs
  • crates/instrumentation/src/entity.rs
  • crates/instrumentation/src/lib.rs
  • crates/instrumentation/src/model.rs
  • crates/model-macros/src/entity_macro.rs
  • crates/model-macros/src/fsm_macro.rs
  • crates/model-macros/src/model_macro.rs
  • crates/model-macros/src/resource_derive.rs
  • crates/model/src/lib.rs
  • crates/model/tests/define_model.rs
  • crates/model/tests/entity_and_events.rs
  • crates/open/src/viewer.rs
💤 Files with no reviewable changes (1)
  • crates/open/src/viewer.rs

Comment thread crates/events/Cargo.toml
serde = ["dep:serde", "quent-dynamic-attributes/serde", "uuid/serde"]

[dependencies]
quent-build-info = { path = "../build-info", default-features = false }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n -C 2 'quent-build-info\s*=' Cargo.toml crates/events/Cargo.toml

Repository: rapidsai/quent

Length of output: 456


🏁 Script executed:

set -euo pipefail

printf '%s\n' '--- workspace dependency declarations ---'
rg -n -C 3 'quent-build-info|workspace.dependencies' Cargo.toml crates/*/Cargo.toml

printf '%s\n' '--- relevant manifests ---'
cat -n Cargo.toml | sed -n '1,100p'
cat -n crates/events/Cargo.toml | sed -n '1,40p'

Repository: rapidsai/quent

Length of output: 7305


🏁 Script executed:

set -euo pipefail

printf '%s\n' '--- workspace dependency section ---'
cat -n Cargo.toml | sed -n '120,240p'

printf '%s\n' '--- build-info manifest ---'
cat -n crates/build-info/Cargo.toml | sed -n '1,120p'

printf '%s\n' '--- all direct build-info dependency forms ---'
rg -n -C 1 'quent-build-info\s*=' --glob 'Cargo.toml'

Repository: rapidsai/quent

Length of output: 2023


Use the workspace dependency declaration. Add quent-build-info = { path = "crates/build-info" } under [workspace.dependencies], then change line 12 to quent-build-info = { workspace = true, default-features = false }. The current direct path dependency violates the workspace dependency policy.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/events/Cargo.toml` at line 12, Move quent-build-info into the root
workspace dependencies using the specified crates/build-info path, then update
the dependency declaration in the events crate to use workspace = true while
preserving default-features = false.

Source: Path instructions

@johanpel

johanpel commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

/merge

@rapids-bot
rapids-bot Bot merged commit e18291b into rapidsai:main Aug 4, 2026
22 checks passed
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