Repository navigation
refactor(runtime): use enumset for frame demand reasons - #505
Conversation
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
📒 Files selected for processing (1)
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
⛔ Files ignored due to path filters (1)
📒 Files selected for processing (4)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review. 📝 WalkthroughWalkthroughThe display runtime replaces its custom ChangesDemand reason set
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Refactor Merge Risk: ⚪ Minimal · up to The set migration has no identified issue that needs resolution before merge; proceed with normal checks. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
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. Comment |
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
2 open findings
What changed in this PR
Refactors the render-thread frame scheduling “demand reason” set implementation from a fixed u32 bitset to enumset::EnumSet, removing the 32-variant coupling while keeping declaration-order iteration and existing scheduling behavior.
Changes:
- Derive
enumset::EnumSetTypeforDemandReasonand replaceDemandReasonSetwithenumset::EnumSet<DemandReason>. - Remove custom set logic (bit operations, iteration,
FromIterator) in favor of enumset’s implementations. - Add enumset as a workspace dependency and add a regression test covering ordering/dedup/emptiness.
| File | Description |
|---|---|
| crates/neomacs-display-runtime/src/render_thread/frame_sched.rs | Switch DemandReasonSet to EnumSet and derive EnumSetType on DemandReason. |
| crates/neomacs-display-runtime/src/render_thread/tests/frame_sched_test.rs | Add regression test for deduplication, ordering, and empty-set behavior. |
| crates/neomacs-display-runtime/Cargo.toml | Add enumset dependency to the runtime crate via workspace deps. |
| Cargo.toml | Add enumset to workspace dependency versions. |
🧠 Review effort: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| pub(crate) type DemandReasonSet = enumset::EnumSet<DemandReason>; | ||
|
|
| .rev() | ||
| .chain(DemandReason::ALL) | ||
| .collect(); | ||
| assert_eq!(reasons.iter().collect::<Vec<_>>(), DemandReason::ALL); |


DemandReasonSetimplemented its ownu32bitset with shifts based on enum indices, coupling set capacity to 32 reasons. Replace it with an alias forenumset::EnumSet<DemandReason>and deriveEnumSetTypeon the existing enum.Remove handwritten insertion, membership, emptiness, iteration, and
FromIteratorimplementations. Let enumset select storage for the variant count. Keep the existing enum traits, declaration-order iteration, diagnostic reason names, and counter indices. Disable generated supertrait implementations and enum operators to preserve the existing enum interface. Counter arrays and scheduling policy are unchanged.Add enumset 1.1.14 as a runtime workspace dependency, including its derive dependencies in the lockfile. Existing locked package versions are retained.
Validation:
cargo nextest run -p neomacs-display-runtime --lib -E 'test(render_thread::frame_sched::frame_sched_test::)'passes all 45 scheduler tests in parallel. An added regression test covers all 22 reasons, reverse insertion, deduplication, declaration-order iteration, and default emptiness. Existing tests cover frame attribution, counter ordering, deadlines, and independent windows. Formatting and diff checks pass. Tests remain inrender_thread/tests/frame_sched_test.rs.