Skip to content

feat: add connection config support - #184

Open
azeam1 wants to merge 1 commit into
mainfrom
OP-3894/app-connection
Open

feat: add connection config support#184
azeam1 wants to merge 1 commit into
mainfrom
OP-3894/app-connection

Conversation

@azeam1

@azeam1 azeam1 commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

Note

Medium Risk
Major additive WIT/API change around auth connection config, but older connectors remain supported and this gem only extracts/validates declarative JSON rather than running OAuth flows.

Overview
Bumps to 5.0.0 and adds WIT v5 so connectors can export embedded connection-config JSON through a new connections interface. Older WIT versions keep working; v5 is tried first on load.

App#connection_config reads that JSON and validates it with ConnectionConfigValidator against the new schema (OAuth2, API key, session, runtime headers/templates, post-connect hooks). connections_supported? reports whether the loaded component has the interface.

Also adds a v5 fixture connector, schema docs, and json_schemer as a gem dependency.

Reviewed by Cursor Bugbot for commit 122ada9. Bugbot is set up for automated code reviews on this repo. Configure here.

@azeam1 azeam1 added the wip label Jul 10, 2026
@azeam1
azeam1 force-pushed the OP-3894/app-connection branch from 7b14757 to fd200b0 Compare August 10, 2026 12:41
@azeam1
azeam1 requested a lite review from Copilot August 10, 2026 12:42
Comment thread lib/app_bridge/connection_config_validator.rb
Comment thread ext/app_bridge/docs/connection-config-schema.json

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR bumps app_bridge to 5.0.0 and introduces WIT v5 (standout:app@5.0.0) with a new exported connections interface so components can embed and expose a validated connection-config JSON document to the Ruby API.

Changes:

  • Add Ruby-side connections_supported? / connection_config API, including JSON Schema validation via AppBridge::ConnectionConfigValidator + new ConnectionConfigError.
  • Add WIT v5 bindings + loader order update (try v5 first) and wire v5 into the Rust host implementations (http/file/env).
  • Add schema/docs/tests and a new v5 Rust WASM fixture + build task updates.

Reviewed changes

Copilot reviewed 22 out of 26 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tasks/fixtures.rake Updates fixture build tasks; adds v5 fixture compilation task and switches v4 copy behavior.
spec/spec_helper.rb Ensures Bundler is set up before loading the gem in specs.
spec/fixtures/components/rust_app_v5/src/lib.rs New v5 Rust component fixture exporting connections.connection-config.
spec/fixtures/components/rust_app_v5/Cargo.toml New Cargo manifest for the v5 Rust fixture.
spec/fixtures/components/rust_app_v5/Cargo.lock New lockfile for the v5 Rust fixture dependencies.
spec/app_bridge/connections_spec.rb Specs for v5 connections behavior + fallback behavior on v4 components.
spec/app_bridge/connection_config_validator_spec.rb Specs for schema validation and error reporting behavior.
README.md Documents the new v5 connection configuration contract and extraction behavior.
lib/app_bridge/version.rb Bumps gem version to 5.0.0.
lib/app_bridge/connection_config_validator.rb Adds JSON Schema validator for connection-config.
lib/app_bridge/app.rb Adds Ruby API methods for connections support + validated config retrieval.
lib/app_bridge.rb Wires validator + defines ConnectionConfigError.
Gemfile.lock Updates gem version and adds json_schemer (and dependencies).
app_bridge.gemspec Adds runtime dependency on json_schemer.
ext/app_bridge/wit/v5/world.wit Introduces WIT v5 world including exported connections interface.
ext/app_bridge/docs/connection-config-schema.json Adds the bundled JSON Schema used for validation.
ext/app_bridge/Cargo.toml Bumps native extension crate version to 5.0.0.
Cargo.toml Excludes the v5 fixture crate from the workspace.
Cargo.lock Updates workspace lock to app_bridge 5.0.0.
ext/app_bridge/src/wrappers/app.rs Adds Rust wrapper methods for connections_supported and connection_config.
ext/app_bridge/src/lib.rs Exposes the new Ruby methods (connections_supported?, _rust_connection_config, etc.).
ext/app_bridge/src/component.rs Adds v5 component bindings, instantiation order, and connections call plumbing.
ext/app_bridge/src/request_builder.rs Enables HTTP host support for v5.
ext/app_bridge/src/file_ops.rs Enables file host support for v5.
ext/app_bridge/src/app_state.rs Implements required host traits for v5.
.gitignore Ignores vendored Bundler directory.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tasks/fixtures.rake
Comment thread ext/app_bridge/src/component.rs Outdated
@azeam1
azeam1 force-pushed the OP-3894/app-connection branch from fd200b0 to 122ada9 Compare August 12, 2026 07:31

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 122ada9. Configure here.

end
rescue JSON::ParserError => e
raise AppBridge::ConnectionConfigError, "Invalid connection-config JSON: #{e.message}"
end

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Symbol keys break config validation

Medium Severity

parse_data returns a Ruby Hash unchanged, so symbol keys never match the string keys in the JSON Schema. json_schemer checks required properties with key set difference, so idiomatic symbol-keyed hashes (including the new validator specs and the documented CI-without-WASM path) fail validation even when the config is valid. The WASM string path is unaffected because JSON.parse yields string keys.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 122ada9. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants