-
Notifications
You must be signed in to change notification settings - Fork 7
Add type field to ActiveBuild record #287
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
In the future, we may want to add other types of active operations (like substitutions or waits for locks). So let's make this an internally tagged enum (in serde terminology) that can be extended later.
WalkthroughThe changes add serialization validation to Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
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: 0
🧹 Nitpick comments (1)
src/libstore/active-builds.cc (1)
120-120: LGTM – Type field pairs with validation.The addition of the "type" field to the JSON output correctly pairs with the deserialization validation at lines 102-104. This is forward-compatible as older readers will simply ignore the additional field.
Optional: Consider extracting the "build" string literal (used here and at line 103) into a named constant to ensure consistency and ease future maintenance.
// At file or namespace scope static constexpr const char* ACTIVE_BUILD_TYPE = "build";Then use
ACTIVE_BUILD_TYPEat lines 103 and 120.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/libstore/active-builds.cc(2 hunks)
⏰ 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: build_aarch64-darwin / build
- GitHub Check: build_x86_64-linux / build
🔇 Additional comments (1)
src/libstore/active-builds.cc (1)
102-104: No action needed—this is not a breaking change.The "type" field addition does not create a backward compatibility issue.
ActiveBuildJSON is used exclusively in the worker protocol'sQueryActiveBuildsfeature, which is behind a feature flag (featureQueryActiveBuilds). Old clients and daemons that lack this feature will not attempt to deserialize this JSON; they fail earlier with "remote store does not support querying active builds". Since both client and daemon are updated together in the same release, there is no persistent storage or version mismatch concern. Thej.at("type")call is appropriate for a required field in a versioned protocol.Likely an incorrect or invalid review comment.
cole-h
left a comment
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.
LGTM.
|
|
||
| ActiveBuild adl_serializer<ActiveBuild>::from_json(const json & j) | ||
| { | ||
| auto type = j.at("type").get<std::string>(); |
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.
This could also be used to version (e.g. build-v2 type with different fields) (paraphrased from a convo with Eelco)
Motivation
In the future, we may want to add other types of active operations (like substitutions or waits for locks). So let's make this an internally tagged enum (in serde terminology) that can be extended later.
Context
Summary by CodeRabbit
Bug Fixes
Chores
✏️ Tip: You can customize this high-level summary in your review settings.