Skip to content

Connection account info: derive identity from the health-check probe#1111

Open
RhysSullivan wants to merge 1 commit into
claude/health-checksfrom
claude/health-checks-identity
Open

Connection account info: derive identity from the health-check probe#1111
RhysSullivan wants to merge 1 commit into
claude/health-checksfrom
claude/health-checks-identity

Conversation

@RhysSullivan

@RhysSullivan RhysSullivan commented Jun 23, 2026

Copy link
Copy Markdown
Owner

Stacked on #1108. Layers account identity on top of the liveness probe: a health check can name a response field whose value identifies the connected account, so the same probe answers "is this alive?" and "whose account is this?". Adds the typed identity-field picker, the live preview (probe a pasted key, see the real response), the account-row identity label, and the key-first connect modal (validate then auto-name). Also restores the OAuth-client deep-link prefill the key-first reorder had dropped.

Stack

  1. Fix combobox inside the health-check editor sheet #1110
  2. Connection health checks (liveness) with OpenAPI backing #1108
  3. Connection account info: derive identity from the health-check probe #1111 👈 current
  4. MCP connection liveness health checks #1112
  5. Health checks for Microsoft Graph and Google #1109

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 23, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
executor-cloud 1952ca8 Jun 26 2026, 02:29 AM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 23, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
executor-marketing 1952ca8 Commit Preview URL

Branch Preview URL
Jun 26 2026, 02:29 AM

@github-actions

github-actions Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Cloudflare preview

Console https://executor-preview-pr-1111.executor-e2e.workers.dev
MCP https://executor-preview-pr-1111.executor-e2e.workers.dev/mcp
Deployed commit 1952ca8

Sign-in is Cloudflare Access (one-time PIN to an allowed email). The preview has its own database and encryption key; it is destroyed when this PR closes.

@pkg-pr-new

pkg-pr-new Bot commented Jun 23, 2026

Copy link
Copy Markdown

Open in StackBlitz

@executor-js/cli

npm i https://pkg.pr.new/@executor-js/cli@1111

@executor-js/config

npm i https://pkg.pr.new/@executor-js/config@1111

@executor-js/execution

npm i https://pkg.pr.new/@executor-js/execution@1111

@executor-js/sdk

npm i https://pkg.pr.new/@executor-js/sdk@1111

@executor-js/codemode-core

npm i https://pkg.pr.new/@executor-js/codemode-core@1111

@executor-js/runtime-quickjs

npm i https://pkg.pr.new/@executor-js/runtime-quickjs@1111

@executor-js/plugin-file-secrets

npm i https://pkg.pr.new/@executor-js/plugin-file-secrets@1111

@executor-js/plugin-graphql

npm i https://pkg.pr.new/@executor-js/plugin-graphql@1111

@executor-js/plugin-keychain

npm i https://pkg.pr.new/@executor-js/plugin-keychain@1111

@executor-js/plugin-mcp

npm i https://pkg.pr.new/@executor-js/plugin-mcp@1111

@executor-js/plugin-onepassword

npm i https://pkg.pr.new/@executor-js/plugin-onepassword@1111

@executor-js/plugin-openapi

npm i https://pkg.pr.new/@executor-js/plugin-openapi@1111

executor

npm i https://pkg.pr.new/executor@1111

commit: 1952ca8

@greptile-apps

greptile-apps Bot commented Jun 23, 2026

Copy link
Copy Markdown

Greptile Summary

This PR layers account identity on top of the existing health-check probe system so the same HTTP probe that answers "is this alive?" can also answer "whose account is this?" — enabling key-first connection naming and a live-preview field picker in the OpenAPI integration UI.

  • Core SDK (health-check.ts): introduces HealthCheckSpec.identityField, a BFS schema walker (projectResponseFields, flattenSchemaShape) for enumerating response fields from OpenAPI schemas, and extractIdentity / extractResponseFields for resolving live values from probe responses.
  • React UI: HealthCheckLivePreviewBlock runs a real validation call with a pasted key and shows the response sample; AddAccountModal auto-fills the connection name from the probed identity when the name field is still empty or was previously auto-filled.
  • E2E coverage: new health-checks-ui.test.ts covers the edit-sheet identity picker, live preview with healthy and expired credentials, and the add-connection auto-naming flow using a revocable mock API server.

Confidence Score: 3/5

Mostly safe but has a confirmed stale-closure race in the auto-fill guard that can silently overwrite a user-typed connection name.

The BFS schema traversal, identity extraction, and live preview machinery are all well-bounded and well-tested. The e2e suite is thorough. The one confirmed P1 defect — stale label/nameAutofilled closure in handleValidate — directly violates the invariant that hand-typed names are never clobbered, and it is in a user-visible, frequently-exercised code path. The P2 around error-body exposure in responseSample is lower risk but worth a conscious decision before shipping.

packages/react/src/components/add-account-modal.tsx (stale closure in handleValidate) and packages/plugins/openapi/src/sdk/backing.ts (error body in responseSample).

Important Files Changed

Filename Overview
packages/core/sdk/src/health-check.ts Core new file introducing health-check vocabulary, BFS schema walker (projectResponseFields), dot-path identity extractor (extractIdentity), and flattenSchemaShape with cycle guard; logic is sound with appropriate depth/field limits.
packages/react/src/components/add-account-modal.tsx Introduces key-first connect flow with identity auto-fill, but contains a stale closure race condition in handleValidate where label and nameAutofilled are captured before the async doSetHealthCheck await, allowing user-typed names to be silently overwritten.
packages/plugins/openapi/src/sdk/backing.ts Adds identity extraction and response sample population to checkHealthOpenApi; responseSample is unconditionally populated from error bodies on non-2xx responses, which may surface internal error field names in the live preview UI.
packages/plugins/openapi/src/sdk/preview.ts Adds buildPreviewHealthCheckCandidates that projects responseFields for top-50 candidates using projectResponseFields; logic is clean and BFS depth/field limits are respected.
packages/react/src/components/health-check-editor.tsx Adds HealthCheckConfigFields (operation + identity field picker) and HealthCheckLivePreviewBlock (live credential validation with response sample table); well-structured with clear separation of concerns.
packages/react/src/components/accounts-section.tsx Updated AccountRow to show identity from live probe result, falling back to stored identityLabel; straightforward display logic with correct precedence.
packages/plugins/openapi/src/react/OpenApiAccountsPanel.tsx Builds livePreview context from apikey auth methods and threads it into HealthCheckEditor; change is minimal and correctly scoped.
packages/plugins/openapi/src/react/AddOpenApiSource.tsx Adds hcIdentityField state and HealthCheckConfigFields to the add-integration screen; wiring is correct and consistent with other config fields.
e2e/scenarios/health-checks-ui.test.ts New UI e2e scenarios covering edit sheet identity flow (operation + identity field picker, live preview, healthy/expired), and Add Connection auto-naming; uses serveMutableIdentityApi with revoke() for credential lifecycle testing.
e2e/scenarios/health-checks.test.ts Extended to validate identity derivation from probe response and discriminated-union spec traversal; follows Effect Vitest patterns with proper acquireRelease cleanup.
packages/core/api/src/handlers/connections.ts Updates toHealthResponse to pass through identity and responseSample from the backing result; change is minimal and correct.
packages/core/sdk/src/shared.ts Browser-safe export surface correctly excludes server-only symbols while exposing client-safe ones.
packages/core/sdk/src/index.ts Full SDK index exports all new health-check symbols; additions are consistent with existing export patterns.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant UI as React UI
    participant Modal as AddAccountModal
    participant API as Connections API
    participant Backing as OpenAPI Backing
    participant Probe as HTTP Probe

    Note over UI,Probe: Key-First Connect Flow
    UI->>Modal: paste API key
    Modal->>API: validateConnection(key, healthCheckSpec)
    API->>Backing: checkHealthOpenApi(spec, credential)
    Backing->>Probe: HTTP request to probe endpoint
    Probe-->>Backing: response body
    Backing->>Backing: extractIdentity(body, identityField)
    Backing->>Backing: extractResponseFields(body)
    Backing-->>API: "HealthCheckResult { status, identity, responseSample }"
    API-->>Modal: result
    Modal->>Modal: "if healthy && identity: setLabel(identity), setNameAutofilled(true)"
    Modal-->>UI: show identity + response sample

    Note over UI,Probe: Live Preview (Edit Sheet)
    UI->>UI: HealthCheckLivePreviewBlock renders
    UI->>API: validateConnection(pastedKey, spec)
    API->>Backing: checkHealthOpenApi(spec, credential)
    Backing->>Probe: HTTP request
    Probe-->>Backing: response body
    Backing-->>API: "HealthCheckResult { responseSample }"
    API-->>UI: show status + response sample table

    Note over UI,Probe: Schema Field Discovery
    UI->>UI: buildPreviewHealthCheckCandidates(spec)
    UI->>UI: projectResponseFields(responseSchema)
    UI->>UI: flattenSchemaShape(schema, defs)
    UI-->>UI: responseFields[] for identity picker combobox
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant UI as React UI
    participant Modal as AddAccountModal
    participant API as Connections API
    participant Backing as OpenAPI Backing
    participant Probe as HTTP Probe

    Note over UI,Probe: Key-First Connect Flow
    UI->>Modal: paste API key
    Modal->>API: validateConnection(key, healthCheckSpec)
    API->>Backing: checkHealthOpenApi(spec, credential)
    Backing->>Probe: HTTP request to probe endpoint
    Probe-->>Backing: response body
    Backing->>Backing: extractIdentity(body, identityField)
    Backing->>Backing: extractResponseFields(body)
    Backing-->>API: "HealthCheckResult { status, identity, responseSample }"
    API-->>Modal: result
    Modal->>Modal: "if healthy && identity: setLabel(identity), setNameAutofilled(true)"
    Modal-->>UI: show identity + response sample

    Note over UI,Probe: Live Preview (Edit Sheet)
    UI->>UI: HealthCheckLivePreviewBlock renders
    UI->>API: validateConnection(pastedKey, spec)
    API->>Backing: checkHealthOpenApi(spec, credential)
    Backing->>Probe: HTTP request
    Probe-->>Backing: response body
    Backing-->>API: "HealthCheckResult { responseSample }"
    API-->>UI: show status + response sample table

    Note over UI,Probe: Schema Field Discovery
    UI->>UI: buildPreviewHealthCheckCandidates(spec)
    UI->>UI: projectResponseFields(responseSchema)
    UI->>UI: flattenSchemaShape(schema, defs)
    UI-->>UI: responseFields[] for identity picker combobox
