Skip to content

fix(contracts): negotiate protocol versions per app and release 1.4.1 - #11

Merged
RentnerKev merged 1 commit into
mainfrom
rentner/fix/negotiate-protocol-versions
Nov 28, 2026
Merged

RentnerKev merged 1 commit into
mainfrom
rentner/fix/negotiate-protocol-versions

Conversation

@RentnerKev

Copy link
Copy Markdown
Member

Summary

Fixes a compatibility bug in 1.4.0. Raising PROTOCOL_VERSION to 1.1.0 made the pipeline's candidate smoke bootstrap every candidate with appProtocol/platformApi/uiBridge 1.1.0. But apps built from app-template-ts with SDK ≤1.3.0 parse those fields as z.literal('1.0.0') and also compare them with === '1.0.0'. So every existing app failed the Marketplace smoke, and would fail on a platform that sends 1.1.0. No repository has adopted 1.4.0 yet.

The rule: per-app negotiation from the manifest. For each of appProtocol, platformApi and uiBridge (the last only for apps with a UI), the negotiated version is the lower bound of the manifest's requires range. It must be at most the offered version and must satisfy the range; otherwise the app is incompatible.

  • >=1.0.0 <2.0.0 negotiates 1.0.0, so existing apps keep their exact 1.0.0.
  • >=1.1.0 <2.0.0 negotiates 1.1.0.

The platform implements the same rule for install, bootstrap, context, readiness and the offered/refused gate.

Changes

  • Rust: Contracts::negotiate_versions(manifest, &ManifestEnvironment) -> Result<NegotiatedVersions, ContractError> in rentnerproxy-app-contracts. It reuses the existing range logic: protocol_order was split out of supports_protocol, so there is no second parser.
  • TypeScript: negotiateVersions(requires, offer), exported with NegotiatedVersions and ProtocolOffer.
  • Pipeline smoke: it bootstraps each candidate with its negotiated versions. input.version is accepted and ignored, and documented as deprecated, so callers on SDK ≤1.3.0, which pass 1.0.0, keep working, and so do callers that pass nothing.
  • rentnerproxy-app-runtime: needs no change. It already echoes the bootstrap's appProtocol and caps it only when the bootstrap is above its own version.
  • Docs: the rule is documented on both helpers and in the README's protocol version table.
  • Versions: contract, crates and npm are at 1.4.1, with regenerated schemas.

Follow-ups

  • Marketplace: adopt 1.4.1 and stop reading BootstrapDescriptor…appProtocol.const in runtime-smoke.ts; pass no version.
  • app-template-ts: call negotiateVersions(manifest.requires, …) in src/server/bootstrap.ts instead of hard-coding '1.0.0'. Existing apps stay valid without that change.

Tests

  • Shared fixtures (fixtures.json, key negotiation, 8 cases, run in Rust and TypeScript):
    • >=1.0.0 → 1.0.0 and >=1.1.0 → 1.1.0;
    • >=1.2.0 on 1.1.0 is incompatible;
    • no UI → no uiBridge;
    • uiBridge follows its own range;
    • a UI without an offered bridge is incompatible;
    • a capped range negotiates its lower bound.
  • Pipeline (smoke_bootstrap.rs):
    • a >=1.0.0 manifest gets 1.0.0 in all fields, and >=1.1.0 gets 1.1.0;
    • an app without a UI gets no uiBridge;
    • >=1.2.0 is rejected;
    • input.version is ignored for "1.0.0", "1.1.0", 7 and absent.
  • Fail on 1.4.0: with the old smoke.rs, three of the four smoke tests fail. The negotiation helpers do not exist in 1.4.0.

Verification

  • bun run verify: format, lint and tests for both languages, contracts:check, typecheck, and 465 TypeScript tests.
  • bun run release:check: 1.4.1 is consistent.
  • In a Linux container: cargo test --workspace --locked passes.

After merge, tag v1.4.1.

🤖 Generated with Claude Code

1.4.0 raised the protocol to 1.1.0 and the candidate smoke bootstrapped every
app with it, which apps built for 1.0.0 reject. The negotiated version of
appProtocol, platformApi and uiBridge is now the lower bound of the manifest
range, bounded by what the environment offers. Add Contracts::negotiate_versions
and negotiateVersions, use them in the smoke bootstrap and ignore its
deprecated version input.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Nov 28, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You'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 30 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between b11473f and bcd7460.

Files ignored due to path filters: 4

  • contracts/v1/contracts.schema.json is excluded by !contracts/v1/contracts.schema.json
  • contracts/v1/openapi.json is excluded by !contracts/v1/openapi.json
  • core/Cargo.lock is excluded by !**/*.lock, !core/Cargo.lock
  • core/app-contracts/contracts.schema.json is excluded by !core/app-contracts/contracts.schema.json
Files selected for processing: 14

  • README.md
  • contracts/v1/fixtures.json
  • contracts/v1/index.ts
  • contracts/v1/primitives.ts
  • contracts/v1/validation.ts
  • core/Cargo.toml
  • core/app-contracts/src/lib.rs
  • core/app-contracts/src/validation.rs
  • core/app-contracts/tests/contracts.rs
  • core/app-pipeline/README.md
  • core/app-pipeline/src/smoke.rs
  • core/app-pipeline/tests/smoke_bootstrap.rs
  • packages/app-contracts/package.json
  • tests/Contracts/app-contracts.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@github-actions github-actions Bot added area: contracts App contract schemas, fixtures and documents area: core Rust core, native protocols and safe storage. area: npm labels Nov 28, 2026
@RentnerKev
RentnerKev merged commit fa380e5 into main Nov 28, 2026
16 checks passed
@RentnerKev
RentnerKev deleted the rentner/fix/negotiate-protocol-versions branch November 28, 2026 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: contracts App contract schemas, fixtures and documents area: core Rust core, native protocols and safe storage. area: npm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant