Repository navigation
fix(broker): serve .servicedef.v2 via a v2-first combined loader (soldr#2364) - #905
Merged
Merged
Conversation
…ader (soldr#2364)
The shared broker's serve path (serve_launching_backends / HelloRouter) read
only v1 `.servicedef` files, but soldr — and every consumer that installs via
write_service_definition_v2 — writes `.servicedef.v2`. So a real Hello was
Refused { "service definition was not found" } even though the file was on
disk: it was under the v2 extension the v1 loader never looks for. This is the
last blocker to a real broker-mediated compile reaching Negotiated in Phase 2
of soldr#2361.
Adds `CombinedServiceDefinitionLoader`: it tries the v2 file first, falls back
to the v1 file, and returns the v1 `ServiceDefinition` type the whole downstream
launch chain (check_version_allowed, BrokerInstanceKey::from_service_definition,
BackendLaunchRequest, ...) already consumes. v2 is a strict superset of v1
(identical field numbers 1-8 plus the v2-only optional http_server at field 10),
so the down-conversion is lossless for everything the launch path reads.
To keep the existing v1-installing unit/integration tests working unchanged,
HelloRouter now takes its loader as `&dyn ServiceDefinitionSource` instead of a
concrete `&ServiceDefinitionLoader`. Both the bare v1 loader and the combined
loader implement the trait, and `&ServiceDefinitionLoader` unsize-coerces to the
trait object at every existing call site — so the ~15 `HelloRouter::new`/
`with_lifecycle_monitor` calls in tests/broker/*.rs compile untouched. serve.rs
switches its two loader constructions to the combined loader.
A missing v2 file (only) falls back to v1; any other v2 error (insecure dir,
decode failure, name mismatch) surfaces as-is so a genuinely broken v2 install
is never masked by a stale v1 fallback.
Testing: 6 new combined_service_def_loader unit tests (v2 load+convert, v1
fallback, v2-preferred, missing-both NotFound, corrupt-v2-surfaced,
conversion-drops-http_server); 46 broker::server lib tests, 14 hello_router +
instance_isolation integration tests, clippy (client), and fmt all pass.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This was referenced Aug 9, 2026
zackees
added a commit
that referenced
this pull request
Aug 9, 2026
…soldr#2364) (#907) Adds serve_launching_backends_negotiates_with_a_v2_servicedef: a cold Hello against a real serve_launching_backends broker whose service is installed as a .servicedef.v2 file (the soldr/v2-consumer default) now negotiates a backend instead of returning Refused { "service definition was not found" }. This is the integration-level acceptance proof for Phase 2 of soldr#2361: it exercises the full fixed path -- client-side Frame-wrapped Hello (#904) through the CombinedServiceDefinitionLoader's v2-first lookup (#905) to a Negotiated reply -- against the real accept loop, not a stub. Existing v1-servicedef serve tests continue to pass via the loader's v1 fallback. Co-authored-by: Claude Opus 4.8 (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.
The bug (Phase 2 of forge-ci/soldr#2361, soldr#2364)
The shared broker's serve path (
serve_launching_backends/HelloRouter) readonly v1
.servicedeffiles, but soldr — and every consumer that installs viaprotocol_v2::write_service_definition_v2— writes.servicedef.v2files.So a real Hello against a live
soldr broker servecame backRefused { "service definition was not found" }even though the servicedef wason disk: it was under the v2 extension the v1 loader never looks for. This was
the last blocker to a real broker-mediated compile reaching
Negotiatedinsteadof
Refused.The fix
CombinedServiceDefinitionLoadertries the v2 file first, falls back to the v1file, and returns the v1
ServiceDefinitiontype the whole downstream launchchain (
check_version_allowed,BrokerInstanceKey::from_service_definition,BackendLaunchRequest, …) already consumes. v2 is a strict superset of v1 —identical field numbers 1–8, plus the v2-only optional
http_serverat field 10 —so the down-conversion (
service_definition_v2_to_v1) is lossless for everythingthe launch path reads (the aggregator-facing
http_serverhint is dropped; thelaunch path never reads it).
Why a trait, not a concrete type swap
Swapping
HelloRouter's loader field to the v2 loader directly produces 7E0308mismatched-type errors, becauseServiceDefinitionis a separatelygenerated prost type per protocol version and every downstream consumer takes
the v1 type by signature. Instead,
HelloRouternow takes its loader as&dyn ServiceDefinitionSource. Both the bare v1ServiceDefinitionLoaderandthe new combined loader implement the trait, and
&ServiceDefinitionLoaderunsize-coerces to the trait object at every existing call site — so the ~15
HelloRouter::new/with_lifecycle_monitorcalls acrosstests/broker/*.rs(which install v1 files) compile and pass unchanged.
serve.rsswitches itstwo loader constructions to the combined loader.
Fallback safety
A missing v2 file (only) falls back to v1. Any other v2 error — insecure
directory, decode failure, service-name mismatch — surfaces as-is, so a genuinely
broken v2 install is loud rather than silently served from a stale v1 file.
Testing
combined_service_def_loaderunit tests: v2 load+convert, v1 fallback,v2-preferred-when-both-present, missing-both →
Io(NotFound), corrupt-v2surfaced (not masked), and conversion drops
http_serverwhile carrying everyshared field.
broker::serverlib suite (46 tests),hello_router::(14) +instance_isolationintegration tests,clippy -p running-process --features client -- -D warnings, andfmt --check: all clean.Downstream
Once merged, soldr's
_vender/running-processsubmodule pin (currently beingbumped for the #904 Frame-wrap fix in forge-ci/soldr#2382) bumps again to include
this, which should let a real
SOLDR_USE_BROKER=1cold compile negotiate throughthe broker end-to-end. I'll validate that on soldr's Linux Docker harness after
the bump.