Skip to content

feat(contracts): send the user's permission keys in the UI context and release 1.5.0 - #12

Merged
RentnerKev merged 2 commits into
mainfrom
rentner/feat/ui-context-permissions
Nov 28, 2026
Merged

RentnerKev merged 2 commits into
mainfrom
rentner/feat/ui-context-permissions

Conversation

@RentnerKev

Copy link
Copy Markdown
Member

Change

An app UI runs in a sandboxed iframe and cannot learn which of the app's permissions the current user holds. The platform already knows them (AppUiSummary.permissionKeys holds only the keys the user has), but the UI bridge has no member to carry them. So the Monitoring app shows an editable form to read-only users until a save fails with 403.

The UI bridge context message gains the optional member permissionKeys:

  • the keys from the manifest permissions that the current user holds, as the manifest declares them (without the app ID);
  • each entry uses the manifest permission key pattern ^[a-z][a-z0-9-]{0,31}$;
  • unique and in ascending ASCII order, at most 64 entries (the manifest maximum).

Negotiation picks the lower bound of each requires range, so a new bridge member needs a protocol version that apps opt into. Following the 1.4.0 precedent, currentProtocolVersion and PROTOCOL_VERSION rise to 1.2.0 for appProtocol, platformApi and uiBridge together. The schema description and the README's protocol section now say:

  • A host sends permissionKeys only to apps whose negotiated uiBridge is 1.2.0 or newer, and always includes it for them. An empty array means none.
  • A host never sends it to an app on an older bridge version, because the strict validators of those apps reject unknown members.
  • The keys only help the UI choose what to show. The platform still enforces x-rentnerproxy-access on every call.
  • bridgeVersion in runtime:bootstrap stays the literal 1.0.0.
  • An app that wants the keys declares requires.uiBridge: ">=1.2.0 <2.0.0".

No issue is linked: the change was requested to fix the read-only Monitoring UI.

Files

  • Contract (TS): contracts/v1/ui-bridge.ts adds the member, with a Zod refinement for unique and sorted keys. manifest.ts now exports a shared permissionKey schema and maxPermissions, which the manifest, operationAccess and the context all use, so the generated JSON Schema is unchanged apart from the new member. public-schemas.ts exports permissionKey. primitives.ts sets the protocol to 1.2.0 and the contract to 1.5.0.

  • Contract (Rust): ProtocolContracts::validate rejects a context whose permissionKeys are not strictly ascending, so duplicates are rejected too. The JSON Schema already enforces the pattern and the maximum. PROTOCOL_VERSION is now 1.2.0.

  • Generated: contracts.schema.json (both copies) and openapi.json, regenerated with bun run contracts:generate.

  • Fixtures: protocol-fixtures.json has 8 new context cases:

    • accepted: keys, an empty array, and exactly 64 keys;
    • rejected: duplicate keys, unsorted keys, an app-ID-qualified key, 65 keys, and null.

    fixtures.json has 4 new negotiation cases: a 1.1.0 app keeps 1.1.0 on a 1.2.0 offer, a 1.2.0 app gets 1.2.0, uiBridge >=1.2.0 gets 1.2.0 while the others keep 1.0.0, and uiBridge >=1.2.0 against a 1.1.0 offer is rejected. TypeScript and Rust both run these fixtures.

  • Tests:

    • TS: the protocol assertion is updated, plus a 1.2.0 negotiation test and a JSON Schema check that the context keys match the manifest permissions items and maximum.
    • Rust contracts: the protocol assertion is updated, plus a 1.2.0 compatibility check.
    • Pipeline: the the_candidate_runtime_offers_the_exposed_protocol_version assertion is updated. The smoke bootstrap now gets >=1.2.0 → 1.2.0, uiBridge >=1.2.0 → 1.2.0, and the "newer protocol" rejection moves to >=1.3.0.
    • Runtime: the readiness test covers 1.2.0 → 1.2.0 and 1.3.0 → capped.
    • The package smoke (.github/scripts/ci/package-sdk.ts) expects 1.2.0.
  • Release 1.5.0: the Cargo workspace version, the inter-crate dependency versions, Cargo.lock (via cargo update --workspace --offline) and packages/app-contracts/package.json move, the same set as fix(contracts): negotiate protocol versions per app and release 1.4.1 #11. The README protocol table gains the 1.2.0 row.