Loading

Reviews (4): Last reviewed commit: "feat: derive connection account info fro..." | Re-trigger Greptile

Comment thread e2e/scenarios/health-checks-ui.test.ts Outdated
Comment thread e2e/scenarios/health-checks-ui.test.ts Outdated
@RhysSullivan RhysSullivan force-pushed the claude/health-checks branch from 59fd53f to dc99124 Compare June 25, 2026 20:30
@RhysSullivan RhysSullivan force-pushed the claude/health-checks-identity branch from d58fd6e to b90461f Compare June 25, 2026 20:30
@RhysSullivan RhysSullivan force-pushed the claude/health-checks branch from dc99124 to d6b3eac Compare June 25, 2026 20:45
@RhysSullivan RhysSullivan force-pushed the claude/health-checks-identity branch from b90461f to aa2f8f0 Compare June 25, 2026 20:45
Layer account identity on top of the liveness probe. A health check can now
name a response field whose value identifies the connected account, so the same
probe that answers "is this alive?" also answers "whose account is this?".

Core: HealthCheckSpec gains an optional identityField (a dot-path into the
response body); HealthCheckResult carries the extracted identity plus a bounded
responseSample of the actual returned fields; HealthCheckCandidate carries the
operation's projected responseFields. New pure helpers: extractIdentity (resolve
a dot-path, numeric segments index arrays), projectResponseFields (enumerate a
response schema's scalar leaves breadth-first, merging every allOf/oneOf/anyOf
branch so discriminated-union fields aren't dropped), and extractResponseFields
(walk a real body for the live preview).

OpenAPI backing extracts the identity on a healthy probe and projects each
candidate's response fields. React: the editor gains a typed identity-field
picker fed by those fields and a live preview (probe a pasted test key, see the
real response plus what the identity resolves to); the account row labels itself
with the probed identity; and the Add Connection "check the key works" flow gains
the identity field (in the inline picker) and auto-fills the connection name from
the probed identity.

Covered by e2e: validating a key derives the identity; a saved connection's probe
surfaces the account then drops it once expired; the identity picker surfaces a
shallow scalar and a second-union-branch-only field across a discriminated union;
the editor live preview and the Add Connection name-derivation drive the identity
flow in the browser.
@RhysSullivan RhysSullivan force-pushed the claude/health-checks branch from d6b3eac to d1aa3ea Compare June 26, 2026 02:26
@RhysSullivan RhysSullivan force-pushed the claude/health-checks-identity branch from aa2f8f0 to 1952ca8 Compare June 26, 2026 02:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant