Repository navigation
[CTX-1185] feat(dynapi): version negotiation for broker services.get (#2006) - #2049
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 8 minutes. View limit details
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. Comment |
Xuepoo
left a comment
There was a problem hiding this comment.
Independent review verdict (guard cron / separate agent reviewer)
Commit reviewed: c05863aee22623044bb0d8b204c57ecce637d04e (branch carryctx/ctx-1185-dynapi-negotiation, PR #2049)
Verdict: APPROVE (minor non-blocking notes only)
Findings:
- Fail-closed negotiation is genuinely implemented.
services.getpins an exact negotiated version into the consumer handle:HostServices::service_calltakes aversionparam (crates/bitty-lua/src/host.rs:1433) and the runtime resolves the exact record viafind_active(iface, provider, version)(crates/bitty-runtime/src/plugin_runtime/services.rs:3158;find_activeat:1016with version +!suspendedpredicate at:1021) — a handle resolved at one version can never drive a same-provider sibling record. - Side-by-side coexistence enforced.
ServiceDirectory::publishretains by(provider, version)instead of provider-only (services.rs:960-963); resolution still fails closed withE_SERVICE_RESOLUTIONwhen the requirement intersects no visible version (services.rs:3122-3129). - Grant-safe diagnostic. The resolve loop checks heads-covered before recording
visible_versions, so an ungranted provider's versions never leak into theavailable:listing; the listing is capped atMAX_RESOLUTION_LISTED_VERSIONS = 8with a remainder count (services.rs:3060-3091,list_visible_versions :1053-1082). - Manifest multi-version expansion.
[services.provided] versionaccepts a non-empty string array capped atMAX_PROVIDED_SERVICES, each expanding to its ownProvidedServicesharing schemas/heads (manifest_toml.rs:420,parse_provided_entry :758-835); duplicate(iface, version)pairs rejected, distinct versions allowed (crates/bitty-plugin-host/src/manifest.rs:2409-2420). - Bind-by-occurrence shared between gate and publisher.
declared_provision_slotbinds the nth provision to the nth declared(interface, version); bothvalidate_capture(mod.rs:2849-2892) andpublish_services(mod.rs:2251-2266) use the same helper, so they cannot disagree. - Tests exercise the negotiation. Unit tests cover highest-compatible pick, exact pin, empty-intersection fail-closed, removal flipping to fail-closed, version-pin driving the exact record, listing cap / hide-ungranted, and directory coexistence (
services.rs:5643-5890); an end-to-end integration test activates a provider declaringversion=["1.0.0","2.0.0"]proving range→v2, pin→v1, empty-range→E_SERVICE_RESOLUTION, per-call ledger version, and pin survival across dispose+re-activate (crates/bitty-runtime/tests/plugin_services.rs:870-952).
Non-blocking notes: the duplicate (iface, version) guard at mod.rs:2895 is effectively unreachable (harmless defense-in-depth); the services.rs:3081 comment reads more absolute than the occurrence/pin behavior (a fresh get after the top version is revoked can return a lower compatible version — a new resolution, not a rebind); debug.rs:28-29 names "fail-closed version negotiation" in pre-existing text not part of this diff.
Read-only review of the 7 files in the diff; signature-change blast radius checked exhaustively via rg (service_call has exactly two impls + the runtime host→bridge call site, all updated in lockstep). just ci-local not run per lane lock.
c05863a to
0266ab4
Compare
Xuepoo
left a comment
There was a problem hiding this comment.
Commander pre-merge check: rebased onto post-2047/2048 main with keep-both resolution (verified: lib 845, host_bridge 47, w147 9/9, fmt, clippy). Full CI green, no CodeRabbit findings. Merging.
Implements #2006 (dynapi 3/4): semver-range matching with empty-intersection fail-closed, side-by-side coexistence, and no silent downgrade.
Gates: fmt clean, clippy -D warnings clean (workspace + dev-tools), runtime lib 278 plugin_runtime passed, plugin-host lib 406 passed, bitty-lua all suites green, plugin_services 11 passed (+ related plugin suites), windows target check clean, verify_w147_small_core_graph 9/9. ci-local blocked by the same pre-existing sccache GHA-backend failure under act as #2047/#2048; scratch-paths fails pre-existing in untouched wsl.rs/component.rs. No manifest changes (cargo-deny N/A), no TODO, no new production edges or authority paths.
Stacking note: branched from main per quartet rule; converges with #2047 arbitration (ambiguity over visible owners composes with highest-wins; qualified pins select before negotiation). Docs sync noted for bitty-terminal-docs interface material + Plugins API surface (separate repo).
Priority: P2 | Area: plugins | Labels: feat,P2,area:plugins | Milestone: v0.1.0 | Task: CTX-1185
Closes #2006