Skip to content

feat(proto): add scheduler command state schemas - #191

Merged
yordis merged 1 commit into
mainfrom
yordis/chore-compile-proto
May 29, 2026
Merged

feat(proto): add scheduler command state schemas#191
yordis merged 1 commit into
mainfrom
yordis/chore-compile-proto

Conversation

@yordis

@yordis yordis commented May 29, 2026

Copy link
Copy Markdown
Member
  • Scheduler commands need a shared lifecycle contract so replayed decisions stay consistent across command handlers.
  • Schedule definition history needs a clear boundary from runtime delivery history so execution records do not pollute command state.

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
@cursor

cursor Bot commented May 29, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Schema-only additions with no runtime or security behavior; consumers must adopt the new types separately.

Overview
Adds protobuf contracts for scheduler schedule command state and the definition-only event stream.

Introduces State / StateValue (MISSING, PRESENT_ENABLED, PRESENT_DISABLED, DELETED) so replayed command handlers can agree on schedule lifecycle. Adds ScheduleEvent as a oneof over ScheduleCreated, SchedulePaused, ScheduleResumed, and ScheduleRemoved, explicitly scoped to schedule-definition history (not runtime fire/delivery events).

Reviewed by Cursor Bugbot for commit d570593. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented May 29, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

Introduces two new protobuf schema definitions for the scheduler domain. The first defines a State message wrapping a StateValue enum with five state conditions. The second defines a ScheduleEvent wrapper message that aggregates four schedule lifecycle event types (created, paused, resumed, removed) using a oneof field.

Changes

Schedule State and Event Protocol Definitions

Layer / File(s) Summary
Schedule State enum and message
proto/trogonai/scheduler/schedules/state/v1/state.proto
StateValue enum represents five state conditions (unspecified, missing, present enabled/disabled, deleted), and State message wraps this enum in a single-field container for state representation.
Schedule Event wrapper
proto/trogonai/scheduler/schedules/v1/events.proto
ScheduleEvent wraps schedule lifecycle event types (ScheduleCreated, SchedulePaused, ScheduleResumed, ScheduleRemoved) using a oneof field to select one active event variant.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

  • TrogonStack/trogonai#187: Implements Rust encoding/decoding codecs and snapshot/event dispatch logic for the State and ScheduleEvent protobuf types introduced in this PR.

Poem

🐰 Two schemas born this day so fine,
State and events in perfect line,
Lifecycle dances, neat and clean,
Best event model ever seen! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat(proto): add scheduler command state schemas' accurately reflects the main changes, which involve adding new protobuf definitions for scheduler state and events.
Description check ✅ Passed The description is related to the changeset, explaining the rationale for introducing scheduler command state schemas and separating schedule definition from runtime delivery history.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch yordis/chore-compile-proto

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.

@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.

🧹 Nitpick comments (1)
proto/trogonai/scheduler/schedules/state/v1/state.proto (1)

1-1: Confirm Protobuf edition = "2024" is valid; document enum/state semantics

edition = "2024" is a supported Protobuf Editions value (requires protoc 32.0+). With that concern addressed, consider adding brief documentation for the StateValue lifecycle—especially the intended meaning/terminal nature of MISSING vs DELETED, and how pause/resume relates to PRESENT_ENABLED / PRESENT_DISABLED.

🤖 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 `@proto/trogonai/scheduler/schedules/state/v1/state.proto` at line 1, Confirm
the Protobuf edition value is correct (edition = "2024" requires protoc 32.0+);
then add short documentation comments in state.proto for the StateValue enum and
related messages explaining lifecycle semantics: clarify that MISSING represents
an object that was never present (or not yet observed) and is terminal for
lookup results, DELETED denotes a previously present object that has been
removed and is a terminal deletion state, and that PRESENT_ENABLED vs
PRESENT_DISABLED represent active vs paused presence (pause/resume transitions
map between PRESENT_ENABLED and PRESENT_DISABLED without being terminal);
reference the StateValue enum and any message types using it so consumers
understand terminal vs transitional states and pause/resume behavior.
🤖 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.

Nitpick comments:
In `@proto/trogonai/scheduler/schedules/state/v1/state.proto`:
- Line 1: Confirm the Protobuf edition value is correct (edition = "2024"
requires protoc 32.0+); then add short documentation comments in state.proto for
the StateValue enum and related messages explaining lifecycle semantics: clarify
that MISSING represents an object that was never present (or not yet observed)
and is terminal for lookup results, DELETED denotes a previously present object
that has been removed and is a terminal deletion state, and that PRESENT_ENABLED
vs PRESENT_DISABLED represent active vs paused presence (pause/resume
transitions map between PRESENT_ENABLED and PRESENT_DISABLED without being
terminal); reference the StateValue enum and any message types using it so
consumers understand terminal vs transitional states and pause/resume behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9cb89829-efc6-4b8e-9870-b83817aa43b5

📥 Commits

Reviewing files that changed from the base of the PR and between 514a90f and d570593.

📒 Files selected for processing (2)
  • proto/trogonai/scheduler/schedules/state/v1/state.proto
  • proto/trogonai/scheduler/schedules/v1/events.proto

@yordis
yordis merged commit 205df68 into main May 29, 2026
4 checks passed
@yordis
yordis deleted the yordis/chore-compile-proto branch May 29, 2026 21:59
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.

1 participant