Repository navigation
feat(broker-v2): extend ServiceDefinition with v1 launcher/isolation fields (slice 22 of zccache#782) - #521
Merged
Conversation
…fields (slice 22 of zccache#782) zccache's v1 → v2 broker migration (zccache#782) is gated on the v2 ServiceDefinition envelope carrying the launcher / isolation policy fields v1 has used since #228. Without them, every consumer that uses \`broker::builders::ServiceDefinitionBuilder::shared_broker(name, path)\` or \`broker::server::ServiceDefinitionLoader\` has to keep importing v1 types just to express "spawn this binary under shared isolation, pinned to this version" — defeating the migration entirely. This slice ports the v1 fields verbatim into the v2 \`ServiceDefinition\` message (field numbers 2–8 deliberately mirror v1's so the per-field migration is mechanical): - \`binary_path\` (field 2) - \`isolation\` (field 3) — new \`BrokerIsolation\` enum mirrors v1's - \`explicit_instance\` (field 4) - \`per_version_binary_dir\` (field 5) - \`min_version\` (field 6) - \`version_allow_list\` (field 7) - \`labels\` (field 8) The v2-only \`http_server\` field stays at 10 (unchanged) and new v2-only fields grow upward from there. Pre-#522 v2 brokers that already speak this schema ignore the new fields per proto3 forward-compat semantics; the brokers will start honoring them once their loader/launcher learns to read them. Tests: - \`service_definition_v1_fields_round_trip\` — every new field survives prost encode + decode end-to-end, including a populated \`labels\` map and a 2-entry \`version_allow_list\`. - \`broker_isolation_enum_values_round_trip\` — pins each enum variant's proto-int value so a future variant addition forces an explicit test update instead of silently misclassifying as the zero value. - \`service_definition_explicit_instance_round_trips_with_any_isolation\` — documents that the proto encoder is permissive about the gating between \`isolation\` and \`explicit_instance\`; the broker enforces the semantic relationship, not the schema. - Pre-existing 6 tests adapted to use \`..Default::default()\` so they survive the field-count change. Closes the upstream prerequisite for zccache#782 slice 21 (service_definition.rs migration) + downstream zccache#782 slice 24 (BackendHandle / DaemonProcess — needs the same launcher metadata). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This was referenced Jun 20, 2026
zackees
added a commit
that referenced
this pull request
Jun 20, 2026
…v2 extensions (#524) Auto-Release will publish this version to crates.io + PyPI on push to main. ## Since 4.5.5 **Broker v2 client hardening (#520)** — closes #517, #518, #519 - \`DEFAULT_HELLO_DEADLINE\` + \`connect_with_deadline\` (3s; mirrors v1) - \`BrokerV2Error::Refused\` promotes \`retry_after_ms\` to top-level - \`SocketCleanup\` RAII guard on \`spawn_stub_broker\` test helper **ServiceDefinition v2 schema extension (#521)** - v2 envelope now carries v1's launcher/isolation field set (binary_path, isolation, explicit_instance, per_version_binary_dir, min_version, version_allow_list, labels) — unblocks consumer-side v2 migrations - New \`BrokerIsolation\` enum mirrors v1's - 3 new round-trip tests (every new field + every enum variant + explicit_instance survives all isolation modes) **ServiceDefinition v2 consumer I/O (#522)** - \`protocol_v2::io::ServiceDefinitionBuilder\` mirrors v1's builder API - \`write_service_definition_v2\`, \`service_definition_dir_v2\`, \`SERVICE_DEF_V2_EXTENSION\` (\`.servicedef.v2\`) - 11 new tests including full builder→install→decode round-trip Unblocks downstream forge-ci/zccache#782 slices 21-25 (consumer-side v1 → v2 migration burn-down) and forge-ci/zccache#840 (bincode wire retirement, which independently needs these v2 surfaces to be stable in a published release before zccache can drop its git+rev patch pin). Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Unblocks zccache#782 slice 21 (service_definition.rs migration) by porting the v1 `ServiceDefinition` launcher/isolation field set into the v2 envelope. zccache cannot move its `ServiceDefinitionBuilder::shared_broker` / `ServiceDefinitionLoader` call sites to v2 without these fields existing on the v2 schema.
What changed
`broker_v2_service_def.proto` gains 7 fields (numbers 2–8 deliberately mirror v1's for diff legibility) + the `BrokerIsolation` enum:
The v2-only `http_server` field stays at 10. New v2-only fields grow upward from there.
Forward-compat
Pre-#522 v2 brokers ignore the new fields per proto3 semantics — the envelope still round-trips. The brokers start honoring them when their loader / launcher learns to read them (separate slice; not in this PR's scope).
Tests
3 new round-trip tests in `broker::protocol_v2::tests`:
Pre-existing 6 tests adapted to `..Default::default()` so they survive the field-count change.
Test plan
Coordinated with zccache#782 (consumer-side burn-down). zccache slice 21 will land as its own PR once this merges + a release ships.
Closes the upstream prerequisite called out in zccache#782 (slice 22 row).