Verification

  • bun run contracts:check, bun run typecheck, bun run lint (0 errors; 3 pre-existing consistent-function-scoping warnings), bun run test (479 pass), bun run release:check (1.5.0 consistent).
  • bun run core:lint (clippy -D warnings passes; cargo reports its pre-existing unused dependency zip manifest warning on Windows) and bun run core:test (all pass on Windows).
  • Linux: cargo test --locked --workspace --all-targets --all-features in a disposable offline container passes, including the Unix-only runtime server.rs, client.rs and events.rs tests. It used Rust 1.99.1, the workspace MSRV; CI uses 1.100.0.
  • bun run package:build <dir> <sha>: "Verified SDK 1.5.0 packages" for this commit, covering reproducible bundles, the npm consumer smoke and the Rust consumer smoke.

Risks

  • This is additive within contract major 1. Apps on uiBridge below 1.2.0 never see the member, and their strict validators keep working. The SDK's own validators accept contexts with and without it.
  • The platform must implement the host side: send permissionKeys (sorted and unique) exactly when the negotiated uiBridge is at least 1.2.0. Apps such as Monitoring opt in with requires.uiBridge: ">=1.2.0 <2.0.0" after adopting 1.5.0.
  • Merging does not publish anything. The release runs when the owner pushes the tag v1.5.0 on main.
  • No secrets, real environment files or production data are included.

🤖 Generated with Claude Code

…d release 1.5.0

An app UI runs in a sandboxed iframe and cannot learn which of the app's
permissions the current user holds, so it shows controls that fail with 403.
The UI bridge context message gains the optional member permissionKeys: the
keys from the manifest permissions that the user holds, unqualified, unique,
in ascending ASCII order and at most 64, with the manifest key pattern.

- Raise currentProtocolVersion and PROTOCOL_VERSION to 1.2.0. A host sends
  permissionKeys only to apps whose negotiated uiBridge is 1.2.0 or newer and
  always includes it for them; an empty array means none. Older bridge
  versions never receive it, because their strict validators reject it.
  bridgeVersion in runtime:bootstrap stays 1.0.0, and the platform still
  enforces x-rentnerproxy-access on every call.
- Share the permission key schema between the manifest, operationAccess and
  the context, and export permissionKey from the schemas entry point.
- Check unique, sorted keys in both SDKs (Zod refinement and
  ProtocolContracts), with shared fixtures for keys, an empty array,
  duplicates, unsorted, qualified and too many keys.
- Add negotiation fixtures for a 1.2.0 offer and update the tests, the
  pipeline smoke and the package smoke that pinned 1.1.0.
- Bump the contract, crates and npm package to 1.5.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Explain Change →

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 52 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 631eb44 and 628ecab.

Files selected for processing: 1

  • contracts/v1/ui-bridge.ts

No actionable comments were generated in the recent review.

Walkthrough

The SDK adds optional permissionKeys to UI bridge context messages. It updates the protocol to 1.2.0 and the contract version to 1.5.0, with schema validation and version negotiation tests.

Changes: Protocol and UI Bridge Update

Layer / File(s) Summary
Permission keys in UI context
contracts/v1/manifest.ts, contracts/v1/ui-bridge.ts, contracts/v1/public-schemas.ts, core/app-contracts/src/protocol.rs, contracts/v1/protocol-fixtures.json, tests/Contracts/app-protocol.test.ts, README.md
The UI context schema adds optional permissionKeys using the manifest permission-key format and 64-item limit. Schema and Rust validation check ordering; fixtures cover accepted and rejected values. The README describes when hosts include the field and how it relates to operation access.
Protocol version and negotiation
contracts/v1/primitives.ts, contracts/v1/fixtures.json, core/app-contracts/..., core/app-pipeline/..., core/app-runtime/tests/server.rs, tests/Contracts/app-contracts.test.ts, core/Cargo.toml, packages/app-contracts/package.json, .github/scripts/ci/package-sdk.ts, README.md
The contract version advances to 1.5.0 and the protocol version to 1.2.0. Fixtures and tests cover negotiation for 1.1.0 and 1.2.0 requirements, including an incompatible UI bridge requirement. Package versions and SDK version expectations are updated.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Possibly related PRs

  • RentnerProxy/app-sdk#3: Defines the protocol version constant and its relationship to pinned protocol versions, which this PR updates.
  • RentnerProxy/app-sdk#10: Establishes protocol 1.1.0 negotiation behavior that this PR extends with 1.2.0.
  • RentnerProxy/app-sdk#7: Adds the runtime whose negotiated protocol version tests this PR updates.

