Skip to content

Commit 6006870

Browse files
feat(credentials): add v2 credential lifecycle APIs (#6664)
* feat(credentials): add v2 OAuth connection APIs * fix(credentials): preserve active OAuth connection links * fix(credentials): bind OAuth links to connection intent * feat(credentials): complete v2 credential lifecycle * fix(credentials): make disconnect idempotent * fix(credentials): stabilize oauth draft retries * fix(credentials): bind oauth callbacks to drafts * fix(credentials): fail closed on oauth completion * fix(credentials): bind shopify completion to oauth state * fix(credentials): align custom oauth reconnects * fix(credentials): centralize application authorization * fix(credentials): keep OAuth draft intent immutable * fix(credentials): allow renamed reconnect targets * fix(credentials): close OAuth draft edge cases * fix(credentials): fail closed without breaking auth * fix(credentials): preserve migrated route behavior * feat(credentials): add provider search * fix(credentials): prevent stale secrets and drafts
1 parent 0ce8ded commit 6006870

124 files changed

Lines changed: 10370 additions & 3479 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.agents/skills/migrate-application-operation/SKILL.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,43 @@ Classify each as `migrate`, `defer`, or `non-goal`. Do not migrate adjacent oper
7878

7979
Preserve behavior unless the task explicitly changes it. Stop and report a decision when surfaces currently disagree on security or compatibility behavior; do not silently choose one.
8080

81+
## Freeze observable behavior before editing
82+
83+
Treat the legacy route or tool as an ordered program, not merely a bag of business logic. Before moving code, write a compact baseline for every in-scope entry point and add focused characterization tests for behavior not already pinned down.
84+
85+
Capture all of these when they apply:
86+
87+
- Accepted inputs, including trimming, blank omission, duplicate query keys, aliases, defaults, and bounds.
88+
- Authentication and authorization order, minimum roles, resource membership, concealment, and exact error/status mapping.
89+
- Exact success bodies, optional fields, status codes, redirects, cookies, headers, and binary or stream behavior.
90+
- Mutation ordering, transaction boundaries, idempotency, no-ops, and observable state after each possible partial failure.
91+
- Audit, notification, analytics, and billing timing plus exact semantic dimensions and attribution.
92+
- Browser or protocol state ownership, concurrency isolation, expiry, callback ordering, and cleanup behavior.
93+
- Every value newly crossing into HTML, JavaScript, SQL, URLs, logs, provider payloads, or another encoding context.
94+
95+
Compare the old statement order with the proposed application lifecycle explicitly:
96+
97+
```text
98+
legacy parse/normalize
99+
-> legacy authorization checks
100+
-> branch-specific canonical lookup
101+
-> mutation(s)
102+
-> per-step side effects
103+
-> response or redirect catch
104+
```
105+
106+
Moving those steps under a wrapper may change behavior even when each individual call is reused. In particular:
107+
108+
- `projectAudit` and `afterSuccess` run only after `execute` returns. They cannot describe earlier committed mutations when a later step throws. Make the compound mutation atomic or define explicit partial-result/failure projection semantics before migrating it.
109+
- Operation metadata is executable policy. Adding a resource role to a workspace-only legacy read is an authorization change, not an architectural cleanup.
110+
- A shared error policy does not automatically preserve route-local concealment, subclass ordering, browser redirects, or branch-specific messages.
111+
- A shared contract does not automatically preserve manual `URLSearchParams` normalization or exact legacy response unions.
112+
- A shared use case may own domain behavior while separate surface presenters still preserve different wire shapes.
113+
- Per-flow identity is insufficient when another part of the flow remains in browser-global state such as one cookie.
114+
- Passing a newly supported parameter through old rendering code creates a new security boundary even when the renderer itself is unchanged.
115+
116+
Fail fast if the baseline cannot be established from code, tests, or an explicit product decision. Do not infer that behavior is unimportant because it was previously implicit.
117+
81118
## Keep the layers distinct
82119

83120
Use these responsibilities:
@@ -270,6 +307,10 @@ Add focused tests for every migrated surface and principal kind allowed by the o
270307
- Public API: personal and workspace keys, rate and rollout behavior, concealment, exact external envelope, and rate headers.
271308
- Copilot or tools: trusted context, exact registered operation membership, rejected forged scope, aliases and resume paths, permission re-check, safe errors, and unchanged tool result shapes.
272309
- Side effects: audit derives from authoritative results; shared notifications follow audit; neither occurs for rejection or no-op.
310+
- Compatibility characterization: legacy normalization, exact response/redirect/cookie behavior, concealment, error subclass precedence, and branch-specific output.
311+
- Failure sequencing: inject a failure after each independently committing step and assert persisted state plus audit, analytics, and notification effects.
312+
- Concurrency: overlap stateful browser or provider flows and prove each callback consumes only its own state and return destination.
313+
- Rendering boundaries: exercise hostile values for every newly connected input that reaches HTML, inline JavaScript, URLs, logs, or provider requests.
273314

274315
Run at minimum:
275316

.claude/commands/migrate-application-operation.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,43 @@ Classify each as `migrate`, `defer`, or `non-goal`. Do not migrate adjacent oper
7777

7878
Preserve behavior unless the task explicitly changes it. Stop and report a decision when surfaces currently disagree on security or compatibility behavior; do not silently choose one.
7979

80+
## Freeze observable behavior before editing
81+
82+
Treat the legacy route or tool as an ordered program, not merely a bag of business logic. Before moving code, write a compact baseline for every in-scope entry point and add focused characterization tests for behavior not already pinned down.
83+
84+
Capture all of these when they apply:
85+
86+
- Accepted inputs, including trimming, blank omission, duplicate query keys, aliases, defaults, and bounds.
87+
- Authentication and authorization order, minimum roles, resource membership, concealment, and exact error/status mapping.
88+
- Exact success bodies, optional fields, status codes, redirects, cookies, headers, and binary or stream behavior.
89+
- Mutation ordering, transaction boundaries, idempotency, no-ops, and observable state after each possible partial failure.
90+
- Audit, notification, analytics, and billing timing plus exact semantic dimensions and attribution.
91+
- Browser or protocol state ownership, concurrency isolation, expiry, callback ordering, and cleanup behavior.
92+
- Every value newly crossing into HTML, JavaScript, SQL, URLs, logs, provider payloads, or another encoding context.
93+
94+
Compare the old statement order with the proposed application lifecycle explicitly:
95+
96+
```text
97+
legacy parse/normalize
98+
-> legacy authorization checks
99+
-> branch-specific canonical lookup
100+
-> mutation(s)
101+
-> per-step side effects
102+
-> response or redirect catch
103+
```
104+
105+
Moving those steps under a wrapper may change behavior even when each individual call is reused. In particular:
106+
107+
- `projectAudit` and `afterSuccess` run only after `execute` returns. They cannot describe earlier committed mutations when a later step throws. Make the compound mutation atomic or define explicit partial-result/failure projection semantics before migrating it.
108+
- Operation metadata is executable policy. Adding a resource role to a workspace-only legacy read is an authorization change, not an architectural cleanup.
109+
- A shared error policy does not automatically preserve route-local concealment, subclass ordering, browser redirects, or branch-specific messages.
110+
- A shared contract does not automatically preserve manual `URLSearchParams` normalization or exact legacy response unions.
111+
- A shared use case may own domain behavior while separate surface presenters still preserve different wire shapes.
112+
- Per-flow identity is insufficient when another part of the flow remains in browser-global state such as one cookie.
113+
- Passing a newly supported parameter through old rendering code creates a new security boundary even when the renderer itself is unchanged.
114+
115+
Fail fast if the baseline cannot be established from code, tests, or an explicit product decision. Do not infer that behavior is unimportant because it was previously implicit.
116+
80117
## Keep the layers distinct
81118

82119
Use these responsibilities:
@@ -269,6 +306,10 @@ Add focused tests for every migrated surface and principal kind allowed by the o
269306
- Public API: personal and workspace keys, rate and rollout behavior, concealment, exact external envelope, and rate headers.
270307
- Copilot or tools: trusted context, exact registered operation membership, rejected forged scope, aliases and resume paths, permission re-check, safe errors, and unchanged tool result shapes.
271308
- Side effects: audit derives from authoritative results; shared notifications follow audit; neither occurs for rejection or no-op.
309+
- Compatibility characterization: legacy normalization, exact response/redirect/cookie behavior, concealment, error subclass precedence, and branch-specific output.
310+
- Failure sequencing: inject a failure after each independently committing step and assert persisted state plus audit, analytics, and notification effects.
311+
- Concurrency: overlap stateful browser or provider flows and prove each callback consumes only its own state and return destination.
312+
- Rendering boundaries: exercise hostile values for every newly connected input that reaches HTML, inline JavaScript, URLs, logs, or provider requests.
272313

273314
Run at minimum:
274315

.cursor/commands/migrate-application-operation.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,43 @@ Classify each as `migrate`, `defer`, or `non-goal`. Do not migrate adjacent oper
7373

7474
Preserve behavior unless the task explicitly changes it. Stop and report a decision when surfaces currently disagree on security or compatibility behavior; do not silently choose one.
7575

76+
## Freeze observable behavior before editing
77+
78+
Treat the legacy route or tool as an ordered program, not merely a bag of business logic. Before moving code, write a compact baseline for every in-scope entry point and add focused characterization tests for behavior not already pinned down.
79+
80+
Capture all of these when they apply:
81+
82+
- Accepted inputs, including trimming, blank omission, duplicate query keys, aliases, defaults, and bounds.
83+
- Authentication and authorization order, minimum roles, resource membership, concealment, and exact error/status mapping.
84+
- Exact success bodies, optional fields, status codes, redirects, cookies, headers, and binary or stream behavior.
85+
- Mutation ordering, transaction boundaries, idempotency, no-ops, and observable state after each possible partial failure.
86+
- Audit, notification, analytics, and billing timing plus exact semantic dimensions and attribution.
87+
- Browser or protocol state ownership, concurrency isolation, expiry, callback ordering, and cleanup behavior.
88+
- Every value newly crossing into HTML, JavaScript, SQL, URLs, logs, provider payloads, or another encoding context.
89+
90+
Compare the old statement order with the proposed application lifecycle explicitly:
91+
92+
```text
93+
legacy parse/normalize
94+
-> legacy authorization checks
95+
-> branch-specific canonical lookup
96+
-> mutation(s)
97+
-> per-step side effects
98+
-> response or redirect catch
99+
```
100+
101+
Moving those steps under a wrapper may change behavior even when each individual call is reused. In particular:
102+
103+
- `projectAudit` and `afterSuccess` run only after `execute` returns. They cannot describe earlier committed mutations when a later step throws. Make the compound mutation atomic or define explicit partial-result/failure projection semantics before migrating it.
104+
- Operation metadata is executable policy. Adding a resource role to a workspace-only legacy read is an authorization change, not an architectural cleanup.
105+
- A shared error policy does not automatically preserve route-local concealment, subclass ordering, browser redirects, or branch-specific messages.
106+
- A shared contract does not automatically preserve manual `URLSearchParams` normalization or exact legacy response unions.
107+
- A shared use case may own domain behavior while separate surface presenters still preserve different wire shapes.
108+
- Per-flow identity is insufficient when another part of the flow remains in browser-global state such as one cookie.
109+
- Passing a newly supported parameter through old rendering code creates a new security boundary even when the renderer itself is unchanged.
110+
111+
Fail fast if the baseline cannot be established from code, tests, or an explicit product decision. Do not infer that behavior is unimportant because it was previously implicit.
112+
76113
## Keep the layers distinct
77114

78115
Use these responsibilities:
@@ -265,6 +302,10 @@ Add focused tests for every migrated surface and principal kind allowed by the o
265302
- Public API: personal and workspace keys, rate and rollout behavior, concealment, exact external envelope, and rate headers.
266303
- Copilot or tools: trusted context, exact registered operation membership, rejected forged scope, aliases and resume paths, permission re-check, safe errors, and unchanged tool result shapes.
267304
- Side effects: audit derives from authoritative results; shared notifications follow audit; neither occurs for rejection or no-op.
305+
- Compatibility characterization: legacy normalization, exact response/redirect/cookie behavior, concealment, error subclass precedence, and branch-specific output.
306+
- Failure sequencing: inject a failure after each independently committing step and assert persisted state plus audit, analytics, and notification effects.
307+
- Concurrency: overlap stateful browser or provider flows and prove each callback consumes only its own state and return destination.
308+
- Rendering boundaries: exercise hostile values for every newly connected input that reaches HTML, inline JavaScript, URLs, logs, or provider requests.
268309

269310
Run at minimum:
270311

apps/docs/content/docs/en/integrations/logrocket.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,4 +188,3 @@ Register a release version in LogRocket so uploaded source maps can decode stack
188188
| --------- | ---- | ----------- |
189189
| `version` | string | Release version that was registered |
190190

191-

apps/docs/openapi-v2-billing.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@
479479
"description": "Human-readable explanation of the error."
480480
},
481481
"details": {
482-
"description": "Structured error details. On a `403` whose cause a caller can act on, this carries a `code` from a closed set:\n- `INSUFFICIENT_WORKSPACE_ROLE` — The caller has access to the workspace but its role is below the one this operation requires.\n- `PERSONAL_API_KEYS_DISABLED` — The workspace's organization does not allow personal API keys. Use a workspace API key.\n- `WORKSPACE_KEY_OPERATION_NOT_PERMITTED` — This operation is not available to a workspace-scoped API key. Use a personal API key.\n- `PRINCIPAL_KIND_NOT_PERMITTED` — This operation does not accept the caller’s kind of API key.\n- `ORGANIZATION_MEMBERSHIP_REQUIRED` — The caller is not a member of the organization it named.\n- `ORGANIZATION_ADMIN_REQUIRED` — The caller is a member of the organization but not an admin or owner.\n- `ENTERPRISE_PLAN_REQUIRED` — The organization has no active enterprise subscription.\n- `AUDIT_LOGS_DISABLED` — Audit logging is not enabled for this deployment.\n- `SKILL_EDITOR_ACCESS_REQUIRED` — The caller can write in the workspace but is not an editor of this skill.\n- `SECRET_ADMIN_ACCESS_REQUIRED` — The caller can write in the workspace but is not an admin of this secret. Ask a workspace admin, or someone holding admin on the secret, to grant access or set the value.\n- `WORKSPACE_RESOURCE_LIMIT_REACHED` — The workspace already holds the maximum number of resources of this kind. Delete one, or contact Sim to raise the limit; the message names the ceiling.\n- `PUBLIC_SHARING_NOT_ALLOWED` — The workspace's organization does not permit sharing this resource publicly. An organization admin controls the policy.\n- `MCP_SERVER_URL_NOT_ALLOWED` — The supplied MCP server URL is outside the allowed domains or resolves to an internal address."
482+
"description": "Structured error details. On a `403` whose cause a caller can act on, this carries a `code` from a closed set:\n- `INSUFFICIENT_WORKSPACE_ROLE` — The caller has access to the workspace but its role is below the one this operation requires.\n- `PERSONAL_API_KEYS_DISABLED` — The workspace's organization does not allow personal API keys. Use a workspace API key.\n- `WORKSPACE_KEY_OPERATION_NOT_PERMITTED` — This operation is not available to a workspace-scoped API key. Use a personal API key.\n- `PRINCIPAL_KIND_NOT_PERMITTED` — This operation does not accept the caller’s kind of API key.\n- `ORGANIZATION_MEMBERSHIP_REQUIRED` — The caller is not a member of the organization it named.\n- `ORGANIZATION_ADMIN_REQUIRED` — The caller is a member of the organization but not an admin or owner.\n- `ENTERPRISE_PLAN_REQUIRED` — The organization has no active enterprise subscription.\n- `AUDIT_LOGS_DISABLED` — Audit logging is not enabled for this deployment.\n- `SKILL_EDITOR_ACCESS_REQUIRED` — The caller can write in the workspace but is not an editor of this skill.\n- `SECRET_ADMIN_ACCESS_REQUIRED` — The caller can write in the workspace but is not an admin of this secret. Ask a workspace admin, or someone holding admin on the secret, to grant access or set the value.\n- `WORKSPACE_RESOURCE_LIMIT_REACHED` — The workspace already holds the maximum number of resources of this kind. Delete one, or contact Sim to raise the limit; the message names the ceiling.\n- `PUBLIC_SHARING_NOT_ALLOWED` — The workspace's organization does not permit sharing this resource publicly. An organization admin controls the policy.\n- `CREDENTIAL_ADMIN_ACCESS_REQUIRED` — The caller can reach the workspace but cannot administer this credential.\n- `MCP_SERVER_URL_NOT_ALLOWED` — The supplied MCP server URL is outside the allowed domains or resolves to an internal address."
483483
}
484484
},
485485
"required": ["code", "message"],

0 commit comments

Comments
 (0)