diff --git a/.agents/skills/native-trigger/SKILL.md b/.agents/skills/native-trigger/SKILL.md
index ae38f70b32..a4ff8e121a 100644
--- a/.agents/skills/native-trigger/SKILL.md
+++ b/.agents/skills/native-trigger/SKILL.md
@@ -84,7 +84,7 @@ pub trait External: Send + Sync + 'static {
async fn prepare_webhook(&self, db, w_id, headers, body, script_path, is_flow) -> Result;
fn service_config_from_create_response(&self, data, resp) -> Option;
fn additional_routes(&self) -> axum::Router;
- async fn http_client_request(&self, url, method, workspace_id, tx, db, headers, body) -> Result;
+ async fn http_client_request(&self, url, method, workspace_id, connection_path, db, headers, body) -> Result;
}
```
@@ -115,28 +115,47 @@ Use this when the external_id is known before the create call (e.g., Google gene
Use this when the external_id is assigned by the remote service and the webhook URL needs to be corrected after creation.
-### OAuth Token Storage (Three-Table Pattern)
+### OAuth App and Connections
-OAuth tokens are stored across three tables, NOT in `workspace_integrations.oauth_data` directly:
+The OAuth **app** (client) is configured per workspace and service; **connections** (connected
+accounts) are many per service. Each trigger acts through one connection, named by
+`native_trigger.connection_path`:
| Table | What's Stored |
|-------|---------------|
-| `workspace_integrations` | `oauth_data` JSON with `base_url`, `client_id`, `client_secret`, `instance_shared` flag; `resource_path` pointing to the variable |
-| `variable` | Encrypted `access_token` (at the path stored in `resource_path`), linked to `account` via `account` column |
-| `account` | `refresh_token`, keyed by `workspace_id` + `client` (service name) + `is_workspace_integration = true` |
+| `workspace_integrations` | `oauth_data` JSON with `base_url`, `client_id`, `client_secret`, `instance_shared` flag. One row per (workspace, service); it must exist for every connection, since token refresh reads the client from it |
+| `variable` | Encrypted `access_token` at the connection path, linked to `account` via its `account` column |
+| `account` | `refresh_token`, with `client` = service name and `is_workspace_integration = true` |
+| `resource` | The connection's resource at the same path, `{ "token": "$var:" }` |
-The `decrypt_oauth_data()` function in `lib.rs` assembles these into a unified struct:
+A user may use a connection when they can read its variable (checked with a user transaction,
+so the variable's row-level security decides): `resolve_usable_connection` /
+`list_usable_connections` in `lib.rs`. The exception is the **workspace connection**: an admin
+may share one connection per service (`workspace_integrations.resource_path`, set by
+`POST .../workspace_connection`), and every member may then use it without reading its token.
+Renames carry the marker along; disconnecting clears it. Background work (sync, renewal, rename re-registration,
+webhook handling) uses the stored `connection_path` directly.
+
+`decrypt_oauth_data(db, w_id, service, connection_path)` assembles these into one struct, and
+every service's `OAuthData` carries `connection_path` so `http_client_request` can refresh and
+write back the right connection:
```rust
pub struct OAuthConfig {
pub base_url: String,
- pub access_token: String, // decrypted from variable
- pub refresh_token: Option, // from account table
+ pub access_token: String, // decrypted from the connection's variable
+ pub refresh_token: Option, // from its account
pub client_id: String, // from oauth_data or instance settings
pub client_secret: String, // from oauth_data or instance settings
+ pub connection_path: String,
}
```
-Instance-level sharing: when `oauth_data.instance_shared == true`, `client_id` and `client_secret` are read from global settings instead of workspace_integrations.
+A refreshed token is written back by connection path and account id, never by service: providers
+like Nextcloud rotate refresh tokens, so writing one onto another account breaks its next refresh.
+
+Instance-level sharing: when the workspace has no OAuth app of its own and the instance admin
+shares one (`share_with_workspaces` in the `oauths` setting; not available for Nextcloud), the
+connect flow uses it and records `{"instance_shared": true}` in `workspace_integrations`.
### URL Resolution
@@ -311,7 +330,7 @@ impl External for NewService {
});
let response: CreateTriggerResponse = self
- .http_client_request(&url, Method::POST, w_id, tx, db, None, Some(&payload))
+ .http_client_request(&url, Method::POST, w_id, &oauth_data.connection_path, db, None, Some(&payload))
.await?;
Ok(response)
@@ -343,7 +362,7 @@ impl External for NewService {
});
let _: serde_json::Value = self
- .http_client_request(&url, Method::PUT, w_id, tx, db, None, Some(&payload))
+ .http_client_request(&url, Method::PUT, w_id, &oauth_data.connection_path, db, None, Some(&payload))
.await?;
// Fetch back the updated state to get the resolved config
@@ -361,7 +380,7 @@ impl External for NewService {
tx: &mut PgConnection,
) -> Result {
let url = format!("{}/api/webhooks/{}", oauth_data.base_url, external_id);
- self.http_client_request::<_, ()>(&url, Method::GET, w_id, tx, db, None, None).await
+ self.http_client_request::<_, ()>(&url, Method::GET, w_id, &oauth_data.connection_path, db, None, None).await
}
async fn delete(
@@ -374,7 +393,7 @@ impl External for NewService {
) -> Result<()> {
let url = format!("{}/api/webhooks/{}", oauth_data.base_url, external_id);
let _: serde_json::Value = self
- .http_client_request::<_, ()>(&url, Method::DELETE, w_id, tx, db, None, None)
+ .http_client_request::<_, ()>(&url, Method::DELETE, w_id, &oauth_data.connection_path, db, None, None)
.await
.or_else(|e| match &e {
Error::InternalErr(msg) if msg.contains("404") => Ok(serde_json::Value::Null),
@@ -749,7 +768,7 @@ pub async fn prepare_native_trigger_args(service_name, db, w_id, headers, body)
When `workspace_integrations.oauth_data.instance_shared == true`, `decrypt_oauth_data()` reads `client_id` and `client_secret` from instance-level global settings instead of workspace-level. This allows admins to share OAuth app credentials across workspaces.
-The frontend handles this via the `generate_instance_connect_url` endpoint in `workspace_integrations.rs`.
+`generate_connect_url` picks the client (`resolve_oauth_client`): the workspace's own app when configured, the instance's otherwise. A GitHub OAuth app only redirects below its single registered callback, so connections made with the instance GitHub app land on `/oauth/callback/github/native_trigger` instead of the workspace settings page.
---
diff --git a/.github/DockerfileBackendTests b/.github/DockerfileBackendTests
index 2ce47ea714..e41a7bbff9 100644
--- a/.github/DockerfileBackendTests
+++ b/.github/DockerfileBackendTests
@@ -28,7 +28,7 @@ ENV PATH="${PATH}:/usr/local/go/bin"
ENV GO_PATH=/usr/local/go/bin/go
# UV
-RUN curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/uv/releases/download/0.13.0/uv-installer.sh | sh && mv /usr/local/cargo/bin/uv /usr/local/bin/uv
+RUN curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/uv/releases/download/0.13.4/uv-installer.sh | sh && mv /usr/local/cargo/bin/uv /usr/local/bin/uv
ENV TZ=Etc/UTC
@@ -42,7 +42,7 @@ RUN wget https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VER
RUN /usr/local/bin/python3 -m pip install pip-tools
# Bun
-COPY --from=oven/bun:1.4.0 /usr/local/bin/bun /usr/bin/bun
+COPY --from=oven/bun:1.4.4 /usr/local/bin/bun /usr/bin/bun
# Install windmill CLI
RUN bun install -g windmill-cli \
diff --git a/.github/actions/sign-attest-image/action.yml b/.github/actions/sign-attest-image/action.yml
index de0133dac0..564a621380 100644
--- a/.github/actions/sign-attest-image/action.yml
+++ b/.github/actions/sign-attest-image/action.yml
@@ -46,7 +46,15 @@ runs:
env:
IMAGE: ${{ inputs.image }}
DIGEST: ${{ inputs.digest }}
- run: cosign sign --yes --recursive "${IMAGE}@${DIGEST}"
+ # Fulcio and Rekor return transient 5xx often enough to fail a release;
+ # re-signing the same digest only adds a signature, so retrying is safe.
+ run: |
+ for attempt in 1 2 3 4 5; do
+ cosign sign --yes --recursive "${IMAGE}@${DIGEST}" && exit 0
+ echo "::warning::cosign sign failed (attempt $attempt/5)"
+ [ "$attempt" -lt 5 ] && sleep $((attempt * 30))
+ done
+ exit 1
- name: SLSA provenance (GitHub artifact attestation)
uses: actions/attest-build-provenance@v4
diff --git a/.github/workflows/ai-agent-tests.yml b/.github/workflows/ai-agent-tests.yml
index 8a3e9e6dbc..255f07e253 100644
--- a/.github/workflows/ai-agent-tests.yml
+++ b/.github/workflows/ai-agent-tests.yml
@@ -61,7 +61,7 @@ jobs:
- uses: oven-sh/setup-bun@v2
with:
- bun-version: 1.4.0
+ bun-version: 1.4.4
- uses: actions/setup-node@v7
with:
diff --git a/.github/workflows/ai-evals-scheduled.yml b/.github/workflows/ai-evals-scheduled.yml
index 580a757c21..2bd8cdb181 100644
--- a/.github/workflows/ai-evals-scheduled.yml
+++ b/.github/workflows/ai-evals-scheduled.yml
@@ -46,7 +46,7 @@ jobs:
- uses: oven-sh/setup-bun@v2
with:
- bun-version: 1.4.0
+ bun-version: 1.4.4
- id: matrix
env:
@@ -93,7 +93,7 @@ jobs:
- uses: oven-sh/setup-bun@v2
with:
- bun-version: 1.4.0
+ bun-version: 1.4.4
- uses: actions/setup-node@v7
with:
diff --git a/.github/workflows/ai-evals-test.yml b/.github/workflows/ai-evals-test.yml
index 84b488ae46..4dd266c364 100644
--- a/.github/workflows/ai-evals-test.yml
+++ b/.github/workflows/ai-evals-test.yml
@@ -75,7 +75,7 @@ jobs:
- uses: oven-sh/setup-bun@v2
with:
- bun-version: 1.4.0
+ bun-version: 1.4.4
- uses: actions/setup-node@v7
with:
diff --git a/.github/workflows/backend-test-windows.yml b/.github/workflows/backend-test-windows.yml
index 9fa13bca58..8bbb73d379 100644
--- a/.github/workflows/backend-test-windows.yml
+++ b/.github/workflows/backend-test-windows.yml
@@ -73,7 +73,7 @@ jobs:
- uses: oven-sh/setup-bun@v2
with:
- bun-version: 1.4.0
+ bun-version: 1.4.4
- uses: actions/setup-node@v7
with:
@@ -81,7 +81,7 @@ jobs:
- uses: astral-sh/setup-uv@v7
with:
- version: "0.13.0"
+ version: "0.13.4"
- uses: shivammathur/setup-php@v2
with:
diff --git a/.github/workflows/backend-test.yml b/.github/workflows/backend-test.yml
index b01e99a696..f2dedd8c69 100644
--- a/.github/workflows/backend-test.yml
+++ b/.github/workflows/backend-test.yml
@@ -58,13 +58,13 @@ jobs:
go-version: 1.21.5
- uses: oven-sh/setup-bun@v2
with:
- bun-version: 1.4.0
+ bun-version: 1.4.4
- uses: actions/setup-node@v7
with:
node-version: "24"
- uses: astral-sh/setup-uv@v7
with:
- version: "0.13.0"
+ version: "0.13.4"
- uses: shivammathur/setup-php@v2
with:
php-version: "8.3"
diff --git a/.github/workflows/codex-pr-review.yml b/.github/workflows/codex-pr-review.yml
index 2d70ad7f7a..e1628729d8 100644
--- a/.github/workflows/codex-pr-review.yml
+++ b/.github/workflows/codex-pr-review.yml
@@ -42,12 +42,14 @@ jobs:
# skips auto-review for every private member.
# Dependabot-triggered runs get a separate secret scope, so this job has no API
# key and cannot review. workflow_call stays open for an explicit request.
+ # `[skip-ai-review]` in the PR body opts out of the automatic run only.
if: |
github.event_name == 'workflow_call' ||
(
github.event.pull_request.draft == false &&
github.event.pull_request.head.repo.fork == false &&
- github.event.pull_request.user.login != 'dependabot[bot]'
+ github.event.pull_request.user.login != 'dependabot[bot]' &&
+ !contains(github.event.pull_request.body, '[skip-ai-review]')
)
permissions:
contents: read
diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml
index 51da953ab0..c046a7d101 100644
--- a/.github/workflows/docker-image.yml
+++ b/.github/workflows/docker-image.yml
@@ -197,47 +197,41 @@ jobs:
ARCH: amd64
steps:
- uses: actions/checkout@v4
- - run: |
- # pulling docker image with desired arch so that actions-docker-extract doesn't do it
- docker pull --platform "linux/$ARCH" ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ needs.build.outputs.digest }}
- docker pull --platform "linux/$ARCH" ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-ee@${{ needs.build_ee.outputs.digest }}
- - run: |
- # Checks the image is in docker prior to running actions-docker-extract. It fails if not
- # Also useful to visually check that the arch is the right opencontainers
- docker image inspect ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ needs.build.outputs.digest }}
- docker image inspect ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-ee@${{ needs.build_ee.outputs.digest }}
-
- - uses: shrink/actions-docker-extract@v3
- id: extract
- with:
- image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ needs.build.outputs.digest }}
- path: "/usr/src/app/windmill"
-
- - uses: shrink/actions-docker-extract@v3
- id: extract-duckdb-ffi-internal
- with:
- image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ needs.build.outputs.digest }}
- path: "/usr/src/app/windmill_duckdb_runner"
-
- - uses: shrink/actions-docker-extract@v3
- id: extract-ee
- with:
- image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-ee@${{ needs.build_ee.outputs.digest }}
- path: "/usr/src/app/windmill"
-
- - name: Rename binary with corresponding architecture
+ # The runner disk cannot hold the CE and EE images at once, so each image
+ # is pulled, extracted from and removed before the next one is pulled.
+ - name: Extract binaries
+ env:
+ CE_IMAGE: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ needs.build.outputs.digest }}
+ EE_IMAGE: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-ee@${{ needs.build_ee.outputs.digest }}
run: |
- mv "${{ steps.extract.outputs.destination }}/windmill" "${{ steps.extract.outputs.destination }}/windmill-${ARCH}"
- mv "${{ steps.extract-ee.outputs.destination }}/windmill" "${{ steps.extract-ee.outputs.destination }}/windmill-ee-${ARCH}"
+ set -euo pipefail
+ mkdir -p release
+ # extract ( )...
+ extract() {
+ local image=$1 cid
+ shift
+ docker pull --platform "linux/$ARCH" "$image"
+ docker image inspect --format '{{.Os}}/{{.Architecture}}' "$image"
+ cid=$(docker create --platform "linux/$ARCH" "$image")
+ while [ $# -gt 0 ]; do
+ docker cp "$cid:$1" "release/$2"
+ shift 2
+ done
+ docker rm "$cid"
+ docker rmi "$image"
+ df -h /
+ }
+ extract "$CE_IMAGE" \
+ /usr/src/app/windmill "windmill-$ARCH" \
+ /usr/src/app/windmill_duckdb_runner windmill_duckdb_runner
+ extract "$EE_IMAGE" /usr/src/app/windmill "windmill-ee-$ARCH"
+ ls -la release
- name: Attach binary to release
uses: softprops/action-gh-release@v2
with:
- files: |
- ${{ steps.extract.outputs.destination }}/*
- ${{ steps.extract-ee.outputs.destination }}/*
- ${{ steps.extract-duckdb-ffi-internal.outputs.destination }}/*
+ files: release/*
upload_ee_debug_to_s3:
needs: [build_ee]
diff --git a/.github/workflows/git-sync-test.yml b/.github/workflows/git-sync-test.yml
index b19f899a20..7d26392dee 100644
--- a/.github/workflows/git-sync-test.yml
+++ b/.github/workflows/git-sync-test.yml
@@ -135,7 +135,7 @@ jobs:
- uses: oven-sh/setup-bun@v2
with:
- bun-version: 1.4.0
+ bun-version: 1.4.4
- uses: denoland/setup-deno@v2
with:
diff --git a/.github/workflows/pi-pr-review.yml b/.github/workflows/pi-pr-review.yml
index a18dc28ff2..4b57db7b78 100644
--- a/.github/workflows/pi-pr-review.yml
+++ b/.github/workflows/pi-pr-review.yml
@@ -40,12 +40,14 @@ jobs:
# skips auto-review for every private member.
# Dependabot-triggered runs get a separate secret scope, so this job has no API
# key and cannot review. workflow_call stays open for an explicit request.
+ # `[skip-ai-review]` in the PR body opts out of the automatic run only.
if: |
github.event_name == 'workflow_call' ||
(
github.event.pull_request.draft == false &&
github.event.pull_request.head.repo.fork == false &&
- github.event.pull_request.user.login != 'dependabot[bot]'
+ github.event.pull_request.user.login != 'dependabot[bot]' &&
+ !contains(github.event.pull_request.body, '[skip-ai-review]')
)
permissions:
contents: read
diff --git a/.github/workflows/pr-ready-review.yml b/.github/workflows/pr-ready-review.yml
index 90714cba53..4b88273cad 100644
--- a/.github/workflows/pr-ready-review.yml
+++ b/.github/workflows/pr-ready-review.yml
@@ -39,12 +39,14 @@ jobs:
# skips auto-review for every private member.
# Dependabot-triggered runs get a separate secret scope, so this job has no API
# key and cannot review. workflow_call stays open for an explicit request.
+ # `[skip-ai-review]` in the PR body opts out of the automatic run only.
if: |
github.event_name == 'workflow_call' ||
(
(github.event.pull_request.draft == false || github.event.pull_request.ready_for_review == true) &&
github.event.pull_request.head.repo.fork == false &&
- github.event.pull_request.user.login != 'dependabot[bot]'
+ github.event.pull_request.user.login != 'dependabot[bot]' &&
+ !contains(github.event.pull_request.body, '[skip-ai-review]')
)
permissions:
contents: read
diff --git a/.github/workflows/weekly-pr-summary.yml b/.github/workflows/weekly-pr-summary.yml
index 9d1f0631fb..14551e9943 100644
--- a/.github/workflows/weekly-pr-summary.yml
+++ b/.github/workflows/weekly-pr-summary.yml
@@ -39,9 +39,10 @@ jobs:
- This gives you the exact 7-day window (store these in variables for use in commands)
2. **Fetch ONLY Merged PRs from Past Week**:
- - Command: `gh pr list --repo ${{ github.repository }} --state merged --search "merged:>=$CUTOFF_DATE" --limit 100 --json number,title,author,mergedAt,url`
+ - Command: `gh pr list --repo ${{ github.repository }} --state merged --search "merged:>=$CUTOFF_DATE" --limit 100 --json number,title,author,mergedAt,url,body --jq '[.[] | select((.body // "") | contains("[skip-ai-review]") | not) | del(.body)]'`
- This returns ONLY PRs that were merged in the last 7 days
- The --search flag filters by merge date using GitHub's search syntax
+ - The --jq filter drops PRs whose body contains `[skip-ai-review]`; never fetch or mention those PRs
- **FILTER OUT** any PRs with titles starting with "chore: release" or "chore(release)"
3. **Categorize PRs**: Group PRs into three categories by analyzing titles and labels:
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 3714717023..9edb1a8e87 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "1.841.0"
+ ".": "1.849.0"
}
diff --git a/AGENTS.md b/AGENTS.md
index 6516e0e095..ef87f1c4dc 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -41,11 +41,14 @@ Open-source platform for internal tools, workflows, API integrations, background
for an inline app runnable that opts in), why an admin's roles are not added, the per-role-set
logins and the order their rows and logins are written in
- **Enterprise**: `docs/enterprise.md` — EE file conventions and PR workflow
+- **Workspace roles**: `docs/workspace-roles.md` — instance-defined roles with per-workspace
+ overrides, the capabilities a role holds, why `ApiAuthed::is_operator` must be derived from the
+ role, and the `role_seat` table billing reads
- **Operator write rights**: `docs/operator-write-rights.md` — which `operator_settings` flags are
enforced rather than cosmetic, and why a right that is granted-unless-withdrawn needs `Option`
fields and a jsonb merge rather than a serde default
- **Operator builder rights**: `docs/operator-builder-rights.md` — the workspace settings that let
- operators compose flows and full-code apps, what the composition check must cover, which
+ operators compose flows, AI agents and full-code apps, what the composition check must cover, which
raw-app endpoint stays closed on purpose, and why either right costs a full seat
- **Auth surface**: `docs/auth-surface.md` — credential precedence, session/cache invalidation
scope, which token labels email their owner at expiry, how OAuth login matches `login_type`, and
@@ -63,6 +66,7 @@ Open-source platform for internal tools, workflows, API integrations, background
- **Domain vocabulary**: `CONTEXT.md` — the words this codebase uses for its own concepts (step, step setting, trigger step, …). Name things the way it does.
- **CLI commands**: when adding/modifying/removing a command, subcommand, option, or description in `cli/src/commands/`, run `python system_prompts/generate.py` to refresh `system_prompts/auto-generated/` and `cli/src/guidance/skills.gen.ts`. The CLI docs the agents use to operate `wmill` are derived from the source — stale generated files give agents the wrong flags.
- **AI guidance** (chat prompts and CLI skills): what the AI knows about Windmill itself — how flows, scripts, apps, pipelines and resources work — is written once, in `system_prompts/base/` and `system_prompts/languages/`, and `system_prompts/generate.py` builds both the chat's `$system_prompts` exports and the CLI's skills from it. Add or change such guidance there, never inline in one consumer: a sentence only one side should see goes in a `` / `` block, and a new file reaches both through the `TOPICS` table. The chat prompt builders under `frontend/src/lib/components/copilot/chat/` add only tool plumbing and runtime values, and shared markdown names no chat tool, since it reaches every chat mode. Rerun `generate.py` after editing; `system_prompts/README.md` has the details.
+- **Windmill MCP server**: `/api/mcp` gives a token with `mcp:all` the AI session's GLOBAL toolset (`backend/windmill-api/src/mcp/session/`), and a token scoped to a selection of scripts and flows the tools server's per-runnable tools, without endpoint tools. The tools server's own URLs, `/api/mcp/w/{workspace}/mcp` and `/api/mcp/gateway`, keep serving existing tokens, endpoint scopes included, except that they give the session toolset to an `mcp:all` token carrying `mcp:session` (added by the OAuth approve, kept across scope edits) or `mcp:read_only`/`mcp:read_run`. Every tool takes a `workspace_id`; the token bounds which (its bound workspace, the `mcp:workspaces:` list, or all of its owner's). What a model reads there (tool names, descriptions, input schemas, instructions, `get_instructions` texts) is generated from the session's TypeScript into `session/gen/`: after changing a GLOBAL tool definition, the global system prompt or `system_prompts/`, run `npm run gen:mcp-session` from `frontend/` (`mcpSessionGen.test.ts` fails otherwise). What a tool *does* is written twice, in `chat/global/core.ts` and in a Rust handler: a behaviour change on one side must be mirrored on the other, and a new session tool is either implemented in Rust or added to `EDITOR_ONLY` (a `cargo test` in `session/mod.rs` fails otherwise).
- **Session recorder**: `frontend/src/lib/components/recording/` is also the recorder `wmill app dev --recording` serves, vendored into the CLI as `cli/src/commands/app/devRecorderBundle.gen.ts`. After changing `rawAppSnapshot.ts` or `rawAppRecording.svelte.ts`, run `bun run gen:dev-recorder` from `cli/` (`cli/test/dev_recorder_bundle_unit.test.ts` fails otherwise).
- **Raw-app policy**: `frontend/src/lib/components/raw_apps/rawAppPolicy.ts` also derives the policy the server's raw-app deploy stores, vendored into the bundle job as `backend/windmill-api/src/apps_raw_policy.gen.js`. After changing it or anything it imports, run `bun run gen:app-policy` from `cli/` (`cli/test/app_policy_bundle_unit.test.ts` fails otherwise). It rides in the job rather than being read from the CLI the job runs because the images install `windmill-cli` unpinned, so an image can carry one older than its server.
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 659adb9e25..d0fccb9912 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,163 @@
# Changelog
+## [1.849.0](https://github.com/windmill-labs/windmill/compare/v1.848.3...v1.849.0) (2026-10-25)
+
+
+### Features
+
+* per-user Anthropic Workload Identity Federation for Windmill AI ([#11998](https://github.com/windmill-labs/windmill/issues/11998)) ([6c8fd6c](https://github.com/windmill-labs/windmill/commit/6c8fd6cfe2057f2822230bdf9ad2058f537df996))
+
+## [1.848.3](https://github.com/windmill-labs/windmill/compare/v1.848.2...v1.848.3) (2026-10-25)
+
+
+### Bug Fixes
+
+* pin node to 24.22.1 in the worker image for CVE-2026-111497 ([#11995](https://github.com/windmill-labs/windmill/issues/11995)) ([0e79e93](https://github.com/windmill-labs/windmill/commit/0e79e934b6342150ee31de08a19400de482b1969))
+
+## [1.848.2](https://github.com/windmill-labs/windmill/compare/v1.848.1...v1.848.2) (2026-10-24)
+
+
+### Bug Fixes
+
+* tighten file handling in deno/bun, stricter codebase tarball,executor isolation ([#11990](https://github.com/windmill-labs/windmill/issues/11990)) ([ccf8892](https://github.com/windmill-labs/windmill/commit/ccf889269b8897be707cde639b2531d522c286c9))
+
+## [1.848.1](https://github.com/windmill-labs/windmill/compare/v1.848.0...v1.848.1) (2026-10-23)
+
+
+### Bug Fixes
+
+* restore workspace pg_dump changes reverted by 812ff6ea5e ([#11988](https://github.com/windmill-labs/windmill/issues/11988)) ([45d3c95](https://github.com/windmill-labs/windmill/commit/45d3c951bb8827c67daaaf75ed52f3c3e1215911))
+* use linkedin openid connect default scopes ([#11953](https://github.com/windmill-labs/windmill/issues/11953)) ([001313a](https://github.com/windmill-labs/windmill/commit/001313aa242c6de053a9deb0c6cdb64580ce1cee))
+
+## [1.848.0](https://github.com/windmill-labs/windmill/compare/v1.847.0...v1.848.0) (2026-10-23)
+
+
+### Features
+
+* add a use/plan/build mode picker and read-only prod sessions ([#11940](https://github.com/windmill-labs/windmill/issues/11940)) ([d6c2b2c](https://github.com/windmill-labs/windmill/commit/d6c2b2c68344bb95939701c418116b2e7d4715a3))
+* composer pills that teach Windmill from the workspace ([#11889](https://github.com/windmill-labs/windmill/issues/11889)) ([ebeea51](https://github.com/windmill-labs/windmill/commit/ebeea514926f60295f3f11f516f4ccda3448f829))
+* fill docusign, salesforce and quickbooks fields on connect ([#11960](https://github.com/windmill-labs/windmill/issues/11960)) ([11f2a4c](https://github.com/windmill-labs/windmill/commit/11f2a4c7ffac980036f839759ae93da6ff3f22e4))
+* group home row menus and open them at their final height ([#11949](https://github.com/windmill-labs/windmill/issues/11949)) ([91bf9b6](https://github.com/windmill-labs/windmill/commit/91bf9b67a74afb419659719949484f1cfd5338c0))
+* let flow builder operators build AI agents ([#11898](https://github.com/windmill-labs/windmill/issues/11898)) ([e5dedd1](https://github.com/windmill-labs/windmill/commit/e5dedd147e1db0c4f36796ba292188bcdb0efc5a))
+* manage and create folders from the home tree view ([#11943](https://github.com/windmill-labs/windmill/issues/11943)) ([da443d2](https://github.com/windmill-labs/windmill/commit/da443d2fb263ecaf90320809b1bb2fc8a4f65b20))
+* run a workspace handler when a variable's value expires ([#10837](https://github.com/windmill-labs/windmill/issues/10837)) ([7a29abc](https://github.com/windmill-labs/windmill/commit/7a29abc7eec491c35217445c1c08486ff030a22c))
+
+
+### Bug Fixes
+
+* change an app's access mode under the deploy row lock ([#11965](https://github.com/windmill-labs/windmill/issues/11965)) ([725b15f](https://github.com/windmill-labs/windmill/commit/725b15f546cf20c2e5908acffb105d73fe907558))
+* fork a raw app into the raw app builder, in its session when there ([#11978](https://github.com/windmill-labs/windmill/issues/11978)) ([3d6a2bc](https://github.com/windmill-labs/windmill/commit/3d6a2bcef2e284d64690db04db32a2326a4b0670))
+* home's acting-on follows the workspace home switches to ([#11946](https://github.com/windmill-labs/windmill/issues/11946)) ([18c6936](https://github.com/windmill-labs/windmill/commit/18c69360c9a8e9a9fe4c7c1d9e825a2b7be403a9))
+* keep a staged flow path across reloads and follow moves in session tabs ([#11967](https://github.com/windmill-labs/windmill/issues/11967)) ([6b56656](https://github.com/windmill-labs/windmill/commit/6b56656bd650f2db5fbd74e23b55b926c6f69dd7))
+* keep the log indexer starting when a stored day chunk is broken ([#11979](https://github.com/windmill-labs/windmill/issues/11979)) ([79fe8ab](https://github.com/windmill-labs/windmill/commit/79fe8ab03f6f052bf7fe763b6f8a0a23fe922611))
+* list usr columns explicitly in whoami's user lookup ([#11970](https://github.com/windmill-labs/windmill/issues/11970)) ([fb193d7](https://github.com/windmill-labs/windmill/commit/fb193d7a816ae97fa8fc60608270296e159dfd3c))
+* make the autoscaling Test scaling button run the integration ([#11972](https://github.com/windmill-labs/windmill/issues/11972)) ([72c6b10](https://github.com/windmill-labs/windmill/commit/72c6b10821cfa35ff3deb3a3ecc729ed75a9dbc6))
+* return variable.value as text so widening it changes no result type ([#11976](https://github.com/windmill-labs/windmill/issues/11976)) ([f6f3a0a](https://github.com/windmill-labs/windmill/commit/f6f3a0a1f24cd9ea0d78207d6848147ebd73bea0))
+* run unstamped git auto-pulls as a superadmin when no admin ([#11973](https://github.com/windmill-labs/windmill/issues/11973)) ([c89a827](https://github.com/windmill-labs/windmill/commit/c89a82750ed0a461d8d4f1502f019bc0da4ed58c))
+* send app editor inspector picks to a new AI session as a chip ([#11966](https://github.com/windmill-labs/windmill/issues/11966)) ([28d2556](https://github.com/windmill-labs/windmill/commit/28d2556c941f66cad353eca3809f43e8d8cf3c05))
+* share settings.yaml's git sync block between a fork and its parent ([#11974](https://github.com/windmill-labs/windmill/issues/11974)) ([fe38a1d](https://github.com/windmill-labs/windmill/commit/fe38a1d3763a11f8b0bc4b07d61824d3a7b51850))
+
+## [1.847.0](https://github.com/windmill-labs/windmill/compare/v1.846.1...v1.847.0) (2026-10-22)
+
+
+### Features
+
+* add job_id and flow_path to flow step error objects ([#11941](https://github.com/windmill-labs/windmill/issues/11941)) ([eeb48f0](https://github.com/windmill-labs/windmill/commit/eeb48f0c26ccc5162430eddec24adc2601eb5f99))
+* chat with a saved agent from a raw app through an agent runnable ([#11921](https://github.com/windmill-labs/windmill/issues/11921)) ([c6a93a9](https://github.com/windmill-labs/windmill/commit/c6a93a9b565752da6c8b55d383e5bee88f00f229))
+* let native triggers act through per-user or shared connections ([#11352](https://github.com/windmill-labs/windmill/issues/11352)) ([dc1fb50](https://github.com/windmill-labs/windmill/commit/dc1fb5087be7169045aad57e955dabe3e29de82e))
+* slack agents through a workspace's own slack app ([#11912](https://github.com/windmill-labs/windmill/issues/11912)) ([34de8bc](https://github.com/windmill-labs/windmill/commit/34de8bc06d2b04f7929bb8cf35f9a34d0e0071fa))
+* worker group toggle to keep the worker's proxy out of jobs ([#11958](https://github.com/windmill-labs/windmill/issues/11958)) ([8a0318a](https://github.com/windmill-labs/windmill/commit/8a0318a28f5cfda7557b0f94db20ef17b0664ee4))
+
+
+### Bug Fixes
+
+* compare a null resource description as empty ([#11947](https://github.com/windmill-labs/windmill/issues/11947)) ([8a7b148](https://github.com/windmill-labs/windmill/commit/8a7b1481bd270df3a98c9db5e7824d13b8cd37b6))
+* compare fork secret variables by decrypted value ([#11952](https://github.com/windmill-labs/windmill/issues/11952)) ([0dd131b](https://github.com/windmill-labs/windmill/commit/0dd131b38074423de5c769cae478c6ea0ae365c2))
+* hold home's ai composer space with a matching placeholder ([#11936](https://github.com/windmill-labs/windmill/issues/11936)) ([9202a74](https://github.com/windmill-labs/windmill/commit/9202a74071ba424ad6cfc1cfded518ee7db002dc))
+* link a variable to its OAuth account only in the connect flow ([#11361](https://github.com/windmill-labs/windmill/issues/11361)) ([d6adac8](https://github.com/windmill-labs/windmill/commit/d6adac8b7579ad6c3df5caab9a735451c1ddd896))
+* stop audit inserts from silently rolling back saves ([#11938](https://github.com/windmill-labs/windmill/issues/11938)) ([5ef19a8](https://github.com/windmill-labs/windmill/commit/5ef19a88a90b3a4fe05a78547416082dc51763f5))
+
+## [1.846.1](https://github.com/windmill-labs/windmill/compare/v1.846.0...v1.846.1) (2026-10-21)
+
+
+### Bug Fixes
+
+* home recent cards include items opened on their own page ([#11934](https://github.com/windmill-labs/windmill/issues/11934)) ([5019fab](https://github.com/windmill-labs/windmill/commit/5019fab5a5f996796a07524c770f86309a7a3500))
+* home search suggests filters whose name matches the typed text ([#11933](https://github.com/windmill-labs/windmill/issues/11933)) ([bf1eb85](https://github.com/windmill-labs/windmill/commit/bf1eb85577419cc08482158c1835d5262ebb87d2))
+
+## [1.846.0](https://github.com/windmill-labs/windmill/compare/v1.845.0...v1.846.0) (2026-10-21)
+
+
+### Features
+
+* home list settings menu with sort, library and user-folder toggles ([#11928](https://github.com/windmill-labs/windmill/issues/11928)) ([73f655d](https://github.com/windmill-labs/windmill/commit/73f655db98dd0f0fd03881c36e6c9310fb2687a2))
+
+
+### Bug Fixes
+
+* home's acting-on pick switches the current workspace ([#11929](https://github.com/windmill-labs/windmill/issues/11929)) ([cdaddcc](https://github.com/windmill-labs/windmill/commit/cdaddcce594378bf502f80e8f225f16b5def5eb4))
+
+## [1.845.0](https://github.com/windmill-labs/windmill/compare/v1.844.0...v1.845.0) (2026-10-21)
+
+
+### Features
+
+* home and empty ai sessions share one session composer ([#11635](https://github.com/windmill-labs/windmill/issues/11635)) ([56b2e10](https://github.com/windmill-labs/windmill/commit/56b2e106daedb5ae381052d3116346a88ba3f206))
+
+## [1.844.0](https://github.com/windmill-labs/windmill/compare/v1.843.0...v1.844.0) (2026-10-21)
+
+
+### Features
+
+* serve the ai session toolset over mcp at /api/mcp ([#11738](https://github.com/windmill-labs/windmill/issues/11738)) ([892334f](https://github.com/windmill-labs/windmill/commit/892334f008d5b6b73de38fdf2831b1a63eeb0a51))
+
+## [1.843.0](https://github.com/windmill-labs/windmill/compare/v1.842.0...v1.843.0) (2026-10-21)
+
+
+### Features
+
+* configurable workspace roles with per-workspace overrides ([#11821](https://github.com/windmill-labs/windmill/issues/11821)) ([21d2a49](https://github.com/windmill-labs/windmill/commit/21d2a49971b858ff8aef2776a36989b57ba49415))
+* move the open in AI session button to the page header ([#11888](https://github.com/windmill-labs/windmill/issues/11888)) ([34db239](https://github.com/windmill-labs/windmill/commit/34db23952a765bbb9c912d74d2a37092703f50f7))
+* ship php only on the full images ([#11922](https://github.com/windmill-labs/windmill/issues/11922)) ([b874861](https://github.com/windmill-labs/windmill/commit/b87486141df5b4f9b93900c0ee3264cf4b4610ec))
+* workspace roles settings UI and capability-based gating ([#11824](https://github.com/windmill-labs/windmill/issues/11824)) ([8dbdfa1](https://github.com/windmill-labs/windmill/commit/8dbdfa194912bf36a705392899b9f84b5a54fd55))
+
+
+### Bug Fixes
+
+* compact the AI chat history between tool iterations ([#11911](https://github.com/windmill-labs/windmill/issues/11911)) ([17de2ba](https://github.com/windmill-labs/windmill/commit/17de2ba983bee5cb7df700476ec8a0169c97ecbd))
+* refuse restarting a flow past an approval that was never granted ([#11920](https://github.com/windmill-labs/windmill/issues/11920)) ([2c6bcc0](https://github.com/windmill-labs/windmill/commit/2c6bcc09c9b6f768592b31ec540d727263a807cc))
+* remove horizontal scroll in the new workspace form ([#11909](https://github.com/windmill-labs/windmill/issues/11909)) ([d35c868](https://github.com/windmill-labs/windmill/commit/d35c86896fa4f5f9936a9f61735553e2ff42b218))
+* revoke mcp oauth grants on password change and reset ([#11908](https://github.com/windmill-labs/windmill/issues/11908)) ([c044777](https://github.com/windmill-labs/windmill/commit/c04477723c9d7544ea9c595e33fdcff5cce0c79d))
+* **worker:** render TEMP_SCRIPT_REFS placeholder in Python runner-group loader.py ([#11915](https://github.com/windmill-labs/windmill/issues/11915)) ([78fb800](https://github.com/windmill-labs/windmill/commit/78fb800904351f6b549b8b2227cb9c0d5dafd55d))
+
+## [1.842.0](https://github.com/windmill-labs/windmill/compare/v1.841.0...v1.842.0) (2026-10-20)
+
+
+### Features
+
+* let AI agents answer in Slack ([#11630](https://github.com/windmill-labs/windmill/issues/11630)) ([35b250e](https://github.com/windmill-labs/windmill/commit/35b250e76739a1e6f543971b099d5796a44d0c89))
+* name the action on chat tool confirmation buttons ([#11795](https://github.com/windmill-labs/windmill/issues/11795)) ([7d01d25](https://github.com/windmill-labs/windmill/commit/7d01d252b526987f8f0b86695de2f9c90de64519))
+
+
+### Bug Fixes
+
+* align collapsed conversations sidebar chat icon with the buttons above ([#11873](https://github.com/windmill-labs/windmill/issues/11873)) ([24238d4](https://github.com/windmill-labs/windmill/commit/24238d4062801558f90728b17e3d70e980c733dd))
+* align sidebar home with the header when ai sessions is off ([#11882](https://github.com/windmill-labs/windmill/issues/11882)) ([1874808](https://github.com/windmill-labs/windmill/commit/18748084705dc48994b7378217e0df1e8bfbfe3f))
+* give the agent page's API and Slack sections tabs on small screens ([#11901](https://github.com/windmill-labs/windmill/issues/11901)) ([394d345](https://github.com/windmill-labs/windmill/commit/394d345e0c8d9d7da87371e8da090d3becc77ce7))
+* keep schedule push, flow advance, wac approval and scim on one pool connection ([#11904](https://github.com/windmill-labs/windmill/issues/11904)) ([8afe060](https://github.com/windmill-labs/windmill/commit/8afe0607abd6bb689a0644916fcdc39fb7df2fe3))
+* keep the flow chat mounted when leaving the chat tab ([#11872](https://github.com/windmill-labs/windmill/issues/11872)) ([ed58996](https://github.com/windmill-labs/windmill/commit/ed589963f4d7b7d50a69cacdede443f2bb7efd18))
+* let devops users reach instance pages without a workspace ([#11876](https://github.com/windmill-labs/windmill/issues/11876)) ([a3a4fa5](https://github.com/windmill-labs/windmill/commit/a3a4fa503804eb9f031699b60e00a196d223cbe6))
+* **mcp:** escape JSON inlined in the MCP OAuth callback page ([#11880](https://github.com/windmill-labs/windmill/issues/11880)) ([5d0a8a9](https://github.com/windmill-labs/windmill/commit/5d0a8a9c15cd54032f930f8a21a0c2c3b517d60d))
+* refresh oauth tokens without holding a pool connection ([#11905](https://github.com/windmill-labs/windmill/issues/11905)) ([8ddb358](https://github.com/windmill-labs/windmill/commit/8ddb358198e834642f259197aa5f6d96bd7740d3))
+* spell the schedule pause time the way the picker writes it ([#11875](https://github.com/windmill-labs/windmill/issues/11875)) ([4186fff](https://github.com/windmill-labs/windmill/commit/4186ffff841d5905d308aa6bae8159aba3794c1c))
+* stop holding a pool connection while waiting for another ([#11902](https://github.com/windmill-labs/windmill/issues/11902)) ([2c559b4](https://github.com/windmill-labs/windmill/commit/2c559b452f38cc86fe45bcdb98574245fd2cf187))
+* write a push's runnable settings before it opens its transaction ([#11897](https://github.com/windmill-labs/windmill/issues/11897)) ([e6c8ef1](https://github.com/windmill-labs/windmill/commit/e6c8ef18a11f079083138a991543f7e273d4e511))
+
+
+### Performance Improvements
+
+* show the AI sessions composer before the chat code loads ([#11886](https://github.com/windmill-labs/windmill/issues/11886)) ([613adb5](https://github.com/windmill-labs/windmill/commit/613adb5287812cf428a74b10e1ef9362d78751b8))
+
## [1.841.0](https://github.com/windmill-labs/windmill/compare/v1.840.0...v1.841.0) (2026-10-18)
diff --git a/Dockerfile b/Dockerfile
index 79f9d05734..7d53a5a58a 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -144,6 +144,9 @@ ARG KUBECTL_VERSION=1.37.1
ARG HELM_VERSION=3.21.4
# NOTE: If changing, also change go version in workspace dependencies template at WorkspaceDependenciesEditor.svelte
ARG GO_VERSION=1.27.1
+# Pinned to the patch: an unpinned install is cached by the image build and stops picking up
+# security releases.
+ARG NODE_VERSION=24.22.1
ARG APP=/usr/src/app
ARG WITH_POWERSHELL=true
ARG WITH_KUBECTL=true
@@ -166,8 +169,12 @@ ENV UV_TOOL_DIR=/usr/local/uv
ENV PATH /usr/local/bin:/root/.local/bin:/tmp/.local/bin:$PATH
-
-RUN apt-get update \
+# The build cache keeps the apt layer while the base image digest and this line are unchanged, so
+# Debian security updates are not picked up by later builds. Bump to force a fresh apt-get upgrade;
+# bump it in docker/DockerfileSlim and docker/DockerfileSlimEe too.
+ARG APT_REFRESH=1
+RUN echo "apt refresh ${APT_REFRESH}" \
+ && apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y --no-install-recommends netbase tzdata ca-certificates wget curl jq unzip build-essential unixodbc xmlsec1 tini gnupg libargon2-1 \
&& if echo "$features" | grep -q "ee"; then apt-get install -y --no-install-recommends libsasl2-modules-gssapi-mit krb5-user; fi \
@@ -241,7 +248,7 @@ ENV PATH="${PATH}:/usr/local/go/bin"
ENV GO_PATH=/usr/local/go/bin/go
# Install UV
-RUN curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/uv/releases/download/0.13.0/uv-installer.sh | sh && mv /root/.local/bin/uv /usr/local/bin/uv
+RUN curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/uv/releases/download/0.13.4/uv-installer.sh | sh && mv /root/.local/bin/uv /usr/local/bin/uv
# Preinstall python runtimes to temp build location (will copy with world-writable perms later)
# --compile-bytecode precompiles the stdlib to .pyc so jobs don't recompile it on every run
@@ -252,8 +259,8 @@ RUN UV_CACHE_DIR=/tmp/build_cache/uv UV_PYTHON_INSTALL_DIR=/tmp/build_cache/py_r
RUN UV_CACHE_DIR=/tmp/build_cache/uv UV_PYTHON_INSTALL_DIR=/tmp/build_cache/py_runtime uv python install $NEW_INSTANCE_PY --compile-bytecode
-RUN curl -sL https://deb.nodesource.com/setup_24.x | bash -
-RUN apt-get -y update && apt-get install -y --no-install-recommends curl procps nodejs awscli && apt-get clean \
+RUN curl -sL https://deb.nodesource.com/setup_${NODE_VERSION%%.*}.x | bash -
+RUN apt-get -y update && apt-get install -y --no-install-recommends curl procps nodejs=${NODE_VERSION}-1nodesource1 awscli && apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# The npm bundled with nodejs is replaced by a pinned one: it is what `//npm` scripts install with
@@ -293,7 +300,7 @@ COPY --from=builder /windmill/target/release/windmill ${APP}/windmill
# DuckDB jobs run in this binary, which the worker looks for next to its own.
COPY --from=windmill_duckdb_ffi_internal_builder /windmill-duckdb-ffi-internal/target/release/windmill_duckdb_runner ${APP}/windmill_duckdb_runner
-COPY --from=oven/bun:1.4.0 /usr/local/bin/bun /usr/bin/bun
+COPY --from=oven/bun:1.4.4 /usr/local/bin/bun /usr/bin/bun
# Install windmill CLI
RUN bun install -g windmill-cli \
@@ -305,9 +312,6 @@ RUN bun install -g windmill-cli \
RUN curl -fsSL https://claude.ai/install.sh | bash \
&& cp /root/.local/share/claude/versions/* /usr/bin/claude
-COPY --from=php:8.3.33-cli-trixie /usr/local/bin/php /usr/bin/php
-COPY --from=composer:2.9.5 /usr/bin/composer /usr/bin/composer
-
# add the docker client to call docker from a worker if enabled
COPY --from=docker:29-dind /usr/local/bin/docker /usr/local/bin/
diff --git a/LICENSE b/LICENSE
index aea6c58c6f..7e682e7dd1 100644
--- a/LICENSE
+++ b/LICENSE
@@ -30,5 +30,18 @@ quotas set in the software and a right to distribute the community edition as is
but not to sell, resell, serve as a managed service, modify or wrap under any
form without an explicit agreement.
+To re-expose directly any Windmill parts to your users (see
+https://www.windmill.dev/docs/misc/white_labelling) as a feature of your
+product, with the exception of iframed public Windmill "apps", or to build a
+feature on top of "Windmill Community Edition" that you sell commercially or
+embed in a distributable product or binary, you must get a commercial license.
+Contact us at sales@windmill.dev if you have any questions. To do the same from
+the binary compiled from the source code in this repository without the
+"enterprise" feature flag, you must comply with the AGPLv3 license terms and
+conditions or get a commercial license from Windmill Labs, Inc.
+
+To use Windmill "Community Edition" as is internally in your organization, or to
+use its APIs as is, you do NOT need a commercial license.
+
All third party components incorporated into the Windmill Software are licensed
under the original license provided by the owner of the applicable component.
diff --git a/README.md b/README.md
index e9ed6381f1..df877e2c0f 100644
--- a/README.md
+++ b/README.md
@@ -3,10 +3,10 @@
-Open-source developer platform for internal code: APIs, background jobs, workflows and UIs. Self-hostable alternative to Retool, Pipedream, Superblocks and a simplified Temporal with autogenerated UIs and custom UIs to trigger workflows and scripts as internal apps.
+Open-source, self-hostable code-first platform for workflows, apps and AI agents, running on the fastest self-hostable orchestrator. Engineers write code in 20+ languages and sync it with Git. Business teams build on the same platform with AI, while review, promotion between environments and isolated workers keep engineers in control of what ships. Self-hostable alternative to Lovable, Retool, n8n and a simplified Temporal.
-Scripts are turned into sharable UIs automatically, and can be composed together into flows or used into richer apps built with low-code. Supported languages: Python, TypeScript, Go, Bash, SQL, GraphQL, PowerShell, Rust, and more.
+Scripts are turned into sharable UIs, APIs and cron jobs automatically, and can be composed together into flows, data pipelines, AI agents or full-code React and Svelte apps. Supported languages: Python, TypeScript, Go, Bash, SQL, GraphQL, PowerShell, Rust, and more.
@@ -34,7 +34,7 @@ Scripts are turned into sharable UIs automatically, and can be composed together
Try it - Website - Docs - Discord - Hub - Contributing
-# Windmill - Developer platform for APIs, background jobs, workflows and UIs
+# Windmill - Code-first platform for workflows, apps and AI agents
Windmill is fully open-sourced (AGPLv3) and Windmill Labs offers dedicated instances and commercial support and licenses.
@@ -42,10 +42,12 @@ Windmill is fully open-sourced (AGPLv3) and Windmill Labs offers dedicated insta
https://github.com/user-attachments/assets/d80de1d9-64de-4d89-aacd-6df23fa81fc4
-- [Windmill - Developer platform for APIs, background jobs, workflows and UIs](#windmill---developer-platform-for-apis-background-jobs-workflows-and-uis)
+- [Windmill - Code-first platform for workflows, apps and AI agents](#windmill---code-first-platform-for-workflows-apps-and-ai-agents)
+ - [Build with AI, ship with review](#build-with-ai-ship-with-review)
- [Main Concepts](#main-concepts)
- - [Show me some actual script code](#show-me-some-actual-script-code)
- - [Local Development](#local-development)
+ - [What the code looks like](#what-the-code-looks-like)
+ - [Data: data tables, DuckDB and DuckLake](#data-data-tables-duckdb-and-ducklake)
+ - [Develop locally or in the browser](#develop-locally-or-in-the-browser)
- [Stack](#stack)
- [Fastest Self-Hostable Workflow Engine](#fastest-self-hostable-workflow-engine)
- [Security](#security)
@@ -59,13 +61,21 @@ https://github.com/user-attachments/assets/d80de1d9-64de-4d89-aacd-6df23fa81fc4
- [License](#license)
- [Integrations](#integrations)
- [Environment Variables](#environment-variables)
- - [Run a local dev setup](#run-a-local-dev-setup)
- - [Frontend only](#frontend-only)
- - [Backend + Frontend](#backend--frontend)
- [Contributing](#contributing)
- - [Contributors](#contributors)
- [Copyright](#copyright)
+## Build with AI, ship with review
+
+Business teams and engineers build on the same Windmill instance. What the AI builds is an ordinary script, flow or app, and goes through the same review as code written by engineers:
+
+- [AI sessions](https://www.windmill.dev/docs/core_concepts/ai_sessions) build scripts, flows and apps with AI in a workspace fork, with a live preview and a diff to review before deploying.
+- [Workspace roles](https://www.windmill.dev/docs/core_concepts/roles_and_permissions#workspace-roles) decide what each team can author, and [folders](https://www.windmill.dev/docs/core_concepts/groups_and_folders) scope the resources, skills and MCP servers its AI can reach.
+- [Protection rulesets](https://www.windmill.dev/docs/core_concepts/protection_rulesets) block direct deployment, so changes reach production only after an engineer reviews and deploys them.
+- [Dev workspaces](https://www.windmill.dev/docs/advanced/dev_workspaces) keep their own credentials, and promote to prod through Compare & Deploy or a Git pull request.
+- [Worker groups](https://www.windmill.dev/docs/core_concepts/worker_groups) run AI-built code on its own workers, or on a [separate instance](https://www.windmill.dev/docs/core_concepts/staging_prod#deploy-to-a-workspace-on-another-instance).
+
+See [let business teams build with AI safely](https://www.windmill.dev/docs/advanced/ai_guardrails) for the full setup. Engineers keep writing code locally with the [CLI](https://www.windmill.dev/docs/advanced/cli), the [VS Code extension](https://www.windmill.dev/docs/cli_local_dev/vscode-extension) and their coding agent, synced with [Git](https://www.windmill.dev/docs/advanced/git_sync).
+
## Main Concepts
1. Define a minimal and generic script in Python, TypeScript, Go or Bash that solves a specific task. The code can be defined in the provided Web IDE or synchronized with your own GitHub repo (e.g. through VS Code extension): [provided Web IDE](https://www.windmill.dev/docs/code_editor) or [synchronized with your own GitHub repo](https://www.windmill.dev/docs/advanced/cli/sync) (e.g. through [VS Code](https://www.windmill.dev/docs/cli_local_dev/vscode-extension) extension):
@@ -90,54 +100,93 @@ Scripts and flows can be triggered by [schedules](https://www.windmill.dev/docs/
Build your entire infra on top of Windmill!
-## Show me some actual script code
+## What the code looks like
+
+A script is a plain function. Its typed arguments become a generated form, an HTTP endpoint and a CLI command:
```typescript
-//import any dependency from npm
import * as wmill from "windmill-client";
-import * as cowsay from "cowsay@1.5.0";
-
-// fill the type, or use the +Resource type to get a type-safe reference to a resource
-type Postgresql = {
- host: string;
- port: number;
- user: string;
- dbname: string;
- sslmode: string;
- password: string;
-};
+import dayjs from "dayjs"; // any npm package, resolved and pinned automatically
export async function main(
- a: number,
- b: "my" | "enum",
- c: Postgresql,
- d = "inferred type string from default arg",
- e = { nested: "object" }
- //f: wmill.Base64
+ customerId: string,
+ plan: "starter" | "pro", // a union of strings becomes a dropdown
+ trialDays = 14 // defaults infer the type
) {
- const email = process.env["WM_EMAIL"];
- // variables are permissioned and by path
- let variable = await wmill.getVariable("f/company-folder/my_secret");
- const lastTimeRun = await wmill.getState();
- // logs are printed and always inspectable
- console.log(cowsay.say({ text: "hello " + email + " " + lastTimeRun }));
- await wmill.setState(Date.now());
+ const trialEnd = dayjs().add(trialDays, "day").toISOString();
- // return is serialized as JSON
- return { foo: d, variable };
+ // a data table: the workspace's Postgres, queried without a connection string
+ const sql = wmill.datatable();
+ await sql`INSERT INTO trials (customer_id, plan, trial_end) VALUES (${customerId}, ${plan}, ${trialEnd})`.fetch();
+
+ // secrets are permissioned by path
+ const slackToken = await wmill.getVariable("f/sales/slack_token");
+ await fetch("https://slack.com/api/chat.postMessage", {
+ method: "POST",
+ headers: { Authorization: `Bearer ${slackToken}`, "Content-Type": "application/json" },
+ body: JSON.stringify({ channel: "#sales", text: `New ${plan} trial: ${customerId}` }),
+ });
+
+ console.log(`Trial started for ${customerId}`); // logs stream live in the UI
+ return { customerId, plan, trialEnd }; // returned as JSON
}
```
-## Local Development
+Workflows are code too. Each task runs as its own job with its own logs, and waiting for an approval releases the worker:
-Windmill supports multiple ways to develop locally and sync with your instance:
+```typescript
+import { task, waitForApproval, workflow } from "windmill-client";
+
+async function plan(env: string) {
+ return { env, changes: 3 };
+}
+
+async function apply(plan: { env: string; changes: number }) {
+ return `applied ${plan.changes} changes to ${plan.env}`;
+}
+
+export const main = workflow(async (env: string) => {
+ const changes = await task(plan)(env);
+ const approval = await waitForApproval({ timeout: 3600 });
+ if (!approval.approved) {
+ return `rejected by ${approval.approver}`;
+ }
+ return await task(apply)(changes);
+});
+```
+
+Flows can also be built in the visual [flow editor](https://www.windmill.dev/docs/flows/flow_editor) or as YAML, with scripts like the first one as steps. See [workflows as code](https://www.windmill.dev/docs/core_concepts/workflows_as_code).
+
+## Data: data tables, DuckDB and DuckLake
+
+- [Data tables](https://www.windmill.dev/docs/core_concepts/persistent_storage/data_tables) give each workspace managed Postgres tables, queried with type-checked SQL from TypeScript, Python and DuckDB scripts without exposing a connection string.
+- [DuckDB](https://www.windmill.dev/docs/integrations/duckdb) scripts query S3 and Azure Blob files (CSV, Parquet, JSON), data tables, Postgres, MySQL and BigQuery in SQL, on your workers.
+- [DuckLake](https://www.windmill.dev/docs/core_concepts/persistent_storage/ducklake) stores large datasets as lakehouse tables in your workspace object storage, queried in plain SQL.
+- [Pipelines](https://www.windmill.dev/docs/core_concepts/pipelines) (alpha) wire scripts by the data they read and write instead of a hand-drawn DAG. This script runs whenever `events` is materialized, and materializes its own table:
+
+```sql
+-- pipeline
+-- on ducklake://main/events
+-- materialize ducklake://main/events_by_kind
+ATTACH 'ducklake://main' AS dl;
+SELECT kind, count(*) AS n
+FROM dl.events
+GROUP BY kind;
+```
+
+Existing [dbt projects](https://www.windmill.dev/docs/getting_started/scripts_quickstart/dbt) run unmodified as scripts. See the [pipelines quickstart](https://www.windmill.dev/docs/getting_started/pipeline_quickstart).
+
+## Develop locally or in the browser
+
+Engineers work from their editor and coding agent, business teams build with AI in the browser, and both land in the same workspace:
| Tool | Description |
|------|-------------|
-| **[CLI](https://www.windmill.dev/docs/advanced/cli)** | Sync scripts from local files or GitHub, run scripts/flows from the command line |
-| **[VS Code Extension](https://www.windmill.dev/docs/cli_local_dev/vscode-extension)** | Edit and test scripts & flows directly from VS Code / Cursor with full IDE support |
-| **[Git Sync](https://www.windmill.dev/docs/advanced/git_sync)** | Two-way sync between Windmill and your Git repository |
-| **[Claude Code](https://www.windmill.dev/docs/core_concepts/ai_generation)** | AI-assisted development with Claude for scripts, flows, and apps |
+| **[CLI](https://www.windmill.dev/docs/advanced/cli)** | Sync a workspace with local files and Git, run scripts and flows from the command line. `wmill init` generates `AGENTS.md` and [skill files](https://www.windmill.dev/docs/misc/guides/local_dev_with_ai) for Claude Code, Cursor and other AI tools |
+| **[VS Code extension](https://www.windmill.dev/docs/cli_local_dev/vscode-extension)** | Edit and test scripts and flows from VS Code or Cursor with full IDE support |
+| **[Git sync](https://www.windmill.dev/docs/advanced/git_sync)** | Two-way sync between a workspace and your Git repository |
+| **[MCP server](https://www.windmill.dev/docs/core_concepts/mcp)** | Let coding agents and AI clients run scripts, manage resources and monitor jobs in a workspace |
+| **[AI sessions](https://www.windmill.dev/docs/core_concepts/ai_sessions)** | The same agent loop in the browser, with nothing to install: plan mode, skills and MCP servers, a live preview, and a diff to review before deploying, in a fork of the workspace |
https://github.com/user-attachments/assets/c541c326-e9ae-4602-a09a-1989aaded1e9
@@ -152,7 +201,8 @@ You can run scripts locally by passing the right environment variables for the `
- **Runtimes**:
- TypeScript/JavaScript: Bun (default); Deno only on the `windmill-full` images
- Python: python3 with uv for dependency management
- - Go, Bash, PowerShell, PHP, Rust, C#, Java, Ansible
+ - PHP: only on the `windmill-full` images
+ - Go, Bash, PowerShell, Rust, C#, Java, Ansible
## Fastest Self-Hostable Workflow Engine
@@ -184,11 +234,12 @@ back to the database is ~50ms. A typical lightweight deno job will take around
## Architecture
-
+Stateless API servers and workers share a PostgreSQL database that holds the job queue and all workspace state (remote agent workers go through the API servers instead). Workers pull jobs by tag, so each worker group can run in its own network, for example dev workers that only reach dev systems and prod workers that only run reviewed code.
-
-
-
+
+
+
+
## How to self-host
@@ -229,15 +280,11 @@ Configure OAuth and SSO (Google Workspace, Microsoft/Azure, Okta) directly from
### License
-The Community Edition is free to use internally. For commercial redistribution or managed services, contact . See [LICENSE](./LICENSE) and [Pricing](https://www.windmill.dev/pricing) for details.
+- Using the Community Edition as is, internally or through its APIs, is free and needs no commercial license, within the limits and quotas set in the software.
+- Selling, reselling or serving the Community Edition as a managed service, modifying or wrapping it, or re-exposing it to your users as a feature of your product (iframed public apps excepted) requires a commercial license: contact .
+- The binary built from this repository without the `enterprise` feature flag is open source under [AGPLv3](./LICENSE-AGPL): the same uses are then allowed under the AGPLv3 terms, or with a commercial license. The API clients and the OpenAPI spec are [Apache 2.0](./LICENSE-APACHE).
-The "Community Edition" of Windmill available in the docker images hosted under ghcr.io/windmill-labs/windmill and the github binary releases contains the files under the AGPLv3 and Apache 2 sources but also includes proprietary and non-public code and features which are not open source and under the following terms: Windmill Labs, Inc. grants a right to use all the features of the "Community Edition" for free without restrictions other than the limits and quotas set in the software and a right to distribute the community edition as is but not to sell, resell, serve Windmill as a managed service, modify or wrap under any form without an explicit agreement.
-
-The binary compilable from source code in this repository without the "enterprise" feature flag is open-source under the [LICENSE-AGPLv3](https://github.com/windmill-labs/windmill/blob/main/LICENSE-AGPL) License terms and conditions.
-
-To [re-expose directly any Windmill parts to your users](https://www.windmill.dev/docs/misc/white_labelling) as a feature of your product, with the exception of iframed public Windmill "apps", or to build a feature on top of "Windmill Community Edition" that you sell commercially or embed in a distributable product or binary, you must get a commercial license. Contact us at if you have any questions. To do the same from the binary compiled from the source code in this repository without the "enterprise" feature flag, you must comply with the AGPLv3 license terms and conditions or get a commercial license from Windmill Labs, Inc.
-
-To use Windmill "Community Edition" as is internally in your organization, or to use its APIs as is, you do NOT need a commercial license.
+See [LICENSE](./LICENSE) for the full terms and [Pricing](https://www.windmill.dev/pricing) for plans.
### Integrations
@@ -248,88 +295,17 @@ On self-hosted instances, you might want to import all the approved resource typ
## Environment Variables
-| Environment Variable name | Default | Description | Api Server/Worker/All |
-| ----------------------------------- | -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- |
-| DATABASE_URL | | The Postgres database url. | All |
-| WORKER_GROUP | default | The worker group the worker belongs to and get its configuration pulled from | Worker |
-| MODE | standalone | The mode if the binary. Possible values: standalone, worker, server, agent | All |
-| METRICS_ADDR | None | (ee only) The socket addr at which to expose Prometheus metrics at the /metrics path. Set to "true" to expose it on port 8001 | All |
-| JSON_FMT | false | Output the logs in json format instead of logfmt | All |
-| BASE_URL | http://localhost:8000 | The base url that is exposed publicly to access your instance. Is overriden by the instance settings if any. | Server |
-| ZOMBIE_JOB_TIMEOUT | 30 | The timeout after which a job is considered to be zombie if the worker did not send pings about processing the job (every server check for zombie jobs every 30s) | Server |
-| RESTART_ZOMBIE_JOBS | true | If true then a zombie job is restarted (in-place with the same uuid and some logs), if false the zombie job is failed | Server |
-| NATIVE_MODE | false | Enable native mode: sets NUM_WORKERS=8, rejects non-native jobs (nativets, postgresql, mysql, etc.) | Worker |
-| SLEEP_QUEUE | 50 | The number of ms to sleep in between the last check for new jobs in the DB. It is multiplied by NUM_WORKERS such that in average, for one worker instance, there is one pull every SLEEP_QUEUE ms. | Worker |
-| KEEP_JOB_DIR | false | Keep the job directory after the job is done. Useful for debugging. | Worker |
-| EXIT_AFTER_N_JOBS | None | Exit the worker process after it has executed that many jobs, so that a supervisor restarts it and no process runs more than that many, bar the steps of a same-worker flow it has started, which it always finishes (set it to 1 for a process per job; jobs handed to a dedicated worker, and the worker's own init and periodic scripts, do not count). Not counting the init and periodic scripts means they run again on every restart: an init script's runtime is added to the latency of every batch of that many jobs, and a periodic script fires once per process start whatever its interval says. The worker's shell in the workers page also starts backed off rather than after the two minutes it otherwise takes, since a process due to be recycled cannot count on living that long: the first command of a session can wait up to 15s, later ones are immediate. For deployments that isolate executions by process lifetime rather than with nsjail; note that a container restart resets the process, not the container filesystem, so caches and `/tmp` survive it. The worker name is then derived from the hostname instead of being random, so the restarted worker keeps its row in the workers list (an agent worker keeps the row but restarts its job count). Use one worker per process: workers of one process share its environment, so the first to reach the limit shuts the others down too. | Worker |
-| WORKER_SUFFIX | None | Pins the last part of the worker name, which is otherwise random, so that a restarted worker keeps its row in the workers list. Only needed when several worker processes of the same worker group run on one host, since the name is derived from the hostname: give each of them a distinct value, as two processes sharing one must never happen. At most 64 letters, digits and underscores; anything else is refused at startup. | Worker |
-| LICENSE_KEY (EE only) | None | License key checked at startup for the Enterprise Edition of Windmill | Worker |
-| SLACK_SIGNING_SECRET | None | The signing secret of your Slack app. See [Slack documentation](https://api.slack.com/authentication/verifying-requests-from-slack) | Server |
-| COOKIE_DOMAIN | None | The domain of the cookie. If not set, the cookie will be set by the browser based on the full origin | Server |
-| DENO_PATH | /usr/bin/deno | The path to the deno binary. | Worker |
-| PYTHON_PATH | | The path to the python binary if wanting to not have it managed by uv. | Worker |
-| GO_PATH | /usr/bin/go | The path to the go binary. | Worker |
-| GOPRIVATE | | The GOPRIVATE env variable to use private go modules | Worker |
-| GOPROXY | | The GOPROXY env variable to use | Worker |
-| NETRC | | The netrc content to use a private go registry | Worker |
-| PY_CONCURRENT_DOWNLOADS | 20 | Sets the maximum number of in-flight concurrent python downloads that windmill will perform at any given time. | Worker |
-| PATH | None | The path environment variable, usually inherited | Worker |
-| HOME | None | The home directory to use for Go and Bash , usually inherited | Worker |
-| DATABASE_CONNECTIONS | 50 (Server)/3 (Worker) | The max number of connections in the database connection pool | All |
-| SUPERADMIN_SECRET | None | A token that would let the caller act as a virtual superadmin superadmin@windmill.dev | Server |
-| TIMEOUT_WAIT_RESULT | 20 | The number of seconds to wait before timeout on the 'run_wait_result' endpoint | Worker |
-| QUEUE_LIMIT_WAIT_RESULT | None | The number of max jobs in the queue before rejecting immediately the request in 'run_wait_result' endpoint. Takes precedence on the query arg. If none is specified, there are no limit. | Worker |
-| DENO_AUTH_TOKENS | None | Custom DENO_AUTH_TOKENS to pass to worker to allow the use of private modules | Worker |
-| DISABLE_RESPONSE_LOGS | false | Disable response logs | Server |
-| CREATE_WORKSPACE_REQUIRE_SUPERADMIN | true | If true, only superadmins can create new workspaces | Server |
-| MIN_FREE_DISK_SPACE_MB | 15000 | Minimum amount of free space on worker. Sends critical alert if worker has less free space. | Worker |
-| RUN_UPDATE_CA_CERTIFICATE_AT_START | false | If true, runs CA certificate update command at startup before other initialization | All |
-| RUN_UPDATE_CA_CERTIFICATE_PATH | /usr/sbin/update-ca-certificates | Path to the CA certificate update command/script to run when RUN_UPDATE_CA_CERTIFICATE_AT_START is true | All |
-| GOOGLE_APPLICATION_CREDENTIALS | None | (ee only) Credentials file for GCP Pub/Sub triggers that authenticate as the instance rather than through a `gcloud` resource (workspace admins only). Application default credentials also resolve the gcloud well-known file and the GCE metadata server. Workload Identity Federation files work with the `file`, `url` and `aws` credential sources; the `executable` source is not supported. | Server |
+The variables most deployments set:
-## Run a local dev setup
+| Environment Variable name | Default | Description | Api Server/Worker/All |
+| ------------------------- | --------------------- | ------------------------------------------------------------------------------------------------------------ | --------------------- |
+| DATABASE_URL | | The Postgres database url. | All |
+| MODE | standalone | The mode of the binary: standalone, server, worker, agent (EE), indexer (EE image, full-text search), mcp | All |
+| WORKER_GROUP | default | The worker group the worker belongs to and gets its configuration pulled from | Worker |
+| BASE_URL | http://localhost:8000 | The base url that is exposed publicly to access your instance. Is overriden by the instance settings if any. | Server |
+| LICENSE_KEY (EE only) | None | License key checked at startup for the Enterprise Edition of Windmill | Worker |
-We recommend using [Nix](./frontend/README_DEV.md#nix). See [./frontend/README_DEV.md](./frontend/README_DEV.md) for all options.
-
-### Frontend only
-
-Uses the backend of with local frontend (hot-reload):
-
-```bash
-cd frontend
-npm install
-npm run generate-backend-client # or generate-backend-client-mac on Mac
-npm run dev
-```
-
-Windmill available at `http://localhost/`
-
-### Backend + Frontend
-
-See the [./frontend/README_DEV.md](./frontend/README_DEV.md) file for all
-running options.
-
-1. Start a local Postgres database using for instance the `start-dev-db.sh` script which will make a database available at `postgres://postgres:changeme@localhost:5432/windmill`
- Then run the migrations using the following command:
- ```
- cargo install sqlx-cli
- env DATABASE_URL= sqlx migrate run
- ```
- This will also avoid compile time issue with sqlx's `query!` macro.
-2. (optional, linux only) Install [nsjail](https://github.com/google/nsjail) and have it accessible in
- your PATH
-3. Install bun and python3 (+ any languages you want to use), have the bins at `/usr/bin/bun` and
- `/usr/local/bin/python3` or set the corresponding environment variables.
-4. (optional) Install the [lld linker](https://lld.llvm.org/)
-5. Go to `frontend/`:
- 1. `npm install`, `npm run generate-backend-client` then `REMOTE=http://localhost:8000 npm run dev`
- 2. You might need to set some extra heap space for the node runtime
- `export NODE_OPTIONS="--max-old-space-size=4096"`
- 3. Create an empty `frontend/build` folder using `mkdir frontend/build`
-6. Go to `backend/`:
- 1. `env DATABASE_URL= RUST_LOG=info cargo run`
- 2. You can specify any feature flag you want to enable, for example `cargo run --features python` to enable the python executor.
-7. Windmill should be available at `http://localhost:3000`
+All other variables (database pool, queue, runtimes, private registries, certificates, zombie jobs and more) are documented in the [environment variables reference](https://www.windmill.dev/docs/core_concepts/environment_variables).
## Contributing
@@ -337,11 +313,7 @@ At this time, we are not seeking outside contribution. Bug reports and feature r
welcome, and small, trivially-verified PRs that fix a problem are still accepted. See
[CONTRIBUTING.md](./CONTRIBUTING.md) for the full policy.
-## Contributors
-
-
-
-
+To run Windmill from source, see [frontend/README_DEV.md](./frontend/README_DEV.md).
## Copyright
diff --git a/ai_evals/README.md b/ai_evals/README.md
index d458e019d0..67592daee4 100644
--- a/ai_evals/README.md
+++ b/ai_evals/README.md
@@ -195,6 +195,15 @@ profile:
operatorSettings: { builder_apps: true } # also builder_flows, manage_schedules, manage_triggers
```
+A role that builds nothing (no builder rights, `manage_schedules` and `manage_triggers` both
+`false`) holds the session in Use, as the chat does in production: the toolset is the
+read-only one and the prompt carries the session section that names the role as the reason.
+
+`judgeAssistantText: true` hands the judge what the assistant said alongside the mode's
+output. Use it when the deliverable is the answer itself, such as a refusal and where to go
+instead: the `global` judge otherwise reads only the drafts, and a substring check cannot tell
+"you can't create it yourself" from "create it yourself".
+
`toolExpect.toolCallArgs` entries support `sharedByAtLeast: `: at least `n` recorded
calls to that tool must carry the same non-blank string in the field. Use it for calls that
have to share an identifier, like two test runs of one chat conversation.
diff --git a/ai_evals/adapters/frontend/core/global/globalEvalRunner.ts b/ai_evals/adapters/frontend/core/global/globalEvalRunner.ts
index e70dbfcfe5..c648848387 100644
--- a/ai_evals/adapters/frontend/core/global/globalEvalRunner.ts
+++ b/ai_evals/adapters/frontend/core/global/globalEvalRunner.ts
@@ -5,9 +5,17 @@ import type { ChatCompletionMessageParam } from "openai/resources/chat/completio
import type { AIProvider, OperatorSettings } from "$lib/gen/types.gen";
import {
globalToolsFor,
- prepareGlobalSystemMessage,
prepareGlobalUserMessage,
} from "../../../../../frontend/src/lib/components/copilot/chat/global/core";
+import { assembleGlobalSystemMessage } from "../../../../../frontend/src/lib/components/copilot/chat/global/globalAssembly";
+import {
+ canBuild,
+ USE_MODE_ACCESS,
+} from "../../../../../frontend/src/lib/components/copilot/chat/sessionCapabilities";
+import {
+ FULL_CAPABILITIES,
+ legacyOperatorCapabilities,
+} from "../../../../../frontend/src/lib/roleCapabilities";
import {
clearGlobalDrafts,
getGlobalDraft,
@@ -155,15 +163,24 @@ export async function runGlobalEval(
options.workspaceFixtures ?? {},
);
seedLiveEditorDrafts(workspaceRoot, options.liveEditorDrafts ?? []);
- // No deploy rules in the mock workspace, so they always pass.
- const access =
+ // No deploy rules in the mock workspace, so they always pass. The role is read as a server
+ // that predates workspace roles describes it, from `operator_settings`.
+ const roleAccess =
options.profile &&
capabilitiesForRole({
isAdmin: false,
- operator: options.profile.operator,
deployRulesPass: true,
- operatorSettings: options.profile.operatorSettings as OperatorSettings,
+ capabilities: options.profile.operator
+ ? legacyOperatorCapabilities(
+ options.profile.operatorSettings as OperatorSettings,
+ )
+ : FULL_CAPABILITIES,
});
+ // A session whose role builds nothing is held in Use, as the chat manager holds it: the
+ // read-only toolset, and the session section that names the role as the reason.
+ const heldInUse =
+ !!options.sessionChat && !!roleAccess && !canBuild(roleAccess);
+ const access = heldInUse ? USE_MODE_ACCESS : roleAccess;
seedOperatorSettings(workspaceRoot, options.profile);
// Declared out here only so `finally` can reach it; a malformed fixture throws while
// building it, and everything seeded above still has to be torn down.
@@ -179,7 +196,7 @@ export async function runGlobalEval(
);
}
// Production resolves a profile for session chats only; elsewhere every tool ships.
- if (!options.sessionChat && access) {
+ if (!options.sessionChat && roleAccess) {
throw new Error(
"This case sets runtime.profile, which only a session chat applies — set runtime.sessionChat: true on the case.",
);
@@ -203,10 +220,13 @@ export async function runGlobalEval(
: undefined;
// Pass the seeded identity straight to the prompt builder rather than mutating
// the process-global `userStore`, so concurrent cases never race on it.
- const baseSystemMessage = prepareGlobalSystemMessage(undefined, {
+ const baseSystemMessage = assembleGlobalSystemMessage(undefined, {
user: options.user,
previewTools: options.sessionChat ?? false,
access,
+ ...(heldInUse && {
+ sessionContext: { workspaceId: workspaceRoot, useMode: "role" as const },
+ }),
});
const helpers = {
...evalArtifacts.helpers,
diff --git a/ai_evals/adapters/frontend/mockBackend.ts b/ai_evals/adapters/frontend/mockBackend.ts
index 69398555f0..1de463690b 100644
--- a/ai_evals/adapters/frontend/mockBackend.ts
+++ b/ai_evals/adapters/frontend/mockBackend.ts
@@ -11,8 +11,13 @@ import type {
ListableApp,
ListableResource,
ListableVariable,
+ Folder,
+ Group,
+ QueuedJob,
Resource,
- Script
+ Schedule,
+ Script,
+ WorkerPing
} from '../../../frontend/src/lib/gen'
import type {
DataMetric,
@@ -97,6 +102,14 @@ export interface BenchmarkWorkspaceResource {
resource_type: string
value?: Record
description?: string
+ /** A database's tables, as `get_db_schema` reads them: schema, table, then column. */
+ dbSchema?: Record>>
+}
+
+export interface BenchmarkDbColumn {
+ type: string
+ required: boolean
+ default?: string
}
/** A resource type the instance holds. */
@@ -117,6 +130,48 @@ export interface BenchmarkWorkspaceJob {
logs?: string
args?: Record
result?: unknown
+ /** Defaults to `completed`. `suspended` is a running flow parked on an approval step. */
+ state?: 'completed' | 'queued' | 'running' | 'suspended'
+ tag?: string
+ schedulePath?: string
+ /** When the run was created, relative to the case start. Unset = now. */
+ createdMinutesAgo?: number
+ /** Completed runs only: how long the run took. */
+ durationMs?: number
+}
+
+/** A worker of the instance, as `list_workers` reports it. */
+export interface BenchmarkWorkspaceWorker {
+ worker: string
+ worker_group: string
+ custom_tags?: string[]
+ lastPingSecondsAgo?: number
+ jobs_executed?: number
+}
+
+/** A folder of the benchmark workspace, as `read_workspace_item` reads it. */
+export interface BenchmarkWorkspaceFolder {
+ name: string
+ summary?: string
+ owners?: string[]
+ /** Who else may use the folder, as `u/` or `g/`: `true` grants write. */
+ extra_perms?: Record
+}
+
+export interface BenchmarkWorkspaceGroup {
+ name: string
+ summary?: string
+ members?: string[]
+}
+
+export interface BenchmarkWorkspaceSchedule {
+ path: string
+ /** Six-field cron. */
+ schedule: string
+ script_path: string
+ is_flow?: boolean
+ enabled?: boolean
+ summary?: string
}
export interface BenchmarkWorkspaceRunnables {
@@ -133,15 +188,28 @@ export interface BenchmarkWorkspaceRunnables {
ducklakes?: string[]
dataMetrics?: DataMetric[]
jobs?: BenchmarkWorkspaceJob[]
+ /** The instance's workers. Unset falls through to the real backend's; `[]` is none. */
+ workers?: BenchmarkWorkspaceWorker[]
+ schedules?: BenchmarkWorkspaceSchedule[]
+ folders?: BenchmarkWorkspaceFolder[]
+ groups?: BenchmarkWorkspaceGroup[]
+ /** The workspace settings document (`get_workspace_settings` reads it). */
+ workspaceSettings?: Record
}
type BenchmarkCompletedJob = CompletedJob & { type: 'CompletedJob' }
+type BenchmarkQueuedJob = QueuedJob & { type: 'QueuedJob' }
const benchmarkWorkspaces = new Set()
const benchmarkWorkspaceRunnables = new Map()
// Keyed by `${workspace}::${jobId}` so concurrent attempts (or distinct cases)
// can seed the same fixed job id without clobbering each other's entry.
-const benchmarkJobs = new Map()
+const benchmarkJobs = new Map<
+ string,
+ { workspace: string; job: BenchmarkCompletedJob | BenchmarkQueuedJob }
+>()
+// What set_workspace_settings applied, per workspace, so get_workspace_settings reads it back.
+const benchmarkWorkspaceSettings = new Map>()
function benchmarkJobKey(workspace: string, jobId: string): string {
return `${workspace}::${jobId}`
@@ -152,11 +220,12 @@ export function resetBenchmarkMockBackend(): void {
benchmarkWorkspaceRunnables.clear()
benchmarkJobs.clear()
benchmarkDrafts.clear()
+ benchmarkWorkspaceSettings.clear()
}
// Stand-in for FolderService.createFolder so the global create_folder tool runs in
-// memory instead of mutating the real backend. Folders aren't otherwise modelled
-// (no folder-listing in evals), so this just echoes the created name.
+// memory instead of mutating the real backend. It echoes the name without adding the
+// folder to the fixture folders that `listBenchmarkFolders` reads.
export function createBenchmarkFolder(_workspace: string, name: string): string {
return name
}
@@ -180,6 +249,14 @@ export function registerBenchmarkWorkspaceRunnables(
})
// Seed any fixture jobs so list_runs / get_run have data to return.
for (const seed of runnables.jobs ?? []) {
+ const createdAt =
+ seed.createdMinutesAgo === undefined
+ ? undefined
+ : new Date(Date.now() - seed.createdMinutesAgo * 60_000).toISOString()
+ if (seed.state && seed.state !== 'completed') {
+ createBenchmarkQueuedJob(workspace, seed, createdAt)
+ continue
+ }
createBenchmarkCompletedJob({
workspace,
id: seed.id,
@@ -190,14 +267,24 @@ export function registerBenchmarkWorkspaceRunnables(
label: seed.label,
logs: seed.logs,
args: seed.args,
- result: seed.result
+ result: seed.result,
+ tag: seed.tag,
+ schedulePath: seed.schedulePath,
+ createdAt,
+ durationMs: seed.durationMs
})
}
+ if (runnables.workspaceSettings) {
+ benchmarkWorkspaceSettings.set(workspace, structuredClone(runnables.workspaceSettings))
+ } else {
+ benchmarkWorkspaceSettings.delete(workspace)
+ }
}
export function unregisterBenchmarkWorkspace(workspace: string): void {
benchmarkWorkspaces.delete(workspace)
benchmarkWorkspaceRunnables.delete(workspace)
+ benchmarkWorkspaceSettings.delete(workspace)
clearBenchmarkDrafts(workspace)
for (const [jobId, entry] of benchmarkJobs.entries()) {
if (entry.workspace === workspace) {
@@ -389,6 +476,15 @@ export function queryBenchmarkResourceTypes(
.slice(0, limit)
}
+/** The tables a fixture seeds for a database resource; `null` when it seeds none. */
+export function getBenchmarkDbSchemaSeed(
+ workspace: string,
+ path: string
+): { resourceType: string; schema: NonNullable } | null {
+ const seed = benchmarkWorkspaceRunnables.get(workspace)?.resources?.find((r) => r.path === path)
+ return seed?.dbSchema ? { resourceType: seed.resource_type, schema: seed.dbSchema } : null
+}
+
/** A seeded resource with its value, as `ResourceService.getResource` returns it. Covers both
* seed kinds, so it agrees with `existsResource` and `listResource` — both of those report AI
* providers too, and a case that lists resources and then reads one by path would otherwise get
@@ -481,18 +577,24 @@ export function createBenchmarkCompletedJob(input: {
id?: string
createdBy?: string
label?: string
+ tag?: string
+ schedulePath?: string
+ createdAt?: string
+ durationMs?: number
}): string {
const jobId = input.id ?? `benchmark-job-${randomUUID()}`
- const now = new Date().toISOString()
+ const createdAt = input.createdAt ?? new Date().toISOString()
+ const durationMs = input.durationMs ?? 0
const job: BenchmarkCompletedJob = {
type: 'CompletedJob',
id: jobId,
workspace_id: input.workspace,
created_by: input.createdBy ?? 'ai-evals',
- created_at: now,
- started_at: now,
- completed_at: now,
- duration_ms: 0,
+ created_at: createdAt,
+ started_at: createdAt,
+ completed_at: new Date(Date.parse(createdAt) + durationMs).toISOString(),
+ duration_ms: durationMs,
+ schedule_path: input.schedulePath,
success: input.success ?? true,
script_path: input.scriptPath,
script_hash: input.scriptHash,
@@ -506,7 +608,7 @@ export function createBenchmarkCompletedJob(input: {
is_skipped: false,
email: 'ai-evals@local',
visible_to_owner: true,
- tag: 'benchmark',
+ tag: input.tag ?? 'benchmark',
labels: input.label ? [input.label] : undefined
}
@@ -517,17 +619,58 @@ export function createBenchmarkCompletedJob(input: {
return jobId
}
+/** A run still in the queue: waiting for a worker, running, or a flow parked on an
+ * approval step (running with a suspend outstanding, as the backend reports it). */
+function createBenchmarkQueuedJob(
+ workspace: string,
+ seed: BenchmarkWorkspaceJob,
+ createdAt = new Date().toISOString()
+): string {
+ const jobId = seed.id ?? `benchmark-job-${randomUUID()}`
+ const started = seed.state === 'running' || seed.state === 'suspended'
+ const job: BenchmarkQueuedJob = {
+ type: 'QueuedJob',
+ id: jobId,
+ workspace_id: workspace,
+ created_by: seed.createdBy ?? 'ai-evals',
+ created_at: createdAt,
+ scheduled_for: createdAt,
+ started_at: started ? createdAt : undefined,
+ running: started,
+ suspend: seed.state === 'suspended' ? 1 : undefined,
+ script_path: seed.scriptPath,
+ schedule_path: seed.schedulePath,
+ args: seed.args,
+ logs: seed.logs,
+ canceled: false,
+ job_kind: seed.jobKind ?? 'script',
+ permissioned_as: 'u/ai-evals',
+ is_flow_step: false,
+ email: 'ai-evals@local',
+ visible_to_owner: true,
+ tag: seed.tag ?? 'benchmark'
+ }
+ benchmarkJobs.set(benchmarkJobKey(workspace, jobId), { workspace, job })
+ return jobId
+}
+
export function getBenchmarkCompletedJob(
workspace: string,
jobId: string
): BenchmarkCompletedJob | null {
const entry = benchmarkJobs.get(benchmarkJobKey(workspace, jobId))
- if (!entry) {
+ if (!entry || entry.job.type !== 'CompletedJob') {
return null
}
return structuredClone(entry.job)
}
+/** Any seeded run, finished or not, as `JobService.getJob` returns it. */
+export function getBenchmarkJob(workspace: string, jobId: string): Job | null {
+ const entry = benchmarkJobs.get(benchmarkJobKey(workspace, jobId))
+ return entry ? (structuredClone(entry.job) as Job) : null
+}
+
/**
* List seeded/recorded jobs for a benchmark workspace, most recent first —
* the shape `JobService.listJobs` returns. Returns `null` for a non-benchmark
@@ -550,7 +693,7 @@ export function listBenchmarkJobs(workspace: string): Job[] | null {
* "not found" error for an unknown id, matching the backend 404.
*/
export function getBenchmarkJobLogs(workspace: string, jobId: string): string {
- const job = getBenchmarkCompletedJob(workspace, jobId)
+ const job = getBenchmarkJob(workspace, jobId)
if (!job) {
throw new Error(`Job Logs not found for "${jobId}"`)
}
@@ -562,7 +705,7 @@ export function getBenchmarkJobLogs(workspace: string, jobId: string): string {
* tree. Fixture jobs are single runs with no steps, so only the root entry.
*/
export function getBenchmarkFlowAllResults(workspace: string, jobId: string) {
- const job = getBenchmarkCompletedJob(workspace, jobId)
+ const job = getBenchmarkJob(workspace, jobId)
if (!job) {
throw new Error(`Job "${jobId}" not found in benchmark workspace`)
}
@@ -575,8 +718,9 @@ export function getBenchmarkFlowAllResults(workspace: string, jobId: string) {
depth: 0,
sibling_index: 1,
sibling_count: 1,
- status: job.success ? 'success' : 'failure',
- success: job.success
+ ...('success' in job
+ ? { status: job.success ? 'success' : 'failure', success: job.success }
+ : { status: job.suspend ? 'suspended' : job.running ? 'running' : 'queued' })
}
],
truncated: false,
@@ -584,6 +728,156 @@ export function getBenchmarkFlowAllResults(workspace: string, jobId: string) {
}
}
+// ============= Workers, schedules =============
+
+/** Mirror `WorkerService.listWorkers`; `null` when no case seeded workers. Workers name no
+ * workspace, so this answers from whichever case seeded them: run cases whose worker seeds
+ * differ one at a time. */
+export function listBenchmarkWorkers(): WorkerPing[] | null {
+ let workers: BenchmarkWorkspaceWorker[] | undefined
+ for (const workspace of benchmarkWorkspaces) {
+ workers ??= benchmarkWorkspaceRunnables.get(workspace)?.workers
+ }
+ if (!workers) return null
+ return workers.map((w) => ({
+ worker: w.worker,
+ worker_instance: `${w.worker}-instance`,
+ worker_group: w.worker_group,
+ custom_tags: w.custom_tags,
+ last_ping: w.lastPingSecondsAgo ?? 2,
+ started_at: BENCHMARK_TIMESTAMP,
+ ip: '10.0.0.1',
+ jobs_executed: w.jobs_executed ?? 0,
+ wm_version: 'benchmark'
+ }))
+}
+
+function buildBenchmarkSchedule(workspace: string, s: BenchmarkWorkspaceSchedule): Schedule {
+ return {
+ path: s.path,
+ edited_by: 'benchmark',
+ edited_at: BENCHMARK_TIMESTAMP,
+ schedule: s.schedule,
+ timezone: 'Etc/UTC',
+ enabled: s.enabled ?? true,
+ script_path: s.script_path,
+ is_flow: s.is_flow ?? false,
+ extra_perms: {},
+ email: 'ai-evals@local',
+ summary: s.summary,
+ workspace_id: workspace
+ } as unknown as Schedule
+}
+
+export function listBenchmarkSchedules(workspace: string): Schedule[] {
+ return (benchmarkWorkspaceRunnables.get(workspace)?.schedules ?? []).map((s) =>
+ buildBenchmarkSchedule(workspace, s)
+ )
+}
+
+export function getBenchmarkSchedule(workspace: string, path: string): Schedule | null {
+ const s = benchmarkWorkspaceRunnables.get(workspace)?.schedules?.find((e) => e.path === path)
+ return s ? buildBenchmarkSchedule(workspace, s) : null
+}
+
+// ============= Folders, groups, workspace settings =============
+
+function buildBenchmarkFolder(workspace: string, f: BenchmarkWorkspaceFolder): Folder {
+ return {
+ workspace_id: workspace,
+ name: f.name,
+ summary: f.summary,
+ owners: f.owners ?? [],
+ extra_perms: f.extra_perms ?? {}
+ } as Folder
+}
+
+export function listBenchmarkFolders(workspace: string): Folder[] {
+ return (benchmarkWorkspaceRunnables.get(workspace)?.folders ?? []).map((f) =>
+ buildBenchmarkFolder(workspace, f)
+ )
+}
+
+export function getBenchmarkFolder(workspace: string, name: string): Folder | null {
+ const f = benchmarkWorkspaceRunnables.get(workspace)?.folders?.find((e) => e.name === name)
+ return f ? buildBenchmarkFolder(workspace, f) : null
+}
+
+export function listBenchmarkGroups(workspace: string): Group[] {
+ return (benchmarkWorkspaceRunnables.get(workspace)?.groups ?? []).flatMap((g) => {
+ const group = getBenchmarkGroup(workspace, g.name)
+ return group ? [group] : []
+ })
+}
+
+export function getBenchmarkGroup(workspace: string, name: string): Group | null {
+ const g = benchmarkWorkspaceRunnables.get(workspace)?.groups?.find((e) => e.name === name)
+ return g
+ ? ({
+ workspace_id: workspace,
+ name: g.name,
+ summary: g.summary,
+ members: g.members ?? [],
+ extra_perms: {}
+ } as Group)
+ : null
+}
+
+const DATA_TABLE_DATABASE_TYPES = ['postgresql', 'instance', 'external_instance']
+
+/** Refuse a data table entry the backend's `DataTableDatabase` would not deserialize. */
+function assertBenchmarkDataTables(value: unknown): void {
+ if (value === undefined || value === null) return
+ const datatables = (value as { datatables?: Record }).datatables ?? {}
+ for (const [name, entry] of Object.entries(datatables)) {
+ const { database, reference } = (entry ?? {}) as {
+ database?: { resource_type?: unknown; resource_path?: unknown }
+ reference?: unknown
+ }
+ // A fork's pointer at its parent's entry owns no database.
+ if (reference && !database) continue
+ if (!DATA_TABLE_DATABASE_TYPES.includes(String(database?.resource_type))) {
+ throw new Error(
+ `datatable.datatables.${name}.database.resource_type must be one of ${DATA_TABLE_DATABASE_TYPES.join(', ')}`
+ )
+ }
+ if (typeof database?.resource_path !== 'string' || database.resource_path === '') {
+ throw new Error(`datatable.datatables.${name}.database.resource_path is required`)
+ }
+ }
+}
+
+/** Mirror `WorkspaceService.getWorkspaceSettingsDocument`; an unseeded workspace has an
+ * empty document. */
+export function getBenchmarkWorkspaceSettingsDocument(workspace: string): Record {
+ return structuredClone(benchmarkWorkspaceSettings.get(workspace) ?? {})
+}
+
+/** Mirror `WorkspaceService.applyWorkspaceSettingsDocument` for a partial document: each
+ * top-level key replaces the stored one, `null` clears it. */
+export function applyBenchmarkWorkspaceSettingsDocument(input: {
+ workspace: string
+ requestBody: { document: Record; dry_run?: boolean }
+}): {
+ changes: Array<{ key: string; before: unknown; after: unknown }>
+ applied: boolean
+} {
+ assertBenchmarkDataTables(input.requestBody.document.datatable)
+ const current = benchmarkWorkspaceSettings.get(input.workspace) ?? {}
+ const changes = Object.entries(input.requestBody.document)
+ .filter(([key, after]) => JSON.stringify(current[key] ?? null) !== JSON.stringify(after ?? null))
+ .map(([key, after]) => ({ key, before: current[key] ?? null, after: after ?? null }))
+ if (!input.requestBody.dry_run) {
+ const next = { ...current }
+ for (const { key, after } of changes) {
+ if (after === null) delete next[key]
+ else next[key] = structuredClone(after)
+ }
+ benchmarkWorkspaceSettings.set(input.workspace, next)
+ }
+ return { changes, applied: !input.requestBody.dry_run }
+}
+
// ============= Drafts (per-user, DB-backed in production) =============
/**
diff --git a/ai_evals/adapters/frontend/vitestAdapter.test.ts b/ai_evals/adapters/frontend/vitestAdapter.test.ts
index b24ccbe5e4..754de224ac 100644
--- a/ai_evals/adapters/frontend/vitestAdapter.test.ts
+++ b/ai_evals/adapters/frontend/vitestAdapter.test.ts
@@ -85,12 +85,52 @@ vi.mock('@codingame/monaco-vscode-languages-service-override', () => ({
vi.mock('$lib/components/vscode', () => ({}))
+// get_db_schema reads a database's tables by running a query job; a benchmark database
+// answers with the tables its fixture seeds instead.
+vi.mock('$lib/components/apps/components/display/dbtable/metadata', async () => {
+ const actual = await vi.importActual(
+ '$lib/components/apps/components/display/dbtable/metadata'
+ )
+ const { getBenchmarkDbSchemaSeed } = await import('./mockBackend')
+ const { stringifySchema } = await import('$lib/components/copilot/lib')
+ const { resourceTypeToLang } = await import(
+ '$lib/components/apps/components/display/dbtable/utils'
+ )
+ return {
+ ...actual,
+ getDbSchemas: async (
+ resourceType: string,
+ resourcePath: string,
+ workspace: string | undefined,
+ ...rest: unknown[]
+ ) => {
+ const seed = workspace ? getBenchmarkDbSchemaSeed(workspace, resourcePath) : null
+ if (!seed) return actual.getDbSchemas(resourceType, resourcePath, workspace, ...rest)
+ const dbSchema = {
+ lang: resourceTypeToLang(seed.resourceType),
+ schema: seed.schema,
+ publicOnly: !!seed.schema.public
+ }
+ return { ...dbSchema, stringified: stringifySchema(dbSchema) }
+ }
+ }
+})
+
vi.mock('$lib/gen', async () => {
const actual = await vi.importActual('$lib/gen')
const {
getBenchmarkAppByPath,
- getBenchmarkCompletedJob,
+ getBenchmarkJob,
getBenchmarkCompletedJobResultMaybe,
+ listBenchmarkWorkers,
+ listBenchmarkSchedules,
+ getBenchmarkSchedule,
+ listBenchmarkFolders,
+ getBenchmarkFolder,
+ getBenchmarkGroup,
+ listBenchmarkGroups,
+ getBenchmarkWorkspaceSettingsDocument,
+ applyBenchmarkWorkspaceSettingsDocument,
getBenchmarkDatatableSchema,
getBenchmarkDatatableMigrationsStatus,
createBenchmarkDatatableMigration,
@@ -175,7 +215,29 @@ vi.mock('$lib/gen', async () => {
createFolder: async (data: { workspace: string; requestBody: { name: string } }) =>
hasBenchmarkWorkspace(data.workspace)
? createBenchmarkFolder(data.workspace, data.requestBody.name)
- : actual.FolderService.createFolder(data)
+ : actual.FolderService.createFolder(data),
+ listFolders: async (data: { workspace: string }) =>
+ hasBenchmarkWorkspace(data.workspace)
+ ? listBenchmarkFolders(data.workspace)
+ : actual.FolderService.listFolders(data),
+ getFolder: async (data: { workspace: string; name: string }) => {
+ if (!hasBenchmarkWorkspace(data.workspace)) return actual.FolderService.getFolder(data)
+ const folder = getBenchmarkFolder(data.workspace, data.name)
+ if (!folder) throw new Error(`Folder "${data.name}" not found in benchmark workspace`)
+ return folder
+ }
+ }),
+ GroupService: wrapService(actual.GroupService, {
+ listGroups: async (data: { workspace: string }) =>
+ hasBenchmarkWorkspace(data.workspace)
+ ? listBenchmarkGroups(data.workspace)
+ : actual.GroupService.listGroups(data),
+ getGroup: async (data: { workspace: string; name: string }) => {
+ if (!hasBenchmarkWorkspace(data.workspace)) return actual.GroupService.getGroup(data)
+ const group = getBenchmarkGroup(data.workspace, data.name)
+ if (!group) throw new Error(`Group "${data.name}" not found in benchmark workspace`)
+ return group
+ }
}),
ScriptService: wrapService(actual.ScriptService, {
listScripts: async (data: { workspace: string }) =>
@@ -357,7 +419,7 @@ vi.mock('$lib/gen', async () => {
: actual.JobService.runFlowByPath(data),
getJob: async (data: { workspace: string; id: string }) => {
if (hasBenchmarkWorkspace(data.workspace)) {
- const job = getBenchmarkCompletedJob(data.workspace, data.id)
+ const job = getBenchmarkJob(data.workspace, data.id)
if (!job) {
throw new Error(`Job "${data.id}" not found in benchmark workspace`)
}
@@ -383,6 +445,14 @@ vi.mock('$lib/gen', async () => {
: actual.JobService.getFlowAllResults(data)
}),
WorkspaceService: wrapService(actual.WorkspaceService, {
+ getWorkspaceSettingsDocument: async (data: { workspace: string }) =>
+ hasBenchmarkWorkspace(data.workspace)
+ ? getBenchmarkWorkspaceSettingsDocument(data.workspace)
+ : actual.WorkspaceService.getWorkspaceSettingsDocument(data),
+ applyWorkspaceSettingsDocument: async (data: any) =>
+ hasBenchmarkWorkspace(data.workspace)
+ ? applyBenchmarkWorkspaceSettingsDocument(data)
+ : actual.WorkspaceService.applyWorkspaceSettingsDocument(data),
getCopilotInfo: async (data: { workspace: string }) =>
hasBenchmarkWorkspace(data.workspace)
? (getBenchmarkAiConfig(data.workspace) ?? {})
@@ -436,13 +506,21 @@ vi.mock('$lib/gen', async () => {
? { metrics: listBenchmarkDataMetrics(data.workspace) ?? [] }
: actual.DataMetricService.listDataMetrics(data)
}),
+ WorkerService: wrapService(actual.WorkerService, {
+ listWorkers: async (data: Record) =>
+ listBenchmarkWorkers() ?? actual.WorkerService.listWorkers(data)
+ }),
ScheduleService: wrapService(actual.ScheduleService, {
existsSchedule: async (data: { workspace: string; path: string }) =>
hasBenchmarkWorkspace(data.workspace) ? false : actual.ScheduleService.existsSchedule(data),
listSchedules: async (data: { workspace: string }) =>
- hasBenchmarkWorkspace(data.workspace) ? [] : actual.ScheduleService.listSchedules(data),
+ hasBenchmarkWorkspace(data.workspace)
+ ? listBenchmarkSchedules(data.workspace)
+ : actual.ScheduleService.listSchedules(data),
getSchedule: async (data: { workspace: string; path: string }) => {
if (hasBenchmarkWorkspace(data.workspace)) {
+ const schedule = getBenchmarkSchedule(data.workspace, data.path)
+ if (schedule) return schedule
throw new Error(`Schedule "${data.path}" not found in benchmark workspace`)
}
return actual.ScheduleService.getSchedule(data)
diff --git a/ai_evals/cases/global.yaml b/ai_evals/cases/global.yaml
index 136f125e59..f0df4ae6e3 100644
--- a/ai_evals/cases/global.yaml
+++ b/ai_evals/cases/global.yaml
@@ -3231,6 +3231,33 @@
- - admin
skipJudge: true
+# A role with schedules and triggers withdrawn builds nothing, which holds the session in Use.
+# Its user cannot create a script by hand either, so the way forward is an admin, not steps.
+- id: global-use-role-script-goes-to-admin
+ prompt: |-
+ Write a Python script that checks whether https://status.example.com is up and returns
+ true or false.
+ initial: ai_evals/fixtures/frontend/global/initial/operator_ops_scripts.json
+ runtime:
+ maxTurns: 6
+ sessionChat: true
+ profile:
+ operator: true
+ operatorSettings:
+ manage_schedules: false
+ manage_triggers: false
+ validate:
+ draftCountExactly: 0
+ assistantExpect:
+ requiredMentionsAnyOf:
+ - - admin
+ judgeAssistantText: true
+ judgeChecklist:
+ - the reply puts the refusal on the user's role in this workspace, not only on this session or its mode
+ - the reply suggests asking a workspace admin, who can create the script or give the role more rights
+ - the reply does not tell or invite the user to create the script themselves with the role they have now, with steps or with code offered for them to paste in; code offered for an admin to add, or saying they could once an admin grants their role more, is fine
+ - the reply does not suggest switching this session to Use & build or Plan; saying a role with more rights could build is fine
+
# An agent from the Agents page is an `ai_agent` resource. Asked about one by name, the model
# has to read it as a resource rather than look for a flow or script of that name.
- id: global-agent-read-as-resource
@@ -3283,3 +3310,626 @@
- Agents page
- agent editor
skipJudge: true
+
+# --- Composer suggestions ---
+# The prompts the pills under Home's composer put in the box
+# (frontend/src/lib/components/copilot/chat/starter/composerSuggestions.ts), word for word.
+# A pill is only worth offering if the session chat can act on its prompt, so each one is
+# pinned here against a workspace where the prompt has something to find.
+
+- id: global-composer-run-queue
+ prompt: |-
+ Is anything stuck in this workspace's queue? Which jobs are waiting or suspended, and why?
+ initial: ai_evals/fixtures/frontend/global/initial/composer_incidents.json
+ runtime:
+ maxTurns: 10
+ sessionChat: true
+ validate:
+ draftCountExactly: 0
+ toolExpect:
+ requiredToolsUsed:
+ - list_runs
+ - list_workers
+ forbiddenToolsUsed:
+ - deploy_workspace_item
+ - delete_workspace_item
+ assistantExpect:
+ requiredMentionsAnyOf:
+ - - gpu-renderer
+ - - refund_approval
+ - approval
+ - approve
+ skipJudge: true
+ judgeChecklist:
+ - finds the 12 gpu_render runs queued on the gpu-renderer tag that no connected worker serves
+ - finds the refund_approval flow suspended on its approval step, and says approving it unblocks it
+
+- id: global-composer-worker-health
+ prompt: |-
+ Are the workers healthy and keeping up with the queue? Compare how long jobs wait before they start with how busy each worker group is.
+ initial: ai_evals/fixtures/frontend/global/initial/composer_incidents.json
+ runtime:
+ maxTurns: 10
+ sessionChat: true
+ validate:
+ draftCountExactly: 0
+ toolExpect:
+ requiredToolsUsed:
+ - list_workers
+ - list_runs
+ forbiddenToolsUsed:
+ - deploy_workspace_item
+ - delete_workspace_item
+ assistantExpect:
+ requiredMentionsAnyOf:
+ - - gpu-renderer
+ skipJudge: true
+ judgeChecklist:
+ - reads the connected workers and the queued runs instead of guessing
+ - points out that the gpu-renderer runs wait because no worker serves that tag
+
+- id: global-composer-schedules
+ prompt: |-
+ Do any schedules in this workspace keep failing? If so, which ones and why?
+ initial: ai_evals/fixtures/frontend/global/initial/composer_incidents.json
+ runtime:
+ maxTurns: 10
+ sessionChat: true
+ validate:
+ draftCountExactly: 0
+ toolExpect:
+ requiredToolsUsed:
+ - list_runs
+ forbiddenToolsUsed:
+ - deploy_workspace_item
+ - delete_workspace_item
+ assistantExpect:
+ requiredMentionsAnyOf:
+ - - charge_cards_every_minute
+ - - insufficient funds
+ - declined
+ skipJudge: true
+ judgeChecklist:
+ - names f/billing/charge_cards_every_minute as the failing schedule, not import_orders_hourly
+ - gives the cause from its runs' logs (card declined, insufficient funds)
+
+- id: global-composer-recent-runs
+ prompt: |-
+ Look at the recent runs in this workspace: did any fail, and why? Is anything getting slower?
+ initial: ai_evals/fixtures/frontend/global/initial/composer_incidents.json
+ runtime:
+ maxTurns: 8
+ sessionChat: true
+ validate:
+ draftCountExactly: 0
+ toolExpect:
+ requiredToolsUsed:
+ - list_runs
+ forbiddenToolsUsed:
+ - deploy_workspace_item
+ - delete_workspace_item
+ assistantExpect:
+ requiredMentionsAnyOf:
+ - - charge_cards
+ - - insufficient funds
+ - declined
+ skipJudge: true
+ judgeChecklist:
+ - names charge_cards as the failing script and gives the cause from its logs
+ - does not invent a slowdown the run durations do not show
+
+# The empty-workspace examples, sent as the composer sends them. The workspace holds nothing,
+# so the model has to stage what it needs; one answer covers a question about the Slack setup.
+- id: global-composer-example-daily-metrics
+ prompt: |-
+ Every weekday at 9am, query postgres for yesterday's signups and revenue and post a summary to the #metrics Slack channel
+ initial: ai_evals/fixtures/frontend/global/initial/user_admin_empty.json
+ runtime:
+ maxTurns: 16
+ sessionChat: true
+ userAnswers:
+ - Use placeholders for the postgres and Slack connections, I'll fill them in later
+ validate:
+ draftCountAtLeast: 1
+ toolExpect:
+ forbiddenToolsUsed:
+ - deploy_workspace_item
+ - delete_workspace_item
+ judgeChecklist:
+ - stages a script or flow that queries postgres for the previous day's signups and revenue
+ - posts the summary to the #metrics Slack channel
+ - runs it on a schedule at 9am on weekdays only
+
+- id: global-composer-example-refund-approval
+ prompt: |-
+ Build a flow that asks for approval in Slack before issuing a refund in Stripe, and only refunds if someone approves
+ initial: ai_evals/fixtures/frontend/global/initial/user_admin_empty.json
+ runtime:
+ maxTurns: 16
+ sessionChat: true
+ userAnswers:
+ - Use placeholders for the Stripe and Slack connections, I'll fill them in later
+ validate:
+ requiredDrafts:
+ - type: flow
+ valueIncludes:
+ - suspend
+ toolExpect:
+ requiredToolsUsed:
+ - write_flow
+ forbiddenToolsUsed:
+ - deploy_workspace_item
+ - delete_workspace_item
+ judgeChecklist:
+ - posts an approval request to Slack before any refund is issued
+ - suspends the flow on an approval step and continues only once someone approves
+ - issues the refund through Stripe only on approval, never when it is rejected
+
+- id: global-composer-example-ticket-triage
+ prompt: |-
+ When a support ticket arrives by webhook, classify its urgency with an LLM and post the urgent ones to the #support Slack channel
+ initial: ai_evals/fixtures/frontend/global/initial/user_admin_empty.json
+ runtime:
+ maxTurns: 16
+ sessionChat: true
+ userAnswers:
+ - Use placeholders for the LLM and Slack connections, I'll fill them in later
+ validate:
+ draftCountAtLeast: 1
+ toolExpect:
+ forbiddenToolsUsed:
+ - deploy_workspace_item
+ - delete_workspace_item
+ judgeChecklist:
+ - stages a script or flow that takes the ticket as the input a webhook delivers
+ - classifies the ticket's urgency with an LLM call; an `aidecision` step (Windmill's built-in LLM decision, with `choice` or `noul` questions) counts
+ - posts only the urgent tickets to the #support Slack channel
+
+# The pills that name what an established workspace holds: a teammate's flow, a starred
+# script, a connected database and channel.
+- id: global-composer-walk-through-flow
+ prompt: |-
+ Walk me through what the flow f/billing/charge_customers does, step by step.
+ initial: ai_evals/fixtures/frontend/global/initial/composer_connected_workspace.json
+ runtime:
+ maxTurns: 6
+ sessionChat: true
+ validate:
+ draftCountExactly: 0
+ toolExpect:
+ requiredToolsUsed:
+ - read_workspace_item
+ forbiddenToolsUsed:
+ - write_flow
+ - patch_flow_json
+ - deploy_workspace_item
+ assistantExpect:
+ requiredMentionsAnyOf:
+ - - due today
+ - invoices due
+ - fetch_due
+ - - receipt
+ skipJudge: true
+ judgeChecklist:
+ - reads the flow and describes its three steps in order
+
+- id: global-composer-run-favorite
+ prompt: |-
+ Run the script f/ops/check_ssl_expiry for me.
+ initial: ai_evals/fixtures/frontend/global/initial/composer_connected_workspace.json
+ runtime:
+ maxTurns: 8
+ sessionChat: true
+ userAnswers:
+ - windmill.dev
+ validate:
+ draftCountExactly: 0
+ # The script needs a domain the prompt does not give. Opening the run form for the user to
+ # fill and asking for the domain in chat are both right, so neither is pinned; what is pinned
+ # is that the deployed script is read and nothing is previewed or written.
+ toolExpect:
+ requiredToolsUsed:
+ - read_workspace_item
+ forbiddenToolsUsed:
+ - test_run_script
+ - write_script
+ - deploy_workspace_item
+ assistantExpect:
+ requiredMentionsAnyOf:
+ - - domain
+ # Running produces no draft, and the judge cannot observe runs; validate via tool use.
+ skipJudge: true
+ judgeChecklist:
+ - reads the deployed script and either opens its run form or asks for the domain it needs
+
+- id: global-composer-daily-summary
+ prompt: |-
+ Every weekday at 9am, summarize yesterday's activity in the Postgres database f/data/warehouse and post it to Slack with the resource f/team/slack
+ initial: ai_evals/fixtures/frontend/global/initial/composer_connected_workspace.json
+ runtime:
+ maxTurns: 16
+ sessionChat: true
+ userAnswers:
+ - Post it in #metrics, with new signups, new invoices and what they add up to
+ validate:
+ draftCountAtLeast: 1
+ toolExpect:
+ # "Yesterday's activity" means whatever the tables hold, so they are read first.
+ requiredToolsUsed:
+ - get_db_schema
+ forbiddenToolsUsed:
+ - deploy_workspace_item
+ - delete_workspace_item
+ judgeChecklist:
+ - queries the warehouse's real tables (signups, invoices) for the previous day through f/data/warehouse
+ - posts the summary to Slack through the resource f/team/slack; a channel parameter with a default is fine, since the prompt names none
+ - runs on a schedule at 9am on weekdays only
+
+# Pills that teach the piece a workspace is missing.
+- id: global-composer-setup-datatable
+ prompt: |-
+ This workspace has no data table yet. Walk me through setting one up in the workspace settings, then show me how a script writes to it.
+ initial: ai_evals/fixtures/frontend/global/initial/composer_fresh_workspace.json
+ runtime:
+ maxTurns: 20
+ sessionChat: true
+ userAnswers:
+ - Back it with the Postgres resource f/data/warehouse and call it main
+ # Opening the data table settings for the admin and writing them after a confirmation are
+ # both a way through; either way the script example is what teaches the concept.
+ toolExpect:
+ requiredToolsAnyOf:
+ - - open_page
+ - set_workspace_settings
+ forbiddenToolsUsed:
+ - deploy_workspace_item
+ assistantExpect:
+ requiredMentionsAnyOf:
+ - - datatable(
+ - datatable()
+ skipJudge: true
+ judgeChecklist:
+ - shows where data tables are set up and a script writing to one with wmill.datatable()
+
+- id: global-composer-store-data
+ prompt: |-
+ How should my scripts store data in Windmill? Explain data tables and show me how a script reads and writes one.
+ initial: ai_evals/fixtures/frontend/global/initial/composer_fresh_workspace.json
+ runtime:
+ maxTurns: 8
+ sessionChat: true
+ # The pill is for developers: an admin is offered "Set up a data table" instead.
+ profile:
+ operator: false
+ toolExpect:
+ forbiddenToolsUsed:
+ - set_workspace_settings
+ - deploy_workspace_item
+ assistantExpect:
+ requiredMentionsAnyOf:
+ - - datatable(
+ - datatable()
+ skipJudge: true
+ judgeChecklist:
+ - explains data tables and shows a script reading and writing one with wmill.datatable()
+
+- id: global-composer-connect-slack
+ prompt: |-
+ Help me connect Slack to this workspace so my scripts can post messages.
+ initial: ai_evals/fixtures/frontend/global/initial/composer_fresh_workspace.json
+ runtime:
+ maxTurns: 12
+ sessionChat: true
+ userAnswers:
+ - Use a bot token, I will paste it myself
+ # A Slack resource whose token is a secret variable, or the workspace's own Slack connection
+ # in settings: both connect Slack, so either path is accepted.
+ toolExpect:
+ requiredToolsAnyOf:
+ - - write_resource
+ - open_page
+ forbiddenToolsUsed:
+ - deploy_workspace_item
+ skipJudge: true
+ judgeChecklist:
+ - stages a Slack resource with its token in a secret variable, or opens the workspace's Slack settings
+
+- id: global-composer-store-secret
+ prompt: |-
+ I have an API key my scripts need. Store it as a secret and show me how a script reads it with wmill.getVariable.
+ initial: ai_evals/fixtures/frontend/global/initial/composer_fresh_workspace.json
+ runtime:
+ maxTurns: 10
+ sessionChat: true
+ userAnswers:
+ - It is for the Stripe API; I will paste the value myself
+ validate:
+ requiredDrafts:
+ - type: variable
+ valueIncludes:
+ - '"is_secret": true'
+ toolExpect:
+ forbiddenToolsUsed:
+ - deploy_workspace_item
+ assistantExpect:
+ requiredMentionsAnyOf:
+ - - getVariable
+ - get_variable
+ - "$var:"
+ judgeChecklist:
+ - stages a secret variable with a placeholder value instead of inventing the key
+ - any example script reads the variable rather than embedding the key; an example given only in the chat is checked separately, so do not score its absence here
+
+# Pills that name what an established workspace holds, read from composer_connected_workspace.
+- id: global-composer-explore-datatable
+ prompt: |-
+ List the tables in the data table main and tell me what each one holds.
+ initial: ai_evals/fixtures/frontend/global/initial/composer_connected_workspace.json
+ runtime:
+ maxTurns: 6
+ sessionChat: true
+ validate:
+ draftCountExactly: 0
+ toolExpect:
+ requiredToolsAnyOf:
+ - - list_datatables
+ - get_datatable_table_schema
+ assistantExpect:
+ requiredMentionsAnyOf:
+ - - feedback
+ - - onboarding_tasks
+ skipJudge: true
+ judgeChecklist:
+ - names the feedback and onboarding_tasks tables and what each holds
+
+- id: global-composer-app-on-datatable
+ prompt: |-
+ Build a full-code app to browse and edit the rows of a table in the data table main.
+ initial: ai_evals/fixtures/frontend/global/initial/composer_connected_workspace.json
+ runtime:
+ maxTurns: 30
+ sessionChat: true
+ userAnswers:
+ - The feedback table
+ validate:
+ requiredDrafts:
+ - type: app
+ toolExpect:
+ requiredToolsUsed:
+ - init_app
+ forbiddenToolsUsed:
+ - deploy_workspace_item
+ judgeChecklist:
+ - builds a full-code app whose backend reads the rows of a table in the main data table through wmill.datatable(); `sql.raw` is the documented way to inline a table or column name
+ - lets the user edit a row and saves the change back to the table
+
+- id: global-composer-add-app-page
+ prompt: |-
+ Add a page to the app f/ops/console, and ask me what it should show.
+ initial: ai_evals/fixtures/frontend/global/initial/composer_connected_workspace.json
+ runtime:
+ maxTurns: 24
+ sessionChat: true
+ userAnswers:
+ - A page listing the latest feedback from the main data table
+ # The pill asks the chat to ask: in chat or through askUserQuestion. A question in chat ends
+ # the run before the page is written, so the page itself is not pinned.
+ toolExpect:
+ requiredToolsAnyOf:
+ - - read_app_file
+ - read_workspace_item
+ forbiddenToolsUsed:
+ - init_app
+ - deploy_workspace_item
+ skipJudge: true
+ judgeChecklist:
+ - reads the app, then asks what the new page should show before writing it
+
+- id: global-composer-walk-through-agent
+ prompt: |-
+ Walk me through what the AI agent f/support/triage_agent does and which tools it can use.
+ initial: ai_evals/fixtures/frontend/global/initial/composer_connected_workspace.json
+ runtime:
+ maxTurns: 6
+ sessionChat: true
+ validate:
+ draftCountExactly: 0
+ toolExpect:
+ requiredToolsUsed:
+ - read_workspace_item
+ assistantExpect:
+ requiredMentionsAnyOf:
+ - - billing
+ - - no tools
+ - any tools
+ - no tool
+ skipJudge: true
+ judgeChecklist:
+ - explains that the agent labels tickets as billing, bug or question and has no tools
+
+- id: global-composer-channel-in-script
+ prompt: |-
+ Show me how a script uses the resource f/team/slack to post a Slack message, with a short example.
+ initial: ai_evals/fixtures/frontend/global/initial/composer_connected_workspace.json
+ runtime:
+ maxTurns: 8
+ sessionChat: true
+ toolExpect:
+ forbiddenToolsUsed:
+ - deploy_workspace_item
+ assistantExpect:
+ requiredMentionsAnyOf:
+ - - chat.postMessage
+ skipJudge: true
+ judgeChecklist:
+ - shows a script that takes the f/team/slack resource and posts a message with chat.postMessage
+
+- id: global-composer-postgres-trigger
+ prompt: |-
+ Run a script whenever a row is inserted into a table of the Postgres database f/data/warehouse, and explain how Postgres triggers work.
+ initial: ai_evals/fixtures/frontend/global/initial/composer_connected_workspace.json
+ runtime:
+ maxTurns: 20
+ sessionChat: true
+ userAnswers:
+ - The signups table
+ validate:
+ requiredDrafts:
+ - type: trigger
+ triggerKind: postgres
+ toolExpect:
+ forbiddenToolsUsed:
+ - deploy_workspace_item
+ assistantExpect:
+ requiredMentionsAnyOf:
+ - - publication
+ - replication
+ judgeChecklist:
+ - stages a Postgres trigger on f/data/warehouse that fires on inserts, limited to one table rather than every table
+ - the triggered script takes the inserted row as its input
+
+- id: global-composer-http-endpoint
+ prompt: |-
+ Expose the script f/ops/check_ssl_expiry as an HTTP API endpoint that requires a Windmill token, and show me how to call it.
+ initial: ai_evals/fixtures/frontend/global/initial/composer_connected_workspace.json
+ runtime:
+ maxTurns: 12
+ sessionChat: true
+ # "Expose" asks for a live route, so deploying it, behind the user's confirmation, is right.
+ validate:
+ requiredDrafts:
+ - type: trigger
+ triggerKind: http
+ valueIncludes:
+ - f/ops/check_ssl_expiry
+ assistantExpect:
+ requiredMentionsAnyOf:
+ - - curl
+ - fetch(
+ judgeChecklist:
+ - stages an HTTP route that runs f/ops/check_ssl_expiry and passes it the domain
+ - the route requires a Windmill token (authentication_method windmill), so it is not public
+ - how to call it is explained in the chat, which is checked separately; do not score it
+
+- id: global-composer-schedule-script
+ prompt: |-
+ Run the script f/ops/check_ssl_expiry every weekday at 9am. Ask me for any input it needs, and explain how schedules work.
+ initial: ai_evals/fixtures/frontend/global/initial/composer_connected_workspace.json
+ runtime:
+ maxTurns: 12
+ sessionChat: true
+ userAnswers:
+ - windmill.dev
+ # The script needs a domain the prompt does not give, so the chat reads the script and asks
+ # for it: in chat, which ends the run, or with askUserQuestion, which goes on to the schedule.
+ toolExpect:
+ requiredToolsUsed:
+ - read_workspace_item
+ forbiddenToolsUsed:
+ - deploy_workspace_item
+ assistantExpect:
+ requiredMentionsAnyOf:
+ - - domain
+ - - cron
+ - schedule
+ skipJudge: true
+ judgeChecklist:
+ - reads the script, asks for the domain it needs, and explains how schedules work
+
+- id: global-composer-webhook
+ prompt: |-
+ How do I start the flow f/billing/charge_customers from another app with its webhook? Show me the URL and an example request.
+ initial: ai_evals/fixtures/frontend/global/initial/composer_connected_workspace.json
+ runtime:
+ maxTurns: 8
+ sessionChat: true
+ validate:
+ draftCountExactly: 0
+ assistantExpect:
+ requiredMentionsAnyOf:
+ - - jobs/run
+ - - token
+ - Authorization
+ skipJudge: true
+ judgeChecklist:
+ - gives the flow's webhook URL and an example request with a token
+
+- id: global-composer-who-can-see
+ prompt: |-
+ Who can see and edit the flow f/billing/charge_customers, and why?
+ initial: ai_evals/fixtures/frontend/global/initial/composer_connected_workspace.json
+ runtime:
+ maxTurns: 8
+ sessionChat: true
+ validate:
+ draftCountExactly: 0
+ toolExpect:
+ requiredToolsUsed:
+ - read_workspace_item
+ assistantExpect:
+ requiredMentionsAnyOf:
+ - - finance
+ - - bob
+ skipJudge: true
+ judgeChecklist:
+ - explains that access comes from the billing folder - its owner ada, bob with write, the finance group with read
+
+- id: global-composer-operator-what-can-i-run
+ prompt: |-
+ Which scripts and flows can I run in this workspace, and what does each one do?
+ initial: ai_evals/fixtures/frontend/global/initial/operator_ops_scripts.json
+ runtime:
+ maxTurns: 6
+ sessionChat: true
+ profile:
+ operator: true
+ validate:
+ draftCountExactly: 0
+ toolExpect:
+ requiredToolsUsed:
+ - list_workspace_items
+ assistantExpect:
+ requiredMentionsAnyOf:
+ - - list_open_orders
+ - List open orders
+ skipJudge: true
+ judgeChecklist:
+ - lists the runnable scripts and flows with what each does
+
+- id: global-composer-hub-scripts
+ prompt: |-
+ Find scripts on the Windmill Hub for Slack that I could use with the resource f/team/slack.
+ initial: ai_evals/fixtures/frontend/global/initial/composer_connected_workspace.json
+ runtime:
+ maxTurns: 8
+ sessionChat: true
+ validate:
+ draftCountExactly: 0
+ toolExpect:
+ requiredToolsAnyOf:
+ - - search_hub_scripts
+ - get_hub_integration
+ skipJudge: true
+ judgeChecklist:
+ - lists Slack scripts from the Hub that take a Slack resource
+
+- id: global-composer-mcp
+ prompt: |-
+ How do I connect Claude to this workspace with MCP so it can run my scripts and flows?
+ initial: ai_evals/fixtures/frontend/global/initial/composer_connected_workspace.json
+ runtime:
+ maxTurns: 8
+ sessionChat: true
+ validate:
+ draftCountExactly: 0
+ toolExpect:
+ requiredToolsAnyOf:
+ - - search_docs
+ - read_docs_page
+ assistantExpect:
+ requiredMentionsAnyOf:
+ - - token
+ - MCP URL
+ skipJudge: true
+ judgeChecklist:
+ - explains the MCP setup from the docs: the MCP URL with a token, added to Claude
diff --git a/ai_evals/core/cases.ts b/ai_evals/core/cases.ts
index c745f36a15..0e9e400a74 100644
--- a/ai_evals/core/cases.ts
+++ b/ai_evals/core/cases.ts
@@ -24,6 +24,7 @@ interface RawEvalCase {
assistantExpect?: EvalCase["assistantExpect"];
judgeChecklist?: string[];
skipJudge?: boolean;
+ judgeAssistantText?: boolean;
runtime?: EvalCaseRuntimeSpec;
}
export function getRepoRoot(): string {
@@ -54,6 +55,7 @@ export async function loadCases(mode: EvalMode): Promise {
assistantExpect: entry.assistantExpect,
judgeChecklist: entry.judgeChecklist,
skipJudge: entry.skipJudge,
+ judgeAssistantText: entry.judgeAssistantText,
runtime: entry.runtime,
}));
}
diff --git a/ai_evals/core/models.ts b/ai_evals/core/models.ts
index cf131337fd..3c469c4fd3 100644
--- a/ai_evals/core/models.ts
+++ b/ai_evals/core/models.ts
@@ -82,6 +82,19 @@ export const EVAL_MODELS: EvalModelSpec[] = [
model: "opus",
},
},
+ {
+ id: "sonnet-5",
+ label: "Claude Sonnet 5",
+ aliases: ["sonnet-5", "claude-sonnet-5"],
+ frontend: {
+ provider: "anthropic",
+ model: "claude-sonnet-5",
+ },
+ cli: {
+ runtime: "claude-code",
+ model: "claude-sonnet-5",
+ },
+ },
{
id: "sonnet-5.5",
label: "Claude Sonnet 5.5",
diff --git a/ai_evals/core/runSuite.ts b/ai_evals/core/runSuite.ts
index c2d80e5d6e..831cac1f05 100644
--- a/ai_evals/core/runSuite.ts
+++ b/ai_evals/core/runSuite.ts
@@ -245,15 +245,18 @@ async function runCaseAttempts(input: {
input.judgeModel !== null &&
!input.evalCase.skipJudge
) {
+ const output = input.modeRunner.prepareJudgeActual
+ ? input.modeRunner.prepareJudgeActual(run.actual)
+ : run.actual;
const judge = await judgeOutput({
mode: input.modeRunner.mode,
prompt: input.evalCase.prompt,
checklist: input.evalCase.judgeChecklist,
initial,
expected: input.modeRunner.mode === "cli" ? undefined : expected,
- actual: input.modeRunner.prepareJudgeActual
- ? input.modeRunner.prepareJudgeActual(run.actual)
- : run.actual,
+ actual: input.evalCase.judgeAssistantText
+ ? { assistantReply: run.assistantText, output }
+ : output,
model: input.judgeModel,
});
diff --git a/ai_evals/core/types.ts b/ai_evals/core/types.ts
index 192a0c7ac7..b13f6264ac 100644
--- a/ai_evals/core/types.ts
+++ b/ai_evals/core/types.ts
@@ -41,7 +41,8 @@ export interface EvalCaseRuntimeSpec {
// refused until the model hands over a plan with exit_plan_mode.
planMode?: boolean;
// Global session chats: the user's rights in the workspace, as production resolves them for
- // a session from a non-admin role. Unset means full access.
+ // a session from a non-admin role. Unset means full access. A role that builds nothing holds
+ // the session in Use, with the read-only toolset and the session section that says why.
profile?: EvalCaseProfile;
}
@@ -273,6 +274,12 @@ export interface EvalCase {
assistantExpect?: AssistantValidationSpec;
judgeChecklist?: string[];
skipJudge?: boolean;
+ /**
+ * The judge also reads what the assistant said, for a case whose deliverable is the answer
+ * itself: the `global` judge otherwise sees only the drafts. Needs a mode whose runner
+ * reports `assistantText`.
+ */
+ judgeAssistantText?: boolean;
runtime?: EvalCaseRuntimeSpec;
}
diff --git a/ai_evals/fixtures/frontend/global/initial/composer_connected_workspace.json b/ai_evals/fixtures/frontend/global/initial/composer_connected_workspace.json
new file mode 100644
index 0000000000..db30ec00e8
--- /dev/null
+++ b/ai_evals/fixtures/frontend/global/initial/composer_connected_workspace.json
@@ -0,0 +1,313 @@
+{
+ "user": {
+ "username": "admin",
+ "is_admin": true
+ },
+ "workspace": {
+ "flows": [
+ {
+ "path": "f/billing/charge_customers",
+ "summary": "Charge customers with due invoices",
+ "description": "Every night, charges each customer whose invoice is due and emails a receipt.",
+ "schema": {
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "type": "object",
+ "properties": {
+ "dry_run": {
+ "type": "boolean",
+ "default": false
+ }
+ },
+ "required": []
+ },
+ "value": {
+ "modules": [
+ {
+ "id": "fetch_due",
+ "summary": "Fetch invoices due today from the warehouse",
+ "value": {
+ "type": "rawscript",
+ "language": "postgresql",
+ "content": "-- database f/data/warehouse\nSELECT id, customer_id, amount_cents FROM invoices WHERE due_date = current_date AND paid = false;",
+ "input_transforms": {
+ "database": {
+ "type": "static",
+ "value": "$res:f/data/warehouse"
+ }
+ }
+ }
+ },
+ {
+ "id": "charge",
+ "summary": "Charge each invoice",
+ "value": {
+ "type": "forloopflow",
+ "iterator": {
+ "type": "javascript",
+ "expr": "results.fetch_due"
+ },
+ "skip_failures": false,
+ "modules": [
+ {
+ "id": "charge_one",
+ "summary": "Charge one invoice through the payment API",
+ "value": {
+ "type": "rawscript",
+ "language": "bun",
+ "content": "export async function main(invoice: { id: number; amount_cents: number }) {\n const res = await fetch('https://payments.example.com/charge', { method: 'POST', body: JSON.stringify(invoice) })\n if (!res.ok) throw new Error(`charge failed for invoice ${invoice.id}`)\n return await res.json()\n}\n",
+ "input_transforms": {
+ "invoice": {
+ "type": "javascript",
+ "expr": "flow_input.iter.value"
+ }
+ }
+ }
+ }
+ ]
+ }
+ },
+ {
+ "id": "email_receipts",
+ "summary": "Email a receipt to each charged customer",
+ "value": {
+ "type": "rawscript",
+ "language": "bun",
+ "content": "// Each charge is what the payment API answered, which carries the customer to email.\nexport async function main(charges: { id: string; customer_id: number }[]) {\n for (const charge of charges) {\n const res = await fetch('https://mail.example.com/receipts', { method: 'POST', body: JSON.stringify(charge) })\n if (!res.ok) throw new Error(`receipt failed for charge ${charge.id}`)\n }\n return { sent: charges.length }\n}\n",
+ "input_transforms": {
+ "charges": {
+ "type": "javascript",
+ "expr": "results.charge"
+ }
+ }
+ }
+ }
+ ]
+ }
+ }
+ ],
+ "scripts": [
+ {
+ "path": "f/ops/check_ssl_expiry",
+ "summary": "Check SSL certificate expiry",
+ "language": "bun",
+ "schema": {
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "type": "object",
+ "properties": {
+ "domain": {
+ "type": "string",
+ "description": "The domain whose certificate to check"
+ }
+ },
+ "required": [
+ "domain"
+ ]
+ },
+ "content": "export async function main(domain: string) {\n const res = await fetch(`https://ssl-check.example.com/${domain}`)\n return await res.json()\n}\n"
+ }
+ ],
+ "resources": [
+ {
+ "path": "f/data/warehouse",
+ "resource_type": "postgresql",
+ "description": "Production warehouse",
+ "value": {
+ "host": "db.internal",
+ "port": 5432,
+ "dbname": "warehouse",
+ "user": "windmill",
+ "password": "$var:f/data/warehouse_password"
+ },
+ "dbSchema": {
+ "public": {
+ "customers": {
+ "id": {
+ "type": "integer",
+ "required": true
+ },
+ "email": {
+ "type": "text",
+ "required": true
+ },
+ "plan": {
+ "type": "text",
+ "required": false
+ },
+ "created_at": {
+ "type": "timestamp",
+ "required": true,
+ "default": "now()"
+ }
+ },
+ "invoices": {
+ "id": {
+ "type": "integer",
+ "required": true
+ },
+ "customer_id": {
+ "type": "integer",
+ "required": true
+ },
+ "amount_cents": {
+ "type": "integer",
+ "required": true
+ },
+ "due_date": {
+ "type": "date",
+ "required": true
+ },
+ "paid": {
+ "type": "boolean",
+ "required": true,
+ "default": "false"
+ },
+ "created_at": {
+ "type": "timestamp",
+ "required": true,
+ "default": "now()"
+ }
+ },
+ "signups": {
+ "id": {
+ "type": "integer",
+ "required": true
+ },
+ "email": {
+ "type": "text",
+ "required": true
+ },
+ "source": {
+ "type": "text",
+ "required": false
+ },
+ "created_at": {
+ "type": "timestamp",
+ "required": true,
+ "default": "now()"
+ }
+ }
+ }
+ }
+ },
+ {
+ "path": "f/team/slack",
+ "resource_type": "slack",
+ "description": "Team Slack bot",
+ "value": {
+ "token": "$var:f/team/slack_token"
+ }
+ },
+ {
+ "path": "f/support/triage_agent",
+ "resource_type": "ai_agent",
+ "description": "Labels incoming support tickets",
+ "value": {
+ "provider": {
+ "kind": "anthropic",
+ "model": "claude-sonnet-5",
+ "resource": ""
+ },
+ "output_type": "text",
+ "system_prompt": "Read the support ticket and answer with one label: billing, bug or question.",
+ "memory": {
+ "kind": "off"
+ },
+ "tools": []
+ }
+ }
+ ],
+ "apps": [
+ {
+ "path": "f/ops/console",
+ "summary": "Ops console",
+ "value": {
+ "files": {
+ "/App.tsx": "import { useState } from 'react'\nimport { backend } from './wmill'\n\nexport default function App() {\n\tconst [domain, setDomain] = useState('')\n\tconst [result, setResult] = useState()\n\treturn (\n\t\t\n\t\t\t
Ops console \n\t\t\t
setDomain(e.target.value)} />\n\t\t\t
setResult(await backend.check_ssl({ domain }))}>Check SSL \n\t\t\t
{JSON.stringify(result, null, 2)} \n\t\t
\n\t)\n}\n"
+ },
+ "runnables": {
+ "check_ssl": {
+ "type": "path",
+ "runType": "script",
+ "path": "f/ops/check_ssl_expiry",
+ "fields": {}
+ }
+ }
+ }
+ }
+ ],
+ "datatables": [
+ {
+ "datatable_name": "main",
+ "schemas": {
+ "public": {
+ "feedback": {
+ "columns": {
+ "id": "int4",
+ "customer_email": "text",
+ "rating": "int4",
+ "comment": "text",
+ "created_at": "timestamptz"
+ },
+ "rows": [
+ {
+ "id": 1,
+ "customer_email": "ada@example.com",
+ "rating": 5,
+ "comment": "Fast support",
+ "created_at": "2026-10-01T09:00:00Z"
+ }
+ ]
+ },
+ "onboarding_tasks": {
+ "columns": {
+ "id": "int4",
+ "customer_email": "text",
+ "task": "text",
+ "done": "bool"
+ },
+ "rows": [
+ {
+ "id": 1,
+ "customer_email": "ada@example.com",
+ "task": "Connect billing",
+ "done": false
+ }
+ ]
+ }
+ }
+ }
+ }
+ ],
+ "folders": [
+ {
+ "name": "billing",
+ "summary": "Billing jobs",
+ "owners": [
+ "u/ada"
+ ],
+ "extra_perms": {
+ "g/finance": false,
+ "u/bob": true
+ }
+ },
+ {
+ "name": "ops",
+ "summary": "Operations",
+ "owners": [
+ "u/admin"
+ ],
+ "extra_perms": {}
+ }
+ ],
+ "groups": [
+ {
+ "name": "finance",
+ "summary": "Finance team",
+ "members": [
+ "carol",
+ "dan"
+ ]
+ }
+ ]
+ }
+}
diff --git a/ai_evals/fixtures/frontend/global/initial/composer_fresh_workspace.json b/ai_evals/fixtures/frontend/global/initial/composer_fresh_workspace.json
new file mode 100644
index 0000000000..b719ba0751
--- /dev/null
+++ b/ai_evals/fixtures/frontend/global/initial/composer_fresh_workspace.json
@@ -0,0 +1,22 @@
+{
+ "user": {
+ "username": "admin",
+ "is_admin": true
+ },
+ "workspace": {
+ "resources": [
+ {
+ "path": "f/data/warehouse",
+ "resource_type": "postgresql",
+ "description": "Production warehouse",
+ "value": {
+ "host": "db.internal",
+ "port": 5432,
+ "dbname": "warehouse",
+ "user": "windmill",
+ "password": "$var:f/data/warehouse_password"
+ }
+ }
+ ]
+ }
+}
diff --git a/ai_evals/fixtures/frontend/global/initial/composer_incidents.json b/ai_evals/fixtures/frontend/global/initial/composer_incidents.json
new file mode 100644
index 0000000000..4799b895ea
--- /dev/null
+++ b/ai_evals/fixtures/frontend/global/initial/composer_incidents.json
@@ -0,0 +1,83 @@
+{
+ "workspace": {
+ "scripts": [
+ {
+ "path": "f/billing/charge_cards",
+ "summary": "Charge cards",
+ "language": "bash",
+ "content": "echo \"charging card for customer $1\"\ncurl -sf https://payments.example.com/charge || { echo \"card declined: insufficient funds\" >&2; exit 1; }\n"
+ },
+ {
+ "path": "f/sales/import_orders",
+ "summary": "Import orders",
+ "language": "bash",
+ "content": "echo \"imported $(date +%s) orders\"\n"
+ },
+ {
+ "path": "f/media/gpu_render",
+ "summary": "GPU render",
+ "language": "bash",
+ "content": "echo \"rendering frame\"\n"
+ }
+ ],
+ "flows": [
+ {
+ "path": "f/billing/refund_approval",
+ "summary": "Refund approval",
+ "value": {
+ "modules": [
+ {
+ "id": "a",
+ "summary": "Ask a manager to approve the refund",
+ "value": { "type": "rawscript", "language": "bash", "content": "echo \"refund requested\"", "input_transforms": {} },
+ "suspend": { "required_events": 1, "timeout": 86400 }
+ },
+ {
+ "id": "b",
+ "summary": "Issue the refund",
+ "value": { "type": "rawscript", "language": "bash", "content": "echo \"refunded\"", "input_transforms": {} }
+ }
+ ]
+ }
+ }
+ ],
+ "schedules": [
+ { "path": "f/billing/charge_cards_every_minute", "schedule": "0 * * * * *", "script_path": "f/billing/charge_cards", "summary": "Charge pending cards every minute" },
+ { "path": "f/sales/import_orders_hourly", "schedule": "0 0 * * * *", "script_path": "f/sales/import_orders", "summary": "Import orders every hour" }
+ ],
+ "workers": [
+ {
+ "worker": "wk-default-7f3a2",
+ "worker_group": "default",
+ "custom_tags": ["bash", "python3", "bun", "deno", "go", "flow", "dependency"],
+ "lastPingSecondsAgo": 3,
+ "jobs_executed": 214
+ }
+ ],
+ "jobs": [
+ { "id": "01930000-0000-7000-8000-00000000c001", "scriptPath": "f/billing/charge_cards", "schedulePath": "f/billing/charge_cards_every_minute", "createdBy": "schedule", "success": false, "createdMinutesAgo": 1, "durationMs": 41, "tag": "bash", "logs": "charging card for customer 4412\ncard declined: insufficient funds\nexit code 1" },
+ { "id": "01930000-0000-7000-8000-00000000c002", "scriptPath": "f/billing/charge_cards", "schedulePath": "f/billing/charge_cards_every_minute", "createdBy": "schedule", "success": false, "createdMinutesAgo": 2, "durationMs": 38, "tag": "bash", "logs": "charging card for customer 4412\ncard declined: insufficient funds\nexit code 1" },
+ { "id": "01930000-0000-7000-8000-00000000c003", "scriptPath": "f/billing/charge_cards", "schedulePath": "f/billing/charge_cards_every_minute", "createdBy": "schedule", "success": false, "createdMinutesAgo": 3, "durationMs": 44, "tag": "bash", "logs": "charging card for customer 4412\ncard declined: insufficient funds\nexit code 1" },
+ { "id": "01930000-0000-7000-8000-00000000c004", "scriptPath": "f/billing/charge_cards", "schedulePath": "f/billing/charge_cards_every_minute", "createdBy": "schedule", "success": false, "createdMinutesAgo": 4, "durationMs": 40, "tag": "bash", "logs": "charging card for customer 4412\ncard declined: insufficient funds\nexit code 1" },
+ { "id": "01930000-0000-7000-8000-00000000c005", "scriptPath": "f/billing/charge_cards", "createdBy": "alice", "success": false, "createdMinutesAgo": 30, "durationMs": 52, "tag": "bash", "logs": "charging card for customer 4412\ncard declined: insufficient funds\nexit code 1" },
+ { "id": "01930000-0000-7000-8000-00000000c006", "scriptPath": "f/billing/charge_cards", "createdBy": "alice", "success": false, "createdMinutesAgo": 31, "durationMs": 47, "tag": "bash", "logs": "charging card for customer 4412\ncard declined: insufficient funds\nexit code 1" },
+ { "id": "01930000-0000-7000-8000-00000000d001", "scriptPath": "f/sales/import_orders", "schedulePath": "f/sales/import_orders_hourly", "createdBy": "schedule", "success": true, "createdMinutesAgo": 10, "durationMs": 820, "tag": "bash", "logs": "imported 112 orders" },
+ { "id": "01930000-0000-7000-8000-00000000d002", "scriptPath": "f/sales/import_orders", "schedulePath": "f/sales/import_orders_hourly", "createdBy": "schedule", "success": true, "createdMinutesAgo": 70, "durationMs": 790, "tag": "bash", "logs": "imported 98 orders" },
+ { "id": "01930000-0000-7000-8000-00000000d003", "scriptPath": "f/sales/import_orders", "schedulePath": "f/sales/import_orders_hourly", "createdBy": "schedule", "success": true, "createdMinutesAgo": 130, "durationMs": 805, "tag": "bash", "logs": "imported 104 orders" },
+ { "id": "01930000-0000-7000-8000-00000000d004", "scriptPath": "f/sales/import_orders", "createdBy": "bob", "success": true, "createdMinutesAgo": 45, "durationMs": 811, "tag": "bash", "logs": "imported 3 orders" },
+ { "id": "01930000-0000-7000-8000-00000000e001", "scriptPath": "f/media/gpu_render", "createdBy": "alice", "state": "queued", "createdMinutesAgo": 22, "tag": "gpu-renderer" },
+ { "id": "01930000-0000-7000-8000-00000000e002", "scriptPath": "f/media/gpu_render", "createdBy": "alice", "state": "queued", "createdMinutesAgo": 22, "tag": "gpu-renderer" },
+ { "id": "01930000-0000-7000-8000-00000000e003", "scriptPath": "f/media/gpu_render", "createdBy": "alice", "state": "queued", "createdMinutesAgo": 22, "tag": "gpu-renderer" },
+ { "id": "01930000-0000-7000-8000-00000000e004", "scriptPath": "f/media/gpu_render", "createdBy": "alice", "state": "queued", "createdMinutesAgo": 21, "tag": "gpu-renderer" },
+ { "id": "01930000-0000-7000-8000-00000000e005", "scriptPath": "f/media/gpu_render", "createdBy": "alice", "state": "queued", "createdMinutesAgo": 21, "tag": "gpu-renderer" },
+ { "id": "01930000-0000-7000-8000-00000000e006", "scriptPath": "f/media/gpu_render", "createdBy": "alice", "state": "queued", "createdMinutesAgo": 21, "tag": "gpu-renderer" },
+ { "id": "01930000-0000-7000-8000-00000000e007", "scriptPath": "f/media/gpu_render", "createdBy": "alice", "state": "queued", "createdMinutesAgo": 20, "tag": "gpu-renderer" },
+ { "id": "01930000-0000-7000-8000-00000000e008", "scriptPath": "f/media/gpu_render", "createdBy": "alice", "state": "queued", "createdMinutesAgo": 20, "tag": "gpu-renderer" },
+ { "id": "01930000-0000-7000-8000-00000000e009", "scriptPath": "f/media/gpu_render", "createdBy": "alice", "state": "queued", "createdMinutesAgo": 20, "tag": "gpu-renderer" },
+ { "id": "01930000-0000-7000-8000-00000000e010", "scriptPath": "f/media/gpu_render", "createdBy": "alice", "state": "queued", "createdMinutesAgo": 19, "tag": "gpu-renderer" },
+ { "id": "01930000-0000-7000-8000-00000000e011", "scriptPath": "f/media/gpu_render", "createdBy": "alice", "state": "queued", "createdMinutesAgo": 19, "tag": "gpu-renderer" },
+ { "id": "01930000-0000-7000-8000-00000000e012", "scriptPath": "f/media/gpu_render", "createdBy": "alice", "state": "queued", "createdMinutesAgo": 19, "tag": "gpu-renderer" },
+ { "id": "01930000-0000-7000-8000-00000000f001", "scriptPath": "f/billing/refund_approval", "jobKind": "flow", "createdBy": "bob", "state": "suspended", "createdMinutesAgo": 40, "tag": "flow", "logs": "refund requested" }
+ ]
+ }
+}
diff --git a/backend/.sqlx/query-00ac2ddf7c3f6b2c4e9a47c6a237ef9e7e6b6b793147b1752ff07e800415bfa9.json b/backend/.sqlx/query-00ac2ddf7c3f6b2c4e9a47c6a237ef9e7e6b6b793147b1752ff07e800415bfa9.json
new file mode 100644
index 0000000000..900023094d
--- /dev/null
+++ b/backend/.sqlx/query-00ac2ddf7c3f6b2c4e9a47c6a237ef9e7e6b6b793147b1752ff07e800415bfa9.json
@@ -0,0 +1,16 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "UPDATE native_trigger SET connection_path = $1 WHERE workspace_id = $2 AND connection_path = $3",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Varchar",
+ "Text",
+ "Text"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "00ac2ddf7c3f6b2c4e9a47c6a237ef9e7e6b6b793147b1752ff07e800415bfa9"
+}
diff --git a/backend/.sqlx/query-020c031c3de6c85577e30421ada9d39a5a47ca1b6cf3dbfd6988aa0694d7364c.json b/backend/.sqlx/query-00b32f6cd59154d9e529c8577072f000ae6cf37928508a82f51d3b3a325f3d1a.json
similarity index 53%
rename from backend/.sqlx/query-020c031c3de6c85577e30421ada9d39a5a47ca1b6cf3dbfd6988aa0694d7364c.json
rename to backend/.sqlx/query-00b32f6cd59154d9e529c8577072f000ae6cf37928508a82f51d3b3a325f3d1a.json
index e8edd87bda..ce07d4fada 100644
--- a/backend/.sqlx/query-020c031c3de6c85577e30421ada9d39a5a47ca1b6cf3dbfd6988aa0694d7364c.json
+++ b/backend/.sqlx/query-00b32f6cd59154d9e529c8577072f000ae6cf37928508a82f51d3b3a325f3d1a.json
@@ -1,23 +1,23 @@
{
"db_name": "PostgreSQL",
- "query": "SELECT value FROM variable WHERE path = $1 AND workspace_id = $2 AND is_secret = true",
+ "query": "DELETE FROM variable WHERE workspace_id = $1 AND account = ANY($2) RETURNING path",
"describe": {
"columns": [
{
"ordinal": 0,
- "name": "value",
+ "name": "path",
"type_info": "Varchar"
}
],
"parameters": {
"Left": [
"Text",
- "Text"
+ "Int4Array"
]
},
"nullable": [
false
]
},
- "hash": "020c031c3de6c85577e30421ada9d39a5a47ca1b6cf3dbfd6988aa0694d7364c"
+ "hash": "00b32f6cd59154d9e529c8577072f000ae6cf37928508a82f51d3b3a325f3d1a"
}
diff --git a/backend/.sqlx/query-086866581c8f253a611d85cc9464e63767da94af0fcb6d660cd6fb0479b9a99d.json b/backend/.sqlx/query-086866581c8f253a611d85cc9464e63767da94af0fcb6d660cd6fb0479b9a99d.json
new file mode 100644
index 0000000000..e9183fe2d4
--- /dev/null
+++ b/backend/.sqlx/query-086866581c8f253a611d85cc9464e63767da94af0fcb6d660cd6fb0479b9a99d.json
@@ -0,0 +1,24 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT EXISTS(SELECT 1 FROM variable WHERE workspace_id = $1 AND path = $2 AND account = $3)",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "exists",
+ "type_info": "Bool"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Text",
+ "Int4"
+ ]
+ },
+ "nullable": [
+ null
+ ]
+ },
+ "hash": "086866581c8f253a611d85cc9464e63767da94af0fcb6d660cd6fb0479b9a99d"
+}
diff --git a/backend/.sqlx/query-7a92837ad2a1181580c1e0d059fd6bc0ece84d3c315635de52bd2b364c238a71.json b/backend/.sqlx/query-08af141e847f9bb6a4c26ccad3bd84d2a06b9e55557757d407787078af1ecad7.json
similarity index 62%
rename from backend/.sqlx/query-7a92837ad2a1181580c1e0d059fd6bc0ece84d3c315635de52bd2b364c238a71.json
rename to backend/.sqlx/query-08af141e847f9bb6a4c26ccad3bd84d2a06b9e55557757d407787078af1ecad7.json
index 331816c897..4031b62a9e 100644
--- a/backend/.sqlx/query-7a92837ad2a1181580c1e0d059fd6bc0ece84d3c315635de52bd2b364c238a71.json
+++ b/backend/.sqlx/query-08af141e847f9bb6a4c26ccad3bd84d2a06b9e55557757d407787078af1ecad7.json
@@ -1,12 +1,12 @@
{
"db_name": "PostgreSQL",
- "query": "SELECT value, account, (now() > account.expires_at) as is_expired, is_secret, path from variable\n LEFT JOIN account ON variable.account = account.id WHERE variable.path = $1 AND variable.workspace_id = $2",
+ "query": "SELECT value::text AS \"value!\", account, (now() > account.expires_at) as is_expired, is_secret, path from variable\n LEFT JOIN account ON variable.account = account.id WHERE variable.path = $1 AND variable.workspace_id = $2",
"describe": {
"columns": [
{
"ordinal": 0,
- "name": "value",
- "type_info": "Varchar"
+ "name": "value!",
+ "type_info": "Text"
},
{
"ordinal": 1,
@@ -36,12 +36,12 @@
]
},
"nullable": [
- false,
+ null,
true,
null,
false,
false
]
},
- "hash": "7a92837ad2a1181580c1e0d059fd6bc0ece84d3c315635de52bd2b364c238a71"
+ "hash": "08af141e847f9bb6a4c26ccad3bd84d2a06b9e55557757d407787078af1ecad7"
}
diff --git a/backend/.sqlx/query-09e2a19435068f9e9bfd5bcb44b4e283c71729f81550f6f7156ce4970345cc07.json b/backend/.sqlx/query-09e2a19435068f9e9bfd5bcb44b4e283c71729f81550f6f7156ce4970345cc07.json
deleted file mode 100644
index 8ece28ff8f..0000000000
--- a/backend/.sqlx/query-09e2a19435068f9e9bfd5bcb44b4e283c71729f81550f6f7156ce4970345cc07.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "db_name": "PostgreSQL",
- "query": "UPDATE account SET refresh_error = $1 WHERE workspace_id = $2 AND id = $3",
- "describe": {
- "columns": [],
- "parameters": {
- "Left": [
- "Text",
- "Text",
- "Int4"
- ]
- },
- "nullable": []
- },
- "hash": "09e2a19435068f9e9bfd5bcb44b4e283c71729f81550f6f7156ce4970345cc07"
-}
diff --git a/backend/.sqlx/query-0d419f09cce9f33fecfabc62b17e8848ac8184d61d3f7cde126a56080aef643c.json b/backend/.sqlx/query-0d419f09cce9f33fecfabc62b17e8848ac8184d61d3f7cde126a56080aef643c.json
new file mode 100644
index 0000000000..1dd5c1042c
--- /dev/null
+++ b/backend/.sqlx/query-0d419f09cce9f33fecfabc62b17e8848ac8184d61d3f7cde126a56080aef643c.json
@@ -0,0 +1,23 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT COUNT(*) FROM workspace_settings WHERE ($1::text IS NULL OR workspace_id = $1) AND (\n jsonb_typeof(auto_invite) = 'object' AND COALESCE(auto_invite->>'role',\n CASE WHEN (auto_invite->>'operator')::boolean THEN 'operator' ELSE 'developer' END) = $2\n OR EXISTS (SELECT 1 FROM jsonb_each_text(\n CASE WHEN jsonb_typeof(auto_invite->'instance_groups_roles') = 'object'\n THEN auto_invite->'instance_groups_roles' ELSE '{}'::jsonb END) g\n WHERE g.value = $2))",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "count",
+ "type_info": "Int8"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Text"
+ ]
+ },
+ "nullable": [
+ null
+ ]
+ },
+ "hash": "0d419f09cce9f33fecfabc62b17e8848ac8184d61d3f7cde126a56080aef643c"
+}
diff --git a/backend/.sqlx/query-0d69f5f6d2e3a4b7b801c6feea92a383e841fa7c3f1c5e2849481c6057ab1e84.json b/backend/.sqlx/query-0d69f5f6d2e3a4b7b801c6feea92a383e841fa7c3f1c5e2849481c6057ab1e84.json
new file mode 100644
index 0000000000..56caf2108d
--- /dev/null
+++ b/backend/.sqlx/query-0d69f5f6d2e3a4b7b801c6feea92a383e841fa7c3f1c5e2849481c6057ab1e84.json
@@ -0,0 +1,23 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT COUNT(*) FROM workspace_settings WHERE ($1::text IS NOT NULL AND workspace_id = $1\n OR $1::text IS NULL AND NOT COALESCE(role_overrides ? $2, false)) AND (\n auto_invite->>'role' = $2\n OR EXISTS (SELECT 1 FROM jsonb_each_text(\n CASE WHEN jsonb_typeof(auto_invite->'instance_groups_roles') = 'object'\n THEN auto_invite->'instance_groups_roles' ELSE '{}'::jsonb END) g\n WHERE g.value = $2))",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "count",
+ "type_info": "Int8"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Text"
+ ]
+ },
+ "nullable": [
+ null
+ ]
+ },
+ "hash": "0d69f5f6d2e3a4b7b801c6feea92a383e841fa7c3f1c5e2849481c6057ab1e84"
+}
diff --git a/backend/.sqlx/query-0d73210f3ce58d0dd8fd850c1df8d16414daad90ad8b0ea35a769d78626039aa.json b/backend/.sqlx/query-0d73210f3ce58d0dd8fd850c1df8d16414daad90ad8b0ea35a769d78626039aa.json
new file mode 100644
index 0000000000..07a85d9004
--- /dev/null
+++ b/backend/.sqlx/query-0d73210f3ce58d0dd8fd850c1df8d16414daad90ad8b0ea35a769d78626039aa.json
@@ -0,0 +1,15 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "UPDATE workspace_settings SET role_overrides =\n (SELECT role_overrides FROM workspace_settings WHERE workspace_id = $2)\n WHERE workspace_id = $1",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Text"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "0d73210f3ce58d0dd8fd850c1df8d16414daad90ad8b0ea35a769d78626039aa"
+}
diff --git a/backend/.sqlx/query-104b8d267f8f904122973d20629473ac77fad069e7c805cf3c2352bd72f8ffb6.json b/backend/.sqlx/query-104b8d267f8f904122973d20629473ac77fad069e7c805cf3c2352bd72f8ffb6.json
new file mode 100644
index 0000000000..e9fb7a6b3b
--- /dev/null
+++ b/backend/.sqlx/query-104b8d267f8f904122973d20629473ac77fad069e7c805cf3c2352bd72f8ffb6.json
@@ -0,0 +1,22 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT role_overrides FROM workspace_settings WHERE workspace_id = $1",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "role_overrides",
+ "type_info": "Jsonb"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text"
+ ]
+ },
+ "nullable": [
+ true
+ ]
+ },
+ "hash": "104b8d267f8f904122973d20629473ac77fad069e7c805cf3c2352bd72f8ffb6"
+}
diff --git a/backend/.sqlx/query-1966a1c4776492599de66d6d189d399c37957f832485156f703f59bd39cdc2bb.json b/backend/.sqlx/query-1966a1c4776492599de66d6d189d399c37957f832485156f703f59bd39cdc2bb.json
new file mode 100644
index 0000000000..7f1ebcf9dc
--- /dev/null
+++ b/backend/.sqlx/query-1966a1c4776492599de66d6d189d399c37957f832485156f703f59bd39cdc2bb.json
@@ -0,0 +1,24 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT EXISTS(SELECT 1 FROM variable v\n JOIN account a ON a.workspace_id = v.workspace_id AND a.id = v.account\n WHERE v.workspace_id = $1 AND v.path = $2 AND a.client = $3\n AND a.is_workspace_integration = true)",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "exists",
+ "type_info": "Bool"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Text",
+ "Text"
+ ]
+ },
+ "nullable": [
+ null
+ ]
+ },
+ "hash": "1966a1c4776492599de66d6d189d399c37957f832485156f703f59bd39cdc2bb"
+}
diff --git a/backend/.sqlx/query-44866e040f382b5e12aa21595bd1452aae8ca746348a6ac6b5bba26f5249166f.json b/backend/.sqlx/query-19b9173fad68c2bde71a70d1ce947c20773dd4c44f19b47e73e24438f5c78ab3.json
similarity index 78%
rename from backend/.sqlx/query-44866e040f382b5e12aa21595bd1452aae8ca746348a6ac6b5bba26f5249166f.json
rename to backend/.sqlx/query-19b9173fad68c2bde71a70d1ce947c20773dd4c44f19b47e73e24438f5c78ab3.json
index 212f6f067b..e66aabbcfb 100644
--- a/backend/.sqlx/query-44866e040f382b5e12aa21595bd1452aae8ca746348a6ac6b5bba26f5249166f.json
+++ b/backend/.sqlx/query-19b9173fad68c2bde71a70d1ce947c20773dd4c44f19b47e73e24438f5c78ab3.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "SELECT c.workspace_id, c.agent_path, c.is_default FROM slack_agent_channel c\n JOIN workspace_settings ws ON ws.workspace_id = c.workspace_id\n AND ws.slack_team_id = c.slack_team_id\n WHERE c.slack_team_id = $1 AND c.channel_id = $2 ORDER BY c.agent_path",
+ "query": "SELECT c.workspace_id, c.agent_path, c.is_default FROM slack_agent_channel c\n JOIN workspace_settings ws ON ws.workspace_id = c.workspace_id\n AND ws.slack_team_id = c.slack_team_id\n WHERE c.slack_team_id = $1 AND c.channel_id = $2\n AND ws.workspace_id = ANY($3)\n ORDER BY c.agent_path",
"describe": {
"columns": [
{
@@ -22,7 +22,8 @@
"parameters": {
"Left": [
"Text",
- "Text"
+ "Text",
+ "TextArray"
]
},
"nullable": [
@@ -31,5 +32,5 @@
false
]
},
- "hash": "44866e040f382b5e12aa21595bd1452aae8ca746348a6ac6b5bba26f5249166f"
+ "hash": "19b9173fad68c2bde71a70d1ce947c20773dd4c44f19b47e73e24438f5c78ab3"
}
diff --git a/backend/.sqlx/query-1c97bf1af258b43fb8dedd3417d0e086996d5fcc3c270e5c1cc9824c30d82726.json b/backend/.sqlx/query-1c97bf1af258b43fb8dedd3417d0e086996d5fcc3c270e5c1cc9824c30d82726.json
new file mode 100644
index 0000000000..bc0ce67103
--- /dev/null
+++ b/backend/.sqlx/query-1c97bf1af258b43fb8dedd3417d0e086996d5fcc3c270e5c1cc9824c30d82726.json
@@ -0,0 +1,17 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "UPDATE usr SET workspace_role = $1, operator = $2 WHERE username = $3 AND workspace_id = $4",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Varchar",
+ "Bool",
+ "Text",
+ "Text"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "1c97bf1af258b43fb8dedd3417d0e086996d5fcc3c270e5c1cc9824c30d82726"
+}
diff --git a/backend/.sqlx/query-61f3627cbd2a50b745c4e491ed8ee71e58db22b7f53202c5360a01c92091fc08.json b/backend/.sqlx/query-1cf81ee935e6e820463820519e3a402d5290b494dac690c9a11f121eeefeab8e.json
similarity index 56%
rename from backend/.sqlx/query-61f3627cbd2a50b745c4e491ed8ee71e58db22b7f53202c5360a01c92091fc08.json
rename to backend/.sqlx/query-1cf81ee935e6e820463820519e3a402d5290b494dac690c9a11f121eeefeab8e.json
index f97d5e310a..da40d27d9f 100644
--- a/backend/.sqlx/query-61f3627cbd2a50b745c4e491ed8ee71e58db22b7f53202c5360a01c92091fc08.json
+++ b/backend/.sqlx/query-1cf81ee935e6e820463820519e3a402d5290b494dac690c9a11f121eeefeab8e.json
@@ -1,12 +1,12 @@
{
"db_name": "PostgreSQL",
- "query": "SELECT value, is_secret\n FROM variable\n WHERE path = $1 AND workspace_id = $2",
+ "query": "SELECT value::text AS \"value!\", is_secret FROM variable WHERE path = $1 AND workspace_id = $2",
"describe": {
"columns": [
{
"ordinal": 0,
- "name": "value",
- "type_info": "Varchar"
+ "name": "value!",
+ "type_info": "Text"
},
{
"ordinal": 1,
@@ -21,9 +21,9 @@
]
},
"nullable": [
- false,
+ null,
false
]
},
- "hash": "61f3627cbd2a50b745c4e491ed8ee71e58db22b7f53202c5360a01c92091fc08"
+ "hash": "1cf81ee935e6e820463820519e3a402d5290b494dac690c9a11f121eeefeab8e"
}
diff --git a/backend/.sqlx/query-1e0751bef92b5628b8d54448da171d56af87b5b263f8484c886e7f51e0198409.json b/backend/.sqlx/query-1e0751bef92b5628b8d54448da171d56af87b5b263f8484c886e7f51e0198409.json
new file mode 100644
index 0000000000..963ca738f2
--- /dev/null
+++ b/backend/.sqlx/query-1e0751bef92b5628b8d54448da171d56af87b5b263f8484c886e7f51e0198409.json
@@ -0,0 +1,47 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT v.path, r.created_by AS \"owner?\", true AS \"workspace!\"\n FROM workspace_integrations wi\n JOIN variable v ON v.workspace_id = wi.workspace_id AND v.path = wi.resource_path\n JOIN account a ON a.workspace_id = v.workspace_id AND a.id = v.account\n LEFT JOIN resource r ON r.workspace_id = v.workspace_id AND r.path = v.path\n WHERE wi.workspace_id = $1 AND wi.service_name = $2\n AND a.client = $3 AND a.is_workspace_integration = true",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "path",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 1,
+ "name": "owner?",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 2,
+ "name": "workspace!",
+ "type_info": "Bool"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text",
+ {
+ "Custom": {
+ "name": "native_trigger_service",
+ "kind": {
+ "Enum": [
+ "nextcloud",
+ "google",
+ "github"
+ ]
+ }
+ }
+ },
+ "Text"
+ ]
+ },
+ "nullable": [
+ false,
+ true,
+ null
+ ]
+ },
+ "hash": "1e0751bef92b5628b8d54448da171d56af87b5b263f8484c886e7f51e0198409"
+}
diff --git a/backend/.sqlx/query-1fbb8493d20eacea2ac78c4473a85f96bd91de548185238f9fd66ac2b4a1e0a0.json b/backend/.sqlx/query-1fbb8493d20eacea2ac78c4473a85f96bd91de548185238f9fd66ac2b4a1e0a0.json
new file mode 100644
index 0000000000..084ae3562e
--- /dev/null
+++ b/backend/.sqlx/query-1fbb8493d20eacea2ac78c4473a85f96bd91de548185238f9fd66ac2b4a1e0a0.json
@@ -0,0 +1,52 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT\n workspace_invite.workspace_id,\n workspace_invite.email,\n workspace_invite.is_admin,\n workspace_invite.operator,\n COALESCE(workspace_invite.workspace_role, CASE WHEN workspace_invite.operator THEN 'operator' ELSE 'developer' END) AS \"role!\",\n workspace.parent_workspace_id\n FROM workspace_invite JOIN workspace ON workspace_invite.workspace_id = workspace.id\n WHERE workspace_id = $1\n ORDER BY workspace_invite.email",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "workspace_id",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 1,
+ "name": "email",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 2,
+ "name": "is_admin",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 3,
+ "name": "operator",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 4,
+ "name": "role!",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 5,
+ "name": "parent_workspace_id",
+ "type_info": "Varchar"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text"
+ ]
+ },
+ "nullable": [
+ false,
+ false,
+ false,
+ false,
+ null,
+ true
+ ]
+ },
+ "hash": "1fbb8493d20eacea2ac78c4473a85f96bd91de548185238f9fd66ac2b4a1e0a0"
+}
diff --git a/backend/.sqlx/query-205f2fb7629382294e53869aa5d2f722f631882929086c453b5825ab4b9c1cb8.json b/backend/.sqlx/query-205f2fb7629382294e53869aa5d2f722f631882929086c453b5825ab4b9c1cb8.json
new file mode 100644
index 0000000000..e7b50bb89a
--- /dev/null
+++ b/backend/.sqlx/query-205f2fb7629382294e53869aa5d2f722f631882929086c453b5825ab4b9c1cb8.json
@@ -0,0 +1,23 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT COUNT(*) FROM usr t WHERE ($1::text IS NULL OR t.workspace_id = $1) AND\n COALESCE(t.workspace_role, CASE WHEN t.operator THEN 'operator' ELSE 'developer' END) = $2",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "count",
+ "type_info": "Int8"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Text"
+ ]
+ },
+ "nullable": [
+ null
+ ]
+ },
+ "hash": "205f2fb7629382294e53869aa5d2f722f631882929086c453b5825ab4b9c1cb8"
+}
diff --git a/backend/.sqlx/query-22e14fc3bb5d8cf3006f0002e8522b8cc0b2fece43f03c0f025e7acefa0d4f32.json b/backend/.sqlx/query-22e14fc3bb5d8cf3006f0002e8522b8cc0b2fece43f03c0f025e7acefa0d4f32.json
index 3df72f8955..6e8e17ddf2 100644
--- a/backend/.sqlx/query-22e14fc3bb5d8cf3006f0002e8522b8cc0b2fece43f03c0f025e7acefa0d4f32.json
+++ b/backend/.sqlx/query-22e14fc3bb5d8cf3006f0002e8522b8cc0b2fece43f03c0f025e7acefa0d4f32.json
@@ -17,7 +17,8 @@
"script",
"flow",
"raw_app",
- "asset"
+ "asset",
+ "agent"
]
}
}
diff --git a/backend/.sqlx/query-23b2a39e37e93ca9367e954eba94b1a6f432edb76320c50e0d07088937c17a01.json b/backend/.sqlx/query-23b2a39e37e93ca9367e954eba94b1a6f432edb76320c50e0d07088937c17a01.json
new file mode 100644
index 0000000000..de6cf870b5
--- /dev/null
+++ b/backend/.sqlx/query-23b2a39e37e93ca9367e954eba94b1a6f432edb76320c50e0d07088937c17a01.json
@@ -0,0 +1,23 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT expires_at FROM account WHERE workspace_id = $1 AND id = $2",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "expires_at",
+ "type_info": "Timestamptz"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Int4"
+ ]
+ },
+ "nullable": [
+ false
+ ]
+ },
+ "hash": "23b2a39e37e93ca9367e954eba94b1a6f432edb76320c50e0d07088937c17a01"
+}
diff --git a/backend/.sqlx/query-257b3bc19f738fe36e3c995c5ba239e1f2855cf39f9fe7a92d722732653fd98b.json b/backend/.sqlx/query-257b3bc19f738fe36e3c995c5ba239e1f2855cf39f9fe7a92d722732653fd98b.json
new file mode 100644
index 0000000000..82a4b1377b
--- /dev/null
+++ b/backend/.sqlx/query-257b3bc19f738fe36e3c995c5ba239e1f2855cf39f9fe7a92d722732653fd98b.json
@@ -0,0 +1,22 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT user_email FROM mcp_oauth_refresh_token WHERE refresh_token = $1",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "user_email",
+ "type_info": "Varchar"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text"
+ ]
+ },
+ "nullable": [
+ false
+ ]
+ },
+ "hash": "257b3bc19f738fe36e3c995c5ba239e1f2855cf39f9fe7a92d722732653fd98b"
+}
diff --git a/backend/.sqlx/query-25b09b592b6917214fd7cfabfece48d266b2d5dc11236c2bb41b1a927ede63d8.json b/backend/.sqlx/query-25b09b592b6917214fd7cfabfece48d266b2d5dc11236c2bb41b1a927ede63d8.json
new file mode 100644
index 0000000000..ed1e19e7e0
--- /dev/null
+++ b/backend/.sqlx/query-25b09b592b6917214fd7cfabfece48d266b2d5dc11236c2bb41b1a927ede63d8.json
@@ -0,0 +1,15 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "INSERT INTO usr (workspace_id, username, email, is_admin, created_at, operator, disabled, role, workspace_role) SELECT $1, username, email, is_admin, created_at, operator, disabled, role, workspace_role FROM usr WHERE workspace_id = $2",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Varchar",
+ "Text"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "25b09b592b6917214fd7cfabfece48d266b2d5dc11236c2bb41b1a927ede63d8"
+}
diff --git a/backend/.sqlx/query-a588f4caa014008b50eccd09122b09f8a098e58791893bacaaf2ff67a30c031c.json b/backend/.sqlx/query-2602402bedcdbc45cdc0d64a76ce075c6ae51404037b0a7d4d33faf6a7d6a6d8.json
similarity index 55%
rename from backend/.sqlx/query-a588f4caa014008b50eccd09122b09f8a098e58791893bacaaf2ff67a30c031c.json
rename to backend/.sqlx/query-2602402bedcdbc45cdc0d64a76ce075c6ae51404037b0a7d4d33faf6a7d6a6d8.json
index 2412e1f5ee..8a131d8465 100644
--- a/backend/.sqlx/query-a588f4caa014008b50eccd09122b09f8a098e58791893bacaaf2ff67a30c031c.json
+++ b/backend/.sqlx/query-2602402bedcdbc45cdc0d64a76ce075c6ae51404037b0a7d4d33faf6a7d6a6d8.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "\n INSERT INTO workspace_integrations (\n workspace_id,\n service_name,\n oauth_data,\n resource_path,\n created_by,\n created_at,\n updated_at\n ) VALUES (\n $1, $2, $3, $4, $5, now(), now()\n )\n ON CONFLICT (workspace_id, service_name)\n DO UPDATE SET\n oauth_data = $3,\n resource_path = $4,\n updated_at = now()\n ",
+ "query": "\n INSERT INTO workspace_integrations (\n workspace_id,\n service_name,\n oauth_data,\n created_by,\n created_at,\n updated_at\n ) VALUES (\n $1, $2, $3, $4, now(), now()\n )\n ON CONFLICT (workspace_id, service_name)\n DO UPDATE SET\n oauth_data = $3,\n updated_at = now()\n ",
"describe": {
"columns": [],
"parameters": {
@@ -19,11 +19,10 @@
}
},
"Jsonb",
- "Text",
"Varchar"
]
},
"nullable": []
},
- "hash": "a588f4caa014008b50eccd09122b09f8a098e58791893bacaaf2ff67a30c031c"
+ "hash": "2602402bedcdbc45cdc0d64a76ce075c6ae51404037b0a7d4d33faf6a7d6a6d8"
}
diff --git a/backend/.sqlx/query-2e8a53e73c3b5c2662efd0e2876f168c2f79258fb900199e8575973d5b3d32bb.json b/backend/.sqlx/query-2e8a53e73c3b5c2662efd0e2876f168c2f79258fb900199e8575973d5b3d32bb.json
new file mode 100644
index 0000000000..d55c6ebb51
--- /dev/null
+++ b/backend/.sqlx/query-2e8a53e73c3b5c2662efd0e2876f168c2f79258fb900199e8575973d5b3d32bb.json
@@ -0,0 +1,94 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT workspace.id, workspace.name, usr.username, workspace_settings.color, workspace.parent_workspace_id,\n workspace.is_dev_workspace, workspace.dev_workspace_label,\n workspace.owner AS \"created_by?\",\n usr.is_admin, usr.operator, usr.workspace_role,\n usr.disabled, usr.is_service_account\n FROM workspace\n JOIN usr ON usr.workspace_id = workspace.id\n JOIN workspace_settings ON workspace_settings.workspace_id = workspace.id\n WHERE usr.email = $1 AND workspace.deleted = false",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "id",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 1,
+ "name": "name",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 2,
+ "name": "username",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 3,
+ "name": "color",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 4,
+ "name": "parent_workspace_id",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 5,
+ "name": "is_dev_workspace",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 6,
+ "name": "dev_workspace_label",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 7,
+ "name": "created_by?",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 8,
+ "name": "is_admin",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 9,
+ "name": "operator",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 10,
+ "name": "workspace_role",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 11,
+ "name": "disabled",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 12,
+ "name": "is_service_account",
+ "type_info": "Bool"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text"
+ ]
+ },
+ "nullable": [
+ false,
+ false,
+ false,
+ true,
+ true,
+ false,
+ true,
+ false,
+ false,
+ false,
+ true,
+ false,
+ false
+ ]
+ },
+ "hash": "2e8a53e73c3b5c2662efd0e2876f168c2f79258fb900199e8575973d5b3d32bb"
+}
diff --git a/backend/.sqlx/query-0010ef26da16facd1c2c832601ac687c4c27de46a90f45496b8446af1a9d0578.json b/backend/.sqlx/query-30b1021260b5ec83a04be1f3dbea08cc81ee85cf98696d9e29a34557587eaf86.json
similarity index 67%
rename from backend/.sqlx/query-0010ef26da16facd1c2c832601ac687c4c27de46a90f45496b8446af1a9d0578.json
rename to backend/.sqlx/query-30b1021260b5ec83a04be1f3dbea08cc81ee85cf98696d9e29a34557587eaf86.json
index cf0754d720..4c0cbba06c 100644
--- a/backend/.sqlx/query-0010ef26da16facd1c2c832601ac687c4c27de46a90f45496b8446af1a9d0578.json
+++ b/backend/.sqlx/query-30b1021260b5ec83a04be1f3dbea08cc81ee85cf98696d9e29a34557587eaf86.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "\n SELECT\n oauth_data as \"oauth_data: sqlx::types::Json\",\n service_name as \"service_name!: ServiceName\",\n resource_path\n FROM\n workspace_integrations\n WHERE\n workspace_id = $1\n ",
+ "query": "\n SELECT\n oauth_data as \"oauth_data: sqlx::types::Json\",\n service_name as \"service_name!: ServiceName\"\n FROM\n workspace_integrations\n WHERE\n workspace_id = $1\n ",
"describe": {
"columns": [
{
@@ -23,11 +23,6 @@
}
}
}
- },
- {
- "ordinal": 2,
- "name": "resource_path",
- "type_info": "Text"
}
],
"parameters": {
@@ -37,9 +32,8 @@
},
"nullable": [
true,
- false,
- true
+ false
]
},
- "hash": "0010ef26da16facd1c2c832601ac687c4c27de46a90f45496b8446af1a9d0578"
+ "hash": "30b1021260b5ec83a04be1f3dbea08cc81ee85cf98696d9e29a34557587eaf86"
}
diff --git a/backend/.sqlx/query-30f69fd4baef17716d26cc59bf6369d6768972478def50010f680103d7c4281b.json b/backend/.sqlx/query-30f69fd4baef17716d26cc59bf6369d6768972478def50010f680103d7c4281b.json
new file mode 100644
index 0000000000..3933b5e6a2
--- /dev/null
+++ b/backend/.sqlx/query-30f69fd4baef17716d26cc59bf6369d6768972478def50010f680103d7c4281b.json
@@ -0,0 +1,41 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT value::text AS \"value!\", is_secret, description, value_valid_until\n FROM variable\n WHERE workspace_id = $1 AND path = $2",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "value!",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 1,
+ "name": "is_secret",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 2,
+ "name": "description",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 3,
+ "name": "value_valid_until",
+ "type_info": "Timestamptz"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Text"
+ ]
+ },
+ "nullable": [
+ null,
+ false,
+ false,
+ true
+ ]
+ },
+ "hash": "30f69fd4baef17716d26cc59bf6369d6768972478def50010f680103d7c4281b"
+}
diff --git a/backend/.sqlx/query-32c7dba63931c9bd35f82f145d095bcfb8f9400809ade1b173bac05d61bfe77a.json b/backend/.sqlx/query-32c7dba63931c9bd35f82f145d095bcfb8f9400809ade1b173bac05d61bfe77a.json
new file mode 100644
index 0000000000..0e2bcbd955
--- /dev/null
+++ b/backend/.sqlx/query-32c7dba63931c9bd35f82f145d095bcfb8f9400809ade1b173bac05d61bfe77a.json
@@ -0,0 +1,24 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "INSERT INTO variable\n (workspace_id, path, value, is_secret, description, account, is_oauth, expires_at, value_valid_until, labels, edited_by)\n VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Varchar",
+ "Varchar",
+ "Varchar",
+ "Bool",
+ "Varchar",
+ "Int4",
+ "Bool",
+ "Timestamptz",
+ "Timestamptz",
+ "TextArray",
+ "Varchar"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "32c7dba63931c9bd35f82f145d095bcfb8f9400809ade1b173bac05d61bfe77a"
+}
diff --git a/backend/.sqlx/query-b656f38e5f1d6a0799767a775b8550027cf7a3bb202269e8dda92d31bc8789dd.json b/backend/.sqlx/query-3420c007c141c5d9e3748c18de03d4b51216ba05e2951ce045ff58112c1db361.json
similarity index 63%
rename from backend/.sqlx/query-b656f38e5f1d6a0799767a775b8550027cf7a3bb202269e8dda92d31bc8789dd.json
rename to backend/.sqlx/query-3420c007c141c5d9e3748c18de03d4b51216ba05e2951ce045ff58112c1db361.json
index 6ad2fc0ae1..b7b2516d40 100644
--- a/backend/.sqlx/query-b656f38e5f1d6a0799767a775b8550027cf7a3bb202269e8dda92d31bc8789dd.json
+++ b/backend/.sqlx/query-3420c007c141c5d9e3748c18de03d4b51216ba05e2951ce045ff58112c1db361.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "SELECT path, value, is_secret FROM variable WHERE workspace_id = $1",
+ "query": "SELECT path, value::text AS \"value!\", is_secret FROM variable WHERE workspace_id = $1",
"describe": {
"columns": [
{
@@ -10,8 +10,8 @@
},
{
"ordinal": 1,
- "name": "value",
- "type_info": "Varchar"
+ "name": "value!",
+ "type_info": "Text"
},
{
"ordinal": 2,
@@ -26,9 +26,9 @@
},
"nullable": [
false,
- false,
+ null,
false
]
},
- "hash": "b656f38e5f1d6a0799767a775b8550027cf7a3bb202269e8dda92d31bc8789dd"
+ "hash": "3420c007c141c5d9e3748c18de03d4b51216ba05e2951ce045ff58112c1db361"
}
diff --git a/backend/.sqlx/query-35238a186adbe0583010dbe8e298a907f16d9e88f648705f2372dfe7c0523879.json b/backend/.sqlx/query-35238a186adbe0583010dbe8e298a907f16d9e88f648705f2372dfe7c0523879.json
new file mode 100644
index 0000000000..027085c2a7
--- /dev/null
+++ b/backend/.sqlx/query-35238a186adbe0583010dbe8e298a907f16d9e88f648705f2372dfe7c0523879.json
@@ -0,0 +1,34 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT workspace_id, slack_oauth_client_id IS NOT NULL AS \"own_app!\",\n slack_signing_secret\n FROM workspace_settings WHERE slack_team_id = $1",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "workspace_id",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 1,
+ "name": "own_app!",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 2,
+ "name": "slack_signing_secret",
+ "type_info": "Text"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text"
+ ]
+ },
+ "nullable": [
+ false,
+ null,
+ true
+ ]
+ },
+ "hash": "35238a186adbe0583010dbe8e298a907f16d9e88f648705f2372dfe7c0523879"
+}
diff --git a/backend/.sqlx/query-36121d10cb03d45fc14aacd08750fb944a54c1172ffa2b990ba157e676f66f51.json b/backend/.sqlx/query-36121d10cb03d45fc14aacd08750fb944a54c1172ffa2b990ba157e676f66f51.json
new file mode 100644
index 0000000000..8d7e440538
--- /dev/null
+++ b/backend/.sqlx/query-36121d10cb03d45fc14aacd08750fb944a54c1172ffa2b990ba157e676f66f51.json
@@ -0,0 +1,36 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT v.value::text AS \"value!\", a.id AS account_id, a.refresh_token\n FROM variable v\n JOIN account a ON a.workspace_id = v.workspace_id AND a.id = v.account\n WHERE v.workspace_id = $1 AND v.path = $2\n AND a.client = $3 AND a.is_workspace_integration = true",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "value!",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 1,
+ "name": "account_id",
+ "type_info": "Int4"
+ },
+ {
+ "ordinal": 2,
+ "name": "refresh_token",
+ "type_info": "Varchar"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Text",
+ "Text"
+ ]
+ },
+ "nullable": [
+ null,
+ false,
+ false
+ ]
+ },
+ "hash": "36121d10cb03d45fc14aacd08750fb944a54c1172ffa2b990ba157e676f66f51"
+}
diff --git a/backend/.sqlx/query-369f8ecde50af034f06d339ecef8fc55a0113b4156274d03d5af643c3da73fa4.json b/backend/.sqlx/query-369f8ecde50af034f06d339ecef8fc55a0113b4156274d03d5af643c3da73fa4.json
index 501e149fc4..20689e1f0a 100644
--- a/backend/.sqlx/query-369f8ecde50af034f06d339ecef8fc55a0113b4156274d03d5af643c3da73fa4.json
+++ b/backend/.sqlx/query-369f8ecde50af034f06d339ecef8fc55a0113b4156274d03d5af643c3da73fa4.json
@@ -53,7 +53,7 @@
false,
false,
false,
- false,
+ true,
false,
false,
true,
diff --git a/backend/.sqlx/query-63c48fde8c0c0fff9abffc3be27e9948556b636b70b818cc31c2d50921a27366.json b/backend/.sqlx/query-3829559733fa087201f935ee10a5cecf2cec4f1646015ed7cf476efaba67707f.json
similarity index 53%
rename from backend/.sqlx/query-63c48fde8c0c0fff9abffc3be27e9948556b636b70b818cc31c2d50921a27366.json
rename to backend/.sqlx/query-3829559733fa087201f935ee10a5cecf2cec4f1646015ed7cf476efaba67707f.json
index 0ba2d18257..af7a60664d 100644
--- a/backend/.sqlx/query-63c48fde8c0c0fff9abffc3be27e9948556b636b70b818cc31c2d50921a27366.json
+++ b/backend/.sqlx/query-3829559733fa087201f935ee10a5cecf2cec4f1646015ed7cf476efaba67707f.json
@@ -1,42 +1,62 @@
{
"db_name": "PostgreSQL",
- "query": "SELECT client, refresh_token, grant_type, cc_client_id, cc_client_secret, cc_token_url, scopes FROM account WHERE workspace_id = $1 AND id = $2",
+ "query": "SELECT mcp_server_url, is_workspace_integration, client, refresh_token, grant_type,\n cc_client_id, cc_client_secret, cc_token_url, scopes, expires_at,\n now() > expires_at AS \"expired!\"\n FROM account WHERE workspace_id = $1 AND id = $2",
"describe": {
"columns": [
{
"ordinal": 0,
+ "name": "mcp_server_url",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 1,
+ "name": "is_workspace_integration",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 2,
"name": "client",
"type_info": "Varchar"
},
{
- "ordinal": 1,
+ "ordinal": 3,
"name": "refresh_token",
"type_info": "Varchar"
},
{
- "ordinal": 2,
+ "ordinal": 4,
"name": "grant_type",
"type_info": "Varchar"
},
{
- "ordinal": 3,
+ "ordinal": 5,
"name": "cc_client_id",
"type_info": "Varchar"
},
{
- "ordinal": 4,
+ "ordinal": 6,
"name": "cc_client_secret",
"type_info": "Varchar"
},
{
- "ordinal": 5,
+ "ordinal": 7,
"name": "cc_token_url",
"type_info": "Varchar"
},
{
- "ordinal": 6,
+ "ordinal": 8,
"name": "scopes",
"type_info": "TextArray"
+ },
+ {
+ "ordinal": 9,
+ "name": "expires_at",
+ "type_info": "Timestamptz"
+ },
+ {
+ "ordinal": 10,
+ "name": "expired!",
+ "type_info": "Bool"
}
],
"parameters": {
@@ -46,14 +66,18 @@
]
},
"nullable": [
+ true,
+ false,
false,
false,
false,
true,
true,
true,
- true
+ true,
+ false,
+ null
]
},
- "hash": "63c48fde8c0c0fff9abffc3be27e9948556b636b70b818cc31c2d50921a27366"
+ "hash": "3829559733fa087201f935ee10a5cecf2cec4f1646015ed7cf476efaba67707f"
}
diff --git a/backend/.sqlx/query-392b256dd7f36ec3736fc2f9d564dc198a6b69d62fb244691af0601e542b6ac3.json b/backend/.sqlx/query-392b256dd7f36ec3736fc2f9d564dc198a6b69d62fb244691af0601e542b6ac3.json
new file mode 100644
index 0000000000..1b5aa1bd1f
--- /dev/null
+++ b/backend/.sqlx/query-392b256dd7f36ec3736fc2f9d564dc198a6b69d62fb244691af0601e542b6ac3.json
@@ -0,0 +1,23 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT EXISTS(SELECT 1 FROM resource WHERE workspace_id = $1 AND path = $2 AND resource_type = 'ai_agent')",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "exists",
+ "type_info": "Bool"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Text"
+ ]
+ },
+ "nullable": [
+ null
+ ]
+ },
+ "hash": "392b256dd7f36ec3736fc2f9d564dc198a6b69d62fb244691af0601e542b6ac3"
+}
diff --git a/backend/.sqlx/query-3b01c43a828ec5d61ed92a27bdb16b526db8e60887d6279b0e66197da686fbf8.json b/backend/.sqlx/query-3b01c43a828ec5d61ed92a27bdb16b526db8e60887d6279b0e66197da686fbf8.json
new file mode 100644
index 0000000000..02871b22f1
--- /dev/null
+++ b/backend/.sqlx/query-3b01c43a828ec5d61ed92a27bdb16b526db8e60887d6279b0e66197da686fbf8.json
@@ -0,0 +1,19 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "INSERT INTO usr (workspace_id, username, email, is_admin, operator, added_via, workspace_role) VALUES ($1, $2, $3, false, $4, $5, $6) ON CONFLICT DO NOTHING",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Varchar",
+ "Varchar",
+ "Varchar",
+ "Bool",
+ "Jsonb",
+ "Varchar"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "3b01c43a828ec5d61ed92a27bdb16b526db8e60887d6279b0e66197da686fbf8"
+}
diff --git a/backend/.sqlx/query-3c951e76bd0d86a488372e54fdfe4f5a2923cff642905c6410267be2eab24853.json b/backend/.sqlx/query-3c951e76bd0d86a488372e54fdfe4f5a2923cff642905c6410267be2eab24853.json
new file mode 100644
index 0000000000..a41e413243
--- /dev/null
+++ b/backend/.sqlx/query-3c951e76bd0d86a488372e54fdfe4f5a2923cff642905c6410267be2eab24853.json
@@ -0,0 +1,23 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT EXISTS(SELECT 1 FROM script WHERE workspace_id = $1 AND path = $2 AND archived = false AND deleted = false)",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "exists",
+ "type_info": "Bool"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Text"
+ ]
+ },
+ "nullable": [
+ null
+ ]
+ },
+ "hash": "3c951e76bd0d86a488372e54fdfe4f5a2923cff642905c6410267be2eab24853"
+}
diff --git a/backend/.sqlx/query-7443ba1f922e190bb9a0ca313847f8d27c35a6ee3aff20157d6285e73aa923ef.json b/backend/.sqlx/query-3e5bdc2e071fc2f1e3c7971736272f20bb5a0aa921a614bd02898d3f162660c2.json
similarity index 76%
rename from backend/.sqlx/query-7443ba1f922e190bb9a0ca313847f8d27c35a6ee3aff20157d6285e73aa923ef.json
rename to backend/.sqlx/query-3e5bdc2e071fc2f1e3c7971736272f20bb5a0aa921a614bd02898d3f162660c2.json
index 4ac58627e7..984c702467 100644
--- a/backend/.sqlx/query-7443ba1f922e190bb9a0ca313847f8d27c35a6ee3aff20157d6285e73aa923ef.json
+++ b/backend/.sqlx/query-3e5bdc2e071fc2f1e3c7971736272f20bb5a0aa921a614bd02898d3f162660c2.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "\n SELECT\n workspace_id,\n service_name AS \"service_name!: ServiceName\",\n oauth_data,\n resource_path,\n created_at,\n updated_at,\n created_by\n FROM\n workspace_integrations\n WHERE\n workspace_id = $1\n AND service_name = $2\n ",
+ "query": "\n SELECT\n workspace_id,\n service_name AS \"service_name!: ServiceName\",\n oauth_data,\n created_at,\n updated_at,\n created_by\n FROM\n workspace_integrations\n WHERE\n workspace_id = $1\n AND service_name = $2\n ",
"describe": {
"columns": [
{
@@ -31,21 +31,16 @@
},
{
"ordinal": 3,
- "name": "resource_path",
- "type_info": "Text"
- },
- {
- "ordinal": 4,
"name": "created_at",
"type_info": "Timestamptz"
},
{
- "ordinal": 5,
+ "ordinal": 4,
"name": "updated_at",
"type_info": "Timestamptz"
},
{
- "ordinal": 6,
+ "ordinal": 5,
"name": "created_by",
"type_info": "Varchar"
}
@@ -71,11 +66,10 @@
false,
false,
true,
- true,
false,
false,
false
]
},
- "hash": "7443ba1f922e190bb9a0ca313847f8d27c35a6ee3aff20157d6285e73aa923ef"
+ "hash": "3e5bdc2e071fc2f1e3c7971736272f20bb5a0aa921a614bd02898d3f162660c2"
}
diff --git a/backend/.sqlx/query-40790b7f44b40b0c64bbabd3bc6c984000e12f33bc1cea460e8f5dd55ea59eec.json b/backend/.sqlx/query-40790b7f44b40b0c64bbabd3bc6c984000e12f33bc1cea460e8f5dd55ea59eec.json
new file mode 100644
index 0000000000..ab8bc4e241
--- /dev/null
+++ b/backend/.sqlx/query-40790b7f44b40b0c64bbabd3bc6c984000e12f33bc1cea460e8f5dd55ea59eec.json
@@ -0,0 +1,23 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT value::text AS \"value!\" FROM variable WHERE workspace_id = $1 AND path = $2",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "value!",
+ "type_info": "Text"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Text"
+ ]
+ },
+ "nullable": [
+ null
+ ]
+ },
+ "hash": "40790b7f44b40b0c64bbabd3bc6c984000e12f33bc1cea460e8f5dd55ea59eec"
+}
diff --git a/backend/.sqlx/query-420707b82c44c7a30719c4419bdd3b4382f863d7c84f18af64e1d3930890a210.json b/backend/.sqlx/query-420707b82c44c7a30719c4419bdd3b4382f863d7c84f18af64e1d3930890a210.json
new file mode 100644
index 0000000000..2b0a574473
--- /dev/null
+++ b/backend/.sqlx/query-420707b82c44c7a30719c4419bdd3b4382f863d7c84f18af64e1d3930890a210.json
@@ -0,0 +1,20 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT EXISTS (SELECT 1 FROM workspace_diff\n WHERE fork_workspace_id = 'wm-fork-renamed' AND kind = 'script'\n AND path = 'u/admin/inline' AND fork_last_event_kind = 'write')",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "exists",
+ "type_info": "Bool"
+ }
+ ],
+ "parameters": {
+ "Left": []
+ },
+ "nullable": [
+ null
+ ]
+ },
+ "hash": "420707b82c44c7a30719c4419bdd3b4382f863d7c84f18af64e1d3930890a210"
+}
diff --git a/backend/.sqlx/query-464286216add454cb64dba810d964c4b6a41d96df223b6d3d1d1bc972ab10d42.json b/backend/.sqlx/query-464286216add454cb64dba810d964c4b6a41d96df223b6d3d1d1bc972ab10d42.json
new file mode 100644
index 0000000000..43bb3da025
--- /dev/null
+++ b/backend/.sqlx/query-464286216add454cb64dba810d964c4b6a41d96df223b6d3d1d1bc972ab10d42.json
@@ -0,0 +1,16 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "INSERT INTO usr (workspace_id, username, email, is_admin, created_at, operator, disabled, role, is_service_account, added_via, workspace_role)\n SELECT $1, username, email, is_admin, created_at, operator, disabled, role, is_service_account,\n CASE WHEN $3 THEN NULL ELSE added_via END, workspace_role\n FROM usr WHERE workspace_id = $2\n AND (NOT $3 OR (NOT operator AND NOT disabled AND NOT is_service_account))\n ON CONFLICT DO NOTHING",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Varchar",
+ "Text",
+ "Bool"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "464286216add454cb64dba810d964c4b6a41d96df223b6d3d1d1bc972ab10d42"
+}
diff --git a/backend/.sqlx/query-4ba98c3b07a3bd2fa51e4ddf93c182b3ac165cb6a343ad616409fa80b4b93484.json b/backend/.sqlx/query-4ba98c3b07a3bd2fa51e4ddf93c182b3ac165cb6a343ad616409fa80b4b93484.json
new file mode 100644
index 0000000000..8cead5cb8e
--- /dev/null
+++ b/backend/.sqlx/query-4ba98c3b07a3bd2fa51e4ddf93c182b3ac165cb6a343ad616409fa80b4b93484.json
@@ -0,0 +1,22 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "UPDATE workspace_settings SET variable_expiration_failed_at = NULL\n WHERE workspace_id = $1 AND variable_expiration_failed_at IS NOT NULL\n RETURNING 1",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "?column?",
+ "type_info": "Int4"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text"
+ ]
+ },
+ "nullable": [
+ null
+ ]
+ },
+ "hash": "4ba98c3b07a3bd2fa51e4ddf93c182b3ac165cb6a343ad616409fa80b4b93484"
+}
diff --git a/backend/.sqlx/query-6c75c89fb215c646f54f2036c40a86a4f4ea8880cc5d0b511aa70b6fd50072c5.json b/backend/.sqlx/query-4c12e63ddcf4e8cfe2227421db8869c4fb77e2fa3b98d6b054995875f3fd5a10.json
similarity index 68%
rename from backend/.sqlx/query-6c75c89fb215c646f54f2036c40a86a4f4ea8880cc5d0b511aa70b6fd50072c5.json
rename to backend/.sqlx/query-4c12e63ddcf4e8cfe2227421db8869c4fb77e2fa3b98d6b054995875f3fd5a10.json
index 45605c04dd..b07b2ae6b5 100644
--- a/backend/.sqlx/query-6c75c89fb215c646f54f2036c40a86a4f4ea8880cc5d0b511aa70b6fd50072c5.json
+++ b/backend/.sqlx/query-4c12e63ddcf4e8cfe2227421db8869c4fb77e2fa3b98d6b054995875f3fd5a10.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "SELECT external_id, webhook_token_hash FROM native_trigger WHERE workspace_id = $1 AND service_name = $2",
+ "query": "SELECT external_id, script_path FROM native_trigger\n WHERE workspace_id = $1 AND service_name = $2 AND connection_path = $3",
"describe": {
"columns": [
{
@@ -10,7 +10,7 @@
},
{
"ordinal": 1,
- "name": "webhook_token_hash",
+ "name": "script_path",
"type_info": "Varchar"
}
],
@@ -28,7 +28,8 @@
]
}
}
- }
+ },
+ "Text"
]
},
"nullable": [
@@ -36,5 +37,5 @@
false
]
},
- "hash": "6c75c89fb215c646f54f2036c40a86a4f4ea8880cc5d0b511aa70b6fd50072c5"
+ "hash": "4c12e63ddcf4e8cfe2227421db8869c4fb77e2fa3b98d6b054995875f3fd5a10"
}
diff --git a/backend/.sqlx/query-4c74a75d99f8d6689470da1d57d3db8bf47f11969a0c026a35a6673574e074d8.json b/backend/.sqlx/query-4c74a75d99f8d6689470da1d57d3db8bf47f11969a0c026a35a6673574e074d8.json
new file mode 100644
index 0000000000..fd576892db
--- /dev/null
+++ b/backend/.sqlx/query-4c74a75d99f8d6689470da1d57d3db8bf47f11969a0c026a35a6673574e074d8.json
@@ -0,0 +1,19 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "INSERT INTO usr\n (workspace_id, email, username, is_admin, operator, workspace_role)\n VALUES ($1, $2, $3, $4, $5, $6)",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Varchar",
+ "Varchar",
+ "Varchar",
+ "Bool",
+ "Bool",
+ "Varchar"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "4c74a75d99f8d6689470da1d57d3db8bf47f11969a0c026a35a6673574e074d8"
+}
diff --git a/backend/.sqlx/query-4d48a34016cc642fe3b3b24220615a59165009048a7c93942ee2ecd78524fb5a.json b/backend/.sqlx/query-4d48a34016cc642fe3b3b24220615a59165009048a7c93942ee2ecd78524fb5a.json
new file mode 100644
index 0000000000..430c45c995
--- /dev/null
+++ b/backend/.sqlx/query-4d48a34016cc642fe3b3b24220615a59165009048a7c93942ee2ecd78524fb5a.json
@@ -0,0 +1,15 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "DELETE FROM resource WHERE workspace_id = $1 AND path = ANY($2)",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Text",
+ "TextArray"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "4d48a34016cc642fe3b3b24220615a59165009048a7c93942ee2ecd78524fb5a"
+}
diff --git a/backend/.sqlx/query-51a30b84aedb4852ea78a4bf6a9f7c5090f6ed3b4d9d03fa5b5a827ffa39c635.json b/backend/.sqlx/query-51a30b84aedb4852ea78a4bf6a9f7c5090f6ed3b4d9d03fa5b5a827ffa39c635.json
new file mode 100644
index 0000000000..e6194747b2
--- /dev/null
+++ b/backend/.sqlx/query-51a30b84aedb4852ea78a4bf6a9f7c5090f6ed3b4d9d03fa5b5a827ffa39c635.json
@@ -0,0 +1,15 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "DELETE FROM account WHERE workspace_id = $1 AND id = $2 AND is_workspace_integration = true\n AND NOT EXISTS (SELECT 1 FROM variable WHERE workspace_id = $1 AND account = $2)",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Int4"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "51a30b84aedb4852ea78a4bf6a9f7c5090f6ed3b4d9d03fa5b5a827ffa39c635"
+}
diff --git a/backend/.sqlx/query-5294237a0bb6b23aed6915f430ac595c6f0d6f215725132fb7ef33bb1847831d.json b/backend/.sqlx/query-5294237a0bb6b23aed6915f430ac595c6f0d6f215725132fb7ef33bb1847831d.json
new file mode 100644
index 0000000000..3c3870611e
--- /dev/null
+++ b/backend/.sqlx/query-5294237a0bb6b23aed6915f430ac595c6f0d6f215725132fb7ef33bb1847831d.json
@@ -0,0 +1,28 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "INSERT INTO workspace_integrations (workspace_id, service_name, oauth_data, created_by)\n VALUES ($1, $2, $3, $4)\n ON CONFLICT (workspace_id, service_name) DO NOTHING",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Varchar",
+ {
+ "Custom": {
+ "name": "native_trigger_service",
+ "kind": {
+ "Enum": [
+ "nextcloud",
+ "google",
+ "github"
+ ]
+ }
+ }
+ },
+ "Jsonb",
+ "Varchar"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "5294237a0bb6b23aed6915f430ac595c6f0d6f215725132fb7ef33bb1847831d"
+}
diff --git a/backend/.sqlx/query-56bb398d53c1c54b27fe3b61b866c752ea54871db71a8859311e18bf6b6da82c.json b/backend/.sqlx/query-56bb398d53c1c54b27fe3b61b866c752ea54871db71a8859311e18bf6b6da82c.json
new file mode 100644
index 0000000000..17a9650d3e
--- /dev/null
+++ b/backend/.sqlx/query-56bb398d53c1c54b27fe3b61b866c752ea54871db71a8859311e18bf6b6da82c.json
@@ -0,0 +1,23 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT value AS \"value: sqlx::types::Json\"\n FROM resource WHERE workspace_id = $1 AND path = $2 AND resource_type = 'ai_agent'",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "value: sqlx::types::Json",
+ "type_info": "Jsonb"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Text"
+ ]
+ },
+ "nullable": [
+ true
+ ]
+ },
+ "hash": "56bb398d53c1c54b27fe3b61b866c752ea54871db71a8859311e18bf6b6da82c"
+}
diff --git a/backend/.sqlx/query-59e359ec5307da46b7fb75d0a2ada7abd1836ec53fdc8086aa160735843f62b9.json b/backend/.sqlx/query-59e359ec5307da46b7fb75d0a2ada7abd1836ec53fdc8086aa160735843f62b9.json
new file mode 100644
index 0000000000..802c83dd7f
--- /dev/null
+++ b/backend/.sqlx/query-59e359ec5307da46b7fb75d0a2ada7abd1836ec53fdc8086aa160735843f62b9.json
@@ -0,0 +1,36 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "DELETE FROM native_trigger\n WHERE workspace_id = $1 AND service_name = $2 AND ($3::text[] IS NULL\n OR (external_id, script_path) IN (SELECT * FROM unnest($3::text[], $4::text[])))\n RETURNING webhook_token_hash",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "webhook_token_hash",
+ "type_info": "Varchar"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text",
+ {
+ "Custom": {
+ "name": "native_trigger_service",
+ "kind": {
+ "Enum": [
+ "nextcloud",
+ "google",
+ "github"
+ ]
+ }
+ }
+ },
+ "TextArray",
+ "TextArray"
+ ]
+ },
+ "nullable": [
+ false
+ ]
+ },
+ "hash": "59e359ec5307da46b7fb75d0a2ada7abd1836ec53fdc8086aa160735843f62b9"
+}
diff --git a/backend/.sqlx/query-5a219a2532517869578c4504ff3153c43903f929ae5d62fbba12610f89c36d55.json b/backend/.sqlx/query-5a219a2532517869578c4504ff3153c43903f929ae5d62fbba12610f89c36d55.json
index 713ccb9dd3..36ddb8ab9f 100644
--- a/backend/.sqlx/query-5a219a2532517869578c4504ff3153c43903f929ae5d62fbba12610f89c36d55.json
+++ b/backend/.sqlx/query-5a219a2532517869578c4504ff3153c43903f929ae5d62fbba12610f89c36d55.json
@@ -15,7 +15,7 @@
]
},
"nullable": [
- null
+ true
]
},
"hash": "5a219a2532517869578c4504ff3153c43903f929ae5d62fbba12610f89c36d55"
diff --git a/backend/.sqlx/query-5af4e97b30d968e2b55f9560c6bb1c3f543964d2c05d2f44f0a7716f890a3fce.json b/backend/.sqlx/query-5af4e97b30d968e2b55f9560c6bb1c3f543964d2c05d2f44f0a7716f890a3fce.json
new file mode 100644
index 0000000000..113d1d6ce0
--- /dev/null
+++ b/backend/.sqlx/query-5af4e97b30d968e2b55f9560c6bb1c3f543964d2c05d2f44f0a7716f890a3fce.json
@@ -0,0 +1,29 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT\n (SELECT created_by FROM resource WHERE workspace_id = $1 AND path = $2) AS \"owner?\",\n EXISTS(SELECT 1 FROM resource WHERE workspace_id = $1 AND path = $2)\n OR EXISTS(SELECT 1 FROM variable WHERE workspace_id = $1 AND path = $2) AS \"taken!\"",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "owner?",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 1,
+ "name": "taken!",
+ "type_info": "Bool"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Text"
+ ]
+ },
+ "nullable": [
+ null,
+ null
+ ]
+ },
+ "hash": "5af4e97b30d968e2b55f9560c6bb1c3f543964d2c05d2f44f0a7716f890a3fce"
+}
diff --git a/backend/.sqlx/query-1587639f13a1a3ad97bd324df38661f3e846f1992704c86ddad74dea151b0ec4.json b/backend/.sqlx/query-5d344853a65a2438c87f12124428609933e4363c11455709e1785228abd3366f.json
similarity index 61%
rename from backend/.sqlx/query-1587639f13a1a3ad97bd324df38661f3e846f1992704c86ddad74dea151b0ec4.json
rename to backend/.sqlx/query-5d344853a65a2438c87f12124428609933e4363c11455709e1785228abd3366f.json
index 0ed678d485..386435e806 100644
--- a/backend/.sqlx/query-1587639f13a1a3ad97bd324df38661f3e846f1992704c86ddad74dea151b0ec4.json
+++ b/backend/.sqlx/query-5d344853a65a2438c87f12124428609933e4363c11455709e1785228abd3366f.json
@@ -1,12 +1,12 @@
{
"db_name": "PostgreSQL",
- "query": "SELECT value, is_secret, path from variable WHERE variable.path = $1 AND variable.workspace_id = $2",
+ "query": "SELECT value::text AS \"value!\", is_secret, path from variable WHERE variable.path = $1 AND variable.workspace_id = $2",
"describe": {
"columns": [
{
"ordinal": 0,
- "name": "value",
- "type_info": "Varchar"
+ "name": "value!",
+ "type_info": "Text"
},
{
"ordinal": 1,
@@ -26,10 +26,10 @@
]
},
"nullable": [
- false,
+ null,
false,
false
]
},
- "hash": "1587639f13a1a3ad97bd324df38661f3e846f1992704c86ddad74dea151b0ec4"
+ "hash": "5d344853a65a2438c87f12124428609933e4363c11455709e1785228abd3366f"
}
diff --git a/backend/.sqlx/query-61c4b826e90badc1307eadfe0c117efc6c8c87ba5542bce9c5f85b1da07e9a4b.json b/backend/.sqlx/query-61c4b826e90badc1307eadfe0c117efc6c8c87ba5542bce9c5f85b1da07e9a4b.json
new file mode 100644
index 0000000000..17347df159
--- /dev/null
+++ b/backend/.sqlx/query-61c4b826e90badc1307eadfe0c117efc6c8c87ba5542bce9c5f85b1da07e9a4b.json
@@ -0,0 +1,16 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "UPDATE account SET\n refresh_token = COALESCE($1, refresh_token),\n expires_at = now() + interval '1 hour',\n refresh_error = NULL\n WHERE workspace_id = $2 AND id = $3",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Varchar",
+ "Text",
+ "Int4"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "61c4b826e90badc1307eadfe0c117efc6c8c87ba5542bce9c5f85b1da07e9a4b"
+}
diff --git a/backend/.sqlx/query-649ef6b8facee43bb9ba5e6413099322f13a7db686176c4a717651c1671b1bae.json b/backend/.sqlx/query-649ef6b8facee43bb9ba5e6413099322f13a7db686176c4a717651c1671b1bae.json
new file mode 100644
index 0000000000..7113138dd7
--- /dev/null
+++ b/backend/.sqlx/query-649ef6b8facee43bb9ba5e6413099322f13a7db686176c4a717651c1671b1bae.json
@@ -0,0 +1,27 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "UPDATE workspace_integrations SET resource_path = NULL\n WHERE workspace_id = $1 AND service_name = $2 AND resource_path = $3",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Text",
+ {
+ "Custom": {
+ "name": "native_trigger_service",
+ "kind": {
+ "Enum": [
+ "nextcloud",
+ "google",
+ "github"
+ ]
+ }
+ }
+ },
+ "Text"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "649ef6b8facee43bb9ba5e6413099322f13a7db686176c4a717651c1671b1bae"
+}
diff --git a/backend/.sqlx/query-653685b39d93008762818d0518b953632040122a9af98332d3fd1d12244b1b80.json b/backend/.sqlx/query-653685b39d93008762818d0518b953632040122a9af98332d3fd1d12244b1b80.json
index e3ef8a7f0a..82604817a0 100644
--- a/backend/.sqlx/query-653685b39d93008762818d0518b953632040122a9af98332d3fd1d12244b1b80.json
+++ b/backend/.sqlx/query-653685b39d93008762818d0518b953632040122a9af98332d3fd1d12244b1b80.json
@@ -17,7 +17,8 @@
"script",
"flow",
"raw_app",
- "asset"
+ "asset",
+ "agent"
]
}
}
diff --git a/backend/.sqlx/query-65acc5b9322f03266079ea6051535168e2cd0e627e3bbff413e38f8a3c616aa0.json b/backend/.sqlx/query-65acc5b9322f03266079ea6051535168e2cd0e627e3bbff413e38f8a3c616aa0.json
new file mode 100644
index 0000000000..213fb4a5d6
--- /dev/null
+++ b/backend/.sqlx/query-65acc5b9322f03266079ea6051535168e2cd0e627e3bbff413e38f8a3c616aa0.json
@@ -0,0 +1,23 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT COUNT(*) FROM workspace_settings WHERE ($1::text IS NULL OR workspace_id = $1) AND (\n auto_invite->>'role' = $2\n OR EXISTS (SELECT 1 FROM jsonb_each_text(\n CASE WHEN jsonb_typeof(auto_invite->'instance_groups_roles') = 'object'\n THEN auto_invite->'instance_groups_roles' ELSE '{}'::jsonb END) g\n WHERE g.value = $2))",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "count",
+ "type_info": "Int8"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Text"
+ ]
+ },
+ "nullable": [
+ null
+ ]
+ },
+ "hash": "65acc5b9322f03266079ea6051535168e2cd0e627e3bbff413e38f8a3c616aa0"
+}
diff --git a/backend/.sqlx/query-68d95ce32653dece237bbf21459b571b8b67d26ffb60dd21e558dfa10612a0ed.json b/backend/.sqlx/query-68d95ce32653dece237bbf21459b571b8b67d26ffb60dd21e558dfa10612a0ed.json
new file mode 100644
index 0000000000..6c40f884ef
--- /dev/null
+++ b/backend/.sqlx/query-68d95ce32653dece237bbf21459b571b8b67d26ffb60dd21e558dfa10612a0ed.json
@@ -0,0 +1,28 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT slack_oauth_client_id IS NOT NULL AS \"own_app!\",\n slack_signing_secret IS NOT NULL AS \"own_secret!\"\n FROM workspace_settings WHERE workspace_id = $1",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "own_app!",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 1,
+ "name": "own_secret!",
+ "type_info": "Bool"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text"
+ ]
+ },
+ "nullable": [
+ null,
+ null
+ ]
+ },
+ "hash": "68d95ce32653dece237bbf21459b571b8b67d26ffb60dd21e558dfa10612a0ed"
+}
diff --git a/backend/.sqlx/query-0c2e53960dc7786c848079b155e62994d4a861f1dbb9752c0a27428d83040e13.json b/backend/.sqlx/query-698758d7ef61b3f1de00088a36fe9f2e94c1c25b02bf324a730e4f734eb61c16.json
similarity index 57%
rename from backend/.sqlx/query-0c2e53960dc7786c848079b155e62994d4a861f1dbb9752c0a27428d83040e13.json
rename to backend/.sqlx/query-698758d7ef61b3f1de00088a36fe9f2e94c1c25b02bf324a730e4f734eb61c16.json
index 5c33539878..17e8d20bb5 100644
--- a/backend/.sqlx/query-0c2e53960dc7786c848079b155e62994d4a861f1dbb9752c0a27428d83040e13.json
+++ b/backend/.sqlx/query-698758d7ef61b3f1de00088a36fe9f2e94c1c25b02bf324a730e4f734eb61c16.json
@@ -1,12 +1,12 @@
{
"db_name": "PostgreSQL",
- "query": "SELECT value, is_secret FROM variable WHERE path = $1",
+ "query": "SELECT value::text AS \"value!\", is_secret FROM variable WHERE path = $1",
"describe": {
"columns": [
{
"ordinal": 0,
- "name": "value",
- "type_info": "Varchar"
+ "name": "value!",
+ "type_info": "Text"
},
{
"ordinal": 1,
@@ -20,9 +20,9 @@
]
},
"nullable": [
- false,
+ null,
false
]
},
- "hash": "0c2e53960dc7786c848079b155e62994d4a861f1dbb9752c0a27428d83040e13"
+ "hash": "698758d7ef61b3f1de00088a36fe9f2e94c1c25b02bf324a730e4f734eb61c16"
}
diff --git a/backend/.sqlx/query-7aa589db3199d7f727cc69e63e1281b7ed329ff0c9d1617747f4ccd6014720cf.json b/backend/.sqlx/query-6be4bf59c404d2f557d1106c48c320bb3eff65255a44bd66799ae14288312ba4.json
similarity index 59%
rename from backend/.sqlx/query-7aa589db3199d7f727cc69e63e1281b7ed329ff0c9d1617747f4ccd6014720cf.json
rename to backend/.sqlx/query-6be4bf59c404d2f557d1106c48c320bb3eff65255a44bd66799ae14288312ba4.json
index b2101cc0d4..0a39db6822 100644
--- a/backend/.sqlx/query-7aa589db3199d7f727cc69e63e1281b7ed329ff0c9d1617747f4ccd6014720cf.json
+++ b/backend/.sqlx/query-6be4bf59c404d2f557d1106c48c320bb3eff65255a44bd66799ae14288312ba4.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "SELECT EXISTS(SELECT 1 FROM variable WHERE account = $1 AND workspace_id = $2)",
+ "query": "SELECT EXISTS(SELECT 1 FROM variable WHERE workspace_id = $1 AND path = $2)",
"describe": {
"columns": [
{
@@ -11,7 +11,7 @@
],
"parameters": {
"Left": [
- "Int4",
+ "Text",
"Text"
]
},
@@ -19,5 +19,5 @@
null
]
},
- "hash": "7aa589db3199d7f727cc69e63e1281b7ed329ff0c9d1617747f4ccd6014720cf"
+ "hash": "6be4bf59c404d2f557d1106c48c320bb3eff65255a44bd66799ae14288312ba4"
}
diff --git a/backend/.sqlx/query-6d856cdf841aa6fb95d82841da3b28d5c5aac9608e8f60e5b76be177e4e105b1.json b/backend/.sqlx/query-6d856cdf841aa6fb95d82841da3b28d5c5aac9608e8f60e5b76be177e4e105b1.json
new file mode 100644
index 0000000000..8cfd36abd6
--- /dev/null
+++ b/backend/.sqlx/query-6d856cdf841aa6fb95d82841da3b28d5c5aac9608e8f60e5b76be177e4e105b1.json
@@ -0,0 +1,12 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "INSERT INTO workspace_diff\n (source_workspace_id, fork_workspace_id, path, kind, ahead, behind, has_changes)\n VALUES\n ('test-workspace', 'wm-fork-secrets', 'u/test-user/same', 'variable', 1, 1, NULL),\n ('test-workspace', 'wm-fork-secrets', 'u/test-user/different', 'variable', 1, 1, NULL)\n ON CONFLICT (source_workspace_id, fork_workspace_id, path, kind)\n DO UPDATE SET ahead = 1, behind = 1, has_changes = NULL",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": []
+ },
+ "nullable": []
+ },
+ "hash": "6d856cdf841aa6fb95d82841da3b28d5c5aac9608e8f60e5b76be177e4e105b1"
+}
diff --git a/backend/.sqlx/query-6e83478011a8f65bf294ad7886139369e386f6a552c6626be48ecaa0e5ab78a7.json b/backend/.sqlx/query-6e83478011a8f65bf294ad7886139369e386f6a552c6626be48ecaa0e5ab78a7.json
deleted file mode 100644
index b765a5eb28..0000000000
--- a/backend/.sqlx/query-6e83478011a8f65bf294ad7886139369e386f6a552c6626be48ecaa0e5ab78a7.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "db_name": "PostgreSQL",
- "query": "UPDATE account SET\n refresh_token = $1,\n expires_at = now() + interval '1 hour',\n refresh_error = NULL\n WHERE workspace_id = $2 AND client = $3 AND is_workspace_integration = true",
- "describe": {
- "columns": [],
- "parameters": {
- "Left": [
- "Varchar",
- "Text",
- "Text"
- ]
- },
- "nullable": []
- },
- "hash": "6e83478011a8f65bf294ad7886139369e386f6a552c6626be48ecaa0e5ab78a7"
-}
diff --git a/backend/.sqlx/query-706872f05247a7d26fcd1b40b129f2defef86f8139dc4e38ae3bf63db039c48b.json b/backend/.sqlx/query-706872f05247a7d26fcd1b40b129f2defef86f8139dc4e38ae3bf63db039c48b.json
new file mode 100644
index 0000000000..aad2908ef5
--- /dev/null
+++ b/backend/.sqlx/query-706872f05247a7d26fcd1b40b129f2defef86f8139dc4e38ae3bf63db039c48b.json
@@ -0,0 +1,22 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT user_email FROM mcp_oauth_server_code WHERE code = $1",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "user_email",
+ "type_info": "Varchar"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text"
+ ]
+ },
+ "nullable": [
+ false
+ ]
+ },
+ "hash": "706872f05247a7d26fcd1b40b129f2defef86f8139dc4e38ae3bf63db039c48b"
+}
diff --git a/backend/.sqlx/query-729852e65e4cf22c474850d46a2065a203ca86b40e8388db963c183ac8fb4fd6.json b/backend/.sqlx/query-729852e65e4cf22c474850d46a2065a203ca86b40e8388db963c183ac8fb4fd6.json
new file mode 100644
index 0000000000..6d4c707f08
--- /dev/null
+++ b/backend/.sqlx/query-729852e65e4cf22c474850d46a2065a203ca86b40e8388db963c183ac8fb4fd6.json
@@ -0,0 +1,18 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "DELETE FROM workspace_invite WHERE\n workspace_id = $1 AND email = $2 AND is_admin = $3\n AND ($5::text IS NOT NULL OR operator = $4)\n AND ($5::text IS NULL OR $5 = COALESCE(workspace_role, CASE WHEN operator THEN 'operator' ELSE 'developer' END))",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Text",
+ "Bool",
+ "Bool",
+ "Text"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "729852e65e4cf22c474850d46a2065a203ca86b40e8388db963c183ac8fb4fd6"
+}
diff --git a/backend/.sqlx/query-2d5ff8fc102ae0c452c1f9cd5cd30fd0a3b4e6e746c659da1767edafd139d45e.json b/backend/.sqlx/query-72bc3795182333d203b4731defb400a6fa59e8a88bebd6e63437e9cb4c491333.json
similarity index 53%
rename from backend/.sqlx/query-2d5ff8fc102ae0c452c1f9cd5cd30fd0a3b4e6e746c659da1767edafd139d45e.json
rename to backend/.sqlx/query-72bc3795182333d203b4731defb400a6fa59e8a88bebd6e63437e9cb4c491333.json
index 2939d5ac88..9450642e5f 100644
--- a/backend/.sqlx/query-2d5ff8fc102ae0c452c1f9cd5cd30fd0a3b4e6e746c659da1767edafd139d45e.json
+++ b/backend/.sqlx/query-72bc3795182333d203b4731defb400a6fa59e8a88bebd6e63437e9cb4c491333.json
@@ -1,21 +1,21 @@
{
"db_name": "PostgreSQL",
- "query": "SELECT value, is_secret, description\n FROM variable\n WHERE workspace_id = $1 AND path = $2",
+ "query": "DELETE FROM workspace_invite WHERE workspace_id = $1 AND email = $2 RETURNING is_admin, operator, workspace_role",
"describe": {
"columns": [
{
"ordinal": 0,
- "name": "value",
- "type_info": "Varchar"
+ "name": "is_admin",
+ "type_info": "Bool"
},
{
"ordinal": 1,
- "name": "is_secret",
+ "name": "operator",
"type_info": "Bool"
},
{
"ordinal": 2,
- "name": "description",
+ "name": "workspace_role",
"type_info": "Varchar"
}
],
@@ -28,8 +28,8 @@
"nullable": [
false,
false,
- false
+ true
]
},
- "hash": "2d5ff8fc102ae0c452c1f9cd5cd30fd0a3b4e6e746c659da1767edafd139d45e"
+ "hash": "72bc3795182333d203b4731defb400a6fa59e8a88bebd6e63437e9cb4c491333"
}
diff --git a/backend/.sqlx/query-7341d832643627cdc33a6eefbca5844a0fbb10fb79e25a604eeb0d83d2122d96.json b/backend/.sqlx/query-7341d832643627cdc33a6eefbca5844a0fbb10fb79e25a604eeb0d83d2122d96.json
new file mode 100644
index 0000000000..a5181dd0a2
--- /dev/null
+++ b/backend/.sqlx/query-7341d832643627cdc33a6eefbca5844a0fbb10fb79e25a604eeb0d83d2122d96.json
@@ -0,0 +1,41 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT username, is_admin, operator, workspace_role FROM usr WHERE\n email = $1 AND workspace_id = $2 AND disabled = false",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "username",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 1,
+ "name": "is_admin",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 2,
+ "name": "operator",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 3,
+ "name": "workspace_role",
+ "type_info": "Varchar"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Text"
+ ]
+ },
+ "nullable": [
+ false,
+ false,
+ false,
+ true
+ ]
+ },
+ "hash": "7341d832643627cdc33a6eefbca5844a0fbb10fb79e25a604eeb0d83d2122d96"
+}
diff --git a/backend/.sqlx/query-74190dc8f1049b61adfcefe19df069204bfc974a55da927658947f3e335da3f5.json b/backend/.sqlx/query-74190dc8f1049b61adfcefe19df069204bfc974a55da927658947f3e335da3f5.json
new file mode 100644
index 0000000000..8a68c6364e
--- /dev/null
+++ b/backend/.sqlx/query-74190dc8f1049b61adfcefe19df069204bfc974a55da927658947f3e335da3f5.json
@@ -0,0 +1,23 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT COUNT(*) FROM workspace_invite t WHERE ($1::text IS NOT NULL AND t.workspace_id = $1\n OR $1::text IS NULL AND NOT EXISTS (SELECT 1 FROM workspace_settings ws\n WHERE ws.workspace_id = t.workspace_id AND ws.role_overrides ? $2)) AND\n COALESCE(t.workspace_role, CASE WHEN t.operator THEN 'operator' ELSE 'developer' END) = $2",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "count",
+ "type_info": "Int8"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Text"
+ ]
+ },
+ "nullable": [
+ null
+ ]
+ },
+ "hash": "74190dc8f1049b61adfcefe19df069204bfc974a55da927658947f3e335da3f5"
+}
diff --git a/backend/.sqlx/query-74742f785888f280bf1d7e28793150c3ddc2fd4be3b8c682f6faa7b917387593.json b/backend/.sqlx/query-74742f785888f280bf1d7e28793150c3ddc2fd4be3b8c682f6faa7b917387593.json
new file mode 100644
index 0000000000..5bf83d1b33
--- /dev/null
+++ b/backend/.sqlx/query-74742f785888f280bf1d7e28793150c3ddc2fd4be3b8c682f6faa7b917387593.json
@@ -0,0 +1,214 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "\n SELECT\n workspace_id,\n slack_team_id,\n teams_team_id,\n teams_team_name,\n teams_team_guid,\n slack_name,\n slack_command_script,\n teams_command_script,\n slack_email,\n slack_oauth_client_id,\n slack_oauth_client_secret,\n customer_id,\n plan,\n webhook,\n ai_config,\n dbt_warehouses,\n large_file_storage,\n datatable,\n ducklake,\n git_sync,\n deploy_ui,\n default_app,\n default_scripts,\n mute_critical_alerts,\n color,\n operator_settings,\n git_app_installations,\n auto_invite,\n error_handler,\n success_handler,\n variable_expiration_handler,\n public_app_execution_limit_per_minute,\n error_handler_fallback_to_instance_alerts\n FROM\n workspace_settings\n WHERE\n workspace_id = $1\n ",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "workspace_id",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 1,
+ "name": "slack_team_id",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 2,
+ "name": "teams_team_id",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 3,
+ "name": "teams_team_name",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 4,
+ "name": "teams_team_guid",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 5,
+ "name": "slack_name",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 6,
+ "name": "slack_command_script",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 7,
+ "name": "teams_command_script",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 8,
+ "name": "slack_email",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 9,
+ "name": "slack_oauth_client_id",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 10,
+ "name": "slack_oauth_client_secret",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 11,
+ "name": "customer_id",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 12,
+ "name": "plan",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 13,
+ "name": "webhook",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 14,
+ "name": "ai_config",
+ "type_info": "Jsonb"
+ },
+ {
+ "ordinal": 15,
+ "name": "dbt_warehouses",
+ "type_info": "Jsonb"
+ },
+ {
+ "ordinal": 16,
+ "name": "large_file_storage",
+ "type_info": "Jsonb"
+ },
+ {
+ "ordinal": 17,
+ "name": "datatable",
+ "type_info": "Jsonb"
+ },
+ {
+ "ordinal": 18,
+ "name": "ducklake",
+ "type_info": "Jsonb"
+ },
+ {
+ "ordinal": 19,
+ "name": "git_sync",
+ "type_info": "Jsonb"
+ },
+ {
+ "ordinal": 20,
+ "name": "deploy_ui",
+ "type_info": "Jsonb"
+ },
+ {
+ "ordinal": 21,
+ "name": "default_app",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 22,
+ "name": "default_scripts",
+ "type_info": "Jsonb"
+ },
+ {
+ "ordinal": 23,
+ "name": "mute_critical_alerts",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 24,
+ "name": "color",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 25,
+ "name": "operator_settings",
+ "type_info": "Jsonb"
+ },
+ {
+ "ordinal": 26,
+ "name": "git_app_installations",
+ "type_info": "Jsonb"
+ },
+ {
+ "ordinal": 27,
+ "name": "auto_invite",
+ "type_info": "Jsonb"
+ },
+ {
+ "ordinal": 28,
+ "name": "error_handler",
+ "type_info": "Jsonb"
+ },
+ {
+ "ordinal": 29,
+ "name": "success_handler",
+ "type_info": "Jsonb"
+ },
+ {
+ "ordinal": 30,
+ "name": "variable_expiration_handler",
+ "type_info": "Jsonb"
+ },
+ {
+ "ordinal": 31,
+ "name": "public_app_execution_limit_per_minute",
+ "type_info": "Int4"
+ },
+ {
+ "ordinal": 32,
+ "name": "error_handler_fallback_to_instance_alerts",
+ "type_info": "Bool"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text"
+ ]
+ },
+ "nullable": [
+ false,
+ true,
+ true,
+ true,
+ true,
+ true,
+ true,
+ true,
+ false,
+ true,
+ true,
+ true,
+ true,
+ true,
+ true,
+ true,
+ true,
+ true,
+ true,
+ true,
+ true,
+ true,
+ true,
+ true,
+ true,
+ true,
+ false,
+ true,
+ true,
+ true,
+ true,
+ true,
+ false
+ ]
+ },
+ "hash": "74742f785888f280bf1d7e28793150c3ddc2fd4be3b8c682f6faa7b917387593"
+}
diff --git a/backend/.sqlx/query-74e6d61f31897d8102fe75bbe44781a71aeba34da94b9b1aa9893c2837d5cb05.json b/backend/.sqlx/query-74e6d61f31897d8102fe75bbe44781a71aeba34da94b9b1aa9893c2837d5cb05.json
new file mode 100644
index 0000000000..a173674b29
--- /dev/null
+++ b/backend/.sqlx/query-74e6d61f31897d8102fe75bbe44781a71aeba34da94b9b1aa9893c2837d5cb05.json
@@ -0,0 +1,28 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT slack_oauth_client_id IS NOT NULL AS \"own_app!\", slack_signing_secret\n FROM workspace_settings WHERE workspace_id = $1",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "own_app!",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 1,
+ "name": "slack_signing_secret",
+ "type_info": "Text"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text"
+ ]
+ },
+ "nullable": [
+ null,
+ true
+ ]
+ },
+ "hash": "74e6d61f31897d8102fe75bbe44781a71aeba34da94b9b1aa9893c2837d5cb05"
+}
diff --git a/backend/.sqlx/query-74f9031593b6c55819508fa32310e465c202fa3784fd179bcd8963217327a03b.json b/backend/.sqlx/query-74f9031593b6c55819508fa32310e465c202fa3784fd179bcd8963217327a03b.json
new file mode 100644
index 0000000000..7440566057
--- /dev/null
+++ b/backend/.sqlx/query-74f9031593b6c55819508fa32310e465c202fa3784fd179bcd8963217327a03b.json
@@ -0,0 +1,35 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT EXISTS(SELECT 1 FROM native_trigger\n WHERE workspace_id = $1 AND service_name = $2 AND connection_path = $3)",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "exists",
+ "type_info": "Bool"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text",
+ {
+ "Custom": {
+ "name": "native_trigger_service",
+ "kind": {
+ "Enum": [
+ "nextcloud",
+ "google",
+ "github"
+ ]
+ }
+ }
+ },
+ "Text"
+ ]
+ },
+ "nullable": [
+ null
+ ]
+ },
+ "hash": "74f9031593b6c55819508fa32310e465c202fa3784fd179bcd8963217327a03b"
+}
diff --git a/backend/.sqlx/query-77d599e4f7c574dffac4824f37127c7ae2ef5f27d665ad9018f5cdea0f6f2cb1.json b/backend/.sqlx/query-77d599e4f7c574dffac4824f37127c7ae2ef5f27d665ad9018f5cdea0f6f2cb1.json
deleted file mode 100644
index f504d7a809..0000000000
--- a/backend/.sqlx/query-77d599e4f7c574dffac4824f37127c7ae2ef5f27d665ad9018f5cdea0f6f2cb1.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "db_name": "PostgreSQL",
- "query": "INSERT INTO workspace_settings (workspace_id, slack_team_id, slack_name, slack_command_script, slack_email, customer_id, plan, webhook, ai_config, large_file_storage, git_sync, default_app, default_scripts, deploy_ui, mute_critical_alerts, color, operator_settings, teams_command_script, teams_team_id, teams_team_name, git_app_installations, ducklake, dbt_warehouses, slack_oauth_client_id, slack_oauth_client_secret, datatable, teams_team_guid, auto_invite, error_handler, success_handler, public_app_execution_limit_per_minute, error_handler_fallback_to_instance_alerts, guest_access_enabled, guest_jwt_public_key, guest_jwt_jwks_url) SELECT $1, slack_team_id, slack_name, slack_command_script, slack_email, customer_id, plan, webhook, ai_config, large_file_storage, git_sync, default_app, default_scripts, deploy_ui, mute_critical_alerts, color, operator_settings, teams_command_script, teams_team_id, teams_team_name, git_app_installations, ducklake, dbt_warehouses, slack_oauth_client_id, slack_oauth_client_secret, datatable, teams_team_guid, auto_invite, error_handler, success_handler, public_app_execution_limit_per_minute, error_handler_fallback_to_instance_alerts, guest_access_enabled, guest_jwt_public_key, guest_jwt_jwks_url FROM workspace_settings WHERE workspace_id = $2",
- "describe": {
- "columns": [],
- "parameters": {
- "Left": [
- "Varchar",
- "Text"
- ]
- },
- "nullable": []
- },
- "hash": "77d599e4f7c574dffac4824f37127c7ae2ef5f27d665ad9018f5cdea0f6f2cb1"
-}
diff --git a/backend/.sqlx/query-993e514229a1d508a44ef07b4399f9697cdefaa1f45ca665f72bc6fcf2797c7e.json b/backend/.sqlx/query-78954c7a6d38ae9d094f77bb255ae235c9b3083b4c179f819c927342bc58651f.json
similarity index 64%
rename from backend/.sqlx/query-993e514229a1d508a44ef07b4399f9697cdefaa1f45ca665f72bc6fcf2797c7e.json
rename to backend/.sqlx/query-78954c7a6d38ae9d094f77bb255ae235c9b3083b4c179f819c927342bc58651f.json
index 25a4d5b723..a8e33b105a 100644
--- a/backend/.sqlx/query-993e514229a1d508a44ef07b4399f9697cdefaa1f45ca665f72bc6fcf2797c7e.json
+++ b/backend/.sqlx/query-78954c7a6d38ae9d094f77bb255ae235c9b3083b4c179f819c927342bc58651f.json
@@ -1,12 +1,12 @@
{
"db_name": "PostgreSQL",
- "query": "SELECT resource_path FROM workspace_integrations WHERE workspace_id = $1 AND service_name = $2",
+ "query": "SELECT EXISTS(SELECT 1 FROM native_trigger WHERE workspace_id = $1 AND service_name = $2)",
"describe": {
"columns": [
{
"ordinal": 0,
- "name": "resource_path",
- "type_info": "Text"
+ "name": "exists",
+ "type_info": "Bool"
}
],
"parameters": {
@@ -27,8 +27,8 @@
]
},
"nullable": [
- true
+ null
]
},
- "hash": "993e514229a1d508a44ef07b4399f9697cdefaa1f45ca665f72bc6fcf2797c7e"
+ "hash": "78954c7a6d38ae9d094f77bb255ae235c9b3083b4c179f819c927342bc58651f"
}
diff --git a/backend/.sqlx/query-79ac4fcf66d90ad793ecdc0906203654e796f71a876ea6d6ebf08c4f65b2156e.json b/backend/.sqlx/query-79ac4fcf66d90ad793ecdc0906203654e796f71a876ea6d6ebf08c4f65b2156e.json
new file mode 100644
index 0000000000..158f49102d
--- /dev/null
+++ b/backend/.sqlx/query-79ac4fcf66d90ad793ecdc0906203654e796f71a876ea6d6ebf08c4f65b2156e.json
@@ -0,0 +1,35 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT v.path, r.created_by AS \"owner?\", false AS \"workspace!\"\n FROM variable v\n JOIN account a ON a.workspace_id = v.workspace_id AND a.id = v.account\n LEFT JOIN resource r ON r.workspace_id = v.workspace_id AND r.path = v.path\n WHERE v.workspace_id = $1 AND a.client = $2 AND a.is_workspace_integration = true\n ORDER BY v.path",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "path",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 1,
+ "name": "owner?",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 2,
+ "name": "workspace!",
+ "type_info": "Bool"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Text"
+ ]
+ },
+ "nullable": [
+ false,
+ true,
+ null
+ ]
+ },
+ "hash": "79ac4fcf66d90ad793ecdc0906203654e796f71a876ea6d6ebf08c4f65b2156e"
+}
diff --git a/backend/.sqlx/query-7b1d29170c9c4ad4e3a15c4e8acbeb6769dc6fc97269beee607a5625a495a121.json b/backend/.sqlx/query-7b1d29170c9c4ad4e3a15c4e8acbeb6769dc6fc97269beee607a5625a495a121.json
deleted file mode 100644
index 97ab6a03d5..0000000000
--- a/backend/.sqlx/query-7b1d29170c9c4ad4e3a15c4e8acbeb6769dc6fc97269beee607a5625a495a121.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "db_name": "PostgreSQL",
- "query": "UPDATE account SET\n expires_at = now() + interval '1 hour',\n refresh_error = NULL\n WHERE workspace_id = $1 AND client = $2 AND is_workspace_integration = true",
- "describe": {
- "columns": [],
- "parameters": {
- "Left": [
- "Text",
- "Text"
- ]
- },
- "nullable": []
- },
- "hash": "7b1d29170c9c4ad4e3a15c4e8acbeb6769dc6fc97269beee607a5625a495a121"
-}
diff --git a/backend/.sqlx/query-d537182f8c8931427f2cf175bd850ce2581a33c8678212de99edb6f823f38994.json b/backend/.sqlx/query-7c481a2cf03e7f80e7170a5165b5225e4e0828d82f5c6ddca9b059f4a876d137.json
similarity index 79%
rename from backend/.sqlx/query-d537182f8c8931427f2cf175bd850ce2581a33c8678212de99edb6f823f38994.json
rename to backend/.sqlx/query-7c481a2cf03e7f80e7170a5165b5225e4e0828d82f5c6ddca9b059f4a876d137.json
index 8c2a7716fd..e637b8c87d 100644
--- a/backend/.sqlx/query-d537182f8c8931427f2cf175bd850ce2581a33c8678212de99edb6f823f38994.json
+++ b/backend/.sqlx/query-7c481a2cf03e7f80e7170a5165b5225e4e0828d82f5c6ddca9b059f4a876d137.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "SELECT (status = 'success' OR EXISTS (\n SELECT 1 FROM native_retry_attempt nra\n JOIN v2_job jc ON jc.id = nra.job_id\n JOIN v2_job_completed cc ON cc.id = nra.job_id\n WHERE jc.parent_job = j.id AND cc.status = 'success'\n )) AS \"success!\"\n FROM v2_job j JOIN v2_job_completed USING (id)\n WHERE j.workspace_id = $1 AND trigger_kind = 'schedule' AND trigger = $2\n AND parent_job IS NULL\n AND runnable_path = $3\n AND j.id != $4\n ORDER BY created_at DESC\n LIMIT $5",
+ "query": "SELECT (status = 'success' OR EXISTS (\n SELECT 1 FROM native_retry_attempt nra\n JOIN v2_job jc ON jc.id = nra.job_id\n JOIN v2_job_completed cc ON cc.id = nra.job_id\n WHERE jc.parent_job = j.id AND cc.status = 'success'\n )) AS \"success!\"\n FROM v2_job j JOIN v2_job_completed USING (id)\n WHERE j.workspace_id = $1 AND trigger_kind = 'schedule' AND trigger = $2\n AND parent_job IS NULL\n AND runnable_path = $3\n AND j.created_at < (SELECT created_at FROM v2_job WHERE id = $4)\n ORDER BY created_at DESC\n LIMIT $5",
"describe": {
"columns": [
{
@@ -22,5 +22,5 @@
null
]
},
- "hash": "d537182f8c8931427f2cf175bd850ce2581a33c8678212de99edb6f823f38994"
+ "hash": "7c481a2cf03e7f80e7170a5165b5225e4e0828d82f5c6ddca9b059f4a876d137"
}
diff --git a/backend/.sqlx/query-7e71cb88613a78b1b6bd0327970e7c732775949f92e1f099ff997d385b025f55.json b/backend/.sqlx/query-7e71cb88613a78b1b6bd0327970e7c732775949f92e1f099ff997d385b025f55.json
new file mode 100644
index 0000000000..787342ca47
--- /dev/null
+++ b/backend/.sqlx/query-7e71cb88613a78b1b6bd0327970e7c732775949f92e1f099ff997d385b025f55.json
@@ -0,0 +1,41 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT username, is_admin, operator, workspace_role FROM usr\n WHERE workspace_id = $1 AND email = $2 AND disabled = false",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "username",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 1,
+ "name": "is_admin",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 2,
+ "name": "operator",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 3,
+ "name": "workspace_role",
+ "type_info": "Varchar"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Text"
+ ]
+ },
+ "nullable": [
+ false,
+ false,
+ false,
+ true
+ ]
+ },
+ "hash": "7e71cb88613a78b1b6bd0327970e7c732775949f92e1f099ff997d385b025f55"
+}
diff --git a/backend/.sqlx/query-80977e90833b63da4cdde111db80d78c8e577dbce51f8571a9ffe3e8e1e652a1.json b/backend/.sqlx/query-80977e90833b63da4cdde111db80d78c8e577dbce51f8571a9ffe3e8e1e652a1.json
new file mode 100644
index 0000000000..24144fdbdb
--- /dev/null
+++ b/backend/.sqlx/query-80977e90833b63da4cdde111db80d78c8e577dbce51f8571a9ffe3e8e1e652a1.json
@@ -0,0 +1,15 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "UPDATE workspace_settings\n SET operator_settings = COALESCE(operator_settings, '{}'::jsonb) || $1\n WHERE workspace_id = $2",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Jsonb",
+ "Text"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "80977e90833b63da4cdde111db80d78c8e577dbce51f8571a9ffe3e8e1e652a1"
+}
diff --git a/backend/.sqlx/query-809a2dd647ddfc6fa79ca2c9039e4ebfc4b2880600a03b82e60b89c4a1fd5cc8.json b/backend/.sqlx/query-809a2dd647ddfc6fa79ca2c9039e4ebfc4b2880600a03b82e60b89c4a1fd5cc8.json
new file mode 100644
index 0000000000..cb33edacdf
--- /dev/null
+++ b/backend/.sqlx/query-809a2dd647ddfc6fa79ca2c9039e4ebfc4b2880600a03b82e60b89c4a1fd5cc8.json
@@ -0,0 +1,15 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "INSERT INTO variable (workspace_id, path, value, is_secret, description, extra_perms, account, is_oauth, expires_at, value_valid_until)\n SELECT $2, path, value, is_secret, description, extra_perms, account, is_oauth, expires_at, value_valid_until\n FROM variable\n WHERE workspace_id = $1",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Varchar"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "809a2dd647ddfc6fa79ca2c9039e4ebfc4b2880600a03b82e60b89c4a1fd5cc8"
+}
diff --git a/backend/.sqlx/query-80d62bd0f372a322d9c2a548a66669551ed6860b0839dd019967569e2325b0bc.json b/backend/.sqlx/query-80d62bd0f372a322d9c2a548a66669551ed6860b0839dd019967569e2325b0bc.json
new file mode 100644
index 0000000000..5b59198fd9
--- /dev/null
+++ b/backend/.sqlx/query-80d62bd0f372a322d9c2a548a66669551ed6860b0839dd019967569e2325b0bc.json
@@ -0,0 +1,18 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "INSERT INTO workspace_invite\n (workspace_id, email, is_admin, operator, workspace_role)\n VALUES ($1, $2, $3, $4, $5) ON CONFLICT (workspace_id, email)\n DO UPDATE SET is_admin = EXCLUDED.is_admin, operator = EXCLUDED.operator,\n workspace_role = EXCLUDED.workspace_role",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Varchar",
+ "Varchar",
+ "Bool",
+ "Bool",
+ "Varchar"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "80d62bd0f372a322d9c2a548a66669551ed6860b0839dd019967569e2325b0bc"
+}
diff --git a/backend/.sqlx/query-884dd7d41713a964a0fbb854d6e54cff4538e230b3cd72dd2e840a08b2a178d9.json b/backend/.sqlx/query-884dd7d41713a964a0fbb854d6e54cff4538e230b3cd72dd2e840a08b2a178d9.json
new file mode 100644
index 0000000000..1823f66c53
--- /dev/null
+++ b/backend/.sqlx/query-884dd7d41713a964a0fbb854d6e54cff4538e230b3cd72dd2e840a08b2a178d9.json
@@ -0,0 +1,41 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT is_admin, operator, workspace_role, email FROM usr where username = $1 AND workspace_id = $2 AND disabled = false",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "is_admin",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 1,
+ "name": "operator",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 2,
+ "name": "workspace_role",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 3,
+ "name": "email",
+ "type_info": "Varchar"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Text"
+ ]
+ },
+ "nullable": [
+ false,
+ false,
+ true,
+ false
+ ]
+ },
+ "hash": "884dd7d41713a964a0fbb854d6e54cff4538e230b3cd72dd2e840a08b2a178d9"
+}
diff --git a/backend/.sqlx/query-8a0287e5b8f37c86d989a39516188484d036e2106acab33f6c459d9b9c9ba3be.json b/backend/.sqlx/query-8a0287e5b8f37c86d989a39516188484d036e2106acab33f6c459d9b9c9ba3be.json
new file mode 100644
index 0000000000..c90368a92f
--- /dev/null
+++ b/backend/.sqlx/query-8a0287e5b8f37c86d989a39516188484d036e2106acab33f6c459d9b9c9ba3be.json
@@ -0,0 +1,19 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "UPDATE account SET refresh_token = COALESCE($1, refresh_token),\n expires_at = CASE WHEN $2 THEN $3 ELSE expires_at END,\n refresh_error = CASE WHEN $2 THEN NULL ELSE refresh_error END\n WHERE workspace_id = $4 AND id = $5 AND refresh_token = $6",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Varchar",
+ "Bool",
+ "Timestamptz",
+ "Text",
+ "Int4",
+ "Text"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "8a0287e5b8f37c86d989a39516188484d036e2106acab33f6c459d9b9c9ba3be"
+}
diff --git a/backend/.sqlx/query-b731208c3e98f8fb15bf0c72e2ab1d4c61566c3cedf31596efe084ef7dc9985a.json b/backend/.sqlx/query-8b8b605d656d88e1fe77f936500cec9cb3388b7232a96bfc287f751d1e0092da.json
similarity index 63%
rename from backend/.sqlx/query-b731208c3e98f8fb15bf0c72e2ab1d4c61566c3cedf31596efe084ef7dc9985a.json
rename to backend/.sqlx/query-8b8b605d656d88e1fe77f936500cec9cb3388b7232a96bfc287f751d1e0092da.json
index 04b960b81a..0481fb751c 100644
--- a/backend/.sqlx/query-b731208c3e98f8fb15bf0c72e2ab1d4c61566c3cedf31596efe084ef7dc9985a.json
+++ b/backend/.sqlx/query-8b8b605d656d88e1fe77f936500cec9cb3388b7232a96bfc287f751d1e0092da.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "SELECT workspace_id, slack_command_script, slack_email FROM workspace_settings WHERE slack_team_id = $1 AND slack_command_script IS NOT NULL",
+ "query": "SELECT workspace_id, slack_command_script, slack_email FROM workspace_settings\n WHERE slack_team_id = $1 AND slack_command_script IS NOT NULL\n AND workspace_id = ANY($2)\n ORDER BY workspace_id = ANY($3) DESC LIMIT 1",
"describe": {
"columns": [
{
@@ -21,7 +21,9 @@
],
"parameters": {
"Left": [
- "Text"
+ "Text",
+ "TextArray",
+ "TextArray"
]
},
"nullable": [
@@ -30,5 +32,5 @@
false
]
},
- "hash": "b731208c3e98f8fb15bf0c72e2ab1d4c61566c3cedf31596efe084ef7dc9985a"
+ "hash": "8b8b605d656d88e1fe77f936500cec9cb3388b7232a96bfc287f751d1e0092da"
}
diff --git a/backend/.sqlx/query-8c2fcd9385931cfba49bcbe67a14cbfbb042a5930d406ec60939791a1d1d723b.json b/backend/.sqlx/query-8c2fcd9385931cfba49bcbe67a14cbfbb042a5930d406ec60939791a1d1d723b.json
new file mode 100644
index 0000000000..bbf54e23b8
--- /dev/null
+++ b/backend/.sqlx/query-8c2fcd9385931cfba49bcbe67a14cbfbb042a5930d406ec60939791a1d1d723b.json
@@ -0,0 +1,23 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT path FROM variable WHERE workspace_id = $1 AND account = $2 AND is_secret",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "path",
+ "type_info": "Varchar"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Int4"
+ ]
+ },
+ "nullable": [
+ false
+ ]
+ },
+ "hash": "8c2fcd9385931cfba49bcbe67a14cbfbb042a5930d406ec60939791a1d1d723b"
+}
diff --git a/backend/.sqlx/query-64dce306efc0d9989542dba5bf003dc94b9337a8d3b69805308258d1fa145e63.json b/backend/.sqlx/query-8ec380ed48a8366e8869c6d1aa06ba774a6ded50ab047d0b0302c7430cee5b70.json
similarity index 61%
rename from backend/.sqlx/query-64dce306efc0d9989542dba5bf003dc94b9337a8d3b69805308258d1fa145e63.json
rename to backend/.sqlx/query-8ec380ed48a8366e8869c6d1aa06ba774a6ded50ab047d0b0302c7430cee5b70.json
index d234750140..9416cd684c 100644
--- a/backend/.sqlx/query-64dce306efc0d9989542dba5bf003dc94b9337a8d3b69805308258d1fa145e63.json
+++ b/backend/.sqlx/query-8ec380ed48a8366e8869c6d1aa06ba774a6ded50ab047d0b0302c7430cee5b70.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "\n INSERT INTO native_trigger (\n external_id,\n workspace_id,\n service_name,\n script_path,\n is_flow,\n webhook_token_hash,\n service_config,\n summary,\n enabled\n ) VALUES (\n $1, $2, $3, $4, $5, $6, $7, $8, $9\n )\n ON CONFLICT (external_id, workspace_id, service_name)\n DO UPDATE SET script_path = $4, is_flow = $5, webhook_token_hash = $6, service_config = $7, summary = $8, error = NULL, updated_at = NOW()\n ",
+ "query": "\n INSERT INTO native_trigger (\n external_id,\n workspace_id,\n service_name,\n script_path,\n is_flow,\n webhook_token_hash,\n service_config,\n summary,\n enabled,\n connection_path\n ) VALUES (\n $1, $2, $3, $4, $5, $6, $7, $8, $9, $10\n )\n ON CONFLICT (external_id, workspace_id, service_name)\n DO UPDATE SET script_path = $4, is_flow = $5, webhook_token_hash = $6, service_config = $7, summary = $8, connection_path = $10, error = NULL, updated_at = NOW()\n ",
"describe": {
"columns": [],
"parameters": {
@@ -24,10 +24,11 @@
"Varchar",
"Jsonb",
"Varchar",
- "Bool"
+ "Bool",
+ "Varchar"
]
},
"nullable": []
},
- "hash": "64dce306efc0d9989542dba5bf003dc94b9337a8d3b69805308258d1fa145e63"
+ "hash": "8ec380ed48a8366e8869c6d1aa06ba774a6ded50ab047d0b0302c7430cee5b70"
}
diff --git a/backend/.sqlx/query-907f231497ac4889c23b84bb3c369ebb8bf60963283640e02e03a1af42af2782.json b/backend/.sqlx/query-907f231497ac4889c23b84bb3c369ebb8bf60963283640e02e03a1af42af2782.json
new file mode 100644
index 0000000000..97f3bd7567
--- /dev/null
+++ b/backend/.sqlx/query-907f231497ac4889c23b84bb3c369ebb8bf60963283640e02e03a1af42af2782.json
@@ -0,0 +1,14 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "DELETE FROM slack_agent_channel WHERE workspace_id = $1",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Text"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "907f231497ac4889c23b84bb3c369ebb8bf60963283640e02e03a1af42af2782"
+}
diff --git a/backend/.sqlx/query-5b0847d2b95a128a5b648dd4847af44ed0992ced76286a08a33134140a454391.json b/backend/.sqlx/query-92710770a07d9cc622fd36bde7114fe6f508293f3334e4e17e7d396b52012a7d.json
similarity index 84%
rename from backend/.sqlx/query-5b0847d2b95a128a5b648dd4847af44ed0992ced76286a08a33134140a454391.json
rename to backend/.sqlx/query-92710770a07d9cc622fd36bde7114fe6f508293f3334e4e17e7d396b52012a7d.json
index 28c09ca528..514793704f 100644
--- a/backend/.sqlx/query-5b0847d2b95a128a5b648dd4847af44ed0992ced76286a08a33134140a454391.json
+++ b/backend/.sqlx/query-92710770a07d9cc622fd36bde7114fe6f508293f3334e4e17e7d396b52012a7d.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "SELECT (status = 'success' OR EXISTS (\n SELECT 1 FROM native_retry_attempt nra\n JOIN v2_job jc ON jc.id = nra.job_id\n JOIN v2_job_completed cc ON cc.id = nra.job_id\n WHERE jc.parent_job = j.id AND cc.status = 'success'\n )) AS \"success!\",\n result AS \"result: Json>\",\n started_at AS \"started_at!\"FROM v2_job j JOIN v2_job_completed USING (id)\n WHERE j.workspace_id = $1 AND trigger_kind = 'schedule' AND trigger = $2\n AND parent_job IS NULL\n AND runnable_path = $3\n AND j.id != $4\n ORDER BY created_at DESC\n LIMIT $5",
+ "query": "SELECT (status = 'success' OR EXISTS (\n SELECT 1 FROM native_retry_attempt nra\n JOIN v2_job jc ON jc.id = nra.job_id\n JOIN v2_job_completed cc ON cc.id = nra.job_id\n WHERE jc.parent_job = j.id AND cc.status = 'success'\n )) AS \"success!\",\n result AS \"result: Json>\",\n started_at AS \"started_at!\"FROM v2_job j JOIN v2_job_completed USING (id)\n WHERE j.workspace_id = $1 AND trigger_kind = 'schedule' AND trigger = $2\n AND parent_job IS NULL\n AND runnable_path = $3\n AND j.created_at < (SELECT created_at FROM v2_job WHERE id = $4)\n ORDER BY created_at DESC\n LIMIT $5",
"describe": {
"columns": [
{
@@ -34,5 +34,5 @@
true
]
},
- "hash": "5b0847d2b95a128a5b648dd4847af44ed0992ced76286a08a33134140a454391"
+ "hash": "92710770a07d9cc622fd36bde7114fe6f508293f3334e4e17e7d396b52012a7d"
}
diff --git a/backend/.sqlx/query-9784d19363fa14b9d7cc49e208967000a7bc8e56adddcd9304b05daf814e5246.json b/backend/.sqlx/query-9784d19363fa14b9d7cc49e208967000a7bc8e56adddcd9304b05daf814e5246.json
new file mode 100644
index 0000000000..9ad7df84ba
--- /dev/null
+++ b/backend/.sqlx/query-9784d19363fa14b9d7cc49e208967000a7bc8e56adddcd9304b05daf814e5246.json
@@ -0,0 +1,22 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT COUNT(*) FROM workspace_settings WHERE COALESCE(role_overrides ? $1, false)",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "count",
+ "type_info": "Int8"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text"
+ ]
+ },
+ "nullable": [
+ null
+ ]
+ },
+ "hash": "9784d19363fa14b9d7cc49e208967000a7bc8e56adddcd9304b05daf814e5246"
+}
diff --git a/backend/.sqlx/query-988c720384e4e2d70bfa11196f3a3514e0756722762fabe49e1d291ce5c09a19.json b/backend/.sqlx/query-988c720384e4e2d70bfa11196f3a3514e0756722762fabe49e1d291ce5c09a19.json
new file mode 100644
index 0000000000..0ffc66a8b7
--- /dev/null
+++ b/backend/.sqlx/query-988c720384e4e2d70bfa11196f3a3514e0756722762fabe49e1d291ce5c09a19.json
@@ -0,0 +1,16 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "UPDATE usr SET workspace_role = $1 WHERE workspace_id = $2 AND username = $3",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Varchar",
+ "Text",
+ "Text"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "988c720384e4e2d70bfa11196f3a3514e0756722762fabe49e1d291ce5c09a19"
+}
diff --git a/backend/.sqlx/query-9a3677f9bfc1b5b679578572302129371c7c62e30d77ba6c5e74b575de635b30.json b/backend/.sqlx/query-9a3677f9bfc1b5b679578572302129371c7c62e30d77ba6c5e74b575de635b30.json
new file mode 100644
index 0000000000..db0e11a62b
--- /dev/null
+++ b/backend/.sqlx/query-9a3677f9bfc1b5b679578572302129371c7c62e30d77ba6c5e74b575de635b30.json
@@ -0,0 +1,26 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "UPDATE variable SET expiration_dispatched_for = $3, expiration_notified_at = now()\n WHERE workspace_id = $1 AND path = $2 AND value_valid_until = $3\n AND expiration_dispatched_for IS NOT DISTINCT FROM $4\n AND expiration_notified_at IS NOT DISTINCT FROM $5\n RETURNING 1",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "?column?",
+ "type_info": "Int4"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Text",
+ "Timestamptz",
+ "Timestamptz",
+ "Timestamptz"
+ ]
+ },
+ "nullable": [
+ null
+ ]
+ },
+ "hash": "9a3677f9bfc1b5b679578572302129371c7c62e30d77ba6c5e74b575de635b30"
+}
diff --git a/backend/.sqlx/query-9aaee16823c7d3fc0954274ba71bc2eae7d950f759d146339c30df039cf10fd8.json b/backend/.sqlx/query-9aaee16823c7d3fc0954274ba71bc2eae7d950f759d146339c30df039cf10fd8.json
new file mode 100644
index 0000000000..38bad3fcde
--- /dev/null
+++ b/backend/.sqlx/query-9aaee16823c7d3fc0954274ba71bc2eae7d950f759d146339c30df039cf10fd8.json
@@ -0,0 +1,22 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT p.email FROM password p LEFT JOIN usr m ON m.workspace_id = $1 AND m.email = p.email WHERE p.super_admin AND NOT p.disabled AND (m.email IS NOT NULL AND NOT m.disabled OR m.email IS NULL AND NOT EXISTS (SELECT 1 FROM usr c WHERE c.workspace_id = $1 AND c.username = COALESCE(p.username, p.email))) ORDER BY m.email IS NULL, p.email LIMIT 1",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "email",
+ "type_info": "Varchar"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text"
+ ]
+ },
+ "nullable": [
+ false
+ ]
+ },
+ "hash": "9aaee16823c7d3fc0954274ba71bc2eae7d950f759d146339c30df039cf10fd8"
+}
diff --git a/backend/.sqlx/query-9bbd373847d5cc8e0d84349dbea73af0d18e3b4ce2eb7a20929f8c4c101141b6.json b/backend/.sqlx/query-9bbd373847d5cc8e0d84349dbea73af0d18e3b4ce2eb7a20929f8c4c101141b6.json
new file mode 100644
index 0000000000..ab555a2efd
--- /dev/null
+++ b/backend/.sqlx/query-9bbd373847d5cc8e0d84349dbea73af0d18e3b4ce2eb7a20929f8c4c101141b6.json
@@ -0,0 +1,12 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "INSERT INTO variable (workspace_id, path, value, is_secret, description, value_valid_until)\n VALUES ('test-workspace', 'u/admin/expiring', 'v', false, 'same', '2027-01-01T00:00:00Z')",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": []
+ },
+ "nullable": []
+ },
+ "hash": "9bbd373847d5cc8e0d84349dbea73af0d18e3b4ce2eb7a20929f8c4c101141b6"
+}
diff --git a/backend/.sqlx/query-9c2b997126090a5bc191f8d7460e14e0f95b81c61241ffd0c9d633e562c4c4f6.json b/backend/.sqlx/query-9c2b997126090a5bc191f8d7460e14e0f95b81c61241ffd0c9d633e562c4c4f6.json
new file mode 100644
index 0000000000..ecb5eb2c4b
--- /dev/null
+++ b/backend/.sqlx/query-9c2b997126090a5bc191f8d7460e14e0f95b81c61241ffd0c9d633e562c4c4f6.json
@@ -0,0 +1,14 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "UPDATE workspace_settings SET variable_expiration_handler = NULL WHERE workspace_id = $1",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Text"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "9c2b997126090a5bc191f8d7460e14e0f95b81c61241ffd0c9d633e562c4c4f6"
+}
diff --git a/backend/.sqlx/query-c925264b7b0fd44ea7ab01c9af1514b9a9f2200e5a5db0a741697b28cd8b505f.json b/backend/.sqlx/query-9d7416a5458bb3d4a145cc1d2d35fa8e032a4ccdd23d7ed9a6c58d791b7bbd08.json
similarity index 62%
rename from backend/.sqlx/query-c925264b7b0fd44ea7ab01c9af1514b9a9f2200e5a5db0a741697b28cd8b505f.json
rename to backend/.sqlx/query-9d7416a5458bb3d4a145cc1d2d35fa8e032a4ccdd23d7ed9a6c58d791b7bbd08.json
index 37025d99d8..bb3d0d83b9 100644
--- a/backend/.sqlx/query-c925264b7b0fd44ea7ab01c9af1514b9a9f2200e5a5db0a741697b28cd8b505f.json
+++ b/backend/.sqlx/query-9d7416a5458bb3d4a145cc1d2d35fa8e032a4ccdd23d7ed9a6c58d791b7bbd08.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "SELECT account FROM variable WHERE path = $1 AND workspace_id = $2",
+ "query": "DELETE FROM variable WHERE workspace_id = $1 AND path = $2 RETURNING account",
"describe": {
"columns": [
{
@@ -19,5 +19,5 @@
true
]
},
- "hash": "c925264b7b0fd44ea7ab01c9af1514b9a9f2200e5a5db0a741697b28cd8b505f"
+ "hash": "9d7416a5458bb3d4a145cc1d2d35fa8e032a4ccdd23d7ed9a6c58d791b7bbd08"
}
diff --git a/backend/.sqlx/query-9dabc87e05f72fbd4b586c80d9c7f41c3a72838c5d4c5f795638506084561894.json b/backend/.sqlx/query-9dabc87e05f72fbd4b586c80d9c7f41c3a72838c5d4c5f795638506084561894.json
new file mode 100644
index 0000000000..6557494459
--- /dev/null
+++ b/backend/.sqlx/query-9dabc87e05f72fbd4b586c80d9c7f41c3a72838c5d4c5f795638506084561894.json
@@ -0,0 +1,15 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "INSERT INTO workspace_settings (workspace_id, slack_team_id, slack_name, slack_command_script, slack_email, customer_id, plan, webhook, ai_config, large_file_storage, git_sync, default_app, default_scripts, deploy_ui, mute_critical_alerts, color, operator_settings, role_overrides, teams_command_script, teams_team_id, teams_team_name, git_app_installations, git_credentials, ducklake, dbt_warehouses, slack_oauth_client_id, slack_oauth_client_secret, slack_signing_secret, datatable, teams_team_guid, auto_invite, error_handler, success_handler, public_app_execution_limit_per_minute, error_handler_fallback_to_instance_alerts, guest_access_enabled, guest_jwt_public_key, guest_jwt_jwks_url, add_admins_and_developers_to_forks, remote_deploy_target, remote_deploy_target_changed_at, variable_expiration_handler) SELECT $1, slack_team_id, slack_name, slack_command_script, slack_email, customer_id, plan, webhook, ai_config, large_file_storage, git_sync, default_app, default_scripts, deploy_ui, mute_critical_alerts, color, operator_settings, role_overrides, teams_command_script, teams_team_id, teams_team_name, git_app_installations, git_credentials, ducklake, dbt_warehouses, slack_oauth_client_id, slack_oauth_client_secret, slack_signing_secret, datatable, teams_team_guid, auto_invite, error_handler, success_handler, public_app_execution_limit_per_minute, error_handler_fallback_to_instance_alerts, guest_access_enabled, guest_jwt_public_key, guest_jwt_jwks_url, add_admins_and_developers_to_forks, remote_deploy_target, remote_deploy_target_changed_at, variable_expiration_handler FROM workspace_settings WHERE workspace_id = $2",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Varchar",
+ "Text"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "9dabc87e05f72fbd4b586c80d9c7f41c3a72838c5d4c5f795638506084561894"
+}
diff --git a/backend/.sqlx/query-a0f799d0211f0a7bd649747a6627b82cd0127581ad831089231317af587bb25a.json b/backend/.sqlx/query-a0f799d0211f0a7bd649747a6627b82cd0127581ad831089231317af587bb25a.json
new file mode 100644
index 0000000000..5ac876fa73
--- /dev/null
+++ b/backend/.sqlx/query-a0f799d0211f0a7bd649747a6627b82cd0127581ad831089231317af587bb25a.json
@@ -0,0 +1,29 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT value::text AS \"value!\", is_secret\n FROM variable\n WHERE path = $1 AND workspace_id = $2",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "value!",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 1,
+ "name": "is_secret",
+ "type_info": "Bool"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Text"
+ ]
+ },
+ "nullable": [
+ null,
+ false
+ ]
+ },
+ "hash": "a0f799d0211f0a7bd649747a6627b82cd0127581ad831089231317af587bb25a"
+}
diff --git a/backend/.sqlx/query-a32aea24f8cc6e0aed80dfa1f0928fab0f26ee5a0b9550ea4ab04e2857bebeda.json b/backend/.sqlx/query-a32aea24f8cc6e0aed80dfa1f0928fab0f26ee5a0b9550ea4ab04e2857bebeda.json
new file mode 100644
index 0000000000..1e8970290f
--- /dev/null
+++ b/backend/.sqlx/query-a32aea24f8cc6e0aed80dfa1f0928fab0f26ee5a0b9550ea4ab04e2857bebeda.json
@@ -0,0 +1,15 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "UPDATE workspace_settings SET role_overrides = $1 WHERE workspace_id = $2",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Jsonb",
+ "Text"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "a32aea24f8cc6e0aed80dfa1f0928fab0f26ee5a0b9550ea4ab04e2857bebeda"
+}
diff --git a/backend/.sqlx/query-a37bd72bb1a151e859b4a37a447887e613debd842e575cc740502144bb279bb3.json b/backend/.sqlx/query-a37bd72bb1a151e859b4a37a447887e613debd842e575cc740502144bb279bb3.json
new file mode 100644
index 0000000000..5eb7d45dd4
--- /dev/null
+++ b/backend/.sqlx/query-a37bd72bb1a151e859b4a37a447887e613debd842e575cc740502144bb279bb3.json
@@ -0,0 +1,76 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "\n SELECT workspace_id, username, email, is_admin, created_at, operator, disabled,\n COALESCE(workspace_role, CASE WHEN operator THEN 'operator' ELSE 'developer' END) AS role,\n added_via, is_service_account\n FROM usr\n WHERE workspace_id = $1\n ORDER BY email\n ",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "workspace_id",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 1,
+ "name": "username",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 2,
+ "name": "email",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 3,
+ "name": "is_admin",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 4,
+ "name": "created_at",
+ "type_info": "Timestamptz"
+ },
+ {
+ "ordinal": 5,
+ "name": "operator",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 6,
+ "name": "disabled",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 7,
+ "name": "role",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 8,
+ "name": "added_via",
+ "type_info": "Jsonb"
+ },
+ {
+ "ordinal": 9,
+ "name": "is_service_account",
+ "type_info": "Bool"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text"
+ ]
+ },
+ "nullable": [
+ false,
+ false,
+ false,
+ false,
+ false,
+ false,
+ false,
+ null,
+ true,
+ false
+ ]
+ },
+ "hash": "a37bd72bb1a151e859b4a37a447887e613debd842e575cc740502144bb279bb3"
+}
diff --git a/backend/.sqlx/query-a4badf66d2ae524d15925869c9bfa6b590cb357e19233318d2a2a31555dbc515.json b/backend/.sqlx/query-a4badf66d2ae524d15925869c9bfa6b590cb357e19233318d2a2a31555dbc515.json
new file mode 100644
index 0000000000..828e5ba470
--- /dev/null
+++ b/backend/.sqlx/query-a4badf66d2ae524d15925869c9bfa6b590cb357e19233318d2a2a31555dbc515.json
@@ -0,0 +1,23 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT value::text AS \"value!\" FROM variable WHERE path = $1 AND workspace_id = $2 AND is_secret = true",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "value!",
+ "type_info": "Text"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Text"
+ ]
+ },
+ "nullable": [
+ null
+ ]
+ },
+ "hash": "a4badf66d2ae524d15925869c9bfa6b590cb357e19233318d2a2a31555dbc515"
+}
diff --git a/backend/.sqlx/query-acd87efeb1e92f6c5f04f8482fde597611be96a8f2c6a8ea884c39b11620be57.json b/backend/.sqlx/query-acd87efeb1e92f6c5f04f8482fde597611be96a8f2c6a8ea884c39b11620be57.json
new file mode 100644
index 0000000000..f9ef3977e7
--- /dev/null
+++ b/backend/.sqlx/query-acd87efeb1e92f6c5f04f8482fde597611be96a8f2c6a8ea884c39b11620be57.json
@@ -0,0 +1,41 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT workspace_id,\n (auto_invite->>'operator')::boolean as \"is_operator: bool\",\n auto_invite->>'role' as \"role: String\",\n (auto_invite->>'mode') = 'add' as \"is_auto_add: bool\"\n FROM workspace_settings ws\n WHERE (auto_invite->>'domain' = $1 OR auto_invite->>'domain' = '*')\n AND (auto_invite->>'enabled')::boolean = true\n AND NOT EXISTS (SELECT 1 FROM usr WHERE workspace_id = ws.workspace_id AND email = $2)",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "workspace_id",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 1,
+ "name": "is_operator: bool",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 2,
+ "name": "role: String",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 3,
+ "name": "is_auto_add: bool",
+ "type_info": "Bool"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Text"
+ ]
+ },
+ "nullable": [
+ false,
+ null,
+ null,
+ null
+ ]
+ },
+ "hash": "acd87efeb1e92f6c5f04f8482fde597611be96a8f2c6a8ea884c39b11620be57"
+}
diff --git a/backend/.sqlx/query-af9c259d71af873d81ad788ab05cd0b52f561bfaac0d4e8d17b1aa0900dcc3bc.json b/backend/.sqlx/query-acda97a0d2ebb10942b1049cafe3fc9c997dd9427659ff15f6850be861000bdf.json
similarity index 65%
rename from backend/.sqlx/query-af9c259d71af873d81ad788ab05cd0b52f561bfaac0d4e8d17b1aa0900dcc3bc.json
rename to backend/.sqlx/query-acda97a0d2ebb10942b1049cafe3fc9c997dd9427659ff15f6850be861000bdf.json
index c15c64b3cc..c8c440ac5f 100644
--- a/backend/.sqlx/query-af9c259d71af873d81ad788ab05cd0b52f561bfaac0d4e8d17b1aa0900dcc3bc.json
+++ b/backend/.sqlx/query-acda97a0d2ebb10942b1049cafe3fc9c997dd9427659ff15f6850be861000bdf.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "SELECT c.agent_path FROM slack_agent_channel c\n JOIN workspace_settings ws ON ws.workspace_id = c.workspace_id\n AND ws.slack_team_id = c.slack_team_id\n WHERE c.slack_team_id = $1 AND c.channel_id = $2 ORDER BY c.agent_path LIMIT 11",
+ "query": "SELECT c.agent_path FROM slack_agent_channel c\n JOIN workspace_settings ws ON ws.workspace_id = c.workspace_id\n AND ws.slack_team_id = c.slack_team_id\n WHERE c.slack_team_id = $1 AND c.channel_id = $2\n AND ws.workspace_id = ANY($3)\n ORDER BY c.agent_path LIMIT 11",
"describe": {
"columns": [
{
@@ -12,12 +12,13 @@
"parameters": {
"Left": [
"Text",
- "Text"
+ "Text",
+ "TextArray"
]
},
"nullable": [
false
]
},
- "hash": "af9c259d71af873d81ad788ab05cd0b52f561bfaac0d4e8d17b1aa0900dcc3bc"
+ "hash": "acda97a0d2ebb10942b1049cafe3fc9c997dd9427659ff15f6850be861000bdf"
}
diff --git a/backend/.sqlx/query-ad218040fc53b063508774c6f04d5f82cc2121ea8519311add88f23f0ea0dae9.json b/backend/.sqlx/query-ad218040fc53b063508774c6f04d5f82cc2121ea8519311add88f23f0ea0dae9.json
new file mode 100644
index 0000000000..87a4b3e764
--- /dev/null
+++ b/backend/.sqlx/query-ad218040fc53b063508774c6f04d5f82cc2121ea8519311add88f23f0ea0dae9.json
@@ -0,0 +1,17 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "UPDATE usr SET added_via = $1, is_admin = $2 WHERE username = $3 AND workspace_id = $4",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Jsonb",
+ "Bool",
+ "Text",
+ "Text"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "ad218040fc53b063508774c6f04d5f82cc2121ea8519311add88f23f0ea0dae9"
+}
diff --git a/backend/.sqlx/query-af37e5579b729a1aedcd63ab70d189c7e0376ca1f0071ae8360183ed1300d2bb.json b/backend/.sqlx/query-af37e5579b729a1aedcd63ab70d189c7e0376ca1f0071ae8360183ed1300d2bb.json
new file mode 100644
index 0000000000..c832fdeeda
--- /dev/null
+++ b/backend/.sqlx/query-af37e5579b729a1aedcd63ab70d189c7e0376ca1f0071ae8360183ed1300d2bb.json
@@ -0,0 +1,238 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "\n SELECT\n workspace_id,\n slack_team_id,\n teams_team_id,\n teams_team_name,\n teams_team_guid,\n slack_name,\n slack_command_script,\n teams_command_script,\n slack_email,\n slack_oauth_client_id,\n slack_oauth_client_secret,\n customer_id,\n plan,\n webhook,\n ai_config,\n dbt_warehouses,\n large_file_storage,\n datatable,\n ducklake,\n git_sync,\n deploy_ui,\n default_app,\n default_scripts,\n mute_critical_alerts,\n color,\n operator_settings,\n git_app_installations,\n auto_invite,\n error_handler,\n success_handler,\n variable_expiration_handler,\n public_app_execution_limit_per_minute,\n error_handler_fallback_to_instance_alerts,\n guest_access_enabled,\n guest_jwt_public_key,\n guest_jwt_jwks_url,\n add_admins_and_developers_to_forks\n FROM\n workspace_settings\n WHERE\n workspace_id = $1\n ",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "workspace_id",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 1,
+ "name": "slack_team_id",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 2,
+ "name": "teams_team_id",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 3,
+ "name": "teams_team_name",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 4,
+ "name": "teams_team_guid",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 5,
+ "name": "slack_name",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 6,
+ "name": "slack_command_script",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 7,
+ "name": "teams_command_script",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 8,
+ "name": "slack_email",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 9,
+ "name": "slack_oauth_client_id",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 10,
+ "name": "slack_oauth_client_secret",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 11,
+ "name": "customer_id",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 12,
+ "name": "plan",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 13,
+ "name": "webhook",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 14,
+ "name": "ai_config",
+ "type_info": "Jsonb"
+ },
+ {
+ "ordinal": 15,
+ "name": "dbt_warehouses",
+ "type_info": "Jsonb"
+ },
+ {
+ "ordinal": 16,
+ "name": "large_file_storage",
+ "type_info": "Jsonb"
+ },
+ {
+ "ordinal": 17,
+ "name": "datatable",
+ "type_info": "Jsonb"
+ },
+ {
+ "ordinal": 18,
+ "name": "ducklake",
+ "type_info": "Jsonb"
+ },
+ {
+ "ordinal": 19,
+ "name": "git_sync",
+ "type_info": "Jsonb"
+ },
+ {
+ "ordinal": 20,
+ "name": "deploy_ui",
+ "type_info": "Jsonb"
+ },
+ {
+ "ordinal": 21,
+ "name": "default_app",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 22,
+ "name": "default_scripts",
+ "type_info": "Jsonb"
+ },
+ {
+ "ordinal": 23,
+ "name": "mute_critical_alerts",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 24,
+ "name": "color",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 25,
+ "name": "operator_settings",
+ "type_info": "Jsonb"
+ },
+ {
+ "ordinal": 26,
+ "name": "git_app_installations",
+ "type_info": "Jsonb"
+ },
+ {
+ "ordinal": 27,
+ "name": "auto_invite",
+ "type_info": "Jsonb"
+ },
+ {
+ "ordinal": 28,
+ "name": "error_handler",
+ "type_info": "Jsonb"
+ },
+ {
+ "ordinal": 29,
+ "name": "success_handler",
+ "type_info": "Jsonb"
+ },
+ {
+ "ordinal": 30,
+ "name": "variable_expiration_handler",
+ "type_info": "Jsonb"
+ },
+ {
+ "ordinal": 31,
+ "name": "public_app_execution_limit_per_minute",
+ "type_info": "Int4"
+ },
+ {
+ "ordinal": 32,
+ "name": "error_handler_fallback_to_instance_alerts",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 33,
+ "name": "guest_access_enabled",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 34,
+ "name": "guest_jwt_public_key",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 35,
+ "name": "guest_jwt_jwks_url",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 36,
+ "name": "add_admins_and_developers_to_forks",
+ "type_info": "Bool"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text"
+ ]
+ },
+ "nullable": [
+ false,
+ true,
+ true,
+ true,
+ true,
+ true,
+ true,
+ true,
+ false,
+ true,
+ true,
+ true,
+ true,
+ true,
+ true,
+ true,
+ true,
+ true,
+ true,
+ true,
+ true,
+ true,
+ true,
+ true,
+ true,
+ true,
+ false,
+ true,
+ true,
+ true,
+ true,
+ true,
+ false,
+ false,
+ true,
+ true,
+ false
+ ]
+ },
+ "hash": "af37e5579b729a1aedcd63ab70d189c7e0376ca1f0071ae8360183ed1300d2bb"
+}
diff --git a/backend/.sqlx/query-b0e56637096b48867401967ad5ddc509bbd1e322788789a913d5148c1113643c.json b/backend/.sqlx/query-b0e56637096b48867401967ad5ddc509bbd1e322788789a913d5148c1113643c.json
new file mode 100644
index 0000000000..2478a6c7eb
--- /dev/null
+++ b/backend/.sqlx/query-b0e56637096b48867401967ad5ddc509bbd1e322788789a913d5148c1113643c.json
@@ -0,0 +1,52 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT username, email, is_admin, operator, workspace_role,\n added_via->>'group' as granting_group\n FROM usr\n WHERE workspace_id = $1 AND added_via->>'source' = 'instance_group'\n ORDER BY email",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "username",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 1,
+ "name": "email",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 2,
+ "name": "is_admin",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 3,
+ "name": "operator",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 4,
+ "name": "workspace_role",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 5,
+ "name": "granting_group",
+ "type_info": "Text"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text"
+ ]
+ },
+ "nullable": [
+ false,
+ false,
+ false,
+ false,
+ true,
+ null
+ ]
+ },
+ "hash": "b0e56637096b48867401967ad5ddc509bbd1e322788789a913d5148c1113643c"
+}
diff --git a/backend/.sqlx/query-b19f5156b3e36b5e831ce792637bf54a3f182c03cef0aef06a1c75b45992cd39.json b/backend/.sqlx/query-b19f5156b3e36b5e831ce792637bf54a3f182c03cef0aef06a1c75b45992cd39.json
index 10adc6e68d..4db5bc6e3c 100644
--- a/backend/.sqlx/query-b19f5156b3e36b5e831ce792637bf54a3f182c03cef0aef06a1c75b45992cd39.json
+++ b/backend/.sqlx/query-b19f5156b3e36b5e831ce792637bf54a3f182c03cef0aef06a1c75b45992cd39.json
@@ -11,7 +11,7 @@
],
"parameters": {
"Left": [
- "Varchar",
+ "Text",
"Int8"
]
},
diff --git a/backend/.sqlx/query-44a12919fb154055f1142cc078ef131f8a0c9cdb37cfba6283a6718480b02a4b.json b/backend/.sqlx/query-b2c35e00474b8fa335d9485c1f98018dc033582642988ed7a3181989fef72fed.json
similarity index 63%
rename from backend/.sqlx/query-44a12919fb154055f1142cc078ef131f8a0c9cdb37cfba6283a6718480b02a4b.json
rename to backend/.sqlx/query-b2c35e00474b8fa335d9485c1f98018dc033582642988ed7a3181989fef72fed.json
index 18c572b1fb..44dcca2457 100644
--- a/backend/.sqlx/query-44a12919fb154055f1142cc078ef131f8a0c9cdb37cfba6283a6718480b02a4b.json
+++ b/backend/.sqlx/query-b2c35e00474b8fa335d9485c1f98018dc033582642988ed7a3181989fef72fed.json
@@ -1,12 +1,12 @@
{
"db_name": "PostgreSQL",
- "query": "SELECT value, is_secret, expires_at FROM variable WHERE path = $1",
+ "query": "SELECT value::text AS \"value!\", is_secret, expires_at FROM variable WHERE path = $1",
"describe": {
"columns": [
{
"ordinal": 0,
- "name": "value",
- "type_info": "Varchar"
+ "name": "value!",
+ "type_info": "Text"
},
{
"ordinal": 1,
@@ -25,10 +25,10 @@
]
},
"nullable": [
- false,
+ null,
false,
true
]
},
- "hash": "44a12919fb154055f1142cc078ef131f8a0c9cdb37cfba6283a6718480b02a4b"
+ "hash": "b2c35e00474b8fa335d9485c1f98018dc033582642988ed7a3181989fef72fed"
}
diff --git a/backend/.sqlx/query-b4e9a0266f4112467f534826c664c928d1e608ddd063d9d5ce3cea8ea62faca4.json b/backend/.sqlx/query-b4e9a0266f4112467f534826c664c928d1e608ddd063d9d5ce3cea8ea62faca4.json
new file mode 100644
index 0000000000..aee28fd8b6
--- /dev/null
+++ b/backend/.sqlx/query-b4e9a0266f4112467f534826c664c928d1e608ddd063d9d5ce3cea8ea62faca4.json
@@ -0,0 +1,12 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "UPDATE variable SET value_valid_until = '2029-12-31T00:00:00Z'\n WHERE workspace_id = 'wm-fork-expiry' AND path = 'u/admin/expiring'",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": []
+ },
+ "nullable": []
+ },
+ "hash": "b4e9a0266f4112467f534826c664c928d1e608ddd063d9d5ce3cea8ea62faca4"
+}
diff --git a/backend/.sqlx/query-b57b038384e48f2e6f288056e7261459604a093a74e22770ccdc14207cacbfb0.json b/backend/.sqlx/query-b57b038384e48f2e6f288056e7261459604a093a74e22770ccdc14207cacbfb0.json
new file mode 100644
index 0000000000..b344aa8d0e
--- /dev/null
+++ b/backend/.sqlx/query-b57b038384e48f2e6f288056e7261459604a093a74e22770ccdc14207cacbfb0.json
@@ -0,0 +1,52 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT\n workspace_invite.workspace_id,\n workspace_invite.email,\n workspace_invite.is_admin,\n workspace_invite.operator,\n COALESCE(workspace_invite.workspace_role, CASE WHEN workspace_invite.operator THEN 'operator' ELSE 'developer' END) AS \"role!\",\n workspace.parent_workspace_id\n FROM workspace_invite JOIN workspace ON workspace_invite.workspace_id = workspace.id WHERE email = $1",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "workspace_id",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 1,
+ "name": "email",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 2,
+ "name": "is_admin",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 3,
+ "name": "operator",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 4,
+ "name": "role!",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 5,
+ "name": "parent_workspace_id",
+ "type_info": "Varchar"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text"
+ ]
+ },
+ "nullable": [
+ false,
+ false,
+ false,
+ false,
+ null,
+ true
+ ]
+ },
+ "hash": "b57b038384e48f2e6f288056e7261459604a093a74e22770ccdc14207cacbfb0"
+}
diff --git a/backend/.sqlx/query-b7c7384b335a51f7d1abd2c627ea62ec651c5c6eee947540e7ee5dcea4780b37.json b/backend/.sqlx/query-b7c7384b335a51f7d1abd2c627ea62ec651c5c6eee947540e7ee5dcea4780b37.json
new file mode 100644
index 0000000000..2b930845d2
--- /dev/null
+++ b/backend/.sqlx/query-b7c7384b335a51f7d1abd2c627ea62ec651c5c6eee947540e7ee5dcea4780b37.json
@@ -0,0 +1,14 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "WITH revoked AS (\n DELETE FROM token WHERE email = $1 AND label LIKE 'mcp-oauth-%' RETURNING token_prefix\n ), refresh AS (\n DELETE FROM mcp_oauth_refresh_token WHERE user_email = $1\n ), code AS (\n DELETE FROM mcp_oauth_server_code WHERE user_email = $1\n )\n INSERT INTO notify_event (channel, payload)\n SELECT 'notify_token_invalidation', token_prefix FROM revoked",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Text"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "b7c7384b335a51f7d1abd2c627ea62ec651c5c6eee947540e7ee5dcea4780b37"
+}
diff --git a/backend/.sqlx/query-b8b89624212f32fb6e994b7488fa7152c190bab532406fd26d17dfbd2355c764.json b/backend/.sqlx/query-b8b89624212f32fb6e994b7488fa7152c190bab532406fd26d17dfbd2355c764.json
new file mode 100644
index 0000000000..cdd594c8df
--- /dev/null
+++ b/backend/.sqlx/query-b8b89624212f32fb6e994b7488fa7152c190bab532406fd26d17dfbd2355c764.json
@@ -0,0 +1,35 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT is_admin, operator, workspace_role FROM usr where username = $1 AND workspace_id = $2 AND disabled = false",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "is_admin",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 1,
+ "name": "operator",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 2,
+ "name": "workspace_role",
+ "type_info": "Varchar"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Text"
+ ]
+ },
+ "nullable": [
+ false,
+ false,
+ true
+ ]
+ },
+ "hash": "b8b89624212f32fb6e994b7488fa7152c190bab532406fd26d17dfbd2355c764"
+}
diff --git a/backend/.sqlx/query-1cf8597b9d37ec5a924aff8cbc0a05768ed9a679ba908ab16497a9bd55578ba1.json b/backend/.sqlx/query-bbc38059207753bd92cc543e5d850abe6dd3b66e87d4827c98cbaa5950f4def4.json
similarity index 72%
rename from backend/.sqlx/query-1cf8597b9d37ec5a924aff8cbc0a05768ed9a679ba908ab16497a9bd55578ba1.json
rename to backend/.sqlx/query-bbc38059207753bd92cc543e5d850abe6dd3b66e87d4827c98cbaa5950f4def4.json
index b4a9f19f45..af2c944342 100644
--- a/backend/.sqlx/query-1cf8597b9d37ec5a924aff8cbc0a05768ed9a679ba908ab16497a9bd55578ba1.json
+++ b/backend/.sqlx/query-bbc38059207753bd92cc543e5d850abe6dd3b66e87d4827c98cbaa5950f4def4.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "SELECT usr.*, COALESCE(password.super_admin, false) as \"super_admin!\", password.name FROM usr LEFT JOIN password ON usr.email = password.email Where usr.username = $1 AND workspace_id = $2\n ",
+ "query": "SELECT usr.workspace_id, usr.email, usr.username, usr.is_admin, usr.created_at, usr.operator, usr.disabled, usr.role, usr.added_via, usr.is_service_account, usr.workspace_role, COALESCE(password.super_admin, false) as \"super_admin!\", password.name FROM usr LEFT JOIN password ON usr.email = password.email Where usr.username = $1 AND workspace_id = $2\n ",
"describe": {
"columns": [
{
@@ -10,12 +10,12 @@
},
{
"ordinal": 1,
- "name": "username",
+ "name": "email",
"type_info": "Varchar"
},
{
"ordinal": 2,
- "name": "email",
+ "name": "username",
"type_info": "Varchar"
},
{
@@ -55,11 +55,16 @@
},
{
"ordinal": 10,
+ "name": "workspace_role",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 11,
"name": "super_admin!",
"type_info": "Bool"
},
{
- "ordinal": 11,
+ "ordinal": 12,
"name": "name",
"type_info": "Varchar"
}
@@ -81,9 +86,10 @@
true,
true,
false,
+ true,
null,
true
]
},
- "hash": "1cf8597b9d37ec5a924aff8cbc0a05768ed9a679ba908ab16497a9bd55578ba1"
+ "hash": "bbc38059207753bd92cc543e5d850abe6dd3b66e87d4827c98cbaa5950f4def4"
}
diff --git a/backend/.sqlx/query-ade0696ec69bec2258d2e3ff86bfba6ed3b1d573c298f9d7fe8056ba7e32ed81.json b/backend/.sqlx/query-bc004ad060664cc75fc000229af16538576b978a1083365b5a98fc4ca7ea9576.json
similarity index 58%
rename from backend/.sqlx/query-ade0696ec69bec2258d2e3ff86bfba6ed3b1d573c298f9d7fe8056ba7e32ed81.json
rename to backend/.sqlx/query-bc004ad060664cc75fc000229af16538576b978a1083365b5a98fc4ca7ea9576.json
index 3fe61f6f8e..09fa4b0b11 100644
--- a/backend/.sqlx/query-ade0696ec69bec2258d2e3ff86bfba6ed3b1d573c298f9d7fe8056ba7e32ed81.json
+++ b/backend/.sqlx/query-bc004ad060664cc75fc000229af16538576b978a1083365b5a98fc4ca7ea9576.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "SELECT workspace_id, path, value FROM variable WHERE is_secret = true AND value IS NOT NULL AND value != ''",
+ "query": "SELECT workspace_id, path, value::text AS \"value!\" FROM variable WHERE is_secret = true AND value IS NOT NULL AND value != ''",
"describe": {
"columns": [
{
@@ -15,8 +15,8 @@
},
{
"ordinal": 2,
- "name": "value",
- "type_info": "Varchar"
+ "name": "value!",
+ "type_info": "Text"
}
],
"parameters": {
@@ -25,8 +25,8 @@
"nullable": [
false,
false,
- false
+ null
]
},
- "hash": "ade0696ec69bec2258d2e3ff86bfba6ed3b1d573c298f9d7fe8056ba7e32ed81"
+ "hash": "bc004ad060664cc75fc000229af16538576b978a1083365b5a98fc4ca7ea9576"
}
diff --git a/backend/.sqlx/query-bd2812c7510d2e448c3218dfe3261272c2916540062d57d36c8471c40a398727.json b/backend/.sqlx/query-bd2812c7510d2e448c3218dfe3261272c2916540062d57d36c8471c40a398727.json
new file mode 100644
index 0000000000..381f5ba491
--- /dev/null
+++ b/backend/.sqlx/query-bd2812c7510d2e448c3218dfe3261272c2916540062d57d36c8471c40a398727.json
@@ -0,0 +1,27 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "UPDATE workspace_integrations SET resource_path = $3, updated_at = now()\n WHERE workspace_id = $1 AND service_name = $2",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Text",
+ {
+ "Custom": {
+ "name": "native_trigger_service",
+ "kind": {
+ "Enum": [
+ "nextcloud",
+ "google",
+ "github"
+ ]
+ }
+ }
+ },
+ "Text"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "bd2812c7510d2e448c3218dfe3261272c2916540062d57d36c8471c40a398727"
+}
diff --git a/backend/.sqlx/query-bda9fc0c6e41d8afebee538e6997c6bad7843f93d0a5780632b02fa215aa404b.json b/backend/.sqlx/query-bda9fc0c6e41d8afebee538e6997c6bad7843f93d0a5780632b02fa215aa404b.json
deleted file mode 100644
index 02a979f32f..0000000000
--- a/backend/.sqlx/query-bda9fc0c6e41d8afebee538e6997c6bad7843f93d0a5780632b02fa215aa404b.json
+++ /dev/null
@@ -1,29 +0,0 @@
-{
- "db_name": "PostgreSQL",
- "query": "SELECT path, value FROM variable\n WHERE path LIKE ('u/' || $1 || '/%')\n AND workspace_id = $2\n AND is_secret = true\n AND (value LIKE '$vault:%' OR value LIKE '$azure_kv:%')",
- "describe": {
- "columns": [
- {
- "ordinal": 0,
- "name": "path",
- "type_info": "Varchar"
- },
- {
- "ordinal": 1,
- "name": "value",
- "type_info": "Varchar"
- }
- ],
- "parameters": {
- "Left": [
- "Text",
- "Text"
- ]
- },
- "nullable": [
- false,
- false
- ]
- },
- "hash": "bda9fc0c6e41d8afebee538e6997c6bad7843f93d0a5780632b02fa215aa404b"
-}
diff --git a/backend/.sqlx/query-c01d2853ab35a404e0cce34c273c7ad58cd9add49f45fd50f4fcf909703d01a2.json b/backend/.sqlx/query-c01d2853ab35a404e0cce34c273c7ad58cd9add49f45fd50f4fcf909703d01a2.json
new file mode 100644
index 0000000000..dfa1689d15
--- /dev/null
+++ b/backend/.sqlx/query-c01d2853ab35a404e0cce34c273c7ad58cd9add49f45fd50f4fcf909703d01a2.json
@@ -0,0 +1,34 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT slack_oauth_client_id, slack_oauth_client_secret, slack_signing_secret\n FROM workspace_settings WHERE workspace_id = $1",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "slack_oauth_client_id",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 1,
+ "name": "slack_oauth_client_secret",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 2,
+ "name": "slack_signing_secret",
+ "type_info": "Text"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text"
+ ]
+ },
+ "nullable": [
+ true,
+ true,
+ true
+ ]
+ },
+ "hash": "c01d2853ab35a404e0cce34c273c7ad58cd9add49f45fd50f4fcf909703d01a2"
+}
diff --git a/backend/.sqlx/query-c0aff25f0cc3b71842b0ba9ae55b6bc5eca203bf02f46164db08580d128b860a.json b/backend/.sqlx/query-c0aff25f0cc3b71842b0ba9ae55b6bc5eca203bf02f46164db08580d128b860a.json
deleted file mode 100644
index 74a9d24135..0000000000
--- a/backend/.sqlx/query-c0aff25f0cc3b71842b0ba9ae55b6bc5eca203bf02f46164db08580d128b860a.json
+++ /dev/null
@@ -1,29 +0,0 @@
-{
- "db_name": "PostgreSQL",
- "query": "SELECT value, account FROM variable WHERE workspace_id = $1 AND path = $2",
- "describe": {
- "columns": [
- {
- "ordinal": 0,
- "name": "value",
- "type_info": "Varchar"
- },
- {
- "ordinal": 1,
- "name": "account",
- "type_info": "Int4"
- }
- ],
- "parameters": {
- "Left": [
- "Text",
- "Text"
- ]
- },
- "nullable": [
- false,
- true
- ]
- },
- "hash": "c0aff25f0cc3b71842b0ba9ae55b6bc5eca203bf02f46164db08580d128b860a"
-}
diff --git a/backend/.sqlx/query-c17ac5cf890831ede0811263a0f35e8cb2fe4df224e2ab633a1e69c4bcfa6cd1.json b/backend/.sqlx/query-c17ac5cf890831ede0811263a0f35e8cb2fe4df224e2ab633a1e69c4bcfa6cd1.json
new file mode 100644
index 0000000000..f468c212dd
--- /dev/null
+++ b/backend/.sqlx/query-c17ac5cf890831ede0811263a0f35e8cb2fe4df224e2ab633a1e69c4bcfa6cd1.json
@@ -0,0 +1,16 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "UPDATE native_trigger SET connection_path = REGEXP_REPLACE(connection_path, 'u/' || $2 || '/(.*)', $1 || '/\\1') WHERE connection_path LIKE ('u/' || $2 || '/%') AND workspace_id = $3",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Text",
+ "Text"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "c17ac5cf890831ede0811263a0f35e8cb2fe4df224e2ab633a1e69c4bcfa6cd1"
+}
diff --git a/backend/.sqlx/query-146f0e42ada3068a5cdae0ffdbb54b63f8c06c9143b16ce399170c1b5a6b911e.json b/backend/.sqlx/query-c1be495552d1bd4c38e378016324b3bc473599c4cb1b2181144988eb88e9fa17.json
similarity index 57%
rename from backend/.sqlx/query-146f0e42ada3068a5cdae0ffdbb54b63f8c06c9143b16ce399170c1b5a6b911e.json
rename to backend/.sqlx/query-c1be495552d1bd4c38e378016324b3bc473599c4cb1b2181144988eb88e9fa17.json
index 9fd6daded5..72f509fc57 100644
--- a/backend/.sqlx/query-146f0e42ada3068a5cdae0ffdbb54b63f8c06c9143b16ce399170c1b5a6b911e.json
+++ b/backend/.sqlx/query-c1be495552d1bd4c38e378016324b3bc473599c4cb1b2181144988eb88e9fa17.json
@@ -1,16 +1,16 @@
{
"db_name": "PostgreSQL",
- "query": "SELECT value, is_secret FROM variable WHERE path = $1 AND workspace_id = $2",
+ "query": "SELECT workspace_role, operator FROM usr WHERE workspace_id = $1 AND username = $2",
"describe": {
"columns": [
{
"ordinal": 0,
- "name": "value",
+ "name": "workspace_role",
"type_info": "Varchar"
},
{
"ordinal": 1,
- "name": "is_secret",
+ "name": "operator",
"type_info": "Bool"
}
],
@@ -21,9 +21,9 @@
]
},
"nullable": [
- false,
+ true,
false
]
},
- "hash": "146f0e42ada3068a5cdae0ffdbb54b63f8c06c9143b16ce399170c1b5a6b911e"
+ "hash": "c1be495552d1bd4c38e378016324b3bc473599c4cb1b2181144988eb88e9fa17"
}
diff --git a/backend/.sqlx/query-c2efefded4eaea858c41c32ef20e2c11ed88327cf033e1abfd7c0458b71f53da.json b/backend/.sqlx/query-c2efefded4eaea858c41c32ef20e2c11ed88327cf033e1abfd7c0458b71f53da.json
index ee946012b2..5791e1ca31 100644
--- a/backend/.sqlx/query-c2efefded4eaea858c41c32ef20e2c11ed88327cf033e1abfd7c0458b71f53da.json
+++ b/backend/.sqlx/query-c2efefded4eaea858c41c32ef20e2c11ed88327cf033e1abfd7c0458b71f53da.json
@@ -76,7 +76,7 @@
false,
false,
false,
- false,
+ true,
false,
false,
false,
diff --git a/backend/.sqlx/query-c427c9dad3de3acc361c341b359453197d7683bc8fd5a96be462e3493e957cee.json b/backend/.sqlx/query-c427c9dad3de3acc361c341b359453197d7683bc8fd5a96be462e3493e957cee.json
new file mode 100644
index 0000000000..f851507f4e
--- /dev/null
+++ b/backend/.sqlx/query-c427c9dad3de3acc361c341b359453197d7683bc8fd5a96be462e3493e957cee.json
@@ -0,0 +1,16 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "UPDATE variable SET value = $1 WHERE workspace_id = $2 AND account = $3",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Varchar",
+ "Text",
+ "Int4"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "c427c9dad3de3acc361c341b359453197d7683bc8fd5a96be462e3493e957cee"
+}
diff --git a/backend/.sqlx/query-f3cd54017710536747b8aca797a8b983774ee2127dceb790181ed91b987f44ff.json b/backend/.sqlx/query-c5a7f56bed61174904d3bb1b7be704a4d1a3a4da8c995319f3cc3ce96d8ef5cc.json
similarity index 65%
rename from backend/.sqlx/query-f3cd54017710536747b8aca797a8b983774ee2127dceb790181ed91b987f44ff.json
rename to backend/.sqlx/query-c5a7f56bed61174904d3bb1b7be704a4d1a3a4da8c995319f3cc3ce96d8ef5cc.json
index 6964dfa8d6..48435310f8 100644
--- a/backend/.sqlx/query-f3cd54017710536747b8aca797a8b983774ee2127dceb790181ed91b987f44ff.json
+++ b/backend/.sqlx/query-c5a7f56bed61174904d3bb1b7be704a4d1a3a4da8c995319f3cc3ce96d8ef5cc.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "\n SELECT\n nt.external_id,\n nt.workspace_id,\n nt.service_name AS \"service_name!: ServiceName\",\n nt.script_path,\n nt.is_flow,\n nt.webhook_token_hash,\n nt.service_config,\n nt.error,\n nt.created_at,\n nt.updated_at,\n nt.summary,\n nt.enabled\n FROM\n native_trigger nt\n WHERE\n nt.workspace_id = $1 AND\n nt.service_name = $2 AND\n ($5::text IS NULL OR nt.script_path = $5) AND\n ($6::bool IS NULL OR nt.is_flow = $6) AND\n (\n (nt.is_flow = false AND EXISTS (\n SELECT 1 FROM script s\n WHERE s.workspace_id = nt.workspace_id\n AND s.path = nt.script_path\n ))\n OR\n (nt.is_flow = true AND EXISTS (\n SELECT 1 FROM flow f\n WHERE f.workspace_id = nt.workspace_id\n AND f.path = nt.script_path\n ))\n ) AND\n ( $7\n OR nt.script_path = ANY($8)\n OR EXISTS ( SELECT 1 FROM unnest($9::text[]) AS pfx\n WHERE nt.script_path = pfx\n OR left(nt.script_path, length(pfx) + 1) = pfx || '/' ) )\n LIMIT $3\n OFFSET $4\n ",
+ "query": "\n SELECT\n nt.external_id,\n nt.workspace_id,\n nt.service_name AS \"service_name!: ServiceName\",\n nt.script_path,\n nt.is_flow,\n nt.webhook_token_hash,\n nt.service_config,\n nt.error,\n nt.created_at,\n nt.updated_at,\n nt.summary,\n nt.enabled,\n nt.connection_path\n FROM\n native_trigger nt\n WHERE\n nt.workspace_id = $1 AND\n nt.service_name = $2 AND\n ($5::text IS NULL OR nt.script_path = $5) AND\n ($6::bool IS NULL OR nt.is_flow = $6) AND\n (\n (nt.is_flow = false AND EXISTS (\n SELECT 1 FROM script s\n WHERE s.workspace_id = nt.workspace_id\n AND s.path = nt.script_path\n ))\n OR\n (nt.is_flow = true AND EXISTS (\n SELECT 1 FROM flow f\n WHERE f.workspace_id = nt.workspace_id\n AND f.path = nt.script_path\n ))\n ) AND\n ( $7\n OR nt.script_path = ANY($8)\n OR EXISTS ( SELECT 1 FROM unnest($9::text[]) AS pfx\n WHERE nt.script_path = pfx\n OR left(nt.script_path, length(pfx) + 1) = pfx || '/' ) )\n LIMIT $3\n OFFSET $4\n ",
"describe": {
"columns": [
{
@@ -73,6 +73,11 @@
"ordinal": 11,
"name": "enabled",
"type_info": "Bool"
+ },
+ {
+ "ordinal": 12,
+ "name": "connection_path",
+ "type_info": "Varchar"
}
],
"parameters": {
@@ -111,8 +116,9 @@
false,
false,
true,
- false
+ false,
+ true
]
},
- "hash": "f3cd54017710536747b8aca797a8b983774ee2127dceb790181ed91b987f44ff"
+ "hash": "c5a7f56bed61174904d3bb1b7be704a4d1a3a4da8c995319f3cc3ce96d8ef5cc"
}
diff --git a/backend/.sqlx/query-c7a1a350f95523df4e2012d2d21ec87a0016b1949cfe2d901aacc281d9442738.json b/backend/.sqlx/query-c7a1a350f95523df4e2012d2d21ec87a0016b1949cfe2d901aacc281d9442738.json
new file mode 100644
index 0000000000..01baaa7c57
--- /dev/null
+++ b/backend/.sqlx/query-c7a1a350f95523df4e2012d2d21ec87a0016b1949cfe2d901aacc281d9442738.json
@@ -0,0 +1,15 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "INSERT INTO role_seat (workspace_id, role, author)\n SELECT $1, role, author FROM role_seat WHERE workspace_id = $2\n ON CONFLICT DO NOTHING",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Varchar",
+ "Text"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "c7a1a350f95523df4e2012d2d21ec87a0016b1949cfe2d901aacc281d9442738"
+}
diff --git a/backend/.sqlx/query-ca4c2768d111fbd653f1a73afc669b58a0016bfb4f0dad133ef2c25b8cd8b4b6.json b/backend/.sqlx/query-ca4c2768d111fbd653f1a73afc669b58a0016bfb4f0dad133ef2c25b8cd8b4b6.json
new file mode 100644
index 0000000000..c84a500f29
--- /dev/null
+++ b/backend/.sqlx/query-ca4c2768d111fbd653f1a73afc669b58a0016bfb4f0dad133ef2c25b8cd8b4b6.json
@@ -0,0 +1,17 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "INSERT INTO workspace_invite\n (workspace_id, email, is_admin, operator, workspace_role)\n VALUES ($1, $2, false, $3, $4)\n ON CONFLICT DO NOTHING",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Varchar",
+ "Varchar",
+ "Bool",
+ "Varchar"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "ca4c2768d111fbd653f1a73afc669b58a0016bfb4f0dad133ef2c25b8cd8b4b6"
+}
diff --git a/backend/.sqlx/query-cbc0edfcdda98420e728e35508e46d9b9ecb504cbea4976c8f45fc089cb81977.json b/backend/.sqlx/query-cbc0edfcdda98420e728e35508e46d9b9ecb504cbea4976c8f45fc089cb81977.json
new file mode 100644
index 0000000000..d109e62811
--- /dev/null
+++ b/backend/.sqlx/query-cbc0edfcdda98420e728e35508e46d9b9ecb504cbea4976c8f45fc089cb81977.json
@@ -0,0 +1,15 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "UPDATE role_seat SET workspace_id = $1 WHERE workspace_id = $2",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Varchar",
+ "Text"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "cbc0edfcdda98420e728e35508e46d9b9ecb504cbea4976c8f45fc089cb81977"
+}
diff --git a/backend/.sqlx/query-cc2dbdc132fe751c7e82445aae5031d05da988837ce41d63a43d13c2018a57d3.json b/backend/.sqlx/query-cc2dbdc132fe751c7e82445aae5031d05da988837ce41d63a43d13c2018a57d3.json
new file mode 100644
index 0000000000..5abf2efb76
--- /dev/null
+++ b/backend/.sqlx/query-cc2dbdc132fe751c7e82445aae5031d05da988837ce41d63a43d13c2018a57d3.json
@@ -0,0 +1,71 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT v.workspace_id, v.path, v.description, v.value_valid_until AS \"value_valid_until!\",\n v.is_secret, v.expiration_dispatched_for, v.expiration_notified_at,\n ws.variable_expiration_handler->>'path' AS \"handler_path!\",\n (ws.variable_expiration_handler->'extra_args')::text::json\n AS \"extra_args: Json>\"\n FROM variable v\n JOIN workspace_settings ws ON ws.workspace_id = v.workspace_id\n JOIN workspace w ON w.id = v.workspace_id\n WHERE NOT w.deleted\n AND v.value_valid_until IS NOT NULL\n AND (v.value_valid_until IS DISTINCT FROM v.expiration_dispatched_for\n OR (v.value_valid_until > now()\n AND v.expiration_notified_at <= now() - make_interval(secs =>\n NULLIF((ws.variable_expiration_handler->>'remind_every_secs')::bigint, 0) - $2)))\n AND v.value_valid_until <= now() + make_interval(secs =>\n COALESCE((ws.variable_expiration_handler->>'notify_before_secs')::bigint, $1))\n AND ws.variable_expiration_handler->>'path' IS NOT NULL\n AND (NOT COALESCE((ws.variable_expiration_handler->>'muted_on_user_path')::boolean, false)\n OR v.path NOT LIKE 'u/%')",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "workspace_id",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 1,
+ "name": "path",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 2,
+ "name": "description",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 3,
+ "name": "value_valid_until!",
+ "type_info": "Timestamptz"
+ },
+ {
+ "ordinal": 4,
+ "name": "is_secret",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 5,
+ "name": "expiration_dispatched_for",
+ "type_info": "Timestamptz"
+ },
+ {
+ "ordinal": 6,
+ "name": "expiration_notified_at",
+ "type_info": "Timestamptz"
+ },
+ {
+ "ordinal": 7,
+ "name": "handler_path!",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 8,
+ "name": "extra_args: Json>",
+ "type_info": "Json"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Int8",
+ "Int8"
+ ]
+ },
+ "nullable": [
+ false,
+ false,
+ false,
+ true,
+ false,
+ true,
+ true,
+ null,
+ null
+ ]
+ },
+ "hash": "cc2dbdc132fe751c7e82445aae5031d05da988837ce41d63a43d13c2018a57d3"
+}
diff --git a/backend/.sqlx/query-cce5e3e639faed8e42574730cc66f0322a83c01cc465742f54a21f8fe5f4f037.json b/backend/.sqlx/query-cce5e3e639faed8e42574730cc66f0322a83c01cc465742f54a21f8fe5f4f037.json
index 29f31c62eb..59ee111e89 100644
--- a/backend/.sqlx/query-cce5e3e639faed8e42574730cc66f0322a83c01cc465742f54a21f8fe5f4f037.json
+++ b/backend/.sqlx/query-cce5e3e639faed8e42574730cc66f0322a83c01cc465742f54a21f8fe5f4f037.json
@@ -39,7 +39,8 @@
"java",
"duckdb",
"ruby",
- "rlang"
+ "rlang",
+ "dbt"
]
}
}
diff --git a/backend/.sqlx/query-72076c1c210c57ef5db26620063c750c4a7eef6dcb2f4a91c7a3ddc2d367e3ba.json b/backend/.sqlx/query-cd829b96e6d8f4ed9a0283d9141ce8588ad36379991e71b10e49211891219a92.json
similarity index 51%
rename from backend/.sqlx/query-72076c1c210c57ef5db26620063c750c4a7eef6dcb2f4a91c7a3ddc2d367e3ba.json
rename to backend/.sqlx/query-cd829b96e6d8f4ed9a0283d9141ce8588ad36379991e71b10e49211891219a92.json
index b3482a1535..fa44c1e169 100644
--- a/backend/.sqlx/query-72076c1c210c57ef5db26620063c750c4a7eef6dcb2f4a91c7a3ddc2d367e3ba.json
+++ b/backend/.sqlx/query-cd829b96e6d8f4ed9a0283d9141ce8588ad36379991e71b10e49211891219a92.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "UPDATE workspace_settings\n SET slack_oauth_client_id = NULL, slack_oauth_client_secret = NULL\n WHERE workspace_id = $1",
+ "query": "UPDATE workspace_settings\n SET slack_oauth_client_id = NULL, slack_oauth_client_secret = NULL,\n slack_signing_secret = NULL\n WHERE workspace_id = $1",
"describe": {
"columns": [],
"parameters": {
@@ -10,5 +10,5 @@
},
"nullable": []
},
- "hash": "72076c1c210c57ef5db26620063c750c4a7eef6dcb2f4a91c7a3ddc2d367e3ba"
+ "hash": "cd829b96e6d8f4ed9a0283d9141ce8588ad36379991e71b10e49211891219a92"
}
diff --git a/backend/.sqlx/query-ce033ee4db97c0f9ae643d287f1a3f1578a6be8686e02c3faa55100eb8fa3700.json b/backend/.sqlx/query-ce033ee4db97c0f9ae643d287f1a3f1578a6be8686e02c3faa55100eb8fa3700.json
new file mode 100644
index 0000000000..3e44f3ab42
--- /dev/null
+++ b/backend/.sqlx/query-ce033ee4db97c0f9ae643d287f1a3f1578a6be8686e02c3faa55100eb8fa3700.json
@@ -0,0 +1,17 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "INSERT INTO workspace_invite\n (workspace_id, email, is_admin, operator, workspace_role)\n SELECT $1::text, email, false, $3, $4 FROM password WHERE ($2::text = '*' OR email LIKE CONCAT('%@', $2::text)) AND NOT EXISTS (\n SELECT 1 FROM usr WHERE workspace_id = $1::text AND email = password.email\n )\n ON CONFLICT DO NOTHING",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Text",
+ "Bool",
+ "Varchar"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "ce033ee4db97c0f9ae643d287f1a3f1578a6be8686e02c3faa55100eb8fa3700"
+}
diff --git a/backend/.sqlx/query-d46f75bb9d7144d571a31ddbb3c986ea2bfd561943ff512ac20f93203e02c3d8.json b/backend/.sqlx/query-d46f75bb9d7144d571a31ddbb3c986ea2bfd561943ff512ac20f93203e02c3d8.json
new file mode 100644
index 0000000000..f70dff1f07
--- /dev/null
+++ b/backend/.sqlx/query-d46f75bb9d7144d571a31ddbb3c986ea2bfd561943ff512ac20f93203e02c3d8.json
@@ -0,0 +1,77 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT workspace_id, username, email, is_admin, created_at, operator, disabled,\n COALESCE(workspace_role, CASE WHEN operator THEN 'operator' ELSE 'developer' END) AS role,\n added_via, is_service_account\n FROM usr WHERE username = $1 AND workspace_id = $2",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "workspace_id",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 1,
+ "name": "username",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 2,
+ "name": "email",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 3,
+ "name": "is_admin",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 4,
+ "name": "created_at",
+ "type_info": "Timestamptz"
+ },
+ {
+ "ordinal": 5,
+ "name": "operator",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 6,
+ "name": "disabled",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 7,
+ "name": "role",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 8,
+ "name": "added_via",
+ "type_info": "Jsonb"
+ },
+ {
+ "ordinal": 9,
+ "name": "is_service_account",
+ "type_info": "Bool"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Text"
+ ]
+ },
+ "nullable": [
+ false,
+ false,
+ false,
+ false,
+ false,
+ false,
+ false,
+ null,
+ true,
+ false
+ ]
+ },
+ "hash": "d46f75bb9d7144d571a31ddbb3c986ea2bfd561943ff512ac20f93203e02c3d8"
+}
diff --git a/backend/.sqlx/query-d79ba22a53c9f96c96fcd4b4cf0e6cc17f767055de943709192ef1ff5106eac5.json b/backend/.sqlx/query-d79ba22a53c9f96c96fcd4b4cf0e6cc17f767055de943709192ef1ff5106eac5.json
new file mode 100644
index 0000000000..3f3a3f20e4
--- /dev/null
+++ b/backend/.sqlx/query-d79ba22a53c9f96c96fcd4b4cf0e6cc17f767055de943709192ef1ff5106eac5.json
@@ -0,0 +1,23 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT v.path FROM variable v\n JOIN account a ON a.workspace_id = v.workspace_id AND a.id = v.account\n WHERE v.workspace_id = $1 AND a.client = $2 AND a.is_workspace_integration = true",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "path",
+ "type_info": "Varchar"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Text"
+ ]
+ },
+ "nullable": [
+ false
+ ]
+ },
+ "hash": "d79ba22a53c9f96c96fcd4b4cf0e6cc17f767055de943709192ef1ff5106eac5"
+}
diff --git a/backend/.sqlx/query-0987f164fe3d64bf0a6a4e9699c2d1f339670da3ed1c08203d54d45798d022dd.json b/backend/.sqlx/query-d976c78db15dac2c70edcea6d7d9ceed91c54f592d0e1f5139d5e111241ca451.json
similarity index 82%
rename from backend/.sqlx/query-0987f164fe3d64bf0a6a4e9699c2d1f339670da3ed1c08203d54d45798d022dd.json
rename to backend/.sqlx/query-d976c78db15dac2c70edcea6d7d9ceed91c54f592d0e1f5139d5e111241ca451.json
index 8aecbed333..0fe46de01d 100644
--- a/backend/.sqlx/query-0987f164fe3d64bf0a6a4e9699c2d1f339670da3ed1c08203d54d45798d022dd.json
+++ b/backend/.sqlx/query-d976c78db15dac2c70edcea6d7d9ceed91c54f592d0e1f5139d5e111241ca451.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "\n SELECT\n external_id,\n workspace_id,\n service_name AS \"service_name!: ServiceName\",\n script_path,\n is_flow,\n webhook_token_hash,\n service_config,\n error,\n created_at,\n updated_at,\n summary,\n enabled\n FROM\n native_trigger\n WHERE\n workspace_id = $1\n AND service_name = $2\n AND script_path = $3\n AND is_flow = $4\n LIMIT 1\n ",
+ "query": "\n SELECT\n external_id,\n workspace_id,\n service_name AS \"service_name!: ServiceName\",\n script_path,\n is_flow,\n webhook_token_hash,\n service_config,\n error,\n created_at,\n updated_at,\n summary,\n enabled,\n connection_path\n FROM\n native_trigger\n WHERE\n workspace_id = $1\n AND service_name = $2\n AND script_path = $3\n AND is_flow = $4\n LIMIT 1\n ",
"describe": {
"columns": [
{
@@ -73,6 +73,11 @@
"ordinal": 11,
"name": "enabled",
"type_info": "Bool"
+ },
+ {
+ "ordinal": 12,
+ "name": "connection_path",
+ "type_info": "Varchar"
}
],
"parameters": {
@@ -106,8 +111,9 @@
false,
false,
true,
- false
+ false,
+ true
]
},
- "hash": "0987f164fe3d64bf0a6a4e9699c2d1f339670da3ed1c08203d54d45798d022dd"
+ "hash": "d976c78db15dac2c70edcea6d7d9ceed91c54f592d0e1f5139d5e111241ca451"
}
diff --git a/backend/.sqlx/query-daaaa027338cd77d6400658667351a4d3bbe6d1309cd8205e853097c9f81a471.json b/backend/.sqlx/query-daaaa027338cd77d6400658667351a4d3bbe6d1309cd8205e853097c9f81a471.json
new file mode 100644
index 0000000000..b2e7a8668c
--- /dev/null
+++ b/backend/.sqlx/query-daaaa027338cd77d6400658667351a4d3bbe6d1309cd8205e853097c9f81a471.json
@@ -0,0 +1,16 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "UPDATE native_trigger SET connection_path = REGEXP_REPLACE(connection_path, 'u/' || $2 || '/(.*)', 'u/' || $1 || '/\\1') WHERE connection_path LIKE ('u/' || $2 || '/%') AND workspace_id = $3",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Text",
+ "Text"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "daaaa027338cd77d6400658667351a4d3bbe6d1309cd8205e853097c9f81a471"
+}
diff --git a/backend/.sqlx/query-db9831a3218b36c32b305b9f2ba21abceec74c9c277f27231dba12868e68126b.json b/backend/.sqlx/query-db9831a3218b36c32b305b9f2ba21abceec74c9c277f27231dba12868e68126b.json
deleted file mode 100644
index 3562a6f345..0000000000
--- a/backend/.sqlx/query-db9831a3218b36c32b305b9f2ba21abceec74c9c277f27231dba12868e68126b.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "db_name": "PostgreSQL",
- "query": "UPDATE account SET refresh_token = $1, expires_at = $2, refresh_error = NULL WHERE workspace_id = $3 AND id = $4",
- "describe": {
- "columns": [],
- "parameters": {
- "Left": [
- "Varchar",
- "Timestamptz",
- "Text",
- "Int4"
- ]
- },
- "nullable": []
- },
- "hash": "db9831a3218b36c32b305b9f2ba21abceec74c9c277f27231dba12868e68126b"
-}
diff --git a/backend/.sqlx/query-dcb5053bdae0a2d141f7e7cb16988f5bc2c40c098558d92ab768281f4e9664c5.json b/backend/.sqlx/query-dcb5053bdae0a2d141f7e7cb16988f5bc2c40c098558d92ab768281f4e9664c5.json
new file mode 100644
index 0000000000..12e32dfe45
--- /dev/null
+++ b/backend/.sqlx/query-dcb5053bdae0a2d141f7e7cb16988f5bc2c40c098558d92ab768281f4e9664c5.json
@@ -0,0 +1,23 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT COUNT(*) FROM usr t WHERE ($1::text IS NOT NULL AND t.workspace_id = $1\n OR $1::text IS NULL AND NOT EXISTS (SELECT 1 FROM workspace_settings ws\n WHERE ws.workspace_id = t.workspace_id AND ws.role_overrides ? $2)) AND\n COALESCE(t.workspace_role, CASE WHEN t.operator THEN 'operator' ELSE 'developer' END) = $2",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "count",
+ "type_info": "Int8"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Text"
+ ]
+ },
+ "nullable": [
+ null
+ ]
+ },
+ "hash": "dcb5053bdae0a2d141f7e7cb16988f5bc2c40c098558d92ab768281f4e9664c5"
+}
diff --git a/backend/.sqlx/query-dda346e3e9d2cab64532948de09cf6dea2537923a987be5584fbcb1c0dc69b7f.json b/backend/.sqlx/query-dda346e3e9d2cab64532948de09cf6dea2537923a987be5584fbcb1c0dc69b7f.json
new file mode 100644
index 0000000000..189593b34c
--- /dev/null
+++ b/backend/.sqlx/query-dda346e3e9d2cab64532948de09cf6dea2537923a987be5584fbcb1c0dc69b7f.json
@@ -0,0 +1,16 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "UPDATE workspace_settings\n SET slack_oauth_client_id = $1, slack_oauth_client_secret = $2,\n slack_signing_secret = CASE WHEN slack_oauth_client_id = $1::varchar\n THEN slack_signing_secret END\n WHERE workspace_id = $3",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Varchar",
+ "Varchar",
+ "Text"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "dda346e3e9d2cab64532948de09cf6dea2537923a987be5584fbcb1c0dc69b7f"
+}
diff --git a/backend/.sqlx/query-ddd41de79b23b0436bbc7997751c90d7d82bd20ea30f1dc08f2e2066fb8d6f4b.json b/backend/.sqlx/query-ddd41de79b23b0436bbc7997751c90d7d82bd20ea30f1dc08f2e2066fb8d6f4b.json
index 9622e63a56..02c50b1e45 100644
--- a/backend/.sqlx/query-ddd41de79b23b0436bbc7997751c90d7d82bd20ea30f1dc08f2e2066fb8d6f4b.json
+++ b/backend/.sqlx/query-ddd41de79b23b0436bbc7997751c90d7d82bd20ea30f1dc08f2e2066fb8d6f4b.json
@@ -23,4 +23,4 @@
]
},
"hash": "ddd41de79b23b0436bbc7997751c90d7d82bd20ea30f1dc08f2e2066fb8d6f4b"
-}
\ No newline at end of file
+}
diff --git a/backend/.sqlx/query-bc6ebef9d41aba232f115f95404922c6054df01fa7f38f5d15d6d4af6c726a3c.json b/backend/.sqlx/query-de0d78bf28a5b6457e5568dce9823a4c216b4be67b68241461b42326d9d65256.json
similarity index 74%
rename from backend/.sqlx/query-bc6ebef9d41aba232f115f95404922c6054df01fa7f38f5d15d6d4af6c726a3c.json
rename to backend/.sqlx/query-de0d78bf28a5b6457e5568dce9823a4c216b4be67b68241461b42326d9d65256.json
index d77682a4ea..e2145fc10a 100644
--- a/backend/.sqlx/query-bc6ebef9d41aba232f115f95404922c6054df01fa7f38f5d15d6d4af6c726a3c.json
+++ b/backend/.sqlx/query-de0d78bf28a5b6457e5568dce9823a4c216b4be67b68241461b42326d9d65256.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "SELECT COUNT(*) FROM group_ WHERE name != 'all' AND name != 'error_handler' AND name != 'slack' AND name != 'wm_deployers'",
+ "query": "SELECT COUNT(*) FROM group_ WHERE name != 'all' AND name != 'error_handler' AND name != 'slack' AND name != 'wm_deployers' AND name != 'variable_expiration_handler'",
"describe": {
"columns": [
{
@@ -16,5 +16,5 @@
null
]
},
- "hash": "bc6ebef9d41aba232f115f95404922c6054df01fa7f38f5d15d6d4af6c726a3c"
+ "hash": "de0d78bf28a5b6457e5568dce9823a4c216b4be67b68241461b42326d9d65256"
}
diff --git a/backend/.sqlx/query-dec3b1a5a743bfcee0c6a1efdfc7398c1c11277e968af4acb9393ba2b340dd1e.json b/backend/.sqlx/query-dec3b1a5a743bfcee0c6a1efdfc7398c1c11277e968af4acb9393ba2b340dd1e.json
new file mode 100644
index 0000000000..6f1cc55c51
--- /dev/null
+++ b/backend/.sqlx/query-dec3b1a5a743bfcee0c6a1efdfc7398c1c11277e968af4acb9393ba2b340dd1e.json
@@ -0,0 +1,29 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT path, value::text AS \"value!\" FROM variable\n WHERE path LIKE ('u/' || $1 || '/%')\n AND workspace_id = $2\n AND is_secret = true\n AND (value LIKE '$vault:%' OR value LIKE '$azure_kv:%')",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "path",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 1,
+ "name": "value!",
+ "type_info": "Text"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Text"
+ ]
+ },
+ "nullable": [
+ false,
+ null
+ ]
+ },
+ "hash": "dec3b1a5a743bfcee0c6a1efdfc7398c1c11277e968af4acb9393ba2b340dd1e"
+}
diff --git a/backend/.sqlx/query-f0d8ebbf62a1d92f39c2f86a70236cece6d6c9e28cce9aff7fe5496bba569807.json b/backend/.sqlx/query-df8f616f7ace1d45cb9022d70e53bef3389884cdde284ed3eb3b8d6979761b98.json
similarity index 81%
rename from backend/.sqlx/query-f0d8ebbf62a1d92f39c2f86a70236cece6d6c9e28cce9aff7fe5496bba569807.json
rename to backend/.sqlx/query-df8f616f7ace1d45cb9022d70e53bef3389884cdde284ed3eb3b8d6979761b98.json
index 912db1a932..ed386844d4 100644
--- a/backend/.sqlx/query-f0d8ebbf62a1d92f39c2f86a70236cece6d6c9e28cce9aff7fe5496bba569807.json
+++ b/backend/.sqlx/query-df8f616f7ace1d45cb9022d70e53bef3389884cdde284ed3eb3b8d6979761b98.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "SELECT fork_last_event_kind, fork_last_event_origin FROM workspace_diff\n WHERE fork_workspace_id = 'wm-fork-renamed' AND kind = 'script'\n AND path = 'u/admin/inline' AND fork_last_event_kind IS NOT NULL",
+ "query": "SELECT fork_last_event_kind, fork_last_event_origin FROM workspace_diff\n WHERE fork_workspace_id = 'wm-fork-renamed' AND kind = 'script'\n AND path = 'u/admin/inline' AND fork_last_event_kind <> 'write'",
"describe": {
"columns": [
{
@@ -22,5 +22,5 @@
true
]
},
- "hash": "f0d8ebbf62a1d92f39c2f86a70236cece6d6c9e28cce9aff7fe5496bba569807"
+ "hash": "df8f616f7ace1d45cb9022d70e53bef3389884cdde284ed3eb3b8d6979761b98"
}
diff --git a/backend/.sqlx/query-e1d7ca4dfbc5eeb6eb60e48a13029ac1a2714b78cc88969604dbd6c44984831f.json b/backend/.sqlx/query-e1d7ca4dfbc5eeb6eb60e48a13029ac1a2714b78cc88969604dbd6c44984831f.json
new file mode 100644
index 0000000000..90a3f9c7f2
--- /dev/null
+++ b/backend/.sqlx/query-e1d7ca4dfbc5eeb6eb60e48a13029ac1a2714b78cc88969604dbd6c44984831f.json
@@ -0,0 +1,12 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "DELETE FROM workspace_diff WHERE fork_workspace_id = 'wm-fork-secrets'",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": []
+ },
+ "nullable": []
+ },
+ "hash": "e1d7ca4dfbc5eeb6eb60e48a13029ac1a2714b78cc88969604dbd6c44984831f"
+}
diff --git a/backend/.sqlx/query-e43b178e40ef39908def1746f7f2a6a2ad960a7b5e9536d15efae31bd2431742.json b/backend/.sqlx/query-e43b178e40ef39908def1746f7f2a6a2ad960a7b5e9536d15efae31bd2431742.json
new file mode 100644
index 0000000000..2319cf80f7
--- /dev/null
+++ b/backend/.sqlx/query-e43b178e40ef39908def1746f7f2a6a2ad960a7b5e9536d15efae31bd2431742.json
@@ -0,0 +1,17 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "UPDATE account SET refresh_error = $1\n WHERE workspace_id = $2 AND id = $3 AND refresh_token = $4",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Text",
+ "Int4",
+ "Text"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "e43b178e40ef39908def1746f7f2a6a2ad960a7b5e9536d15efae31bd2431742"
+}
diff --git a/backend/.sqlx/query-f91c3e12549a3e037e8e784ad6ed439d762d17acb70793e9b26454572a156397.json b/backend/.sqlx/query-e497205c8654cc0ba1b9c88aa1c253f5823cb10016330b317257c8c668d951c2.json
similarity index 58%
rename from backend/.sqlx/query-f91c3e12549a3e037e8e784ad6ed439d762d17acb70793e9b26454572a156397.json
rename to backend/.sqlx/query-e497205c8654cc0ba1b9c88aa1c253f5823cb10016330b317257c8c668d951c2.json
index 30ec07404b..58f404a64d 100644
--- a/backend/.sqlx/query-f91c3e12549a3e037e8e784ad6ed439d762d17acb70793e9b26454572a156397.json
+++ b/backend/.sqlx/query-e497205c8654cc0ba1b9c88aa1c253f5823cb10016330b317257c8c668d951c2.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "SELECT workspace_id, slack_command_script IS NOT NULL AS \"has_script!\"\n FROM workspace_settings WHERE slack_team_id = $1\n ORDER BY slack_command_script IS NOT NULL DESC LIMIT 2",
+ "query": "SELECT workspace_id, slack_command_script IS NOT NULL AS \"has_script!\"\n FROM workspace_settings ws WHERE slack_team_id = $1\n AND ws.workspace_id = ANY($2)\n ORDER BY slack_command_script IS NOT NULL DESC LIMIT 2",
"describe": {
"columns": [
{
@@ -16,7 +16,8 @@
],
"parameters": {
"Left": [
- "Text"
+ "Text",
+ "TextArray"
]
},
"nullable": [
@@ -24,5 +25,5 @@
null
]
},
- "hash": "f91c3e12549a3e037e8e784ad6ed439d762d17acb70793e9b26454572a156397"
+ "hash": "e497205c8654cc0ba1b9c88aa1c253f5823cb10016330b317257c8c668d951c2"
}
diff --git a/backend/.sqlx/query-b9686c115e83ad0725503e2c076960914f825eaa2b44281a4e147cea6e886e7a.json b/backend/.sqlx/query-e6d49c3186419c726cc6ed771548c72164b36ccb5434bcc4babefa7f3363c675.json
similarity index 68%
rename from backend/.sqlx/query-b9686c115e83ad0725503e2c076960914f825eaa2b44281a4e147cea6e886e7a.json
rename to backend/.sqlx/query-e6d49c3186419c726cc6ed771548c72164b36ccb5434bcc4babefa7f3363c675.json
index ebb5cee72c..99ec12fd85 100644
--- a/backend/.sqlx/query-b9686c115e83ad0725503e2c076960914f825eaa2b44281a4e147cea6e886e7a.json
+++ b/backend/.sqlx/query-e6d49c3186419c726cc6ed771548c72164b36ccb5434bcc4babefa7f3363c675.json
@@ -1,11 +1,11 @@
{
"db_name": "PostgreSQL",
- "query": "DELETE FROM native_trigger WHERE workspace_id = $1 AND service_name = $2 RETURNING webhook_token_hash",
+ "query": "SELECT script_path FROM native_trigger WHERE workspace_id = $1 AND service_name = $2",
"describe": {
"columns": [
{
"ordinal": 0,
- "name": "webhook_token_hash",
+ "name": "script_path",
"type_info": "Varchar"
}
],
@@ -30,5 +30,5 @@
false
]
},
- "hash": "b9686c115e83ad0725503e2c076960914f825eaa2b44281a4e147cea6e886e7a"
+ "hash": "e6d49c3186419c726cc6ed771548c72164b36ccb5434bcc4babefa7f3363c675"
}
diff --git a/backend/.sqlx/query-e78a06c0ea4d46ec2d55417a81d0c7ed15b7bf962ba19fcd09b23f8e982fa1c9.json b/backend/.sqlx/query-e78a06c0ea4d46ec2d55417a81d0c7ed15b7bf962ba19fcd09b23f8e982fa1c9.json
new file mode 100644
index 0000000000..032d104253
--- /dev/null
+++ b/backend/.sqlx/query-e78a06c0ea4d46ec2d55417a81d0c7ed15b7bf962ba19fcd09b23f8e982fa1c9.json
@@ -0,0 +1,14 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "DELETE FROM role_seat WHERE workspace_id = $1",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Text"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "e78a06c0ea4d46ec2d55417a81d0c7ed15b7bf962ba19fcd09b23f8e982fa1c9"
+}
diff --git a/backend/.sqlx/query-e8eaa80631362dee4d696e41abf220cb6f8346d2bfcd901371b480a16a70109c.json b/backend/.sqlx/query-e8eaa80631362dee4d696e41abf220cb6f8346d2bfcd901371b480a16a70109c.json
new file mode 100644
index 0000000000..b3dd32073d
--- /dev/null
+++ b/backend/.sqlx/query-e8eaa80631362dee4d696e41abf220cb6f8346d2bfcd901371b480a16a70109c.json
@@ -0,0 +1,15 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "UPDATE workspace_settings SET variable_expiration_handler = $1 WHERE workspace_id = $2",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Jsonb",
+ "Text"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "e8eaa80631362dee4d696e41abf220cb6f8346d2bfcd901371b480a16a70109c"
+}
diff --git a/backend/.sqlx/query-eac25b9ce5df40a896687d2ba3f9279396ed7213da4598034332bb0ba6ce271c.json b/backend/.sqlx/query-eac25b9ce5df40a896687d2ba3f9279396ed7213da4598034332bb0ba6ce271c.json
new file mode 100644
index 0000000000..736b176227
--- /dev/null
+++ b/backend/.sqlx/query-eac25b9ce5df40a896687d2ba3f9279396ed7213da4598034332bb0ba6ce271c.json
@@ -0,0 +1,22 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "UPDATE workspace_settings SET variable_expiration_failed_at = now()\n WHERE workspace_id = $1 AND variable_expiration_failed_at IS NULL\n RETURNING 1",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "?column?",
+ "type_info": "Int4"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text"
+ ]
+ },
+ "nullable": [
+ null
+ ]
+ },
+ "hash": "eac25b9ce5df40a896687d2ba3f9279396ed7213da4598034332bb0ba6ce271c"
+}
diff --git a/backend/.sqlx/query-eacce0ccde20eddc4aded69c35d62122478424a36193254d5e00b8723ca28079.json b/backend/.sqlx/query-eacce0ccde20eddc4aded69c35d62122478424a36193254d5e00b8723ca28079.json
new file mode 100644
index 0000000000..f0ced3e76b
--- /dev/null
+++ b/backend/.sqlx/query-eacce0ccde20eddc4aded69c35d62122478424a36193254d5e00b8723ca28079.json
@@ -0,0 +1,20 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "UPDATE workspace_settings SET variable_expiration_failed_at = NULL\n WHERE variable_expiration_failed_at IS NOT NULL AND variable_expiration_handler IS NULL\n RETURNING workspace_id",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "workspace_id",
+ "type_info": "Varchar"
+ }
+ ],
+ "parameters": {
+ "Left": []
+ },
+ "nullable": [
+ false
+ ]
+ },
+ "hash": "eacce0ccde20eddc4aded69c35d62122478424a36193254d5e00b8723ca28079"
+}
diff --git a/backend/.sqlx/query-eaed64e9c1b4b13ba97b394a9b17adac931366debe890df5b25e4110e47e4f87.json b/backend/.sqlx/query-eaed64e9c1b4b13ba97b394a9b17adac931366debe890df5b25e4110e47e4f87.json
new file mode 100644
index 0000000000..a654f614bd
--- /dev/null
+++ b/backend/.sqlx/query-eaed64e9c1b4b13ba97b394a9b17adac931366debe890df5b25e4110e47e4f87.json
@@ -0,0 +1,15 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "UPDATE workspace_settings SET slack_signing_secret = $1 WHERE workspace_id = $2",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Text"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "eaed64e9c1b4b13ba97b394a9b17adac931366debe890df5b25e4110e47e4f87"
+}
diff --git a/backend/.sqlx/query-ecd08125821a21842bad7d328ea83cbaf7676cbed2f0c3a433699578da88e8ae.json b/backend/.sqlx/query-ecd08125821a21842bad7d328ea83cbaf7676cbed2f0c3a433699578da88e8ae.json
new file mode 100644
index 0000000000..db600a495e
--- /dev/null
+++ b/backend/.sqlx/query-ecd08125821a21842bad7d328ea83cbaf7676cbed2f0c3a433699578da88e8ae.json
@@ -0,0 +1,20 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT COUNT(DISTINCT value) FROM variable WHERE path = 'u/test-user/same'",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "count",
+ "type_info": "Int8"
+ }
+ ],
+ "parameters": {
+ "Left": []
+ },
+ "nullable": [
+ null
+ ]
+ },
+ "hash": "ecd08125821a21842bad7d328ea83cbaf7676cbed2f0c3a433699578da88e8ae"
+}
diff --git a/backend/.sqlx/query-ee3ed82783b5b7d2f41f16a1d94f006687bd9de4611203b5dd0c28eacee02842.json b/backend/.sqlx/query-ee3ed82783b5b7d2f41f16a1d94f006687bd9de4611203b5dd0c28eacee02842.json
deleted file mode 100644
index a1d873778f..0000000000
--- a/backend/.sqlx/query-ee3ed82783b5b7d2f41f16a1d94f006687bd9de4611203b5dd0c28eacee02842.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "db_name": "PostgreSQL",
- "query": "INSERT INTO workspace_settings (workspace_id, slack_team_id, slack_name, slack_command_script, slack_email, customer_id, plan, webhook, ai_config, large_file_storage, git_sync, default_app, default_scripts, deploy_ui, mute_critical_alerts, color, operator_settings, teams_command_script, teams_team_id, teams_team_name, git_app_installations, git_credentials, ducklake, dbt_warehouses, slack_oauth_client_id, slack_oauth_client_secret, datatable, teams_team_guid, auto_invite, error_handler, success_handler, public_app_execution_limit_per_minute, error_handler_fallback_to_instance_alerts, guest_access_enabled, guest_jwt_public_key, guest_jwt_jwks_url, add_admins_and_developers_to_forks, remote_deploy_target, remote_deploy_target_changed_at) SELECT $1, slack_team_id, slack_name, slack_command_script, slack_email, customer_id, plan, webhook, ai_config, large_file_storage, git_sync, default_app, default_scripts, deploy_ui, mute_critical_alerts, color, operator_settings, teams_command_script, teams_team_id, teams_team_name, git_app_installations, git_credentials, ducklake, dbt_warehouses, slack_oauth_client_id, slack_oauth_client_secret, datatable, teams_team_guid, auto_invite, error_handler, success_handler, public_app_execution_limit_per_minute, error_handler_fallback_to_instance_alerts, guest_access_enabled, guest_jwt_public_key, guest_jwt_jwks_url, add_admins_and_developers_to_forks, remote_deploy_target, remote_deploy_target_changed_at FROM workspace_settings WHERE workspace_id = $2",
- "describe": {
- "columns": [],
- "parameters": {
- "Left": [
- "Varchar",
- "Text"
- ]
- },
- "nullable": []
- },
- "hash": "ee3ed82783b5b7d2f41f16a1d94f006687bd9de4611203b5dd0c28eacee02842"
-}
diff --git a/backend/.sqlx/query-ee8b92d51f220cac5a32f0edcb3c4effa302380d4b434d8c74677bfbf895333c.json b/backend/.sqlx/query-ee8b92d51f220cac5a32f0edcb3c4effa302380d4b434d8c74677bfbf895333c.json
new file mode 100644
index 0000000000..d101f5ec0a
--- /dev/null
+++ b/backend/.sqlx/query-ee8b92d51f220cac5a32f0edcb3c4effa302380d4b434d8c74677bfbf895333c.json
@@ -0,0 +1,12 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "INSERT INTO workspace_diff\n (source_workspace_id, fork_workspace_id, path, kind, ahead, behind, has_changes)\n VALUES ('test-workspace', 'wm-fork-expiry', 'u/admin/expiring', 'variable', 0, 1, NULL)",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": []
+ },
+ "nullable": []
+ },
+ "hash": "ee8b92d51f220cac5a32f0edcb3c4effa302380d4b434d8c74677bfbf895333c"
+}
diff --git a/backend/.sqlx/query-c7766afaea3e187824698cae2b090af9f49ded98cd1824f1ac91cc5dbe709bc1.json b/backend/.sqlx/query-efae221cbce1c9d4b96f9990a012b3efce1740b7037cac9983529bc052cf2dd9.json
similarity index 83%
rename from backend/.sqlx/query-c7766afaea3e187824698cae2b090af9f49ded98cd1824f1ac91cc5dbe709bc1.json
rename to backend/.sqlx/query-efae221cbce1c9d4b96f9990a012b3efce1740b7037cac9983529bc052cf2dd9.json
index 6a9de7e35b..66edee8f0b 100644
--- a/backend/.sqlx/query-c7766afaea3e187824698cae2b090af9f49ded98cd1824f1ac91cc5dbe709bc1.json
+++ b/backend/.sqlx/query-efae221cbce1c9d4b96f9990a012b3efce1740b7037cac9983529bc052cf2dd9.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "\n SELECT\n external_id,\n workspace_id,\n service_name AS \"service_name!: ServiceName\",\n script_path,\n is_flow,\n webhook_token_hash,\n service_config,\n error,\n created_at,\n updated_at,\n summary,\n enabled\n FROM\n native_trigger\n WHERE\n workspace_id = $1\n AND service_name = $2\n AND external_id = $3\n ",
+ "query": "\n SELECT\n external_id,\n workspace_id,\n service_name AS \"service_name!: ServiceName\",\n script_path,\n is_flow,\n webhook_token_hash,\n service_config,\n error,\n created_at,\n updated_at,\n summary,\n enabled,\n connection_path\n FROM\n native_trigger\n WHERE\n workspace_id = $1\n AND service_name = $2\n AND external_id = $3\n ",
"describe": {
"columns": [
{
@@ -73,6 +73,11 @@
"ordinal": 11,
"name": "enabled",
"type_info": "Bool"
+ },
+ {
+ "ordinal": 12,
+ "name": "connection_path",
+ "type_info": "Varchar"
}
],
"parameters": {
@@ -105,8 +110,9 @@
false,
false,
true,
- false
+ false,
+ true
]
},
- "hash": "c7766afaea3e187824698cae2b090af9f49ded98cd1824f1ac91cc5dbe709bc1"
+ "hash": "efae221cbce1c9d4b96f9990a012b3efce1740b7037cac9983529bc052cf2dd9"
}
diff --git a/backend/.sqlx/query-f4af0affaed3b1d30f5c6f4ddf4114718468fbf75ef13c6087c2f57fbbe0b82f.json b/backend/.sqlx/query-f4af0affaed3b1d30f5c6f4ddf4114718468fbf75ef13c6087c2f57fbbe0b82f.json
index e52ddcf21f..dfcaa29208 100644
--- a/backend/.sqlx/query-f4af0affaed3b1d30f5c6f4ddf4114718468fbf75ef13c6087c2f57fbbe0b82f.json
+++ b/backend/.sqlx/query-f4af0affaed3b1d30f5c6f4ddf4114718468fbf75ef13c6087c2f57fbbe0b82f.json
@@ -34,7 +34,8 @@
"java",
"duckdb",
"ruby",
- "rlang"
+ "rlang",
+ "dbt"
]
}
}
diff --git a/backend/.sqlx/query-f5022831ab610ab22ef1af1441753aba57d5e8f19a316f76e01922559425d81b.json b/backend/.sqlx/query-f5022831ab610ab22ef1af1441753aba57d5e8f19a316f76e01922559425d81b.json
new file mode 100644
index 0000000000..3b0dbb2f41
--- /dev/null
+++ b/backend/.sqlx/query-f5022831ab610ab22ef1af1441753aba57d5e8f19a316f76e01922559425d81b.json
@@ -0,0 +1,15 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "INSERT INTO workspace_settings (workspace_id, slack_team_id, slack_name, slack_command_script, slack_email, customer_id, plan, webhook, ai_config, large_file_storage, git_sync, default_app, default_scripts, deploy_ui, mute_critical_alerts, color, operator_settings, role_overrides, teams_command_script, teams_team_id, teams_team_name, git_app_installations, git_credentials, ducklake, dbt_warehouses, slack_oauth_client_id, slack_oauth_client_secret, slack_signing_secret, datatable, teams_team_guid, auto_invite, error_handler, success_handler, public_app_execution_limit_per_minute, error_handler_fallback_to_instance_alerts, guest_access_enabled, guest_jwt_public_key, guest_jwt_jwks_url, add_admins_and_developers_to_forks, remote_deploy_target, remote_deploy_target_changed_at) SELECT $1, slack_team_id, slack_name, slack_command_script, slack_email, customer_id, plan, webhook, ai_config, large_file_storage, git_sync, default_app, default_scripts, deploy_ui, mute_critical_alerts, color, operator_settings, role_overrides, teams_command_script, teams_team_id, teams_team_name, git_app_installations, git_credentials, ducklake, dbt_warehouses, slack_oauth_client_id, slack_oauth_client_secret, slack_signing_secret, datatable, teams_team_guid, auto_invite, error_handler, success_handler, public_app_execution_limit_per_minute, error_handler_fallback_to_instance_alerts, guest_access_enabled, guest_jwt_public_key, guest_jwt_jwks_url, add_admins_and_developers_to_forks, remote_deploy_target, remote_deploy_target_changed_at FROM workspace_settings WHERE workspace_id = $2",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Varchar",
+ "Text"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "f5022831ab610ab22ef1af1441753aba57d5e8f19a316f76e01922559425d81b"
+}
diff --git a/backend/.sqlx/query-f54795cfa04ef4d0f6ed05aee09513d23e8ef5412d030a172f81dd9a9be0bf2f.json b/backend/.sqlx/query-f54795cfa04ef4d0f6ed05aee09513d23e8ef5412d030a172f81dd9a9be0bf2f.json
new file mode 100644
index 0000000000..bb2808083c
--- /dev/null
+++ b/backend/.sqlx/query-f54795cfa04ef4d0f6ed05aee09513d23e8ef5412d030a172f81dd9a9be0bf2f.json
@@ -0,0 +1,23 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT COUNT(*) FROM workspace_invite t WHERE ($1::text IS NULL OR t.workspace_id = $1) AND\n COALESCE(t.workspace_role, CASE WHEN t.operator THEN 'operator' ELSE 'developer' END) = $2",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "count",
+ "type_info": "Int8"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Text"
+ ]
+ },
+ "nullable": [
+ null
+ ]
+ },
+ "hash": "f54795cfa04ef4d0f6ed05aee09513d23e8ef5412d030a172f81dd9a9be0bf2f"
+}
diff --git a/backend/.sqlx/query-f59c0f10c2dc7c0b578c764545e2ceee71c5f0ed6aca603e7ec7aae47f7cdade.json b/backend/.sqlx/query-f59c0f10c2dc7c0b578c764545e2ceee71c5f0ed6aca603e7ec7aae47f7cdade.json
new file mode 100644
index 0000000000..da21731ae1
--- /dev/null
+++ b/backend/.sqlx/query-f59c0f10c2dc7c0b578c764545e2ceee71c5f0ed6aca603e7ec7aae47f7cdade.json
@@ -0,0 +1,42 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT external_id, connection_path FROM native_trigger\n WHERE workspace_id = $1 AND service_name = $2 AND ($3::text[] IS NULL\n OR (external_id, script_path) IN (SELECT * FROM unnest($3::text[], $4::text[])))",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "external_id",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 1,
+ "name": "connection_path",
+ "type_info": "Varchar"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text",
+ {
+ "Custom": {
+ "name": "native_trigger_service",
+ "kind": {
+ "Enum": [
+ "nextcloud",
+ "google",
+ "github"
+ ]
+ }
+ }
+ },
+ "TextArray",
+ "TextArray"
+ ]
+ },
+ "nullable": [
+ false,
+ true
+ ]
+ },
+ "hash": "f59c0f10c2dc7c0b578c764545e2ceee71c5f0ed6aca603e7ec7aae47f7cdade"
+}
diff --git a/backend/.sqlx/query-f830e934b43a83f857f682383f36ed56df6518e3035778e4e3b95182d2504e00.json b/backend/.sqlx/query-f830e934b43a83f857f682383f36ed56df6518e3035778e4e3b95182d2504e00.json
deleted file mode 100644
index 8025c7654c..0000000000
--- a/backend/.sqlx/query-f830e934b43a83f857f682383f36ed56df6518e3035778e4e3b95182d2504e00.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "db_name": "PostgreSQL",
- "query": "UPDATE workspace_settings\n SET slack_oauth_client_id = $1, slack_oauth_client_secret = $2\n WHERE workspace_id = $3",
- "describe": {
- "columns": [],
- "parameters": {
- "Left": [
- "Varchar",
- "Varchar",
- "Text"
- ]
- },
- "nullable": []
- },
- "hash": "f830e934b43a83f857f682383f36ed56df6518e3035778e4e3b95182d2504e00"
-}
diff --git a/backend/.sqlx/query-fa9cba875690fa5568a7bb3f33464ccea31da990bb66d6c29b48d39f714c7c8b.json b/backend/.sqlx/query-fa9cba875690fa5568a7bb3f33464ccea31da990bb66d6c29b48d39f714c7c8b.json
new file mode 100644
index 0000000000..8515006507
--- /dev/null
+++ b/backend/.sqlx/query-fa9cba875690fa5568a7bb3f33464ccea31da990bb66d6c29b48d39f714c7c8b.json
@@ -0,0 +1,23 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT now() > expires_at AS \"expired!\" FROM account\n WHERE workspace_id = $1 AND id = $2",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "expired!",
+ "type_info": "Bool"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Int4"
+ ]
+ },
+ "nullable": [
+ null
+ ]
+ },
+ "hash": "fa9cba875690fa5568a7bb3f33464ccea31da990bb66d6c29b48d39f714c7c8b"
+}
diff --git a/backend/Cargo.lock b/backend/Cargo.lock
index 3f2dfbffec..3ae4630fe5 100644
--- a/backend/Cargo.lock
+++ b/backend/Cargo.lock
@@ -1336,9 +1336,9 @@ dependencies = [
[[package]]
name = "aws-smithy-async"
-version = "1.3.0"
+version = "1.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f02e407fb3b54891734224b9ffac8a71fdd35f542500fa1af95754a6b2beb316"
+checksum = "de681a9df7ff79823b759ee17061076ec049cd61a8fa28ece4293d89c9f6964e"
dependencies = [
"futures-util",
"pin-project-lite",
@@ -1992,18 +1992,18 @@ dependencies = [
[[package]]
name = "bon"
-version = "3.10.2"
+version = "3.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "214f5df094ce551a10a30ffb9c70243d61f121a3d985a6495933e181dee6a7d2"
+checksum = "a05442cd7005532d0cfedec676b5b9333d2b4c7c3afabe2b1a9ce2742fbe2ee6"
dependencies = [
"bon-macros",
]
[[package]]
name = "bon-macros"
-version = "3.10.2"
+version = "3.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2706da6c749998cc555d04184909608956a69ad3f8ab1a076fbc867b4a3c3ce5"
+checksum = "93833e97ac7c46ba97045afcf247238c27057538fcf2f06344662ddd5f567be6"
dependencies = [
"darling 0.24.1",
"ident_case",
@@ -2366,9 +2366,9 @@ dependencies = [
[[package]]
name = "cc"
-version = "1.8.0"
+version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6651c9ed80effdc7db0ff72512157f901af5e3549e341e24b1dd4887d836d838"
+checksum = "86e055fa6e3e40ad6187ba25b6855eeb635d5271f8e0f0e1e9a5826b8d75bea0"
dependencies = [
"find-msvc-tools",
"jobserver",
@@ -2695,9 +2695,9 @@ checksum = "3618cccc083bb987a415d85c02ca6c9994ea5b44731ec28b9ecf09658655fba9"
[[package]]
name = "const_format"
-version = "0.2.36"
+version = "0.2.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4481a617ad9a412be3b97c5d403fef8ed023103368908b9c50af598ff467cc1e"
+checksum = "a3decb4d6965448659923544a634a0571ba44cede4e11ef15a5a317126840454"
dependencies = [
"const_format_proc_macros",
"konst",
@@ -2705,9 +2705,9 @@ dependencies = [
[[package]]
name = "const_format_proc_macros"
-version = "0.2.34"
+version = "0.2.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1d57c2eccfb16dbac1f4e61e206105db5820c9d26c3c472bc17c774259ef7744"
+checksum = "941b570269a642506f08cb5b688c04bfa6cfd41a26f8bcdc49db8fd00c0ab659"
dependencies = [
"proc-macro2",
"quote",
@@ -2858,9 +2858,9 @@ checksum = "217698eaf96b4a3f0bc4f3662aaa55bdf913cd54d7204591faa790070c6d0853"
[[package]]
name = "crc32fast"
-version = "1.5.2"
+version = "1.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "01a7799fd6b852db0e61728dde9a204c423b44d689dbd432522543614b490e78"
+checksum = "0ba106e844045ddc02c20768ac4b0b7cb45f2cc2ecbd833ac9f5dacb183c2055"
dependencies = [
"cfg-if",
]
@@ -2964,9 +2964,9 @@ dependencies = [
[[package]]
name = "crypto-bigint"
-version = "0.7.5"
+version = "0.7.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1a52aa3fcda4e6302a9f48734f234d35d4721b96f8fe07d073f07ce9df4f0271"
+checksum = "d726facc8b27e604391b232b970cdc19b5468c69f08b466b9734c759216c7415"
dependencies = [
"cpubits",
"ctutils",
@@ -3055,9 +3055,9 @@ dependencies = [
[[package]]
name = "ctutils"
-version = "0.4.3"
+version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "03bb0e1cc970d482d121d9a1744999169b69a07470b3d644a7894e53fcaf4574"
+checksum = "38d28fb6aa7dd680b3ffd1a3e64e115c177bdba63c0ae7f9cd48129ff05c4fa0"
dependencies = [
"cmov",
"subtle",
@@ -4156,7 +4156,7 @@ dependencies = [
"hyper-util",
"ipnet",
"percent-encoding",
- "rustls-webpki 0.103.15",
+ "rustls-webpki 0.103.16",
"serde_json",
"thiserror 2.0.21",
"tokio",
@@ -4427,7 +4427,7 @@ dependencies = [
"rustls 0.23.40",
"rustls-pemfile 2.2.0",
"rustls-tokio-stream",
- "rustls-webpki 0.103.15",
+ "rustls-webpki 0.103.16",
"serde",
"thiserror 2.0.21",
"tokio",
@@ -4777,9 +4777,9 @@ dependencies = [
[[package]]
name = "diplomat-runtime"
-version = "0.16.0"
+version = "0.16.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ae517853d9f82b2d144393b1c32c34c46c2e361de2b6c44a8fdfce23beb211cd"
+checksum = "d9d981121ba76150987fda68185b37853c0b928a55dfdc28897348cd068440be"
[[package]]
name = "diplomat_core"
@@ -5070,7 +5070,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b805154de2e68f59874ec217ca36790dcffe500cd872c60fe509d28d0814a74d"
dependencies = [
"ed448",
- "elliptic-curve 0.14.1",
+ "elliptic-curve 0.14.2",
"hash2curve",
"rand_core 0.10.1",
"serdect 0.4.3",
@@ -5126,12 +5126,12 @@ dependencies = [
[[package]]
name = "elliptic-curve"
-version = "0.14.1"
+version = "0.14.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9d65aa39b3a5c1c9c1b745c9a019234bb7a21b77abcb4f4d266d706e2d577d65"
+checksum = "0ad4496221fcfc21015fd8c0e26fcfab00504832dc0604f52acdd7bad2a8dc81"
dependencies = [
"base16ct 1.0.0",
- "crypto-bigint 0.7.5",
+ "crypto-bigint 0.7.8",
"crypto-common 0.2.2",
"ff 0.14.0",
"group 0.14.0",
@@ -5218,9 +5218,9 @@ checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826"
[[package]]
name = "erased-serde"
-version = "0.4.10"
+version = "0.4.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d2add8a07dd6a8d93ff627029c51de145e12686fbc36ecb298ac22e74cf02dec"
+checksum = "1e59b668157f32d3459d4bd634861a06ffa2503a461ca5f0916b9f0252605e66"
dependencies = [
"serde",
"serde_core",
@@ -5408,9 +5408,9 @@ dependencies = [
[[package]]
name = "find-msvc-tools"
-version = "0.1.14"
+version = "0.1.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "aedcfb3409746eddb02b9e19ebda1c3394f759a152e48ee875a0844d1b955484"
+checksum = "1c66915cc5391097de7a2b0b972e8505aa33c0df401fd3a6811dbdb32881ba48"
[[package]]
name = "fips203"
@@ -6241,7 +6241,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1eaf40612d7d854743e7189228a6d528f0f6e8502cf6a0cb831d28a218b7f3f6"
dependencies = [
"digest 0.11.3",
- "elliptic-curve 0.14.1",
+ "elliptic-curve 0.14.2",
]
[[package]]
@@ -6745,7 +6745,7 @@ dependencies = [
"tokio",
"tokio-rustls 0.26.6",
"tower-service",
- "webpki-roots 1.0.9",
+ "webpki-roots 1.0.11",
]
[[package]]
@@ -6859,9 +6859,9 @@ dependencies = [
[[package]]
name = "icu_calendar"
-version = "2.3.0"
+version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "58655df2f728e46e4eee80bddebefacf52ec3e77cdb925014b47c5a5905eb55c"
+checksum = "a68ffb801cc7acb8dcae62da7c692c47934698d2dd4f479ddee1eb442763dea1"
dependencies = [
"calendrical_calculations",
"displaydoc",
@@ -6875,15 +6875,15 @@ dependencies = [
[[package]]
name = "icu_calendar_data"
-version = "2.3.0"
+version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dc00caaa3fb3201ff7a18aa458e8c3ab042b9da154cfdf948bdde3936c31c36e"
+checksum = "514da54e79efa36b5976232d5b3d1d8ee1b47b19ab658f1b1ebe39221696c2d8"
[[package]]
name = "icu_collections"
-version = "2.3.0"
+version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fa68d21081c4a05d5a901a1c62add574c77048b6a1c67be3b50ce0b60d4ca513"
+checksum = "fe090a42a0d3140fed8c63263ed1fecc02422cb2f4bfe55cd8de2de1b8e105dd"
dependencies = [
"displaydoc",
"potential_utf",
@@ -6895,9 +6895,9 @@ dependencies = [
[[package]]
name = "icu_locale_core"
-version = "2.3.0"
+version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d56e28588da92eee5c3201a6eff33fabdd49b62269c8938d4ff050ce4d900deb"
+checksum = "25d29b57c17c6528d0dc4c2141cfa2d08200465acb537a3909c8b9b8a4a984c0"
dependencies = [
"displaydoc",
"litemap",
@@ -6909,9 +6909,9 @@ dependencies = [
[[package]]
name = "icu_locale_fallback"
-version = "2.3.0"
+version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "251af8e57c9400e3eb58242fe5b8b1152b2a64fdf4cf632f923c38ccee6f2fa9"
+checksum = "406e9ae5b95d8aa37db6293405931b766a6172d1848daee22d70eb44aa78a43c"
dependencies = [
"icu_locale_core",
"icu_locale_fallback_data",
@@ -6923,15 +6923,15 @@ dependencies = [
[[package]]
name = "icu_locale_fallback_data"
-version = "2.3.0"
+version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "decf2a22ec8fa68f1a0c1129a3f8583f8f8bc24e8b9ccbe98ead99f62a4dc3a8"
+checksum = "3632ebbd0c5c3637ba1a40bdf8288f2cb9d2268e73441a69d5fc73d7cfbaa87c"
[[package]]
name = "icu_normalizer"
-version = "2.3.0"
+version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "12f9cf5f235641ed274641dd81c3f28d870e276763d0797aeeab72317b1c646f"
+checksum = "404a3b8c486f205c87fe7f23ab6894d84a4ad76d6e4671ae1981ba7def87c599"
dependencies = [
"icu_collections",
"icu_normalizer_data",
@@ -6943,15 +6943,15 @@ dependencies = [
[[package]]
name = "icu_normalizer_data"
-version = "2.3.0"
+version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1563da1ed3e0b3bf3d74c9b85917ac9c56464d2f57242270c09c9e752f8021a0"
+checksum = "20f0088bfb7441f7a37fa0c9e20cb1e9cba1cac6b9ce8cd2a6dc44294f8e8cbc"
[[package]]
name = "icu_properties"
-version = "2.3.0"
+version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7e7ca276ad3145661a65914e6daf131ca5120cd3dcee8f8f3214b8875184a148"
+checksum = "2ea83d991c56158f7cf898bf86436c1dfe7c07ee82fe88951f2695c9f37a379f"
dependencies = [
"displaydoc",
"icu_collections",
@@ -6964,15 +6964,15 @@ dependencies = [
[[package]]
name = "icu_properties_data"
-version = "2.3.0"
+version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e590f038c1464a96894fd6d10127e90a8be4509f56ff7ecef851b15cee0b7caa"
+checksum = "b98f29af82d02b163fe50161388350e743bb3107cc8e8c2f7314cb505faddfcf"
[[package]]
name = "icu_provider"
-version = "2.3.1"
+version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d27bbb9d3abbefac45d55f647c9de1d44aafcd1186eb91879afef17c396c3e73"
+checksum = "413099315636c588ee8f011190b329b971a09a8fae9d157e01dcae8379468514"
dependencies = [
"displaydoc",
"icu_locale_core",
@@ -6987,9 +6987,9 @@ dependencies = [
[[package]]
name = "icu_segmenter"
-version = "2.3.0"
+version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "82d07aafccd67af15d02512a6adf5896fbc5ed00f2e99b471d2efa14016db3db"
+checksum = "61b195dc605f81aa181bec9b3bd14e26cc71b903e4644f6af578ca9772c7a710"
dependencies = [
"icu_collections",
"icu_locale_fallback",
@@ -6998,14 +6998,15 @@ dependencies = [
"potential_utf",
"smallvec",
"utf8_iter",
+ "zerotrie",
"zerovec",
]
[[package]]
name = "icu_segmenter_data"
-version = "2.3.0"
+version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ae293c039020f9ec10710af98d29ce6aa2051486638b49c9a6409f3b4a9e98ad"
+checksum = "913a7d294ad056474749152107309fdee3ec17d2482d1ab70fdc61a81c64b9a3"
[[package]]
name = "ident_case"
@@ -7223,9 +7224,9 @@ checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
[[package]]
name = "ixdtf"
-version = "0.6.6"
+version = "0.6.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4d3667095d64c3ecffc96463a21157b04bf3e252f6e8d5750b20c02e33c194e3"
+checksum = "4754a1731458af0443709c9667302793d3f63cc90ec4ba4c8259f2b9515478e5"
[[package]]
name = "jiff"
@@ -8155,9 +8156,9 @@ checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
[[package]]
name = "memmap2"
-version = "0.9.11"
+version = "0.9.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d1219ed1b7f229ee7104d281dd01d6802fe28bb6e95d292942c4daacdeb798c0"
+checksum = "6b0ca1155a9ecc25aa12e8313a119f32edf0255fea2f44839c4ac0a12b2ac157"
dependencies = [
"libc",
"stable_deref_trait",
@@ -10826,11 +10827,11 @@ checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4"
[[package]]
name = "relative-path"
-version = "2.0.2"
+version = "2.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f2a073568cd8b9c4825429d3e9fc5f52851b4f97cc1348800689408921e6b8f8"
+checksum = "38540a682c6e9bca04a8bca9e5ec5a6ba168dfbb04c9998fe517a9befb92eb68"
dependencies = [
- "serde",
+ "serde_core",
]
[[package]]
@@ -10888,7 +10889,7 @@ dependencies = [
"wasm-bindgen-futures",
"wasm-streams 0.4.2",
"web-sys",
- "webpki-roots 1.0.9",
+ "webpki-roots 1.0.11",
]
[[package]]
@@ -11101,9 +11102,9 @@ dependencies = [
[[package]]
name = "rmcp-macros"
-version = "3.5.1"
+version = "3.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a1da498700030856ba63114bceefa30ba21f5e278cb975e5b9de3529fe842b40"
+checksum = "967fa7f7935d7d6217d593df0e8e5c9307bcaf256974a5a9ee64476c97735389"
dependencies = [
"darling 0.24.1",
"proc-macro2",
@@ -11460,7 +11461,7 @@ dependencies = [
"once_cell",
"ring 0.17.14",
"rustls-pki-types",
- "rustls-webpki 0.103.15",
+ "rustls-webpki 0.103.16",
"subtle",
"zeroize",
]
@@ -11475,7 +11476,7 @@ dependencies = [
"rustls 0.23.40",
"rustls-native-certs 0.7.3",
"rustls-pki-types",
- "rustls-webpki 0.103.15",
+ "rustls-webpki 0.103.16",
]
[[package]]
@@ -11557,7 +11558,7 @@ dependencies = [
"rustls 0.23.40",
"rustls-native-certs 0.8.5",
"rustls-platform-verifier-android",
- "rustls-webpki 0.103.15",
+ "rustls-webpki 0.103.16",
"security-framework 3.7.0",
"security-framework-sys",
"webpki-root-certs",
@@ -11606,9 +11607,9 @@ dependencies = [
[[package]]
name = "rustls-webpki"
-version = "0.103.15"
+version = "0.103.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f3c3cf1d8b1e7d4927e2d154c3fcb02979afb9939629c62cd9048d4f07b60ac2"
+checksum = "4443b1b6d39d7c663139942cc4558262562d2c84123bb6282ef177009ca8b281"
dependencies = [
"aws-lc-rs",
"ring 0.17.14",
@@ -12407,9 +12408,9 @@ checksum = "1b6709c7b6754dca1311b3c73e79fcce40dd414c782c66d88e8823030093b02b"
[[package]]
name = "sketches-ddsketch"
-version = "0.4.1"
+version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "513c3f5f732bfd6fbb187619c2dfe9d2f25f1a2976f01d575f0fd329d565df56"
+checksum = "e53e2f8d4e9c692f23a90208fad6a64862f413e286d533f1f649f160e2d5caee"
dependencies = [
"serde",
]
@@ -12422,9 +12423,9 @@ checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
[[package]]
name = "smallvec"
-version = "1.16.3"
+version = "1.16.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5b3dc8af474f516a851ff4bd12db780f948b9250ad37211e4eec0bccea54e01b"
+checksum = "d0d5d4b1981b8bbbb7aed204cae5726d683d5d6ac7e74ec54122ea28f315e7c8"
dependencies = [
"serde",
]
@@ -13965,9 +13966,9 @@ dependencies = [
[[package]]
name = "tinystr"
-version = "0.8.4"
+version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b1e27c91459209c2986af3dcf603a5a74a4368754ce37414f59acc971167f643"
+checksum = "abc840c238154d58f9e86b2792261edfde565a17696e1cda1a449de27979801a"
dependencies = [
"displaydoc",
"serde_core",
@@ -14745,9 +14746,9 @@ checksum = "86a801b3cea342a06d468c8710662aa29e5e05e4f5c0d62f00bbb7f2ad7941c2"
[[package]]
name = "typed-path"
-version = "0.12.3"
+version = "0.12.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8e28f89b80c87b8fb0cf04ab448d5dd0dd0ade2f8891bae878de66a75a28600e"
+checksum = "54ec2755506471f54baf5e4bb5499d8e510cc1caf271270e778a736bd2d7336c"
[[package]]
name = "typeid"
@@ -15051,9 +15052,9 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
[[package]]
name = "uuid"
-version = "1.28.0"
+version = "1.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7cc1186384beb7dd8eedea376413fd654937285ea6c9cfbb928dc3043ea4b606"
+checksum = "4a0e2d11620c50695fe12bbbfde96b3477fe606e7284c22d505c12ce51214514"
dependencies = [
"getrandom 0.4.3",
"js-sys",
@@ -15368,9 +15369,9 @@ dependencies = [
[[package]]
name = "webpki-root-certs"
-version = "1.0.9"
+version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b96554aa2acc8ccdb7e1c9a58a7a68dd5d13bccc69cd124cb09406db612a1c9b"
+checksum = "e49d0e65abc00c142e8f9428da991da9f1a250c39be97459901eb12b9b49f62a"
dependencies = [
"rustls-pki-types",
]
@@ -15381,14 +15382,14 @@ version = "0.26.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "521bc38abb08001b01866da9f51eb7c5d647a19260e00054a8c7fd5f9e57f7a9"
dependencies = [
- "webpki-roots 1.0.9",
+ "webpki-roots 1.0.11",
]
[[package]]
name = "webpki-roots"
-version = "1.0.9"
+version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7dcd9d09a39985f5344844e66b0c530a33843579125f23e21e9f0f220850f22a"
+checksum = "f5f280bbb2b287bc8e7de7e3852945a0ff50d1bbcb5ed42b6c7a568c546df171"
dependencies = [
"rustls-pki-types",
]
@@ -15486,7 +15487,7 @@ dependencies = [
[[package]]
name = "windmill"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"async-nats",
@@ -15576,7 +15577,7 @@ dependencies = [
[[package]]
name = "windmill-ai"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"async-stream",
"async-trait",
@@ -15611,7 +15612,7 @@ dependencies = [
[[package]]
name = "windmill-alerting"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"axum",
"chrono",
@@ -15624,7 +15625,7 @@ dependencies = [
[[package]]
name = "windmill-api"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"argon2",
@@ -15767,7 +15768,7 @@ dependencies = [
[[package]]
name = "windmill-api-agent-workers"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"axum",
"chrono",
@@ -15791,7 +15792,7 @@ dependencies = [
[[package]]
name = "windmill-api-assets"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"axum",
"chrono",
@@ -15808,7 +15809,7 @@ dependencies = [
[[package]]
name = "windmill-api-auth"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"axum",
@@ -15834,7 +15835,7 @@ dependencies = [
[[package]]
name = "windmill-api-client"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"reqwest 0.12.28",
"serde",
@@ -15844,7 +15845,7 @@ dependencies = [
[[package]]
name = "windmill-api-configs"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"axum",
"chrono",
@@ -15861,7 +15862,7 @@ dependencies = [
[[package]]
name = "windmill-api-debug"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"axum",
"base64 0.22.1",
@@ -15883,7 +15884,7 @@ dependencies = [
[[package]]
name = "windmill-api-embeddings"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"axum",
@@ -15906,7 +15907,7 @@ dependencies = [
[[package]]
name = "windmill-api-flow-conversations"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"axum",
"chrono",
@@ -15922,7 +15923,7 @@ dependencies = [
[[package]]
name = "windmill-api-flows"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"axum",
"chrono",
@@ -15944,7 +15945,7 @@ dependencies = [
[[package]]
name = "windmill-api-groups"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"axum",
"chrono",
@@ -15966,7 +15967,7 @@ dependencies = [
[[package]]
name = "windmill-api-inputs"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"axum",
"chrono",
@@ -15980,7 +15981,7 @@ dependencies = [
[[package]]
name = "windmill-api-integration-tests"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"async-nats",
@@ -16016,7 +16017,7 @@ dependencies = [
[[package]]
name = "windmill-api-jobs"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"axum",
@@ -16042,7 +16043,7 @@ dependencies = [
[[package]]
name = "windmill-api-npm-proxy"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"axum",
"chrono",
@@ -16070,7 +16071,7 @@ dependencies = [
[[package]]
name = "windmill-api-openapi"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"axum",
@@ -16092,7 +16093,7 @@ dependencies = [
[[package]]
name = "windmill-api-schedule"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"axum",
"chrono",
@@ -16112,7 +16113,7 @@ dependencies = [
[[package]]
name = "windmill-api-scripts"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"axum",
@@ -16154,7 +16155,7 @@ dependencies = [
[[package]]
name = "windmill-api-settings"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"axum",
@@ -16184,7 +16185,7 @@ dependencies = [
[[package]]
name = "windmill-api-sse"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"lazy_static",
"serde",
@@ -16196,7 +16197,7 @@ dependencies = [
[[package]]
name = "windmill-api-users"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"argon2",
"axum",
@@ -16220,7 +16221,7 @@ dependencies = [
[[package]]
name = "windmill-api-workers"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"axum",
"chrono",
@@ -16235,7 +16236,7 @@ dependencies = [
[[package]]
name = "windmill-api-workspaces"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"axum",
"chrono",
@@ -16274,7 +16275,7 @@ dependencies = [
[[package]]
name = "windmill-audit"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"chrono",
"lazy_static",
@@ -16289,7 +16290,7 @@ dependencies = [
[[package]]
name = "windmill-autoscaling"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"axum",
@@ -16308,7 +16309,7 @@ dependencies = [
[[package]]
name = "windmill-common"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"aes-gcm",
"aho-corasick",
@@ -16414,7 +16415,7 @@ dependencies = [
"url",
"urlencoding",
"uuid",
- "webpki-roots 1.0.9",
+ "webpki-roots 1.0.11",
"windmill-macros",
"windmill-parser",
"windmill-parser-py",
@@ -16426,7 +16427,7 @@ dependencies = [
[[package]]
name = "windmill-dep-map"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"chrono",
"futures",
@@ -16446,7 +16447,7 @@ dependencies = [
[[package]]
name = "windmill-git-sync"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"regex",
"serde",
@@ -16463,7 +16464,7 @@ dependencies = [
[[package]]
name = "windmill-indexer"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"astral-tokio-tar",
@@ -16490,7 +16491,7 @@ dependencies = [
[[package]]
name = "windmill-jseval"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"futures",
@@ -16507,7 +16508,7 @@ dependencies = [
[[package]]
name = "windmill-macros"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"itertools 0.14.0",
"lazy_static",
@@ -16523,7 +16524,7 @@ dependencies = [
[[package]]
name = "windmill-mcp"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"async-trait",
@@ -16545,7 +16546,7 @@ dependencies = [
[[package]]
name = "windmill-native-triggers"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"async-trait",
@@ -16576,7 +16577,7 @@ dependencies = [
[[package]]
name = "windmill-oauth"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"arc-swap",
@@ -16601,7 +16602,7 @@ dependencies = [
[[package]]
name = "windmill-object-store"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"async-stream",
@@ -16637,7 +16638,7 @@ dependencies = [
[[package]]
name = "windmill-operator"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"futures",
@@ -16656,7 +16657,7 @@ dependencies = [
[[package]]
name = "windmill-parser"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"convert_case 0.6.0",
"serde",
@@ -16665,7 +16666,7 @@ dependencies = [
[[package]]
name = "windmill-parser-bash"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"lazy_static",
@@ -16677,7 +16678,7 @@ dependencies = [
[[package]]
name = "windmill-parser-csharp"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"serde_json",
@@ -16689,7 +16690,7 @@ dependencies = [
[[package]]
name = "windmill-parser-go"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"gosyn",
@@ -16701,7 +16702,7 @@ dependencies = [
[[package]]
name = "windmill-parser-graphql"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"lazy_static",
@@ -16713,7 +16714,7 @@ dependencies = [
[[package]]
name = "windmill-parser-java"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"serde_json",
@@ -16725,7 +16726,7 @@ dependencies = [
[[package]]
name = "windmill-parser-nu"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"nu-parser",
@@ -16736,7 +16737,7 @@ dependencies = [
[[package]]
name = "windmill-parser-php"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"itertools 0.14.0",
@@ -16747,7 +16748,7 @@ dependencies = [
[[package]]
name = "windmill-parser-py"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"itertools 0.14.0",
@@ -16759,7 +16760,7 @@ dependencies = [
[[package]]
name = "windmill-parser-py-asset"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"ruff_python_ast",
@@ -16770,7 +16771,7 @@ dependencies = [
[[package]]
name = "windmill-parser-py-imports"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"async-recursion",
@@ -16793,7 +16794,7 @@ dependencies = [
[[package]]
name = "windmill-parser-r"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"serde_json",
@@ -16805,7 +16806,7 @@ dependencies = [
[[package]]
name = "windmill-parser-ruby"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"lazy_static",
@@ -16819,7 +16820,7 @@ dependencies = [
[[package]]
name = "windmill-parser-rust"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"convert_case 0.6.0",
@@ -16836,7 +16837,7 @@ dependencies = [
[[package]]
name = "windmill-parser-sql"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"lazy_static",
@@ -16849,7 +16850,7 @@ dependencies = [
[[package]]
name = "windmill-parser-sql-asset"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"serde",
@@ -16861,7 +16862,7 @@ dependencies = [
[[package]]
name = "windmill-parser-ts"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"lazy_static",
@@ -16879,7 +16880,7 @@ dependencies = [
[[package]]
name = "windmill-parser-ts-asset"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"serde-wasm-bindgen",
@@ -16895,7 +16896,7 @@ dependencies = [
[[package]]
name = "windmill-parser-wac"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"ruff_python_ast",
@@ -16912,7 +16913,7 @@ dependencies = [
[[package]]
name = "windmill-parser-yaml"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"lazy_static",
@@ -16926,7 +16927,7 @@ dependencies = [
[[package]]
name = "windmill-queue"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"async-recursion",
@@ -16965,7 +16966,7 @@ dependencies = [
[[package]]
name = "windmill-runtime-nativets"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"const_format",
@@ -17003,7 +17004,7 @@ dependencies = [
[[package]]
name = "windmill-sql-datatype-parser-wasm"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"getrandom 0.3.4",
"wasm-bindgen",
@@ -17014,7 +17015,7 @@ dependencies = [
[[package]]
name = "windmill-store"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"async-recursion",
@@ -17049,7 +17050,7 @@ dependencies = [
[[package]]
name = "windmill-test-utils"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"async-trait",
@@ -17073,7 +17074,7 @@ dependencies = [
[[package]]
name = "windmill-trigger"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"async-trait",
@@ -17106,7 +17107,7 @@ dependencies = [
[[package]]
name = "windmill-trigger-amqp"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"async-trait",
@@ -17133,7 +17134,7 @@ dependencies = [
[[package]]
name = "windmill-trigger-azure"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"async-trait",
@@ -17166,7 +17167,7 @@ dependencies = [
[[package]]
name = "windmill-trigger-email"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"async-trait",
@@ -17186,7 +17187,7 @@ dependencies = [
[[package]]
name = "windmill-trigger-gcp"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"async-trait",
@@ -17220,7 +17221,7 @@ dependencies = [
[[package]]
name = "windmill-trigger-http"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"async-trait",
@@ -17257,7 +17258,7 @@ dependencies = [
[[package]]
name = "windmill-trigger-kafka"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"async-trait",
@@ -17280,7 +17281,7 @@ dependencies = [
[[package]]
name = "windmill-trigger-mqtt"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"async-trait",
@@ -17304,7 +17305,7 @@ dependencies = [
[[package]]
name = "windmill-trigger-nats"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"async-nats",
@@ -17328,7 +17329,7 @@ dependencies = [
[[package]]
name = "windmill-trigger-postgres"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"async-trait",
@@ -17363,7 +17364,7 @@ dependencies = [
[[package]]
name = "windmill-trigger-sqs"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"async-trait",
@@ -17391,7 +17392,7 @@ dependencies = [
[[package]]
name = "windmill-trigger-websocket"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"async-trait",
@@ -17416,7 +17417,7 @@ dependencies = [
[[package]]
name = "windmill-types"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"bitflags 2.13.2",
@@ -17435,7 +17436,7 @@ dependencies = [
[[package]]
name = "windmill-worker"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"async-once-cell",
@@ -17553,7 +17554,7 @@ dependencies = [
[[package]]
name = "windmill-worker-volumes"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"bytes",
"futures",
@@ -18256,9 +18257,9 @@ dependencies = [
[[package]]
name = "yoke"
-version = "0.8.3"
+version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5"
+checksum = "417ef3fcf6c300b7dbd25c85531a746931c02ad536f3cf4786ed1e88223340b3"
dependencies = [
"stable_deref_trait",
"yoke-derive",
@@ -18352,9 +18353,9 @@ dependencies = [
[[package]]
name = "zerovec"
-version = "0.11.8"
+version = "0.11.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bb0464e17806c1d976d5cba29399c7f08e516e279e2ba493f63123b5fca67dd8"
+checksum = "f58a2799cfe9a1670c7ea8edbd52ef8edb93cb37a7f83bf31ba9e35d9dae6a40"
dependencies = [
"serde",
"yoke",
@@ -18364,9 +18365,9 @@ dependencies = [
[[package]]
name = "zerovec-derive"
-version = "0.11.6"
+version = "0.11.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "34df6fc39dbd26ddc9c10e6a2984476e13acce22e64e4487636ef494369225da"
+checksum = "c3743ddbf47738d929cd1ae2e199d40d0162979dfe31aef8ae646d2bf00bf97a"
dependencies = [
"proc-macro2",
"quote",
diff --git a/backend/Cargo.toml b/backend/Cargo.toml
index 1851f386c2..b42cac10f0 100644
--- a/backend/Cargo.toml
+++ b/backend/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "windmill"
-version = "1.841.0"
+version = "1.849.0"
authors.workspace = true
edition.workspace = true
@@ -88,7 +88,7 @@ members = [
exclude = ["./windmill-duckdb-ffi-internal", "./parsers/windmill-parser-wasm"]
[workspace.package]
-version = "1.841.0"
+version = "1.849.0"
authors = ["Ruben Fiszel "]
edition = "2021"
diff --git a/backend/ee-repo-ref.txt b/backend/ee-repo-ref.txt
index 615a468f70..991ab7238e 100644
--- a/backend/ee-repo-ref.txt
+++ b/backend/ee-repo-ref.txt
@@ -1 +1 @@
-1a47ebf405774527e3b79c0591897ace3e22a739
+e9eec74860968201207e710979ddbeba29bcc290
diff --git a/backend/migrations/20260824180615_variable_value_valid_until.down.sql b/backend/migrations/20260824180615_variable_value_valid_until.down.sql
new file mode 100644
index 0000000000..963fd00f8e
--- /dev/null
+++ b/backend/migrations/20260824180615_variable_value_valid_until.down.sql
@@ -0,0 +1,9 @@
+ALTER TABLE variable DROP CONSTRAINT IF EXISTS variable_oauth_no_value_expiry;
+DROP INDEX IF EXISTS idx_variable_expiration_due;
+
+COMMENT ON COLUMN variable.expires_at IS NULL;
+
+ALTER TABLE variable
+ DROP COLUMN IF EXISTS value_valid_until,
+ DROP COLUMN IF EXISTS expiration_dispatched_for,
+ DROP COLUMN IF EXISTS expiration_notified_at;
diff --git a/backend/migrations/20260824180615_variable_value_valid_until.up.sql b/backend/migrations/20260824180615_variable_value_valid_until.up.sql
new file mode 100644
index 0000000000..308394d7e0
--- /dev/null
+++ b/backend/migrations/20260824180615_variable_value_valid_until.up.sql
@@ -0,0 +1,30 @@
+-- `value_valid_until` is when the value stored in the variable stops working; the row itself
+-- lives on. `expires_at` keeps its unrelated meaning — delete the row — so no existing writer
+-- changes meaning under a rolling deploy and no data is rewritten here.
+ALTER TABLE variable ADD COLUMN IF NOT EXISTS value_valid_until TIMESTAMP WITH TIME ZONE;
+
+COMMENT ON COLUMN variable.expires_at IS
+ 'Garbage collection deadline: the row is deleted once passed. Set by the ephemeral secret_arg mint. Not the value''s expiry — see value_valid_until.';
+COMMENT ON COLUMN variable.value_valid_until IS
+ 'When the value stops working. Drives the workspace variable expiration handler; never deletes the row.';
+
+-- Holds the `value_valid_until` that was dispatched, rather than a plain "was dispatched" flag,
+-- so that moving the date re-arms the handler by construction — no writer has to remember to
+-- clear anything.
+ALTER TABLE variable
+ ADD COLUMN IF NOT EXISTS expiration_dispatched_for TIMESTAMP WITH TIME ZONE;
+
+-- When the handler last ran for this variable, which paces its reminders.
+ALTER TABLE variable
+ ADD COLUMN IF NOT EXISTS expiration_notified_at TIMESTAMP WITH TIME ZONE;
+
+-- Serves the sweep's due predicate. Partial so it stays the size of the opted-in set rather
+-- than the whole variable table. Not partial on `expiration_dispatched_for`: reminders keep a
+-- dispatched variable due until it expires.
+CREATE INDEX IF NOT EXISTS idx_variable_expiration_due ON variable (value_valid_until)
+ WHERE value_valid_until IS NOT NULL;
+
+-- An OAuth-linked value is refreshed by Windmill itself, so a rotation date on it would only
+-- announce an expiry that never comes.
+ALTER TABLE variable ADD CONSTRAINT variable_oauth_no_value_expiry
+ CHECK (account IS NULL OR value_valid_until IS NULL);
diff --git a/backend/migrations/20260824180616_workspace_variable_expiration_handler.down.sql b/backend/migrations/20260824180616_workspace_variable_expiration_handler.down.sql
new file mode 100644
index 0000000000..92c048bd52
--- /dev/null
+++ b/backend/migrations/20260824180616_workspace_variable_expiration_handler.down.sql
@@ -0,0 +1,3 @@
+ALTER TABLE workspace_settings
+ DROP COLUMN IF EXISTS variable_expiration_handler,
+ DROP COLUMN IF EXISTS variable_expiration_failed_at;
diff --git a/backend/migrations/20260824180616_workspace_variable_expiration_handler.up.sql b/backend/migrations/20260824180616_workspace_variable_expiration_handler.up.sql
new file mode 100644
index 0000000000..8e6cb03938
--- /dev/null
+++ b/backend/migrations/20260824180616_workspace_variable_expiration_handler.up.sql
@@ -0,0 +1,6 @@
+-- Shape mirrors `error_handler` / `success_handler` as grouped by 20260124172000:
+-- {"path": ..., "extra_args": ..., "muted_on_user_path": ...}
+ALTER TABLE workspace_settings ADD COLUMN IF NOT EXISTS variable_expiration_handler JSONB;
+
+-- When the handler last failed to start; the sweep skips the workspace for a while after it.
+ALTER TABLE workspace_settings ADD COLUMN IF NOT EXISTS variable_expiration_failed_at TIMESTAMP WITH TIME ZONE;
diff --git a/backend/migrations/20260903161430_variable_expiration_handler_slack_perms.down.sql b/backend/migrations/20260903161430_variable_expiration_handler_slack_perms.down.sql
new file mode 100644
index 0000000000..40443fc999
--- /dev/null
+++ b/backend/migrations/20260903161430_variable_expiration_handler_slack_perms.down.sql
@@ -0,0 +1 @@
+UPDATE folder SET extra_perms = extra_perms - 'g/variable_expiration_handler' WHERE name = 'slack_bot';
diff --git a/backend/migrations/20260903161430_variable_expiration_handler_slack_perms.up.sql b/backend/migrations/20260903161430_variable_expiration_handler_slack_perms.up.sql
new file mode 100644
index 0000000000..25adde9d36
--- /dev/null
+++ b/backend/migrations/20260903161430_variable_expiration_handler_slack_perms.up.sql
@@ -0,0 +1,7 @@
+-- Windmill never created this group before this release, so one present now was made by a user,
+-- who would otherwise keep it as it gains read on the Slack bot token below.
+DELETE FROM usr_to_group WHERE group_ = 'variable_expiration_handler';
+UPDATE group_ SET extra_perms = '{}'::jsonb WHERE name = 'variable_expiration_handler';
+
+-- Backfill for slack_bot folders created before this grant (see create_slack_workspace_artifacts).
+UPDATE folder SET extra_perms = JSONB_SET(extra_perms, '{g/variable_expiration_handler}', 'false', true) WHERE name = 'slack_bot';
diff --git a/backend/migrations/20261015140602_mcp_oauth_grant_without_workspace.down.sql b/backend/migrations/20261015140602_mcp_oauth_grant_without_workspace.down.sql
new file mode 100644
index 0000000000..6e9587579b
--- /dev/null
+++ b/backend/migrations/20261015140602_mcp_oauth_grant_without_workspace.down.sql
@@ -0,0 +1,18 @@
+-- A server without these scopes ignores them, which would widen every token carrying one:
+-- a narrowed `mcp:all` to full access, a workspace list to all of the owner's workspaces.
+DELETE FROM token WHERE EXISTS (
+ SELECT 1 FROM unnest(scopes) s
+ WHERE s IN ('mcp:read_only', 'mcp:read_run', 'mcp:runnables_as_tools') OR s LIKE 'mcp:workspaces:%'
+);
+DELETE FROM mcp_oauth_refresh_token WHERE EXISTS (
+ SELECT 1 FROM unnest(scopes) s
+ WHERE s IN ('mcp:read_only', 'mcp:read_run', 'mcp:runnables_as_tools') OR s LIKE 'mcp:workspaces:%'
+);
+DELETE FROM mcp_oauth_server_code WHERE EXISTS (
+ SELECT 1 FROM unnest(scopes) s
+ WHERE s IN ('mcp:read_only', 'mcp:read_run', 'mcp:runnables_as_tools') OR s LIKE 'mcp:workspaces:%'
+);
+DELETE FROM mcp_oauth_server_code WHERE workspace_id IS NULL;
+DELETE FROM mcp_oauth_refresh_token WHERE workspace_id IS NULL;
+ALTER TABLE mcp_oauth_server_code ALTER COLUMN workspace_id SET NOT NULL;
+ALTER TABLE mcp_oauth_refresh_token ALTER COLUMN workspace_id SET NOT NULL;
diff --git a/backend/migrations/20261015140602_mcp_oauth_grant_without_workspace.up.sql b/backend/migrations/20261015140602_mcp_oauth_grant_without_workspace.up.sql
new file mode 100644
index 0000000000..efd4bdc283
--- /dev/null
+++ b/backend/migrations/20261015140602_mcp_oauth_grant_without_workspace.up.sql
@@ -0,0 +1,4 @@
+-- An MCP OAuth grant can span several workspaces (listed in its scopes) or all of the
+-- user's, in which case the token it mints is bound to none.
+ALTER TABLE mcp_oauth_server_code ALTER COLUMN workspace_id DROP NOT NULL;
+ALTER TABLE mcp_oauth_refresh_token ALTER COLUMN workspace_id DROP NOT NULL;
diff --git a/backend/migrations/20261016072241_workspace_roles.down.sql b/backend/migrations/20261016072241_workspace_roles.down.sql
new file mode 100644
index 0000000000..6cc9a3cbef
--- /dev/null
+++ b/backend/migrations/20261016072241_workspace_roles.down.sql
@@ -0,0 +1,4 @@
+DROP TABLE IF EXISTS role_seat;
+ALTER TABLE workspace_settings DROP COLUMN IF EXISTS role_overrides;
+ALTER TABLE workspace_invite DROP COLUMN IF EXISTS workspace_role;
+ALTER TABLE usr DROP COLUMN IF EXISTS workspace_role;
diff --git a/backend/migrations/20261016072241_workspace_roles.up.sql b/backend/migrations/20261016072241_workspace_roles.up.sql
new file mode 100644
index 0000000000..8cd96628a0
--- /dev/null
+++ b/backend/migrations/20261016072241_workspace_roles.up.sql
@@ -0,0 +1,68 @@
+-- A member's role by name. NULL keeps the legacy reading of `operator` (`operator` / `developer`),
+-- so rows written by code that predates roles stay meaningful.
+ALTER TABLE usr ADD COLUMN IF NOT EXISTS workspace_role VARCHAR(50);
+ALTER TABLE workspace_invite ADD COLUMN IF NOT EXISTS workspace_role VARCHAR(50);
+
+-- Per-workspace role overrides, keyed by role name: `{"": {"label"?, "capabilities": {..}}}`.
+ALTER TABLE workspace_settings ADD COLUMN IF NOT EXISTS role_overrides JSONB;
+
+-- The operator settings a workspace changed from their default become its override of the
+-- `operator` role. Keys left at their default stay unset, so they follow the instance definition.
+-- A value that is not a boolean reads as unset: one hand-edited row must not abort the upgrade.
+CREATE OR REPLACE FUNCTION wm_try_bool(v TEXT) RETURNS BOOLEAN AS $$
+BEGIN
+ RETURN v::boolean;
+EXCEPTION WHEN invalid_text_representation THEN
+ RETURN NULL;
+END;
+$$ LANGUAGE plpgsql IMMUTABLE;
+
+WITH caps AS (
+ SELECT workspace_id, jsonb_strip_nulls(jsonb_build_object(
+ 'flows', CASE WHEN wm_try_bool(operator_settings->>'builder_flows') THEN 'compose' END,
+ 'apps', CASE WHEN wm_try_bool(operator_settings->>'builder_apps') THEN 'compose' END,
+ 'manage_schedules', CASE WHEN wm_try_bool(operator_settings->>'manage_schedules') IS false THEN false END,
+ 'manage_triggers', CASE WHEN wm_try_bool(operator_settings->>'manage_triggers') IS false THEN false END,
+ 'visibility', NULLIF(jsonb_strip_nulls(jsonb_build_object(
+ 'runs', CASE WHEN wm_try_bool(operator_settings->>'runs') IS false THEN false END,
+ 'schedules', CASE WHEN wm_try_bool(operator_settings->>'schedules') IS false THEN false END,
+ 'resources', CASE WHEN wm_try_bool(operator_settings->>'resources') IS false THEN false END,
+ 'variables', CASE WHEN wm_try_bool(operator_settings->>'variables') IS false THEN false END,
+ 'assets', CASE WHEN wm_try_bool(operator_settings->>'assets') IS false THEN false END,
+ 'triggers', CASE WHEN wm_try_bool(operator_settings->>'triggers') IS false THEN false END,
+ 'audit_logs', CASE WHEN wm_try_bool(operator_settings->>'audit_logs') IS false THEN false END,
+ 'groups', CASE WHEN wm_try_bool(operator_settings->>'groups') IS false THEN false END,
+ 'folders', CASE WHEN wm_try_bool(operator_settings->>'folders') IS false THEN false END,
+ 'workers', CASE WHEN wm_try_bool(operator_settings->>'workers') IS false THEN false END
+ )), '{}'::jsonb)
+ )) AS caps
+ FROM workspace_settings
+ WHERE operator_settings IS NOT NULL AND jsonb_typeof(operator_settings) = 'object'
+)
+UPDATE workspace_settings ws
+SET role_overrides = jsonb_build_object('operator', jsonb_build_object('capabilities', caps.caps))
+FROM caps
+WHERE ws.workspace_id = caps.workspace_id AND caps.caps <> '{}'::jsonb;
+
+DROP FUNCTION wm_try_bool(TEXT);
+
+-- Whether a role costs a full (author) seat, materialized from the role configuration so billing
+-- SQL needs no copy of the capability merge. `workspace_id = ''` holds the instance roles; a
+-- workspace row exists only for a role that workspace overrides or adds.
+CREATE TABLE IF NOT EXISTS role_seat (
+ workspace_id VARCHAR(50) NOT NULL,
+ role VARCHAR(50) NOT NULL,
+ author BOOLEAN NOT NULL,
+ PRIMARY KEY (workspace_id, role)
+);
+INSERT INTO role_seat (workspace_id, role, author)
+VALUES ('', 'developer', true), ('', 'operator', false)
+ON CONFLICT DO NOTHING;
+INSERT INTO role_seat (workspace_id, role, author)
+SELECT workspace_id,
+ 'operator',
+ (role_overrides->'operator'->'capabilities'->>'flows') IS NOT NULL
+ OR (role_overrides->'operator'->'capabilities'->>'apps') IS NOT NULL
+FROM workspace_settings
+WHERE role_overrides ? 'operator'
+ON CONFLICT DO NOTHING;
diff --git a/backend/migrations/20261020155618_workspace_slack_signing_secret.down.sql b/backend/migrations/20261020155618_workspace_slack_signing_secret.down.sql
new file mode 100644
index 0000000000..a93bfaa916
--- /dev/null
+++ b/backend/migrations/20261020155618_workspace_slack_signing_secret.down.sql
@@ -0,0 +1 @@
+ALTER TABLE workspace_settings DROP COLUMN IF EXISTS slack_signing_secret;
diff --git a/backend/migrations/20261020155618_workspace_slack_signing_secret.up.sql b/backend/migrations/20261020155618_workspace_slack_signing_secret.up.sql
new file mode 100644
index 0000000000..2bd78fa59b
--- /dev/null
+++ b/backend/migrations/20261020155618_workspace_slack_signing_secret.up.sql
@@ -0,0 +1 @@
+ALTER TABLE workspace_settings ADD COLUMN IF NOT EXISTS slack_signing_secret TEXT;
diff --git a/backend/migrations/20261022000335_audit_insert_policy_windmill_user.down.sql b/backend/migrations/20261022000335_audit_insert_policy_windmill_user.down.sql
new file mode 100644
index 0000000000..2e7bb84888
--- /dev/null
+++ b/backend/migrations/20261022000335_audit_insert_policy_windmill_user.down.sql
@@ -0,0 +1,7 @@
+DROP POLICY IF EXISTS insert_any ON audit_partitioned;
+CREATE POLICY schedule ON audit_partitioned FOR INSERT TO windmill_user
+ WITH CHECK ((username)::text ~~ 'schedule-%'::text);
+CREATE POLICY schedule_audit ON audit_partitioned FOR INSERT TO windmill_user
+ WITH CHECK ((parameters ->> 'end_user'::text) ~~ 'schedule-%'::text);
+CREATE POLICY webhook ON audit_partitioned FOR INSERT TO windmill_user
+ WITH CHECK ((username)::text ~~ 'webhook-%'::text);
diff --git a/backend/migrations/20261022000335_audit_insert_policy_windmill_user.up.sql b/backend/migrations/20261022000335_audit_insert_policy_windmill_user.up.sql
new file mode 100644
index 0000000000..ab6b376663
--- /dev/null
+++ b/backend/migrations/20261022000335_audit_insert_policy_windmill_user.up.sql
@@ -0,0 +1,7 @@
+-- Only the server writes audit rows, so insert policies guard nothing. They did reject rows
+-- whose username is not the caller, such as a job pushed as another user by a non-admin, and
+-- that failed insert aborted the caller's transaction. Reads stay restricted by `see_own`.
+DROP POLICY IF EXISTS schedule ON audit_partitioned;
+DROP POLICY IF EXISTS schedule_audit ON audit_partitioned;
+DROP POLICY IF EXISTS webhook ON audit_partitioned;
+CREATE POLICY insert_any ON audit_partitioned FOR INSERT TO windmill_user WITH CHECK (true);
diff --git a/backend/migrations/20261022125411_native_trigger_connection.down.sql b/backend/migrations/20261022125411_native_trigger_connection.down.sql
new file mode 100644
index 0000000000..3951ab2a64
--- /dev/null
+++ b/backend/migrations/20261022125411_native_trigger_connection.down.sql
@@ -0,0 +1 @@
+ALTER TABLE native_trigger DROP COLUMN IF EXISTS connection_path;
diff --git a/backend/migrations/20261022125411_native_trigger_connection.up.sql b/backend/migrations/20261022125411_native_trigger_connection.up.sql
new file mode 100644
index 0000000000..3b235a8d4d
--- /dev/null
+++ b/backend/migrations/20261022125411_native_trigger_connection.up.sql
@@ -0,0 +1,24 @@
+-- Each native trigger names the connection (OAuth resource) it acts through, instead of every
+-- trigger of a service sharing the single workspace connection.
+ALTER TABLE native_trigger ADD COLUMN connection_path VARCHAR(255);
+
+-- Saving the OAuth app, or starting a connect with the instance app, used to clear
+-- resource_path while the connection itself stayed. A service then had at most one connection,
+-- so when exactly one is found it is the one its triggers used.
+UPDATE workspace_integrations wi
+SET resource_path = (
+ SELECT CASE WHEN count(*) = 1 THEN min(v.path) END
+ FROM variable v
+ JOIN account a ON a.workspace_id = v.workspace_id AND a.id = v.account
+ WHERE v.workspace_id = wi.workspace_id
+ AND a.client = wi.service_name::text
+ AND a.is_workspace_integration = true
+)
+WHERE wi.resource_path IS NULL;
+
+UPDATE native_trigger nt
+SET connection_path = wi.resource_path
+FROM workspace_integrations wi
+WHERE wi.workspace_id = nt.workspace_id
+ AND wi.service_name = nt.service_name
+ AND wi.resource_path IS NOT NULL;
diff --git a/backend/migrations/20261022163514_reset_cached_variable_workspace_diffs.down.sql b/backend/migrations/20261022163514_reset_cached_variable_workspace_diffs.down.sql
new file mode 100644
index 0000000000..d2f607c5b8
--- /dev/null
+++ b/backend/migrations/20261022163514_reset_cached_variable_workspace_diffs.down.sql
@@ -0,0 +1 @@
+-- Add down migration script here
diff --git a/backend/migrations/20261022163514_reset_cached_variable_workspace_diffs.up.sql b/backend/migrations/20261022163514_reset_cached_variable_workspace_diffs.up.sql
new file mode 100644
index 0000000000..c531389793
--- /dev/null
+++ b/backend/migrations/20261022163514_reset_cached_variable_workspace_diffs.up.sql
@@ -0,0 +1,3 @@
+-- Secrets compared by ciphertext were cached as changed even when both sides held the same value,
+-- and a cached verdict is trusted until the next write. Re-evaluate every variable row once.
+UPDATE workspace_diff SET has_changes = NULL WHERE kind = 'variable';
diff --git a/backend/oauth_connect.json b/backend/oauth_connect.json
index 611e3f7c17..48957fee2f 100644
--- a/backend/oauth_connect.json
+++ b/backend/oauth_connect.json
@@ -337,12 +337,29 @@
"auth_url": "https://www.linkedin.com/oauth/v2/authorization",
"token_url": "https://www.linkedin.com/oauth/v2/accessToken",
"grant_types": ["authorization_code", "client_credentials"],
- "scopes": ["w_member_social", "r_liteprofile", "r_emailaddress"],
+ "scopes": ["openid", "profile", "email", "w_member_social"],
+ "scope_options": [
+ "openid",
+ "profile",
+ "email",
+ "w_member_social",
+ "r_member_social",
+ "w_organization_social",
+ "r_organization_social",
+ "r_organization_admin",
+ "rw_organization_admin",
+ "r_ads",
+ "r_basicprofile"
+ ],
"req_body_auth": true
},
"quickbooks": {
"auth_url": "https://appcenter.intuit.com/connect/oauth2",
"token_url": "https://oauth.platform.intuit.com/oauth2/v1/tokens/bearer",
+ "connect_fields": {
+ "realmId": "callback.realmId"
+ },
+ "resource_fields": ["realmId", "isSandBox"],
"scopes": ["com.intuit.quickbooks.accounting"]
},
"visma": {
@@ -468,15 +485,26 @@
"docusign": {
"auth_url": "https://account.docusign.com/oauth/auth",
"token_url": "https://account.docusign.com/oauth/token",
+ "userinfo_url": "https://account.docusign.com/oauth/userinfo",
+ "connect_fields": {
+ "account_id": "userinfo.accounts[is_default=true].account_id",
+ "base_uri": "userinfo.accounts[is_default=true].base_uri"
+ },
+ "resource_fields": ["account_id", "base_uri"],
"scopes": ["signature"],
"sandbox": {
"auth_url": "https://account-d.docusign.com/oauth/auth",
- "token_url": "https://account-d.docusign.com/oauth/token"
+ "token_url": "https://account-d.docusign.com/oauth/token",
+ "userinfo_url": "https://account-d.docusign.com/oauth/userinfo"
}
},
"salesforce": {
"auth_url": "https://login.salesforce.com/services/oauth2/authorize",
"token_url": "https://login.salesforce.com/services/oauth2/token",
+ "connect_fields": {
+ "instance_url": "token.instance_url"
+ },
+ "resource_fields": ["instance_url"],
"scopes": ["api", "refresh_token", "offline_access"],
"sandbox": {
"auth_url": "https://test.salesforce.com/services/oauth2/authorize",
diff --git a/backend/parsers/windmill-parser-wasm/Cargo.lock b/backend/parsers/windmill-parser-wasm/Cargo.lock
index f89fa1d49a..ba2d483531 100644
--- a/backend/parsers/windmill-parser-wasm/Cargo.lock
+++ b/backend/parsers/windmill-parser-wasm/Cargo.lock
@@ -6340,7 +6340,7 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windmill-common"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"aes-gcm",
"aho-corasick",
@@ -6430,7 +6430,7 @@ dependencies = [
[[package]]
name = "windmill-macros"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"proc-macro2",
"quote",
@@ -6442,7 +6442,7 @@ dependencies = [
[[package]]
name = "windmill-parser"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"convert_case",
"serde",
@@ -6451,7 +6451,7 @@ dependencies = [
[[package]]
name = "windmill-parser-bash"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"lazy_static",
@@ -6463,7 +6463,7 @@ dependencies = [
[[package]]
name = "windmill-parser-csharp"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"serde_json",
@@ -6475,7 +6475,7 @@ dependencies = [
[[package]]
name = "windmill-parser-go"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"gosyn",
@@ -6487,7 +6487,7 @@ dependencies = [
[[package]]
name = "windmill-parser-graphql"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"lazy_static",
@@ -6499,7 +6499,7 @@ dependencies = [
[[package]]
name = "windmill-parser-java"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"serde_json",
@@ -6511,7 +6511,7 @@ dependencies = [
[[package]]
name = "windmill-parser-nu"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"nu-parser",
@@ -6522,7 +6522,7 @@ dependencies = [
[[package]]
name = "windmill-parser-php"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"itertools 0.14.0",
@@ -6533,7 +6533,7 @@ dependencies = [
[[package]]
name = "windmill-parser-py"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"itertools 0.14.0",
@@ -6545,7 +6545,7 @@ dependencies = [
[[package]]
name = "windmill-parser-py-asset"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"ruff_python_ast",
@@ -6556,7 +6556,7 @@ dependencies = [
[[package]]
name = "windmill-parser-py-imports"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"async-recursion",
@@ -6579,7 +6579,7 @@ dependencies = [
[[package]]
name = "windmill-parser-r"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"serde_json",
@@ -6591,7 +6591,7 @@ dependencies = [
[[package]]
name = "windmill-parser-ruby"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"lazy_static",
@@ -6605,7 +6605,7 @@ dependencies = [
[[package]]
name = "windmill-parser-rust"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"convert_case",
@@ -6622,7 +6622,7 @@ dependencies = [
[[package]]
name = "windmill-parser-sql"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"lazy_static",
@@ -6635,7 +6635,7 @@ dependencies = [
[[package]]
name = "windmill-parser-sql-asset"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"serde",
@@ -6647,7 +6647,7 @@ dependencies = [
[[package]]
name = "windmill-parser-ts"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"lazy_static",
@@ -6665,7 +6665,7 @@ dependencies = [
[[package]]
name = "windmill-parser-ts-asset"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"serde-wasm-bindgen",
@@ -6681,7 +6681,7 @@ dependencies = [
[[package]]
name = "windmill-parser-wac"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"ruff_python_ast",
@@ -6698,7 +6698,7 @@ dependencies = [
[[package]]
name = "windmill-parser-wasm"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"getrandom 0.2.17",
@@ -6730,7 +6730,7 @@ dependencies = [
[[package]]
name = "windmill-parser-yaml"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"lazy_static",
@@ -6744,7 +6744,7 @@ dependencies = [
[[package]]
name = "windmill-types"
-version = "1.841.0"
+version = "1.849.0"
dependencies = [
"anyhow",
"bitflags",
diff --git a/backend/parsers/windmill-parser-wasm/Cargo.toml b/backend/parsers/windmill-parser-wasm/Cargo.toml
index d6c0389840..0d0697c3fd 100644
--- a/backend/parsers/windmill-parser-wasm/Cargo.toml
+++ b/backend/parsers/windmill-parser-wasm/Cargo.toml
@@ -12,7 +12,7 @@ resolver = "2"
members = ["."]
[workspace.package]
-version = "1.841.0"
+version = "1.849.0"
edition = "2021"
authors = ["Ruben Fiszel "]
diff --git a/backend/src/main.rs b/backend/src/main.rs
index ef9961ba57..1035a0549f 100644
--- a/backend/src/main.rs
+++ b/backend/src/main.rs
@@ -1680,12 +1680,15 @@ async fn process_notify_event(
);
windmill_common::variables::CUSTOM_ENVS_CACHE.remove(payload);
}
- "notify_operator_settings_change" => {
+ // Written by the legacy operator settings mirror, always alongside a role override.
+ c if c == "notify_operator_settings_change"
+ || c == windmill_common::roles::ROLE_OVERRIDES_CHANGE_CHANNEL =>
+ {
tracing::info!(
- "Operator settings change detected, invalidating operator rights cache: {}",
+ "Role overrides change detected, invalidating workspace roles cache: {}",
payload
);
- windmill_common::workspaces::invalidate_operator_rights_cache(payload);
+ windmill_common::roles::invalidate_workspace_roles_cache(payload);
}
"notify_asset_producer_change" => {
tracing::debug!(
@@ -2042,6 +2045,9 @@ async fn process_notify_event(
DISABLE_PASSWORD_LOGIN_SETTING => {
load_disable_password_login(db).await;
}
+ windmill_common::global_settings::WORKSPACE_ROLES_SETTING => {
+ windmill_common::roles::invalidate_all_roles_cache();
+ }
MCP_DISABLE_TOKEN_QUERY_PARAM_SETTING => {
load_mcp_disable_token_query_param(db).await;
}
diff --git a/backend/src/monitor.rs b/backend/src/monitor.rs
index 827c092529..868e558f8d 100644
--- a/backend/src/monitor.rs
+++ b/backend/src/monitor.rs
@@ -129,6 +129,7 @@ use windmill_object_store::reload_object_store_setting;
use windmill_queue::{
add_completed_job_error, cancel_job, canceled_result, get_queued_job_v2,
schedule::{find_unarmed_schedules, rearm_schedule, RearmOutcome},
+ variable_expiration::dispatch_expiring_variables,
CanceledBy, MiniCompletedJob, SameWorkerPayload,
};
use windmill_store::resources::MAX_RESOURCE_VERSIONS;
@@ -441,6 +442,7 @@ pub async fn initial_load(
cache_clear: None,
additional_python_paths: None,
pip_local_dependencies: None,
+ disable_job_proxy: false,
native_mode,
// an agent worker never reads its group's config, only its token
object_store_cache_config: None,
@@ -4410,6 +4412,15 @@ pub async fn monitor_db(
}
};
+ // Run every 5 minutes (10 iterations * 30s)
+ let dispatch_expiring_variables_f = async {
+ if server_mode && iteration.is_some() && iteration.as_ref().unwrap().should_run(10) {
+ if let Some(db) = conn.as_sql() {
+ dispatch_expiring_variables(&db).await;
+ }
+ }
+ };
+
// run every hour (120 iterations * 30s = 3600s)
let cleanup_stale_server_heartbeats_f = async {
if server_mode && iteration.is_some() && iteration.as_ref().unwrap().should_run(120) {
@@ -4616,6 +4627,7 @@ pub async fn monitor_db(
native_triggers_sync_f,
cleanup_notify_events_f,
check_expiring_tokens_f,
+ dispatch_expiring_variables_f,
cleanup_stale_server_heartbeats_f,
manage_audit_partitions_f,
export_audit_logs_to_object_store_f,
diff --git a/backend/summarized_schema.txt b/backend/summarized_schema.txt
index 2bf6b0188f..418108cd30 100644
--- a/backend/summarized_schema.txt
+++ b/backend/summarized_schema.txt
@@ -220,7 +220,7 @@ v2_job_runtime: id(uuid), ping(ts), memory_peak(int)
FK: (id) -> v2_job_queue(id)
v2_job_status: id(uuid), flow_status(jsonb), flow_leaf_jobs(jsonb), workflow_as_code_status(jsonb)
FK: (id) -> v2_job_queue(id)
-variable: workspace_id(char), path(char), value(char), is_secret(bool), description(char), extra_perms(jsonb), account(int), is_oauth(bool), expires_at(ts), labels(text[])
+variable: workspace_id(char), path(char), value(char), is_secret(bool), description(char), extra_perms(jsonb), account(int), is_oauth(bool), expires_at(ts), labels(text[]), value_valid_until(timestamptz), expiration_dispatched_for(timestamptz), expiration_notified_at(timestamptz)
FK: (workspace_id) -> workspace(id)
websocket_trigger: path(char), url(char), script_path(char), is_flow(bool), workspace_id(char), edited_by(char), email(char), edited_at(ts), extra_perms(jsonb), server_id(char), last_server_ping(ts), error(text), filters(jsonb[]), initial_messages(jsonb[]), url_runnable_args(jsonb), can_return_message(bool), error_handler_path(char), error_handler_args(jsonb), retry(jsonb), can_return_error_result(bool), mode(trigger_mode), labels(text[])
windmill_migrations: name(text), created_at(ts)
@@ -244,7 +244,7 @@ workspace_protection_rule: workspace_id(char), name(char), rules(int), bypass_gr
FK: (workspace_id) -> workspace(id)
workspace_runnable_dependencies: flow_path(char), runnable_path(char), script_hash(bigint), runnable_is_flow(bool), workspace_id(char), app_path(char), id(bigint), runnable_is_agent(bool)
FK: (app_path, workspace_id) -> app(path, workspace_id) | (flow_path, workspace_id) -> flow(path, workspace_id)
-workspace_settings: workspace_id(char), slack_team_id(char), slack_name(char), slack_command_script(char), slack_email(char), customer_id(char), plan(char), webhook(text), ai_config(jsonb), large_file_storage(jsonb), git_sync(jsonb), default_app(char), default_scripts(jsonb), deploy_ui(jsonb), mute_critical_alerts(bool), color(char), operator_settings(jsonb), teams_command_script(text), teams_team_id(text), teams_team_name(text), git_app_installations(jsonb), ducklake(jsonb), slack_oauth_client_id(char), slack_oauth_client_secret(char), datatable(jsonb), teams_team_guid(text), auto_invite(jsonb), error_handler(jsonb), success_handler(jsonb), public_app_execution_limit_per_minute(int), dbt_warehouses(jsonb), guest_access_enabled(bool), guest_jwt_public_key(text), guest_jwt_jwks_url(text), ai_sessions_backup_generation(int), add_admins_and_developers_to_forks(bool), remote_deploy_target(jsonb), remote_deploy_target_changed_at(ts)
+workspace_settings: workspace_id(char), slack_team_id(char), slack_name(char), slack_command_script(char), slack_email(char), customer_id(char), plan(char), webhook(text), ai_config(jsonb), large_file_storage(jsonb), git_sync(jsonb), default_app(char), default_scripts(jsonb), deploy_ui(jsonb), mute_critical_alerts(bool), color(char), operator_settings(jsonb), teams_command_script(text), teams_team_id(text), teams_team_name(text), git_app_installations(jsonb), ducklake(jsonb), slack_oauth_client_id(char), slack_oauth_client_secret(char), datatable(jsonb), teams_team_guid(text), auto_invite(jsonb), error_handler(jsonb), success_handler(jsonb), public_app_execution_limit_per_minute(int), dbt_warehouses(jsonb), guest_access_enabled(bool), guest_jwt_public_key(text), guest_jwt_jwks_url(text), ai_sessions_backup_generation(int), add_admins_and_developers_to_forks(bool), remote_deploy_target(jsonb), remote_deploy_target_changed_at(ts), variable_expiration_handler(jsonb), variable_expiration_failed_at(ts)
FK: (workspace_id) -> workspace(id)
zombie_job_counter: job_id(uuid), counter(int)
FK: (job_id) -> v2_job(id)
diff --git a/backend/tests/ai_agent_linked.rs b/backend/tests/ai_agent_linked.rs
new file mode 100644
index 0000000000..8b7f328213
--- /dev/null
+++ b/backend/tests/ai_agent_linked.rs
@@ -0,0 +1,55 @@
+use serde_json::json;
+use sqlx::{Pool, Postgres};
+use std::time::Duration;
+use windmill_common::{flows::FlowValue, jobs::JobPayload};
+use windmill_test_utils::{
+ completed_job, in_test_worker, listen_for_completed_jobs, ApiServer, RunJob, StreamFind,
+};
+
+/// Only writes of an agent are checked for operators, so a linked step must refuse a path whose
+/// resource is no longer an agent rather than run the `tools` it now holds.
+#[sqlx::test(fixtures("base"))]
+#[serial_test::serial]
+async fn linked_agent_step_refuses_a_resource_of_another_type(
+ db: Pool,
+) -> anyhow::Result<()> {
+ sqlx::query(
+ "INSERT INTO resource (workspace_id, path, value, resource_type)
+ VALUES ('test-workspace', 'u/test-user/agent', $1, 'object')",
+ )
+ .bind(
+ json!({"tools": [{"id": "t", "value": {"tool_type": "flowmodule",
+ "type": "rawscript", "language": "bun", "input_transforms": {},
+ "content": "export async function main() { return 1 }"}}]}),
+ )
+ .execute(&db)
+ .await?;
+
+ let server = ApiServer::start(db.clone()).await?;
+ let flow: FlowValue = serde_json::from_value(json!({"modules": [{"id": "agent", "value": {
+ "type": "aiagent", "tools": [], "agent": "$res:u/test-user/agent",
+ "input_transforms": {"user_message": {"type": "static", "value": "hi"}}
+ }}]}))?;
+ let id = RunJob::from(JobPayload::RawFlow {
+ value: flow,
+ path: Some("u/test-user/linked".into()),
+ restarted_from: None,
+ })
+ .push(&db)
+ .await;
+ let notifications = listen_for_completed_jobs(&db).await;
+ tokio::time::timeout(
+ Duration::from_secs(45),
+ in_test_worker(&db, notifications.find(&id), server.addr.port()),
+ )
+ .await?;
+ let job = completed_job(id, &db).await;
+ server.close().await?;
+ assert!(!job.success);
+ assert!(
+ format!("{:?}", job.result).contains("not an AI agent"),
+ "{:?}",
+ job.result
+ );
+ Ok(())
+}
diff --git a/backend/tests/app_access_mode_only.rs b/backend/tests/app_access_mode_only.rs
new file mode 100644
index 0000000000..b113e9de9a
--- /dev/null
+++ b/backend/tests/app_access_mode_only.rs
@@ -0,0 +1,311 @@
+//! `EditApp.execution_mode`: changing who may open an app without sending its policy.
+//!
+//! The change is applied to the deployed policy under the row lock a deploy takes, so it keeps
+//! every other field a concurrent deploy wrote. It is held to the rules a policy write is held
+//! to, and it is refused to a caller who could not keep the app's run-as user, since a policy
+//! write from them would rebind it.
+//!
+//! One test: the protection rules and the workspace roles are cached per workspace id across
+//! the process, and every test here uses `test-workspace`.
+//!
+//! Users from the `base` fixture:
+//! test-user (admin, token SECRET_TOKEN)
+//! test-user-2 (non-admin, token SECRET_TOKEN_2)
+//! test-user-3 (made a compose-only operator below, token SECRET_TOKEN_3)
+
+use reqwest::multipart;
+use serde_json::{json, Value};
+use sqlx::{Pool, Postgres};
+use windmill_common::workspaces::invalidate_protection_rules_cache;
+use windmill_test_utils::*;
+
+const ADMIN: &str = "SECRET_TOKEN";
+const USER: &str = "SECRET_TOKEN_2";
+const BUILDER: &str = "SECRET_TOKEN_3";
+
+fn client() -> reqwest::Client {
+ reqwest::Client::new()
+}
+
+async fn update(ws: &str, path: &str, token: &str, body: Value) -> anyhow::Result<(u16, String)> {
+ let resp = client()
+ .post(format!("{ws}/apps/update/{path}"))
+ .bearer_auth(token)
+ .json(&body)
+ .send()
+ .await?;
+ Ok((resp.status().as_u16(), resp.text().await?))
+}
+
+async fn create(ws: &str, token: &str, path: &str, policy: Value) -> anyhow::Result<()> {
+ let resp = client()
+ .post(format!("{ws}/apps/create"))
+ .bearer_auth(token)
+ .json(&json!({ "path": path, "summary": "", "value": {}, "policy": policy }))
+ .send()
+ .await?;
+ assert_eq!(resp.status(), 201, "create {path}: {}", resp.text().await?);
+ Ok(())
+}
+
+/// An anonymous, sandboxed raw app with no runnables, as a builder may deploy one.
+async fn create_raw(ws: &str, token: &str, path: &str) -> anyhow::Result<()> {
+ let app = json!({
+ "path": path,
+ "summary": "",
+ "value": { "files": {}, "runnables": {} },
+ "policy": { "execution_mode": "anonymous", "sandbox": true, "triggerables_v2": {} },
+ });
+ let form = multipart::Form::new()
+ .part(
+ "app",
+ multipart::Part::text(app.to_string()).mime_str("application/json")?,
+ )
+ .part("js", multipart::Part::text("console.log('app')"));
+ let resp = client()
+ .post(format!("{ws}/apps/create_raw"))
+ .bearer_auth(token)
+ .multipart(form)
+ .send()
+ .await?;
+ assert_eq!(
+ resp.status(),
+ 201,
+ "create_raw {path}: {}",
+ resp.text().await?
+ );
+ Ok(())
+}
+
+async fn policy(db: &Pool, path: &str) -> anyhow::Result {
+ Ok(sqlx::query_scalar(
+ "SELECT policy FROM app WHERE path = $1 AND workspace_id = 'test-workspace'",
+ )
+ .bind(path)
+ .fetch_one(db)
+ .await?)
+}
+
+fn triggerable(key: &str) -> Value {
+ json!({ key: { "static_inputs": {}, "one_of_inputs": {} } })
+}
+
+#[sqlx::test(fixtures("base"))]
+async fn test_access_mode_only_update(db: Pool) -> anyhow::Result<()> {
+ initialize_tracing().await;
+ invalidate_protection_rules_cache("test-workspace");
+ let server = ApiServer::start(db.clone()).await?;
+ let ws = format!(
+ "http://localhost:{}/api/w/test-workspace",
+ server.addr.port()
+ );
+
+ // ========================================
+ // 1. The mode alone changes; every other field of the deployed policy stays.
+ // ========================================
+ const SHARED: &str = "u/test-user-2/shared";
+ create(
+ &ws,
+ ADMIN,
+ SHARED,
+ json!({
+ "execution_mode": "publisher",
+ "triggerables_v2": triggerable("c:script/u/test-user/noop"),
+ "sandbox": true,
+ "allowed_s3_keys": [{ "s3_path": "a/b.txt" }],
+ }),
+ )
+ .await?;
+ let before = policy(&db, SHARED).await?;
+ assert_eq!(before["on_behalf_of"], "u/test-user");
+
+ let (status, body) =
+ update(&ws, SHARED, ADMIN, json!({ "execution_mode": "anonymous" })).await?;
+ assert_eq!(status, 200, "{body}");
+ let mut after = policy(&db, SHARED).await?;
+ assert_eq!(after["execution_mode"], "anonymous");
+ after["execution_mode"] = before["execution_mode"].clone();
+ assert_eq!(
+ after, before,
+ "a mode-only change must keep every other policy field"
+ );
+
+ // Sending a policy too is ambiguous about which mode wins.
+ let (status, _) = update(
+ &ws,
+ SHARED,
+ ADMIN,
+ json!({ "execution_mode": "publisher", "policy": { "execution_mode": "anonymous" } }),
+ )
+ .await?;
+ assert_eq!(status, 400);
+
+ // ========================================
+ // 2. Someone who cannot keep the run-as user cannot change the mode of an app that runs
+ // as someone else, even with write access to it.
+ // ========================================
+ let (status, body) =
+ update(&ws, SHARED, USER, json!({ "execution_mode": "publisher" })).await?;
+ assert_eq!(status, 403, "{body}");
+ assert!(body.contains("wm_deployers"), "{body}");
+ assert_eq!(policy(&db, SHARED).await?["execution_mode"], "anonymous");
+
+ // ========================================
+ // 3. A policy without a mode keeps the deployed one.
+ // ========================================
+ const OWN: &str = "u/test-user-2/own";
+ create(&ws, USER, OWN, json!({ "execution_mode": "publisher" })).await?;
+ sqlx::query(
+ "INSERT INTO draft (workspace_id, path, typ, value, email)
+ VALUES ('test-workspace', $1, 'app', '{}', 'test2@windmill.dev')",
+ )
+ .bind(OWN)
+ .execute(&db)
+ .await?;
+ let (status, body) = update(&ws, OWN, USER, json!({ "execution_mode": "anonymous" })).await?;
+ assert_eq!(status, 200, "{body}");
+ let drafts: i64 = sqlx::query_scalar(
+ "SELECT count(*) FROM draft WHERE workspace_id = 'test-workspace' AND path = $1",
+ )
+ .bind(OWN)
+ .fetch_one(&db)
+ .await?;
+ assert_eq!(drafts, 1, "a mode-only change must keep the caller's draft");
+ let (status, body) = update(
+ &ws,
+ OWN,
+ USER,
+ json!({ "value": { "v": 2 }, "policy": { "triggerables_v2": triggerable("c:script/f/x/new") } }),
+ )
+ .await?;
+ assert_eq!(status, 200, "{body}");
+ let p = policy(&db, OWN).await?;
+ assert_eq!(p["execution_mode"], "anonymous");
+ assert!(
+ p["triggerables_v2"].get("c:script/f/x/new").is_some(),
+ "{p}"
+ );
+
+ // ========================================
+ // 4. A compose-only operator: an omitted mode inherits the deployed one unless it is Viewer.
+ // ========================================
+ sqlx::query("UPDATE usr SET operator = true WHERE workspace_id = 'test-workspace' AND username = 'test-user-3'")
+ .execute(&db)
+ .await?;
+ sqlx::query(
+ r#"UPDATE workspace_settings SET role_overrides = '{"operator": {"capabilities": {"apps": "compose"}}}'
+ WHERE workspace_id = 'test-workspace'"#,
+ )
+ .execute(&db)
+ .await?;
+ // In wm_deployers, so the refusal in the last step below holds for a builder who may keep
+ // another user's identity on deploy.
+ sqlx::query(
+ "INSERT INTO group_ (workspace_id, name, summary, extra_perms) VALUES ('test-workspace', 'wm_deployers', '', '{}')",
+ )
+ .execute(&db)
+ .await?;
+ sqlx::query(
+ "INSERT INTO usr_to_group (workspace_id, group_, usr) VALUES ('test-workspace', 'wm_deployers', 'test-user-3')",
+ )
+ .execute(&db)
+ .await?;
+ windmill_common::roles::invalidate_workspace_roles_cache("test-workspace");
+ windmill_common::roles::invalidate_member_role_cache("test-workspace", "test-user-3");
+
+ const BUILT: &str = "u/test-user-3/built";
+ create_raw(&ws, BUILDER, BUILT).await?;
+
+ let settings_only = json!({ "policy": { "sandbox": true, "triggerables_v2": {} } });
+ let (status, body) = update(&ws, BUILT, BUILDER, settings_only.clone()).await?;
+ assert_eq!(status, 200, "{body}");
+ assert_eq!(
+ policy(&db, BUILT).await?["execution_mode"],
+ "anonymous",
+ "a builder's policy without a mode must keep a non-Viewer deployed mode"
+ );
+
+ // Viewer stays refused to a builder, alone as in a policy.
+ let (status, body) = update(&ws, BUILT, BUILDER, json!({ "execution_mode": "viewer" })).await?;
+ assert_eq!(status, 403, "{body}");
+
+ // An admin may put the builder's app in Viewer; the builder's next policy without a mode
+ // then cannot inherit it.
+ let (status, body) = update(&ws, BUILT, ADMIN, json!({ "execution_mode": "viewer" })).await?;
+ assert_eq!(status, 200, "{body}");
+ let (status, body) = update(&ws, BUILT, BUILDER, settings_only).await?;
+ assert_eq!(status, 200, "{body}");
+ assert_eq!(policy(&db, BUILT).await?["execution_mode"], "publisher");
+
+ let (status, body) = update(
+ &ws,
+ BUILT,
+ BUILDER,
+ json!({ "execution_mode": "anonymous" }),
+ )
+ .await?;
+ assert_eq!(
+ status, 200,
+ "a builder may change the mode of its own app: {body}"
+ );
+ assert_eq!(policy(&db, BUILT).await?["execution_mode"], "anonymous");
+
+ // A builder's deploy would sandbox an app whose policy leaves it unset, which a mode-only
+ // change must not do.
+ sqlx::query(
+ "UPDATE app SET policy = policy - 'sandbox' WHERE path = $1 AND workspace_id = 'test-workspace'",
+ )
+ .bind(BUILT)
+ .execute(&db)
+ .await?;
+ let (status, body) = update(
+ &ws,
+ BUILT,
+ BUILDER,
+ json!({ "execution_mode": "publisher" }),
+ )
+ .await?;
+ assert_eq!(status, 403, "{body}");
+ let p = policy(&db, BUILT).await?;
+ assert!(p.get("sandbox").is_none(), "{p}");
+ assert_eq!(p["execution_mode"], "anonymous");
+
+ // Changing the mode alone skips the check of the triggerables against the builder's RLS, so
+ // it stays refused on an app that runs as someone else; deploying it is the way.
+ const ADMIN_RUN: &str = "u/test-user-3/admin_run";
+ create_raw(&ws, ADMIN, ADMIN_RUN).await?;
+ let (status, body) = update(
+ &ws,
+ ADMIN_RUN,
+ BUILDER,
+ json!({ "execution_mode": "publisher" }),
+ )
+ .await?;
+ assert_eq!(status, 403, "{body}");
+ assert!(body.contains("by deploying it"), "{body}");
+
+ // ========================================
+ // 5. Widening is gated by the protection rule; narrowing is not.
+ // ========================================
+ let resp = client()
+ .post(format!("{ws}/workspaces/protection_rules"))
+ .bearer_auth(ADMIN)
+ .json(&json!({
+ "name": "no-public-apps",
+ "rules": ["RestrictAnonymousAppDeployment"],
+ "bypass_users": [],
+ "bypass_groups": []
+ }))
+ .send()
+ .await?;
+ assert_eq!(resp.status(), 200, "{}", resp.text().await?);
+
+ let (status, body) = update(&ws, OWN, USER, json!({ "execution_mode": "publisher" })).await?;
+ assert_eq!(status, 200, "narrowing stays open: {body}");
+ let (status, body) = update(&ws, OWN, USER, json!({ "execution_mode": "anonymous" })).await?;
+ assert_eq!(status, 403, "{body}");
+ assert!(body.contains("no-public-apps"), "{body}");
+ assert_eq!(policy(&db, OWN).await?["execution_mode"], "publisher");
+
+ Ok(())
+}
diff --git a/backend/tests/app_preview_auth.rs b/backend/tests/app_preview_auth.rs
index f8e90ce144..9f6e77f61c 100644
--- a/backend/tests/app_preview_auth.rs
+++ b/backend/tests/app_preview_auth.rs
@@ -75,12 +75,12 @@ async fn test_app_preview_authorization(db: Pool) -> anyhow::Result<()
let status = resp.status();
let body = resp.text().await?;
assert_eq!(
- status, 401,
+ status, 403,
"Operator must be rejected from app preview (got {status}): {body}"
);
assert!(
- body.contains("Operators cannot run preview jobs"),
- "rejection must be the operator guard, got: {body}"
+ body.contains("Your role cannot run preview jobs"),
+ "rejection must be the role guard, got: {body}"
);
// 2. The fix must NOT over-block the legitimate editor flow: a regular
diff --git a/backend/tests/app_run_mode_lock_strip.rs b/backend/tests/app_run_mode_lock_strip.rs
index 7a1bba75f6..77265f2bcd 100644
--- a/backend/tests/app_run_mode_lock_strip.rs
+++ b/backend/tests/app_run_mode_lock_strip.rs
@@ -110,10 +110,13 @@ async fn test_run_mode_strips_caller_lock_and_modules(db: Pool) -> any
.json(&json!({
// The args map is the other injection channel: an inline run is a
// `JobKind::Preview` job, so the worker/executors read `_MODULES` and
- // `_TEMP_SCRIPT_REFS` back out of the job args. Both must be stripped.
+ // `_TEMP_SCRIPT_REFS` back out of the job args. Both must be stripped —
+ // including the NUL spellings, which `push` stores under the plain name.
"args": {
"_MODULES": { "m.py": { "content": "print('evil')\n", "language": "python3" } },
- "_TEMP_SCRIPT_REFS": { "../evil": "deadbeef" }
+ "_MODULES\u{0}": { "m.py": { "content": "print('evil')\n", "language": "python3" } },
+ "_TEMP_SCRIPT_REFS": { "../evil": "deadbeef" },
+ "_TEMP_SCRIPT_REFS\u{0}": { "../evil": "deadbeef" }
},
"component": "comp",
"raw_code": inline_raw_code(Some(CALLER_HASH), true)
diff --git a/backend/tests/audit_rls.rs b/backend/tests/audit_rls.rs
new file mode 100644
index 0000000000..2aca3051ab
--- /dev/null
+++ b/backend/tests/audit_rls.rs
@@ -0,0 +1,37 @@
+//! A non-admin's transaction must accept an audit row recorded under another username, as a
+//! job pushed to run as someone else writes one. A rejected insert aborts the transaction and
+//! takes the caller's own write down with it.
+
+use sqlx::{Pool, Postgres};
+
+use windmill_test_utils::ensure_today_audit_partition;
+
+#[sqlx::test]
+async fn non_admin_writes_an_audit_row_for_another_user(db: Pool) -> anyhow::Result<()> {
+ ensure_today_audit_partition(&db).await;
+
+ let mut tx = db.begin().await?;
+ sqlx::query("SET LOCAL ROLE windmill_user")
+ .execute(&mut *tx)
+ .await?;
+ sqlx::query("SELECT set_config('session.user', 'bob', true)")
+ .execute(&mut *tx)
+ .await?;
+ // The shape a schedule run as alice records without an Enterprise license: parameters
+ // redacted, so no `end_user` names the schedule.
+ sqlx::query(
+ "INSERT INTO audit_partitioned
+ (workspace_id, username, operation, action_kind, resource, parameters, email)
+ VALUES ('admins', 'alice', 'redacted', 'execute', 'EE only', '{\"redacted\": \"-\"}', 'alice@windmill.dev')",
+ )
+ .execute(&mut *tx)
+ .await?;
+ tx.commit().await?;
+
+ let count: i64 =
+ sqlx::query_scalar("SELECT count(*) FROM audit_partitioned WHERE username = 'alice'")
+ .fetch_one(&db)
+ .await?;
+ assert_eq!(count, 1);
+ Ok(())
+}
diff --git a/backend/tests/caller_modules_strip.rs b/backend/tests/caller_modules_strip.rs
index a65ca22d1b..bf4a096ee1 100644
--- a/backend/tests/caller_modules_strip.rs
+++ b/backend/tests/caller_modules_strip.rs
@@ -20,10 +20,16 @@ fn modules(v: &str) -> serde_json::Value {
/// Pushes `payload` with a caller `_MODULES` both in `args` and in `extra` (where webhook
/// query and headers land), and returns the stored `_MODULES`.
+///
+/// Every spelling `push` stores as `_MODULES` is sent, not just the exact name: it writes
+/// the args with their `\u0000` escapes removed, keys included, so `_MODULES\0` lands in
+/// the job as `_MODULES` unless the removal compares the name that will be stored.
async fn stored_modules(db: &Pool, payload: JobPayload) -> Option {
let caller: Box = serde_json::value::to_raw_value(&modules("caller")).unwrap();
- let args = HashMap::from([("_MODULES".to_string(), caller.clone())]);
- let extra = HashMap::from([("_MODULES".to_string(), caller)]);
+ let spellings =
+ || ["_MODULES", "_MODULES\0", "_MOD\0ULES"].map(|k| (k.to_string(), caller.clone()));
+ let args = HashMap::from(spellings());
+ let extra = HashMap::from(spellings());
let (id, tx) = windmill_queue::push(
db,
PushIsolationLevel::IsolatedRoot(db.clone()),
diff --git a/backend/tests/dedicated_workers.rs b/backend/tests/dedicated_workers.rs
index d0ba3e5e63..fc4ff77bb3 100644
--- a/backend/tests/dedicated_workers.rs
+++ b/backend/tests/dedicated_workers.rs
@@ -843,7 +843,8 @@ mod dedicated_worker_tests {
let job_a = completed_job(uuid_a, &db).await;
let job_b = completed_job(uuid_b, &db).await;
- assert_eq!(job_a.json_result().unwrap(), json!(105));
+ // helper(5) = 50, + 100
+ assert_eq!(job_a.json_result().unwrap(), json!(150));
assert_eq!(job_b.json_result().unwrap(), json!(205));
assert_ran_on_dedicated_worker(&db, uuid_a, "python3").await;
assert_ran_on_dedicated_worker(&db, uuid_b, "python3").await;
diff --git a/backend/tests/dependency_map.rs b/backend/tests/dependency_map.rs
index dad6c86aa3..e68828fe24 100644
--- a/backend/tests/dependency_map.rs
+++ b/backend/tests/dependency_map.rs
@@ -511,6 +511,7 @@ def main():
)
.unwrap(),
policy: None,
+ execution_mode: None,
deployment_message: None,
custom_path: None,
preserve_on_behalf_of: None,
diff --git a/backend/tests/fixtures/dedicated_flows.sql b/backend/tests/fixtures/dedicated_flows.sql
index b3b63685df..e81cd32556 100644
--- a/backend/tests/fixtures/dedicated_flows.sql
+++ b/backend/tests/fixtures/dedicated_flows.sql
@@ -321,12 +321,13 @@ E'{"modules":[{"id":"a","value":{"type":"forloopflow","iterator":{"type":"javasc
-- ============================================================
-- Test: Python runner group
--- Two Python scripts sharing a workspace dependency annotation.
+-- Two Python scripts sharing a workspace dependency annotation. Script a has a
+-- relative import (helper defined below), so the group's loader.py is written.
-- ============================================================
INSERT INTO public.script(workspace_id, created_by, content, schema, summary, description, path, hash, language, lock, dedicated_worker) VALUES (
'test-workspace',
'system',
-E'# extra_requirements: f/system/dedicated_double\ndef main(x: int):\n return x + 100',
+E'# extra_requirements: f/system/dedicated_double\nfrom .py_dedicated_helper import helper\n\ndef main(x: int):\n return helper(x) + 100',
'{"$schema":"https://json-schema.org/draft/2020-12/schema","properties":{"x":{"type":"number","description":""}},"required":["x"],"type":"object"}',
'', '',
'f/system/py_rg_script_a', 300050, 'python3', '', true);
diff --git a/backend/tests/git_sync_autopull_identity.rs b/backend/tests/git_sync_autopull_identity.rs
index 4e7562c3f3..bc76e4c1cb 100644
--- a/backend/tests/git_sync_autopull_identity.rs
+++ b/backend/tests/git_sync_autopull_identity.rs
@@ -192,3 +192,25 @@ async fn unstamped_fork_pull_runs_as_the_parents_first_admin(
assert_eq!(pull_identities(&db, FORK).await?, vec![identity("aaron")]);
Ok(())
}
+
+/// A workspace with no admin and no stamp runs its pulls as an instance superadmin, skipping
+/// sam, whose instance username a member holds, and the deactivated seeded superadmin.
+#[sqlx::test(fixtures("git_sync_autopull_identity"))]
+async fn unstamped_pull_without_admins_runs_as_a_superadmin(
+ db: Pool,
+) -> anyhow::Result<()> {
+ sqlx::query("UPDATE usr SET is_admin = false WHERE workspace_id = $1")
+ .bind(PARENT)
+ .execute(&db)
+ .await?;
+ sqlx::query("UPDATE password SET disabled = true WHERE email = 'admin@windmill.dev'")
+ .execute(&db)
+ .await?;
+ let mut repo = repo_enabled_by("alice@windmill.dev");
+ repo.auto_pull.as_mut().unwrap().enabled_by = None;
+
+ let job = reconcile_and_enqueue_pull(&db, PARENT, &repo, "main", "abc123", None).await?;
+ assert!(job.is_some(), "{}", recorded_pull_error(&db, PARENT).await?);
+ assert_eq!(pull_identities(&db, PARENT).await?, vec![identity("sue")]);
+ Ok(())
+}
diff --git a/backend/tests/inline_preview_auth.rs b/backend/tests/inline_preview_auth.rs
index acf511c26c..231e71e92a 100644
--- a/backend/tests/inline_preview_auth.rs
+++ b/backend/tests/inline_preview_auth.rs
@@ -91,7 +91,7 @@ async fn operator_job_token(job_id: uuid::Uuid) -> String {
.expect("mint operator job token")
}
-const OPERATOR_GUARD_MSG: &str = "Operators cannot run preview jobs";
+const OPERATOR_GUARD_MSG: &str = "Your role cannot run preview jobs";
/// The fixture's deployed-script jobs of the operator: one running, one queued.
const RUNNING_JOB_ID: &str = "2aa0c0de-0000-4000-8000-000000000001";
diff --git a/backend/tests/pool_hold_and_wait.rs b/backend/tests/pool_hold_and_wait.rs
new file mode 100644
index 0000000000..44af05ab39
--- /dev/null
+++ b/backend/tests/pool_hold_and_wait.rs
@@ -0,0 +1,200 @@
+//! Paths that hold a pool connection (an open transaction or an acquired connection) must not
+//! wait for a second one from the same pool: a burst the size of the pool would have every
+//! holder wait for another until the acquire timeout. On a one-connection pool any such second
+//! checkout hangs.
+
+use std::time::Duration;
+
+use serde_json::json;
+use sqlx::{postgres::PgPoolOptions, Pool, Postgres};
+use windmill_common::{
+ db::{AuthedRef, UserDB, UserDbWithAuthed},
+ error::Error,
+ jobs::JobPayload,
+ worker::Connection,
+};
+use windmill_test_utils::*;
+
+async fn one_connection_pool(db: &Pool) -> Pool {
+ PgPoolOptions::new()
+ .max_connections(1)
+ .acquire_timeout(Duration::from_secs(5))
+ .connect_with((*db.connect_options()).clone())
+ .await
+ .unwrap()
+}
+
+#[sqlx::test(fixtures("base"))]
+async fn run_by_path_of_a_missing_script_uses_one_connection(db: Pool) {
+ let one = one_connection_pool(&db).await;
+ let groups = vec![];
+ let folders = vec![];
+ let authed = AuthedRef {
+ email: "test2@windmill.dev",
+ username: "test-user-2",
+ is_admin: &false,
+ is_operator: &false,
+ groups: &groups,
+ folders: &folders,
+ scopes: &None,
+ token_prefix: &None,
+ };
+ let lookup = windmill_common::get_latest_deployed_hash_for_path(
+ Some(UserDbWithAuthed { authed: &authed, db: UserDB::new(one.clone()) }),
+ one.clone(),
+ "test-workspace",
+ "f/missing/script",
+ );
+ let res = tokio::time::timeout(Duration::from_secs(15), lookup)
+ .await
+ .unwrap();
+ assert!(matches!(res, Err(Error::NotFound(_))), "{:?}", res.err());
+}
+
+#[sqlx::test(fixtures("base"))]
+async fn for_loop_flow_runs_on_one_connection(db: Pool) -> anyhow::Result<()> {
+ initialize_tracing().await;
+ let server = ApiServer::start(db.clone()).await?;
+ let flow = serde_json::from_value(json!({
+ "modules": [{
+ "id": "loop",
+ "value": {
+ "type": "forloopflow",
+ "iterator": { "type": "static", "value": [1, 2] },
+ "skip_failures": false,
+ "parallel": false,
+ "modules": [{ "id": "inner", "value": { "type": "identity" } }]
+ }
+ }]
+ }))?;
+ let job = RunJob::from(JobPayload::RawFlow { value: flow, path: None, restarted_from: None })
+ .push(&db)
+ .await;
+
+ let one = one_connection_pool(&db).await;
+ let db2 = db.clone();
+ in_test_worker(
+ Connection::Sql(one),
+ async move {
+ while sqlx::query_scalar::<_, bool>(
+ "SELECT EXISTS (SELECT 1 FROM v2_job_completed WHERE id = $1)",
+ )
+ .bind(job)
+ .fetch_one(&db2)
+ .await
+ .unwrap()
+ == false
+ {
+ tokio::time::sleep(Duration::from_millis(100)).await;
+ }
+ },
+ server.addr.port(),
+ )
+ .await;
+
+ let status: String =
+ sqlx::query_scalar("SELECT status::text FROM v2_job_completed WHERE id = $1")
+ .bind(job)
+ .fetch_one(&db)
+ .await?;
+ assert_eq!(status, "success");
+ Ok(())
+}
+
+#[cfg(all(feature = "enterprise", feature = "private"))]
+#[sqlx::test(fixtures("base", "schedule"))]
+async fn schedule_handlers_run_on_one_connection(db: Pool) -> anyhow::Result<()> {
+ use windmill_queue::{add_completed_job, get_mini_completed_job};
+
+ const SCHEDULE: &str = "f/system/handled_schedule";
+ const HANDLER: &str = "script/f/system/schedule_recovery_handler";
+ sqlx::query(
+ "INSERT INTO schedule (workspace_id, path, edited_by, schedule, enabled, script_path, args,
+ is_flow, email, timezone, permissioned_as, on_success, on_recovery)
+ VALUES ('test-workspace', $1, 'test-user', '0 0 0 1 1 *', true, 'f/system/failing_script',
+ '{}', false, 'test@windmill.dev', 'UTC', 'u/test-user', $2, $2)",
+ )
+ .bind(SCHEDULE)
+ .bind(HANDLER)
+ .execute(&db)
+ .await?;
+
+ // The previous occurrence failed, so this successful one is a recovery. The handlers run
+ // once the completion has committed, when the next tick may already have completed: a
+ // later occurrence must not count as history, or its success would hide the recovery.
+ let insert_job =
+ "INSERT INTO v2_job (id, workspace_id, created_by, created_at, permissioned_as,
+ permissioned_as_email, kind, runnable_id, runnable_path, script_lang, tag,
+ visible_to_owner, trigger, trigger_kind)
+ VALUES ($1, 'test-workspace', 'test-user', now() - $2 * interval '1 minute', 'u/test-user',
+ 'test@windmill.dev', 'script', 12349, 'f/system/failing_script', 'bun', 'bun', true,
+ $3, 'schedule')";
+ for (minutes_ago, status) in [(1.0, "failure"), (-1.0, "success")] {
+ let id = uuid::Uuid::new_v4();
+ sqlx::query(insert_job)
+ .bind(id)
+ .bind(minutes_ago)
+ .bind(SCHEDULE)
+ .execute(&db)
+ .await?;
+ sqlx::query(
+ "INSERT INTO v2_job_completed (id, workspace_id, duration_ms, result, started_at,
+ completed_at, status)
+ VALUES ($1, 'test-workspace', 1, '{}', now(), now(), $2::job_status)",
+ )
+ .bind(id)
+ .bind(status)
+ .execute(&db)
+ .await?;
+ }
+
+ let running = uuid::Uuid::new_v4();
+ sqlx::query(insert_job)
+ .bind(running)
+ .bind(0.0)
+ .bind(SCHEDULE)
+ .execute(&db)
+ .await?;
+ sqlx::query(
+ "INSERT INTO v2_job_queue (id, workspace_id, scheduled_for, running, started_at, tag)
+ VALUES ($1, 'test-workspace', now(), true, now(), 'bun')",
+ )
+ .bind(running)
+ .execute(&db)
+ .await?;
+ sqlx::query("INSERT INTO v2_job_runtime (id, ping) VALUES ($1, now())")
+ .bind(running)
+ .execute(&db)
+ .await?;
+
+ let one = one_connection_pool(&db).await;
+ let job = get_mini_completed_job(&running, "test-workspace", &db)
+ .await?
+ .unwrap();
+ let result = json!("OK");
+ let complete = add_completed_job(
+ &one,
+ &job,
+ true,
+ false,
+ sqlx::types::Json(&result),
+ None,
+ 0,
+ None,
+ false,
+ None,
+ false,
+ );
+ tokio::time::timeout(Duration::from_secs(30), complete).await??;
+
+ // One on_success job and one on_recovery job.
+ let handlers: i64 = sqlx::query_scalar(
+ "SELECT count(*) FROM v2_job WHERE runnable_path = 'f/system/schedule_recovery_handler'
+ AND parent_job = $1",
+ )
+ .bind(running)
+ .fetch_one(&db)
+ .await?;
+ assert_eq!(handlers, 2);
+ Ok(())
+}
diff --git a/backend/tests/push_pool_connections.rs b/backend/tests/push_pool_connections.rs
new file mode 100644
index 0000000000..006340cf8a
--- /dev/null
+++ b/backend/tests/push_pool_connections.rs
@@ -0,0 +1,63 @@
+//! `push` must not need a second pool connection while it holds its transaction: a burst of
+//! pushes the size of the pool would each hold one and wait for another until the acquire
+//! timeout. On a one-connection pool any such second checkout hangs.
+
+use std::time::Duration;
+
+use sqlx::{postgres::PgPoolOptions, Pool, Postgres};
+use windmill_common::jobs::JobPayload;
+use windmill_test_utils::RunJob;
+
+#[sqlx::test(fixtures("base"))]
+async fn concurrency_limited_flow_pushes_on_one_connection(db: Pool) {
+ // The flow and settings caches outlive the test database (they are on disk), so only a
+ // version and a limit no run has used yet make `push` read the flow and write its settings.
+ let limit = (uuid::Uuid::new_v4().as_u128() % 1_000_000_000) as i32 + 1;
+ let version = limit as i64;
+ let value = format!(r#"{{"modules":[],"concurrent_limit":{limit}}}"#);
+ sqlx::query(
+ "WITH f AS (
+ INSERT INTO flow (workspace_id, path, summary, description, value, edited_by, schema, extra_perms, versions)
+ VALUES ('test-workspace', 'f/t/limited', '', '', $1::jsonb, 'test-user', '{}', '{}', ARRAY[$2])
+ )
+ INSERT INTO flow_version (id, workspace_id, path, value, schema, created_by)
+ VALUES ($2, 'test-workspace', 'f/t/limited', $1::jsonb, '{}', 'test-user')",
+ )
+ .bind(&value)
+ .bind(version)
+ .execute(&db)
+ .await
+ .unwrap();
+
+ let one = PgPoolOptions::new()
+ .max_connections(1)
+ .acquire_timeout(Duration::from_secs(5))
+ .connect_with((*db.connect_options()).clone())
+ .await
+ .unwrap();
+
+ let push = RunJob::from(JobPayload::Flow {
+ path: "f/t/limited".to_string(),
+ dedicated_worker: None,
+ apply_preprocessor: false,
+ version,
+ labels: None,
+ job_token_scopes: None,
+ })
+ .push(&one);
+ let job = tokio::time::timeout(Duration::from_secs(15), push)
+ .await
+ .unwrap();
+
+ let stored: Option = sqlx::query_scalar(
+ "SELECT cs.concurrent_limit FROM v2_job_queue q
+ JOIN runnable_settings rs ON rs.hash = q.runnable_settings_handle
+ JOIN concurrency_settings cs ON cs.hash = rs.concurrency_settings
+ WHERE q.id = $1",
+ )
+ .bind(job)
+ .fetch_one(&db)
+ .await
+ .unwrap();
+ assert_eq!(stored, Some(limit));
+}
diff --git a/backend/tests/reserved_control_args.rs b/backend/tests/reserved_control_args.rs
new file mode 100644
index 0000000000..a733546e51
--- /dev/null
+++ b/backend/tests/reserved_control_args.rs
@@ -0,0 +1,436 @@
+//! `_ENTRYPOINT_OVERRIDE`, `_MODULES` and `_TEMP_SCRIPT_REFS` steer *how* a runnable runs:
+//! which function the worker calls instead of `main`, what module files land in the job
+//! directory, where its workspace imports resolve from. They are legitimate for a caller
+//! running its own code under its own identity, and must not be settable by a third party
+//! whose payload runs under somebody else's: an HTTP route body or native trigger message
+//! (the job runs as the trigger's owner) and a public app viewer's inputs (as the
+//! publisher).
+//!
+//! `push` stores the args with their `\u0000` escapes removed, keys included, so every
+//! check also has to hold for a NUL-spelled key: `_ENTRYPOINT_OVERRIDE\0` is read back as
+//! `_ENTRYPOINT_OVERRIDE`. The same rename is what lets a viewer's `tenant\0` land as
+//! `tenant` over an app policy's pinned `tenant`.
+
+use std::collections::HashMap;
+
+use serde_json::{json, value::RawValue, Value};
+use sqlx::{Pool, Postgres};
+use windmill_common::{
+ jobs::JobPayload,
+ runnable_settings::{ConcurrencySettings, DebouncingSettings},
+ scripts::{ScriptHash, ScriptLang},
+ triggers::TriggerMetadata,
+};
+use windmill_queue::{PushArgs, PushArgsOwned, PushIsolationLevel};
+use windmill_test_utils::*;
+
+const SCRIPT_PATH: &str = "f/system/hello";
+const SCRIPT_HASH: i64 = 123412;
+/// Two top-level functions, as in the report: `main` authenticates, `apply` acts.
+const SCRIPT_CONTENT: &str = "export async function main(data: string) { return data }\n\
+ export async function apply(action: string) { return action }\n";
+
+fn client() -> reqwest::Client {
+ reqwest::Client::new()
+}
+
+fn authed(b: reqwest::RequestBuilder, token: &str) -> reqwest::RequestBuilder {
+ b.header("Authorization", format!("Bearer {}", token))
+}
+
+fn raw(v: Value) -> Box {
+ serde_json::value::to_raw_value(&v).unwrap()
+}
+
+fn modules() -> Value {
+ json!({ "bunfig.toml": { "content": "preload = [\"./x.ts\"]", "language": "bun" } })
+}
+
+/// Deploy `SCRIPT_PATH` (a non-null `lock` is what makes a script count as deployed).
+async fn deploy_script(db: &Pool) -> anyhow::Result<()> {
+ sqlx::query(
+ r#"INSERT INTO script (workspace_id, hash, path, content, language, kind, created_by,
+ schema, summary, description, lock)
+ VALUES ('test-workspace', $1, $2, $3, 'bun', 'script', 'test-user', '{}', '', '',
+ E'{}\n//bun.lock\n')"#,
+ )
+ .bind(SCRIPT_HASH)
+ .bind(SCRIPT_PATH)
+ .bind(SCRIPT_CONTENT)
+ .execute(db)
+ .await?;
+ Ok(())
+}
+
+async fn job_args_and_entrypoint(
+ db: &Pool,
+ id: uuid::Uuid,
+) -> anyhow::Result<(Value, Option)> {
+ Ok(
+ sqlx::query_as("SELECT args, script_entrypoint_override FROM v2_job WHERE id = $1")
+ .bind(id)
+ .fetch_one(db)
+ .await?,
+ )
+}
+
+fn trigger_authed() -> windmill_api_auth::ApiAuthed {
+ windmill_api_auth::ApiAuthed {
+ email: "test@windmill.dev".to_string(),
+ username: "test-user".to_string(),
+ is_admin: true,
+ is_operator: false,
+ groups: vec![],
+ folders: vec![],
+ scopes: None,
+ username_override: None,
+ username_override_is_token_label: false,
+ is_session_token: false,
+ token_prefix: None,
+ read_only: false,
+ job_id: None,
+ credential_expiry: None,
+ }
+}
+
+/// `trigger_runnable_inner` is the one funnel every trigger reaches `push` through, so it
+/// stands in here for the HTTP route whose body keys become the job's top-level args. The
+/// sender is anonymous on a `none`/`custom_script` route; the job runs as the route owner.
+#[sqlx::test(fixtures("base"))]
+async fn trigger_args_lose_every_reserved_control_key(db: Pool) -> anyhow::Result<()> {
+ initialize_tracing().await;
+ deploy_script(&db).await?;
+
+ let args = PushArgsOwned {
+ args: HashMap::from([
+ // Picks `apply` instead of `main`, skipping whatever `main` authenticates.
+ ("_ENTRYPOINT_OVERRIDE".to_string(), raw(json!("apply"))),
+ ("_ENTRYPOINT_OVERRIDE\u{0}".to_string(), raw(json!("apply"))),
+ ("_ENTRY\u{0}POINT_OVERRIDE".to_string(), raw(json!("apply"))),
+ ("_MODULES\u{0}".to_string(), raw(modules())),
+ (
+ "_TEMP_SCRIPT_REFS\u{0}".to_string(),
+ raw(json!({ "f/system/dep": "deadbeef" })),
+ ),
+ // An ordinary input must still get through, NUL-renamed or not.
+ ("data".to_string(), raw(json!("payload"))),
+ ("action\u{0}".to_string(), raw(json!("refund"))),
+ ]),
+ extra: None,
+ };
+
+ let (id, _, _, _, _) = windmill_trigger::trigger_helpers::trigger_runnable_inner(
+ &db,
+ None,
+ None,
+ trigger_authed(),
+ "test-workspace",
+ SCRIPT_PATH,
+ false,
+ args,
+ None,
+ None,
+ None,
+ "u/test-user/route".to_string(),
+ None,
+ TriggerMetadata::new(
+ Some("u/test-user/route".to_string()),
+ windmill_common::jobs::JobTriggerKind::Http,
+ ),
+ None,
+ )
+ .await?;
+
+ let (args, entrypoint) = job_args_and_entrypoint(&db, id).await?;
+ assert_eq!(
+ args,
+ json!({ "data": "payload", "action": "refund" }),
+ "a trigger payload may carry the runnable's inputs and nothing that steers how it runs"
+ );
+ assert_eq!(
+ entrypoint, None,
+ "a trigger payload must not pick the function the worker calls instead of `main`"
+ );
+ Ok(())
+}
+
+/// The counterpart: `_ENTRYPOINT_OVERRIDE` stays for a caller that runs the script under
+/// its own identity with `jobs:run` — the script editor's preprocessor test, dynamic-select
+/// helpers, the CLI and workflow-as-code all send it this way (GHSA-wxjq-w5pj-jqhx bounds
+/// what it may contain, not who may set it). Stripping it in `push` would break them.
+#[sqlx::test(fixtures("base"))]
+async fn an_authenticated_push_keeps_the_entrypoint_override(
+ db: Pool,
+) -> anyhow::Result<()> {
+ deploy_script(&db).await?;
+
+ // Both spellings: `push` normalizes the names to what it stores, so the NUL-spelled one
+ // selects the function exactly like the plain one instead of being silently different.
+ for key in ["_ENTRYPOINT_OVERRIDE", "_ENTRYPOINT_OVERRIDE\u{0}"] {
+ let args = HashMap::from([
+ (key.to_string(), raw(json!("apply"))),
+ ("action".to_string(), raw(json!("refund"))),
+ ]);
+ let (id, tx) = windmill_queue::push(
+ &db,
+ PushIsolationLevel::IsolatedRoot(db.clone()),
+ "test-workspace",
+ JobPayload::ScriptHash {
+ hash: ScriptHash(SCRIPT_HASH),
+ path: SCRIPT_PATH.to_string(),
+ cache_ttl: None,
+ cache_ignore_s3_path: None,
+ dedicated_worker: None,
+ language: ScriptLang::Bun,
+ priority: None,
+ apply_preprocessor: false,
+ concurrency_settings: ConcurrencySettings::default(),
+ debouncing_settings: DebouncingSettings::default(),
+ labels: None,
+ job_token_scopes: None,
+ },
+ PushArgs { args: &args, extra: None },
+ "test-user",
+ "test@windmill.dev",
+ "u/test-user".to_string(),
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ false,
+ false,
+ None,
+ true,
+ None,
+ None,
+ None,
+ None,
+ None,
+ false,
+ None,
+ None,
+ None,
+ None,
+ )
+ .await?;
+ tx.commit().await?;
+ let (args, entrypoint) = job_args_and_entrypoint(&db, id).await?;
+ assert_eq!(
+ entrypoint.as_deref(),
+ Some("apply"),
+ "an authenticated caller running a script as itself may still pick the entrypoint \
+ (sent as {key:?})"
+ );
+ assert_eq!(
+ args,
+ json!({ "_ENTRYPOINT_OVERRIDE": "apply", "action": "refund" }),
+ "the stored name is the normalized one (sent as {key:?})"
+ );
+ }
+ Ok(())
+}
+
+/// Create a public (anonymous) app whose single component is the deployed script, with the
+/// given policy inputs, and return its path.
+async fn create_public_app(
+ ws: &str,
+ path: &str,
+ static_inputs: Value,
+ one_of_inputs: Value,
+) -> anyhow::Result<()> {
+ let resp = authed(client().post(format!("{ws}/apps/create")), "SECRET_TOKEN")
+ .json(&json!({
+ "path": path,
+ "summary": "",
+ "value": {},
+ "policy": {
+ "execution_mode": "anonymous",
+ "triggerables_v2": {
+ format!("comp:script/{SCRIPT_PATH}"): {
+ "static_inputs": static_inputs,
+ "one_of_inputs": one_of_inputs,
+ }
+ }
+ }
+ }))
+ .send()
+ .await?;
+ assert_eq!(resp.status(), 201, "create app: {}", resp.text().await?);
+ Ok(())
+}
+
+/// A viewer of a public app runs the publisher's pinned script as the publisher: it may
+/// fill in the inputs the policy leaves free and nothing else.
+#[sqlx::test(fixtures("base"))]
+async fn public_app_viewer_cannot_steer_the_pinned_runnable(
+ db: Pool,
+) -> anyhow::Result<()> {
+ initialize_tracing().await;
+ let server = ApiServer::start(db.clone()).await?;
+ let ws = format!(
+ "http://localhost:{}/api/w/test-workspace",
+ server.addr.port()
+ );
+ deploy_script(&db).await?;
+
+ let app_path = "u/test-user/reserved_args";
+ create_public_app(
+ &ws,
+ app_path,
+ json!({ "tenant": "acme" }),
+ json!({ "greeting": ["Hello,", "Bonjour,"] }),
+ )
+ .await?;
+
+ // No `Authorization` header at all: the anonymous visitor of a public app.
+ let run = |args: &'static str| {
+ client()
+ .post(format!("{ws}/apps_u/execute_component/{app_path}"))
+ .header("content-type", "application/json")
+ .body(format!(
+ r#"{{"component": "comp", "path": "script/{SCRIPT_PATH}", "args": {args}}}"#
+ ))
+ .send()
+ };
+
+ // A name spelled with a NUL is the same name once stored, so the policy's pinned value
+ // must still win and the one-of list must still be enforced.
+ let resp = run(r#"{"tenant\u0000": "globex", "greeting": "Hello,"}"#).await?;
+ let status = resp.status();
+ let body = resp.text().await?;
+ assert_eq!(status, 200, "run must be accepted: {body}");
+ let (args, _) = job_args_and_entrypoint(&db, uuid::Uuid::parse_str(body.trim())?).await?;
+ assert_eq!(
+ args["tenant"],
+ json!("acme"),
+ "a NUL-renamed arg must not override an input the policy pins: {args}"
+ );
+
+ let resp = run(r#"{"greeting\u0000": "anything"}"#).await?;
+ let status = resp.status();
+ let body = resp.text().await?;
+ assert_eq!(
+ status, 400,
+ "a NUL-renamed arg must still be held to the policy's one_of list: {body}"
+ );
+ assert!(
+ body.contains("must be one of"),
+ "expected the one_of rejection, got: {body}"
+ );
+
+ // The control keys, in both spellings, in one request.
+ let resp = run(
+ r#"{"_ENTRYPOINT_OVERRIDE": "apply", "_ENTRYPOINT_OVERRIDE\u0000": "apply",
+ "_MODULES": {"bunfig.toml": {"content": "x", "language": "bun"}},
+ "_MODULES\u0000": {"bunfig.toml": {"content": "x", "language": "bun"}},
+ "_TEMP_SCRIPT_REFS": {"f/system/dep": "deadbeef"},
+ "_TEMP_SCRIPT_REFS\u0000": {"f/system/dep": "deadbeef"},
+ "greeting": "Hello,"}"#,
+ )
+ .await?;
+ let status = resp.status();
+ let body = resp.text().await?;
+ assert_eq!(status, 200, "run must be accepted: {body}");
+ let (args, entrypoint) =
+ job_args_and_entrypoint(&db, uuid::Uuid::parse_str(body.trim())?).await?;
+ assert_eq!(
+ entrypoint, None,
+ "a viewer must not pick the function the worker calls instead of `main`"
+ );
+ assert_eq!(
+ args,
+ json!({ "tenant": "acme", "greeting": "Hello," }),
+ "only the policy's pinned input and the viewer's allowed one may reach the job: {args}"
+ );
+ Ok(())
+}
+
+/// A deployed flow's dynamic-select code has no deployed runnable, so it is queued as a
+/// `JobKind::Preview` job — the one kind on which the bun and python executors honor
+/// `_TEMP_SCRIPT_REFS` and resolve the code's workspace imports from the temporary script
+/// store, which any workspace member can write. The caller of this route only fills in that
+/// code's inputs (it may be an operator, who is refused `jobs/run/preview` outright), so the
+/// key must not reach the job, in either spelling.
+#[sqlx::test(fixtures("base"))]
+async fn flow_dynamic_select_strips_caller_control_args(db: Pool) -> anyhow::Result<()> {
+ initialize_tracing().await;
+ let server = ApiServer::start(db.clone()).await?;
+ let ws = format!(
+ "http://localhost:{}/api/w/test-workspace",
+ server.addr.port()
+ );
+
+ // Someone else's flow: `test-user-2` below can run it, not edit it.
+ let flow_path = "u/test-user/dynselect_control_args";
+ let resp = authed(client().post(format!("{ws}/flows/create")), "SECRET_TOKEN")
+ .json(&json!({
+ "path": flow_path,
+ "summary": "",
+ "description": "",
+ "value": { "modules": [] },
+ "schema": {
+ "type": "object",
+ "properties": { "region": { "type": "object", "format": "dynselect-region" } },
+ "x-windmill-dyn-select-lang": "bun",
+ "x-windmill-dyn-select-code":
+ "import { regions } from \"/f/system/regions\"\n\
+ export async function region() { return regions() }\n"
+ }
+ }))
+ .send()
+ .await?;
+ assert_eq!(resp.status(), 201, "create flow: {}", resp.text().await?);
+
+ // Read-only for the caller below: running the dyn-select code is all it may do.
+ sqlx::query(
+ "UPDATE flow SET extra_perms = '{\"u/test-user-2\": false}'
+ WHERE path = $1 AND workspace_id = 'test-workspace'",
+ )
+ .bind(flow_path)
+ .execute(&db)
+ .await?;
+
+ let refs = json!({ "f/system/regions": "deadbeef" });
+ let modules = json!({ "regions.ts": { "content": "export const v = 1", "language": "bun" } });
+ let resp = authed(
+ client().post(format!("{ws}/jobs/run/dynamic_select")),
+ "SECRET_TOKEN_2",
+ )
+ .json(&json!({
+ "entrypoint_function": "region",
+ "runnable_ref": { "source": "deployed", "path": flow_path, "runnable_kind": "flow" },
+ "args": {
+ "_TEMP_SCRIPT_REFS": refs,
+ "_TEMP_SCRIPT_REFS\u{0}": refs,
+ "_MODULES": modules,
+ "_MODULES\u{0}": modules,
+ "filterText": "eu"
+ }
+ }))
+ .send()
+ .await?;
+ let status = resp.status();
+ let body = resp.text().await?;
+ assert_eq!(status, 201, "dynamic select must be accepted: {body}");
+
+ let id = uuid::Uuid::parse_str(body.trim())?;
+ let kind: String = sqlx::query_scalar("SELECT kind::text FROM v2_job WHERE id = $1")
+ .bind(id)
+ .fetch_one(&db)
+ .await?;
+ assert_eq!(
+ kind, "preview",
+ "the premise of this test: a deployed flow's dyn-select code runs as a preview job"
+ );
+ let (args, _) = job_args_and_entrypoint(&db, id).await?;
+ assert_eq!(
+ args,
+ json!({ "_ENTRYPOINT_OVERRIDE": "region", "filterText": "eu" }),
+ "only the caller's inputs and the server-set entrypoint may reach the job"
+ );
+ Ok(())
+}
diff --git a/backend/tests/untrusted_interpolation.rs b/backend/tests/untrusted_interpolation.rs
new file mode 100644
index 0000000000..2171797e18
--- /dev/null
+++ b/backend/tests/untrusted_interpolation.rs
@@ -0,0 +1,441 @@
+//! Handler, public-app and agent tool jobs run with more rights than whoever wrote some of their
+//! arguments, so nothing in those arguments may be resolved by the worker with the job's identity.
+
+use axum::{routing::post, Json as AxumJson, Router};
+use serde_json::{json, value::RawValue, Value};
+use sqlx::{types::Json, Pool, Postgres};
+use std::time::Duration;
+use uuid::Uuid;
+use windmill_common::{flows::FlowValue, jobs::JobPayload};
+use windmill_test_utils::*;
+
+const SECRET: &str = "s3cr3t-value";
+const ENV_SECRET: &str = "env-s3cr3t";
+const READERS: &str =
+ r#"{"g/error_handler": false, "g/success_handler": false, "g/publishers": false}"#;
+
+async fn seed(db: &Pool) -> anyhow::Result<()> {
+ // Every test of this file is serial: the workspace env cache is process-wide.
+ sqlx::query(
+ "INSERT INTO workspace_env (workspace_id, name, value) VALUES ('test-workspace', 'API_KEY', $1)",
+ )
+ .bind(ENV_SECRET)
+ .execute(db)
+ .await?;
+ windmill_common::variables::CUSTOM_ENVS_CACHE.remove("test-workspace");
+ // How an app run as its publisher reads a secret: through the publisher's groups.
+ sqlx::query(
+ "INSERT INTO group_ (workspace_id, name, summary, extra_perms)
+ VALUES ('test-workspace', 'publishers', '', '{}')",
+ )
+ .execute(db)
+ .await?;
+ sqlx::query(
+ "INSERT INTO usr_to_group (workspace_id, group_, usr)
+ VALUES ('test-workspace', 'publishers', 'test-user')",
+ )
+ .execute(db)
+ .await?;
+ sqlx::query(
+ "INSERT INTO variable (workspace_id, path, value, is_secret, description, extra_perms)
+ VALUES ('test-workspace', 'u/test-user/secret', $1, false, '', $2::jsonb)",
+ )
+ .bind(format!("\"{SECRET}\""))
+ .bind(READERS)
+ .execute(db)
+ .await?;
+ sqlx::query(
+ "INSERT INTO resource_type (workspace_id, name, schema, description, created_by)
+ VALUES ('test-workspace', 'c_cfg', '{}', '', 'test-user')",
+ )
+ .execute(db)
+ .await?;
+ sqlx::query(
+ "INSERT INTO resource (workspace_id, path, value, resource_type, extra_perms, created_by)
+ VALUES ('test-workspace', 'u/test-user/cfg', '{\"set_by\": \"admin\"}', 'c_cfg', $1::jsonb,
+ 'test-user')",
+ )
+ .bind(READERS)
+ .execute(db)
+ .await?;
+ // The lock must be non-null for the script to count as deployed.
+ sqlx::query(
+ r#"INSERT INTO script (workspace_id, hash, path, content, language, kind, created_by, schema,
+ summary, description, lock)
+ VALUES ('test-workspace', 1234, 'f/handlers/h', $1, 'bun', 'script', 'test-user', '{}',
+ '', '', E'{}\n//bun.lock\n')"#,
+ )
+ .bind(
+ "export async function main(error: any, cfg: any, success_result: any, pipeline: any,
+ price: any, note: any, leak: any, log: any) {
+ return { error, cfg, success_result, pipeline, price, note, leak, log };
+ }",
+ )
+ .execute(db)
+ .await?;
+ Ok(())
+}
+
+async fn run(db: &Pool, port: u16, id: Uuid) -> Value {
+ let done = listen_for_completed_jobs(db).await.find(&id);
+ tokio::time::timeout(Duration::from_secs(60), in_test_worker(db, done, port))
+ .await
+ .expect("job did not complete");
+ let job = completed_job(id, db).await;
+ assert!(job.success, "{:?}", job.result);
+ job.json_result().unwrap()
+}
+
+fn assert_omitted(v: &Value) {
+ let s = v.as_str().unwrap_or_default();
+ assert!(
+ s.starts_with("The following variable has been omitted for security reasons"),
+ "{v}"
+ );
+}
+
+/// What a failed job sends its handler: references in its error, and the `$WM_TOKEN` the worker
+/// replaces with the handler's token in an argument that holds one.
+fn failed_result() -> Box {
+ // Raw text: a number survives only if nothing on the way parses it.
+ RawValue::from_string(
+ r#"{"error": {"message": "$var:u/test-user/secret", "name": "$WM_TOKEN",
+ "stack": "$jsonvar:u/test-user/secret"},
+ "meta": {"code": 1.10, "id": 18446744073709551617}, "log": "a\u0000b"}"#
+ .to_string(),
+ )
+ .unwrap()
+}
+
+fn extra_args() -> Json> {
+ Json(serde_json::value::to_raw_value(&json!({"cfg": "$res:u/test-user/cfg"})).unwrap())
+}
+
+/// Stored as jsonb stores it: numbers exact, the NUL jsonb refuses stripped.
+async fn assert_handled(db: &Pool, port: u16, id: Uuid) -> Value {
+ let stored: String = sqlx::query_scalar("SELECT args::text FROM v2_job WHERE id = $1")
+ .bind(id)
+ .fetch_one(db)
+ .await
+ .unwrap();
+ assert!(
+ stored.contains("1.10") && stored.contains("18446744073709551617"),
+ "{stored}"
+ );
+ let out = run(db, port, id).await;
+ assert_eq!(out["log"], json!("ab"));
+ assert!(!out.to_string().contains(SECRET), "{out}");
+ for k in ["message", "name", "stack"] {
+ assert_omitted(&out["error"][k]);
+ }
+ // The handler's own settings, written by an admin.
+ assert_eq!(out["cfg"], json!({"set_by": "admin"}));
+ out
+}
+
+#[sqlx::test(fixtures("base"))]
+#[serial_test::serial]
+async fn error_handler_resolves_nothing_the_failed_job_wrote(
+ db: Pool,
+) -> anyhow::Result<()> {
+ initialize_tracing().await;
+ let server = ApiServer::start(db.clone()).await?;
+ seed(&db).await?;
+ let id = windmill_queue::push_error_handler(
+ &db,
+ Uuid::new_v4(),
+ None,
+ Some("u/test-user/failing".to_string()),
+ false,
+ "test-workspace",
+ "script/f/handlers/h",
+ Json(&failed_result()),
+ None,
+ None,
+ Some(extra_args()),
+ "test@windmill.dev",
+ None,
+ false,
+ None,
+ )
+ .await?;
+ assert_handled(&db, server.addr.port(), id).await;
+ Ok(())
+}
+
+#[sqlx::test(fixtures("base"))]
+#[serial_test::serial]
+async fn success_handler_resolves_nothing_the_job_returned(
+ db: Pool,
+) -> anyhow::Result<()> {
+ initialize_tracing().await;
+ let server = ApiServer::start(db.clone()).await?;
+ seed(&db).await?;
+ let result = json!({
+ "pipeline": [{"$match": {"currency": "$USD", "$or": [{"a": "$category"}]}}],
+ "price": "$10.00",
+ "note": "cost $var:u/test-user/secret",
+ "leak": "\u{24}jsonvar:u/test-user/secret",
+ });
+ let id = windmill_queue::push_success_handler(
+ &db,
+ Uuid::new_v4(),
+ None,
+ Some("u/test-user/succeeding".to_string()),
+ false,
+ "test-workspace",
+ "script/f/handlers/h",
+ Json(&result),
+ None,
+ Some(extra_args()),
+ "test@windmill.dev",
+ None,
+ )
+ .await?;
+ let out = run(&db, server.addr.port(), id).await;
+ assert_omitted(&out["leak"]);
+ // Holds the prefix that makes the worker interpolate the whole argument.
+ assert!(out["note"]
+ .as_str()
+ .unwrap()
+ .starts_with("cost The following variable"));
+ for k in ["pipeline", "price"] {
+ assert_eq!(out[k], result[k], "{k}");
+ }
+ assert_eq!(out["cfg"], json!({"set_by": "admin"}));
+ Ok(())
+}
+
+#[cfg(all(feature = "enterprise", feature = "private"))]
+#[sqlx::test(fixtures("base"))]
+#[serial_test::serial]
+async fn recovery_handler_resolves_nothing_the_schedule_jobs_wrote(
+ db: Pool,
+) -> anyhow::Result<()> {
+ initialize_tracing().await;
+ let server = ApiServer::start(db.clone()).await?;
+ seed(&db).await?;
+ let job_id = Uuid::new_v4();
+ let failed = failed_result();
+ let success = json!({"leak": "$var:u/test-user/secret", "ok": {"$match": "$USD"}});
+ windmill_queue::jobs_ee::handle_recovered_schedule(
+ &db,
+ job_id,
+ "u/test-user/schedule",
+ "u/test-user/flaky",
+ false,
+ "test-workspace",
+ "script/f/handlers/h",
+ Some(&failed),
+ sqlx::types::chrono::Utc::now(),
+ Json(&success),
+ 1,
+ sqlx::types::chrono::Utc::now(),
+ Some(extra_args()),
+ "u/test-user",
+ )
+ .await?;
+ let id: Uuid = sqlx::query_scalar("SELECT id FROM v2_job WHERE parent_job = $1")
+ .bind(job_id)
+ .fetch_one(&db)
+ .await?;
+ let out = assert_handled(&db, server.addr.port(), id).await;
+ assert_omitted(&out["success_result"]["leak"]);
+ assert_eq!(out["success_result"]["ok"], success["ok"]);
+ Ok(())
+}
+
+#[sqlx::test(fixtures("base"))]
+#[serial_test::serial]
+async fn public_app_resolves_nothing_the_viewer_sent(db: Pool) -> anyhow::Result<()> {
+ initialize_tracing().await;
+ let server = ApiServer::start(db.clone()).await?;
+ let port = server.addr.port();
+ seed(&db).await?;
+ let content = "export function main(a: any, b: any, c: any, d: any) { return { a, b, c, d } }";
+ let ws = format!("http://localhost:{port}/api/w/test-workspace");
+ let client = reqwest::Client::new();
+ let resp = client
+ .post(format!("{ws}/apps/create"))
+ .bearer_auth("SECRET_TOKEN")
+ .json(&json!({
+ "path": "u/test-user/app",
+ "summary": "",
+ "value": {"runnables": {"c": {"type": "inline",
+ "inlineScript": {"language": "bun", "content": content}}}},
+ "policy": {"execution_mode": "anonymous", "triggerables_v2": {
+ format!("c:rawscript/{}", windmill_common::utils::calculate_hash(content)):
+ {"static_inputs": {}, "one_of_inputs": {}}
+ }},
+ }))
+ .send()
+ .await?;
+ assert!(resp.status().is_success(), "{}", resp.text().await?);
+ // `\u0024` passes a text match on `$var:` until jsonb decodes it.
+ let body = r#"{"component": "c",
+ "raw_code": {"language": "bun", "content": "CONTENT"},
+ "args": {"a": "\u0024var:u/test-user/secret", "b": {"x": ["$jsonvar:u/test-user/secret"]},
+ "c": {"pipeline": [{"$match": {"currency": "$USD"}}]},
+ "d": {"key": "$API_KEY", "note": "cost $var:x"}}}"#
+ .replace("CONTENT", content);
+ let resp = client
+ .post(format!("{ws}/apps_u/execute_component/u/test-user/app"))
+ .bearer_auth("SECRET_TOKEN_2")
+ .header("content-type", "application/json")
+ .body(body)
+ .send()
+ .await?;
+ assert!(resp.status().is_success(), "{}", resp.text().await?);
+ let id: Uuid = resp.text().await?.parse()?;
+ let out = run(&db, port, id).await;
+ assert!(!out.to_string().contains(SECRET), "{out}");
+ assert!(!out.to_string().contains(ENV_SECRET), "{out}");
+ assert_omitted(&out["a"]);
+ assert_omitted(&out["b"]["x"][0]);
+ assert_eq!(
+ out["c"],
+ json!({"pipeline": [{"$match": {"currency": "$USD"}}]})
+ );
+ assert_eq!(out["d"]["key"], json!("$API_KEY"));
+ Ok(())
+}
+
+/// Read as the jsonb args column holds it: whatever the worker's own test finds in the stored text,
+/// the check finds too, and nothing more.
+#[sqlx::test(fixtures("base"))]
+#[serial_test::serial]
+async fn reads_an_argument_as_jsonb_stores_it(db: Pool) -> anyhow::Result<()> {
+ use windmill_common::{utils::strip_json_nul, variables::*};
+ for arg in [
+ r#""\u0024var:x""#,
+ r#""$va\u0072:x""#,
+ r#""$va\\u0072:x""#,
+ r#""$va\u0000r:x""#,
+ r#""\ud800 $var:x""#,
+ r#"{"a": "\u0024res:x", "a": "ok"}"#,
+ r#"{"a": "ok", "a": "\u0024var:x"}"#,
+ r#"{"n": 1e400, "n": 0, "r": "\u0024var:x"}"#,
+ r#"{"\u0024encrypted:k": 1}"#,
+ r#""cost \u0024var:x""#,
+ r#"{"$match": {"c": "$USD"}, "p": 1.10}"#,
+ r#""$10.00""#,
+ ] {
+ let stored: Option = match sqlx::query_scalar("SELECT $1::jsonb::text")
+ .bind(strip_json_nul(arg).as_ref())
+ .fetch_one(&db)
+ .await
+ {
+ Ok(s) => Some(s),
+ Err(sqlx::Error::Database(e)) if e.code().as_deref() == Some("22P02") => None,
+ Err(e) => return Err(e.into()),
+ };
+ assert_eq!(
+ untrusted_arg_interpolates(arg),
+ stored.as_deref().map_or(true, arg_needs_interpolation),
+ "{arg} stored as {stored:?}"
+ );
+ }
+ Ok(())
+}
+
+/// One tool call with `arguments`, then a final answer once the tool's reply is in.
+fn model(arguments: &'static str) -> Router {
+ Router::new().route(
+ "/v1/chat/completions",
+ post(move |AxumJson(body): AxumJson| async move {
+ let answered = body["messages"]
+ .as_array()
+ .unwrap()
+ .iter()
+ .any(|m| m["role"] == "tool");
+ let delta = if answered {
+ json!({"role": "assistant", "content": "done"})
+ } else {
+ json!({"role": "assistant", "tool_calls": [{"index": 0, "id": "call_0",
+ "type": "function", "function": {"name": "echo", "arguments": arguments}}]})
+ };
+ let event = json!({"choices": [{"index": 0, "delta": delta, "finish_reason": null}]});
+ let end = json!({"choices": [{"index": 0, "delta": {},
+ "finish_reason": if answered {"stop"} else {"tool_calls"}}]});
+ (
+ [("content-type", "text/event-stream")],
+ format!("data: {event}\n\ndata: {end}\n\ndata: [DONE]\n\n"),
+ )
+ }),
+ )
+}
+
+/// What the tool replied to the model.
+async fn tool_reply(db: &Pool, port: u16, arguments: &'static str) -> String {
+ std::env::set_var("ALLOW_PRIVATE_AI_BASE_URLS", "true");
+ let listener = tokio::net::TcpListener::bind("127.0.0.1:0").await.unwrap();
+ let base = format!("http://{}", listener.local_addr().unwrap());
+ let stub = tokio::spawn(async move { axum::serve(listener, model(arguments)).await });
+ let flow: FlowValue = serde_json::from_value(json!({"modules": [{"id": "agent", "value": {
+ "type": "aiagent",
+ "tools": [{"id": "echo", "summary": "echo", "value": {
+ "type": "rawscript", "language": "bun", "input_transforms": {},
+ "content": "export async function main(x: any) { return x }"}}],
+ "input_transforms": {
+ "provider": {"type": "static", "value": {"kind": "customai", "model": "m",
+ "resource": {"base_url": format!("{base}/v1")}}},
+ "user_message": {"type": "static", "value": "go"},
+ "max_iterations": {"type": "static", "value": 2}
+ }
+ }}]}))
+ .unwrap();
+ let id = RunJob::from(JobPayload::RawFlow {
+ value: flow,
+ path: Some("u/test-user/agent".into()),
+ restarted_from: None,
+ })
+ .push(db)
+ .await;
+ let out = run(db, port, id).await;
+ stub.abort();
+ out["messages"]
+ .as_array()
+ .unwrap()
+ .iter()
+ .find(|m| m["role"] == "tool")
+ .unwrap()["content"]
+ .as_str()
+ .unwrap()
+ .to_string()
+}
+
+#[sqlx::test(fixtures("base"))]
+#[serial_test::serial]
+async fn agent_tool_call_resolves_nothing_the_model_wrote(
+ db: Pool,
+) -> anyhow::Result<()> {
+ initialize_tracing().await;
+ let server = ApiServer::start(db.clone()).await?;
+ let port = server.addr.port();
+ seed(&db).await?;
+ // jsonb keeps the last copy of a duplicate key, the one a Rust decode refuses to read past.
+ let reply = tool_reply(
+ &db,
+ port,
+ r#"{"x": {"n": 1e400, "n": 0, "r": "\u0024var:u/test-user/secret"}}"#,
+ )
+ .await;
+ assert!(!reply.contains(SECRET), "{reply}");
+ assert!(reply.contains("Tool call refused"), "{reply}");
+
+ // A tool the model calls without arguments, as Anthropic sends it.
+ let reply = tool_reply(&db, port, "").await;
+ assert!(!reply.contains("Tool call refused"), "{reply}");
+
+ let reply = tool_reply(
+ &db,
+ port,
+ r#"{"x": {"pipeline": [{"$match": {"currency": "$USD", "_id": "$category"}}]}}"#,
+ )
+ .await;
+ assert_eq!(
+ serde_json::from_str::(&reply)?,
+ json!({"pipeline": [{"$match": {"currency": "$USD", "_id": "$category"}}]})
+ );
+ Ok(())
+}
diff --git a/backend/tests/variable_expiration.rs b/backend/tests/variable_expiration.rs
new file mode 100644
index 0000000000..94a4ed3f78
--- /dev/null
+++ b/backend/tests/variable_expiration.rs
@@ -0,0 +1,534 @@
+//! Tests for the variable expiration sweep. No worker: the sweep ends at the push, and the
+//! queued job is what the tests assert on.
+
+use sqlx::{Pool, Postgres};
+use windmill_queue::variable_expiration::dispatch_expiring_variables;
+use windmill_test_utils::{initialize_tracing, ApiServer};
+
+const WS: &str = "test-workspace";
+
+async fn configure_handler(db: &Pool, handler: &str) -> anyhow::Result<()> {
+ sqlx::query("UPDATE workspace_settings SET variable_expiration_handler = $2::jsonb WHERE workspace_id = $1")
+ .bind(WS)
+ .bind(handler)
+ .execute(db)
+ .await?;
+ Ok(())
+}
+
+/// Seed a deployed script the handler setting can point at.
+async fn seed_handler_script(db: &Pool, path: &str) -> anyhow::Result<()> {
+ sqlx::query(
+ r#"INSERT INTO script (workspace_id, hash, path, summary, description, content, created_by, language, lock)
+ VALUES ($1, $2, $3, '', '', 'export function main() {}', 'test-user', 'bun', '')"#,
+ )
+ .bind(WS)
+ .bind(path.bytes().fold(0i64, |h, b| h.wrapping_mul(31).wrapping_add(b as i64)))
+ .bind(path)
+ .execute(db)
+ .await?;
+ Ok(())
+}
+
+async fn seed_variable(db: &Pool, path: &str, expires_in: &str) -> anyhow::Result<()> {
+ sqlx::query(&format!(
+ r#"INSERT INTO variable (workspace_id, path, value, is_secret, description, value_valid_until)
+ VALUES ($1, $2, 'MUST_NOT_LEAK', true, 'a credential', now() + interval '{expires_in}')"#
+ ))
+ .bind(WS)
+ .bind(path)
+ .execute(db)
+ .await?;
+ Ok(())
+}
+
+async fn queued_handler_jobs(db: &Pool, path: &str) -> anyhow::Result {
+ Ok(
+ sqlx::query_scalar::<_, i64>("SELECT count(*) FROM v2_job WHERE runnable_path = $1")
+ .bind(path)
+ .fetch_one(db)
+ .await?,
+ )
+}
+
+/// The sweep dispatches inside the handler's `notify_before_secs`, leaves everything outside it
+/// alone, and does not fire twice for the same expiry.
+#[sqlx::test(fixtures("base"))]
+async fn test_dispatch_within_lead_time_once(db: Pool) -> anyhow::Result<()> {
+ initialize_tracing().await;
+ seed_handler_script(&db, "u/test-user/expiry_handler").await?;
+ configure_handler(
+ &db,
+ r#"{"path": "script/u/test-user/expiry_handler", "notify_before_secs": 3600}"#,
+ )
+ .await?;
+
+ seed_variable(&db, "u/test-user/due", "30 minutes").await?;
+ seed_variable(&db, "u/test-user/far", "2 hours").await?;
+
+ dispatch_expiring_variables(&db).await;
+
+ assert_eq!(
+ queued_handler_jobs(&db, "u/test-user/expiry_handler").await?,
+ 1,
+ "exactly the variable inside the lead window should dispatch"
+ );
+
+ // Admins grant this group access to the secrets it rotates, so the job must run as it.
+ let (path, is_secret, permissioned_as, permissioned_as_email): (String, bool, String, String) =
+ sqlx::query_as(
+ "SELECT args->>'variable_path', (args->>'is_secret')::boolean, permissioned_as,
+ permissioned_as_email FROM v2_job WHERE runnable_path = $1",
+ )
+ .bind("u/test-user/expiry_handler")
+ .fetch_one(&db)
+ .await?;
+ assert_eq!(path, "u/test-user/due");
+ assert!(is_secret);
+ assert_eq!(permissioned_as, "g/variable_expiration_handler");
+ assert_eq!(
+ permissioned_as_email,
+ "variable_expiration_handler@windmill.dev"
+ );
+
+ let args: String = sqlx::query_scalar("SELECT args::text FROM v2_job WHERE runnable_path = $1")
+ .bind("u/test-user/expiry_handler")
+ .fetch_one(&db)
+ .await?;
+ assert!(
+ !args.contains("MUST_NOT_LEAK"),
+ "handler args leaked the value: {args}"
+ );
+
+ // The claim is what makes concurrent replicas safe.
+ dispatch_expiring_variables(&db).await;
+ assert_eq!(
+ queued_handler_jobs(&db, "u/test-user/expiry_handler").await?,
+ 1,
+ "a dispatched variable must not fire again"
+ );
+
+ Ok(())
+}
+
+/// A variable's writer must not get the handler to resolve a reference as its own identity;
+/// the admin's `extra_args` still resolve.
+#[sqlx::test(fixtures("base"))]
+async fn test_variable_fields_do_not_resolve_in_handler(db: Pool) -> anyhow::Result<()> {
+ initialize_tracing().await;
+ seed_handler_script(&db, "u/test-user/expiry_handler").await?;
+ configure_handler(
+ &db,
+ r#"{"path": "script/u/test-user/expiry_handler", "extra_args": {"slack": "$res:f/slack_bot/bot_token"}}"#,
+ )
+ .await?;
+ seed_variable(&db, "u/test-user/due", "30 minutes").await?;
+ sqlx::query(
+ "UPDATE variable SET description = '$var:u/test-user/other' WHERE path = 'u/test-user/due'",
+ )
+ .execute(&db)
+ .await?;
+
+ dispatch_expiring_variables(&db).await;
+
+ let (description, slack): (String, String) = sqlx::query_as(
+ "SELECT args->>'description', args->>'slack' FROM v2_job WHERE runnable_path = $1",
+ )
+ .bind("u/test-user/expiry_handler")
+ .fetch_one(&db)
+ .await?;
+ assert!(
+ !description.starts_with("$var:"),
+ "description still resolves: {description}"
+ );
+ assert_eq!(slack, "$res:f/slack_bot/bot_token");
+ Ok(())
+}
+
+/// `remind_every_secs` runs the handler again once the interval has elapsed, and not before.
+#[sqlx::test(fixtures("base"))]
+async fn test_remind_every_repeats_the_notice(db: Pool) -> anyhow::Result<()> {
+ initialize_tracing().await;
+ seed_handler_script(&db, "u/test-user/expiry_handler").await?;
+ configure_handler(
+ &db,
+ r#"{"path": "script/u/test-user/expiry_handler", "remind_every_secs": 600}"#,
+ )
+ .await?;
+ seed_variable(&db, "u/test-user/due", "30 minutes").await?;
+
+ dispatch_expiring_variables(&db).await;
+ dispatch_expiring_variables(&db).await;
+ assert_eq!(
+ queued_handler_jobs(&db, "u/test-user/expiry_handler").await?,
+ 1,
+ "no reminder before the interval has elapsed"
+ );
+
+ // A sweep landing a few seconds short of the interval must still remind.
+ sqlx::query(
+ "UPDATE variable SET expiration_notified_at = now() - interval '9 minutes 50 seconds'",
+ )
+ .execute(&db)
+ .await?;
+ dispatch_expiring_variables(&db).await;
+ assert_eq!(
+ queued_handler_jobs(&db, "u/test-user/expiry_handler").await?,
+ 2
+ );
+
+ sqlx::query(
+ "UPDATE variable SET value_valid_until = now() - interval '1 minute',
+ expiration_dispatched_for = now() - interval '1 minute',
+ expiration_notified_at = now() - interval '11 minutes'",
+ )
+ .execute(&db)
+ .await?;
+ dispatch_expiring_variables(&db).await;
+ assert_eq!(
+ queued_handler_jobs(&db, "u/test-user/expiry_handler").await?,
+ 2
+ );
+ Ok(())
+}
+
+/// Moving `value_valid_until` re-arms the variable; re-writing the same date does not.
+#[sqlx::test(fixtures("base"))]
+async fn test_rearm_on_date_change(db: Pool) -> anyhow::Result<()> {
+ initialize_tracing().await;
+ let server = ApiServer::start(db.clone()).await?;
+ let base_url = format!("http://localhost:{}", server.addr.port());
+ seed_handler_script(&db, "u/test-user/expiry_handler").await?;
+ configure_handler(&db, r#"{"path": "script/u/test-user/expiry_handler"}"#).await?;
+ seed_variable(&db, "u/test-user/due", "30 minutes").await?;
+
+ // Through the real endpoint: writing the column directly would assert nothing.
+ let update = async |body: serde_json::Value| -> anyhow::Result {
+ Ok(reqwest::Client::new()
+ .post(format!(
+ "{base_url}/api/w/{WS}/variables/update/u/test-user/due"
+ ))
+ .bearer_auth("SECRET_TOKEN")
+ .json(&body)
+ .send()
+ .await?
+ .status()
+ .as_u16())
+ };
+
+ dispatch_expiring_variables(&db).await;
+ assert_eq!(
+ queued_handler_jobs(&db, "u/test-user/expiry_handler").await?,
+ 1
+ );
+
+ let stored: chrono::DateTime = sqlx::query_scalar(
+ "SELECT value_valid_until FROM variable WHERE workspace_id = $1 AND path = $2",
+ )
+ .bind(WS)
+ .bind("u/test-user/due")
+ .fetch_one(&db)
+ .await?;
+
+ // An unchanged `wmill sync push` rewrites the same date.
+ assert_eq!(
+ update(serde_json::json!({ "value_valid_until": stored })).await?,
+ 200
+ );
+ dispatch_expiring_variables(&db).await;
+ assert_eq!(
+ queued_handler_jobs(&db, "u/test-user/expiry_handler").await?,
+ 1,
+ "an unchanged expiry must not re-arm"
+ );
+
+ assert_eq!(
+ update(serde_json::json!({ "description": "touched" })).await?,
+ 200
+ );
+ dispatch_expiring_variables(&db).await;
+ assert_eq!(
+ queued_handler_jobs(&db, "u/test-user/expiry_handler").await?,
+ 1,
+ "an update that omits value_valid_until must not re-arm"
+ );
+
+ assert_eq!(
+ update(serde_json::json!({ "value_valid_until": stored + chrono::Duration::minutes(5) }))
+ .await?,
+ 200
+ );
+ dispatch_expiring_variables(&db).await;
+ assert_eq!(
+ queued_handler_jobs(&db, "u/test-user/expiry_handler").await?,
+ 2,
+ "a moved expiry must re-arm the handler"
+ );
+
+ Ok(())
+}
+
+/// `muted_on_user_path` keeps personal-path variables out.
+#[sqlx::test(fixtures("base"))]
+async fn test_muted_user_paths(db: Pool) -> anyhow::Result<()> {
+ initialize_tracing().await;
+ seed_handler_script(&db, "u/test-user/expiry_handler").await?;
+ seed_variable(&db, "u/test-user/personal", "30 minutes").await?;
+ seed_variable(&db, "f/test_folder/shared", "30 minutes").await?;
+ configure_handler(
+ &db,
+ r#"{"path": "script/u/test-user/expiry_handler", "muted_on_user_path": true}"#,
+ )
+ .await?;
+ dispatch_expiring_variables(&db).await;
+
+ let dispatched: Vec =
+ sqlx::query_scalar("SELECT args->>'variable_path' FROM v2_job WHERE runnable_path = $1")
+ .bind("u/test-user/expiry_handler")
+ .fetch_all(&db)
+ .await?;
+ assert_eq!(
+ dispatched,
+ vec!["f/test_folder/shared".to_string()],
+ "a muted personal path must not dispatch"
+ );
+
+ Ok(())
+}
+
+/// Broken workspaces' due rows must not hold back anyone else's first notice or reminder: every
+/// due row is tried each pass, and a broken handler only once per pass. The broken rows go in
+/// first, so a cap on the pass would cut off the working workspace.
+#[sqlx::test(fixtures("base"))]
+async fn test_broken_handlers_do_not_hold_back_others(db: Pool) -> anyhow::Result<()> {
+ initialize_tracing().await;
+ sqlx::raw_sql(
+ r#"INSERT INTO workspace (id, name, owner) SELECT 'broken-' || i, 'broken-' || i, 'test-user' FROM generate_series(1, 100) i;
+ INSERT INTO workspace_key (workspace_id, kind, key) SELECT 'broken-' || i, 'cloud', 'k' FROM generate_series(1, 100) i;
+ INSERT INTO workspace_settings (workspace_id, variable_expiration_handler)
+ SELECT 'broken-' || i, '{"path": "script/u/test-user/does_not_exist"}'::jsonb FROM generate_series(1, 100) i;
+ INSERT INTO variable (workspace_id, path, value, is_secret, description, value_valid_until)
+ SELECT 'broken-' || i, 'f/creds/v' || j, 'v', false, '', now() - interval '1 day'
+ FROM generate_series(1, 100) i, generate_series(1, 2) j;"#,
+ )
+ .execute(&db)
+ .await?;
+ seed_handler_script(&db, "u/test-user/expiry_handler").await?;
+ configure_handler(
+ &db,
+ r#"{"path": "script/u/test-user/expiry_handler", "remind_every_secs": 60}"#,
+ )
+ .await?;
+ seed_variable(&db, "u/test-user/fresh", "30 minutes").await?;
+ sqlx::query(
+ "INSERT INTO variable (workspace_id, path, value, is_secret, description, value_valid_until,
+ expiration_dispatched_for, expiration_notified_at)
+ VALUES ($1, 'u/test-user/reminded', 'v', false, '', now() + interval '10 minutes',
+ now() + interval '10 minutes', now() - interval '2 minutes')",
+ )
+ .bind(WS)
+ .execute(&db)
+ .await?;
+
+ dispatch_expiring_variables(&db).await;
+
+ assert_eq!(
+ queued_handler_jobs(&db, "u/test-user/expiry_handler").await?,
+ 2,
+ "the first notice and the reminder must both go out"
+ );
+ assert_eq!(
+ queued_handler_jobs(&db, "u/test-user/does_not_exist").await?,
+ 0
+ );
+ Ok(())
+}
+
+/// A broken handler alerts once, however many passes it fails, runs on the first pass after
+/// it is deployed, and that resolves its alert.
+#[sqlx::test(fixtures("base"))]
+async fn test_deploying_the_handler_ends_the_failure(db: Pool) -> anyhow::Result<()> {
+ initialize_tracing().await;
+ configure_handler(&db, r#"{"path": "script/u/test-user/redeployed_handler"}"#).await?;
+ seed_variable(&db, "u/test-user/due", "30 minutes").await?;
+ let alerts = || async {
+ Ok::<_, anyhow::Error>(sqlx::query_as::<_, (i64, i64)>(
+ "SELECT count(*), count(*) FILTER (WHERE NOT acknowledged) FROM alerts
+ WHERE alert_type = 'critical_error' AND resource = 'variable_expiration_handler:test-workspace'",
+ )
+ .fetch_one(&db)
+ .await?)
+ };
+
+ dispatch_expiring_variables(&db).await;
+ dispatch_expiring_variables(&db).await;
+ assert_eq!(
+ alerts().await?,
+ (1, 1),
+ "one alert per failure, not per pass"
+ );
+
+ seed_handler_script(&db, "u/test-user/redeployed_handler").await?;
+ dispatch_expiring_variables(&db).await;
+
+ assert_eq!(
+ queued_handler_jobs(&db, "u/test-user/redeployed_handler").await?,
+ 1,
+ "the deployed handler did not run on the next pass"
+ );
+ assert_eq!(alerts().await?, (1, 0), "starting again resolves the alert");
+ Ok(())
+}
+
+/// A handler script still waiting on its dependency job runs on the first pass after its lock
+/// lands, though nothing about the script changes but the lock.
+#[sqlx::test(fixtures("base"))]
+async fn test_handler_runs_once_its_lock_lands(db: Pool) -> anyhow::Result<()> {
+ initialize_tracing().await;
+ configure_handler(
+ &db,
+ r#"{"path": "script/u/test-user/pending_lock_handler"}"#,
+ )
+ .await?;
+ seed_variable(&db, "u/test-user/due", "30 minutes").await?;
+ seed_handler_script(&db, "u/test-user/pending_lock_handler").await?;
+ sqlx::query("UPDATE script SET lock = NULL WHERE workspace_id = $1")
+ .bind(WS)
+ .execute(&db)
+ .await?;
+
+ dispatch_expiring_variables(&db).await;
+ assert_eq!(
+ queued_handler_jobs(&db, "u/test-user/pending_lock_handler").await?,
+ 0
+ );
+ sqlx::query("UPDATE script SET lock = '' WHERE workspace_id = $1")
+ .bind(WS)
+ .execute(&db)
+ .await?;
+ dispatch_expiring_variables(&db).await;
+
+ assert_eq!(
+ queued_handler_jobs(&db, "u/test-user/pending_lock_handler").await?,
+ 1,
+ "the handler did not run once its lock landed"
+ );
+ Ok(())
+}
+
+/// A removed handler has nothing left to retry, so the next pass ends its failure and resolves
+/// its alert.
+#[sqlx::test(fixtures("base"))]
+async fn test_removing_a_failing_handler_resolves_its_alert(
+ db: Pool,
+) -> anyhow::Result<()> {
+ initialize_tracing().await;
+ sqlx::query(
+ "UPDATE workspace_settings SET variable_expiration_handler = NULL,
+ variable_expiration_failed_at = now() WHERE workspace_id = $1",
+ )
+ .bind(WS)
+ .execute(&db)
+ .await?;
+ sqlx::query(
+ "INSERT INTO alerts (alert_type, message, acknowledged, acknowledged_workspace, workspace_id, resource)
+ VALUES ('critical_error', 'failed', false, false, $1, 'variable_expiration_handler:' || $1)",
+ )
+ .bind(WS)
+ .execute(&db)
+ .await?;
+
+ dispatch_expiring_variables(&db).await;
+
+ let (failing, open_alerts): (bool, i64) = sqlx::query_as(
+ "SELECT ws.variable_expiration_failed_at IS NOT NULL,
+ (SELECT count(*) FROM alerts WHERE alert_type = 'critical_error' AND NOT acknowledged
+ AND workspace_id = $1)
+ FROM workspace_settings ws WHERE ws.workspace_id = $1",
+ )
+ .bind(WS)
+ .fetch_one(&db)
+ .await?;
+ assert!(!failing, "the removed handler's failure must end");
+ assert_eq!(
+ open_alerts, 0,
+ "the removed handler's alert must be resolved"
+ );
+ Ok(())
+}
+
+/// The handler endpoint: admin-only, existence-checked, and clearing by omission, which
+/// `wmill sync push` relies on to propagate an absent handler.
+#[sqlx::test(fixtures("base"))]
+async fn test_edit_handler_endpoint(db: Pool) -> anyhow::Result<()> {
+ initialize_tracing().await;
+ let server = ApiServer::start(db.clone()).await?;
+ let base_url = format!("http://localhost:{}", server.addr.port());
+
+ let edit = async |token: &str, body: serde_json::Value| -> anyhow::Result {
+ Ok(reqwest::Client::new()
+ .post(format!(
+ "{base_url}/api/w/{WS}/workspaces/edit_variable_expiration_handler"
+ ))
+ .bearer_auth(token)
+ .json(&body)
+ .send()
+ .await?
+ .status()
+ .as_u16())
+ };
+ let stored = async || -> anyhow::Result> {
+ Ok(sqlx::query_scalar(
+ "SELECT variable_expiration_handler FROM workspace_settings WHERE workspace_id = $1",
+ )
+ .bind(WS)
+ .fetch_one(&db)
+ .await?)
+ };
+
+ seed_handler_script(&db, "u/test-user/expiry_handler").await?;
+ let handler = serde_json::json!({ "path": "script/u/test-user/expiry_handler" });
+ assert_eq!(edit("SECRET_TOKEN_2", handler.clone()).await?, 403);
+ assert!(stored().await?.is_none());
+
+ for path in [
+ "u/test-user/expiry_handler",
+ "script/u/test-user/does_not_exist",
+ ] {
+ assert_eq!(
+ edit("SECRET_TOKEN", serde_json::json!({ "path": path })).await?,
+ 400,
+ "{path}"
+ );
+ }
+
+ // A recorded failure is the sweep's to end, so the endpoint leaves it alone either way.
+ sqlx::query("UPDATE workspace_settings SET variable_expiration_failed_at = now() WHERE workspace_id = $1")
+ .bind(WS)
+ .execute(&db)
+ .await?;
+ let failing = || async {
+ Ok::<_, anyhow::Error>(sqlx::query_scalar::<_, bool>(
+ "SELECT variable_expiration_failed_at IS NOT NULL FROM workspace_settings WHERE workspace_id = $1",
+ )
+ .bind(WS)
+ .fetch_one(&db)
+ .await?)
+ };
+ assert_eq!(edit("SECRET_TOKEN", handler).await?, 200);
+ assert_eq!(
+ stored()
+ .await?
+ .and_then(|h| h["path"].as_str().map(String::from)),
+ Some("script/u/test-user/expiry_handler".to_string())
+ );
+ assert!(failing().await?, "saving the handler must keep its failure");
+
+ assert_eq!(edit("SECRET_TOKEN", serde_json::json!({})).await?, 200);
+ assert!(
+ stored().await?.is_none(),
+ "an omitted path clears the handler"
+ );
+
+ Ok(())
+}
diff --git a/backend/tests/workspace_export.rs b/backend/tests/workspace_export.rs
index 5894ca8394..792d41b487 100644
--- a/backend/tests/workspace_export.rs
+++ b/backend/tests/workspace_export.rs
@@ -288,6 +288,48 @@ async fn test_tarball_export_gates_values_on_item_scopes(db: Pool) ->
Ok(())
}
+/// The tarball drops variables by `expires_at`, never `value_valid_until`, and the exported
+/// entry carries the date, or a pull/push round-trip clears it.
+#[sqlx::test(fixtures("base"))]
+async fn test_tarball_export_excludes_only_gc_variables(db: Pool) -> anyhow::Result<()> {
+ initialize_tracing().await;
+ let server = ApiServer::start(db.clone()).await?;
+ let base_url = format!("http://localhost:{}", server.addr.port());
+
+ sqlx::query(
+ r#"INSERT INTO variable (workspace_id, path, value, is_secret, description, expires_at, value_valid_until)
+ VALUES ('test-workspace', 'u/test-user/expiring', 'v', false, '', NULL, '2030-01-15T08:00:00Z'),
+ ('test-workspace', 'u/test-user/ephemeral', 'v', false, '', now() + interval '7 days', NULL)"#,
+ )
+ .execute(&db)
+ .await?;
+
+ let resp = reqwest::Client::new()
+ .get(format!(
+ "{base_url}/api/w/test-workspace/workspaces/tarball"
+ ))
+ .bearer_auth("SECRET_TOKEN")
+ .send()
+ .await?;
+ assert_eq!(resp.status().as_u16(), 200);
+ let body = String::from_utf8_lossy(&resp.bytes().await?).into_owned();
+
+ assert!(
+ body.contains("u/test-user/expiring.variable.json"),
+ "a variable with an expiry must still reach git sync"
+ );
+ assert!(
+ body.contains("2030-01-15T08:00:00Z"),
+ "the exported entry must carry the expiry back"
+ );
+ assert!(
+ !body.contains("u/test-user/ephemeral.variable.json"),
+ "a variable awaiting garbage collection must stay out of the export"
+ );
+
+ Ok(())
+}
+
/// `settings.json` carries the admin-managed integration config that `get_settings`
/// is admin-only for (the webhook URL, ai_config, git_sync, handler extra_args), so
/// `include_settings` takes the same admin check as `get_settings` rather than
diff --git a/backend/tests/workspace_fairness.rs b/backend/tests/workspace_fairness.rs
index f5922037e4..7f1e82782a 100644
--- a/backend/tests/workspace_fairness.rs
+++ b/backend/tests/workspace_fairness.rs
@@ -46,6 +46,7 @@ use windmill_common::worker::{
WORKSPACE_FAIRNESS_MIN_TOTAL, WORKSPACE_FAIRNESS_OVERLOADED,
};
use windmill_queue::workspace_fairness::refresh_overloaded;
+use windmill_test_utils::ensure_today_audit_partition;
// ---------------------------------------------------------------------------
// Shared helpers
@@ -331,22 +332,6 @@ async fn fairness_lifts_when_load_drops(db: Pool) {
assert!(overloaded_set().is_empty());
}
-/// Ensure today's audit_partitioned partition exists — the migration only
-/// creates partitions for the day it ran + 3 days, after which production
-/// relies on `monitor::manage_audit_partitions` to roll new ones. That
-/// maintenance task does not run in the test binary, so inserts silently
-/// fail-and-warn without it.
-async fn ensure_today_audit_partition(db: &Pool) {
- let today: chrono::NaiveDate = chrono::Utc::now().date_naive();
- let next = today + chrono::Duration::days(1);
- let partition = format!("audit_{}", today.format("%Y%m%d"));
- let sql = format!(
- "CREATE TABLE IF NOT EXISTS \"{partition}\" PARTITION OF audit_partitioned \
- FOR VALUES FROM ('{today}') TO ('{next}')"
- );
- let _ = sqlx::query(&sql).execute(db).await;
-}
-
/// Both cap AND uncap transitions must produce audit-log rows. This test
/// drives a cap → uncap cycle and inspects `audit_partitioned` directly.
#[sqlx::test(fixtures("base"))]
diff --git a/backend/windmill-ai/src/ai_providers.rs b/backend/windmill-ai/src/ai_providers.rs
index 311c8d3eb7..489a965ef1 100644
--- a/backend/windmill-ai/src/ai_providers.rs
+++ b/backend/windmill-ai/src/ai_providers.rs
@@ -213,7 +213,9 @@ impl AIProvider {
AIProvider::Groq => Ok("https://api.groq.com/openai/v1".to_string()),
AIProvider::OpenRouter => Ok("https://openrouter.ai/api/v1".to_string()),
AIProvider::TogetherAI => Ok("https://api.together.xyz/v1".to_string()),
- AIProvider::Anthropic => Ok("https://api.anthropic.com/v1".to_string()),
+ AIProvider::Anthropic => {
+ Ok(crate::providers::anthropic::ANTHROPIC_API_BASE_URL.to_string())
+ }
AIProvider::Mistral => Ok("https://api.mistral.ai/v1".to_string()),
AIProvider::TypeSafe => Ok(TYPESAFE_BASE_URL.to_string()),
AIProvider::Cloudflare => Err(Error::BadRequest(
diff --git a/backend/windmill-ai/src/credentials.rs b/backend/windmill-ai/src/credentials.rs
index 5a779938ed..f5489c5c30 100644
--- a/backend/windmill-ai/src/credentials.rs
+++ b/backend/windmill-ai/src/credentials.rs
@@ -32,6 +32,21 @@ pub struct ProviderCredentials {
/// A role trust policy that conditions on `sub` has to admit both, or only
/// one of the copilot and the AI agent step will be able to assume the role.
pub oidc_role_arn: Option,
+ /// Anthropic Workload Identity Federation settings, from an `anthropic_federated`
+ /// resource. The API proxy exchanges an OIDC token minted for the requesting
+ /// user for a short-lived access token, which then goes out as `access_token`.
+ pub anthropic_federation: Option,
pub platform: AIPlatform,
pub custom_headers: HashMap,
}
+
+/// The identifiers a Claude Console federation rule needs in a token exchange.
+/// None of them is a secret: what authorises the exchange is the OIDC token.
+#[derive(Clone, Debug, PartialEq, Eq, Hash)]
+pub struct AnthropicFederation {
+ pub federation_rule_id: String,
+ pub organization_id: String,
+ pub service_account_id: String,
+ /// Required by Anthropic only when the rule is enabled in several workspaces.
+ pub workspace_id: Option,
+}
diff --git a/backend/windmill-ai/src/providers/anthropic.rs b/backend/windmill-ai/src/providers/anthropic.rs
index 7acd2db939..2a3417bc62 100644
--- a/backend/windmill-ai/src/providers/anthropic.rs
+++ b/backend/windmill-ai/src/providers/anthropic.rs
@@ -2,6 +2,7 @@ use super::{anthropic_model_rejects_sampling_params, REASONING_OFF_SENTINEL};
use crate::{
ai_google::parse_data_url,
ai_providers::{AIPlatform, AIProvider, DISABLE_ANTHROPIC_PROMPT_CACHING},
+ credentials::AnthropicFederation,
image_handler::prepare_messages_for_api,
proxy::{
add_user_to_body, common_outbound_headers, credential_header, ProxyBuildArgs, ProxyRequest,
@@ -837,6 +838,169 @@ impl QueryBuilder for AnthropicQueryBuilder {
}
}
+pub const ANTHROPIC_API_BASE_URL: &str = "https://api.anthropic.com/v1";
+
+/// Audience of the OIDC token Windmill presents in an Anthropic token exchange,
+/// which a federation rule can pin with its `audience` matcher.
+pub const ANTHROPIC_OIDC_AUDIENCE: &str = "https://api.anthropic.com";
+
+/// Lifetime of that OIDC token. A federation issuer refuses a token that lives
+/// longer than its maximum (one hour by default), and Anthropic caps the access
+/// token at twice the assertion's remaining life, so 30 minutes still lets a rule
+/// mint its default one-hour token.
+pub const ANTHROPIC_OIDC_TOKEN_LIFETIME_SECS: i64 = 1800;
+
+/// Exchange again this long before the access token expires, so a long streamed
+/// response that starts on a reused token cannot outlive it. Capped at half the
+/// token's lifetime: a rule may mint tokens for as little as a minute, and a
+/// margin longer than that would exchange again on every request.
+const FEDERATED_TOKEN_REFRESH_MARGIN: std::time::Duration = std::time::Duration::from_secs(300);
+
+/// A short-lived Anthropic access token minted by a federated token exchange.
+#[derive(Clone, Debug)]
+pub struct FederatedAccessToken {
+ pub access_token: String,
+ refresh_at: std::time::SystemTime,
+}
+
+impl FederatedAccessToken {
+ fn new(access_token: String, lifetime: std::time::Duration) -> Self {
+ // Anthropic mints tokens for at most a day; the clamp keeps an out-of-range
+ // `expires_in` from overflowing the clock arithmetic.
+ let lifetime = lifetime.min(std::time::Duration::from_secs(86400));
+ let margin = FEDERATED_TOKEN_REFRESH_MARGIN.min(lifetime / 2);
+ Self { access_token, refresh_at: std::time::SystemTime::now() + lifetime - margin }
+ }
+
+ pub fn is_fresh(&self) -> bool {
+ std::time::SystemTime::now() < self.refresh_at
+ }
+}
+
+#[derive(Serialize)]
+struct FederatedTokenRequest<'a> {
+ grant_type: &'static str,
+ assertion: &'a str,
+ federation_rule_id: &'a str,
+ organization_id: &'a str,
+ service_account_id: &'a str,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ workspace_id: Option<&'a str>,
+}
+
+#[derive(Deserialize)]
+struct FederatedTokenResponse {
+ access_token: String,
+ expires_in: u64,
+}
+
+/// Exchange an OIDC token for an Anthropic access token at `POST /v1/oauth/token`
+/// (RFC 7523 `jwt-bearer` grant). `client` must already be pinned to the
+/// validated address of `base_url`.
+pub async fn exchange_federated_token(
+ client: &reqwest::Client,
+ base_url: &str,
+ federation: &AnthropicFederation,
+ assertion: &str,
+) -> Result {
+ let exchanged = request_federated_token(client, base_url, federation, assertion).await;
+ windmill_common::feature_usage::log_feature_usage(
+ "anthropic_federation",
+ "token_exchange",
+ if exchanged.is_ok() { "ok" } else { "failed" },
+ );
+ exchanged
+}
+
+async fn request_federated_token(
+ client: &reqwest::Client,
+ base_url: &str,
+ federation: &AnthropicFederation,
+ assertion: &str,
+) -> Result {
+ let url = AIProvider::build_anthropic_api_url(base_url, "oauth/token");
+ let response = client
+ .post(url)
+ .header("anthropic-version", ANTHROPIC_VERSION_STANDARD)
+ .json(&FederatedTokenRequest {
+ grant_type: "urn:ietf:params:oauth:grant-type:jwt-bearer",
+ assertion,
+ federation_rule_id: &federation.federation_rule_id,
+ organization_id: &federation.organization_id,
+ service_account_id: &federation.service_account_id,
+ workspace_id: federation.workspace_id.as_deref(),
+ })
+ .send()
+ .await
+ .map_err(|e| Error::internal_err(format!("Anthropic token exchange failed: {e}")))?;
+
+ let status = response.status();
+ if !status.is_success() {
+ let body = response.text().await.unwrap_or_default();
+ // Anthropic answers every denied assertion with the same opaque 401; the
+ // reason is only recorded in the Console's authentication history.
+ let hint = if status == reqwest::StatusCode::UNAUTHORIZED {
+ " The reason the exchange was denied is in the authentication history of the Claude Console's Workload identity page."
+ } else {
+ ""
+ };
+ return Err(Error::BadRequest(format!(
+ "Anthropic token exchange failed with status {status}: {body}.{hint}"
+ )));
+ }
+
+ let token = response
+ .json::()
+ .await
+ .map_err(|e| {
+ Error::internal_err(format!(
+ "Failed to parse the Anthropic token exchange response: {e}"
+ ))
+ })?;
+ Ok(FederatedAccessToken::new(
+ token.access_token,
+ std::time::Duration::from_secs(token.expires_in),
+ ))
+}
+
+/// The access token of a federated resource for a job, reusing `cached` while it
+/// is still fresh, so the agent loop exchanges once per job rather than per turn.
+/// Returns `None` for a resource that does not federate.
+pub async fn refresh_federated_access_token<'a>(
+ credentials: &crate::credentials::ProviderCredentials,
+ cached: &'a mut Option,
+ client: &AuthedClient,
+) -> Result, Error> {
+ let Some(federation) = credentials.anthropic_federation.as_ref() else {
+ return Ok(None);
+ };
+ if !cached.as_ref().is_some_and(FederatedAccessToken::is_fresh) {
+ // A worker holds no OIDC signing key, so it asks the API to mint the token for this job.
+ let assertion = client
+ .get_id_token_expiring_in(
+ ANTHROPIC_OIDC_AUDIENCE,
+ Some(ANTHROPIC_OIDC_TOKEN_LIFETIME_SECS),
+ )
+ .await
+ .map_err(|e| Error::ExecutionErr(format!("Failed to get an OIDC token: {e}")))?;
+ let http_client = crate::utils::pinned_ai_client_for(&credentials.base_url).await?;
+ *cached = Some(
+ exchange_federated_token(&http_client, &credentials.base_url, federation, &assertion)
+ .await?,
+ );
+ }
+ Ok(cached.as_ref().map(|token| token.access_token.as_str()))
+}
+
+/// Headers authenticating a request with a federated access token, which Anthropic
+/// takes as a bearer token in place of `x-api-key`.
+pub fn federated_auth_headers(access_token: &str) -> Vec<(&'static str, String)> {
+ vec![
+ ("Authorization", format!("Bearer {access_token}")),
+ ("anthropic-version", ANTHROPIC_VERSION_STANDARD.to_string()),
+ ]
+}
+
#[cfg(test)]
mod tests {
use super::*;
@@ -859,6 +1023,7 @@ mod tests {
aws_secret_access_key: None,
aws_session_token: None,
oidc_role_arn: None,
+ anthropic_federation: None,
platform,
custom_headers: HashMap::new(),
}
diff --git a/backend/windmill-ai/src/providers/google_ai.rs b/backend/windmill-ai/src/providers/google_ai.rs
index bbf45e5e57..06a404e5a4 100644
--- a/backend/windmill-ai/src/providers/google_ai.rs
+++ b/backend/windmill-ai/src/providers/google_ai.rs
@@ -805,6 +805,7 @@ mod tests {
aws_secret_access_key: None,
aws_session_token: None,
oidc_role_arn: None,
+ anthropic_federation: None,
platform,
custom_headers: HashMap::new(),
}
diff --git a/backend/windmill-ai/src/providers/mod.rs b/backend/windmill-ai/src/providers/mod.rs
index 82dceaa02f..ffddd33d3a 100644
--- a/backend/windmill-ai/src/providers/mod.rs
+++ b/backend/windmill-ai/src/providers/mod.rs
@@ -370,6 +370,7 @@ mod parity_tests {
aws_secret_access_key: None,
aws_session_token: None,
oidc_role_arn: None,
+ anthropic_federation: None,
platform: kase.platform.clone(),
custom_headers: HashMap::new(),
}
diff --git a/backend/windmill-ai/src/proxy.rs b/backend/windmill-ai/src/proxy.rs
index ca6ee1b59b..66285437e4 100644
--- a/backend/windmill-ai/src/proxy.rs
+++ b/backend/windmill-ai/src/proxy.rs
@@ -285,6 +285,7 @@ mod tests {
aws_secret_access_key: None,
aws_session_token: None,
oidc_role_arn: None,
+ anthropic_federation: None,
platform: AIPlatform::Standard,
custom_headers: HashMap::new(),
}
diff --git a/backend/windmill-ai/src/types.rs b/backend/windmill-ai/src/types.rs
index 59733e352c..3950576aed 100644
--- a/backend/windmill-ai/src/types.rs
+++ b/backend/windmill-ai/src/types.rs
@@ -19,7 +19,7 @@ pub struct McpToolSource {
use crate::{
ai_google::sanitize_schema_for_google,
ai_providers::{empty_string_as_none, AIProvider},
- credentials::ProviderCredentials,
+ credentials::{AnthropicFederation, ProviderCredentials},
};
use windmill_common::{db::DB, error::Error, flow_status::AgentAction, flows::FlowModule};
use windmill_parser::Typ;
@@ -270,6 +270,16 @@ pub struct ProviderResource {
/// credentials exchange this crate does not perform.
#[serde(default, deserialize_with = "empty_string_as_none")]
pub token_url: Option,
+ /// Set only by `anthropic_federated` resources, which authenticate through
+ /// Workload Identity Federation with an OIDC token minted for the job.
+ #[serde(default, deserialize_with = "empty_string_as_none")]
+ pub federation_rule_id: Option,
+ #[serde(default, deserialize_with = "empty_string_as_none")]
+ pub organization_id: Option,
+ #[serde(default, deserialize_with = "empty_string_as_none")]
+ pub service_account_id: Option,
+ #[serde(default, deserialize_with = "empty_string_as_none")]
+ pub workspace_id: Option,
/// The API token of a `cloudflare` resource, which names it `token` rather than `api_key`.
#[serde(default, deserialize_with = "empty_string_as_none")]
pub token: Option,
@@ -323,8 +333,13 @@ impl ProviderWithResource {
/// Callers must only pass resources that were already authorized for the
/// current job/workspace; this helper does not perform access checks.
pub async fn to_provider_credentials(&self, db: &DB) -> Result {
+ let anthropic_federation = self.anthropic_federation()?;
let base_url = if self.kind == AIProvider::AWSBedrock {
String::new()
+ } else if anthropic_federation.is_some() {
+ // The exchanged token is the job's identity, so it only ever goes to
+ // Anthropic: a resource cannot point it at another host.
+ crate::providers::anthropic::ANTHROPIC_API_BASE_URL.to_string()
} else {
self.get_base_url(db).await?
};
@@ -348,11 +363,40 @@ impl ProviderWithResource {
aws_secret_access_key: self.resource.aws_secret_access_key.clone(),
aws_session_token: self.resource.aws_session_token.clone(),
oidc_role_arn: self.resource.oidc_role_arn.clone(),
+ anthropic_federation,
platform: self.resource.platform.clone(),
custom_headers: self.resource.headers.clone(),
})
}
+ /// The federation settings of an `anthropic_federated` resource, which only
+ /// `federation_rule_id` identifies; the other required fields are checked here.
+ fn anthropic_federation(&self) -> Result, Error> {
+ let resource = &self.resource;
+ let Some(federation_rule_id) = resource.federation_rule_id.clone() else {
+ return Ok(None);
+ };
+ if self.kind != AIProvider::Anthropic {
+ return Err(Error::ExecutionErr(format!(
+ "An anthropic_federated resource can only be used with the Anthropic provider, not {:?}",
+ self.kind
+ )));
+ }
+ let required = |value: &Option, name: &str| {
+ value.clone().ok_or_else(|| {
+ Error::ExecutionErr(format!(
+ "The anthropic_federated resource needs {name} to be set"
+ ))
+ })
+ };
+ Ok(Some(AnthropicFederation {
+ federation_rule_id,
+ organization_id: required(&resource.organization_id, "organization_id")?,
+ service_account_id: required(&resource.service_account_id, "service_account_id")?,
+ workspace_id: resource.workspace_id.clone(),
+ }))
+ }
+
#[cfg(feature = "bedrock")]
pub fn get_region(&self) -> Option<&str> {
self.resource.region.as_deref()
@@ -983,6 +1027,47 @@ pub struct S3ObjectWithType {
mod tests {
use super::*;
+ #[test]
+ fn a_federated_resource_resolves_its_federation_and_names_a_missing_field() {
+ let provider = |kind: &str, resource: &str| -> ProviderWithResource {
+ serde_json::from_str(&format!(
+ r#"{{"kind":"{kind}","model":"m","resource":{resource}}}"#
+ ))
+ .unwrap()
+ };
+ let federated = r#"{"federation_rule_id":"fdrl_x","organization_id":"org","service_account_id":"svac_x","workspace_id":""}"#;
+
+ assert_eq!(
+ provider("anthropic", federated)
+ .anthropic_federation()
+ .unwrap(),
+ Some(AnthropicFederation {
+ federation_rule_id: "fdrl_x".to_string(),
+ organization_id: "org".to_string(),
+ service_account_id: "svac_x".to_string(),
+ workspace_id: None,
+ })
+ );
+ let incomplete = provider(
+ "anthropic",
+ r#"{"federation_rule_id":"fdrl_x","organization_id":"org"}"#,
+ );
+ assert!(incomplete
+ .anthropic_federation()
+ .unwrap_err()
+ .to_string()
+ .contains("service_account_id"));
+ assert!(provider("openai", federated)
+ .anthropic_federation()
+ .is_err());
+ assert_eq!(
+ provider("anthropic", r#"{"api_key":"k","organization_id":"org"}"#)
+ .anthropic_federation()
+ .unwrap(),
+ None
+ );
+ }
+
/// The schema is part of the prompt prefix the provider caches on, so its keys must
/// serialize in the same order on every request.
#[test]
diff --git a/backend/windmill-api-auth/src/auth.rs b/backend/windmill-api-auth/src/auth.rs
index 6bc9a930a4..e278b644d5 100644
--- a/backend/windmill-api-auth/src/auth.rs
+++ b/backend/windmill-api-auth/src/auth.rs
@@ -466,8 +466,8 @@ impl AuthCache {
let lookup = if super_admin {
Some((true, false))
} else {
- sqlx::query!(
- "SELECT is_admin, operator FROM usr where username = $1 AND \
+ let row = sqlx::query!(
+ "SELECT is_admin, operator, workspace_role FROM usr where username = $1 AND \
workspace_id = $2 AND disabled = false",
name,
&w_id.as_ref().unwrap()
@@ -475,8 +475,24 @@ impl AuthCache {
.fetch_optional(&self.db)
.await
.ok()
- .flatten()
- .map(|r| (r.is_admin, r.operator))
+ .flatten();
+ match row {
+ Some(r) => {
+ // Fails closed: an unreadable role config
+ // gates the member rather than freeing it.
+ let restricted =
+ windmill_common::roles::member_is_restricted_db(
+ &self.db,
+ w_id.as_ref().unwrap(),
+ r.workspace_role,
+ r.operator,
+ )
+ .await
+ .unwrap_or(true);
+ Some((r.is_admin, restricted && !r.is_admin))
+ }
+ None => None,
+ }
};
if let Some((is_admin, is_operator)) = lookup {
@@ -596,15 +612,35 @@ impl AuthCache {
username_override_from_label(label);
if w_id.is_some() {
let row_o = sqlx::query!(
- "SELECT username, is_admin, operator FROM usr WHERE
+ "SELECT username, is_admin, operator, workspace_role FROM usr WHERE
email = $1 AND workspace_id = $2 AND disabled = false",
&email,
w_id.as_ref().unwrap()
)
- .map(|x| (x.username, x.is_admin, x.operator))
+ .map(|x| (x.username, x.is_admin, x.operator, x.workspace_role))
.fetch_optional(&self.db)
.await
- .unwrap_or(Some(("error".to_string(), false, false)));
+ .unwrap_or(Some(("error".to_string(), false, false, None)));
+ let row_o = match row_o {
+ Some((username, is_admin, operator, workspace_role)) => {
+ // Fails closed, as above.
+ let restricted =
+ windmill_common::roles::member_is_restricted_db(
+ &self.db,
+ w_id.as_ref().unwrap(),
+ workspace_role,
+ operator,
+ )
+ .await
+ .unwrap_or(true);
+ Some((
+ username,
+ is_admin,
+ restricted && !is_admin && !super_admin,
+ ))
+ }
+ None => None,
+ };
match row_o {
Some((username, is_admin, is_operator)) => {
@@ -867,10 +903,9 @@ async fn admit_and_record_guest_jwt(db: &DB, w_id: &str, email: &str, app_path:
return false;
}
GUEST_JWT_ACTIVITY_CACHE.insert(cache_key, ());
- // Audit last, best-effort, on its own connection: the EE writer swallows an
- // `audit_partitioned` failure but that failing statement still aborts the
- // transaction it runs in, so auditing before the commit would let the whole
- // activity row roll back while this returned success, admitting an uncounted guest.
+ // Audit last, best-effort, on its own connection: a failed `audit_partitioned`
+ // insert aborts the transaction it runs in, so auditing before the commit would
+ // let an audit failure drop the activity row that counts this guest.
if first_jwt {
let author = windmill_common::audit::AuditAuthor {
email: email.to_string(),
@@ -1244,6 +1279,7 @@ pub async fn resolve_opt_job_authed(
// could approve an OAuth flow that mints a new non-read-only
// token.
let is_mcp_transport = path == "/api/mcp/gateway"
+ || path == "/api/mcp"
|| (path.starts_with("/api/mcp/w/")
&& (path.ends_with("/mcp")
|| path.ends_with("/sse")
diff --git a/backend/windmill-api-auth/src/composed.rs b/backend/windmill-api-auth/src/composed.rs
new file mode 100644
index 0000000000..e9d79240dd
--- /dev/null
+++ b/backend/windmill-api-auth/src/composed.rs
@@ -0,0 +1,171 @@
+//! Authorizing what a restricted role composes: the references a value-only walk
+//! (`check_flow_is_composition_only`) collects, checked against the caller's own permissions.
+
+use sqlx::{Postgres, Transaction};
+use windmill_common::{
+ error::{self, Error},
+ flows::FlowValue,
+ roles::AuthorLevel,
+ workspaces::{check_operator_can_build, BuilderKind},
+ DB,
+};
+
+use crate::{get_scope_tags, is_super_admin_authed, ApiAuthed};
+
+/// `validate_operator_composed_flow` on a transaction the caller already holds, so a write that
+/// has one open does not wait on a second connection. It must have been begun as the caller
+/// (`UserDB::begin`): its row-level security is the check.
+pub async fn authorize_composed_flow(
+ value: &FlowValue,
+ flow_tag: &Option,
+ authed: &ApiAuthed,
+ db: &DB,
+ tx: &mut Transaction<'_, Postgres>,
+ w_id: &str,
+) -> error::Result<()> {
+ let mut refs = windmill_common::flows::check_flow_is_composition_only(value)?;
+
+ // A builder links only an agent it can read, and binds only the tool inputs it leaves open.
+ for agent in &refs.agents {
+ let path = &agent.path;
+ let value = sqlx::query_scalar!(
+ "SELECT value AS \"value: sqlx::types::Json\"
+ FROM resource WHERE workspace_id = $1 AND path = $2 AND resource_type = 'ai_agent'",
+ w_id,
+ path,
+ )
+ .fetch_optional(&mut **tx)
+ .await?
+ .ok_or_else(|| {
+ Error::PermissionDenied(format!(
+ "Agent {path} does not exist or is not readable by you"
+ ))
+ })?;
+ if agent.bound_inputs.is_empty() {
+ continue;
+ }
+ let tools: Vec = value
+ .and_then(|v| v.0.get("tools").cloned())
+ .map(serde_json::from_value)
+ .transpose()
+ .map_err(|e| Error::BadRequest(format!("Invalid tools in agent {path}: {e}")))?
+ .unwrap_or_default();
+ windmill_common::flows::check_bound_agent_inputs_are_open(
+ path,
+ &tools,
+ &agent.bound_inputs,
+ )?;
+ }
+
+ // A tag is how a step picks the worker group it runs on: unauthorized, a builder could route
+ // a job onto a privileged one.
+ refs.tags.extend(flow_tag.clone().filter(|t| !t.is_empty()));
+ if !refs.tags.is_empty() {
+ // Job-aware: a WM_TOKEN running as a superadmin must not unlock restricted tags.
+ let is_super_admin = is_super_admin_authed(db, authed).await?;
+ for tag in &refs.tags {
+ windmill_common::jobs::check_tag_available_for_workspace_internal(
+ db,
+ w_id,
+ tag,
+ None,
+ std::future::ready(w_id.to_string()),
+ is_super_admin,
+ get_scope_tags(authed),
+ )
+ .await?;
+ }
+ }
+
+ if refs.runnables.is_empty() && refs.pinned_scripts.is_empty() {
+ return Ok(());
+ }
+ // A flow can step through the same script thirty times; this runs on every write, preview and
+ // dependency job.
+ refs.runnables.sort();
+ refs.runnables.dedup();
+ refs.pinned_scripts
+ .sort_by_key(|(path, hash)| (path.clone(), hash.0));
+ refs.pinned_scripts
+ .dedup_by_key(|(path, hash)| (path.clone(), hash.0));
+ // The worker resolves a step's path with the root DB handle and runs it as that runnable's
+ // `on_behalf_of`, so composing an unreadable path would run code the builder cannot see. RLS
+ // on this transaction is the check.
+ for (is_flow, path) in &refs.runnables {
+ let readable = if *is_flow {
+ sqlx::query_scalar!(
+ "SELECT EXISTS(SELECT 1 FROM flow WHERE workspace_id = $1 AND path = $2)",
+ w_id,
+ path,
+ )
+ } else {
+ sqlx::query_scalar!(
+ "SELECT EXISTS(SELECT 1 FROM script WHERE workspace_id = $1 AND path = $2)",
+ w_id,
+ path,
+ )
+ }
+ .fetch_one(&mut **tx)
+ .await?
+ .unwrap_or(false);
+ if !readable {
+ return Err(Error::PermissionDenied(format!(
+ "{} {path} does not exist or is not readable by you",
+ if *is_flow { "Flow" } else { "Script" }
+ )));
+ }
+ }
+ // A pinned step is dispatched by its hash alone, ignoring the path beside it, so a readable
+ // path paired with another script's hash would still run that other script.
+ for (path, hash) in &refs.pinned_scripts {
+ let exists = sqlx::query_scalar!(
+ "SELECT EXISTS(SELECT 1 FROM script WHERE workspace_id = $1 AND path = $2 AND hash = $3)",
+ w_id,
+ path,
+ hash.0,
+ )
+ .fetch_one(&mut **tx)
+ .await?
+ .unwrap_or(false);
+ if !exists {
+ return Err(Error::PermissionDenied(format!(
+ "Version {hash} is not a readable version of {path}"
+ )));
+ }
+ }
+ Ok(())
+}
+
+/// What a restricted role must pass to store an `ai_agent` resource, deployed or as a draft. Its
+/// tools run in the agent's own runs and in every flow step linking it, so it is held to the rules
+/// of a composed flow, under the same capability. `tx` is the write's own, begun as the caller.
+pub async fn validate_operator_agent(
+ value: &serde_json::Value,
+ authed: &ApiAuthed,
+ db: &DB,
+ tx: &mut Transaction<'_, Postgres>,
+ w_id: &str,
+) -> error::Result<()> {
+ if check_operator_can_build(db, w_id, authed, BuilderKind::Flows, "write AI agents").await?
+ == AuthorLevel::Full
+ {
+ return Ok(());
+ }
+ let tools = value
+ .get("tools")
+ .cloned()
+ .unwrap_or_else(|| serde_json::json!([]));
+ let flow: FlowValue = serde_json::from_value(serde_json::json!({"modules": [{
+ "id": "agent",
+ "value": {"type": "aiagent", "input_transforms": {}, "tools": tools}
+ }]}))
+ .map_err(|e| Error::BadRequest(format!("Invalid agent tools: {e}")))?;
+ authorize_composed_flow(&flow, &None, authed, db, tx, w_id)
+ .await
+ .map_err(|e| match e {
+ Error::PermissionDenied(msg) => {
+ Error::PermissionDenied(msg.replace("edit this flow", "edit this agent"))
+ }
+ e => e,
+ })
+}
diff --git a/backend/windmill-api-auth/src/lib.rs b/backend/windmill-api-auth/src/lib.rs
index 30c3bb65af..6a09710b5e 100644
--- a/backend/windmill-api-auth/src/lib.rs
+++ b/backend/windmill-api-auth/src/lib.rs
@@ -7,6 +7,7 @@
*/
pub mod auth;
+pub mod composed;
#[cfg(feature = "private")]
pub mod ee;
pub mod ee_oss;
@@ -590,7 +591,9 @@ pub fn ensure_scopes_within_caller(
for requested in requested_restrictions {
if requested.starts_with("mcp:") {
- if !caller_mcp.contains(requested.as_str()) {
+ // `mcp:session` (windmill_mcp's SESSION_SCOPE) grants nothing: it only picks
+ // the toolset an `mcp:all` token gets, and `mcp:all` is matched here itself.
+ if requested != "mcp:session" && !caller_mcp.contains(requested.as_str()) {
return Err(Error::PermissionDenied(format!(
"A scope-restricted token cannot grant MCP scope '{requested}' unless the \
caller holds the same scope verbatim"
@@ -943,7 +946,7 @@ pub async fn gate_operator_writes(
let w_id = params.get("workspace_id").ok_or_else(|| {
Error::internal_err("operator write gate layered outside a workspaced router".to_string())
})?;
- check_operator_can_manage(&db, w_id, authed.is_operator, kind).await?;
+ check_operator_can_manage(&db, w_id, &authed, kind).await?;
Ok(next.run(Request::from_parts(parts, body)).await)
}
@@ -1963,6 +1966,11 @@ mod tests {
opt_scopes(Some(vec!["mcp:scripts:*"])).as_deref()
)
.is_err());
+ assert!(ensure_scopes_within_caller(
+ &mcp_all,
+ opt_scopes(Some(vec!["mcp:all", "mcp:session"])).as_deref()
+ )
+ .is_ok());
}
#[test]
diff --git a/backend/windmill-api-configs/src/lib.rs b/backend/windmill-api-configs/src/lib.rs
index 890a561679..8336888088 100644
--- a/backend/windmill-api-configs/src/lib.rs
+++ b/backend/windmill-api-configs/src/lib.rs
@@ -35,6 +35,7 @@ pub fn global_service() -> Router {
"/list_autoscaling_events/{worker_group}",
get(list_autoscaling_events),
)
+ .route("/test_autoscaling/{worker_group}", post(test_autoscaling))
.route(
"/native_kubernetes_autoscaling_healthcheck",
get(native_kubernetes_autoscaling_healthcheck),
@@ -224,13 +225,15 @@ async fn update_config(
#[cfg(not(feature = "enterprise"))]
let config = if name.starts_with("worker__") {
- // In CE, only allow setting worker_tags, cache_clear, init_bash, native_mode and paused
+ // In CE, only allow setting worker_tags, cache_clear, init_bash, native_mode, paused and
+ // disable_job_proxy
serde_json::json!({
"worker_tags": config.get("worker_tags"),
"cache_clear": config.get("cache_clear"),
"init_bash": config.get("init_bash"),
"native_mode": config.get("native_mode"),
- "paused": config.get("paused")
+ "paused": config.get("paused"),
+ "disable_job_proxy": config.get("disable_job_proxy")
})
} else {
config
@@ -417,6 +420,48 @@ async fn native_kubernetes_autoscaling_healthcheck() -> Result<(), error::Error>
))
}
+#[derive(Serialize)]
+struct TestAutoscalingResponse {
+ job_id: Option,
+}
+
+#[cfg(all(feature = "enterprise", feature = "private"))]
+async fn test_autoscaling(
+ authed: ApiAuthed,
+ Extension(db): Extension,
+ Path(worker_group): Path,
+ Json(test): Json,
+) -> error::JsonResult {
+ require_devops_role(&db, &authed).await?;
+ audit_log(
+ &db,
+ &authed,
+ "worker_config.test_autoscaling",
+ ActionKind::Execute,
+ "global",
+ Some(&worker_group),
+ None,
+ )
+ .await?;
+ let job_id = windmill_autoscaling::autoscaling_ee::test_autoscaling(
+ &db,
+ &worker_group,
+ test,
+ &authed.email,
+ )
+ .await?;
+ Ok(Json(TestAutoscalingResponse {
+ job_id: job_id.map(|id| id.to_string()),
+ }))
+}
+
+#[cfg(not(all(feature = "enterprise", feature = "private")))]
+async fn test_autoscaling() -> error::JsonResult {
+ Err(error::Error::BadRequest(
+ "Autoscaling available only in the enterprise version".to_string(),
+ ))
+}
+
async fn list_available_python_versions() -> error::JsonResult> {
#[cfg(not(all(feature = "python", feature = "run_inline")))]
return Err(error::Error::BadRequest(
diff --git a/backend/windmill-api-flow-conversations/src/lib.rs b/backend/windmill-api-flow-conversations/src/lib.rs
index 7320721ea5..2ed3531cca 100644
--- a/backend/windmill-api-flow-conversations/src/lib.rs
+++ b/backend/windmill-api-flow-conversations/src/lib.rs
@@ -14,7 +14,7 @@ pub use windmill_common::flow_conversations::FlowConversation;
use windmill_common::{
db::{UserDB, DB},
error::{JsonResult, Result},
- flow_conversations::{running_turns, MessageType, RunningTurn},
+ flow_conversations::{running_turns, MessageType, RunningTurn, ANONYMOUS_CONVERSATION_OWNER},
utils::{not_found_if_none, paginate, truncate_with_ellipsis, Pagination},
};
@@ -96,7 +96,8 @@ async fn list_conversations(
"created_by",
"is_test",
])
- .and_where_eq("workspace_id", "?".bind(&w_id));
+ .and_where_eq("workspace_id", "?".bind(&w_id))
+ .and_where_ne("created_by", "?".bind(&ANONYMOUS_CONVERSATION_OWNER));
if let Some(flow_path) = &query.flow_path {
sqlb.and_where_eq("flow_path", "?".bind(flow_path));
diff --git a/backend/windmill-api-flows/src/flows.rs b/backend/windmill-api-flows/src/flows.rs
index fe4d8c37d4..5d4268a93c 100644
--- a/backend/windmill-api-flows/src/flows.rs
+++ b/backend/windmill-api-flows/src/flows.rs
@@ -16,9 +16,10 @@ use axum::{
};
use windmill_api_auth::{
auth::{list_tokens_internal, TruncatedTokenWithEmail},
- build_scope_path_predicate, check_scopes, get_scope_tags, maybe_refresh_folders,
- require_owner_of_path, ApiAuthed,
+ build_scope_path_predicate, check_scopes, maybe_refresh_folders, require_owner_of_path,
+ ApiAuthed,
};
+use windmill_common::roles::AuthorLevel;
use windmill_common::workspaces::{
check_deploy_rules, check_operator_can_build, operator_builder_rights, BuilderKind,
RuleCheckResult,
@@ -133,6 +134,17 @@ async fn list_search_flows(
Ok(Json(rows))
}
+/// `WHERE` condition matching one label, directly on the flow or inherited from its folder.
+///
+/// The template has two `?`, so both are filled in a single `binds` pass. Chaining `bind`
+/// would not work: `bind` replaces the first `?` of the string *as it is at that moment*,
+/// so the second call would find the `?` that the first call inserted as part of the bound
+/// value and substitute there, leaving the value partly outside its quotes.
+fn label_condition(label: &str) -> String {
+ "(o.labels @> ARRAY[?] OR folder_labels(o.workspace_id, o.path) @> ARRAY[?])"
+ .binds(&[&label.trim()])
+}
+
async fn list_flows(
authed: ApiAuthed,
Extension(user_db): Extension,
@@ -216,11 +228,7 @@ async fn list_flows(
}
if let Some(label) = &lq.label {
for l in label.split(',') {
- sqlb.and_where(
- "(o.labels @> ARRAY[?] OR folder_labels(o.workspace_id, o.path) @> ARRAY[?])"
- .bind(&l.trim())
- .bind(&l.trim()),
- );
+ sqlb.and_where(label_condition(l));
}
}
@@ -244,7 +252,7 @@ async fn list_flows(
// Append the authed user's drafts at paths with no deployed flow; see scripts.rs.
if lq.include_draft_only.unwrap_or(false)
- && (!authed.is_operator || operator_builder_rights(&db, &w_id).await?.flows)
+ && operator_builder_rights(&db, &w_id, &authed).await?.flows
&& offset == 0
&& lq.path_start.is_none()
&& lq.path_exact.is_none()
@@ -576,6 +584,7 @@ async fn list_paths_linking_agent(
async fn validate_flow(
new_flow: &NewFlow,
+ flows_level: AuthorLevel,
authed: &ApiAuthed,
db: &DB,
user_db: &UserDB,
@@ -591,7 +600,7 @@ async fn validate_flow(
guard_flow_from_debounce_data(new_flow).await?;
- if authed.is_operator {
+ if flows_level == AuthorLevel::Compose {
validate_operator_flow(
&new_flow.parse_flow_value()?,
&new_flow.tag,
@@ -641,85 +650,11 @@ pub async fn validate_operator_composed_flow(
user_db: &UserDB,
w_id: &str,
) -> error::Result<()> {
- let mut refs = windmill_common::flows::check_flow_is_composition_only(value)?;
-
- // A tag is how a step picks the worker group it runs on: unauthorized, a builder could route
- // a job onto a privileged one.
- refs.tags.extend(flow_tag.clone().filter(|t| !t.is_empty()));
- if !refs.tags.is_empty() {
- // Job-aware: a WM_TOKEN running as a superadmin must not unlock restricted tags.
- let is_super_admin = windmill_api_auth::is_super_admin_authed(db, authed).await?;
- for tag in &refs.tags {
- windmill_common::jobs::check_tag_available_for_workspace_internal(
- db,
- w_id,
- tag,
- None,
- std::future::ready(w_id.to_string()),
- is_super_admin,
- get_scope_tags(authed),
- )
- .await?;
- }
- }
-
- if refs.runnables.is_empty() && refs.pinned_scripts.is_empty() {
- return Ok(());
- }
- // A flow can step through the same script thirty times; this runs on every write, preview and
- // dependency job.
- refs.runnables.sort();
- refs.runnables.dedup();
- refs.pinned_scripts
- .sort_by_key(|(path, hash)| (path.clone(), hash.0));
- refs.pinned_scripts
- .dedup_by_key(|(path, hash)| (path.clone(), hash.0));
- // The worker resolves a step's path with the root DB handle and runs it as that runnable's
- // `on_behalf_of`, so composing an unreadable path would run code the builder cannot see. RLS
- // on this transaction is the check.
let mut tx = user_db.clone().begin(authed).await?;
- for (is_flow, path) in &refs.runnables {
- let readable = if *is_flow {
- sqlx::query_scalar!(
- "SELECT EXISTS(SELECT 1 FROM flow WHERE workspace_id = $1 AND path = $2)",
- w_id,
- path,
- )
- } else {
- sqlx::query_scalar!(
- "SELECT EXISTS(SELECT 1 FROM script WHERE workspace_id = $1 AND path = $2)",
- w_id,
- path,
- )
- }
- .fetch_one(&mut *tx)
- .await?
- .unwrap_or(false);
- if !readable {
- return Err(Error::PermissionDenied(format!(
- "{} {path} does not exist or is not readable by you",
- if *is_flow { "Flow" } else { "Script" }
- )));
- }
- }
- // A pinned step is dispatched by its hash alone, ignoring the path beside it, so a readable
- // path paired with another script's hash would still run that other script.
- for (path, hash) in &refs.pinned_scripts {
- let exists = sqlx::query_scalar!(
- "SELECT EXISTS(SELECT 1 FROM script WHERE workspace_id = $1 AND path = $2 AND hash = $3)",
- w_id,
- path,
- hash.0,
- )
- .fetch_one(&mut *tx)
- .await?
- .unwrap_or(false);
- if !exists {
- return Err(Error::PermissionDenied(format!(
- "Version {hash} is not a readable version of {path}"
- )));
- }
- }
+ windmill_api_auth::composed::authorize_composed_flow(
+ value, flow_tag, authed, db, &mut tx, w_id,
+ )
+ .await?;
tx.commit().await?;
Ok(())
}
@@ -732,14 +667,8 @@ async fn create_flow(
Path(w_id): Path,
Json(mut nf): Json,
) -> Result<(StatusCode, String)> {
- check_operator_can_build(
- &db,
- &w_id,
- authed.is_operator,
- BuilderKind::Flows,
- "create flows",
- )
- .await?;
+ let flows_level =
+ check_operator_can_build(&db, &w_id, &authed, BuilderKind::Flows, "create flows").await?;
check_scopes(&authed, || format!("flows:write:{}", nf.path))?;
// A `<= 0` flow timeout is "unset", not a 0-second limit that kills every run instantly.
@@ -759,7 +688,7 @@ async fn create_flow(
return Err(Error::PermissionDenied(msg));
}
- validate_flow(&nf, &authed, &db, &user_db, &w_id).await?;
+ validate_flow(&nf, flows_level, &authed, &db, &user_db, &w_id).await?;
if *CLOUD_HOSTED {
let nb_flows =
sqlx::query_scalar!("SELECT COUNT(*) FROM flow WHERE workspace_id = $1", &w_id)
@@ -1354,14 +1283,8 @@ async fn update_flow(
Path((w_id, flow_path)): Path<(String, StripPath)>,
Json(ef): Json,
) -> Result {
- check_operator_can_build(
- &db,
- &w_id,
- authed.is_operator,
- BuilderKind::Flows,
- "update flows",
- )
- .await?;
+ let flows_level =
+ check_operator_can_build(&db, &w_id, &authed, BuilderKind::Flows, "update flows").await?;
let flow_path = flow_path.to_path();
// The URL identifies the flow being updated; the body path is only needed to rename.
let mut nf = ef.into_new_flow(flow_path);
@@ -1388,7 +1311,7 @@ async fn update_flow(
return Err(Error::PermissionDenied(msg));
}
- validate_flow(&nf, &authed, &db, &user_db, &w_id).await?;
+ validate_flow(&nf, flows_level, &authed, &db, &user_db, &w_id).await?;
let authed = maybe_refresh_folders(&flow_path, &w_id, authed, &db).await;
// Before `tx` opens, for the reason given in `create_flow`.
@@ -2056,14 +1979,7 @@ async fn archive_flow_by_path(
Path((w_id, path)): Path<(String, StripPath)>,
Json(archived): Json,
) -> Result {
- check_operator_can_build(
- &db,
- &w_id,
- authed.is_operator,
- BuilderKind::Flows,
- "archive flows",
- )
- .await?;
+ check_operator_can_build(&db, &w_id, &authed, BuilderKind::Flows, "archive flows").await?;
let path = path.to_path();
check_scopes(&authed, || format!("flows:write:{}", path))?;
if let RuleCheckResult::Blocked(msg) = check_deploy_rules(
@@ -2204,14 +2120,7 @@ async fn delete_flow_by_path(
Path((w_id, path)): Path<(String, StripPath)>,
Query(query): Query,
) -> Result {
- check_operator_can_build(
- &db,
- &w_id,
- authed.is_operator,
- BuilderKind::Flows,
- "delete flows",
- )
- .await?;
+ check_operator_can_build(&db, &w_id, &authed, BuilderKind::Flows, "delete flows").await?;
let path = path.to_path();
check_scopes(&authed, || format!("flows:write:{}", path))?;
if let RuleCheckResult::Blocked(msg) = check_deploy_rules(
@@ -2382,6 +2291,31 @@ mod tests {
const SECOND: Duration = Duration::from_secs(1);
+ #[test]
+ fn label_condition_fills_both_placeholders_in_one_pass() {
+ // Ordinary label: unchanged behaviour, the value appears quoted in both positions.
+ assert_eq!(
+ super::label_condition(" finance "),
+ "(o.labels @> ARRAY['finance'] OR folder_labels(o.workspace_id, o.path) @> ARRAY['finance'])"
+ );
+
+ // A `?` in the label must stay inside the quoted literal in both positions and must
+ // not leave a placeholder behind. With chained `bind`s this produced
+ // `ARRAY['a'a?b'b'] ... ARRAY[?]`, i.e. label text outside the quotes.
+ let cond = super::label_condition("a?b");
+ assert_eq!(
+ cond,
+ "(o.labels @> ARRAY['a?b'] OR folder_labels(o.workspace_id, o.path) @> ARRAY['a?b'])"
+ );
+ assert!(!cond.contains("ARRAY[?]"));
+
+ // Single quotes keep being escaped by doubling.
+ assert_eq!(
+ super::label_condition("a'?b"),
+ "(o.labels @> ARRAY['a''?b'] OR folder_labels(o.workspace_id, o.path) @> ARRAY['a''?b'])"
+ );
+ }
+
#[test]
fn flowmodule_serde() {
let fv = FlowValue {
diff --git a/backend/windmill-api-groups/src/granular_acls.rs b/backend/windmill-api-groups/src/granular_acls.rs
index f7c3398adc..c867e89a60 100644
--- a/backend/windmill-api-groups/src/granular_acls.rs
+++ b/backend/windmill-api-groups/src/granular_acls.rs
@@ -117,7 +117,7 @@ async fn add_granular_acl(
}
if let Some(manage_kind) = manage_kind_for_acl_kind(kind) {
- check_operator_can_manage(&db, &w_id, authed.is_operator, manage_kind).await?;
+ check_operator_can_manage(&db, &w_id, &authed, manage_kind).await?;
}
let identifier = if kind == "group_" || kind == "folder" || kind == "volume" {
@@ -368,7 +368,7 @@ async fn remove_granular_acl(
}
if let Some(manage_kind) = manage_kind_for_acl_kind(kind) {
- check_operator_can_manage(&db, &w_id, authed.is_operator, manage_kind).await?;
+ check_operator_can_manage(&db, &w_id, &authed, manage_kind).await?;
}
if !authed.is_admin {
diff --git a/backend/windmill-api-groups/src/groups.rs b/backend/windmill-api-groups/src/groups.rs
index 860e486a75..0d3b5e360d 100644
--- a/backend/windmill-api-groups/src/groups.rs
+++ b/backend/windmill-api-groups/src/groups.rs
@@ -218,12 +218,13 @@ pub async fn require_is_owner(
}
async fn _check_nb_of_groups(db: &DB) -> Result<()> {
- let nb_groups = sqlx::query_scalar!("SELECT COUNT(*) FROM group_ WHERE name != 'all' AND name != 'error_handler' AND name != 'slack' AND name != 'wm_deployers'",)
+ // Groups that back workspace settings do not count toward the limit.
+ let nb_groups = sqlx::query_scalar!("SELECT COUNT(*) FROM group_ WHERE name != 'all' AND name != 'error_handler' AND name != 'slack' AND name != 'wm_deployers' AND name != 'variable_expiration_handler'",)
.fetch_one(db)
.await?;
if nb_groups.unwrap_or(0) >= 3 {
return Err(Error::BadRequest(
- "You have reached the maximum number of groups (3 outside of native groups 'all', 'slack', 'error_handler' and 'wm_deployers') without an enterprise license"
+ "You have reached the maximum number of groups (3 outside of native groups 'all', 'slack', 'error_handler', 'wm_deployers' and 'variable_expiration_handler') without an enterprise license"
.to_string(),
));
}
diff --git a/backend/windmill-api-integration-tests/tests/agent_on_behalf_of.rs b/backend/windmill-api-integration-tests/tests/agent_on_behalf_of.rs
index 628614056c..540282de9a 100644
--- a/backend/windmill-api-integration-tests/tests/agent_on_behalf_of.rs
+++ b/backend/windmill-api-integration-tests/tests/agent_on_behalf_of.rs
@@ -153,6 +153,10 @@ async fn test_agent_run_identity_and_needs_read(db: Pool) -> anyhow::R
for raw in [
r#"{"user_message":"$var:u/test-user-3/secret"}"#,
r#"{"user_message":"\u0024var:u/test-user-3/secret"}"#,
+ // Resolved once a step combines it with an argument holding a reference.
+ r#"{"user_message":"$WM_TOKEN"}"#,
+ // jsonb drops the undecodable duplicate and keeps the reference.
+ r#"{"user_message":{"n":1e400,"n":0,"r":"\u0024var:u/test-user-3/secret"}}"#,
] {
let resp = reqwest::Client::new()
.post(format!("{base_url}/w/test-workspace/{run}"))
@@ -163,6 +167,14 @@ async fn test_agent_run_identity_and_needs_read(db: Pool) -> anyhow::R
.await?;
assert_eq!(resp.status().as_u16(), 400, "a reference in {raw}");
}
+ let (status, body) = post(
+ &base_url,
+ "SECRET_TOKEN_2",
+ &run,
+ json!({ "user_message": {"$match": {"currency": "$USD", "_id": "$category"}} }),
+ )
+ .await?;
+ assert_eq!(status, 201, "nothing the worker resolves: {body}");
// The run takes its conversation outside the caller's row policy, so a reader must not
// continue another user's conversation; an admin still may, as the policy allows.
diff --git a/backend/windmill-api-integration-tests/tests/datatable_roles.rs b/backend/windmill-api-integration-tests/tests/datatable_roles.rs
index 764cc3ac04..e1623ef901 100644
--- a/backend/windmill-api-integration-tests/tests/datatable_roles.rs
+++ b/backend/windmill-api-integration-tests/tests/datatable_roles.rs
@@ -1737,7 +1737,7 @@ async fn an_operator_neither_writes_nor_runs_a_migration(db: Pool) ->
let status = resp.status();
let text = resp.text().await?;
assert!(
- status == 401 && text.contains("Operators cannot"),
+ status == 403 && text.contains("Your role cannot"),
"{status}: {text}"
);
}
diff --git a/backend/windmill-api-integration-tests/tests/drafts.rs b/backend/windmill-api-integration-tests/tests/drafts.rs
index f45ffb3f8e..0d1e3c9185 100644
--- a/backend/windmill-api-integration-tests/tests/drafts.rs
+++ b/backend/windmill-api-integration-tests/tests/drafts.rs
@@ -143,6 +143,12 @@ async fn test_update_draft_write_authorization(db: Pool) -> anyhow::Re
.send()
.await?;
assert_eq!(r.status(), 200, "own namespace allowed");
+ let r = user2
+ .post(save_url(port, "data_pipeline", "u/test-user-2/pipeline"))
+ .json(&json!({ "value": { "a": 1 } }))
+ .send()
+ .await?;
+ assert_eq!(r.status(), 200, "a developer saves data pipeline drafts");
// Another user's namespace, no grant → rejected.
let r = user2
@@ -166,6 +172,16 @@ async fn test_update_draft_write_authorization(db: Pool) -> anyhow::Re
.send()
.await?;
assert_eq!(r.status(), 403, "operator rejected");
+ let r = op
+ .post(save_url(port, "data_pipeline", "u/test-user-3/pipeline"))
+ .json(&json!({ "value": { "a": 1 } }))
+ .send()
+ .await?;
+ assert_eq!(
+ r.status(),
+ 403,
+ "a role that cannot code has no pipeline drafts"
+ );
Ok(())
}
diff --git a/backend/windmill-api-integration-tests/tests/jobs_authed.rs b/backend/windmill-api-integration-tests/tests/jobs_authed.rs
index 2c5d2ee78e..2592ecdf7a 100644
--- a/backend/windmill-api-integration-tests/tests/jobs_authed.rs
+++ b/backend/windmill-api-integration-tests/tests/jobs_authed.rs
@@ -626,10 +626,9 @@ async fn test_resolve_completed_jobs_scoping(db: Pool) -> anyhow::Resu
.json(&json!({ "job_ids": [mine] }))
.send()
.await?;
- // Error::NotAuthorized maps to 401 (403 is RequireAdmin/PermissionDenied).
assert_eq!(
resp.status().as_u16(),
- 401,
+ 403,
"operators must be refused: {}",
resp.text().await?
);
diff --git a/backend/windmill-api-integration-tests/tests/native_triggers.rs b/backend/windmill-api-integration-tests/tests/native_triggers.rs
index e7f0147323..285d560588 100644
--- a/backend/windmill-api-integration-tests/tests/native_triggers.rs
+++ b/backend/windmill-api-integration-tests/tests/native_triggers.rs
@@ -14,6 +14,7 @@ use sqlx::{Pool, Postgres};
use axum::http::StatusCode;
use windmill_api_auth::{ApiAuthed, ScopePathFilter};
use windmill_common::{
+ db::UserDB,
error::Error,
variables::{build_crypt, encrypt},
};
@@ -22,12 +23,13 @@ use windmill_native_triggers::{
get_workspace_integration,
github::GitHub,
google::{parse_stop_channel_params, should_renew_channel},
- grant_refused, http_error_status, list_native_triggers, map_external_error,
- native_trigger_is_enabled,
+ grant_refused, http_error_status, list_native_triggers, list_usable_connections,
+ map_external_error, native_trigger_is_enabled,
nextcloud::NextCloud,
- require_native_integration_use, set_native_trigger_enabled, store_native_trigger,
- store_workspace_integration, update_native_trigger, External, ExternalReadFailure,
- HttpRequestError, NativeTriggerConfig, OAuthConfig, ServiceName,
+ require_native_integration_use, resolve_usable_connection, set_native_trigger_enabled,
+ store_native_trigger, store_workspace_integration, update_native_trigger,
+ update_oauth_token_resource, External, ExternalReadFailure, HttpRequestError,
+ NativeTriggerConfig, OAuthConfig, ServiceName,
};
// ============================================================================
@@ -133,7 +135,6 @@ async fn setup_oauth_integration(
"test-workspace",
service_name,
oauth_data,
- Some(resource_path),
)
.await?;
tx.commit().await?;
@@ -149,73 +150,125 @@ fn now_ms() -> i64 {
}
// ============================================================================
-// 1. Resource Path Change
+// 1. Several connections of one service
// ============================================================================
+/// Each connection keeps its own tokens: a refresh written back for one, or disconnecting one,
+/// must not touch another. Providers that rotate refresh tokens invalidate the old one, so a
+/// refresh token copied onto the wrong account breaks that account's next refresh.
#[sqlx::test(migrations = "../migrations", fixtures("base"))]
-async fn test_resource_path_change(db: Pool) -> anyhow::Result<()> {
- let path_a = "u/test-user/native_gworkspace";
- setup_oauth_integration(
+async fn test_connections_are_isolated(db: Pool) -> anyhow::Result<()> {
+ let path_a = "u/test-user/native_nextcloud";
+ let path_b = "u/other-user/native_nextcloud";
+ let mut account_a = 0;
+ for (path, token) in [(path_a, "a"), (path_b, "b")] {
+ let account = setup_oauth_integration(
+ &db,
+ ServiceName::Nextcloud,
+ path,
+ &format!("access-{token}"),
+ &format!("refresh-{token}"),
+ None,
+ )
+ .await?;
+ if path == path_a {
+ account_a = account;
+ }
+ }
+
+ update_oauth_token_resource(
&db,
- ServiceName::Google,
- path_a,
- "token-a",
- "refresh-a",
- None,
- )
- .await?;
-
- // Verify decrypt works at path A
- let config: OAuthConfig =
- decrypt_oauth_data(&db, "test-workspace", ServiceName::Google).await?;
- assert_eq!(config.access_token, "token-a");
-
- // Cleanup old path
- let mut tx = db.begin().await?;
- windmill_native_triggers::workspace_integrations::cleanup_oauth_resource(
- &mut *tx,
"test-workspace",
- ServiceName::Google,
+ account_a,
+ "access-a2",
+ Some("refresh-a2"),
)
.await;
- tx.commit().await?;
- // Recreate at path B
- let path_b = "u/test-user/native_gworkspace_v2";
- setup_oauth_integration(
- &db,
- ServiceName::Google,
- path_b,
- "token-b",
- "refresh-b",
- None,
+ let a: OAuthConfig =
+ decrypt_oauth_data(&db, "test-workspace", ServiceName::Nextcloud, Some(path_a)).await?;
+ let b: OAuthConfig =
+ decrypt_oauth_data(&db, "test-workspace", ServiceName::Nextcloud, Some(path_b)).await?;
+ assert_eq!(
+ (a.access_token.as_str(), a.refresh_token.as_deref()),
+ ("access-a2", Some("refresh-a2"))
+ );
+ assert_eq!(
+ (b.access_token.as_str(), b.refresh_token.as_deref()),
+ ("access-b", Some("refresh-b"))
+ );
+
+ let mut tx = db.begin().await?;
+ windmill_native_triggers::workspace_integrations::cleanup_connection(
+ &mut *tx,
+ "test-workspace",
+ path_a,
)
.await?;
+ tx.commit().await?;
- // Path A resources should be gone
- let var_count: i64 = sqlx::query_scalar!(
- "SELECT count(*) FROM variable WHERE workspace_id = 'test-workspace' AND path = $1",
- path_a,
+ assert!(decrypt_oauth_data::(
+ &db,
+ "test-workspace",
+ ServiceName::Nextcloud,
+ Some(path_a)
)
- .fetch_one(&db)
- .await?
- .unwrap_or(0);
- assert_eq!(var_count, 0, "variable at old path should be deleted");
+ .await
+ .is_err());
+ let b: OAuthConfig =
+ decrypt_oauth_data(&db, "test-workspace", ServiceName::Nextcloud, Some(path_b)).await?;
+ assert_eq!(b.refresh_token.as_deref(), Some("refresh-b"));
- let res_count: i64 = sqlx::query_scalar!(
- "SELECT count(*) FROM resource WHERE workspace_id = 'test-workspace' AND path = $1",
- path_a,
+ Ok(())
+}
+
+/// A member who cannot read the admin's connection may still use it once it is shared as the
+/// workspace connection.
+#[sqlx::test(migrations = "../migrations", fixtures("base"))]
+async fn test_workspace_connection_usable_by_members(db: Pool) -> anyhow::Result<()> {
+ let path = "u/test-user/native_nextcloud";
+ setup_oauth_integration(&db, ServiceName::Nextcloud, path, "a", "r", None).await?;
+ let member = ApiAuthed {
+ email: "test2@windmill.dev".to_string(),
+ username: "test-user-2".to_string(),
+ is_admin: false,
+ ..test_authed()
+ };
+ let usable_paths = || async {
+ let mut tx = UserDB::new(db.clone()).begin(&member).await?;
+ let connections =
+ list_usable_connections(&db, &mut tx, "test-workspace", ServiceName::Nextcloud).await?;
+ tx.commit().await?;
+ anyhow::Ok(
+ connections
+ .into_iter()
+ .map(|c| (c.path, c.workspace))
+ .collect::>(),
+ )
+ };
+
+ assert!(usable_paths().await?.is_empty());
+
+ sqlx::query(
+ "UPDATE workspace_integrations SET resource_path = $1
+ WHERE workspace_id = 'test-workspace' AND service_name = 'nextcloud'",
)
- .fetch_one(&db)
- .await?
- .unwrap_or(0);
- assert_eq!(res_count, 0, "resource at old path should be deleted");
+ .bind(path)
+ .execute(&db)
+ .await?;
+ assert_eq!(usable_paths().await?, vec![(path.to_string(), true)]);
- // Path B should work
- let config: OAuthConfig =
- decrypt_oauth_data(&db, "test-workspace", ServiceName::Google).await?;
- assert_eq!(config.access_token, "token-b");
- assert_eq!(config.refresh_token.as_deref(), Some("refresh-b"));
+ // Clients and specs that predate connections name none: they keep getting the shared
+ // account once the member also has their own.
+ let own = "u/test-user-2/native_nextcloud";
+ setup_oauth_integration(&db, ServiceName::Nextcloud, own, "b", "s", None).await?;
+ let mut tx = UserDB::new(db.clone()).begin(&member).await?;
+ let default =
+ resolve_usable_connection(&db, &mut tx, "test-workspace", ServiceName::Nextcloud, None)
+ .await?;
+ tx.commit().await?;
+ assert_eq!(usable_paths().await?.len(), 2);
+ assert_eq!(default, path);
Ok(())
}
@@ -237,8 +290,13 @@ async fn test_decrypt_workspace_level(db: Pool) -> anyhow::Result<()>
)
.await?;
- let config: OAuthConfig =
- decrypt_oauth_data(&db, "test-workspace", ServiceName::Google).await?;
+ let config: OAuthConfig = decrypt_oauth_data(
+ &db,
+ "test-workspace",
+ ServiceName::Google,
+ Some(resource_path),
+ )
+ .await?;
assert_eq!(config.access_token, "ws-access-token");
assert_eq!(config.refresh_token.as_deref(), Some("ws-refresh-token"));
@@ -282,8 +340,13 @@ async fn test_decrypt_instance_level(db: Pool) -> anyhow::Result<()> {
)
.await?;
- let config: OAuthConfig =
- decrypt_oauth_data(&db, "test-workspace", ServiceName::Google).await?;
+ let config: OAuthConfig = decrypt_oauth_data(
+ &db,
+ "test-workspace",
+ ServiceName::Google,
+ Some(resource_path),
+ )
+ .await?;
assert_eq!(config.client_id, "instance-client-id");
assert_eq!(config.client_secret, "instance-client-secret");
@@ -306,8 +369,13 @@ async fn test_token_update_persists(db: Pool) -> anyhow::Result<()> {
.await?;
// Verify old tokens
- let config: OAuthConfig =
- decrypt_oauth_data(&db, "test-workspace", ServiceName::Google).await?;
+ let config: OAuthConfig = decrypt_oauth_data(
+ &db,
+ "test-workspace",
+ ServiceName::Google,
+ Some(resource_path),
+ )
+ .await?;
assert_eq!(config.access_token, "old-access-token");
// Simulate token refresh: update variable + account
@@ -330,8 +398,13 @@ async fn test_token_update_persists(db: Pool) -> anyhow::Result<()> {
.await?;
// Verify new tokens
- let config: OAuthConfig =
- decrypt_oauth_data(&db, "test-workspace", ServiceName::Google).await?;
+ let config: OAuthConfig = decrypt_oauth_data(
+ &db,
+ "test-workspace",
+ ServiceName::Google,
+ Some(resource_path),
+ )
+ .await?;
assert_eq!(config.access_token, "new-access-token");
assert_eq!(config.refresh_token.as_deref(), Some("new-refresh-token"));
@@ -342,24 +415,57 @@ async fn test_token_update_persists(db: Pool) -> anyhow::Result<()> {
// 3. Channel Expiration Renewal — should_renew_channel
// ============================================================================
-#[test]
-fn test_require_native_integration_use_blocks_operators() {
- // Regression: the integration *use* routes (calendar/drive/repo/event pickers)
- // must reject read-only operators, who cannot create native triggers and so
- // must not be able to drive the admin-configured integration's upstream API.
+#[sqlx::test(migrations = "../migrations", fixtures("base", "permissions_test"))]
+async fn test_require_native_integration_use_needs_code_and_manage_triggers(
+ db: Pool,
+) -> anyhow::Result<()> {
+ // The pickers drive the admin-connected account's upstream API: the default operator, which
+ // may manage triggers but not write code, must stay locked out of them.
+ windmill_common::roles::invalidate_all_roles_cache();
let mut operator = test_authed();
+ operator.username = "operator".to_string();
operator.is_admin = false;
operator.is_operator = true;
- assert!(require_native_integration_use(&operator).is_err());
+ assert!(
+ require_native_integration_use(&db, "test-workspace", &operator)
+ .await
+ .is_err()
+ );
- // A regular non-admin author (the population that configures triggers) is allowed.
- let mut author = test_authed();
- author.is_admin = false;
- author.is_operator = false;
- assert!(require_native_integration_use(&author).is_ok());
+ let set_override = |caps: &'static str| {
+ let db = db.clone();
+ async move {
+ sqlx::query(
+ "UPDATE workspace_settings SET role_overrides = jsonb_build_object('operator',
+ jsonb_build_object('capabilities', $1::jsonb))
+ WHERE workspace_id = 'test-workspace'",
+ )
+ .bind(caps)
+ .execute(&db)
+ .await
+ .unwrap();
+ windmill_common::roles::invalidate_all_roles_cache();
+ }
+ };
+ set_override(r#"{"code": true}"#).await;
+ assert!(
+ require_native_integration_use(&db, "test-workspace", &operator)
+ .await
+ .is_ok()
+ );
+ set_override(r#"{"code": true, "manage_triggers": false}"#).await;
+ assert!(
+ require_native_integration_use(&db, "test-workspace", &operator)
+ .await
+ .is_err()
+ );
- // Admins are allowed.
- assert!(require_native_integration_use(&test_authed()).is_ok());
+ assert!(
+ require_native_integration_use(&db, "test-workspace", &test_authed())
+ .await
+ .is_ok()
+ );
+ Ok(())
}
#[test]
@@ -458,6 +564,7 @@ async fn test_delete_integration_full_cascade(db: Pool) -> anyhow::Res
json!({"triggerType": "drive"}),
None,
true,
+ "u/test-user/native_conn",
)
.await?;
@@ -468,12 +575,12 @@ async fn test_delete_integration_full_cascade(db: Pool) -> anyhow::Res
// Step 2: Cleanup OAuth resources
let mut tx = db.begin().await?;
- windmill_native_triggers::workspace_integrations::cleanup_oauth_resource(
+ windmill_native_triggers::workspace_integrations::cleanup_service_connections(
&mut *tx,
"test-workspace",
ServiceName::Google,
)
- .await;
+ .await?;
tx.commit().await?;
// Step 3: Delete workspace integration
@@ -549,17 +656,18 @@ async fn test_cleanup_preserves_triggers(db: Pool) -> anyhow::Result<(
json!({"triggerType": "drive"}),
None,
true,
+ "u/test-user/native_conn",
)
.await?;
// Cleanup OAuth only — should NOT remove the trigger
let mut tx = db.begin().await?;
- windmill_native_triggers::workspace_integrations::cleanup_oauth_resource(
+ windmill_native_triggers::workspace_integrations::cleanup_connection(
&mut *tx,
"test-workspace",
- ServiceName::Google,
+ resource_path,
)
- .await;
+ .await?;
tx.commit().await?;
// OAuth resources gone
@@ -607,6 +715,7 @@ async fn test_rename_moves_native_trigger(db: Pool) -> anyhow::Result<
json!({"event": "OCP\\Files\\Events\\Node\\NodeCreatedEvent"}),
None,
true,
+ "u/test-user/native_conn",
)
.await?;
// An unrelated trigger already sitting on the target path must not be reported as moved.
@@ -624,6 +733,7 @@ async fn test_rename_moves_native_trigger(db: Pool) -> anyhow::Result<
json!({"event": "OCP\\Files\\Events\\Node\\NodeCreatedEvent"}),
None,
true,
+ "u/test-user/native_conn",
)
.await?;
@@ -696,6 +806,7 @@ async fn test_list_native_triggers_scope_filter(db: Pool) -> anyhow::R
json!({"event": "OCP\\Files\\Events\\Node\\NodeCreatedEvent"}),
None,
true,
+ "u/test-user/native_conn",
)
.await?;
}
@@ -801,7 +912,7 @@ fn test_provider_rejection_is_readable_and_not_internal() {
"the envelope should not reach the user: {message}"
);
assert!(
- message.contains("Workspace settings > Integrations"),
+ message.contains("the workspace's shared account"),
"the hint should say what to do: {message}"
);
}
@@ -931,6 +1042,7 @@ async fn test_native_trigger_enabled_toggle(db: Pool) -> anyhow::Resul
json!({"event": "OCA\\Files\\Event\\LoadAdditionalScriptsEvent"}),
None,
true,
+ "u/test-user/native_conn",
)
.await?;
@@ -980,6 +1092,7 @@ async fn test_native_trigger_enabled_toggle(db: Pool) -> anyhow::Resul
json!({}),
None,
false,
+ "u/test-user/native_conn",
)
.await?;
assert!(
@@ -997,6 +1110,7 @@ async fn test_native_trigger_enabled_toggle(db: Pool) -> anyhow::Resul
json!({}),
None,
true,
+ "u/test-user/native_conn",
)
.await?;
assert!(
diff --git a/backend/windmill-api-integration-tests/tests/operator_builder_apps.rs b/backend/windmill-api-integration-tests/tests/operator_builder_apps.rs
index 7033d093f2..71a7a2b8fa 100644
--- a/backend/windmill-api-integration-tests/tests/operator_builder_apps.rs
+++ b/backend/windmill-api-integration-tests/tests/operator_builder_apps.rs
@@ -1,7 +1,6 @@
use serde_json::json;
use serial_test::serial;
use sqlx::{Pool, Postgres};
-use windmill_common::workspaces::invalidate_operator_rights_cache;
use windmill_test_utils::*;
/// Every test here must be `#[serial]`: the rights cache is process-global and keyed by workspace id
@@ -22,16 +21,18 @@ fn client(token: &str) -> reqwest::Client {
async fn set_builder(db: &Pool, flows: bool, apps: bool) -> anyhow::Result<()> {
sqlx::query(
- "UPDATE workspace_settings SET operator_settings = $1::text::jsonb WHERE workspace_id = $2",
+ "UPDATE workspace_settings SET role_overrides = $1::text::jsonb WHERE workspace_id = $2",
)
.bind(format!(
- r#"{{"builder_flows": {flows}, "builder_apps": {apps}}}"#
+ r#"{{"operator": {{"capabilities": {{"flows": "{}", "apps": "{}"}}}}}}"#,
+ if flows { "compose" } else { "none" },
+ if apps { "compose" } else { "none" },
))
.bind(WS)
.execute(db)
.await?;
// The rights are read through a process-global 60s cache keyed by workspace id.
- invalidate_operator_rights_cache(WS);
+ windmill_common::roles::invalidate_all_roles_cache();
Ok(())
}
diff --git a/backend/windmill-api-integration-tests/tests/operator_builder_flows.rs b/backend/windmill-api-integration-tests/tests/operator_builder_flows.rs
index 7be3920124..6bed27eca5 100644
--- a/backend/windmill-api-integration-tests/tests/operator_builder_flows.rs
+++ b/backend/windmill-api-integration-tests/tests/operator_builder_flows.rs
@@ -1,6 +1,5 @@
use serde_json::json;
use sqlx::{Pool, Postgres};
-use windmill_common::workspaces::invalidate_operator_rights_cache;
use windmill_test_utils::*;
const WS: &str = "test-workspace";
@@ -19,14 +18,17 @@ fn operator_client() -> reqwest::Client {
async fn set_builder(db: &Pool, flows: bool) -> anyhow::Result<()> {
sqlx::query(
- "UPDATE workspace_settings SET operator_settings = $1::text::jsonb WHERE workspace_id = $2",
+ "UPDATE workspace_settings SET role_overrides = $1::text::jsonb WHERE workspace_id = $2",
)
- .bind(format!(r#"{{"builder_flows": {flows}}}"#))
+ .bind(format!(
+ r#"{{"operator": {{"capabilities": {{"flows": "{}"}}}}}}"#,
+ if flows { "compose" } else { "none" }
+ ))
.bind(WS)
.execute(db)
.await?;
// The right is read through a process-global 60s cache keyed by workspace id.
- invalidate_operator_rights_cache(WS);
+ windmill_common::roles::invalidate_all_roles_cache();
Ok(())
}
@@ -115,6 +117,16 @@ async fn test_operator_builder_flows_boundary(db: Pool) -> anyhow::Res
.send()
.await?;
assert_eq!(resp.status(), 200, "{}", resp.text().await?);
+ let notified: Vec =
+ sqlx::query_scalar("SELECT payload FROM notify_event WHERE channel = $1")
+ .bind(windmill_common::roles::ROLE_OVERRIDES_CHANGE_CHANNEL)
+ .fetch_all(&db)
+ .await?;
+ assert_eq!(
+ notified,
+ vec![WS.to_string()],
+ "other replicas drop their cached roles only through this event"
+ );
let resp = c
.post(format!("{api}/flows/create"))
@@ -313,5 +325,155 @@ async fn test_operator_builder_flows_boundary(db: Pool) -> anyhow::Res
resp.text().await?
);
+ check_builder_agents(&db, &api, &c).await
+}
+
+/// An agent is a resource an operator may otherwise write, and its stored tools run as they are,
+/// so only the flow right opens it, and every write of one, drafts included, is checked like a
+/// composed flow. Part of the boundary test: the right is read through a process-global cache
+/// keyed by workspace id, which a second test in this binary would race.
+async fn check_builder_agents(
+ db: &Pool,
+ api: &str,
+ c: &reqwest::Client,
+) -> anyhow::Result<()> {
+ let tool = |mut value: serde_json::Value| {
+ value["tool_type"] = json!("flowmodule");
+ value["input_transforms"] = json!({});
+ json!({"tools": [{"id": "t", "summary": "t", "value": value}]})
+ };
+ let composed = tool(json!({"type": "script", "path": "u/operator/some_script"}));
+ let inline = tool(json!({"type": "rawscript", "content": "echo x", "language": "bash"}));
+ let agent = |path: &str, value: &serde_json::Value| json!({"path": path, "resource_type": "ai_agent", "value": value});
+
+ set_builder(db, false).await?;
+ let resp = c
+ .post(format!("{api}/resources/create"))
+ .json(&agent("u/operator/a1", &composed))
+ .send()
+ .await?;
+ assert_eq!(
+ resp.status(),
+ 403,
+ "an operator without the builder right must not write an agent"
+ );
+
+ set_builder(db, true).await?;
+ let resp = c
+ .post(format!("{api}/resources/create"))
+ .json(&agent("u/operator/a1", &inline))
+ .send()
+ .await?;
+ assert_eq!(
+ resp.status(),
+ 403,
+ "a builder must not save an agent with an inline tool"
+ );
+ let resp = c
+ .post(format!("{api}/resources/create"))
+ .json(&agent("u/operator/a1", &composed))
+ .send()
+ .await?;
+ assert_eq!(resp.status(), 201, "{}", resp.text().await?);
+ let resp = c
+ .post(format!("{api}/resources/update_value/u/operator/a1"))
+ .json(&json!({"value": inline}))
+ .send()
+ .await?;
+ assert_eq!(
+ resp.status(),
+ 403,
+ "a builder must not swap an agent's tools for inline code"
+ );
+ // A draft of a deployed agent may leave its type to the deployed row.
+ let resp = c
+ .post(format!("{api}/drafts/update/resource/u/operator/a1"))
+ .json(&json!({"value": {"args": inline, "description": ""}, "force": true}))
+ .send()
+ .await?;
+ assert_eq!(
+ resp.status(),
+ 403,
+ "a builder must not draft an agent with an inline tool"
+ );
+ // Deploying a draft over an agent keeps the row's type, whatever type the draft names.
+ let resp = c
+ .post(format!("{api}/drafts/update/resource/u/operator/a1"))
+ .json(&json!({"value": {"args": inline, "description": "", "resource_type": "object"},
+ "force": true}))
+ .send()
+ .await?;
+ assert_eq!(
+ resp.status(),
+ 403,
+ "a builder must not draft inline tools over an agent under another type"
+ );
+
+ let linking = |path: &str, agent: &str| {
+ json!({"path": path, "summary": "", "description": "", "schema": {},
+ "value": {"modules": [{"id": "a", "value": {"type": "aiagent",
+ "input_transforms": {}, "tools": [], "agent": format!("$res:{agent}")}}]}})
+ };
+ let resp = c
+ .post(format!("{api}/flows/create"))
+ .json(&linking("u/operator/agent_f1", "u/operator/a1"))
+ .send()
+ .await?;
+ assert!(
+ resp.status().is_success(),
+ "a builder must be able to link a readable agent: {}",
+ resp.text().await?
+ );
+ let resp = c
+ .post(format!("{api}/flows/create"))
+ .json(&linking("u/operator/agent_f2", "u/alice/agent"))
+ .send()
+ .await?;
+ assert_eq!(
+ resp.status(),
+ 403,
+ "a builder must not link an agent it cannot read"
+ );
+
+ // A developer's agent may run inline code, and linking it runs it as authored. A step may bind
+ // the inputs the agent leaves to the model, never one its author set.
+ let mut dev_agent = inline.clone();
+ dev_agent["tools"][0]["value"]["input_transforms"] = json!({
+ "set": {"type": "static", "value": "fixed"}, "open": {"type": "ai"}});
+ sqlx::query(
+ "INSERT INTO resource (workspace_id, path, value, resource_type, created_by)
+ VALUES ($1, 'u/operator/dev_agent', $2, 'ai_agent', 'alice')",
+ )
+ .bind(WS)
+ .bind(&dev_agent)
+ .execute(db)
+ .await?;
+ let binding = |path: &str, input: &str| {
+ let mut flow = linking(path, "u/operator/dev_agent");
+ flow["value"]["modules"][0]["value"]["tool_inputs"] =
+ json!({"t": {input: {"type": "static", "value": "bound"}}});
+ flow
+ };
+ let resp = c
+ .post(format!("{api}/flows/create"))
+ .json(&binding("u/operator/agent_f4", "open"))
+ .send()
+ .await?;
+ assert!(
+ resp.status().is_success(),
+ "a builder must be able to bind an input the agent leaves open: {}",
+ resp.text().await?
+ );
+ let resp = c
+ .post(format!("{api}/flows/create"))
+ .json(&binding("u/operator/agent_f3", "set"))
+ .send()
+ .await?;
+ assert_eq!(
+ resp.status(),
+ 403,
+ "a builder must not override an input the agent's author set"
+ );
+
Ok(())
}
diff --git a/backend/windmill-api-integration-tests/tests/operator_manage_rights.rs b/backend/windmill-api-integration-tests/tests/operator_manage_rights.rs
index 22901d1c87..dbc5f36e01 100644
--- a/backend/windmill-api-integration-tests/tests/operator_manage_rights.rs
+++ b/backend/windmill-api-integration-tests/tests/operator_manage_rights.rs
@@ -1,7 +1,6 @@
use serde_json::json;
use serial_test::serial;
use sqlx::{Pool, Postgres};
-use windmill_common::workspaces::invalidate_operator_rights_cache;
use windmill_test_utils::*;
/// Every test here must be `#[serial]`, and start by dropping the cache entry. The rights cache is
@@ -44,7 +43,7 @@ async fn set_settings(api: &str, body: serde_json::Value) -> anyhow::Result
.send()
.await?;
let status = resp.status().as_u16();
- invalidate_operator_rights_cache(WS);
+ windmill_common::roles::invalidate_all_roles_cache();
Ok(status)
}
@@ -53,7 +52,7 @@ async fn set_settings(api: &str, body: serde_json::Value) -> anyhow::Result
#[serial]
async fn test_operator_manage_rights(db: Pool) -> anyhow::Result<()> {
initialize_tracing().await;
- invalidate_operator_rights_cache(WS);
+ windmill_common::roles::invalidate_all_roles_cache();
let server = ApiServer::start(db.clone()).await?;
let port = server.addr.port();
let api = format!("http://localhost:{port}/api/w/{WS}");
@@ -146,7 +145,7 @@ async fn test_manage_triggers_covers_a_route_outside_the_shared_handler(
db: Pool,
) -> anyhow::Result<()> {
initialize_tracing().await;
- invalidate_operator_rights_cache(WS);
+ windmill_common::roles::invalidate_all_roles_cache();
let server = ApiServer::start(db.clone()).await?;
let port = server.addr.port();
let api = format!("http://localhost:{port}/api/w/{WS}");
@@ -223,7 +222,7 @@ async fn test_manage_triggers_covers_a_route_outside_the_shared_handler(
#[serial]
async fn test_manage_rights_admit_matching_drafts(db: Pool) -> anyhow::Result<()> {
initialize_tracing().await;
- invalidate_operator_rights_cache(WS);
+ windmill_common::roles::invalidate_all_roles_cache();
let server = ApiServer::start(db.clone()).await?;
let port = server.addr.port();
let api = format!("http://localhost:{port}/api/w/{WS}");
@@ -253,7 +252,9 @@ async fn test_manage_rights_admit_matching_drafts(db: Pool) -> anyhow:
};
let resp = c
- .post(format!("{api}/drafts/update/trigger_schedule/u/operator/sched_draft"))
+ .post(format!(
+ "{api}/drafts/update/trigger_schedule/u/operator/sched_draft"
+ ))
.json(&json!({ "value": {
"path": "u/operator/sched_draft",
"schedule": "0 0 12 * * *",
@@ -315,7 +316,7 @@ async fn test_manage_rights_admit_matching_drafts(db: Pool) -> anyhow:
#[serial]
async fn test_operators_draft_resources_and_variables(db: Pool) -> anyhow::Result<()> {
initialize_tracing().await;
- invalidate_operator_rights_cache(WS);
+ windmill_common::roles::invalidate_all_roles_cache();
let server = ApiServer::start(db.clone()).await?;
let port = server.addr.port();
let api = format!("http://localhost:{port}/api/w/{WS}");
@@ -405,3 +406,62 @@ async fn test_operators_draft_resources_and_variables(db: Pool) -> any
Ok(())
}
+
+/// The two endpoints that make the API server run `pg_dump`/`psql` against a database a request
+/// names are closed to a role that cannot run code.
+///
+/// Both polarities on each route: a 403 alone would equally be a route that does not exist or one
+/// refusing the source for some other reason, and the admin's 400 shows the gate is about the role
+/// rather than the request. The source is deliberately unresolvable, so the gate is the only thing
+/// that can answer 403 and no database is ever reached.
+#[sqlx::test(migrations = "../migrations", fixtures("base", "permissions_test"))]
+#[serial]
+async fn test_dumping_a_database_needs_the_code_right(db: Pool) -> anyhow::Result<()> {
+ initialize_tracing().await;
+ windmill_common::roles::invalidate_all_roles_cache();
+ let server = ApiServer::start(db.clone()).await?;
+ let port = server.addr.port();
+ let api = format!("http://localhost:{port}/api/w/{WS}");
+
+ let cases = [
+ (
+ "workspaces/export_pg_schema",
+ json!({"source": "u/operator/not-a-source"}),
+ "export a database schema",
+ ),
+ (
+ "workspaces/import_pg_database",
+ json!({"source": "u/operator/not-a-source", "target": "u/operator/not-a-source",
+ "fork_behavior": "schema_only"}),
+ "import a database",
+ ),
+ ];
+
+ for (route, body, action) in cases {
+ let resp = operator_client()
+ .post(format!("{api}/{route}"))
+ .json(&body)
+ .send()
+ .await?;
+ let status = resp.status();
+ let text = resp.text().await?;
+ assert_eq!(status, 403, "{route}: {text}");
+ assert!(
+ text.contains(&format!("Your role cannot {action} in this workspace")),
+ "{route} refused for another reason: {text}"
+ );
+
+ let resp = reqwest::Client::new()
+ .post(format!("{api}/{route}"))
+ .header("Authorization", "Bearer SECRET_TOKEN")
+ .json(&body)
+ .send()
+ .await?;
+ let status = resp.status();
+ let text = resp.text().await?;
+ assert_eq!(status, 400, "{route}: {text}");
+ assert!(text.contains("Invalid source format"), "{route}: {text}");
+ }
+
+ Ok(())
+}
diff --git a/backend/windmill-api-integration-tests/tests/users.rs b/backend/windmill-api-integration-tests/tests/users.rs
index 56656e54dd..3a52e94e4a 100644
--- a/backend/windmill-api-integration-tests/tests/users.rs
+++ b/backend/windmill-api-integration-tests/tests/users.rs
@@ -1046,3 +1046,117 @@ async fn test_impersonation_session_is_never_refreshed(db: Pool) -> an
Ok(())
}
+
+#[cfg(all(feature = "enterprise", feature = "private"))]
+#[sqlx::test(migrations = "../migrations", fixtures("base"))]
+async fn test_set_password_revokes_mcp_oauth_grants(db: Pool) -> anyhow::Result<()> {
+ initialize_tracing().await;
+ let server = ApiServer::start(db.clone()).await?;
+
+ sqlx::raw_sql(
+ "INSERT INTO mcp_oauth_server_client (client_id, client_name, redirect_uris)
+ VALUES ('mcp-client', 'MCP client', ARRAY['http://localhost/cb']);
+ INSERT INTO token (token_hash, token_prefix, email, label, expiration)
+ VALUES (encode(sha256('MCP_ACCESS_TOKEN'::bytea), 'hex'), 'MCP_ACCESS', 'test2@windmill.dev',
+ 'mcp-oauth-mcp-client', now() + interval '7 days'),
+ (encode(sha256('OTHER_MCP_TOKEN'::bytea), 'hex'), 'OTHER_MCP_', 'test3@windmill.dev',
+ 'mcp-oauth-mcp-client', now() + interval '7 days');
+ INSERT INTO mcp_oauth_refresh_token
+ (refresh_token, access_token_hash, client_id, user_email, workspace_id, scopes, token_family, expires_at)
+ VALUES ('test2-refresh', encode(sha256('MCP_ACCESS_TOKEN'::bytea), 'hex'), 'mcp-client',
+ 'test2@windmill.dev', 'test-workspace', ARRAY['mcp:all'], gen_random_uuid(), now() + interval '30 days'),
+ ('test3-refresh', encode(sha256('OTHER_MCP_TOKEN'::bytea), 'hex'), 'mcp-client',
+ 'test3@windmill.dev', 'test-workspace', ARRAY['mcp:all'], gen_random_uuid(), now() + interval '30 days');
+ INSERT INTO mcp_oauth_server_code (code, client_id, user_email, workspace_id, scopes, redirect_uri)
+ VALUES ('test2-code', 'mcp-client', 'test2@windmill.dev', 'test-workspace', ARRAY['mcp:all'],
+ 'http://localhost/cb');",
+ )
+ .execute(&db)
+ .await?;
+
+ // A refresh in flight: it holds the grant lock and writes its rotated tokens while the
+ // password change is waiting on that lock.
+ let mut grant = db.begin().await?;
+ sqlx::query("SELECT pg_advisory_xact_lock_shared(hashtext('mcp_oauth_grant:' || $1))")
+ .bind("test2@windmill.dev")
+ .execute(&mut *grant)
+ .await?;
+ let request = tokio::spawn(
+ authed(client().post(format!(
+ "http://localhost:{}/api/users/set_password_of/test2@windmill.dev",
+ server.addr.port()
+ )))
+ .json(&json!({"password": "new-test-password-123"}))
+ .send(),
+ );
+ let mut waiting = false;
+ for _ in 0..100 {
+ waiting = sqlx::query_scalar(
+ "SELECT EXISTS(SELECT 1 FROM pg_locks WHERE locktype = 'advisory' AND NOT granted
+ AND database = (SELECT oid FROM pg_database WHERE datname = current_database()))",
+ )
+ .fetch_one(&db)
+ .await?;
+ if waiting {
+ break;
+ }
+ tokio::time::sleep(std::time::Duration::from_millis(100)).await;
+ }
+ assert!(
+ waiting,
+ "the password change never waited on the grant lock"
+ );
+ sqlx::raw_sql(
+ "INSERT INTO token (token_hash, token_prefix, email, label, expiration)
+ VALUES (encode(sha256('MCP_ROTATED_TOKEN'::bytea), 'hex'), 'MCP_ROTATE', 'test2@windmill.dev',
+ 'mcp-oauth-mcp-client', now() + interval '7 days');
+ INSERT INTO mcp_oauth_refresh_token
+ (refresh_token, access_token_hash, client_id, user_email, workspace_id, scopes, token_family, expires_at)
+ VALUES ('test2-rotated', encode(sha256('MCP_ROTATED_TOKEN'::bytea), 'hex'), 'mcp-client',
+ 'test2@windmill.dev', 'test-workspace', ARRAY['mcp:all'], gen_random_uuid(), now() + interval '30 days');",
+ )
+ .execute(&mut *grant)
+ .await?;
+ grant.commit().await?;
+
+ let resp = request.await??;
+ assert_eq!(resp.status(), 200, "{}", resp.text().await?);
+
+ let labels: Vec<(String, String)> = sqlx::query_as(
+ "SELECT email, label FROM token WHERE email IN ('test2@windmill.dev', 'test3@windmill.dev') ORDER BY email, label",
+ )
+ .fetch_all(&db)
+ .await?;
+ assert_eq!(
+ labels,
+ vec![
+ ("test2@windmill.dev".to_string(), "test token 2".to_string()),
+ (
+ "test3@windmill.dev".to_string(),
+ "mcp-oauth-mcp-client".to_string()
+ ),
+ ("test3@windmill.dev".to_string(), "test token 3".to_string()),
+ ]
+ );
+ let refresh: Vec = sqlx::query_scalar(
+ "SELECT refresh_token FROM mcp_oauth_refresh_token ORDER BY refresh_token",
+ )
+ .fetch_all(&db)
+ .await?;
+ assert_eq!(refresh, vec!["test3-refresh".to_string()]);
+ let invalidated: Vec = sqlx::query_scalar(
+ "SELECT payload FROM notify_event WHERE channel = 'notify_token_invalidation' ORDER BY payload",
+ )
+ .fetch_all(&db)
+ .await?;
+ assert_eq!(
+ invalidated,
+ vec!["MCP_ACCESS".to_string(), "MCP_ROTATE".to_string()]
+ );
+ let codes: i64 = sqlx::query_scalar("SELECT count(*) FROM mcp_oauth_server_code")
+ .fetch_one(&db)
+ .await?;
+ assert_eq!(codes, 0);
+
+ Ok(())
+}
diff --git a/backend/windmill-api-integration-tests/tests/variables.rs b/backend/windmill-api-integration-tests/tests/variables.rs
index e5018f4f97..adb9f29c36 100644
--- a/backend/windmill-api-integration-tests/tests/variables.rs
+++ b/backend/windmill-api-integration-tests/tests/variables.rs
@@ -338,3 +338,133 @@ async fn test_variables_are_cached(db: Pool) -> anyhow::Result<()> {
Ok(())
}
+
+/// A draft-only row is built field by field, so a forgotten field is dropped silently.
+#[sqlx::test(migrations = "../migrations", fixtures("base"))]
+async fn test_draft_only_row_carries_value_valid_until(db: Pool) -> anyhow::Result<()> {
+ initialize_tracing().await;
+ let server = ApiServer::start(db.clone()).await?;
+ let port = server.addr.port();
+
+ authed(client().post(format!(
+ "http://localhost:{port}/api/w/test-workspace/drafts/update/variable/u/test-user/draft_var"
+ )))
+ .json(&json!({
+ "value": {
+ "path": "u/test-user/draft_var",
+ "variable": { "value": "x", "is_secret": true, "description": "" },
+ "wsSpecific": false,
+ "value_valid_until": "2027-03-15T08:00:00Z"
+ }
+ }))
+ .send()
+ .await?;
+
+ let resp = authed(client().get(format!(
+ "http://localhost:{port}/api/w/test-workspace/variables/list?include_draft_only=true"
+ )))
+ .send()
+ .await?;
+ assert_eq!(resp.status(), 200);
+ let rows = resp.json::>().await?;
+
+ let row = rows
+ .iter()
+ .find(|v| v["path"] == "u/test-user/draft_var")
+ .expect("draft-only row is listed");
+ assert_eq!(row["draft_only"], true);
+ assert_eq!(row["value_valid_until"], "2027-03-15T08:00:00Z");
+
+ Ok(())
+}
+
+/// An expiry on an OAuth-linked variable is refused with a readable error, not a raw
+/// constraint violation.
+#[sqlx::test(migrations = "../migrations", fixtures("base"))]
+async fn test_oauth_variable_refuses_value_expiry(db: Pool) -> anyhow::Result<()> {
+ initialize_tracing().await;
+ let server = ApiServer::start(db.clone()).await?;
+ let port = server.addr.port();
+
+ sqlx::query(
+ "WITH a AS (INSERT INTO account (workspace_id, expires_at, refresh_token, client)
+ VALUES ('test-workspace', now() + interval '1 hour', 'r', 'github') RETURNING id)
+ INSERT INTO variable (workspace_id, path, value, is_secret, description, account, is_oauth)
+ SELECT 'test-workspace', 'u/test-user/oauth_var', 't', false, '', id, true FROM a",
+ )
+ .execute(&db)
+ .await?;
+
+ let resp = authed(client().post(format!(
+ "http://localhost:{port}/api/w/test-workspace/variables/update/u/test-user/oauth_var"
+ )))
+ .json(&json!({ "value_valid_until": "2027-03-15T08:00:00Z" }))
+ .send()
+ .await?;
+ assert_eq!(resp.status(), 400);
+ assert!(resp.text().await?.contains("OAuth"));
+
+ Ok(())
+}
+
+/// Reading a variable linked to an OAuth account refreshes through it and returns the fresh token,
+/// so the variable endpoints must not let a caller choose the link.
+#[sqlx::test(migrations = "../migrations", fixtures("base"))]
+async fn test_variable_endpoints_ignore_account_link(db: Pool) -> anyhow::Result<()> {
+ initialize_tracing().await;
+ let server = ApiServer::start(db.clone()).await?;
+ let port = server.addr.port();
+ let base = format!("http://localhost:{port}/api/w/test-workspace/variables");
+
+ let account: i32 = sqlx::query_scalar(
+ "INSERT INTO account (workspace_id, client, expires_at, refresh_token)
+ VALUES ('test-workspace', 'github', now(), 'r') RETURNING id",
+ )
+ .fetch_one(&db)
+ .await?;
+ let link = |path: &'static str| {
+ let db = db.clone();
+ async move {
+ sqlx::query_scalar::<_, Option>(
+ "SELECT account FROM variable WHERE workspace_id = 'test-workspace' AND path = $1",
+ )
+ .bind(path)
+ .fetch_one(&db)
+ .await
+ .unwrap()
+ }
+ };
+
+ let path = "u/test-user/oauth_probe";
+ let resp = authed(client().post(format!("{base}/create")))
+ .json(
+ &json!({ "path": path, "value": "t", "is_secret": true, "description": "",
+ "is_oauth": true, "account": account }),
+ )
+ .send()
+ .await?;
+ assert_eq!(resp.status(), 201);
+ assert_eq!(link(path).await, None);
+
+ let other: i32 = sqlx::query_scalar(
+ "INSERT INTO account (workspace_id, client, expires_at, refresh_token)
+ VALUES ('test-workspace', 'github', now(), 'r') RETURNING id",
+ )
+ .fetch_one(&db)
+ .await?;
+ sqlx::query(
+ "UPDATE variable SET account = $1 WHERE workspace_id = 'test-workspace' AND path = $2",
+ )
+ .bind(account)
+ .bind(path)
+ .execute(&db)
+ .await?;
+ let resp = authed(client().post(variable_url(port, "update", path)))
+ .json(&json!({ "description": "d", "account": other }))
+ .send()
+ .await?;
+ assert_eq!(resp.status(), 200);
+ assert_eq!(link(path).await, Some(account));
+
+ Ok(())
+}
diff --git a/backend/windmill-api-integration-tests/tests/workspace_comparison.rs b/backend/windmill-api-integration-tests/tests/workspace_comparison.rs
index 1aa2bc8df2..830a29e8c2 100644
--- a/backend/windmill-api-integration-tests/tests/workspace_comparison.rs
+++ b/backend/windmill-api-integration-tests/tests/workspace_comparison.rs
@@ -2549,6 +2549,26 @@ async fn test_rename_records_the_vacated_path(db: Pool) -> anyhow::Res
"script deploy failed: {status} — {hash}"
);
parent_hash = Some(hash.trim().trim_matches('"').to_string());
+ // Each deploy tallies from its own spawned task: let the create's `write` land
+ // before the rename, or it can overwrite the `rename_from` asserted below.
+ if path == "u/admin/inline" {
+ let mut written = false;
+ for _ in 0..40 {
+ tokio::time::sleep(std::time::Duration::from_millis(50)).await;
+ written = sqlx::query_scalar!(
+ "SELECT EXISTS (SELECT 1 FROM workspace_diff
+ WHERE fork_workspace_id = 'wm-fork-renamed' AND kind = 'script'
+ AND path = 'u/admin/inline' AND fork_last_event_kind = 'write')"
+ )
+ .fetch_one(&db)
+ .await?
+ .unwrap_or(false);
+ if written {
+ break;
+ }
+ }
+ assert!(written, "the inline create should be tallied");
+ }
}
let mut vacated = None;
for _ in 0..40 {
@@ -2556,7 +2576,7 @@ async fn test_rename_records_the_vacated_path(db: Pool) -> anyhow::Res
vacated = sqlx::query!(
"SELECT fork_last_event_kind, fork_last_event_origin FROM workspace_diff
WHERE fork_workspace_id = 'wm-fork-renamed' AND kind = 'script'
- AND path = 'u/admin/inline' AND fork_last_event_kind IS NOT NULL"
+ AND path = 'u/admin/inline' AND fork_last_event_kind <> 'write'"
)
.fetch_optional(&db)
.await?;
@@ -2570,3 +2590,263 @@ async fn test_rename_records_the_vacated_path(db: Pool) -> anyhow::Res
Ok(())
}
+
+/// Regression: a resource or resource type can be stored with a NULL description while deploy
+/// writes "", so the comparison must read the two as equal or the item never settles.
+#[sqlx::test(migrations = "../migrations", fixtures("base"))]
+async fn test_compare_null_description_equals_empty(db: Pool) -> anyhow::Result<()> {
+ initialize_tracing().await;
+
+ let server = ApiServer::start(db.clone()).await?;
+ let port = server.addr.port();
+ let base_url = format!("http://localhost:{port}/api");
+ let client = windmill_api_client::create_client(
+ &format!("http://localhost:{port}"),
+ "SECRET_TOKEN".to_string(),
+ );
+
+ for q in [
+ "INSERT INTO workspace (id, name, owner, parent_workspace_id)
+ VALUES ('wm-fork-test-workspace', 'Fork', 'test-user', 'test-workspace')",
+ "INSERT INTO workspace_settings (workspace_id) VALUES ('wm-fork-test-workspace')",
+ "INSERT INTO workspace_key(workspace_id, kind, key)
+ VALUES ('wm-fork-test-workspace', 'cloud', 'test-key')",
+ "INSERT INTO resource (workspace_id, path, value, resource_type, description, created_by) VALUES
+ ('test-workspace', 'u/test-user/null_desc', '{}', 'generic', NULL, 'test-user'),
+ ('wm-fork-test-workspace', 'u/test-user/null_desc', '{}', 'generic', '', 'test-user'),
+ ('test-workspace', 'u/test-user/other_desc', '{}', 'generic', NULL, 'test-user'),
+ ('wm-fork-test-workspace', 'u/test-user/other_desc', '{}', 'generic', 'x', 'test-user')",
+ "INSERT INTO resource_type (workspace_id, name, schema, description, created_by) VALUES
+ ('test-workspace', 'null_desc_rt', '{}', NULL, 'test-user'),
+ ('wm-fork-test-workspace', 'null_desc_rt', '{}', '', 'test-user'),
+ ('test-workspace', 'other_desc_rt', '{}', NULL, 'test-user'),
+ ('wm-fork-test-workspace', 'other_desc_rt', '{}', 'x', 'test-user')",
+ "INSERT INTO workspace_diff
+ (source_workspace_id, fork_workspace_id, path, kind, ahead, behind, has_changes) VALUES
+ ('test-workspace', 'wm-fork-test-workspace', 'u/test-user/null_desc', 'resource', 1, 1, NULL),
+ ('test-workspace', 'wm-fork-test-workspace', 'u/test-user/other_desc', 'resource', 1, 1, NULL),
+ ('test-workspace', 'wm-fork-test-workspace', 'null_desc_rt', 'resource_type', 1, 1, NULL),
+ ('test-workspace', 'wm-fork-test-workspace', 'other_desc_rt', 'resource_type', 1, 1, NULL)",
+ ] {
+ sqlx::query(q).execute(&db).await?;
+ }
+
+ let comparison: serde_json::Value = client
+ .client()
+ .get(&format!(
+ "{base_url}/w/test-workspace/workspaces/compare/wm-fork-test-workspace"
+ ))
+ .send()
+ .await?
+ .json()
+ .await?;
+ let mut paths: Vec<&str> = comparison["diffs"]
+ .as_array()
+ .unwrap_or_else(|| panic!("no diffs: {comparison}"))
+ .iter()
+ .map(|d| d["path"].as_str().unwrap())
+ .collect();
+ paths.sort();
+ assert_eq!(
+ paths,
+ ["other_desc_rt", "u/test-user/other_desc"],
+ "{comparison}"
+ );
+
+ Ok(())
+}
+
+/// Runs its closure when dropped, so process-wide state is put back even when an assertion
+/// fails.
+struct OnDrop(F);
+impl Drop for OnDrop {
+ fn drop(&mut self) {
+ (self.0)()
+ }
+}
+
+/// Secrets are encrypted with a fresh nonce on every write, so a secret holding the same value on
+/// both sides must compare by plaintext, not ciphertext.
+#[sqlx::test(migrations = "../migrations", fixtures("base"))]
+async fn test_compare_secret_variables_by_value(db: Pool) -> anyhow::Result<()> {
+ initialize_tracing().await;
+
+ let server = ApiServer::start(db.clone()).await?;
+ let port = server.addr.port();
+ let client = windmill_api_client::create_client(
+ &format!("http://localhost:{port}"),
+ "SECRET_TOKEN".to_string(),
+ );
+ let base_url = format!("http://localhost:{port}/api");
+
+ let resp = client
+ .client()
+ .post(&format!(
+ "{base_url}/w/test-workspace/workspaces/create_fork"
+ ))
+ .json(&json!({ "id": "wm-fork-secrets", "name": "Secrets Fork" }))
+ .send()
+ .await?;
+ assert!(
+ resp.status().is_success(),
+ "fork creation failed: {}",
+ resp.status()
+ );
+
+ // Secrets are written in CBC, which is deterministic, until every worker reads AES-GCM.
+ use windmill_common::min_version::{MIN_VERSION, MIN_VERSION_SUPPORTS_AEAD_SECRETS};
+ let before = MIN_VERSION.load_full();
+ let _restore = OnDrop(move || MIN_VERSION.store(before.clone()));
+ MIN_VERSION.store(std::sync::Arc::new(
+ MIN_VERSION_SUPPORTS_AEAD_SECRETS.version().clone(),
+ ));
+
+ for (ws, path, value) in [
+ ("test-workspace", "u/test-user/same", "s3cret"),
+ ("wm-fork-secrets", "u/test-user/same", "s3cret"),
+ ("test-workspace", "u/test-user/different", "one"),
+ ("wm-fork-secrets", "u/test-user/different", "two"),
+ ] {
+ let resp = client
+ .client()
+ .post(&format!("{base_url}/w/{ws}/variables/create"))
+ .json(&json!({ "path": path, "value": value, "is_secret": true, "description": "" }))
+ .send()
+ .await?;
+ assert_eq!(resp.status(), 201, "{}", resp.text().await?);
+ }
+ let stored = sqlx::query_scalar!(
+ "SELECT COUNT(DISTINCT value) FROM variable WHERE path = 'u/test-user/same'"
+ )
+ .fetch_one(&db)
+ .await?;
+ assert_eq!(
+ stored,
+ Some(2),
+ "the same secret must be stored as two different ciphertexts"
+ );
+
+ // The creates above tally these rows from a spawned task that can land after the
+ // DELETE, so the plant must upsert.
+ sqlx::query!("DELETE FROM workspace_diff WHERE fork_workspace_id = 'wm-fork-secrets'")
+ .execute(&db)
+ .await?;
+ sqlx::query!(
+ "INSERT INTO workspace_diff
+ (source_workspace_id, fork_workspace_id, path, kind, ahead, behind, has_changes)
+ VALUES
+ ('test-workspace', 'wm-fork-secrets', 'u/test-user/same', 'variable', 1, 1, NULL),
+ ('test-workspace', 'wm-fork-secrets', 'u/test-user/different', 'variable', 1, 1, NULL)
+ ON CONFLICT (source_workspace_id, fork_workspace_id, path, kind)
+ DO UPDATE SET ahead = 1, behind = 1, has_changes = NULL"
+ )
+ .execute(&db)
+ .await?;
+
+ let comparison: serde_json::Value = client
+ .client()
+ .get(&format!(
+ "{base_url}/w/test-workspace/workspaces/compare/wm-fork-secrets"
+ ))
+ .send()
+ .await?
+ .json()
+ .await?;
+ let diffs = comparison["diffs"].as_array().unwrap();
+ let listed = |path: &str| {
+ diffs
+ .iter()
+ .any(|d| d["path"] == path && d["kind"] == "variable")
+ };
+
+ assert!(
+ !listed("u/test-user/same"),
+ "equal secrets must compare as unchanged: {comparison}"
+ );
+ assert!(
+ listed("u/test-user/different"),
+ "different secrets must compare as changed: {comparison}"
+ );
+
+ Ok(())
+}
+
+/// `compare_two_variables` hand-lists its columns, so a forgotten one hides that difference
+/// from the fork diff, and it can never be promoted.
+#[sqlx::test(migrations = "../migrations", fixtures("base"))]
+async fn test_compare_variables_detects_value_valid_until(db: Pool) -> anyhow::Result<()> {
+ initialize_tracing().await;
+
+ let server = ApiServer::start(db.clone()).await?;
+ let port = server.addr.port();
+ let base_url = format!("http://localhost:{port}/api");
+ let admin = windmill_api_client::create_client(
+ &format!("http://localhost:{port}"),
+ "SECRET_TOKEN".to_string(),
+ );
+
+ sqlx::query!(
+ "INSERT INTO variable (workspace_id, path, value, is_secret, description, value_valid_until)
+ VALUES ('test-workspace', 'u/admin/expiring', 'v', false, 'same', '2027-01-01T00:00:00Z')"
+ )
+ .execute(&db)
+ .await?;
+
+ let resp = admin
+ .client()
+ .post(&format!(
+ "{base_url}/w/test-workspace/workspaces/create_fork"
+ ))
+ .json(&json!({ "id": "wm-fork-expiry", "name": "Expiry Fork" }))
+ .send()
+ .await?;
+ assert!(
+ resp.status().is_success(),
+ "fork creation failed: {}",
+ resp.status()
+ );
+
+ // Before the UPDATE below overwrites it: the fork must inherit the date from the source.
+ let inherited: Option = sqlx::query_scalar(
+ "SELECT to_char(value_valid_until, 'YYYY-MM-DD') FROM variable
+ WHERE workspace_id = 'wm-fork-expiry' AND path = 'u/admin/expiring'",
+ )
+ .fetch_one(&db)
+ .await?;
+ assert_eq!(inherited.as_deref(), Some("2027-01-01"));
+
+ // Only the expiry differs.
+ sqlx::query!(
+ "UPDATE variable SET value_valid_until = '2029-12-31T00:00:00Z'
+ WHERE workspace_id = 'wm-fork-expiry' AND path = 'u/admin/expiring'"
+ )
+ .execute(&db)
+ .await?;
+
+ // Forces the endpoint to re-evaluate the pair rather than trust a cached verdict.
+ sqlx::query!(
+ "INSERT INTO workspace_diff
+ (source_workspace_id, fork_workspace_id, path, kind, ahead, behind, has_changes)
+ VALUES ('test-workspace', 'wm-fork-expiry', 'u/admin/expiring', 'variable', 0, 1, NULL)"
+ )
+ .execute(&db)
+ .await?;
+
+ let comparison = admin
+ .client()
+ .get(&format!(
+ "{base_url}/w/test-workspace/workspaces/compare/wm-fork-expiry"
+ ))
+ .send()
+ .await?
+ .json::()
+ .await?;
+
+ assert_eq!(
+ comparison["summary"]["variables_changed"].as_u64(),
+ Some(1),
+ "an expiry-only change must show as deployable: {comparison}"
+ );
+
+ Ok(())
+}
diff --git a/backend/windmill-api-integration-tests/tests/workspaces.rs b/backend/windmill-api-integration-tests/tests/workspaces.rs
index a159bf6090..de5ed4baa0 100644
--- a/backend/windmill-api-integration-tests/tests/workspaces.rs
+++ b/backend/windmill-api-integration-tests/tests/workspaces.rs
@@ -1262,5 +1262,35 @@ async fn test_admin_and_operator_are_exclusive(db: Pool) -> anyhow::Re
.await?;
assert_eq!(resp.status(), 400, "{}", resp.text().await?);
+ // Rows written before the rule can still carry both flags: the admin wins, and `whoami`
+ // says so, since the frontend hides every gated page from an operator.
+ sqlx::query(
+ "UPDATE usr SET is_admin = true, operator = true
+ WHERE workspace_id = 'test-workspace' AND username = 'operator'",
+ )
+ .execute(&db)
+ .await?;
+ let resp = client()
+ .get(format!("{api}/users/whoami"))
+ .header("Authorization", "Bearer OPERATOR_TOKEN_1")
+ .send()
+ .await?;
+ assert_eq!(resp.status(), 200);
+ let me: serde_json::Value = resp.json().await?;
+ assert_eq!(
+ (me["is_admin"].as_bool(), me["operator"].as_bool()),
+ (Some(true), Some(false))
+ );
+ let resp = client()
+ .post(format!("{api}/scripts/create"))
+ .header("Authorization", "Bearer OPERATOR_TOKEN_1")
+ .json(&json!({
+ "path": "u/operator/legacy_admin", "summary": "", "description": "",
+ "content": "export function main() {}", "language": "deno", "schema": {}
+ }))
+ .send()
+ .await?;
+ assert_eq!(resp.status(), 201, "{}", resp.text().await?);
+
Ok(())
}
diff --git a/backend/windmill-api-jobs/src/execution.rs b/backend/windmill-api-jobs/src/execution.rs
index da77acbf7c..53c318b70d 100644
--- a/backend/windmill-api-jobs/src/execution.rs
+++ b/backend/windmill-api-jobs/src/execution.rs
@@ -916,6 +916,35 @@ pub async fn handle_chat_conversation_messages(
is_test: bool,
// The run's args, for the files the message carried.
args: &HashMap>,
+) -> error::Result<()> {
+ file_chat_turn(
+ tx,
+ &authed.username,
+ authed.is_admin,
+ w_id,
+ flow_path,
+ run_query,
+ user_message_raw,
+ job_id,
+ is_test,
+ args,
+ )
+ .await
+}
+
+/// [`handle_chat_conversation_messages`] for a conversation owned by `owner`, which need not be a
+/// user: an anonymous app visitor's is owned by `ANONYMOUS_CONVERSATION_OWNER`.
+pub async fn file_chat_turn(
+ tx: &mut sqlx::Transaction<'_, sqlx::Postgres>,
+ owner: &str,
+ is_admin: bool,
+ w_id: &str,
+ flow_path: &str,
+ run_query: &RunJobQuery,
+ user_message_raw: Option<&Box>,
+ job_id: Uuid,
+ is_test: bool,
+ args: &HashMap>,
) -> error::Result<()> {
// Names the query parameter rather than the field: it is not a flow argument, and
// supplying it as one is the first thing tried on reading `memory_id is required`.
@@ -945,8 +974,8 @@ pub async fn handle_chat_conversation_messages(
tx,
w_id,
flow_path,
- &authed.username,
- authed.is_admin,
+ owner,
+ is_admin,
&user_message,
memory_id,
is_test,
diff --git a/backend/windmill-api-jobs/src/query.rs b/backend/windmill-api-jobs/src/query.rs
index 96d8ca3698..ebfc0c3725 100644
--- a/backend/windmill-api-jobs/src/query.rs
+++ b/backend/windmill-api-jobs/src/query.rs
@@ -268,9 +268,10 @@ pub fn filter_list_queue_query(
if let Some(bf) = &lq.broad_filter {
let pat = format!("%{}%", escape_ilike_pattern(bf));
+ // `binds` fills every `?` in one pass; chained `bind`s would re-scan a `?` in the bound value
sqlb.and_where(
"(runnable_path ILIKE ? OR v2_job.tag ILIKE ? OR trigger ILIKE ? OR trigger_kind::text ILIKE ?)"
- .bind(&pat).bind(&pat).bind(&pat).bind(&pat)
+ .binds(&[&pat]),
);
}
@@ -490,7 +491,7 @@ pub fn filter_list_completed_query(
}
if let Some(dt) = &lq.created_or_started_after {
let ts = dt.to_rfc3339();
- sqlb.and_where("(created_at >= ? OR started_at >= ?)".bind(&ts).bind(&ts));
+ sqlb.and_where("(created_at >= ? OR started_at >= ?)".binds(&[&ts]));
}
if let Some(dt) = &lq.created_before {
@@ -591,10 +592,11 @@ pub fn filter_list_completed_query(
if let Some(bf) = &lq.broad_filter {
let pat = format!("%{}%", escape_ilike_pattern(bf));
+ // `binds` fills every `?` in one pass; chained `bind`s would re-scan a `?` in the bound value
sqlb.and_where(
"(runnable_path ILIKE ? OR v2_job.tag ILIKE ? OR trigger ILIKE ? OR trigger_kind::text ILIKE ? \
OR EXISTS (SELECT 1 FROM unnest(v2_job.labels) lbl WHERE lbl ILIKE ?))"
- .bind(&pat).bind(&pat).bind(&pat).bind(&pat).bind(&pat)
+ .binds(&[&pat]),
);
}
@@ -945,6 +947,20 @@ mod tests {
assert!(sql.contains("'schedule'"));
}
+ #[test]
+ fn test_queue_broad_filter_with_question_mark() {
+ let lq = ListQueueQuery { broad_filter: Some("a?b".to_string()), ..empty_queue_query() };
+ let sqlb = filter_list_queue_query(
+ SqlBuilder::select_from("v2_job_queue").clone(),
+ &lq,
+ "ws",
+ false,
+ );
+ let sql = build_sql(sqlb);
+ assert_eq!(sql.matches("ILIKE '%a?b%'").count(), 4);
+ assert!(!sql.contains("ILIKE ?"));
+ }
+
// --- Completed query tests ---
#[test]
@@ -1124,4 +1140,19 @@ mod tests {
let sql = build_sql(sqlb);
assert!(sql.contains("result @>"));
}
+
+ #[test]
+ fn test_completed_broad_filter_with_question_mark() {
+ let lq =
+ ListCompletedQuery { broad_filter: Some("a?b".to_string()), ..empty_completed_query() };
+ let sqlb = filter_list_completed_query(
+ SqlBuilder::select_from("v2_job_completed").clone(),
+ &lq,
+ "ws",
+ false,
+ );
+ let sql = build_sql(sqlb);
+ assert_eq!(sql.matches("ILIKE '%a?b%'").count(), 5);
+ assert!(!sql.contains("ILIKE ?"));
+ }
}
diff --git a/backend/windmill-api-schedule/src/lib.rs b/backend/windmill-api-schedule/src/lib.rs
index fb935e0b5c..e2fa7da8fe 100644
--- a/backend/windmill-api-schedule/src/lib.rs
+++ b/backend/windmill-api-schedule/src/lib.rs
@@ -894,17 +894,18 @@ async fn list_schedule(
}
if let Some(broad_filter) = &lsq.broad_filter {
let pat = format!("%{}%", escape_ilike_pattern(broad_filter));
+ // `binds` fills every `?` in one pass; chained `bind`s would re-scan a `?` in the bound value
sqlb.and_where(
"(path ILIKE ? OR script_path ILIKE ? OR description ILIKE ? OR summary ILIKE ? OR schedule ILIKE ?)"
- .bind(&pat).bind(&pat).bind(&pat).bind(&pat).bind(&pat)
+ .binds(&[&pat]),
);
}
if let Some(label) = &lsq.label {
for l in label.split(',') {
+ // `binds` fills every `?` in one pass; chained `bind`s would re-scan a `?` in the bound value
sqlb.and_where(
"(labels @> ARRAY[?] OR folder_labels(workspace_id, path) @> ARRAY[?])"
- .bind(&l.trim())
- .bind(&l.trim()),
+ .binds(&[&l.trim()]),
);
}
}
@@ -926,13 +927,13 @@ async fn list_schedule(
&& lsq.summary.is_none()
&& lsq.broad_filter.is_none()
&& lsq.label.is_none()
- && (!authed.is_operator
- || windmill_common::workspaces::operator_can_draft(
- &db,
- &w_id,
- UserDraftItemKind::TriggerSchedule,
- )
- .await?)
+ && windmill_common::workspaces::operator_can_draft(
+ &db,
+ &w_id,
+ &authed,
+ UserDraftItemKind::TriggerSchedule,
+ )
+ .await?
{
let draft_only_rows = fetch_draft_only_list_rows(
&db,
diff --git a/backend/windmill-api-scripts/src/scripts.rs b/backend/windmill-api-scripts/src/scripts.rs
index 4bbe372254..4e8516b8ed 100644
--- a/backend/windmill-api-scripts/src/scripts.rs
+++ b/backend/windmill-api-scripts/src/scripts.rs
@@ -185,6 +185,10 @@ async fn list_scripts(
Query(pagination): Query,
Query(lq): Query,
) -> JsonResult> {
+ // A role that cannot write code lists only what it can run: no libraries, no drafts.
+ let cannot_code = !windmill_common::roles::caller_capabilities(&db, &w_id, &authed)
+ .await?
+ .code;
let (per_page, offset) = paginate_without_limits(pagination);
let mut sqlb = SqlBuilder::select_from("script as o")
.fields(&[
@@ -255,7 +259,7 @@ async fn list_scripts(
.as_ref()
.map(|x| !x.contains(&"preprocessor".to_string()))
.unwrap_or(true))
- || authed.is_operator
+ || cannot_code
{
// only include scripts that have a runnable entrypoint. Use a
// deny-list: anything that isn't a 'lib' (library script without
@@ -305,14 +309,14 @@ async fn list_scripts(
}
if let Some(label) = &lq.label {
for l in label.split(',') {
+ // `binds` fills every `?` in one pass; chained `bind`s would re-scan a `?` in the bound value
sqlb.and_where(
"(o.labels @> ARRAY[?] OR folder_labels(o.workspace_id, o.path) @> ARRAY[?])"
- .bind(&l.trim())
- .bind(&l.trim()),
+ .binds(&[&l.trim()]),
);
}
}
- if authed.is_operator {
+ if cannot_code {
sqlb.and_where_eq("kind", quote("script"));
} else if let Some(lowercased_kinds) = lowercased_kinds {
let safe_kinds = lowercased_kinds
@@ -360,7 +364,7 @@ async fn list_scripts(
// `include_draft_only` so picker callers stay deployed-only (home page opts in);
// skipped past page 0 or under any narrowing filter to keep pagination clean.
if lq.include_draft_only.unwrap_or(false)
- && !authed.is_operator
+ && !cannot_code
&& offset == 0
&& lq.path_start.is_none()
&& lq.path_exact.is_none()
@@ -1248,7 +1252,7 @@ async fn validate_dbt_relation(
/// The schema the editor would have derived from `content`, for a deploy that sends
/// none (MCP, a bare API call). `None` for a language whose parser this build lacks,
/// or code that does not parse.
-fn infer_main_schema(
+pub fn infer_main_schema(
language: &ScriptLang,
kind: Option<&ScriptKind>,
content: &str,
@@ -1352,11 +1356,7 @@ async fn create_script_internal<'c>(
Option,
Vec,
)> {
- if authed.is_operator {
- return Err(Error::NotAuthorized(
- "Operators cannot create scripts for security reasons".to_string(),
- ));
- }
+ windmill_common::workspaces::check_role_can_code(&db, &w_id, &authed, "create scripts").await?;
check_scopes(&authed, || format!("scripts:write:{}", ns.path))?;
// Normalize positive-only settings so a `<= 0` value (e.g. a CLI-pushed `0`) persists as
@@ -4086,11 +4086,8 @@ async fn archive_script_by_path(
Extension(db): Extension,
Path((w_id, path)): Path<(String, StripPath)>,
) -> Result<()> {
- if authed.is_operator {
- return Err(Error::NotAuthorized(
- "Operators cannot archive scripts for security reasons".to_string(),
- ));
- }
+ windmill_common::workspaces::check_role_can_code(&db, &w_id, &authed, "archive scripts")
+ .await?;
let path = path.to_path();
check_scopes(&authed, || format!("scripts:write:{}", path))?;
if let RuleCheckResult::Blocked(msg) = check_deploy_rules(
@@ -4182,11 +4179,8 @@ async fn archive_script_by_hash(
Extension(webhook): Extension,
Path((w_id, hash)): Path<(String, ScriptHash)>,
) -> JsonResult\n\n{#snippet header(step: string, title: string, description: string)}\n \n{/snippet}\n\n\n \n\n \n
\n {@render header('1', 'Call a backend runnable', 'Runnables are scripts that run on Windmill workers. Call them like async functions; context fields add who is calling.')}\n \n
\n
\n {#if greetError}\n {greetError} \n {:else if greeting}\n {greeting.message} \n Ran at {new Date(greeting.ran_at).toLocaleTimeString()} \n {:else}\n The result shows up here. \n {/if}\n
\n
\n const res = await backend.greet({ name }) \n \n\n
\n {@render header('2', 'Use any language', 'Each runnable picks its own language. This one is Python, called the same way.')}\n \n
\n
\n \n {statsLoading ? 'Analyzing...' : 'Analyze with Python'}\n \n
\n {#if statsError}\n
{statsError}
\n {/if}\n {#if stats}\n
\n
{stats.words} words
\n
{stats.sentences} sentences
\n
{stats.characters} characters
\n
\n {#each stats.top_words as word (word)}\n {word} \n {/each}\n
\n
\n {/if}\n
\n const stats = await backend.word_stats({ text }) \n \n\n
\n {@render header('3', 'Run jobs in the background', 'Start long jobs without blocking the UI, then poll their status. Start several at once.')}\n \n
\n Start a job \n
\n {#if jobsError}\n
{jobsError}
\n {/if}\n
\n {#each jobs as job (job.id)}\n \n {job.status} \n {job.id.slice(-8)}\n {job.seconds}s \n \n \n {:else}\n No jobs yet. \n {/each}\n \n
\n const id = await backendAsync.slow_task({ seconds })\nconst job = await getJob(id) \n \n\n
\n {@render header('4', 'Stream results', 'A runnable can yield its output bit by bit. Render it as it arrives, like an LLM answer.')}\n \n
\n \n {streaming ? 'Streaming...' : 'Start streaming'}\n \n
\n
\n {#if streamError}\n {streamError} \n {:else if streamed || streaming}\n {streamed}{#if streaming} {/if}\n {:else}\n Streamed text shows up here. \n {/if}\n
\n
\n await streamJob(id, (u) => append(u.new_result_stream)) \n \n
\n \n",
+ "/index.css": "/* The app renders inside an iframe whose host page has its own theme the\n iframe cannot read, so paint an opaque surface here: without one the host's\n background shows through and dark text lands on it unreadable. */\n:root {\n color-scheme: light;\n --bg: #f4f5f8;\n --card: #ffffff;\n --sunken: #efeff4;\n --border: #e2e3eb;\n --fg: #3d4758;\n --fg-strong: #1d2430;\n --muted: #718096;\n --accent: #5074f6;\n --accent-hover: #2c5beb;\n --accent-soft: #e8ebfb;\n --success: #15803d;\n --success-soft: #dcfce7;\n --error: #b91c1c;\n --error-soft: #fef2f2;\n --warning: #a16207;\n --warning-soft: #fef9c3;\n}\n\n@media (prefers-color-scheme: dark) {\n :root {\n color-scheme: dark;\n --bg: #242832;\n --card: #2e3441;\n --sunken: #272c35;\n --border: #3b4252;\n --fg: #d4d7dd;\n --fg-strong: #eeeff2;\n --muted: #a9b0ba;\n --accent: #7085db;\n --accent-hover: #5670d5;\n --accent-soft: #343d5c;\n --success: #86efac;\n --success-soft: #1f3a2b;\n --error: #fca5a5;\n --error-soft: #431a1a;\n --warning: #fde68a;\n --warning-soft: #3d3419;\n }\n}\n\n* {\n box-sizing: border-box;\n}\n\nbody {\n margin: 0;\n min-height: 100vh;\n background: var(--bg);\n color: var(--fg);\n font-family: Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;\n font-size: 14px;\n line-height: 1.5;\n -webkit-font-smoothing: antialiased;\n}\n\nh1,\nh2 {\n margin: 0;\n color: var(--fg-strong);\n}\n\ncode,\npre {\n font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;\n}\n\n.muted {\n color: var(--muted);\n}\n\n.error {\n color: var(--error);\n}\n\n.app {\n max-width: 1040px;\n margin: 0 auto;\n padding: 40px 20px 56px;\n}\n\n.hero {\n margin-bottom: 28px;\n}\n\n.hero h1 {\n font-size: 1.75rem;\n font-weight: 650;\n letter-spacing: -0.01em;\n margin: 8px 0 6px;\n}\n\n.hero p {\n max-width: 620px;\n margin: 0;\n}\n\n.eyebrow {\n display: inline-block;\n padding: 2px 10px;\n border-radius: 999px;\n background: var(--accent-soft);\n color: var(--accent);\n font-size: 12px;\n font-weight: 600;\n}\n\n.grid {\n display: grid;\n grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));\n gap: 16px;\n}\n\n.card {\n display: flex;\n flex-direction: column;\n background: var(--card);\n border: 1px solid var(--border);\n border-radius: 10px;\n box-shadow: 0 1px 2px rgb(16 24 40 / 0.04);\n overflow: hidden;\n}\n\n.card-header {\n display: flex;\n gap: 12px;\n padding: 18px 18px 0;\n}\n\n.card-header h2 {\n font-size: 15px;\n font-weight: 600;\n}\n\n.card-header p {\n margin: 2px 0 0;\n font-size: 13px;\n}\n\n.card-step {\n flex: none;\n display: grid;\n place-items: center;\n width: 26px;\n height: 26px;\n border-radius: 7px;\n background: var(--accent-soft);\n color: var(--accent);\n font-size: 13px;\n font-weight: 700;\n}\n\n.card-body {\n flex: 1;\n display: flex;\n flex-direction: column;\n gap: 12px;\n padding: 16px 18px 18px;\n}\n\n.snippet {\n margin: 0;\n padding: 10px 18px;\n border-top: 1px solid var(--border);\n background: var(--sunken);\n color: var(--muted);\n font-size: 12px;\n white-space: pre-wrap;\n}\n\n.row {\n display: flex;\n gap: 8px;\n}\n\ninput,\ntextarea {\n flex: 1;\n min-width: 0;\n padding: 7px 10px;\n border: 1px solid var(--border);\n border-radius: 6px;\n background: var(--card);\n color: var(--fg-strong);\n font: inherit;\n resize: vertical;\n}\n\ninput:focus,\ntextarea:focus {\n outline: 2px solid var(--accent);\n outline-offset: -1px;\n}\n\nbutton {\n padding: 7px 14px;\n border: none;\n border-radius: 6px;\n background: var(--accent);\n color: #fff;\n font: inherit;\n font-weight: 500;\n cursor: pointer;\n transition: background 0.15s;\n}\n\nbutton:hover:not(:disabled) {\n background: var(--accent-hover);\n}\n\nbutton:disabled {\n opacity: 0.6;\n cursor: default;\n}\n\n.output {\n min-height: 44px;\n padding: 11px 12px;\n border-radius: 6px;\n background: var(--sunken);\n word-break: break-word;\n}\n\n.output.error {\n background: var(--error-soft);\n}\n\n.output.stream {\n min-height: 96px;\n white-space: pre-wrap;\n}\n\n.caret {\n display: inline-block;\n width: 7px;\n height: 1em;\n margin-left: 2px;\n vertical-align: text-bottom;\n background: var(--accent);\n animation: blink 1s steps(1) infinite;\n}\n\n@keyframes blink {\n 50% {\n opacity: 0;\n }\n}\n\n.stats {\n display: grid;\n grid-template-columns: repeat(3, 1fr);\n gap: 8px;\n}\n\n.stats > div {\n display: flex;\n flex-direction: column;\n padding: 10px 12px;\n border-radius: 6px;\n background: var(--sunken);\n}\n\n.stats strong {\n font-size: 20px;\n color: var(--fg-strong);\n}\n\n.stats span {\n font-size: 12px;\n}\n\n.stats .tags {\n grid-column: 1 / -1;\n flex-direction: row;\n flex-wrap: wrap;\n gap: 6px;\n padding: 0;\n background: none;\n}\n\n.tag {\n padding: 2px 8px;\n border-radius: 999px;\n background: var(--accent-soft);\n color: var(--accent);\n}\n\n.jobs {\n display: flex;\n flex-direction: column;\n gap: 6px;\n margin: 0;\n padding: 0;\n list-style: none;\n}\n\n.jobs li {\n display: flex;\n align-items: center;\n gap: 10px;\n padding: 8px 10px;\n border-radius: 6px;\n background: var(--sunken);\n font-size: 13px;\n}\n\n.pill {\n min-width: 64px;\n padding: 1px 8px;\n border-radius: 999px;\n font-size: 12px;\n font-weight: 600;\n text-align: center;\n}\n\n.pill.queued {\n background: var(--warning-soft);\n color: var(--warning);\n}\n\n.pill.running {\n background: var(--accent-soft);\n color: var(--accent);\n}\n\n.pill.success {\n background: var(--success-soft);\n color: var(--success);\n}\n\n.pill.failure {\n background: var(--error-soft);\n color: var(--error);\n}\n\n.bar {\n flex: 1;\n height: 4px;\n border-radius: 999px;\n background: var(--border);\n overflow: hidden;\n}\n\n.bar-fill {\n width: 0;\n height: 100%;\n border-radius: inherit;\n background: var(--accent);\n}\n\n.bar-fill.running {\n animation: fill linear forwards;\n}\n\n.bar-fill.success {\n width: 100%;\n background: var(--success);\n}\n\n.bar-fill.failure {\n width: 100%;\n background: var(--error);\n}\n\n@keyframes fill {\n to {\n width: 95%;\n }\n}\n",
+ "/package.json": "{\n \"dependencies\": {\n \"svelte\": \"^5.56.8\"\n }\n}"
+ }
+ },
+ "starter_runnables": {
+ "greet": {
+ "name": "greet",
+ "fields": {
+ "username": {
+ "type": "ctx",
+ "ctx": "username"
+ }
+ },
+ "type": "inline",
+ "inlineScript": {
+ "content": "// import * as wmill from \"windmill-client\"\n\n// `username` is a context field: the app fills it with the viewer's username.\n// Direct API callers can pass any value, so don't use it for access control.\nexport async function main(name: string, username: string) {\n return {\n message: `Hello ${name}! ${username ? `You are signed in as ${username}.` : 'You are not signed in.'}`,\n ran_at: new Date().toISOString()\n }\n}\n",
+ "language": "bun",
+ "schema": {
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "properties": {
+ "name": {
+ "default": null,
+ "description": "",
+ "originalType": "string",
+ "type": "string"
+ },
+ "username": {
+ "default": null,
+ "description": "",
+ "originalType": "string",
+ "type": "string"
+ }
+ },
+ "required": [
+ "name",
+ "username"
+ ],
+ "type": "object"
+ }
+ }
+ },
+ "word_stats": {
+ "name": "word_stats",
+ "fields": {},
+ "type": "inline",
+ "inlineScript": {
+ "content": "import re\nfrom collections import Counter\n\n\ndef main(text: str):\n words = re.findall(r\"[a-z']+\", text.lower())\n top = Counter(w for w in words if len(w) > 4).most_common(5)\n return {\n \"words\": len(words),\n \"characters\": len(text),\n \"sentences\": len(re.findall(r\"[.!?]+\", text)),\n \"top_words\": [word for word, _ in top],\n }\n",
+ "language": "python3",
+ "schema": {
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "properties": {
+ "text": {
+ "default": null,
+ "description": "",
+ "originalType": "string",
+ "type": "string"
+ }
+ },
+ "required": [
+ "text"
+ ],
+ "type": "object"
+ }
+ }
+ },
+ "slow_task": {
+ "name": "slow_task",
+ "fields": {},
+ "type": "inline",
+ "inlineScript": {
+ "content": "export async function main(seconds: number) {\n await new Promise((resolve) => setTimeout(resolve, seconds * 1000))\n return `Done after ${seconds}s`\n}\n",
+ "language": "bun",
+ "schema": {
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "properties": {
+ "seconds": {
+ "default": null,
+ "description": "",
+ "originalType": "number",
+ "type": "number"
+ }
+ },
+ "required": [
+ "seconds"
+ ],
+ "type": "object"
+ }
+ }
+ },
+ "stream_text": {
+ "name": "stream_text",
+ "fields": {},
+ "type": "inline",
+ "inlineScript": {
+ "content": "// Returning an async generator streams each yielded chunk to the caller.\nexport async function main() {\n const text =\n 'Every word of this text is yielded by a Bun script as soon as it is ready, ' +\n 'and the app renders it the moment it arrives. Use the same pattern to ' +\n 'stream an LLM answer, a long report or live logs.'\n return (async function* () {\n for (const word of text.split(' ')) {\n await new Promise((resolve) => setTimeout(resolve, 60))\n yield word + ' '\n }\n })()\n}\n",
+ "language": "bun",
+ "schema": {
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "properties": {},
+ "required": [],
+ "type": "object"
+ }
+ }
+ }
+ }
+}
diff --git a/backend/windmill-api/src/mcp/session/gen/instructions.json b/backend/windmill-api/src/mcp/session/gen/instructions.json
new file mode 100644
index 0000000000..9cdb920c99
--- /dev/null
+++ b/backend/windmill-api/src/mcp/session/gen/instructions.json
@@ -0,0 +1,237 @@
+{
+ "index": {
+ "script": {
+ "": "script",
+ "python3": "script.python3",
+ "deno": "script.deno",
+ "go": "script.go",
+ "bash": "script.bash",
+ "powershell": "script.powershell",
+ "postgresql": "script.postgresql",
+ "mysql": "script.mysql",
+ "bigquery": "script.bigquery",
+ "snowflake": "script.snowflake",
+ "mssql": "script.mssql",
+ "oracledb": "script.oracledb",
+ "graphql": "script.graphql",
+ "nativets": "script.nativets",
+ "bun": "script.bun",
+ "php": "script.php",
+ "rust": "script.rust",
+ "ansible": "script.ansible",
+ "csharp": "script.csharp",
+ "nu": "script.nu",
+ "java": "script.java",
+ "ruby": "script.ruby",
+ "rlang": "script.rlang",
+ "duckdb": "script.duckdb",
+ "bunnative": "script.bunnative",
+ "dbt": "script.dbt"
+ },
+ "flow": {
+ "": "flow",
+ "python3": "flow",
+ "deno": "flow",
+ "go": "flow",
+ "bash": "flow",
+ "powershell": "flow",
+ "postgresql": "flow",
+ "mysql": "flow",
+ "bigquery": "flow",
+ "snowflake": "flow",
+ "mssql": "flow",
+ "oracledb": "flow",
+ "graphql": "flow",
+ "nativets": "flow",
+ "bun": "flow",
+ "php": "flow",
+ "rust": "flow",
+ "ansible": "flow",
+ "csharp": "flow",
+ "nu": "flow",
+ "java": "flow",
+ "ruby": "flow",
+ "rlang": "flow",
+ "duckdb": "flow",
+ "bunnative": "flow",
+ "dbt": "flow"
+ },
+ "resource": {
+ "": "resource",
+ "python3": "resource",
+ "deno": "resource",
+ "go": "resource",
+ "bash": "resource",
+ "powershell": "resource",
+ "postgresql": "resource",
+ "mysql": "resource",
+ "bigquery": "resource",
+ "snowflake": "resource",
+ "mssql": "resource",
+ "oracledb": "resource",
+ "graphql": "resource",
+ "nativets": "resource",
+ "bun": "resource",
+ "php": "resource",
+ "rust": "resource",
+ "ansible": "resource",
+ "csharp": "resource",
+ "nu": "resource",
+ "java": "resource",
+ "ruby": "resource",
+ "rlang": "resource",
+ "duckdb": "resource",
+ "bunnative": "resource",
+ "dbt": "resource"
+ },
+ "app": {
+ "": "app",
+ "python3": "app.python3",
+ "deno": "app",
+ "go": "app",
+ "bash": "app",
+ "powershell": "app",
+ "postgresql": "app",
+ "mysql": "app",
+ "bigquery": "app",
+ "snowflake": "app",
+ "mssql": "app",
+ "oracledb": "app",
+ "graphql": "app",
+ "nativets": "app",
+ "bun": "app",
+ "php": "app",
+ "rust": "app",
+ "ansible": "app",
+ "csharp": "app",
+ "nu": "app",
+ "java": "app",
+ "ruby": "app",
+ "rlang": "app",
+ "duckdb": "app",
+ "bunnative": "app",
+ "dbt": "app"
+ },
+ "datatable": {
+ "": "datatable",
+ "python3": "datatable.python3",
+ "deno": "datatable",
+ "go": "datatable.go",
+ "bash": "datatable.go",
+ "powershell": "datatable.go",
+ "postgresql": "datatable.go",
+ "mysql": "datatable.go",
+ "bigquery": "datatable.go",
+ "snowflake": "datatable.go",
+ "mssql": "datatable.go",
+ "oracledb": "datatable.go",
+ "graphql": "datatable.go",
+ "nativets": "datatable",
+ "bun": "datatable",
+ "php": "datatable.go",
+ "rust": "datatable.go",
+ "ansible": "datatable.go",
+ "csharp": "datatable.go",
+ "nu": "datatable.go",
+ "java": "datatable.go",
+ "ruby": "datatable.go",
+ "rlang": "datatable.go",
+ "duckdb": "datatable.go",
+ "bunnative": "datatable",
+ "dbt": "datatable.go"
+ },
+ "pipeline": {
+ "": "pipeline",
+ "python3": "pipeline",
+ "deno": "pipeline",
+ "go": "pipeline",
+ "bash": "pipeline",
+ "powershell": "pipeline",
+ "postgresql": "pipeline",
+ "mysql": "pipeline",
+ "bigquery": "pipeline",
+ "snowflake": "pipeline",
+ "mssql": "pipeline",
+ "oracledb": "pipeline",
+ "graphql": "pipeline",
+ "nativets": "pipeline",
+ "bun": "pipeline",
+ "php": "pipeline",
+ "rust": "pipeline",
+ "ansible": "pipeline",
+ "csharp": "pipeline",
+ "nu": "pipeline",
+ "java": "pipeline",
+ "ruby": "pipeline",
+ "rlang": "pipeline",
+ "duckdb": "pipeline",
+ "bunnative": "pipeline",
+ "dbt": "pipeline"
+ },
+ "workspace_settings": {
+ "": "workspace_settings",
+ "python3": "workspace_settings",
+ "deno": "workspace_settings",
+ "go": "workspace_settings",
+ "bash": "workspace_settings",
+ "powershell": "workspace_settings",
+ "postgresql": "workspace_settings",
+ "mysql": "workspace_settings",
+ "bigquery": "workspace_settings",
+ "snowflake": "workspace_settings",
+ "mssql": "workspace_settings",
+ "oracledb": "workspace_settings",
+ "graphql": "workspace_settings",
+ "nativets": "workspace_settings",
+ "bun": "workspace_settings",
+ "php": "workspace_settings",
+ "rust": "workspace_settings",
+ "ansible": "workspace_settings",
+ "csharp": "workspace_settings",
+ "nu": "workspace_settings",
+ "java": "workspace_settings",
+ "ruby": "workspace_settings",
+ "rlang": "workspace_settings",
+ "duckdb": "workspace_settings",
+ "bunnative": "workspace_settings",
+ "dbt": "workspace_settings"
+ }
+ },
+ "texts": {
+ "script": "# Global draft script instructions\n\n- Global mode writes complete draft payloads only; it does not save, deploy, run, or generate metadata.\n- A script draft is a workspace item: `{ type: 'script', path, summary?, language, value, isDraft }` where `value` is the source code string.\n- Paths follow the conventions in the system prompt: default to `u//` when the user gave a bare name; only use `f//` when the folder is known to exist. Preserve the current path/language when modifying unless the user asked to change them.\n- Use `edit_script` for small localized changes (provide `old_string`/`new_string`); use `write_script` for full rewrites.\n- No script language was provided. Default to `bun` only for new TypeScript scripts; if the user requested another language or you read an existing script, call get_instructions again with that language.\n\n# Windmill script authoring reference (bun)\n\n# Windmill Script Writing Guide\n\n## General Principles\n\n- A script's inputs are its parameters. Credentials and configuration come in as resource-typed parameters, never hard-coded or read from the environment; the language section below shows how that language declares parameters\n- When no resource type exists for a service, still take its connection as one resource-typed parameter, of a custom type holding the connection fields (base URL, account identifiers, credentials), its secret in a variable the resource references. A custom type is named `c_`, which keeps it apart from a hub type synced later: the parameter takes `RT.C` in TypeScript, a `c_` TypedDict in Python. A plain string parameter or a variable read inside the code only when the user asks for it: the resource keeps a connection's fields together, lets whoever runs the script pick an existing connection, and keeps the secret out of the arguments a run records. If the instance is reported as not having synced the Windmill Hub's resource types, mention that a superadmin can sync them, since the hub has types for most services. Otherwise, or when the user prefers it to syncing, propose the resource type and ask before creating it\n- A Windmill Hub script takes a resource type the hub publishes, so on an instance that has not synced the hub's types that type is missing: say so, and that a superadmin can sync them, before asking for a resource of it. Hub scripts often declare the type inline (`type Stripe = { token: string }`), which is still the `stripe` resource type; in code you write, name it the way the language section shows (`RT.Stripe` in TypeScript) rather than copying the inline declaration\n- Libraries are installed automatically - do not show installation instructions\n- In a language with an entrypoint function (TypeScript, Python, Go, Rust, PHP, R, …), name it `main` (`Main` in C#) and do not call it; in TypeScript it must be async. SQL, GraphQL, Bash, PowerShell and Ansible scripts have no `main`: their language section shows how they take arguments\n- Where the language has a Windmill client (`wmill`), use it to interact with the platform\n- A script's input schema may carry a top-level `prompt_for_ai` string: its author's instructions to an AI choosing the inputs. Follow it when you pick arguments to run that script, and keep it when you rewrite the schema\n\n## Return Values\n\n- A script can return any JSON-serializable value; a SQL script returns the rows its query produces\n- Return values become available to subsequent flow steps via `results.step_id`\n\n## Preprocessor Scripts\n\nPreprocessor scripts process raw trigger data from various sources (webhook, custom HTTP route, SQS, WebSocket, Kafka, NATS, MQTT, AMQP, Postgres, GCP Pub/Sub, Azure, or email) before passing it to the flow. This separates the trigger logic from the flow logic and keeps the auto-generated UI clean.\n\nA preprocessor is written in TypeScript or Python: its function is named `preprocessor` instead of `main`, and it receives a single parameter called `event` (the language section gives its type).\n\nThe returned object determines the parameter values passed to the flow.\ne.g., `{ b: 1, a: 2 }` calls the flow with `a = 2` and `b = 1`, assuming the flow has two inputs called `a` and `b`.\n\n\n# TypeScript (Bun)\n\nBun runtime with full npm ecosystem and fastest execution. **Bun is the default and preferred TypeScript runtime** — choose it for any TypeScript script unless there is a major reason to use Deno for that specific use-case.\n\n## Structure\n\nExport a single **async** function called `main`:\n\n```typescript\nexport async function main(param1: string, param2: number) {\n // Your code here\n return { result: param1, count: param2 };\n}\n```\n\nDo not call the main function. Libraries are installed automatically.\n\n## Resource Types\n\nOn Windmill, credentials and configuration are stored in resources and passed as parameters to main.\n\nUse the `RT` namespace for resource types:\n\n```typescript\nexport async function main(stripe: RT.Stripe) {\n // stripe contains API key and config from the resource\n}\n```\n\nOnly use resource types if you need them to satisfy the instructions. Always use the RT namespace.\n\n## Imports\n\n```typescript\nimport Stripe from \"stripe\";\nimport { someFunction } from \"some-package\";\n```\n\n## Prefer `//native` when the runtime allows it\n\nIf a script only needs `fetch` and the JavaScript standard library — including when it uses `windmill-client` — prefer making it a **native** script: add `//native` as the first line and write it with the `write-script-bunnative` skill. Native scripts run on a lightweight V8 isolate, start faster, and parallelize heavily. `windmill-client` works on the native worker (its calls go over `fetch`), so needing the Windmill client is **not** a reason to avoid `//native`. Use the regular `bun` language only when the code (or a dependency) needs Node/Bun runtime APIs — `node:*` modules, the filesystem, child processes, or native addons.\n\n## Windmill Client\n\nImport the windmill client for platform interactions:\n\n```typescript\nimport * as wmill from \"windmill-client\";\n```\n\n**Prefer `windmill-client` over raw `fetch` for anything that talks to Windmill** — reading resources/variables/states, running scripts and flows, S3 object operations, etc. It handles auth, the workspace, and the base URL for you, so you don't hand-roll URLs or tokens. Reserve `fetch` for calling *external* HTTP APIs that aren't Windmill.\n\nThe full `windmill-client` API reference (every exported function and its signature) is included below — consult it for the exact method to use instead of guessing or falling back to `fetch`.\n\n## Preprocessor Scripts\n\nFor preprocessor scripts, the function should be named `preprocessor` and receives an `event` parameter:\n\n```typescript\ntype Event = {\n kind:\n | \"webhook\"\n | \"http\"\n | \"websocket\"\n | \"kafka\"\n | \"email\"\n | \"nats\"\n | \"postgres\"\n | \"sqs\"\n | \"mqtt\"\n | \"amqp\"\n | \"gcp\"\n | \"azure\";\n body: any;\n headers: Record;\n query: Record;\n};\n\nexport async function preprocessor(event: Event) {\n return {\n param1: event.body.field1,\n param2: event.query.id,\n };\n}\n```\n\n## S3 Object Operations\n\nWindmill provides built-in support for S3-compatible storage operations. The `wmill.S3Object` type covers both the `s3://storage/key` URI form (`s3:///key` for the workspace default storage) and the `{ s3, storage? }` record form — always use it instead of redefining your own.\n\n### Receiving an S3Object as a script parameter\n\n```typescript\nimport * as wmill from \"windmill-client\";\n\nexport async function main(file: wmill.S3Object) {\n const content = await wmill.loadS3File(file);\n // ...\n}\n```\n\n### S3 operations\n\n```typescript\nimport * as wmill from \"windmill-client\";\n\n// Load file content from S3\nconst content: Uint8Array = await wmill.loadS3File(s3object);\n\n// Load file as stream\nconst blob: Blob = await wmill.loadS3FileStream(s3object);\n\n// Write file to S3\nconst result: wmill.S3Object = await wmill.writeS3File(\n s3object, // Target path (or undefined to auto-generate)\n fileContent, // string or Blob\n s3ResourcePath // Optional: specific S3 resource to use\n);\n```\n\n\n# TypeScript SDK (windmill-client)\n\nImport: import * as wmill from 'windmill-client'\n\nThe client configures itself from the job's environment — base URL, token and credentials mode\nare all set before your code runs, so there is nothing to initialize and no reason to read\nWM_TOKEN or BASE_INTERNAL_URL and build an API URL yourself. Reconstructing that by hand only\nreintroduces details the client already handles. Call the SDK for anything Windmill, and use raw\nHTTP for third-party APIs.\n\nThe helpers below are the surface to prefer. For an endpoint none of them covers, import the\ngenerated service classes (JobService, ScriptService, ...) from 'windmill-client' — they are not\nlisted here but they do exist. What does not exist is a helper name you guessed at: if it is\nneither listed below nor a service method, do not call it.\n\nTo know who is running the script, read the contextual variables rather than calling the API:\n`process.env.WM_END_USER_EMAIL || process.env.WM_EMAIL`. WM_END_USER_EMAIL is the app viewer when\nthe run was triggered from an app and empty otherwise (both variables are always defined), WM_EMAIL\nis the user the job is permissioned as. WM_USERNAME is the matching username.\n\nworkerHasInternalServer(): boolean\n\n/**\n * Initialize the Windmill client with authentication token and base URL\n * @param token - Authentication token (defaults to WM_TOKEN env variable)\n * @param baseUrl - API base URL (defaults to BASE_INTERNAL_URL or BASE_URL env variable)\n */\nsetClient(token?: string, baseUrl?: string): void\n\n/**\n * Create a client configuration from env variables\n * @returns client configuration\n */\ngetWorkspace(): string\n\n/**\n * Get a resource value by path\n * @param path path of the resource, default to internal state path\n * @param undefinedIfEmpty if the resource does not exist, return undefined instead of throwing an error\n * @returns resource value\n */\nasync getResource(path?: string, undefinedIfEmpty?: boolean): Promise\n\n/**\n * Get the true root job id\n * @param jobId job id to get the root job id from (default to current job)\n * @returns root job id\n */\nasync getRootJobId(jobId?: string): Promise\n\n/**\n * Run a script synchronously by its path and wait for the result\n * @param path - Script path in Windmill\n * @param args - Arguments to pass to the script\n * @param verbose - Enable verbose logging\n * @param tag - Override the worker tag the job runs on\n * @returns Script execution result\n */\nasync runScriptByPath(path: string, args: Record | null = null, verbose: boolean = false, tag: string | null = null): Promise\n\n/**\n * Run a script synchronously by its hash and wait for the result\n * @param hash_ - Script hash in Windmill\n * @param args - Arguments to pass to the script\n * @param verbose - Enable verbose logging\n * @param tag - Override the worker tag the job runs on\n * @returns Script execution result\n */\nasync runScriptByHash(hash_: string, args: Record | null = null, verbose: boolean = false, tag: string | null = null): Promise\n\n/**\n * Append a text to the result stream\n * @param text text to append to the result stream\n */\nappendToResultStream(text: string): void\n\n/**\n * Stream to the result stream\n * @param stream stream to stream to the result stream\n */\nasync streamResult(stream: AsyncIterable): Promise\n\n/**\n * Run a flow synchronously by its path and wait for the result\n * @param path - Flow path in Windmill\n * @param args - Arguments to pass to the flow\n * @param verbose - Enable verbose logging\n * @param tag - Override the worker tag the job runs on\n * @returns Flow execution result\n */\nasync runFlow(path: string | null = null, args: Record | null = null, verbose: boolean = false, tag: string | null = null): Promise\n\n/**\n * Wait for a job to complete and return its result\n * @param jobId - ID of the job to wait for\n * @param verbose - Enable verbose logging\n * @returns Job result when completed\n */\nasync waitJob(jobId: string, verbose: boolean = false): Promise\n\n/**\n * Get the result of a completed job\n * @param jobId - ID of the completed job\n * @returns Job result\n */\nasync getResult(jobId: string): Promise\n\n/**\n * Get the result of a job if completed, or its current status\n * @param jobId - ID of the job\n * @returns Object with started, completed, success, and result properties\n */\nasync getResultMaybe(jobId: string): Promise\n\n/**\n * Cancel a queued or running job by ID.\n * @param jobId - UUID of the job to cancel\n * @param reason - Optional reason for cancellation\n * @returns Response message from the cancel endpoint\n */\nasync cancelJob(jobId: string, reason: string | undefined = undefined): Promise\n\n/**\n * Run a script asynchronously by its path\n * @param path - Script path in Windmill\n * @param args - Arguments to pass to the script\n * @param scheduledInSeconds - Schedule execution for a future time (in seconds), or {@link RunScriptAsyncOptions}\n * `{ scheduledInSeconds?, tag?, retry? }`, e.g. `{ retry: { constant: { attempts: 3, seconds: 10 } } }`\n * @param tag - Override the worker tag the job runs on\n * @returns Job ID of the created job\n */\nasync runScriptByPathAsync(path: string, args: Record | null = null, scheduledInSeconds: number | null | RunScriptAsyncOptions = null, tag: string | null = null): Promise\n\n/**\n * Run a script asynchronously by its hash\n * @param hash_ - Script hash in Windmill\n * @param args - Arguments to pass to the script\n * @param scheduledInSeconds - Schedule execution for a future time (in seconds), or {@link RunScriptAsyncOptions}\n * `{ scheduledInSeconds?, tag?, retry? }`, e.g. `{ retry: { constant: { attempts: 3, seconds: 10 } } }`\n * @param tag - Override the worker tag the job runs on\n * @returns Job ID of the created job\n */\nasync runScriptByHashAsync(hash_: string, args: Record | null = null, scheduledInSeconds: number | null | RunScriptAsyncOptions = null, tag: string | null = null): Promise\n\n/**\n * Run a flow asynchronously by its path\n * @param path - Flow path in Windmill\n * @param args - Arguments to pass to the flow\n * @param scheduledInSeconds - Schedule execution for a future time (in seconds)\n * @param doNotTrackInParent - If false, tracks state in parent job (only use when fully awaiting the job)\n * @param tag - Override the worker tag the job runs on\n * @returns Job ID of the created job\n */\nasync runFlowAsync(path: string | null, args: Record | null, scheduledInSeconds: number | null = null, // can only be set to false if this the job will be fully await and not concurrent with any other job // as otherwise the child flow and its own child will store their state in the parent job which will // lead to incorrectness and failures doNotTrackInParent: boolean = true, tag: string | null = null): Promise\n\n/**\n * Resolve a resource value in case the default value was picked because the input payload was undefined\n * @param obj resource value or path of the resource under the format `$res:path`\n * @returns resource value\n */\nasync resolveDefaultResource(obj: any): Promise\n\n/**\n * Get the state file path from environment variables\n * @returns State path string\n */\ngetStatePath(): string\n\n/**\n * Set a resource value by path\n * @param path path of the resource to set, default to state path\n * @param value new value of the resource to set\n * @param initializeToTypeIfNotExist if the resource does not exist, initialize it with this type\n */\nasync setResource(value: any, path?: string, initializeToTypeIfNotExist?: string): Promise\n\n/**\n * Set the state\n * @param state state to set\n * @param path Optional state resource path override. Defaults to `getStatePath()`.\n */\nasync setState(state: any, path?: string): Promise\n\n/**\n * Set the progress\n * Progress cannot go back and limited to 0% to 99% range\n * @param percent Progress to set in %\n * @param jobId? Job to set progress for\n */\nasync setProgress(percent: number, jobId?: any): Promise\n\n/**\n * Get the progress\n * @param jobId? Job to get progress from\n * @returns Optional clamped between 0 and 100 progress value\n */\nasync getProgress(jobId?: any): Promise\n\n/**\n * Whether the worker running this job has received its shutdown signal.\n * A draining worker waits for its current job to finish before exiting, so a\n * long-running script can poll this and return early to let the worker be replaced.\n * @param jobId? Job to check, defaults to the current job\n */\nasync workerIsDraining(jobId?: string): Promise\n\n/**\n * Set a flow user state\n * @param key key of the state\n * @param value value of the state\n */\nasync setFlowUserState(key: string, value: any, errorIfNotPossible?: boolean): Promise\n\n/**\n * Get a flow user state\n * @param path path of the variable\n */\nasync getFlowUserState(key: string, errorIfNotPossible?: boolean): Promise