Skip to content

Conversation

@kirkbrauer
Copy link
Member

@kirkbrauer kirkbrauer commented Sep 24, 2025

Add exporter status enum as proposed in #25

Summary by CodeRabbit

  • New Features

    • API: Exporter objects now include a read-only status field reflecting availability and lifecycle stage (Unspecified, Offline, Available, Before Lease Hook, Lease Ready, After Lease Hook).
    • The status field is output-only and appears in API responses wherever Exporter is returned.
  • Chores

    • Deprecated the existing read-only online flag for Exporter; clients remain backward compatible.

@coderabbitai
Copy link

coderabbitai bot commented Sep 24, 2025

Walkthrough

Adds an output-only status field to the Exporter message, deprecates the existing online field, and introduces a new ExporterStatus enum in the client v1 proto schema. No RPCs or service methods were added or changed.

Changes

Cohort / File(s) Summary
Proto schema: Exporter status
proto/jumpstarter/client/v1/client.proto
Marked Exporter.online (field 3) as deprecated = true (still OUTPUT_ONLY). Added Exporter.status (field 4) of type ExporterStatus (OUTPUT_ONLY). Introduced ExporterStatus enum with values: EXPORTER_STATUS_UNSPECIFIED, EXPORTER_STATUS_OFFLINE, EXPORTER_STATUS_AVAILABLE, EXPORTER_STATUS_BEFORE_LEASE_HOOK, EXPORTER_STATUS_LEASE_READY, EXPORTER_STATUS_AFTER_LEASE_HOOK.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • mangelajo

Poem

I hop through protos, neat and spry,
A status enum beneath the sky.
online bows with one last wink,
status steps up — no time to blink.
Carrots, fields, and tiny hops; I code and sniff and never stop. 🥕🐇

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title precisely summarizes the primary change in the changeset — the addition of an ExporterStatus enum and a status field — and directly matches the modifications shown in the proto file; it is concise, specific, and informative for reviewers scanning history.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch add-exporter-status

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.

@kirkbrauer
Copy link
Member Author

@mangelajo Will this break anything if we merge, or is there a specific order of steps that we need to go through on the controller side?

Copy link

@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: 0

🧹 Nitpick comments (2)
proto/jumpstarter/client/v1/client.proto (2)

71-72: Make status optional for presence semantics; define relationship with online.

  • Consider optional so clients can distinguish "unset" vs "UNSPECIFIED", consistent with other fields in this proto (e.g., optional timestamps).
  • Clarify/standardize how online relates to status to avoid divergence. A simple rule would be online == (status != EXPORTER_STATUS_OFFLINE). If that’s the intent, plan to deprecate online (later) or mark it as derived.

Suggested change in this hunk:

-  ExporterStatus status = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
+  optional ExporterStatus status = 4 [(google.api.field_behavior) = OUTPUT_ONLY];

Outside this hunk (for later, if you choose to deprecate):

bool online = 3 [(google.api.field_behavior) = OUTPUT_ONLY, deprecated = true];

Please confirm whether online should be strictly derived from status and whether servers will always populate status (making presence unnecessary).


74-81: Enum looks good; consider minor naming/docs polish.

  • Zero value UNSPECIFIED is correct. Good.
  • Optional: align with common API style by naming this “State” (ExporterState) rather than “Status” to convey lifecycle; not required.
  • Add brief comments per value to improve generated docs, since these are user-facing states.

Example:

// The exporter is reachable and can accept a lease.
EXPORTER_STATUS_AVAILABLE = 2;
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8d91c4a and f54cc90.

📒 Files selected for processing (1)
  • proto/jumpstarter/client/v1/client.proto (1 hunks)

Copy link

@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: 0

🧹 Nitpick comments (1)
proto/jumpstarter/client/v1/client.proto (1)

74-81: Document state machine expectations and availability semantics.

Enum design looks solid. Add a brief enum-level comment clarifying transitions and availability so clients can reason safely (e.g., only AVAILABLE indicates free-to-lease; other states are not available). This improves forward compatibility.

Apply this diff to add a synopsis:

-enum ExporterStatus {
+// Describes the exporter lifecycle/status for client consumption.
+// Notes:
+// - Only EXPORTER_STATUS_AVAILABLE indicates the exporter can be leased.
+// - Additional states may be added in the future; clients should default
+//   to treating unknown states as not available.
+// - Mapping to legacy `online`: online == (status != OFFLINE).
+enum ExporterStatus {
   EXPORTER_STATUS_UNSPECIFIED = 0;       // Unspecified exporter status
   EXPORTER_STATUS_OFFLINE = 1;           // Exporter is offline
   EXPORTER_STATUS_AVAILABLE = 2;         // Exporter is available to be leased
   EXPORTER_STATUS_BEFORE_LEASE_HOOK = 3; // Exporter is executing before lease hook(s)
   EXPORTER_STATUS_LEASE_READY = 4;       // Exporter is leased and ready to accept commands
   EXPORTER_STATUS_AFTER_LEASE_HOOK = 5;  // Exporter is executing after lease hook(s)
 }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f54cc90 and 3c30d6d.

📒 Files selected for processing (1)
  • proto/jumpstarter/client/v1/client.proto (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-06T11:35:36.215Z
Learnt from: michalskrivanek
PR: jumpstarter-dev/jumpstarter-protocol#24
File: proto/jumpstarter/client/v1/client.proto:70-70
Timestamp: 2025-08-06T11:35:36.215Z
Learning: In the jumpstarter-protocol repository, the user michalskrivanek intentionally uses non-optional boolean fields for status indicators like the `online` field in the Exporter message, preferring to treat unset values as false rather than distinguishing between unset and explicitly false states.

Applied to files:

  • proto/jumpstarter/client/v1/client.proto
🔇 Additional comments (1)
proto/jumpstarter/client/v1/client.proto (1)

70-72: Document mapping from onlinestatus and treat EXPORTER_STATUS_UNSPECIFIED as unknown.

proto/jumpstarter/client/v1/client.proto already contains deprecated online (field 3) and status (field 4, enum includes EXPORTER_STATUS_UNSPECIFIED). Add these comments to guide migration:

   string name = 1 [(google.api.field_behavior) = IDENTIFIER];
   map<string, string> labels = 2;
-  bool online = 3 [(google.api.field_behavior) = OUTPUT_ONLY, deprecated = true];
-  ExporterStatus status = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
+  // Deprecated: use `status` instead.
+  // Compatibility: servers should continue to populate this for a grace period.
+  // Mapping: treat `online == true` iff `status != EXPORTER_STATUS_OFFLINE`.
+  bool online = 3 [(google.api.field_behavior) = OUTPUT_ONLY, deprecated = true];
+  // Overall exporter lifecycle status.
+  // Default/zero value is `EXPORTER_STATUS_UNSPECIFIED`; clients should treat that
+  // as unknown (and not assume availability).
+  ExporterStatus status = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
 }

Operational sequence:

  • Merge proto and regenerate SDKs.
  • Update controller to populate status while continuing to set online per the mapping.
  • After clients migrate, remove online and reserve field number 3.

Confirm the controller will emit both fields during the migration window and that client logic treats EXPORTER_STATUS_UNSPECIFIED as unknown.

@mangelajo mangelajo merged commit a865a5f into main Sep 24, 2025
2 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.

3 participants