Suggested labels: area: contracts, area: core, area: npm, area: automation, enhancement, area: release

Merge Risk: Minimal · previous review 631eb · assessed changes only

Path filters excluded changed files. This rating applies only to the assessed changes.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the UI context now carries the user's permission keys (feat(contracts)), and it also names the 1.5.0 release bump. Both match the changeset. The title is a single line…
Description check Passed The description follows the template's sections. The Change section explains the problem, the new permissionKeys member, the protocol bump, and the reason no issue is linked. The Verification section …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: the UI context now carries the user's permission keys (feat(contracts)), and it also names the 1.5.0 release bump. Both match the changeset. The title is a single line of 84 characters, which is long but still clear. The explanation matches the raw summary, which covers the new permissionKeys member, the protocol 1.2.0 bump, and the contract 1.5.0 version bump.

Full details: Description check

Explanation

The description follows the template's sections. The Change section explains the problem, the new permissionKeys member, the protocol bump, and the reason no issue is linked. The Verification section lists the checks run and their results. The Risks section states the change is additive within contract major 1, notes that the platform host side is still required, and confirms that no secrets or production data are included. The description is detailed and complete.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
Fix failing CI checks

  • Commit to this branch
  • Create a new PR
  • 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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between fa380e5 and 631eb44.

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: 18

  • .github/scripts/ci/package-sdk.ts
  • README.md
  • contracts/v1/fixtures.json
  • contracts/v1/manifest.ts
  • contracts/v1/primitives.ts
  • contracts/v1/protocol-fixtures.json
  • contracts/v1/public-schemas.ts
  • contracts/v1/ui-bridge.ts
  • core/Cargo.toml
  • core/app-contracts/src/lib.rs
  • core/app-contracts/src/protocol.rs
  • core/app-contracts/tests/contracts.rs
  • core/app-pipeline/src/lib.rs
  • core/app-pipeline/tests/smoke_bootstrap.rs
  • core/app-runtime/tests/server.rs
  • packages/app-contracts/package.json
  • tests/Contracts/app-contracts.test.ts
  • tests/Contracts/app-protocol.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@github-actions github-actions Bot added area: automation GitHub checks, release and repository automation. area: contracts App contract schemas, fixtures and documents area: core Rust core, native protocols and safe storage. area: npm labels Nov 28, 2026
@RentnerKev

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@RentnerKev
RentnerKev merged commit e997977 into main Nov 28, 2026
15 checks passed
@RentnerKev
RentnerKev deleted the rentner/feat/ui-context-permissions branch November 28, 2026 23:36
RentnerKev added a commit to RentnerProxy/marketplace that referenced this pull request Nov 29, 2026
App SDK 1.5.0 raises the offered protocol version from 1.1.0 to 1.2.0
for appProtocol, platformApi and uiBridge; UI bridge 1.2.0 adds the
user's permissionKeys to the UI context message. Negotiation is
unchanged, so the candidate pipeline now accepts apps that require
protocol 1.2.0 while older apps keep their lower bound.

- Use rentnerproxy-app-catalog, -app-pipeline and -artifacts 1.5.0
  and @rentnerproxy/app-contracts ^1.5.0.
- The smoke test negotiates 1.1.0 for >=1.1.0 and 1.2.0 for >=1.2.0,
  and rejects >=1.3.0 as newer than offered next to the major 2 case.

Refs RentnerProxy/app-sdk#12

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: automation GitHub checks, release and repository automation. 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