Merge remote-tracking branch 'origin/main' into unify-ai-session-home-chatbox

This commit is contained in:
Guilhem Lemouel
2026-10-19 09:10:33 -07:00
285 changed files with 9665 additions and 2569 deletions
+1 -1
View File
@@ -1,3 +1,3 @@
{
".": "1.837.0"
".": "1.841.0"
}
+3
View File
@@ -33,6 +33,9 @@ Open-source platform for internal tools, workflows, API integrations, background
administers behind `external_instance` data tables and Ducklake catalogs: its invariants (one
lifecycle lock, managed-object markers, the setup gate, per-cluster roles, fork copy ownership)
and how to run one locally
- **Fork object storage**: `docs/fork-object-storage.md` — how a fork's object keys map under
`__wm_forks/<segment>/` with read-through to its ancestors, where the mapping must be applied,
and why `__wm_forks/` is reachable only through a workspace's own chain
- **Data table viewer roles**: `docs/datatable-viewer-roles.md`, on what a connection naming no
role holds: the default role as a floor, whose roles are added (the job's own, or its viewer's
for an inline app runnable that opts in), why an admin's roles are not added, the per-role-set
+76
View File
@@ -1,5 +1,81 @@
# Changelog
## [1.841.0](https://github.com/windmill-labs/windmill/compare/v1.840.0...v1.841.0) (2026-10-18)
### Features
* let agent workers authenticate with a workload identity token ([#11858](https://github.com/windmill-labs/windmill/issues/11858)) ([be23abb](https://github.com/windmill-labs/windmill/commit/be23abb3602ed9c45f1c66c98d5f84e7676dccfa))
* let ALLOW_PRIVATE_MCP_SERVER_URLS name the private hosts it allows ([#11869](https://github.com/windmill-labs/windmill/issues/11869)) ([5c205fa](https://github.com/windmill-labs/windmill/commit/5c205fa46915de9e5fde731a117ba8571cfa56f7))
* probe nsjail with a real jail and add a gVisor compat mode ([#11865](https://github.com/windmill-labs/windmill/issues/11865)) ([69d36f7](https://github.com/windmill-labs/windmill/commit/69d36f77daceb25cc903c7ea014ba8d487650b18))
### Bug Fixes
* insert ApiAuthed into request extensions in no-auth mode ([#11868](https://github.com/windmill-labs/windmill/issues/11868)) ([a7561fd](https://github.com/windmill-labs/windmill/commit/a7561fd8bde5c4a766a050507c2d9b9823c08bcc))
* reject out-of-range integer args to narrow SQL types instead of wrapping ([#11864](https://github.com/windmill-labs/windmill/issues/11864)) ([19ec5d3](https://github.com/windmill-labs/windmill/commit/19ec5d3cd8a36600c8896a895d0e566735f729a9))
* warn when an autoscaled worker group has no tags to count ([#11859](https://github.com/windmill-labs/windmill/issues/11859)) ([8b14a78](https://github.com/windmill-labs/windmill/commit/8b14a78822f95fb045d80940dfd9197f79ea88cc))
## [1.840.0](https://github.com/windmill-labs/windmill/compare/v1.839.0...v1.840.0) (2026-10-17)
### Features
* add a no_network annotation for sandboxed jobs ([#11844](https://github.com/windmill-labs/windmill/issues/11844)) ([feb7b1a](https://github.com/windmill-labs/windmill/commit/feb7b1ad906046f4cf6ea53a85506f42b1b66e93))
* warn at worker startup when WHITELIST_ENVS forwards a secret-shaped variable ([#11838](https://github.com/windmill-labs/windmill/issues/11838)) ([16c8be2](https://github.com/windmill-labs/windmill/commit/16c8be2355b919878091769810749c54c2f0a09d))
### Bug Fixes
* keep script and flow deploys off a second pool connection ([#11843](https://github.com/windmill-labs/windmill/issues/11843)) ([2684156](https://github.com/windmill-labs/windmill/commit/268415623b515280b99bd5d9e32876868821dc4f))
* let ALLOW_PRIVATE_AI_BASE_URLS name the private hosts it allows ([#11841](https://github.com/windmill-labs/windmill/issues/11841)) ([b0c97b3](https://github.com/windmill-labs/windmill/commit/b0c97b34caa6343db278a9c5c09228248acf970c))
* mount python script modules into the nsjail sandbox ([#11846](https://github.com/windmill-labs/windmill/issues/11846)) ([7a8cb62](https://github.com/windmill-labs/windmill/commit/7a8cb62fa135bff04522f4bbd93aba194e33b121))
* refuse dot segments in AI proxy paths ([#11837](https://github.com/windmill-labs/windmill/issues/11837)) ([89f36a7](https://github.com/windmill-labs/windmill/commit/89f36a73d16675fd5f0d57daa2baf616ee95cbf5))
* run bun and npm installs under nsjail sandboxing ([#11845](https://github.com/windmill-labs/windmill/issues/11845)) ([6646c86](https://github.com/windmill-labs/windmill/commit/6646c86351f188d9b7e355dfb46e87bfa5c81846))
* scope delete_jobs side-table deletes to the request workspace ([#11836](https://github.com/windmill-labs/windmill/issues/11836)) ([09a5911](https://github.com/windmill-labs/windmill/commit/09a59110d941a8c306a0d89e99d34d509545059f))
* skip the fork lock when a fork creation has no storage to purge ([#11842](https://github.com/windmill-labs/windmill/issues/11842)) ([0b54ebc](https://github.com/windmill-labs/windmill/commit/0b54ebc73d3d9541d2521857adc27766c4342000))
### Performance Improvements
* clone sqlx test databases from a migrated template ([#11848](https://github.com/windmill-labs/windmill/issues/11848)) ([4ed6c1a](https://github.com/windmill-labs/windmill/commit/4ed6c1a6ce1b6d53ea9ee965214da0c3adb3f3bd))
## [1.839.0](https://github.com/windmill-labs/windmill/compare/v1.838.0...v1.839.0) (2026-10-16)
### Features
* add a Require isolated forks protection rule ([#11834](https://github.com/windmill-labs/windmill/issues/11834)) ([ab4e790](https://github.com/windmill-labs/windmill/commit/ab4e790a216b92f789e130955d7cd180b394d1fe))
* isolate fork object storage under a per-fork prefix ([#11829](https://github.com/windmill-labs/windmill/issues/11829)) ([9375805](https://github.com/windmill-labs/windmill/commit/9375805fdf7501347a4dfb37e58f1be7fa2c5658))
* one Entra app for the Teams bot and ms_teams Graph connect ([#11718](https://github.com/windmill-labs/windmill/issues/11718)) ([e7088e7](https://github.com/windmill-labs/windmill/commit/e7088e7f4766cd662890cdf61f2b6a5a0fce06a8))
* route python S3 client settings through the S3 proxy ([#11819](https://github.com/windmill-labs/windmill/issues/11819)) ([de340ee](https://github.com/windmill-labs/windmill/commit/de340eed6f5520414b59166f8dc16938f7ac6c36))
### Bug Fixes
* verify Bot Framework JWT on incoming Teams activities ([#11818](https://github.com/windmill-labs/windmill/issues/11818)) ([0b1935f](https://github.com/windmill-labs/windmill/commit/0b1935f251605926760565fb7693f345f1a56312))
## [1.838.0](https://github.com/windmill-labs/windmill/compare/v1.837.0...v1.838.0) (2026-10-16)
### Features
* accept Ed25519-signed license keys alongside RSA ([#11810](https://github.com/windmill-labs/windmill/issues/11810)) ([33d4049](https://github.com/windmill-labs/windmill/commit/33d4049db029e1dc478b1251c562232f0127fc8a))
* make the frontend installable as a progressive web app ([#11805](https://github.com/windmill-labs/windmill/issues/11805)) ([b86909f](https://github.com/windmill-labs/windmill/commit/b86909fc81b21447414266f47a83a43492204e50))
* name mcp script and flow tools after their last path segment ([#11817](https://github.com/windmill-labs/windmill/issues/11817)) ([d1a13d9](https://github.com/windmill-labs/windmill/commit/d1a13d9054d5994b5ed9c0f8566b86154662caa0))
* route dev workspace and fork jobs to their own worker groups ([#11811](https://github.com/windmill-labs/windmill/issues/11811)) ([6e565b0](https://github.com/windmill-labs/windmill/commit/6e565b0dcb0fb56b69131c262d482c82bb6c527b))
### Bug Fixes
* **ai-chat:** tell the session chat that an agent is an ai_agent resource ([#11798](https://github.com/windmill-labs/windmill/issues/11798)) ([a521548](https://github.com/windmill-labs/windmill/commit/a52154877caa5c3e473ee56c1eaf040b7da2375f))
* emit a single email claim in job OIDC tokens ([#11804](https://github.com/windmill-labs/windmill/issues/11804)) ([2ef0c0d](https://github.com/windmill-labs/windmill/commit/2ef0c0d8e14fcd5ff1c06f6113ffaf2792b9d4c9))
* give inline script runs their own job dir ([#11822](https://github.com/windmill-labs/windmill/issues/11822)) ([6aec448](https://github.com/windmill-labs/windmill/commit/6aec4488ebe8f377b4ea9bb4948649831cba0dbc))
* hold mcp token references to resource reference scopes ([#11803](https://github.com/windmill-labs/windmill/issues/11803)) ([c09038b](https://github.com/windmill-labs/windmill/commit/c09038b10698042209fd6aa26c466fb53d6dc7d0))
* let deployed low-code apps run database studio queries again ([#11816](https://github.com/windmill-labs/windmill/issues/11816)) ([7c63a30](https://github.com/windmill-labs/windmill/commit/7c63a30edd650f49eff85066dcc7916cec1b7010))
* truncate long row titles instead of wrapping ([#11815](https://github.com/windmill-labs/windmill/issues/11815)) ([153a871](https://github.com/windmill-labs/windmill/commit/153a871550e3ae9ad6282aa59b3a4f9897fec6c1))
* use the session workspace's user in three AI session places ([#11808](https://github.com/windmill-labs/windmill/issues/11808)) ([19fc07f](https://github.com/windmill-labs/windmill/commit/19fc07faa95a8a2247e726f9d0a2adc3cfa42bd2))
## [1.837.0](https://github.com/windmill-labs/windmill/compare/v1.836.0...v1.837.0) (2026-10-15)
+8 -1
View File
@@ -18,7 +18,9 @@ RUN apt-get -y update \
pkg-config=1.8.* \
protobuf-compiler=3.21.*
RUN git clone -b master --single-branch https://github.com/google/nsjail.git . && git checkout dccf911fd2659e7b08ce9507c25b2b38ec2c5800
COPY docker/nsjail-patches/ /nsjail-patches/
RUN git clone -b master --single-branch https://github.com/google/nsjail.git . && git checkout dccf911fd2659e7b08ce9507c25b2b38ec2c5800 \
&& git apply /nsjail-patches/*.patch
RUN make
FROM ${RUST_IMAGE} AS rust_base
@@ -254,6 +256,11 @@ 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 \
&& rm -rf /var/lib/apt/lists/*
# The npm bundled with nodejs is replaced by a pinned one: it is what `//npm` scripts install with
# (NPM_PATH=/usr/bin/npm). npm 12 skips dependency install scripts not covered by an allowScripts
# policy (package.json or .npmrc).
RUN npm install -g npm@12.2.0 && npm cache clean --force
# go build is slower the first time it is ran, so we prewarm it in the build
# This mirrors Windmill's Go wrapper structure: main.go imports inner package, uses encoding/json, os, fmt
RUN export GOCACHE=/tmp/build_cache/go && \
+11 -1
View File
@@ -24,4 +24,14 @@ rustflags = [
]
[net]
git-fetch-with-cli = true
git-fetch-with-cli = true
[env]
# `#[sqlx::test]` clones each test database from a template migrated once, instead of running
# every migration per test. The `_sqlx_tmpl_*` databases it leaves on the server are reused.
SQLX_TEST_TEMPLATE = "true"
# All `#[sqlx::test]` pools of a test binary share this many connections, and each keeps the
# ones it took until it ends: below 5 per test thread, concurrent tests can split them all and
# wait on each other until their acquire times out. 50 covers CI's `--test-threads=10`; a run
# with more threads over a binary of more than 10 tests needs 5 per thread.
SQLX_TEST_MAX_CONNECTIONS = "50"
@@ -1,14 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "\n INSERT INTO script (workspace_id, hash, path, content, language, kind, created_by, schema, summary, description, lock, ws_error_handler_muted)\n VALUES ('test-workspace', $1, 'f/test/muted_failing_script', 'export function main() { throw new Error(\"fail\"); }', 'bun', 'script', 'test-user', '{}', '', '', E'{}\\n//bun.lock\\n<empty>', true)\n ",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Int8"
]
},
"nullable": []
},
"hash": "009fd85c1aa55ea36454eafffbf62505461eb1cc8b9af85a2e2ab6e7dbe950c6"
}
@@ -0,0 +1,20 @@
{
"db_name": "PostgreSQL",
"query": "SELECT config FROM config WHERE name LIKE 'worker\\_\\_%'",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "config",
"type_info": "Jsonb"
}
],
"parameters": {
"Left": []
},
"nullable": [
true
]
},
"hash": "0fb0fea54a1580d4b7ffd37ca43e169f51dbbdc3584d3522f25e97e180e307fd"
}
@@ -1,15 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "\n INSERT INTO script (workspace_id, hash, path, content, language, kind, created_by, schema, summary, description, lock)\n VALUES ('test-workspace', $1, 'f/test/simple_script', $2, 'bun', 'script', 'test-user', '{}', 'Simple test script', 'A simple test script', E'{}\\n//bun.lock\\n<empty>')\n ",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Int8",
"Text"
]
},
"nullable": []
},
"hash": "1043947475822c27f73b5357e6ec0d527d999f2865ff5de75186b49004a3565e"
}
@@ -1,20 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "SELECT error_handler->>'path' FROM workspace_settings WHERE workspace_id = 'test-workspace'",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "?column?",
"type_info": "Text"
}
],
"parameters": {
"Left": []
},
"nullable": [
null
]
},
"hash": "12c3101e02f197ad731b66f539fe677ad25520fcc9c5a2378a293122956bed4c"
}
@@ -1,12 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "\n UPDATE workspace_settings\n SET error_handler = '{\"path\": \"script/f/test/error_handler\", \"extra_args\": {\"notify\": true}, \"muted_on_cancel\": true, \"muted_on_user_path\": false}'::jsonb\n WHERE workspace_id = 'test-workspace'\n ",
"describe": {
"columns": [],
"parameters": {
"Left": []
},
"nullable": []
},
"hash": "18d1a6ac94f2c87d5ea8c48a228f061135be4065dca33fbc429d8b0186c5ccb3"
}
@@ -0,0 +1,23 @@
{
"db_name": "PostgreSQL",
"query": "SELECT id FROM v2_job WHERE workspace_id = $1 AND id = ANY($2)",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "id",
"type_info": "Uuid"
}
],
"parameters": {
"Left": [
"Text",
"UuidArray"
]
},
"nullable": [
false
]
},
"hash": "1f21ef9dfa502b425b85d2acb6b3af1694ee60157089ce0c823d6c1351b8ed2c"
}
@@ -1,20 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "SELECT (error_handler->>'muted_on_cancel')::boolean FROM workspace_settings WHERE workspace_id = 'test-workspace'",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "bool",
"type_info": "Bool"
}
],
"parameters": {
"Left": []
},
"nullable": [
null
]
},
"hash": "25bf3956b4365a4d4f96368bcc6e33817ae284ab26c195eee53d988d74263e86"
}
@@ -1,20 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "SELECT (error_handler->>'muted_on_user_path')::boolean FROM workspace_settings WHERE workspace_id = 'test-workspace'",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "bool",
"type_info": "Bool"
}
],
"parameters": {
"Left": []
},
"nullable": [
null
]
},
"hash": "28b8264a427e8c19be823d2b8e40736a7b7675780672b503d91737cd0c617657"
}
@@ -1,12 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "\n UPDATE workspace_settings\n SET success_handler = '{\"path\": \"script/f/test/success_handler\", \"extra_args\": {\"key\": \"value\"}}'::jsonb\n WHERE workspace_id = 'test-workspace'\n ",
"describe": {
"columns": [],
"parameters": {
"Left": []
},
"nullable": []
},
"hash": "28f3dfb70aed943ad3d64da608168c027c645afb73dfc2360245b68ba593cab4"
}
@@ -1,12 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "\n UPDATE workspace_settings\n SET success_handler = NULL\n WHERE workspace_id = 'test-workspace'\n ",
"describe": {
"columns": [],
"parameters": {
"Left": []
},
"nullable": []
},
"hash": "2c2ed5c91a4893966e94305df8b9f8ac904c8d0781a83fdea66c918320fb5601"
}
@@ -0,0 +1,22 @@
{
"db_name": "PostgreSQL",
"query": "SELECT config FROM config WHERE name = $1 FOR UPDATE",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "config",
"type_info": "Jsonb"
}
],
"parameters": {
"Left": [
"Text"
]
},
"nullable": [
true
]
},
"hash": "2d22fe27288580cb727e43b2abe3be2e6e6e3b03e61ce8f2879627115224c8cf"
}
@@ -1,12 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "\n INSERT INTO script (workspace_id, hash, path, content, language, kind, created_by, schema, summary, description, lock)\n VALUES ('test-workspace', 3333333333, 'f/test/error_handler', 'export function main() { return \"handled\"; }', 'bun', 'script', 'test-user', '{}', '', '', E'{}\\n//bun.lock\\n<empty>')\n ",
"describe": {
"columns": [],
"parameters": {
"Left": []
},
"nullable": []
},
"hash": "344c08104d62d9bcd3f9117abb574e73a6fb364e4ab3e3916958c2e493673b1d"
}
@@ -1,12 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "\n INSERT INTO group_ (workspace_id, name, summary, extra_perms)\n VALUES ('test-workspace', 'success_handler', 'The group the success handler acts on behalf of', '{\"u/test-user\": true}')\n ON CONFLICT DO NOTHING\n ",
"describe": {
"columns": [],
"parameters": {
"Left": []
},
"nullable": []
},
"hash": "3a71ab02239d8dd4e2f440a35155459a7d5091c125a0998e79d89f8c560a3fd3"
}
@@ -1,14 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "\n INSERT INTO script (workspace_id, hash, path, content, language, kind, created_by, schema, summary, description, lock)\n VALUES ('test-workspace', 1234567890, 'f/test/success_handler', $1, 'bun', 'script', 'test-user', '{}', 'Success handler script', 'Handles successful job completions', E'{}\\n//bun.lock\\n<empty>')\n ",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Text"
]
},
"nullable": []
},
"hash": "42250637493a623850ca76fe5a705fe4acef039f38a5e76da8d09f2f7e755779"
}
@@ -0,0 +1,23 @@
{
"db_name": "PostgreSQL",
"query": "SELECT EXISTS (SELECT 1 FROM fork_storage_namespace WHERE workspace_id = ANY($1))\n AND EXISTS (SELECT 1 FROM workspace WHERE parent_workspace_id = $2)",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "?column?",
"type_info": "Bool"
}
],
"parameters": {
"Left": [
"TextArray",
"Text"
]
},
"nullable": [
null
]
},
"hash": "45b73345f2009122142f3410736b2d57a07e2047a704d9a7d8eab3416ff1d9d5"
}
@@ -0,0 +1,22 @@
{
"db_name": "PostgreSQL",
"query": "SELECT EXISTS (SELECT 1 FROM fork_storage_namespace WHERE workspace_id = $1)",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "exists",
"type_info": "Bool"
}
],
"parameters": {
"Left": [
"Text"
]
},
"nullable": [
null
]
},
"hash": "4640ac69b297127cd0f5c369fa4a49857237cd57134dbc467b53601c1ec942d2"
}
@@ -1,12 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "\n INSERT INTO group_ (workspace_id, name, summary, extra_perms)\n VALUES ('test-workspace', 'error_handler', 'The group the error handler acts on behalf of', '{\"u/test-user\": true}')\n ON CONFLICT DO NOTHING\n ",
"describe": {
"columns": [],
"parameters": {
"Left": []
},
"nullable": []
},
"hash": "5f5bdd667f699a5a1c05e07d805a97afb06252541d06b4785063819c3893b674"
}
@@ -1,12 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "\n UPDATE workspace_settings\n SET success_handler = '{\"path\": \"script/f/test/success_handler\"}'::jsonb\n WHERE workspace_id = 'test-workspace'\n ",
"describe": {
"columns": [],
"parameters": {
"Left": []
},
"nullable": []
},
"hash": "65016ea993fb40d4ab6b0a6f15c2082e8dfbaada01243bae07065c089bc42fa9"
}
@@ -1,14 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "\n INSERT INTO script (workspace_id, hash, path, content, language, kind, created_by, schema, summary, description, lock)\n VALUES ('test-workspace', 1111111111, 'f/test/error_handler', $1, 'bun', 'script', 'test-user', '{}', 'Error handler script', 'Handles failed job completions', E'{}\\n//bun.lock\\n<empty>')\n ",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Text"
]
},
"nullable": []
},
"hash": "69e1c04c246c42a3a1d7202b6fb349d0ac779431993e225945ddfb91489cb927"
}
@@ -0,0 +1,28 @@
{
"db_name": "PostgreSQL",
"query": "SELECT storage, storage_ref FROM fork_storage_namespace WHERE workspace_id = $1",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "storage",
"type_info": "Text"
},
{
"ordinal": 1,
"name": "storage_ref",
"type_info": "Text"
}
],
"parameters": {
"Left": [
"Text"
]
},
"nullable": [
false,
false
]
},
"hash": "7796f40e349bf0771cceff037fa2224ab49659213638230be7f9acbf82d8e1b0"
}
@@ -1,12 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "\n UPDATE workspace_settings\n SET error_handler = NULL\n WHERE workspace_id = 'test-workspace'\n ",
"describe": {
"columns": [],
"parameters": {
"Left": []
},
"nullable": []
},
"hash": "79648f03eb50385183c34d57bda1ac984cf6502609df9ee51b7d684b585b8447"
}
@@ -0,0 +1,34 @@
{
"db_name": "PostgreSQL",
"query": "\n WITH RECURSIVE chain AS (\n SELECT id, parent_workspace_id, is_dev_workspace, deleted, 0 AS depth\n FROM workspace WHERE id = $1\n UNION ALL\n SELECT w.id, w.parent_workspace_id, w.is_dev_workspace, w.deleted, chain.depth + 1\n FROM workspace w\n JOIN chain ON w.id = chain.parent_workspace_id\n WHERE chain.depth < 20\n )\n SELECT\n (SELECT id FROM chain\n WHERE parent_workspace_id IS NULL\n OR (is_dev_workspace AND id NOT LIKE 'wm-fork-%')\n ORDER BY depth LIMIT 1) AS id,\n (SELECT parent_workspace_id IS NOT NULL FROM chain WHERE depth = 0) AS has_parent,\n (SELECT bool_or(is_dev_workspace\n OR (parent_workspace_id IS NULL AND id LIKE 'wm-fork-%')\n OR (deleted AND parent_workspace_id IS NOT NULL))\n FROM chain) AS in_dev_lineage\n ",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "id",
"type_info": "Varchar"
},
{
"ordinal": 1,
"name": "has_parent",
"type_info": "Bool"
},
{
"ordinal": 2,
"name": "in_dev_lineage",
"type_info": "Bool"
}
],
"parameters": {
"Left": [
"Text"
]
},
"nullable": [
null,
null,
null
]
},
"hash": "7ec099041134ee34057b57e86b35c67fad4532904ed633b85c3bbc627367ef0c"
}
@@ -1,14 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "\n INSERT INTO script (workspace_id, hash, path, content, language, kind, created_by, schema, summary, description, lock)\n VALUES ('test-workspace', $1, 'f/test/success_script', 'export function main() { return \"ok\"; }', 'bun', 'script', 'test-user', '{}', '', '', E'{}\\n//bun.lock\\n<empty>')\n ",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Int8"
]
},
"nullable": []
},
"hash": "8511e096394edb1433f6572d50b66d8558866af53d829d83fa634f12a90733c0"
}
@@ -1,20 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "SELECT success_handler->'extra_args' FROM workspace_settings WHERE workspace_id = 'test-workspace'",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "?column?",
"type_info": "Jsonb"
}
],
"parameters": {
"Left": []
},
"nullable": [
null
]
},
"hash": "87044e1466cd114cbef336620e96dc29f3f930149fedc240d44c614dfc794ff7"
}
@@ -1,15 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "DELETE FROM zombie_job_counter WHERE job_id IN (SELECT id FROM v2_job WHERE workspace_id = $1 AND id = ANY($2))",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Text",
"UuidArray"
]
},
"nullable": []
},
"hash": "92b011eda2a652af714b08137b447753bc03ec35f6daa8ca245b1c8ed34c405f"
}
@@ -0,0 +1,28 @@
{
"db_name": "PostgreSQL",
"query": "SELECT large_file_storage, ducklake FROM workspace_settings WHERE workspace_id = $1",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "large_file_storage",
"type_info": "Jsonb"
},
{
"ordinal": 1,
"name": "ducklake",
"type_info": "Jsonb"
}
],
"parameters": {
"Left": [
"Text"
]
},
"nullable": [
true,
true
]
},
"hash": "98aebe8ead7d3f6e84ad88e6d006309b24b658cac3c99d8d0bdb84cdd00c413a"
}
@@ -0,0 +1,35 @@
{
"db_name": "PostgreSQL",
"query": "SELECT c.id AS \"id!\", ws.large_file_storage,\n EXISTS (SELECT 1 FROM fork_storage_namespace f\n WHERE f.workspace_id = c.id AND f.storage = $2) AS \"isolated!\"\n FROM unnest($1::text[]) WITH ORDINALITY AS c(id, ord)\n LEFT JOIN workspace_settings ws ON ws.workspace_id = c.id\n ORDER BY c.ord",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "id!",
"type_info": "Text"
},
{
"ordinal": 1,
"name": "large_file_storage",
"type_info": "Jsonb"
},
{
"ordinal": 2,
"name": "isolated!",
"type_info": "Bool"
}
],
"parameters": {
"Left": [
"TextArray",
"Text"
]
},
"nullable": [
null,
true,
null
]
},
"hash": "a37dec4e86f537880d45da01ce872ae5b7858a087cb4eb5869573fff69c1c6b9"
}
@@ -1,15 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "\n INSERT INTO script (workspace_id, hash, path, content, language, kind, created_by, schema, summary, description, lock)\n VALUES ('test-workspace', $1, 'f/test/failing_script', $2, 'bun', 'script', 'test-user', '{}', 'Failing test script', 'A script that always fails', E'{}\\n//bun.lock\\n<empty>')\n ",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Int8",
"Text"
]
},
"nullable": []
},
"hash": "b0c10d17ed684af4dc79db7a199d4438ea003b5762178f25ff12ef23c1a8f46a"
}
@@ -1,12 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "\n INSERT INTO group_ (workspace_id, name, summary, extra_perms)\n VALUES ('test-workspace', 'error_handler', 'Error handler group', '{\"u/test-user\": true}')\n ON CONFLICT DO NOTHING\n ",
"describe": {
"columns": [],
"parameters": {
"Left": []
},
"nullable": []
},
"hash": "ba0c3dad5d2a77922821c9c6d58e06a65e6666e197f3e59b880470df35c27bec"
}
@@ -1,12 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "\n UPDATE workspace_settings\n SET error_handler = '{\"path\": \"script/f/test/error_handler\"}'::jsonb\n WHERE workspace_id = 'test-workspace'\n ",
"describe": {
"columns": [],
"parameters": {
"Left": []
},
"nullable": []
},
"hash": "bb4cde84157126f29680cb36075848e7cde2ab7c6b7f0861becd4c0b8c330a8d"
}
@@ -0,0 +1,22 @@
{
"db_name": "PostgreSQL",
"query": "SELECT EXISTS (SELECT 1 FROM workspace WHERE id = $1)",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "exists",
"type_info": "Bool"
}
],
"parameters": {
"Left": [
"Text"
]
},
"nullable": [
null
]
},
"hash": "bdc39bdd63c38217834a0c0d858f6db33d63ff7bf55329452dc84dae2560c23e"
}
@@ -1,12 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "\n UPDATE workspace_settings\n SET success_handler = '{\"path\": \"flow/f/test/success_flow\"}'::jsonb\n WHERE workspace_id = 'test-workspace'\n ",
"describe": {
"columns": [],
"parameters": {
"Left": []
},
"nullable": []
},
"hash": "c2f271bcea1f11b2979152cc743559236fd875192b7b7f4824c63675fdc6a551"
}
@@ -0,0 +1,15 @@
{
"db_name": "PostgreSQL",
"query": "DELETE FROM fork_storage_namespace WHERE workspace_id = $1 AND storage = $2",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Text",
"Text"
]
},
"nullable": []
},
"hash": "c37f34ea3603af1496825ec54a3415fe710c5fbbc7380c5088c7069fa2caf990"
}
@@ -1,12 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "\n INSERT INTO script (workspace_id, hash, path, content, language, kind, created_by, schema, summary, description, lock)\n VALUES ('test-workspace', 5555555555, 'f/test/error_handler', 'export function main() { return \"handled\"; }', 'bun', 'script', 'test-user', '{}', '', '', E'{}\\n//bun.lock\\n<empty>')\n ",
"describe": {
"columns": [],
"parameters": {
"Left": []
},
"nullable": []
},
"hash": "cc719da4da98b6fe9612a4cc2f42dd19834a3e0d0be593ea6bc1239fe5453a74"
}
@@ -1,20 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "SELECT error_handler->'extra_args' FROM workspace_settings WHERE workspace_id = 'test-workspace'",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "?column?",
"type_info": "Jsonb"
}
],
"parameters": {
"Left": []
},
"nullable": [
null
]
},
"hash": "d5f1a2bfbac206a33b991d58f9ff4b8e8e4a3840ea1c65d409576379dede41ed"
}
@@ -1,20 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "\n SELECT id\n FROM v2_job\n WHERE workspace_id = 'test-workspace'\n AND permissioned_as_email = 'error_handler@windmill.dev'\n ",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "id",
"type_info": "Uuid"
}
],
"parameters": {
"Left": []
},
"nullable": [
false
]
},
"hash": "e4c9f3bca6bd636c3ee31fc643182ed5ca48a45da895fb992d820682f5169f7c"
}
@@ -1,20 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "SELECT success_handler->>'path' FROM workspace_settings WHERE workspace_id = 'test-workspace'",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "?column?",
"type_info": "Text"
}
],
"parameters": {
"Left": []
},
"nullable": [
null
]
},
"hash": "e9808cc152e1ce4717260ebb42f203ca16321a4550073258734a6208b83c00c2"
}
@@ -0,0 +1,16 @@
{
"db_name": "PostgreSQL",
"query": "INSERT INTO fork_storage_namespace (workspace_id, storage, storage_ref)\n VALUES ($1, $2, $3)",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Varchar",
"Text",
"Text"
]
},
"nullable": []
},
"hash": "eb6dc43ac53a853eab20ef804a092249e32b1184a146463094289c604bbd0332"
}
@@ -1,38 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "\n SELECT\n id,\n runnable_path,\n permissioned_as_email,\n parent_job\n FROM v2_job\n WHERE workspace_id = 'test-workspace'\n AND permissioned_as_email = 'error_handler@windmill.dev'\n ORDER BY created_at DESC\n LIMIT 1\n ",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "id",
"type_info": "Uuid"
},
{
"ordinal": 1,
"name": "runnable_path",
"type_info": "Varchar"
},
{
"ordinal": 2,
"name": "permissioned_as_email",
"type_info": "Varchar"
},
{
"ordinal": 3,
"name": "parent_job",
"type_info": "Uuid"
}
],
"parameters": {
"Left": []
},
"nullable": [
false,
true,
false,
true
]
},
"hash": "fdf0a16a72bc2eca2025d64750e2e6a7e7ff90b5ad4b42e6aab53992b447a20e"
}
+105 -101
View File
@@ -243,9 +243,9 @@ dependencies = [
[[package]]
name = "arc-swap"
version = "1.9.2"
version = "1.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c049c0be4daef0b145cb3555416b3b8ef5b7888a38aea1a3a155801fe7b0810b"
checksum = "380962b3d93b99642e50b9febf72c071e97e8b32d86eae9cf4ef582bb960ae6e"
dependencies = [
"rustversion",
]
@@ -7700,9 +7700,9 @@ dependencies = [
[[package]]
name = "libc"
version = "0.2.190"
version = "0.2.191"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce5d3ddc6d3fa000eb1536d85e147bfe31aacaba692ed6a876f95cb7c855be78"
checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
[[package]]
name = "libffi-sys"
@@ -7771,7 +7771,7 @@ dependencies = [
"bitflags 2.13.2",
"libc",
"plain",
"redox_syscall 0.9.4",
"redox_syscall 0.9.5",
]
[[package]]
@@ -10735,9 +10735,9 @@ dependencies = [
[[package]]
name = "redox_syscall"
version = "0.9.4"
version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "737970939a87c6fa31e7acad13307bccbb017a073b695b6089a2c484f929e20e"
checksum = "580c875845b41ecb1564ad1ae4703044cef774145e3d7a94dc2b3fa7c97868fd"
dependencies = [
"bitflags 2.13.2",
]
@@ -11709,9 +11709,9 @@ checksum = "ece8e78b2f38ec51c51f5d475df0a7187ba5111b2a28bdc761ee05b075d40a71"
[[package]]
name = "schannel"
version = "0.1.29"
version = "0.1.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "91c1b7e4904c873ef0710c1f407dde2e6287de2bebc1bbbf7d430bb7cbffd939"
checksum = "9cb23c424d8ee841bb4d813677ca237e2a610067d594fec130f87d6093495ab5"
dependencies = [
"windows-sys 0.61.2",
]
@@ -12610,7 +12610,7 @@ dependencies = [
[[package]]
name = "sqlx"
version = "0.8.6"
source = "git+https://github.com/windmill-labs/sqlx?rev=6bdaee94fa62a01561125646da3f99eb341f2457#6bdaee94fa62a01561125646da3f99eb341f2457"
source = "git+https://github.com/windmill-labs/sqlx?rev=c1c5f1f2a07cb1fce0e47463c314697e08f4f26b#c1c5f1f2a07cb1fce0e47463c314697e08f4f26b"
dependencies = [
"sqlx-core",
"sqlx-macros",
@@ -12622,7 +12622,7 @@ dependencies = [
[[package]]
name = "sqlx-core"
version = "0.8.6"
source = "git+https://github.com/windmill-labs/sqlx?rev=6bdaee94fa62a01561125646da3f99eb341f2457#6bdaee94fa62a01561125646da3f99eb341f2457"
source = "git+https://github.com/windmill-labs/sqlx?rev=c1c5f1f2a07cb1fce0e47463c314697e08f4f26b#c1c5f1f2a07cb1fce0e47463c314697e08f4f26b"
dependencies = [
"base64 0.22.1",
"bigdecimal",
@@ -12660,7 +12660,7 @@ dependencies = [
[[package]]
name = "sqlx-macros"
version = "0.8.6"
source = "git+https://github.com/windmill-labs/sqlx?rev=6bdaee94fa62a01561125646da3f99eb341f2457#6bdaee94fa62a01561125646da3f99eb341f2457"
source = "git+https://github.com/windmill-labs/sqlx?rev=c1c5f1f2a07cb1fce0e47463c314697e08f4f26b#c1c5f1f2a07cb1fce0e47463c314697e08f4f26b"
dependencies = [
"proc-macro2",
"quote",
@@ -12672,7 +12672,7 @@ dependencies = [
[[package]]
name = "sqlx-macros-core"
version = "0.8.6"
source = "git+https://github.com/windmill-labs/sqlx?rev=6bdaee94fa62a01561125646da3f99eb341f2457#6bdaee94fa62a01561125646da3f99eb341f2457"
source = "git+https://github.com/windmill-labs/sqlx?rev=c1c5f1f2a07cb1fce0e47463c314697e08f4f26b#c1c5f1f2a07cb1fce0e47463c314697e08f4f26b"
dependencies = [
"dotenvy",
"either",
@@ -12696,7 +12696,7 @@ dependencies = [
[[package]]
name = "sqlx-mysql"
version = "0.8.6"
source = "git+https://github.com/windmill-labs/sqlx?rev=6bdaee94fa62a01561125646da3f99eb341f2457#6bdaee94fa62a01561125646da3f99eb341f2457"
source = "git+https://github.com/windmill-labs/sqlx?rev=c1c5f1f2a07cb1fce0e47463c314697e08f4f26b#c1c5f1f2a07cb1fce0e47463c314697e08f4f26b"
dependencies = [
"atoi",
"base64 0.22.1",
@@ -12740,7 +12740,7 @@ dependencies = [
[[package]]
name = "sqlx-postgres"
version = "0.8.6"
source = "git+https://github.com/windmill-labs/sqlx?rev=6bdaee94fa62a01561125646da3f99eb341f2457#6bdaee94fa62a01561125646da3f99eb341f2457"
source = "git+https://github.com/windmill-labs/sqlx?rev=c1c5f1f2a07cb1fce0e47463c314697e08f4f26b#c1c5f1f2a07cb1fce0e47463c314697e08f4f26b"
dependencies = [
"atoi",
"base64 0.22.1",
@@ -12780,7 +12780,7 @@ dependencies = [
[[package]]
name = "sqlx-sqlite"
version = "0.8.6"
source = "git+https://github.com/windmill-labs/sqlx?rev=6bdaee94fa62a01561125646da3f99eb341f2457#6bdaee94fa62a01561125646da3f99eb341f2457"
source = "git+https://github.com/windmill-labs/sqlx?rev=c1c5f1f2a07cb1fce0e47463c314697e08f4f26b#c1c5f1f2a07cb1fce0e47463c314697e08f4f26b"
dependencies = [
"atoi",
"chrono",
@@ -14876,9 +14876,9 @@ checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
[[package]]
name = "unicode-normalization"
version = "0.1.25"
version = "0.1.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5fd4f6878c9cb28d874b009da9e8d183b5abc80117c40bbd187a1fde336be6e8"
checksum = "75cd3fb03d5288b3ba9a1ee103ac7e9cbb59f0b03d64f8ddfcc04dd42758a85d"
dependencies = [
"tinyvec",
]
@@ -15486,7 +15486,7 @@ dependencies = [
[[package]]
name = "windmill"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"async-nats",
@@ -15576,7 +15576,7 @@ dependencies = [
[[package]]
name = "windmill-ai"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"async-stream",
"async-trait",
@@ -15611,7 +15611,7 @@ dependencies = [
[[package]]
name = "windmill-alerting"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"axum",
"chrono",
@@ -15624,7 +15624,7 @@ dependencies = [
[[package]]
name = "windmill-api"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"argon2",
@@ -15767,7 +15767,7 @@ dependencies = [
[[package]]
name = "windmill-api-agent-workers"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"axum",
"chrono",
@@ -15782,6 +15782,7 @@ dependencies = [
"tracing",
"uuid",
"windmill-api-auth",
"windmill-audit",
"windmill-common",
"windmill-parser-py-imports",
"windmill-queue",
@@ -15790,7 +15791,7 @@ dependencies = [
[[package]]
name = "windmill-api-assets"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"axum",
"chrono",
@@ -15807,7 +15808,7 @@ dependencies = [
[[package]]
name = "windmill-api-auth"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"axum",
@@ -15833,7 +15834,7 @@ dependencies = [
[[package]]
name = "windmill-api-client"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"reqwest 0.12.28",
"serde",
@@ -15843,7 +15844,7 @@ dependencies = [
[[package]]
name = "windmill-api-configs"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"axum",
"chrono",
@@ -15860,7 +15861,7 @@ dependencies = [
[[package]]
name = "windmill-api-debug"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"axum",
"base64 0.22.1",
@@ -15882,7 +15883,7 @@ dependencies = [
[[package]]
name = "windmill-api-embeddings"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"axum",
@@ -15905,7 +15906,7 @@ dependencies = [
[[package]]
name = "windmill-api-flow-conversations"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"axum",
"chrono",
@@ -15921,7 +15922,7 @@ dependencies = [
[[package]]
name = "windmill-api-flows"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"axum",
"chrono",
@@ -15943,7 +15944,7 @@ dependencies = [
[[package]]
name = "windmill-api-groups"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"axum",
"chrono",
@@ -15965,7 +15966,7 @@ dependencies = [
[[package]]
name = "windmill-api-inputs"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"axum",
"chrono",
@@ -15979,7 +15980,7 @@ dependencies = [
[[package]]
name = "windmill-api-integration-tests"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"async-nats",
@@ -16015,7 +16016,7 @@ dependencies = [
[[package]]
name = "windmill-api-jobs"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"axum",
@@ -16041,7 +16042,7 @@ dependencies = [
[[package]]
name = "windmill-api-npm-proxy"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"axum",
"chrono",
@@ -16069,7 +16070,7 @@ dependencies = [
[[package]]
name = "windmill-api-openapi"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"axum",
@@ -16091,7 +16092,7 @@ dependencies = [
[[package]]
name = "windmill-api-schedule"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"axum",
"chrono",
@@ -16111,7 +16112,7 @@ dependencies = [
[[package]]
name = "windmill-api-scripts"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"axum",
@@ -16153,7 +16154,7 @@ dependencies = [
[[package]]
name = "windmill-api-settings"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"axum",
@@ -16183,7 +16184,7 @@ dependencies = [
[[package]]
name = "windmill-api-sse"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"lazy_static",
"serde",
@@ -16195,7 +16196,7 @@ dependencies = [
[[package]]
name = "windmill-api-users"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"argon2",
"axum",
@@ -16219,7 +16220,7 @@ dependencies = [
[[package]]
name = "windmill-api-workers"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"axum",
"chrono",
@@ -16229,11 +16230,12 @@ dependencies = [
"uuid",
"windmill-api-auth",
"windmill-common",
"windmill-queue",
]
[[package]]
name = "windmill-api-workspaces"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"axum",
"chrono",
@@ -16272,7 +16274,7 @@ dependencies = [
[[package]]
name = "windmill-audit"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"chrono",
"lazy_static",
@@ -16287,7 +16289,7 @@ dependencies = [
[[package]]
name = "windmill-autoscaling"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"axum",
@@ -16306,7 +16308,7 @@ dependencies = [
[[package]]
name = "windmill-common"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"aes-gcm",
"aho-corasick",
@@ -16344,8 +16346,10 @@ dependencies = [
"hex",
"hkdf",
"hmac 0.12.1",
"http 1.5.0",
"hyper 1.12.0",
"indexmap 2.14.2",
"ipnet",
"itertools 0.14.0",
"jsonwebtoken 10.4.0",
"lazy_static",
@@ -16422,7 +16426,7 @@ dependencies = [
[[package]]
name = "windmill-dep-map"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"chrono",
"futures",
@@ -16442,7 +16446,7 @@ dependencies = [
[[package]]
name = "windmill-git-sync"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"regex",
"serde",
@@ -16459,7 +16463,7 @@ dependencies = [
[[package]]
name = "windmill-indexer"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"astral-tokio-tar",
@@ -16486,7 +16490,7 @@ dependencies = [
[[package]]
name = "windmill-jseval"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"futures",
@@ -16503,7 +16507,7 @@ dependencies = [
[[package]]
name = "windmill-macros"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"itertools 0.14.0",
"lazy_static",
@@ -16519,7 +16523,7 @@ dependencies = [
[[package]]
name = "windmill-mcp"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"async-trait",
@@ -16541,7 +16545,7 @@ dependencies = [
[[package]]
name = "windmill-native-triggers"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"async-trait",
@@ -16572,7 +16576,7 @@ dependencies = [
[[package]]
name = "windmill-oauth"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"arc-swap",
@@ -16597,7 +16601,7 @@ dependencies = [
[[package]]
name = "windmill-object-store"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"async-stream",
@@ -16633,7 +16637,7 @@ dependencies = [
[[package]]
name = "windmill-operator"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"futures",
@@ -16652,7 +16656,7 @@ dependencies = [
[[package]]
name = "windmill-parser"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"convert_case 0.6.0",
"serde",
@@ -16661,7 +16665,7 @@ dependencies = [
[[package]]
name = "windmill-parser-bash"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"lazy_static",
@@ -16673,7 +16677,7 @@ dependencies = [
[[package]]
name = "windmill-parser-csharp"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"serde_json",
@@ -16685,7 +16689,7 @@ dependencies = [
[[package]]
name = "windmill-parser-go"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"gosyn",
@@ -16697,7 +16701,7 @@ dependencies = [
[[package]]
name = "windmill-parser-graphql"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"lazy_static",
@@ -16709,7 +16713,7 @@ dependencies = [
[[package]]
name = "windmill-parser-java"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"serde_json",
@@ -16721,7 +16725,7 @@ dependencies = [
[[package]]
name = "windmill-parser-nu"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"nu-parser",
@@ -16732,7 +16736,7 @@ dependencies = [
[[package]]
name = "windmill-parser-php"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"itertools 0.14.0",
@@ -16743,7 +16747,7 @@ dependencies = [
[[package]]
name = "windmill-parser-py"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"itertools 0.14.0",
@@ -16755,7 +16759,7 @@ dependencies = [
[[package]]
name = "windmill-parser-py-asset"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"ruff_python_ast",
@@ -16766,7 +16770,7 @@ dependencies = [
[[package]]
name = "windmill-parser-py-imports"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"async-recursion",
@@ -16789,7 +16793,7 @@ dependencies = [
[[package]]
name = "windmill-parser-r"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"serde_json",
@@ -16801,7 +16805,7 @@ dependencies = [
[[package]]
name = "windmill-parser-ruby"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"lazy_static",
@@ -16815,7 +16819,7 @@ dependencies = [
[[package]]
name = "windmill-parser-rust"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"convert_case 0.6.0",
@@ -16832,7 +16836,7 @@ dependencies = [
[[package]]
name = "windmill-parser-sql"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"lazy_static",
@@ -16845,7 +16849,7 @@ dependencies = [
[[package]]
name = "windmill-parser-sql-asset"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"serde",
@@ -16857,7 +16861,7 @@ dependencies = [
[[package]]
name = "windmill-parser-ts"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"lazy_static",
@@ -16875,7 +16879,7 @@ dependencies = [
[[package]]
name = "windmill-parser-ts-asset"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"serde-wasm-bindgen",
@@ -16891,7 +16895,7 @@ dependencies = [
[[package]]
name = "windmill-parser-wac"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"ruff_python_ast",
@@ -16908,7 +16912,7 @@ dependencies = [
[[package]]
name = "windmill-parser-yaml"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"lazy_static",
@@ -16922,7 +16926,7 @@ dependencies = [
[[package]]
name = "windmill-queue"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"async-recursion",
@@ -16961,7 +16965,7 @@ dependencies = [
[[package]]
name = "windmill-runtime-nativets"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"const_format",
@@ -16999,7 +17003,7 @@ dependencies = [
[[package]]
name = "windmill-sql-datatype-parser-wasm"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"getrandom 0.3.4",
"wasm-bindgen",
@@ -17010,7 +17014,7 @@ dependencies = [
[[package]]
name = "windmill-store"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"async-recursion",
@@ -17045,7 +17049,7 @@ dependencies = [
[[package]]
name = "windmill-test-utils"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"async-trait",
@@ -17069,7 +17073,7 @@ dependencies = [
[[package]]
name = "windmill-trigger"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"async-trait",
@@ -17102,7 +17106,7 @@ dependencies = [
[[package]]
name = "windmill-trigger-amqp"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"async-trait",
@@ -17129,7 +17133,7 @@ dependencies = [
[[package]]
name = "windmill-trigger-azure"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"async-trait",
@@ -17162,7 +17166,7 @@ dependencies = [
[[package]]
name = "windmill-trigger-email"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"async-trait",
@@ -17182,7 +17186,7 @@ dependencies = [
[[package]]
name = "windmill-trigger-gcp"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"async-trait",
@@ -17216,7 +17220,7 @@ dependencies = [
[[package]]
name = "windmill-trigger-http"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"async-trait",
@@ -17253,7 +17257,7 @@ dependencies = [
[[package]]
name = "windmill-trigger-kafka"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"async-trait",
@@ -17276,7 +17280,7 @@ dependencies = [
[[package]]
name = "windmill-trigger-mqtt"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"async-trait",
@@ -17300,7 +17304,7 @@ dependencies = [
[[package]]
name = "windmill-trigger-nats"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"async-nats",
@@ -17324,7 +17328,7 @@ dependencies = [
[[package]]
name = "windmill-trigger-postgres"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"async-trait",
@@ -17359,7 +17363,7 @@ dependencies = [
[[package]]
name = "windmill-trigger-sqs"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"async-trait",
@@ -17387,7 +17391,7 @@ dependencies = [
[[package]]
name = "windmill-trigger-websocket"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"async-trait",
@@ -17412,7 +17416,7 @@ dependencies = [
[[package]]
name = "windmill-types"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"bitflags 2.13.2",
@@ -17431,7 +17435,7 @@ dependencies = [
[[package]]
name = "windmill-worker"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"async-once-cell",
@@ -17549,7 +17553,7 @@ dependencies = [
[[package]]
name = "windmill-worker-volumes"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"bytes",
"futures",
@@ -18371,9 +18375,9 @@ dependencies = [
[[package]]
name = "zip"
version = "7.2.0"
version = "7.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c42e33efc22a0650c311c2ef19115ce232583abbe80850bc8b66509ebef02de0"
checksum = "cc12baa6db2b15a140161ce53d72209dacea594230798c24774139b54ecaa980"
dependencies = [
"crc32fast",
"indexmap 2.14.2",
@@ -18426,9 +18430,9 @@ dependencies = [
[[package]]
name = "zstd-sys"
version = "2.1.1+zstd.1.5.7"
version = "2.1.2+zstd.1.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aeec9eaf2dffbbd09201e23bd0ffcbaa33bb8e9266a10734fd7ed90a85eca078"
checksum = "481ada9c543b2323cbb7bbdbb5249177fbf0188ed959ed2c15e4b22421c84ed3"
dependencies = [
"cc",
"pkg-config",
+16 -10
View File
@@ -1,6 +1,6 @@
[package]
name = "windmill"
version = "1.837.0"
version = "1.841.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.837.0"
version = "1.841.0"
authors = ["Ruben Fiszel <ruben@windmill.dev>"]
edition = "2021"
@@ -226,7 +226,12 @@ all_sqlx_features = ["all_languages", "enterprise", "enterprise_saml", "embeddin
"windmill-git-sync/all_sqlx_features"]
[patch.crates-io]
# v0.8.6 plus one commit: `Pool::begin` is not cancel-safe on Postgres. sqlx raises the
# v0.8.6 plus the fix below and two `#[sqlx::test]`-only changes, both set in .cargo/config.toml:
# `SQLX_TEST_TEMPLATE` clones each test database from a template migrated once per migration
# set instead of migrating it per test, and `SQLX_TEST_MAX_CONNECTIONS` lifts the cap on the
# connections all test pools share. The rev is tagged `windmill-0.8.6-test-template-c1c5f1f` in
# the fork so it stays fetchable.
# The fix: `Pool::begin` is not cancel-safe on Postgres. sqlx raises the
# transaction depth its rollback-on-drop guard keys on only *after* the BEGIN round trip, so
# a cancelled caller (a disconnecting API client, a `timeout`, an aborted task) leaves the
# session in a transaction nothing will end, and the pool hands that connection out again —
@@ -239,13 +244,13 @@ all_sqlx_features = ["all_languages", "enterprise", "enterprise_saml", "embeddin
# Changing any of this — a bump, a rebase of the fork, dropping these lines — still compiles
# clean, so run the guard that actually checks the behaviour is still there:
# cargo test -p windmill-common --test sqlx_begin_cancel_safe -- --ignored
sqlx = { git = "https://github.com/windmill-labs/sqlx", rev = "6bdaee94fa62a01561125646da3f99eb341f2457" }
sqlx-core = { git = "https://github.com/windmill-labs/sqlx", rev = "6bdaee94fa62a01561125646da3f99eb341f2457" }
sqlx-macros = { git = "https://github.com/windmill-labs/sqlx", rev = "6bdaee94fa62a01561125646da3f99eb341f2457" }
sqlx-macros-core = { git = "https://github.com/windmill-labs/sqlx", rev = "6bdaee94fa62a01561125646da3f99eb341f2457" }
sqlx-postgres = { git = "https://github.com/windmill-labs/sqlx", rev = "6bdaee94fa62a01561125646da3f99eb341f2457" }
sqlx-mysql = { git = "https://github.com/windmill-labs/sqlx", rev = "6bdaee94fa62a01561125646da3f99eb341f2457" }
sqlx-sqlite = { git = "https://github.com/windmill-labs/sqlx", rev = "6bdaee94fa62a01561125646da3f99eb341f2457" }
sqlx = { git = "https://github.com/windmill-labs/sqlx", rev = "c1c5f1f2a07cb1fce0e47463c314697e08f4f26b" }
sqlx-core = { git = "https://github.com/windmill-labs/sqlx", rev = "c1c5f1f2a07cb1fce0e47463c314697e08f4f26b" }
sqlx-macros = { git = "https://github.com/windmill-labs/sqlx", rev = "c1c5f1f2a07cb1fce0e47463c314697e08f4f26b" }
sqlx-macros-core = { git = "https://github.com/windmill-labs/sqlx", rev = "c1c5f1f2a07cb1fce0e47463c314697e08f4f26b" }
sqlx-postgres = { git = "https://github.com/windmill-labs/sqlx", rev = "c1c5f1f2a07cb1fce0e47463c314697e08f4f26b" }
sqlx-mysql = { git = "https://github.com/windmill-labs/sqlx", rev = "c1c5f1f2a07cb1fce0e47463c314697e08f4f26b" }
sqlx-sqlite = { git = "https://github.com/windmill-labs/sqlx", rev = "c1c5f1f2a07cb1fce0e47463c314697e08f4f26b" }
object_store = { git = "https://github.com/apache/arrow-rs-object-store", rev = "36752c975d4f29e20b57c91f81a10872dcd48ae7" }
# Use tiberius main branch for libgssapi 0.8.1 fix (https://github.com/prisma/tiberius/issues/343)
tiberius = { git = "https://github.com/prisma/tiberius", rev = "59db57960a14b422fb3a1309aa4aa47880896ff8" }
@@ -501,6 +506,7 @@ mail-send = { version = "0.4.0", features = ["builder"], default-features=false
urlencoding = "^2"
quick-xml = { version = "^0.37", features = ["serialize"] }
url = { version = "^2" , features = ["serde"]}
ipnet = "2"
async-oauth2 = "0.5.1"
reqwest = { version = "^0.13", features = ["json", "stream", "gzip", "multipart", "query", "form"] }
# The reqwest object_store builds its HTTP clients with, for a custom `HttpConnector`.
+1 -1
View File
@@ -1 +1 @@
664708fff04d4f9e0660bcae3edb307fb2c9481b
e922599943c472a6d0f736f629ae04081f866686
@@ -0,0 +1,4 @@
-- Fold edits made under ms_teams back into `teams`, which the previous version reads.
UPDATE global_settings
SET value = (value - 'ms_teams') || jsonb_build_object('teams', value -> 'ms_teams')
WHERE name = 'oauths' AND value ? 'ms_teams';
@@ -0,0 +1,6 @@
-- The Teams Entra app now lives under oauths.ms_teams (bot + Graph connect). Copy the old
-- `teams` entry and keep it, so servers still on the previous version keep working during a
-- rolling upgrade.
UPDATE global_settings
SET value = value || jsonb_build_object('ms_teams', value -> 'teams')
WHERE name = 'oauths' AND value ? 'teams' AND NOT value ? 'ms_teams';
@@ -0,0 +1 @@
DROP TABLE IF EXISTS fork_storage_namespace;
@@ -0,0 +1,24 @@
-- Workspace storages a fork/dev workspace isolates from its parent: its writes land under
-- `__wm_forks/<fork segment>/` of that storage, and its reads fall back to the parent's keys.
-- One row per (fork, storage) chosen isolated at fork creation; forks created before this
-- table have none and keep sharing the parent's keys.
--
-- Deliberately NO foreign key to workspace(id), like fork_ducklake_namespace: rows are also the
-- cleanup ledger and must OUTLIVE the workspace row when deleting the prefix fails after the
-- delete commits. A recreated same-id fork would otherwise read the deleted fork's objects
-- under the deterministic prefix; fork creation retries leftover rows and refuses to proceed
-- while they cannot be cleaned.
CREATE TABLE fork_storage_namespace (
workspace_id VARCHAR(50) NOT NULL,
-- '' = the default storage, else a `secondary_storage` name.
storage TEXT NOT NULL,
-- The storage's resolved identity at fork creation (`<lfs type>:<resource path or root
-- path>`), so cleanup deletes the prefix from the storage the fork wrote to even if the
-- name is repointed later.
storage_ref TEXT NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
PRIMARY KEY (workspace_id, storage)
);
GRANT ALL ON fork_storage_namespace TO windmill_user;
GRANT ALL ON fork_storage_namespace TO windmill_admin;
+141
View File
@@ -317,6 +317,14 @@
"type": "web_server"
}
},
"asana": {
"auth_url": "https://app.asana.com/-/oauth_authorize",
"token_url": "https://app.asana.com/-/oauth_token",
"scopes": ["default"],
"scope_options": [
{ "value": "default", "label": "Full permissions (the Asana app must be registered with Full permissions)" }
]
},
"notion": {
"auth_url": "https://api.notion.com/v1/oauth/authorize",
"token_url": "https://api.notion.com/v1/oauth/token",
@@ -380,6 +388,20 @@
}
}
},
"shopify": {
"grant_types": ["client_credentials"],
"connect_config_template": {
"display_name": "Shopify",
"label": "Shopify store",
"placeholder": "your-store",
"help_url": "https://shopify.dev/docs/apps/build/authentication-authorization/access-tokens/client-credentials-grant",
"token_url": "https://{instance}.myshopify.com/admin/oauth/access_token",
"strip_suffix": ".myshopify.com",
"resource_mapping": {
"store_name": "{instance}"
}
}
},
"sage_intacct": {
"auth_url": "https://api.intacct.com/ia/api/v1/oauth2/authorize",
"token_url": "https://api.intacct.com/ia/api/v1/oauth2/token",
@@ -478,6 +500,101 @@
}
}
},
"ms_teams": {
"req_body_auth": true,
"scopes": [
"offline_access",
"User.Read",
"Team.ReadBasic.All",
"Channel.ReadBasic.All",
"ChannelMessage.Send",
"Chat.ReadWrite",
"OnlineMeetings.ReadWrite"
],
"scope_options": [
{
"value": "offline_access",
"label": "Stay connected (refresh token)"
},
{
"value": "User.Read",
"label": "Read your profile"
},
{
"value": "Team.ReadBasic.All",
"label": "List your teams"
},
{
"value": "Channel.ReadBasic.All",
"label": "List channels"
},
{
"value": "ChannelMessage.Send",
"label": "Post and reply in channels"
},
{
"value": "Chat.ReadWrite",
"label": "Read, create and send in your chats"
},
{
"value": "Chat.ReadBasic",
"label": "List your chats"
},
{
"value": "Chat.Read",
"label": "Read your chat messages"
},
{
"value": "Chat.Create",
"label": "Create chats"
},
{
"value": "ChatMessage.Send",
"label": "Send chat messages"
},
{
"value": "OnlineMeetings.ReadWrite",
"label": "Create and read online meetings"
},
{
"value": "ChannelMessage.Read.All",
"label": "Read channel messages (admin consent)"
},
{
"value": "ChannelMember.Read.All",
"label": "List channel members (admin consent)"
},
{
"value": "TeamMember.Read.All",
"label": "List team members (admin consent)"
},
{
"value": "Channel.Create",
"label": "Create channels (admin consent)"
},
{
"value": "Schedule.Read.All",
"label": "Read Shifts schedules (admin consent)"
}
],
"connect_config_template": {
"label": "Microsoft Entra tenant",
"placeholder": "organizations, or your tenant id",
"help_url": "https://learn.microsoft.com/en-us/entra/identity-platform/v2-protocols#endpoints",
"auth_url": "https://login.microsoftonline.com/{instance}/oauth2/v2.0/authorize",
"token_url": "https://login.microsoftonline.com/{instance}/oauth2/v2.0/token",
"req_body_auth": true,
"scopes": [
"offline_access",
"User.Read",
"Team.ReadBasic.All",
"Channel.ReadBasic.All",
"ChannelMessage.Send",
"Chat.ReadWrite",
"OnlineMeetings.ReadWrite"
]
}
},
"netsuite": {
"connect_config_template": {
"display_name": "NetSuite",
@@ -593,5 +710,29 @@
"optional_scope": "tickets crm.objects.line_items.read crm.objects.line_items.write e-commerce crm.objects.quotes.read crm.objects.quotes.write crm.objects.leads.read crm.objects.leads.write crm.objects.custom.read crm.objects.custom.write crm.schemas.custom.read crm.lists.read crm.lists.write sales-email-read forms files content crm.objects.marketing_events.read marketing.campaigns.read communication_preferences.read_write automation automation.sequences.read automation.sequences.enrollments.write conversations.read conversations.write scheduler.meetings.meeting-link.read"
},
"req_body_auth": true
},
"zendesk": {
"grant_types": ["authorization_code", "client_credentials"],
"scopes": ["read", "write"],
"cc_scopes": ["read", "write"],
"scope_options": [
{ "value": "read", "label": "Read tickets, users, organizations and Help Center content" },
{ "value": "write", "label": "Create, update and delete tickets, users, organizations and Help Center content" }
],
"req_body_auth": true,
"connect_config_template": {
"display_name": "Zendesk",
"label": "Zendesk subdomain",
"placeholder": "yourcompany (from yourcompany.zendesk.com)",
"help_url": "https://developer.zendesk.com/documentation/api-basics/authentication/oauth-migration/",
"auth_url": "https://{instance}.zendesk.com/oauth/authorizations/new",
"token_url": "https://{instance}.zendesk.com/oauth/tokens",
"scopes": ["read", "write"],
"req_body_auth": true,
"strip_suffix": ".zendesk.com",
"resource_mapping": {
"subdomain": "{instance}"
}
}
}
}
@@ -7,6 +7,8 @@ authors.workspace = true
[lib]
name = "windmill_parser_bash"
path = "./src/lib.rs"
# src/ has no doctests: remove this line before adding one, or cargo test never runs it.
doctest = false
[target.'cfg(target_arch = "wasm32")'.dependencies]
regex-lite.workspace = true
@@ -7,6 +7,8 @@ authors.workspace = true
[lib]
name = "windmill_parser_csharp"
path = "./src/lib.rs"
# src/ has no doctests: remove this line before adding one, or cargo test never runs it.
doctest = false
[dependencies]
windmill-parser.workspace = true
@@ -7,6 +7,8 @@ authors.workspace = true
[lib]
name = "windmill_parser_go"
path = "./src/lib.rs"
# src/ has no doctests: remove this line before adding one, or cargo test never runs it.
doctest = false
[dependencies]
windmill-parser.workspace = true
@@ -7,6 +7,8 @@ authors.workspace = true
[lib]
name = "windmill_parser_graphql"
path = "./src/lib.rs"
# src/ has no doctests: remove this line before adding one, or cargo test never runs it.
doctest = false
[target.'cfg(target_arch = "wasm32")'.dependencies]
regex-lite.workspace = true
@@ -7,6 +7,8 @@ authors.workspace = true
[lib]
name = "windmill_parser_java"
path = "./src/lib.rs"
# src/ has no doctests: remove this line before adding one, or cargo test never runs it.
doctest = false
[dependencies]
windmill-parser.workspace = true
@@ -7,6 +7,9 @@ edition.workspace = true
[lib]
name = "windmill_parser_nu"
path = "./src/lib.rs"
# src/ has no unit tests or doctests: remove both lines before adding one, or cargo test never runs it.
test = false
doctest = false
[dependencies]
windmill-parser.workspace = true
@@ -7,6 +7,8 @@ authors.workspace = true
[lib]
name = "windmill_parser_php"
path = "./src/lib.rs"
# src/ has no doctests: remove this line before adding one, or cargo test never runs it.
doctest = false
[dependencies]
windmill-parser.workspace = true
@@ -7,6 +7,8 @@ authors.workspace = true
[lib]
name = "windmill_parser_py_asset"
path = "./src/lib.rs"
# src/ has no doctests: remove this line before adding one, or cargo test never runs it.
doctest = false
[dependencies]
windmill-parser.workspace = true
@@ -7,6 +7,9 @@ authors.workspace = true
[lib]
name = "windmill_parser_py_imports"
path = "./src/lib.rs"
# src/ has no unit tests or doctests: remove both lines before adding one, or cargo test never runs it.
test = false
doctest = false
[target.'cfg(target_arch = "wasm32")'.dependencies]
regex-lite.workspace = true
@@ -7,6 +7,8 @@ authors.workspace = true
[lib]
name = "windmill_parser_py"
path = "./src/lib.rs"
# src/ has no doctests: remove this line before adding one, or cargo test never runs it.
doctest = false
[dependencies]
windmill-parser.workspace = true
@@ -7,6 +7,8 @@ authors.workspace = true
[lib]
name = "windmill_parser_r"
path = "./src/lib.rs"
# src/ has no doctests: remove this line before adding one, or cargo test never runs it.
doctest = false
[dependencies]
windmill-parser.workspace = true
@@ -7,6 +7,8 @@ authors.workspace = true
[lib]
name = "windmill_parser_ruby"
path = "./src/lib.rs"
# src/ has no doctests: remove this line before adding one, or cargo test never runs it.
doctest = false
[dependencies]
windmill-parser.workspace = true
@@ -7,6 +7,8 @@ authors.workspace = true
[lib]
name = "windmill_parser_rust"
path = "./src/lib.rs"
# src/ has no doctests: remove this line before adding one, or cargo test never runs it.
doctest = false
[dependencies]
windmill-parser.workspace = true
@@ -7,6 +7,8 @@ authors.workspace = true
[lib]
name = "windmill_parser_sql_asset"
path = "./src/lib.rs"
# src/ has no doctests: remove this line before adding one, or cargo test never runs it.
doctest = false
[dependencies]
windmill-parser.workspace = true
@@ -7,6 +7,8 @@ authors.workspace = true
[lib]
name = "windmill_parser_sql"
path = "./src/lib.rs"
# src/ has no doctests: remove this line before adding one, or cargo test never runs it.
doctest = false
[target.'cfg(target_arch = "wasm32")'.dependencies]
regex-lite.workspace = true
@@ -7,6 +7,8 @@ authors.workspace = true
[lib]
name = "windmill_parser_ts_asset"
path = "./src/lib.rs"
# src/ has no doctests: remove this line before adding one, or cargo test never runs it.
doctest = false
[target.'cfg(target_arch = "wasm32")'.dependencies]
wasm-bindgen.workspace = true
@@ -8,6 +8,9 @@ authors.workspace = true
[lib]
name = "windmill_parser_ts"
path = "./src/lib.rs"
# src/ has no unit tests or doctests: remove both lines before adding one, or cargo test never runs it.
test = false
doctest = false
[target.'cfg(target_arch = "wasm32")'.dependencies]
wasm-bindgen.workspace = true
+14 -1
View File
@@ -189,7 +189,20 @@ pub fn parse_expr_for_imports(code: &str, skip_type_only: bool) -> anyhow::Resul
/// // Returns: ["f/utils"]
/// ```
pub fn parse_relative_imports(code: &str, path: &str) -> anyhow::Result<Vec<String>> {
let imports = parse_expr_for_imports(code, false)?;
resolve_relative_imports(code, path, false)
}
/// [`parse_relative_imports`] without type-only imports, which are erased before the code runs.
pub fn parse_runtime_relative_imports(code: &str, path: &str) -> anyhow::Result<Vec<String>> {
resolve_relative_imports(code, path, true)
}
fn resolve_relative_imports(
code: &str,
path: &str,
skip_type_only: bool,
) -> anyhow::Result<Vec<String>> {
let imports = parse_expr_for_imports(code, skip_type_only)?;
let script_dir = path.rsplit_once('/').map(|(dir, _)| dir).unwrap_or("");
let mut resolved: Vec<String> = imports
@@ -4,7 +4,7 @@ mod tests {
use windmill_parser::{Arg, MainArgSignature, ObjectProperty, ObjectType, Typ};
use windmill_parser_ts::{
parse_deno_signature, parse_expr_for_imports, parse_relative_imports,
remove_pinned_import_specifiers,
parse_runtime_relative_imports, remove_pinned_import_specifiers,
};
/// The server parses defaults natively, where a non-JSON literal cannot be evaluated
@@ -944,6 +944,19 @@ export const label = "pkg@1.2.3";
assert_eq!(result, vec!["f/folder/helper"]);
}
#[test]
fn test_runtime_relative_imports_skip_type_only() {
let code = r#"
import type { Shape } from "./types";
import { helper } from "./helper";
export async function main(s: Shape) { return helper(s); }
"#;
let result = parse_runtime_relative_imports(code, "f/folder/script").unwrap();
assert_eq!(result, vec!["f/folder/helper"]);
let all = parse_relative_imports(code, "f/folder/script").unwrap();
assert_eq!(all, vec!["f/folder/helper", "f/folder/types"]);
}
#[test]
fn test_relative_imports_double_dot() {
let code = r#"
@@ -7,6 +7,9 @@ authors.workspace = true
[lib]
name = "windmill_parser_wac"
path = "./src/lib.rs"
# src/ has no unit tests or doctests: remove both lines before adding one, or cargo test never runs it.
test = false
doctest = false
[dependencies]
ruff_python_parser.workspace = true
+24 -24
View File
@@ -6340,7 +6340,7 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windmill-common"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"aes-gcm",
"aho-corasick",
@@ -6430,7 +6430,7 @@ dependencies = [
[[package]]
name = "windmill-macros"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"proc-macro2",
"quote",
@@ -6442,7 +6442,7 @@ dependencies = [
[[package]]
name = "windmill-parser"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"convert_case",
"serde",
@@ -6451,7 +6451,7 @@ dependencies = [
[[package]]
name = "windmill-parser-bash"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"lazy_static",
@@ -6463,7 +6463,7 @@ dependencies = [
[[package]]
name = "windmill-parser-csharp"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"serde_json",
@@ -6475,7 +6475,7 @@ dependencies = [
[[package]]
name = "windmill-parser-go"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"gosyn",
@@ -6487,7 +6487,7 @@ dependencies = [
[[package]]
name = "windmill-parser-graphql"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"lazy_static",
@@ -6499,7 +6499,7 @@ dependencies = [
[[package]]
name = "windmill-parser-java"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"serde_json",
@@ -6511,7 +6511,7 @@ dependencies = [
[[package]]
name = "windmill-parser-nu"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"nu-parser",
@@ -6522,7 +6522,7 @@ dependencies = [
[[package]]
name = "windmill-parser-php"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"itertools 0.14.0",
@@ -6533,7 +6533,7 @@ dependencies = [
[[package]]
name = "windmill-parser-py"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"itertools 0.14.0",
@@ -6545,7 +6545,7 @@ dependencies = [
[[package]]
name = "windmill-parser-py-asset"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"ruff_python_ast",
@@ -6556,7 +6556,7 @@ dependencies = [
[[package]]
name = "windmill-parser-py-imports"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"async-recursion",
@@ -6579,7 +6579,7 @@ dependencies = [
[[package]]
name = "windmill-parser-r"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"serde_json",
@@ -6591,7 +6591,7 @@ dependencies = [
[[package]]
name = "windmill-parser-ruby"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"lazy_static",
@@ -6605,7 +6605,7 @@ dependencies = [
[[package]]
name = "windmill-parser-rust"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"convert_case",
@@ -6622,7 +6622,7 @@ dependencies = [
[[package]]
name = "windmill-parser-sql"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"lazy_static",
@@ -6635,7 +6635,7 @@ dependencies = [
[[package]]
name = "windmill-parser-sql-asset"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"serde",
@@ -6647,7 +6647,7 @@ dependencies = [
[[package]]
name = "windmill-parser-ts"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"lazy_static",
@@ -6665,7 +6665,7 @@ dependencies = [
[[package]]
name = "windmill-parser-ts-asset"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"serde-wasm-bindgen",
@@ -6681,7 +6681,7 @@ dependencies = [
[[package]]
name = "windmill-parser-wac"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"ruff_python_ast",
@@ -6698,7 +6698,7 @@ dependencies = [
[[package]]
name = "windmill-parser-wasm"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"getrandom 0.2.17",
@@ -6730,7 +6730,7 @@ dependencies = [
[[package]]
name = "windmill-parser-yaml"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"lazy_static",
@@ -6744,7 +6744,7 @@ dependencies = [
[[package]]
name = "windmill-types"
version = "1.837.0"
version = "1.841.0"
dependencies = [
"anyhow",
"bitflags",
@@ -12,7 +12,7 @@ resolver = "2"
members = ["."]
[workspace.package]
version = "1.837.0"
version = "1.841.0"
edition = "2021"
authors = ["Ruben Fiszel <ruben@windmill.dev>"]
@@ -7,6 +7,8 @@ edition.workspace = true
[lib]
name = "windmill_parser_yaml"
path = "./src/lib.rs"
# src/ has no doctests: remove this line before adding one, or cargo test never runs it.
doctest = false
[dependencies]
yaml-rust.workspace = true
@@ -7,6 +7,8 @@ authors.workspace = true
[lib]
name = "windmill_parser"
path = "./src/lib.rs"
# src/ has no doctests: remove this line before adding one, or cargo test never runs it.
doctest = false
[dependencies]
serde = { version = "1.0", features = ["derive"] }
@@ -9,6 +9,8 @@ authors.workspace = true
crate-type = ["cdylib"]
name = "windmill_sql_datatype_parser_wasm"
path = "./src/lib.rs"
# src/ has no unit tests: remove this line before adding one, or cargo test never runs it.
test = false
[dev-dependencies]
wasm-bindgen-test.workspace = true
+54 -23
View File
@@ -44,12 +44,13 @@ use windmill_common::{
CRITICAL_ALERTS_ON_TOKEN_EXPIRY_SETTING, CRITICAL_ALERT_MUTE_UI_SETTING,
CRITICAL_ALERT_MUTE_ZOMBIE_JOB_RESTART_SETTING, CRITICAL_ERROR_CHANNELS_SETTING,
CUSTOM_TAGS_SETTING, DEFAULT_TAGS_PER_WORKSPACE_SETTING, DEFAULT_TAGS_WORKSPACES_SETTING,
DEPENDENCY_JOB_TAG_SETTING, DISABLE_PASSWORD_LOGIN_SETTING, EMAIL_DOMAIN_SETTING,
ENV_SETTINGS, EXPOSE_DEBUG_METRICS_SETTING, EXPOSE_METRICS_SETTING,
EXTRA_PIP_INDEX_URL_SETTING, FORK_WORKSPACE_TAG_APPEND_FORK_SUFFIX_SETTING,
HTTP_ROUTE_DEFAULT_ALLOWED_ORIGINS_SETTING, HTTP_ROUTE_WORKSPACED_ROUTE_SETTING,
HUB_API_SECRET_SETTING, HUB_BASE_URL_SETTING, INDEXER_SETTING,
INSTANCE_EVENTS_WEBHOOK_SETTING, INSTANCE_PYTHON_VERSION_SETTING,
DEPENDENCY_JOB_TAG_SETTING, DEV_WORKSPACE_ISOLATION_SETTING,
DEV_WORKSPACE_ISOLATION_SKIP_NON_DEV_FORKS_SETTING, DEV_WORKSPACE_TAG_SUFFIX_SETTING,
DISABLE_PASSWORD_LOGIN_SETTING, EMAIL_DOMAIN_SETTING, ENV_SETTINGS,
EXPOSE_DEBUG_METRICS_SETTING, EXPOSE_METRICS_SETTING, EXTRA_PIP_INDEX_URL_SETTING,
FORK_WORKSPACE_TAG_APPEND_FORK_SUFFIX_SETTING, HTTP_ROUTE_DEFAULT_ALLOWED_ORIGINS_SETTING,
HTTP_ROUTE_WORKSPACED_ROUTE_SETTING, HUB_API_SECRET_SETTING, HUB_BASE_URL_SETTING,
INDEXER_SETTING, INSTANCE_EVENTS_WEBHOOK_SETTING, INSTANCE_PYTHON_VERSION_SETTING,
JOB_DEFAULT_TIMEOUT_SECS_SETTING, JOB_ISOLATION_SETTING, JWT_SECRET_SETTING,
KEEP_JOB_DIR_SETTING, LICENSE_KEY_SETTING, MAVEN_REPOS_SETTING, MAVEN_SETTINGS_XML_SETTING,
MCP_DISABLE_TOKEN_QUERY_PARAM_SETTING, MONITOR_LOGS_ON_OBJECT_STORE_SETTING,
@@ -129,7 +130,9 @@ use windmill_worker::{
use crate::monitor::{
initial_load, load_concurrency_key_max_queued, load_dependency_job_tag,
load_disable_password_login, load_fork_workspace_tag_append_fork_suffix, load_keep_job_dir,
load_dev_workspace_isolation, load_dev_workspace_isolation_skip_non_dev_forks,
load_dev_workspace_tag_suffix, load_disable_password_login,
load_fork_workspace_tag_append_fork_suffix, load_keep_job_dir,
load_mcp_disable_token_query_param, load_metrics_debug_enabled, load_preview_tags_override,
load_require_preexisting_user, load_retention_period_overrides, load_tag_per_workspace_enabled,
load_tag_per_workspace_workspaces, load_workspace_fairness_duration_secs,
@@ -683,6 +686,29 @@ async fn windmill_main() -> anyhow::Result<()> {
_ => {}
}
// Before `num_workers`: it reads `WORKER_GROUP`, which an agent authenticating with a
// workload identity token only learns from the server.
let agent_setup = if mode == Mode::Agent {
let agent_config = match AgentConfig::from_env() {
Ok(config) => config,
Err(e) => {
eprintln!("{e}");
std::process::exit(1);
}
};
let suffix = resolve_worker_suffix(&hostname, 1)?;
if let Err(e) = agent_config.resolve_workload_identity(&suffix).await {
eprintln!(
"Agent worker could not authenticate with its workload identity token, check \
AGENT_IDENTITY_TOKEN_FILE and BASE_INTERNAL_URL (the reason is in the server log): {e:#}"
);
std::process::exit(1);
}
Some((agent_config, suffix))
} else {
None
};
#[allow(unused_mut)]
let mut num_workers = if mode == Mode::Server || mode == Mode::Indexer || mode == Mode::MCP {
0
@@ -735,19 +761,11 @@ async fn windmill_main() -> anyhow::Result<()> {
.and_then(|x| x.parse().ok())
.unwrap_or(IpAddr::from(default_bind_addr));
let (conn, first_suffix, agent_config) = if mode == Mode::Agent {
let agent_config = match AgentConfig::from_env() {
Ok(config) => config,
Err(e) => {
tracing::error!("{e}");
std::process::exit(1);
}
};
let (conn, first_suffix, agent_config) = if let Some((agent_config, suffix)) = agent_setup {
tracing::info!(
"Creating http client for cluster using base internal url {}",
agent_config.base_internal_url
);
let suffix = resolve_worker_suffix(&hostname, 1)?;
(
Connection::Http(agent_config.build_http_client(&suffix)),
Some(suffix),
@@ -846,6 +864,8 @@ async fn windmill_main() -> anyhow::Result<()> {
let worker_mode = num_workers > 0;
if worker_mode {
windmill_common::worker::warn_secret_shaped_whitelist_envs();
#[cfg(any(target_os = "linux"))]
if let Err(e) = disable_oom_group() {
tracing::warn!(
@@ -991,7 +1011,7 @@ Windmill Community Edition {GIT_VERSION}
tracing::error!("Failed to reload license key: {err:#}");
if is_agent {
tracing::error!(
"Agent worker cannot connect to server. Please check AGENT_TOKEN and BASE_INTERNAL_URL"
"Agent worker cannot connect to server. Please check AGENT_TOKEN (or AGENT_IDENTITY_TOKEN_FILE) and BASE_INTERNAL_URL"
);
std::process::exit(1);
}
@@ -1052,12 +1072,8 @@ Windmill Community Edition {GIT_VERSION}
// Before the first load: it can sign a token for instance object storage.
#[cfg(all(feature = "enterprise", feature = "openidconnect", feature = "private"))]
windmill_common::oidc_ee::init_oidc_signing(
&conn,
server_mode,
killpill_rx.resubscribe(),
)
.await?;
windmill_common::oidc_ee::init_oidc_signing(&conn, server_mode, killpill_rx.resubscribe())
.await?;
initial_load(
&conn,
@@ -1881,6 +1897,21 @@ async fn process_notify_event(
tracing::error!("Error loading dependency job tag: {e:#}");
}
}
DEV_WORKSPACE_ISOLATION_SETTING => {
if let Err(e) = load_dev_workspace_isolation(db).await {
tracing::error!("Error loading dev workspace isolation: {e:#}");
}
}
DEV_WORKSPACE_ISOLATION_SKIP_NON_DEV_FORKS_SETTING => {
if let Err(e) = load_dev_workspace_isolation_skip_non_dev_forks(db).await {
tracing::error!("Error loading dev workspace isolation of forks: {e:#}");
}
}
DEV_WORKSPACE_TAG_SUFFIX_SETTING => match load_dev_workspace_tag_suffix(db).await {
Ok(true) if worker_mode => reload_worker_config(db, tx.clone(), true).await,
Ok(_) => (),
Err(e) => tracing::error!("Error loading dev workspace tag suffix: {e:#}"),
},
WORKSPACE_FAIRNESS_ENABLED_SETTING => {
if let Err(e) = load_workspace_fairness_enabled(db).await {
tracing::error!("Error loading workspace fairness enabled: {e:#}");
+84 -20
View File
@@ -60,17 +60,19 @@ use windmill_common::{
CRITICAL_ALERTS_ON_DB_OVERSIZE_SETTING, CRITICAL_ALERTS_ON_TOKEN_EXPIRY_SETTING,
CRITICAL_ALERT_MUTE_UI_SETTING, CRITICAL_ALERT_MUTE_ZOMBIE_JOB_RESTART_SETTING,
CRITICAL_ERROR_CHANNELS_SETTING, CUSTOM_TAGS_SETTING, DEFAULT_TAGS_PER_WORKSPACE_SETTING,
DEFAULT_TAGS_WORKSPACES_SETTING, DEPENDENCY_JOB_TAG_SETTING, DISABLE_PASSWORD_LOGIN,
DISABLE_PASSWORD_LOGIN_SETTING, EXPOSE_DEBUG_METRICS_SETTING, EXPOSE_METRICS_SETTING,
EXTRA_PIP_INDEX_URL_SETTING, FORK_WORKSPACE_TAG_APPEND_FORK_SUFFIX_SETTING,
HUB_API_SECRET_SETTING, HUB_BASE_URL_SETTING, INSTANCE_PYTHON_VERSION_SETTING,
JOB_DEFAULT_TIMEOUT_SECS_SETTING, JOB_ISOLATION_SETTING, JWT_SECRET_SETTING,
KEEP_JOB_DIR_SETTING, LICENSE_KEY_SETTING, MCP_DISABLE_TOKEN_QUERY_PARAM,
MCP_DISABLE_TOKEN_QUERY_PARAM_SETTING, MONITOR_LOGS_ON_OBJECT_STORE_SETTING, NPMRC_SETTING,
NPM_CONFIG_REGISTRY_SETTING, NSJAIL_TMPFS_SIZE_MB_SETTING, NSJAIL_TMP_BACKING_SETTING,
NUGET_CONFIG_SETTING, OTEL_SETTING, OTEL_TRACES_RETENTION_SECS_SETTING,
OTEL_TRACING_PROXY_SETTING, PIP_INDEX_URL_SETTING, POWERSHELL_REPO_PAT_SETTING,
POWERSHELL_REPO_URL_SETTING, PREVIEW_TAGS_OVERRIDE_SETTING, REQUEST_SIZE_LIMIT_SETTING,
DEFAULT_TAGS_WORKSPACES_SETTING, DEPENDENCY_JOB_TAG_SETTING,
DEV_WORKSPACE_ISOLATION_SETTING, DEV_WORKSPACE_ISOLATION_SKIP_NON_DEV_FORKS_SETTING,
DEV_WORKSPACE_TAG_SUFFIX_SETTING, DISABLE_PASSWORD_LOGIN, DISABLE_PASSWORD_LOGIN_SETTING,
EXPOSE_DEBUG_METRICS_SETTING, EXPOSE_METRICS_SETTING, EXTRA_PIP_INDEX_URL_SETTING,
FORK_WORKSPACE_TAG_APPEND_FORK_SUFFIX_SETTING, HUB_API_SECRET_SETTING,
HUB_BASE_URL_SETTING, INSTANCE_PYTHON_VERSION_SETTING, JOB_DEFAULT_TIMEOUT_SECS_SETTING,
JOB_ISOLATION_SETTING, JWT_SECRET_SETTING, KEEP_JOB_DIR_SETTING, LICENSE_KEY_SETTING,
MCP_DISABLE_TOKEN_QUERY_PARAM, MCP_DISABLE_TOKEN_QUERY_PARAM_SETTING,
MONITOR_LOGS_ON_OBJECT_STORE_SETTING, NPMRC_SETTING, NPM_CONFIG_REGISTRY_SETTING,
NSJAIL_TMPFS_SIZE_MB_SETTING, NSJAIL_TMP_BACKING_SETTING, NUGET_CONFIG_SETTING,
OTEL_SETTING, OTEL_TRACES_RETENTION_SECS_SETTING, OTEL_TRACING_PROXY_SETTING,
PIP_INDEX_URL_SETTING, POWERSHELL_REPO_PAT_SETTING, POWERSHELL_REPO_URL_SETTING,
PREVIEW_TAGS_OVERRIDE_SETTING, REQUEST_SIZE_LIMIT_SETTING,
REQUIRE_PREEXISTING_USER_FOR_OAUTH_SETTING, RETENTION_PERIOD_SECS_SETTING,
SAML_METADATA_SETTING, SANDBOX_IMAGE_CACHE_MAX_MB_SETTING,
SANDBOX_IMAGE_DEFAULT_REGISTRY_SETTING, SANDBOX_IMAGE_MAX_SIZE_MB_SETTING,
@@ -89,15 +91,18 @@ use windmill_common::{
users::truncate_token,
utils::{empty_as_none, now_from_db, report_critical_error, Mode, HUB_API_SECRET},
worker::{
load_env_vars, load_init_bash_from_env, load_periodic_bash_script_from_env,
load_periodic_bash_script_interval_from_env, load_whitelist_env_vars_from_env,
load_worker_config, store_pull_query, store_suspended_pull_query, Connection, WorkerConfig,
CLOUD_HOSTED, CONCURRENCY_KEY_MAX_QUEUED, CONCURRENCY_KEY_MAX_QUEUED_DEFAULT,
DEFAULT_TAGS_PER_WORKSPACE, DEFAULT_TAGS_WORKSPACES, DEPENDENCY_JOB_TAG,
FORK_WORKSPACE_TAG_APPEND_FORK_SUFFIX, INDEXER_CONFIG, PREVIEW_TAGS_OVERRIDE, SMTP_CONFIG,
WINDMILL_DIR, WORKER_CONFIG, WORKER_GROUP, WORKSPACE_FAIRNESS_DURATION_SECS,
WORKSPACE_FAIRNESS_ENABLED, WORKSPACE_FAIRNESS_MAX_PERCENT, WORKSPACE_FAIRNESS_MIN_TOTAL,
WORKSPACE_MAX_QUEUED_JOBS, WORKSPACE_MAX_QUEUED_JOBS_DEFAULT,
is_valid_dev_workspace_tag_suffix, load_env_vars, load_init_bash_from_env,
load_periodic_bash_script_from_env, load_periodic_bash_script_interval_from_env,
load_whitelist_env_vars_from_env, load_worker_config, store_pull_query,
store_suspended_pull_query, Connection, WorkerConfig, CLOUD_HOSTED,
CONCURRENCY_KEY_MAX_QUEUED, CONCURRENCY_KEY_MAX_QUEUED_DEFAULT,
DEFAULT_DEV_WORKSPACE_TAG_SUFFIX, DEFAULT_TAGS_PER_WORKSPACE, DEFAULT_TAGS_WORKSPACES,
DEPENDENCY_JOB_TAG, DEV_WORKSPACE_ISOLATION, DEV_WORKSPACE_ISOLATION_SKIP_NON_DEV_FORKS,
DEV_WORKSPACE_TAG_SUFFIX, FORK_WORKSPACE_TAG_APPEND_FORK_SUFFIX, INDEXER_CONFIG,
PREVIEW_TAGS_OVERRIDE, SMTP_CONFIG, WINDMILL_DIR, WORKER_CONFIG, WORKER_GROUP,
WORKSPACE_FAIRNESS_DURATION_SECS, WORKSPACE_FAIRNESS_ENABLED,
WORKSPACE_FAIRNESS_MAX_PERCENT, WORKSPACE_FAIRNESS_MIN_TOTAL, WORKSPACE_MAX_QUEUED_JOBS,
WORKSPACE_MAX_QUEUED_JOBS_DEFAULT,
},
KillpillSender, AUDIT_LOG_RETENTION_DAYS, BASE_URL, CRITICAL_ALERTS_ON_DB_OVERSIZE,
CRITICAL_ALERTS_ON_TOKEN_EXPIRY, CRITICAL_ALERT_MUTE_UI_ENABLED,
@@ -321,6 +326,18 @@ pub async fn initial_load(
pass.setting(DEPENDENCY_JOB_TAG_SETTING, false, |v| async move {
apply_dependency_job_tag(v)
});
// Ahead of the worker config reload below, which expands the tags with it.
pass.setting(DEV_WORKSPACE_TAG_SUFFIX_SETTING, false, |v| async move {
apply_dev_workspace_tag_suffix(v);
});
pass.setting(DEV_WORKSPACE_ISOLATION_SETTING, false, |v| async move {
apply_dev_workspace_isolation(v)
});
pass.setting(
DEV_WORKSPACE_ISOLATION_SKIP_NON_DEV_FORKS_SETTING,
false,
|v| async move { apply_dev_workspace_isolation_skip_non_dev_forks(v) },
);
// Load per-workspace retention overrides before the first cleanup tick so a fresh server
// never sweeps globally without honoring configured longer-retention workspaces.
@@ -1127,6 +1144,53 @@ pub fn apply_fork_workspace_tag_append_fork_suffix(value: Option<serde_json::Val
};
}
/// Returns whether the suffix changed, in which case a worker must reload its config: a group
/// serving dev workspaces listens to its tags expanded with it.
pub async fn load_dev_workspace_tag_suffix(db: &DB) -> error::Result<bool> {
let v = load_value_from_global_settings(db, DEV_WORKSPACE_TAG_SUFFIX_SETTING).await?;
Ok(apply_dev_workspace_tag_suffix(v))
}
pub fn apply_dev_workspace_tag_suffix(value: Option<serde_json::Value>) -> bool {
let suffix = match value {
Some(serde_json::Value::String(t)) if !t.trim().is_empty() => t.trim().to_string(),
_ => DEFAULT_DEV_WORKSPACE_TAG_SUFFIX.to_string(),
};
if !is_valid_dev_workspace_tag_suffix(&suffix) {
tracing::error!("Ignoring invalid dev workspace tag suffix {suffix:?}");
return false;
}
let prev = DEV_WORKSPACE_TAG_SUFFIX.swap(std::sync::Arc::new(suffix.clone()));
*prev != suffix
}
pub async fn load_dev_workspace_isolation(db: &DB) -> error::Result<()> {
let v = load_value_from_global_settings(db, DEV_WORKSPACE_ISOLATION_SETTING).await?;
apply_dev_workspace_isolation(v);
Ok(())
}
pub fn apply_dev_workspace_isolation(value: Option<serde_json::Value>) {
DEV_WORKSPACE_ISOLATION.store(
matches!(value, Some(serde_json::Value::Bool(true))),
Ordering::Relaxed,
);
}
pub async fn load_dev_workspace_isolation_skip_non_dev_forks(db: &DB) -> error::Result<()> {
let v = load_value_from_global_settings(db, DEV_WORKSPACE_ISOLATION_SKIP_NON_DEV_FORKS_SETTING)
.await?;
apply_dev_workspace_isolation_skip_non_dev_forks(v);
Ok(())
}
pub fn apply_dev_workspace_isolation_skip_non_dev_forks(value: Option<serde_json::Value>) {
DEV_WORKSPACE_ISOLATION_SKIP_NON_DEV_FORKS.store(
matches!(value, Some(serde_json::Value::Bool(true))),
Ordering::Relaxed,
);
}
pub async fn reload_critical_alert_mute_ui_setting(conn: &Connection) -> error::Result<()> {
let v = load_value_from_global_settings_with_conn(conn, CRITICAL_ALERT_MUTE_UI_SETTING, true)
.await?;
+208
View File
@@ -0,0 +1,208 @@
//! Sets the process-wide `DEV_WORKSPACE_ISOLATION`, so it lives in its own test binary: any other
//! test pushing a job in the same process would land on a suffixed tag.
use std::collections::HashMap;
use sqlx::{Pool, Postgres};
use windmill_common::{
jobs::{JobPayload, RawCode},
runnable_settings::{ConcurrencySettings, DebouncingSettings},
scripts::{ScriptHash, ScriptLang},
worker::{DEV_WORKSPACE_ISOLATION, DEV_WORKSPACE_ISOLATION_SKIP_NON_DEV_FORKS},
};
use windmill_queue::{PushArgs, PushIsolationLevel};
async fn pushed_tag(
db: &Pool<Postgres>,
workspace_id: &str,
payload: JobPayload,
tag: Option<&str>,
) -> String {
try_pushed_tag(db, workspace_id, payload, tag)
.await
.expect("push must succeed")
}
async fn try_pushed_tag(
db: &Pool<Postgres>,
workspace_id: &str,
payload: JobPayload,
tag: Option<&str>,
) -> Result<String, windmill_common::error::Error> {
let args = HashMap::new();
let (id, tx) = windmill_queue::push(
db,
PushIsolationLevel::IsolatedRoot(db.clone()),
workspace_id,
payload,
PushArgs::from(&args),
"test-user",
"test@windmill.dev",
"u/test-user".to_string(),
None,
None,
None,
None,
None,
None,
None,
None,
false,
false,
None,
true,
tag.map(str::to_string),
None,
None,
None,
None,
false,
None,
None,
None,
None,
)
.await?;
tx.commit().await.unwrap();
Ok(sqlx::query_scalar("SELECT tag FROM v2_job WHERE id = $1")
.bind(id)
.fetch_one(db)
.await
.unwrap())
}
fn preview() -> JobPayload {
JobPayload::Code(RawCode {
hash: None,
content: "echo hi".to_string(),
path: None,
language: ScriptLang::Bash,
lock: None,
concurrency_settings: ConcurrencySettings::default().into(),
debouncing_settings: DebouncingSettings::default(),
cache_ttl: None,
cache_ignore_s3_path: None,
dedicated_worker: None,
modules: None,
tag: None,
})
}
#[sqlx::test(fixtures("base"))]
async fn dev_workspace_and_fork_jobs_run_on_suffixed_tags(db: Pool<Postgres>) {
DEV_WORKSPACE_ISOLATION.store(true, std::sync::atomic::Ordering::Relaxed);
// A dev workspace, a fork of it, a fork whose parent was deleted (`ON DELETE SET NULL`), and a
// fork of the root with a fork of its own.
sqlx::query(
"INSERT INTO workspace (id, name, owner, parent_workspace_id, is_dev_workspace) VALUES
('staging', 'staging', 'test-user', 'test-workspace', true),
('wm-fork-a', 'fork', 'test-user', 'staging', false),
('wm-fork-orphan', 'orphan', 'test-user', NULL, false),
('wm-fork-root', 'root fork', 'test-user', 'test-workspace', false),
('wm-fork-root-2', 'root fork 2', 'test-user', 'wm-fork-root', false),
('archived-dev', 'archived dev', 'test-user', 'test-workspace', false),
('wm-fork-of-archived', 'fork of archived dev', 'test-user', 'archived-dev', false)",
)
.execute(&db)
.await
.unwrap();
sqlx::query(
"INSERT INTO workspace_settings (workspace_id) VALUES
('staging'), ('wm-fork-a'), ('wm-fork-orphan'), ('wm-fork-root'), ('wm-fork-root-2'),
('archived-dev'), ('wm-fork-of-archived')",
)
.execute(&db)
.await
.unwrap();
for (workspace, tag, expected) in [
("test-workspace", None, "bash"),
("test-workspace", Some("gpu"), "gpu"),
("staging", None, "bash-dev"),
("staging", Some("gpu"), "gpu-dev"),
// A tag inherited from a dev job (a flow step, an agent's tool) is not suffixed twice.
("staging", Some("gpu-dev"), "gpu-dev"),
("wm-fork-a", None, "bash-dev"),
("wm-fork-orphan", None, "bash-dev"),
("wm-fork-root", None, "bash-dev"),
] {
assert_eq!(
pushed_tag(&db, workspace, preview(), tag).await,
expected,
"{workspace} with tag {tag:?}"
);
}
// Only the forks whose lineage holds no dev workspace leave isolation. An orphaned fork's
// lineage is unknown, and so is that of a fork of an archived dev workspace (archiving clears
// `is_dev_workspace`), so both stay.
sqlx::query("UPDATE workspace SET deleted = true WHERE id = 'archived-dev'")
.execute(&db)
.await
.unwrap();
DEV_WORKSPACE_ISOLATION_SKIP_NON_DEV_FORKS.store(true, std::sync::atomic::Ordering::Relaxed);
for (workspace, expected) in [
("wm-fork-root", "bash"),
("wm-fork-root-2", "bash"),
("staging", "bash-dev"),
("wm-fork-a", "bash-dev"),
("wm-fork-orphan", "bash-dev"),
("wm-fork-of-archived", "bash-dev"),
] {
assert_eq!(
pushed_tag(&db, workspace, preview(), None).await,
expected,
"{workspace} with non-dev forks not isolated"
);
}
DEV_WORKSPACE_ISOLATION_SKIP_NON_DEV_FORKS.store(false, std::sync::atomic::Ordering::Relaxed);
// A dedicated worker tag already names the workspace, and its worker is placed by hand.
let dedicated = JobPayload::ScriptHash {
hash: ScriptHash(123412),
path: "f/system/hello".to_string(),
cache_ttl: None,
cache_ignore_s3_path: None,
dedicated_worker: Some(true),
language: ScriptLang::Bun,
priority: None,
apply_preprocessor: false,
concurrency_settings: ConcurrencySettings::default(),
debouncing_settings: DebouncingSettings::default(),
labels: None,
job_token_scopes: None,
};
assert_eq!(
pushed_tag(&db, "staging", dedicated, None).await,
"staging:f/system/hello"
);
// A hashed dedicated tag keeps only a prefix of its workspace id: a dev workspace sharing that
// prefix does not get to use another workspace's dedicated worker.
let root = "a".repeat(40);
let dev = format!("{root}-dev");
sqlx::query(
"INSERT INTO workspace (id, name, owner, parent_workspace_id, is_dev_workspace)
VALUES ($1, 'root', 'test-user', NULL, false), ($2, 'dev', 'test-user', $1, true)",
)
.bind(&root)
.bind(&dev)
.execute(&db)
.await
.unwrap();
sqlx::query("INSERT INTO workspace_settings (workspace_id) VALUES ($1), ($2)")
.bind(&root)
.bind(&dev)
.execute(&db)
.await
.unwrap();
let root_dedicated =
windmill_common::worker::dedicated_worker_tag(&root, "f/some/long/script/path");
assert!(
try_pushed_tag(&db, &dev, preview(), Some(&root_dedicated))
.await
.is_err(),
"{root_dedicated} must not stay unsuffixed, and suffixed it no longer fits a job tag"
);
}
-480
View File
@@ -1,480 +0,0 @@
use sqlx::{Pool, Postgres};
use windmill_test_utils::*;
/// Test that workspace error handler can be set and removed via database operations
#[cfg(feature = "deno_core")]
#[sqlx::test(fixtures("base"))]
async fn test_error_handler_settings(db: Pool<Postgres>) -> anyhow::Result<()> {
initialize_tracing().await;
let _server = ApiServer::start(db.clone()).await?;
// Initially error_handler should be NULL
let initial = sqlx::query_scalar!(
r#"SELECT error_handler->>'path' FROM workspace_settings WHERE workspace_id = 'test-workspace'"#
)
.fetch_one(&db)
.await?;
assert!(initial.is_none());
// Set error handler with all options
sqlx::query!(
r#"
UPDATE workspace_settings
SET error_handler = '{"path": "script/f/test/error_handler", "extra_args": {"notify": true}, "muted_on_cancel": true, "muted_on_user_path": false}'::jsonb
WHERE workspace_id = 'test-workspace'
"#
)
.execute(&db)
.await?;
let after_set = sqlx::query_scalar!(
r#"SELECT error_handler->>'path' FROM workspace_settings WHERE workspace_id = 'test-workspace'"#
)
.fetch_one(&db)
.await?;
assert_eq!(after_set, Some("script/f/test/error_handler".to_string()));
// Verify extra_args
let extra_args = sqlx::query_scalar!(
r#"SELECT error_handler->'extra_args' FROM workspace_settings WHERE workspace_id = 'test-workspace'"#
)
.fetch_one(&db)
.await?;
assert!(extra_args.is_some());
// Verify muted_on_cancel
let muted_on_cancel = sqlx::query_scalar!(
r#"SELECT (error_handler->>'muted_on_cancel')::boolean FROM workspace_settings WHERE workspace_id = 'test-workspace'"#
)
.fetch_one(&db)
.await?;
assert_eq!(muted_on_cancel, Some(true));
// Verify muted_on_user_path
let muted_on_user_path = sqlx::query_scalar!(
r#"SELECT (error_handler->>'muted_on_user_path')::boolean FROM workspace_settings WHERE workspace_id = 'test-workspace'"#
)
.fetch_one(&db)
.await?;
assert_eq!(muted_on_user_path, Some(false));
// Remove error handler
sqlx::query!(
r#"
UPDATE workspace_settings
SET error_handler = NULL
WHERE workspace_id = 'test-workspace'
"#
)
.execute(&db)
.await?;
let after_remove = sqlx::query_scalar!(
r#"SELECT error_handler->>'path' FROM workspace_settings WHERE workspace_id = 'test-workspace'"#
)
.fetch_one(&db)
.await?;
assert!(after_remove.is_none());
Ok(())
}
/// Test that a failed job triggers the workspace error handler
#[cfg(all(feature = "deno_core", feature = "enterprise", feature = "private"))]
#[sqlx::test(fixtures("base"))]
async fn test_error_handler_triggered_on_failure(db: Pool<Postgres>) -> anyhow::Result<()> {
use windmill_common::jobs::JobPayload;
use windmill_common::runnable_settings::{ConcurrencySettings, DebouncingSettings};
use windmill_common::scripts::{ScriptHash, ScriptLang};
initialize_tracing().await;
let server = ApiServer::start(db.clone()).await?;
// Create the error handler script
let error_handler_code = r#"
export async function main(path: string, email: string, job_id: string, is_flow: boolean, workspace_id: string, error: any) {
console.log("Error handler called for job:", job_id);
return { handled: true, original_path: path };
}
"#;
sqlx::query!(
r#"
INSERT INTO script (workspace_id, hash, path, content, language, kind, created_by, schema, summary, description, lock)
VALUES ('test-workspace', 1111111111, 'f/test/error_handler', $1, 'bun', 'script', 'test-user', '{}', 'Error handler script', 'Handles failed job completions', E'{}\n//bun.lock\n<empty>')
"#,
error_handler_code
)
.execute(&db)
.await?;
// Create a script that will fail
let failing_script_code = "export function main() { throw new Error('intentional failure'); }";
let failing_script_hash: i64 = 2222222222;
sqlx::query!(
r#"
INSERT INTO script (workspace_id, hash, path, content, language, kind, created_by, schema, summary, description, lock)
VALUES ('test-workspace', $1, 'f/test/failing_script', $2, 'bun', 'script', 'test-user', '{}', 'Failing test script', 'A script that always fails', E'{}\n//bun.lock\n<empty>')
"#,
failing_script_hash,
failing_script_code
)
.execute(&db)
.await?;
// Set up the error handler in workspace_settings
sqlx::query!(
r#"
UPDATE workspace_settings
SET error_handler = '{"path": "script/f/test/error_handler"}'::jsonb
WHERE workspace_id = 'test-workspace'
"#
)
.execute(&db)
.await?;
// Create the error_handler group
sqlx::query!(
r#"
INSERT INTO group_ (workspace_id, name, summary, extra_perms)
VALUES ('test-workspace', 'error_handler', 'The group the error handler acts on behalf of', '{"u/test-user": true}')
ON CONFLICT DO NOTHING
"#
)
.execute(&db)
.await?;
// Run the failing script
let completed_job = RunJob::from(JobPayload::ScriptHash {
hash: ScriptHash(failing_script_hash),
path: "f/test/failing_script".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,
})
.run_until_complete(&db, false, server.addr.port())
.await;
// Verify the job actually failed
assert!(!completed_job.success, "Job should have failed");
let main_job_id = completed_job.id;
// Wait for the error handler job to be created
tokio::time::sleep(tokio::time::Duration::from_millis(500)).await;
// Verify the error handler job was created
let error_handler_job = sqlx::query!(
r#"
SELECT
id,
runnable_path,
permissioned_as_email,
parent_job
FROM v2_job
WHERE workspace_id = 'test-workspace'
AND permissioned_as_email = 'error_handler@windmill.dev'
ORDER BY created_at DESC
LIMIT 1
"#
)
.fetch_optional(&db)
.await?;
assert!(
error_handler_job.is_some(),
"Error handler job should have been created"
);
let handler_job = error_handler_job.unwrap();
assert_eq!(
handler_job.runnable_path.as_deref(),
Some("f/test/error_handler"),
"Error handler should run the configured script"
);
assert_eq!(
handler_job.permissioned_as_email.as_str(),
"error_handler@windmill.dev",
"Error handler should run as error_handler user"
);
assert_eq!(
handler_job.parent_job,
Some(main_job_id),
"Error handler should have the failed job as parent"
);
Ok(())
}
/// Test that error handler is NOT triggered when ws_error_handler_muted is set on the script
#[cfg(all(feature = "deno_core", feature = "enterprise", feature = "private"))]
#[sqlx::test(fixtures("base"))]
async fn test_error_handler_muted_on_script(db: Pool<Postgres>) -> anyhow::Result<()> {
use windmill_common::jobs::JobPayload;
use windmill_common::runnable_settings::{ConcurrencySettings, DebouncingSettings};
use windmill_common::scripts::{ScriptHash, ScriptLang};
initialize_tracing().await;
let server = ApiServer::start(db.clone()).await?;
// Create the error handler script
sqlx::query!(
r#"
INSERT INTO script (workspace_id, hash, path, content, language, kind, created_by, schema, summary, description, lock)
VALUES ('test-workspace', 3333333333, 'f/test/error_handler', 'export function main() { return "handled"; }', 'bun', 'script', 'test-user', '{}', '', '', E'{}\n//bun.lock\n<empty>')
"#,
)
.execute(&db)
.await?;
// Create a failing script with ws_error_handler_muted = true
let failing_script_hash: i64 = 4444444444;
sqlx::query!(
r#"
INSERT INTO script (workspace_id, hash, path, content, language, kind, created_by, schema, summary, description, lock, ws_error_handler_muted)
VALUES ('test-workspace', $1, 'f/test/muted_failing_script', 'export function main() { throw new Error("fail"); }', 'bun', 'script', 'test-user', '{}', '', '', E'{}\n//bun.lock\n<empty>', true)
"#,
failing_script_hash,
)
.execute(&db)
.await?;
// Set up the error handler
sqlx::query!(
r#"
UPDATE workspace_settings
SET error_handler = '{"path": "script/f/test/error_handler"}'::jsonb
WHERE workspace_id = 'test-workspace'
"#
)
.execute(&db)
.await?;
sqlx::query!(
r#"
INSERT INTO group_ (workspace_id, name, summary, extra_perms)
VALUES ('test-workspace', 'error_handler', 'Error handler group', '{"u/test-user": true}')
ON CONFLICT DO NOTHING
"#
)
.execute(&db)
.await?;
// Run the muted failing script
let completed_job = RunJob::from(JobPayload::ScriptHash {
hash: ScriptHash(failing_script_hash),
path: "f/test/muted_failing_script".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,
})
.run_until_complete(&db, false, server.addr.port())
.await;
assert!(!completed_job.success, "Job should have failed");
// Wait and check that NO error handler job was created
tokio::time::sleep(tokio::time::Duration::from_millis(500)).await;
let error_handler_job = sqlx::query_scalar!(
r#"
SELECT id
FROM v2_job
WHERE workspace_id = 'test-workspace'
AND permissioned_as_email = 'error_handler@windmill.dev'
"#
)
.fetch_optional(&db)
.await?;
assert!(
error_handler_job.is_none(),
"Error handler should NOT have been triggered for a muted script"
);
Ok(())
}
/// Test that error handler is NOT triggered on successful job completion
#[cfg(all(feature = "deno_core", feature = "enterprise", feature = "private"))]
#[sqlx::test(fixtures("base"))]
async fn test_error_handler_not_triggered_on_success(db: Pool<Postgres>) -> anyhow::Result<()> {
use windmill_common::jobs::JobPayload;
use windmill_common::runnable_settings::{ConcurrencySettings, DebouncingSettings};
use windmill_common::scripts::{ScriptHash, ScriptLang};
initialize_tracing().await;
let server = ApiServer::start(db.clone()).await?;
// Create the error handler script
sqlx::query!(
r#"
INSERT INTO script (workspace_id, hash, path, content, language, kind, created_by, schema, summary, description, lock)
VALUES ('test-workspace', 5555555555, 'f/test/error_handler', 'export function main() { return "handled"; }', 'bun', 'script', 'test-user', '{}', '', '', E'{}\n//bun.lock\n<empty>')
"#,
)
.execute(&db)
.await?;
// Create a successful script
let success_script_hash: i64 = 6666666666;
sqlx::query!(
r#"
INSERT INTO script (workspace_id, hash, path, content, language, kind, created_by, schema, summary, description, lock)
VALUES ('test-workspace', $1, 'f/test/success_script', 'export function main() { return "ok"; }', 'bun', 'script', 'test-user', '{}', '', '', E'{}\n//bun.lock\n<empty>')
"#,
success_script_hash,
)
.execute(&db)
.await?;
// Set up the error handler
sqlx::query!(
r#"
UPDATE workspace_settings
SET error_handler = '{"path": "script/f/test/error_handler"}'::jsonb
WHERE workspace_id = 'test-workspace'
"#
)
.execute(&db)
.await?;
sqlx::query!(
r#"
INSERT INTO group_ (workspace_id, name, summary, extra_perms)
VALUES ('test-workspace', 'error_handler', 'Error handler group', '{"u/test-user": true}')
ON CONFLICT DO NOTHING
"#
)
.execute(&db)
.await?;
// Run the successful script
let completed_job = RunJob::from(JobPayload::ScriptHash {
hash: ScriptHash(success_script_hash),
path: "f/test/success_script".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,
})
.run_until_complete(&db, false, server.addr.port())
.await;
assert!(completed_job.success, "Job should have succeeded");
// Wait and check that NO error handler job was created
tokio::time::sleep(tokio::time::Duration::from_millis(500)).await;
let error_handler_job = sqlx::query_scalar!(
r#"
SELECT id
FROM v2_job
WHERE workspace_id = 'test-workspace'
AND permissioned_as_email = 'error_handler@windmill.dev'
"#
)
.fetch_optional(&db)
.await?;
assert!(
error_handler_job.is_none(),
"Error handler should NOT have been triggered for a successful job"
);
Ok(())
}
/// A hub script run at the top level (a schedule, a trigger, the API) is a `script_hub` job,
/// and its failure must reach the workspace error handler like a workspace script's.
#[cfg(all(feature = "enterprise", feature = "private"))]
#[sqlx::test(fixtures("base"))]
async fn test_error_handler_triggered_on_hub_script_failure(
db: Pool<Postgres>,
) -> anyhow::Result<()> {
use windmill_common::jobs::JobPayload;
initialize_tracing().await;
let server = ApiServer::start(db.clone()).await?;
let version = "990000002";
let hub_dir = &*windmill_common::worker::HUB_CACHE_DIR;
tokio::fs::create_dir_all(hub_dir).await?;
tokio::fs::write(
format!("{hub_dir}/{version}"),
r#"{"content":"exit 1","lockfile":null,"language":"bash","schema":{},"summary":null}"#,
)
.await?;
// The workspace handler settings are cached per workspace id across the tests of this
// binary, so this reuses the handler path every other test here configures.
sqlx::query(
"INSERT INTO script (workspace_id, hash, path, content, language, kind, created_by, schema, summary, description, lock)
VALUES ('test-workspace', 1111111112, 'f/test/error_handler', 'echo handled', 'bash', 'script', 'test-user', '{}', '', '', '')",
)
.execute(&db)
.await?;
sqlx::query(
r#"UPDATE workspace_settings SET error_handler = '{"path": "script/f/test/error_handler"}'::jsonb
WHERE workspace_id = 'test-workspace'"#,
)
.execute(&db)
.await?;
let completed_job = RunJob::from(JobPayload::ScriptHub {
path: format!("hub/{version}/test/fail"),
apply_preprocessor: false,
})
.run_until_complete(&db, false, server.addr.port())
.await;
assert!(!completed_job.success, "Hub script should have failed");
let mut handler_parent = None;
for _ in 0..50 {
handler_parent = sqlx::query_scalar::<_, Option<uuid::Uuid>>(
"SELECT parent_job FROM v2_job
WHERE workspace_id = 'test-workspace' AND permissioned_as_email = 'error_handler@windmill.dev'",
)
.fetch_optional(&db)
.await?;
if handler_parent.is_some() {
break;
}
tokio::time::sleep(tokio::time::Duration::from_millis(100)).await;
}
assert_eq!(
handler_parent,
Some(Some(completed_job.id)),
"Workspace error handler should handle the failed hub script"
);
Ok(())
}
-33
View File
@@ -1,33 +0,0 @@
-- NOTE: Applied after workspace_dependencies_leafs.sql
-- Python script that uses relative imports
INSERT INTO public.script(workspace_id, created_by, content, schema, summary, description, path, hash, language, lock) VALUES (
'test-workspace',
'test-user',
'
from f.leafs.python import main as python_leaf
def main():
return {"python_import": python_leaf()}',
'{"$schema":"https://json-schema.org/draft/2020-12/schema","properties":{},"required":[],"type":"object"}',
'',
'',
'f/python_importer', 500005, 'python3', '');
-- TypeScript script that uses relative imports
INSERT INTO public.script(workspace_id, created_by, content, schema, summary, description, path, hash, language, lock) VALUES (
'test-workspace',
'test-user',
'
import { main as tsLeaf } from "./leafs/ts";
export async function main() {
return { ts_import: await tsLeaf() };
}',
'{"$schema":"https://json-schema.org/draft/2020-12/schema","properties":{},"required":[],"type":"object"}',
'',
'',
'f/ts_importer', 500006, 'nativets', '');
-- Dependency map entries
INSERT INTO dependency_map (workspace_id, importer_path, importer_kind, imported_path, importer_node_id) VALUES ('test-workspace', 'f/python_importer', 'script', 'f/leafs/python', '');
INSERT INTO dependency_map (workspace_id, importer_path, importer_kind, imported_path, importer_node_id) VALUES ('test-workspace', 'f/ts_importer', 'script', 'f/leafs/ts', '');
-54
View File
@@ -1,54 +0,0 @@
-- Basic leaf scripts in different languages
INSERT INTO public.script(workspace_id, created_by, content, schema, summary, description, path, hash, language, lock) VALUES (
'test-workspace',
'test-user',
'
export async function main() {
return "TypeScript leaf";
}',
'{"$schema":"https://json-schema.org/draft/2020-12/schema","properties":{},"required":[],"type":"object"}',
'',
'',
'f/leafs/ts', 500001, 'nativets', '');
INSERT INTO public.script(workspace_id, created_by, content, schema, summary, description, path, hash, language, lock) VALUES (
'test-workspace',
'test-user',
'
package main
import "fmt"
func main() {
fmt.Println("Go leaf")
}',
'{"$schema":"https://json-schema.org/draft/2020-12/schema","properties":{},"required":[],"type":"object"}',
'',
'',
'f/leafs/go', 500002, 'go', '');
INSERT INTO public.script(workspace_id, created_by, content, schema, summary, description, path, hash, language, lock) VALUES (
'test-workspace',
'test-user',
'
def main():
return "Python leaf"',
'{"$schema":"https://json-schema.org/draft/2020-12/schema","properties":{},"required":[],"type":"object"}',
'',
'',
'f/leafs/python', 500003, 'python3', '');
INSERT INTO public.script(workspace_id, created_by, content, schema, summary, description, path, hash, language, lock) VALUES (
'test-workspace',
'test-user',
'
<?php
function main() {
return "PHP leaf";
}
?>',
'{"$schema":"https://json-schema.org/draft/2020-12/schema","properties":{},"required":[],"type":"object"}',
'',
'',
'f/leafs/php', 500004, 'php', '');
@@ -680,6 +680,17 @@ async fn test_folder_default_permissioned_as(db: Pool<Postgres>) -> anyhow::Resu
// 8. Stale rule — rule resolves to a user that does not exist
// ========================================================================
let resp = authed(
client().post(format!("{base}/scripts/create")),
"SECRET_TOKEN",
)
.json(&new_script("f/prodfolder/stale/existing"))
.send()
.await?;
let status = resp.status();
let existing_hash = resp.text().await?;
assert_eq!(status, 201, "script before the stale rule: {existing_hash}");
let resp = authed(
client().post(format!("{base}/folders/update/prodfolder")),
"SECRET_TOKEN",
@@ -719,6 +730,33 @@ async fn test_folder_default_permissioned_as(db: Pool<Postgres>) -> anyhow::Resu
"error should identify the stale user: {body}"
);
// The default applies only to a first deploy, so it cannot fail a redeploy...
let mut redeploy = new_script("f/prodfolder/stale/existing");
redeploy["content"] = json!("export async function main() { return 43; }");
redeploy["parent_hash"] = json!(existing_hash);
let resp = authed(
client().post(format!("{base}/scripts/create")),
"SECRET_TOKEN",
)
.json(&redeploy)
.send()
.await?;
assert_eq!(
resp.status(),
201,
"stale rule must not block a redeploy: {}",
resp.text().await?
);
// ...while a first deploy it would apply to still reports it.
let resp = authed(
client().post(format!("{base}/scripts/create")),
"SECRET_TOKEN",
)
.json(&new_script("f/prodfolder/stale/new_script"))
.send()
.await?;
assert_eq!(resp.status(), 400, "stale rule should refuse a new script");
// Non-matching paths in the same folder still work fine.
let resp = authed(
client().post(format!("{base}/schedules/create")),
+26
View File
@@ -1533,6 +1533,32 @@ async fn declarative_sync_rejects_an_unusable_instance_banner(db: Pool<Postgres>
);
}
#[sqlx::test(fixtures("base"))]
async fn declarative_sync_rejects_an_unusable_dev_workspace_tag_suffix(db: Pool<Postgres>) {
clear_settings_and_configs(&db).await;
let before = count_global_settings(&db).await;
let mut desired = BTreeMap::new();
desired.insert(
"dev_workspace_tag_suffix".to_string(),
serde_json::json!("-dev' OR '1'='1"),
);
let err = windmill_common::instance_config::sync_global_settings_declarative(
&db,
&BTreeMap::new(),
&desired,
&(),
)
.await
.expect_err("a suffix the workers would ignore must fail the sync");
assert!(
err.to_string().contains("dev_workspace_tag_suffix"),
"the error should name the offending setting, got: {err}"
);
assert_eq!(count_global_settings(&db).await, before);
}
#[sqlx::test(fixtures("base"))]
async fn declarative_sync_rejects_a_malformed_max_token_expiration(db: Pool<Postgres>) {
clear_settings_and_configs(&db).await;
+115
View File
@@ -686,3 +686,118 @@ async fn test_protection_rule_rename(db: Pool<Postgres>) -> anyhow::Result<()> {
Ok(())
}
/// `RequireIsolatedForks` refuses a non-bypassing forker any data shared with the workspace, on
/// both fork entry points, and lets an admin through.
#[sqlx::test(fixtures("base"))]
async fn test_require_isolated_forks(db: Pool<Postgres>) -> anyhow::Result<()> {
initialize_tracing().await;
// Not `test-workspace`: PROTECTION_RULES_CACHE is process-wide and keyed by workspace id, so
// the other tests here, running concurrently on their own databases, would overwrite its rules.
invalidate_protection_rules_cache("iso-ws");
// `dt2` is a clone governed from `gov`, but its database is this workspace's; `dt3` points
// into `gov`'s database.
let pg = r#"{"resource_type": "postgresql", "resource_path": "u/test-user/pg"}"#;
let gov = r#"{"workspace_id": "gov", "datatable": "src"}"#;
sqlx::raw_sql(
"INSERT INTO workspace (id, name, owner) VALUES
('gov', 'gov', 'test-user'), ('iso-ws', 'iso-ws', 'test-user');
INSERT INTO workspace_settings (workspace_id) VALUES ('gov'), ('iso-ws');
INSERT INTO workspace_key (workspace_id, kind, key) VALUES ('iso-ws', 'cloud', 'iso-key');
INSERT INTO group_ (workspace_id, name, summary, extra_perms) VALUES
('iso-ws', 'all', 'All users', '{}');
INSERT INTO usr (workspace_id, email, username, is_admin, role) VALUES
('iso-ws', 'test@windmill.dev', 'test-user', true, 'Admin'),
('iso-ws', 'test2@windmill.dev', 'test-user-2', false, 'User')",
)
.execute(&db)
.await?;
for (w_id, datatables) in [
("gov", format!(r#"{{"src": {{"database": {pg}}}}}"#)),
(
"iso-ws",
format!(
r#"{{"dt1": {{"database": {pg}}}, "dt2": {{"database": {pg}, "governed_by": {gov}}},
"dt3": {{"reference": {gov}}}}}"#
),
),
] {
sqlx::query(
"UPDATE workspace_settings SET datatable = jsonb_build_object('datatables', $2::jsonb) \
WHERE workspace_id = $1",
)
.bind(w_id)
.bind(datatables)
.execute(&db)
.await?;
}
let server = ApiServer::start(db.clone()).await?;
let base = format!("http://localhost:{}/api/w/iso-ws", server.addr.port());
let resp = authed(
client().post(format!("{base}/workspaces/protection_rules")),
"SECRET_TOKEN",
)
.json(&json!({
"name": "isolate",
"rules": ["RequireIsolatedForks"],
"bypass_users": [],
"bypass_groups": []
}))
.send()
.await?;
assert_eq!(resp.status(), 200, "{}", resp.text().await?);
let cloned =
json!([{"name": "dt1", "new_dbname": "wm_fork_iso__dt1", "fork_behavior": "schema_only"}]);
for (route, body, shared) in [
(
"create_fork",
json!({"shared_storages": ["_default_"], "forked_datatables": cloned}),
"storage",
),
(
"create_workspace_fork_branch",
json!({"shared_ducklakes": ["main"], "forked_datatables": cloned}),
"ducklake",
),
(
"create_fork",
json!({"forked_datatables": cloned}),
"data table `dt2`",
),
] {
let mut body = body;
body["id"] = json!("wm-fork-iso");
body["name"] = json!("iso");
let resp = authed(
client().post(format!("{base}/workspaces/{route}")),
"SECRET_TOKEN_2",
)
.json(&body)
.send()
.await?;
let status = resp.status();
let text = resp.text().await?;
assert!(
status == 403 && text.contains(shared) && !text.contains("dt3"),
"{route} sharing {shared} should be refused: {status} {text}"
);
}
// An admin bypasses the rule: what stops this request is the unknown storage name.
let resp = authed(
client().post(format!("{base}/workspaces/create_fork")),
"SECRET_TOKEN",
)
.json(&json!({"id": "wm-fork-iso", "name": "iso", "shared_storages": ["_default_"]}))
.send()
.await?;
let text = resp.text().await?;
assert!(
!text.contains("isolate"),
"admin should bypass the rule: {text}"
);
Ok(())
}
-293
View File
@@ -1,293 +0,0 @@
use sqlx::{Pool, Postgres};
use windmill_test_utils::*;
/// Both job-running tests seed `f/test/success_handler` with a different hash, each in its own
/// database, while the deployed-script caches are process-global and keyed by workspace and
/// path. With them on, one test resolves the handler to the other's hash and the handler push
/// 404s whenever that hash's info is not cached yet.
#[cfg(all(feature = "enterprise", feature = "private"))]
fn disable_deployed_script_cache() {
windmill_common::DEPLOYED_SCRIPT_CACHE_DISABLED
.store(true, std::sync::atomic::Ordering::Relaxed);
}
/// The handler job is pushed after the job it handles is reported complete.
#[cfg(all(feature = "enterprise", feature = "private"))]
async fn wait_for_success_handler_job(
db: &Pool<Postgres>,
) -> anyhow::Result<Option<(Option<String>, Option<uuid::Uuid>)>> {
for _ in 0..100 {
let job = sqlx::query_as::<_, (Option<String>, Option<uuid::Uuid>)>(
"SELECT runnable_path, parent_job FROM v2_job
WHERE workspace_id = 'test-workspace' AND permissioned_as_email = 'success_handler@windmill.dev'",
)
.fetch_optional(db)
.await?;
if job.is_some() {
return Ok(job);
}
tokio::time::sleep(tokio::time::Duration::from_millis(100)).await;
}
Ok(None)
}
/// Test that the workspace success handler cache works correctly with 60s TTL
#[cfg(feature = "deno_core")]
#[sqlx::test(fixtures("base"))]
async fn test_success_handler_cache(db: Pool<Postgres>) -> anyhow::Result<()> {
initialize_tracing().await;
// First, create a success handler script
let _server = ApiServer::start(db.clone()).await?;
// Set up a success handler in workspace_settings using new JSONB column
sqlx::query!(
r#"
UPDATE workspace_settings
SET success_handler = '{"path": "script/f/test/success_handler", "extra_args": {"key": "value"}}'::jsonb
WHERE workspace_id = 'test-workspace'
"#
)
.execute(&db)
.await?;
// Verify the success handler was set
let result = sqlx::query_scalar!(
r#"SELECT success_handler->>'path' FROM workspace_settings WHERE workspace_id = 'test-workspace'"#
)
.fetch_one(&db)
.await?;
assert_eq!(result, Some("script/f/test/success_handler".to_string()));
// Verify extra args were set
let extra_args = sqlx::query_scalar!(
r#"SELECT success_handler->'extra_args' FROM workspace_settings WHERE workspace_id = 'test-workspace'"#
)
.fetch_one(&db)
.await?;
assert!(extra_args.is_some());
Ok(())
}
/// Test that success handler can be set and removed via database operations
#[cfg(feature = "deno_core")]
#[sqlx::test(fixtures("base"))]
async fn test_success_handler_settings(db: Pool<Postgres>) -> anyhow::Result<()> {
initialize_tracing().await;
let _server = ApiServer::start(db.clone()).await?;
// Initially success_handler should be NULL
let initial = sqlx::query_scalar!(
r#"SELECT success_handler->>'path' FROM workspace_settings WHERE workspace_id = 'test-workspace'"#
)
.fetch_one(&db)
.await?;
assert!(initial.is_none());
// Set success handler
sqlx::query!(
r#"
UPDATE workspace_settings
SET success_handler = '{"path": "flow/f/test/success_flow"}'::jsonb
WHERE workspace_id = 'test-workspace'
"#
)
.execute(&db)
.await?;
let after_set = sqlx::query_scalar!(
r#"SELECT success_handler->>'path' FROM workspace_settings WHERE workspace_id = 'test-workspace'"#
)
.fetch_one(&db)
.await?;
assert_eq!(after_set, Some("flow/f/test/success_flow".to_string()));
// Remove success handler
sqlx::query!(
r#"
UPDATE workspace_settings
SET success_handler = NULL
WHERE workspace_id = 'test-workspace'
"#
)
.execute(&db)
.await?;
let after_remove = sqlx::query_scalar!(
r#"SELECT success_handler->>'path' FROM workspace_settings WHERE workspace_id = 'test-workspace'"#
)
.fetch_one(&db)
.await?;
assert!(after_remove.is_none());
Ok(())
}
/// Test that a successful job completion triggers the success handler
#[cfg(all(feature = "deno_core", feature = "enterprise", feature = "private"))]
#[sqlx::test(fixtures("base"))]
async fn test_success_handler_triggered_on_success(db: Pool<Postgres>) -> anyhow::Result<()> {
use serde_json::json;
use windmill_common::jobs::JobPayload;
use windmill_common::runnable_settings::{ConcurrencySettings, DebouncingSettings};
use windmill_common::scripts::{ScriptHash, ScriptLang};
initialize_tracing().await;
disable_deployed_script_cache();
let server = ApiServer::start(db.clone()).await?;
// Create a simple success handler script
// Note: lock must be non-null for script to be considered "deployed"
let success_handler_code = r#"
export async function main(path: string, email: string, job_id: string, is_flow: boolean, workspace_id: string, result: any) {
console.log("Success handler called for job:", job_id);
return { handled: true, original_path: path };
}
"#;
sqlx::query!(
r#"
INSERT INTO script (workspace_id, hash, path, content, language, kind, created_by, schema, summary, description, lock)
VALUES ('test-workspace', 1234567890, 'f/test/success_handler', $1, 'bun', 'script', 'test-user', '{}', 'Success handler script', 'Handles successful job completions', E'{}\n//bun.lock\n<empty>')
"#,
success_handler_code
)
.execute(&db)
.await?;
// Create a simple test script that we'll run (needs to be JobKind::Script, not Preview)
// Note: lock must be non-null for script to be considered "deployed"
let test_script_code = "export function main() { return 'success'; }";
let test_script_hash: i64 = 9876543210;
sqlx::query!(
r#"
INSERT INTO script (workspace_id, hash, path, content, language, kind, created_by, schema, summary, description, lock)
VALUES ('test-workspace', $1, 'f/test/simple_script', $2, 'bun', 'script', 'test-user', '{}', 'Simple test script', 'A simple test script', E'{}\n//bun.lock\n<empty>')
"#,
test_script_hash,
test_script_code
)
.execute(&db)
.await?;
// Set up the success handler in workspace_settings
sqlx::query!(
r#"
UPDATE workspace_settings
SET success_handler = '{"path": "script/f/test/success_handler"}'::jsonb
WHERE workspace_id = 'test-workspace'
"#
)
.execute(&db)
.await?;
// Create the success_handler group
sqlx::query!(
r#"
INSERT INTO group_ (workspace_id, name, summary, extra_perms)
VALUES ('test-workspace', 'success_handler', 'The group the success handler acts on behalf of', '{"u/test-user": true}')
ON CONFLICT DO NOTHING
"#
)
.execute(&db)
.await?;
// Run a script using ScriptHash (produces JobKind::Script, not Preview)
let completed_job = RunJob::from(JobPayload::ScriptHash {
hash: ScriptHash(test_script_hash),
path: "f/test/simple_script".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,
})
.run_until_complete(&db, false, server.addr.port())
.await;
let result = completed_job.json_result().unwrap();
assert_eq!(result, json!("success"));
let main_job_id = completed_job.id;
let handler_job = wait_for_success_handler_job(&db).await?;
assert_eq!(
handler_job,
Some((
Some("f/test/success_handler".to_string()),
Some(main_job_id)
)),
"Success handler should run the configured script with the main job as parent"
);
// Note: root_job may be None when it equals parent_job (optimization in push function)
Ok(())
}
/// A hub script run at the top level (a schedule, a trigger, the API) is a `script_hub` job,
/// and its success must reach the workspace success handler like a workspace script's.
#[cfg(all(feature = "enterprise", feature = "private"))]
#[sqlx::test(fixtures("base"))]
async fn test_success_handler_triggered_on_hub_script_success(
db: Pool<Postgres>,
) -> anyhow::Result<()> {
use windmill_common::jobs::JobPayload;
initialize_tracing().await;
disable_deployed_script_cache();
let server = ApiServer::start(db.clone()).await?;
let version = "990000003";
let hub_dir = &*windmill_common::worker::HUB_CACHE_DIR;
tokio::fs::create_dir_all(hub_dir).await?;
tokio::fs::write(
format!("{hub_dir}/{version}"),
r#"{"content":"echo ok","lockfile":null,"language":"bash","schema":{},"summary":null}"#,
)
.await?;
// The workspace handler settings are cached per workspace id across the tests of this
// binary, so this reuses the handler path every other test here configures.
sqlx::query(
"INSERT INTO script (workspace_id, hash, path, content, language, kind, created_by, schema, summary, description, lock)
VALUES ('test-workspace', 1234567891, 'f/test/success_handler', 'echo handled', 'bash', 'script', 'test-user', '{}', '', '', '')",
)
.execute(&db)
.await?;
sqlx::query(
r#"UPDATE workspace_settings SET success_handler = '{"path": "script/f/test/success_handler"}'::jsonb
WHERE workspace_id = 'test-workspace'"#,
)
.execute(&db)
.await?;
let completed_job = RunJob::from(JobPayload::ScriptHub {
path: format!("hub/{version}/test/ok"),
apply_preprocessor: false,
})
.run_until_complete(&db, false, server.addr.port())
.await;
assert!(completed_job.success, "Hub script should have succeeded");
let handler_job = wait_for_success_handler_job(&db).await?;
assert_eq!(
handler_job.map(|(_, parent)| parent),
Some(Some(completed_job.id)),
"Workspace success handler should handle the successful hub script"
);
Ok(())
}
+25
View File
@@ -528,6 +528,16 @@ async fn test_jobs_export_delete_is_workspace_scoped(db: Pool<Postgres>) -> anyh
let other_job = Uuid::new_v4();
insert_job(&db, "ws-other", other_job).await?;
seed_side_rows(&db, "ws-other", other_job).await?;
// A queued flow's per-job tables, which carry no workspace_id of their own.
for sql in [
"INSERT INTO v2_job_queue (id, workspace_id, scheduled_for) VALUES ($1, 'ws-other', now())",
"INSERT INTO v2_job_runtime (id) VALUES ($1)",
"INSERT INTO v2_job_status (id) VALUES ($1)",
"INSERT INTO resume_job (id, job, flow) VALUES (gen_random_uuid(), $1, $1)",
"INSERT INTO concurrency_key (key, job_id) VALUES ('k', $1)",
] {
sqlx::query(sql).bind(other_job).execute(&db).await?;
}
// A test-workspace admin calls the purge endpoint with the FOREIGN job id.
let server = ApiServer::start(db.clone()).await?;
@@ -552,5 +562,20 @@ async fn test_jobs_export_delete_is_workspace_scoped(db: Pool<Postgres>) -> anyh
(1, 1, 1, 1),
"jobs_export purge crossed workspaces: dispatch_event={de} flow_conversation_message={fcm} zombie_job_counter={zombie} v2_job={job}"
);
for table_col in [
"v2_job_queue WHERE id",
"v2_job_runtime WHERE id",
"v2_job_status WHERE id",
"resume_job WHERE job",
"concurrency_key WHERE job_id",
] {
let n = count(
&db,
&format!("SELECT count(*) FROM {table_col} = $1"),
other_job,
)
.await?;
assert_eq!(n, 1, "jobs_export purge crossed workspaces: {table_col}");
}
Ok(())
}
+83 -109
View File
@@ -2123,7 +2123,6 @@ async fn test_postgresql_single_worker_session_isolation(db: Pool<Postgres>) ->
#[serial(pg_cache)]
async fn test_postgresql_100_jobs_cached(db: Pool<Postgres>) -> anyhow::Result<()> {
use std::sync::atomic::Ordering;
use windmill_common::worker::Connection;
use windmill_worker::pg_executor::{clear_pg_cache, CACHE_HITS};
initialize_tracing().await;
@@ -2176,27 +2175,7 @@ async fn test_postgresql_100_jobs_cached(db: Pool<Postgres>) -> anyhow::Result<(
ids.push(make_pg_job(content).push(&db).await);
}
// Run ONE worker for all 100 jobs.
let listener = listen_for_completed_jobs(&db).await;
let id_set = ids
.iter()
.copied()
.collect::<std::collections::HashSet<_>>();
in_test_worker(
Connection::Sql(db.clone()),
async {
use futures::StreamExt;
let mut remaining = id_set;
let mut listener = listener;
while !remaining.is_empty() {
if let Some(id) = listener.next().await {
remaining.remove(&id);
}
}
},
port,
)
.await;
run_on_one_worker(&db, port, &ids).await;
// Verify all 100 jobs succeeded.
for (i, id) in ids.iter().enumerate() {
@@ -2259,6 +2238,26 @@ async fn test_postgresql_arg_type_combinations(db: Pool<Postgres>) -> anyhow::Re
let db_arg = json!({"host": "localhost", "port": 5432, "dbname": "windmill", "user": "postgres", "password": "changeme"});
let make_pg_job = |content: String| {
RunJob::from(JobPayload::Code(RawCode {
hash: None,
content,
path: None,
lock: None,
language: ScriptLang::Postgresql,
cache_ttl: None,
cache_ignore_s3_path: None,
dedicated_worker: None,
concurrency_settings: windmill_common::runnable_settings::ConcurrencySettings::default(
)
.into(),
debouncing_settings: windmill_common::runnable_settings::DebouncingSettings::default(),
modules: None,
tag: None,
}))
.arg("database", db_arg.clone())
};
// Build a fresh schema for this test so we don't trip over prior runs.
let setup = r#"
DROP SCHEMA IF EXISTS wm_pg_arg_combo_test CASCADE;
@@ -2289,26 +2288,7 @@ CREATE TABLE wm_pg_arg_combo_test.allcols (
CREATE TYPE wm_pg_arg_combo_test.color AS ENUM ('red','green','blue');
CREATE TABLE wm_pg_arg_combo_test.enumtbl (c wm_pg_arg_combo_test.color);
"#;
RunJob::from(JobPayload::Code(RawCode {
hash: None,
content: setup.to_owned(),
path: None,
lock: None,
language: ScriptLang::Postgresql,
cache_ttl: None,
cache_ignore_s3_path: None,
dedicated_worker: None,
concurrency_settings: windmill_common::runnable_settings::ConcurrencySettings::default()
.into(),
debouncing_settings: windmill_common::runnable_settings::DebouncingSettings::default(),
modules: None,
tag: None,
}))
.arg("database", db_arg.clone())
.run_until_complete(&db, false, port)
.await
.json_result()
.unwrap();
let setup_id = make_pg_job(setup.to_owned()).push(&db).await;
// Each case: (name, content, args, expected_result)
let cases: Vec<(&str, String, serde_json::Value, serde_json::Value)> = vec![
@@ -2742,29 +2722,22 @@ SELECT 'price: $5' AS lbl, $5::int + $50::int AS sum"#
),
];
for (name, content, args, expected) in cases {
let mut job = RunJob::from(JobPayload::Code(RawCode {
hash: None,
content,
path: None,
lock: None,
language: ScriptLang::Postgresql,
cache_ttl: None,
cache_ignore_s3_path: None,
dedicated_worker: None,
concurrency_settings: windmill_common::runnable_settings::ConcurrencySettings::default(
)
.into(),
debouncing_settings: windmill_common::runnable_settings::DebouncingSettings::default(),
modules: None,
tag: None,
}))
.arg("database", db_arg.clone());
let mut ids = vec![setup_id];
for (_, content, args, _) in &cases {
let mut job = make_pg_job(content.clone());
for (k, v) in args.as_object().unwrap() {
job = job.arg(k, v.clone());
}
let result = job
.run_until_complete(&db, false, port)
ids.push(job.push(&db).await);
}
run_on_one_worker(&db, port, &ids).await;
completed_job(setup_id, &db)
.await
.json_result()
.expect("setup: no json result");
for ((name, _, _, expected), id) in cases.into_iter().zip(&ids[1..]) {
let result = completed_job(*id, &db)
.await
.json_result()
.unwrap_or_else(|| panic!("case '{name}': no json result"));
@@ -2774,6 +2747,32 @@ SELECT 'price: $5' AS lbl, $5::int + $50::int AS sum"#
Ok(())
}
/// Runs the already pushed `ids` on a single worker and returns once all completed. One worker
/// takes them one at a time in push order, so a setup job pushed first runs before the rest,
/// and they all share the process-wide PG connection cache as consecutive jobs would.
async fn run_on_one_worker(db: &Pool<Postgres>, port: u16, ids: &[Uuid]) {
use futures::StreamExt;
use windmill_common::worker::Connection;
let mut listener = listen_for_completed_jobs(db).await;
let mut remaining = ids
.iter()
.copied()
.collect::<std::collections::HashSet<_>>();
in_test_worker(
Connection::Sql(db.clone()),
async {
while !remaining.is_empty() {
if let Some(id) = listener.next().await {
remaining.remove(&id);
}
}
},
port,
)
.await;
}
/// Pooler-safety regression test for #8988: when every arg has a resolvable
/// otyp (the common SDK case), the dispatch must use unnamed prepared
/// statements (`query_typed_raw`) and *must not* leak named statements
@@ -3010,11 +3009,7 @@ CREATE SCHEMA wm_pg_cached_test;
CREATE TYPE wm_pg_cached_test.color AS ENUM ('red', 'green', 'blue');
CREATE DOMAIN wm_pg_cached_test.short_name AS TEXT CHECK (length(VALUE) BETWEEN 1 AND 10);
"#;
make_pg_job(setup.to_owned())
.run_until_complete(&db, false, port)
.await
.json_result()
.unwrap();
let setup_id = make_pg_job(setup.to_owned()).push(&db).await;
// Run a long alternating sequence of enum + domain queries on the same
// cached connection. Each query goes through the prepare-fallback path
@@ -3022,21 +3017,36 @@ CREATE DOMAIN wm_pg_cached_test.short_name AS TEXT CHECK (length(VALUE) BETWEEN
// tokio_postgres' typeinfo cache to resolve the Oids server-side. Pre-fix
// this would fail intermittently with `prepared statement "sN" does not
// exist` after the first cached-conn reuse.
let mut pairs = Vec::with_capacity(10);
for i in 0..10 {
let r = make_pg_job("-- $1 arg1\nSELECT $1::wm_pg_cached_test.color AS c".to_owned())
let enum_id = make_pg_job("-- $1 arg1\nSELECT $1::wm_pg_cached_test.color AS c".to_owned())
.arg("arg1", json!(if i % 2 == 0 { "red" } else { "blue" }))
.run_until_complete(&db, false, port)
.push(&db)
.await;
let domain_id =
make_pg_job("-- $1 arg1\nSELECT $1::wm_pg_cached_test.short_name AS s".to_owned())
.arg("arg1", json!(format!("v{i}")))
.push(&db)
.await;
pairs.push((enum_id, domain_id));
}
let mut ids = vec![setup_id];
ids.extend(pairs.iter().flat_map(|(e, d)| [*e, *d]));
run_on_one_worker(&db, port, &ids).await;
completed_job(setup_id, &db)
.await
.json_result()
.expect("setup: no json result");
for (i, (enum_id, domain_id)) in pairs.into_iter().enumerate() {
let r = completed_job(enum_id, &db).await;
assert!(
r.success,
"iter {i} enum query failed (was the DISCARD ALL bug); result: {:?}",
r.result
);
let r = make_pg_job("-- $1 arg1\nSELECT $1::wm_pg_cached_test.short_name AS s".to_owned())
.arg("arg1", json!(format!("v{i}")))
.run_until_complete(&db, false, port)
.await;
let r = completed_job(domain_id, &db).await;
assert!(
r.success,
"iter {i} domain query failed (was the DISCARD ALL bug); result: {:?}",
@@ -5852,42 +5862,6 @@ async fn test_flow_schedule_handlers(db: Pool<Postgres>) -> anyhow::Result<()> {
Ok(())
}
#[sqlx::test(fixtures("base", "relative_bun"))]
async fn test_relative_imports_bun(db: Pool<Postgres>) -> anyhow::Result<()> {
let content = r#"
import { main as test1 } from "/f/system/same_folder_script.ts";
import { main as test2 } from "./same_folder_script.ts";
import { main as test3 } from "/f/system_relative/different_folder_script.ts";
import { main as test4 } from "../system_relative/different_folder_script.ts";
export async function main() {
return [test1(), test2(), test3(), test4()];
}
"#
.to_string();
run_deployed_relative_imports(&db, content.clone(), ScriptLang::Bun).await?;
run_preview_relative_imports(&db, content, ScriptLang::Bun).await?;
Ok(())
}
#[cfg(feature = "deno_core")]
#[sqlx::test(fixtures("base", "relative_bun"))]
async fn test_nested_imports_bun(db: Pool<Postgres>) -> anyhow::Result<()> {
let content = r#"
import { main as test } from "/f/system_relative/nested_script.ts";
export async function main() {
return test();
}
"#
.to_string();
run_deployed_relative_imports(&db, content.clone(), ScriptLang::Bun).await?;
run_preview_relative_imports(&db, content, ScriptLang::Bun).await?;
Ok(())
}
#[sqlx::test(fixtures("base", "relative_deno"))]
async fn test_relative_imports_deno(db: Pool<Postgres>) -> anyhow::Result<()> {
let content = r#"
+43 -140
View File
@@ -1,23 +1,10 @@
mod workspace_dependencies {
use sqlx::{Pool, Postgres};
use tokio_stream::StreamExt;
use windmill_common::scripts::ScriptLang;
use windmill_dep_map::workspace_dependencies::NewWorkspaceDependencies;
use windmill_test_utils::in_test_worker;
use windmill_test_utils::init_client;
use windmill_test_utils::listen_for_completed_jobs;
mod deps {
pub const REQUIREMENTS_IN: &'static str = "tiny==0.1.3";
// pub const GO_MOD: &'static str = r##"
// module example.com/project
// go 1.20
// require github.com/gin-gonic/gin v1.8.1
// "##;
pub const PACKAGE_JSON: &'static str = r##"
const PACKAGE_JSON: &'static str = r##"
{
"name": "example-project",
"version": "1.0.0",
@@ -27,101 +14,13 @@ mod workspace_dependencies {
}
"##;
pub const COMPOSER_JSON: &'static str = r##"
{
"name": "example/project",
"require": {
"monolog/monolog": "^2.3"
}
}
"##;
}
#[cfg(feature = "python")]
#[sqlx::test(fixtures("base", "workspace_dependencies_leafs"))]
#[ignore]
async fn basic_manual_named(db: Pool<Postgres>) -> anyhow::Result<()> {
let ((_client, port, _s), db, mut completed) = (
init_client(db.clone()).await,
&db,
listen_for_completed_jobs(&db).await,
);
for (idx, (l, c)) in [
(ScriptLang::Python3, deps::REQUIREMENTS_IN),
(ScriptLang::Bun, deps::PACKAGE_JSON),
(ScriptLang::Php, deps::COMPOSER_JSON),
// (ScriptLang::Go, deps::GO_MOD),
]
.iter()
.enumerate()
{
let id = NewWorkspaceDependencies {
workspace_id: "test-workspace".into(),
language: *l,
content: (*c).into(),
name: Some("test".to_owned()),
description: None,
}
.create(("".to_owned(), "".to_owned(), "".to_owned()), db.clone())
.await
.unwrap();
assert_eq!(idx + 1, id as usize);
}
// Wait for 4 jobs.
// Creating those dependencies will trigger redeployment of all scripts in workspace_dependencies_leafs.sql
in_test_worker(
db,
async {
completed.next().await;
completed.next().await;
completed.next().await;
// completed.next().await;
},
port,
)
.await;
// Verify all scripts have correct locks
// let mut langs = vec![];
// for r in sqlx::query!(
// r#"SELECT language AS "language: ScriptLang",lock FROM script WHERE archived = false"#
// )
// .fetch_all(db)
// .await
// .unwrap()
// {
// match r.language {
// ScriptLang::Python3 => assert_eq!("", &r.lock.unwrap()),
// ScriptLang::Go => todo!(),
// ScriptLang::Bun => todo!(),
// ScriptLang::Bunnative => todo!(),
// ScriptLang::Php => todo!(),
// _ => panic!("Unsupported language"),
// }
// langs.push(r.language);
// }
// langs.sort();
// // Just tiny additional verification for peace of mind.
// assert_eq!(langs.as_slice(), &[]);
Ok(())
}
#[sqlx::test(fixtures("base", "hub_sync_blacklist"))]
async fn hub_sync_blacklist_from_workspace_deps(db: Pool<Postgres>) -> anyhow::Result<()> {
let ((_client, port, _s), db, mut completed) = (
init_client(db.clone()).await,
&db,
listen_for_completed_jobs(&db).await,
);
// The first unnamed workspace dependencies wait out the existence cache before
// redeploying their dependents. Read once per process, and this binary has no other test.
std::env::set_var("EXISTS_CACHE_TIMEOUT_MS", "0");
let db = &db;
// Verify built-in fixtures exist
// Check that hub_sync script exists and is a Bun script
let hub_sync_lang = sqlx::query_scalar!(
r#"SELECT language AS "language: ScriptLang" FROM script WHERE path = 'u/admin/hub_sync'"#
)
@@ -134,51 +33,55 @@ mod workspace_dependencies {
"Expected hub_sync to be a Bun script"
);
// Create unnamed (default) workspace dependencies for Bun
let _id = NewWorkspaceDependencies {
// Unnamed (default) workspace dependencies for Bun
NewWorkspaceDependencies {
workspace_id: "admins".into(),
language: ScriptLang::Bun,
content: deps::PACKAGE_JSON.into(),
name: None, // No name = default workspace dependencies
content: PACKAGE_JSON.into(),
name: None,
description: None,
}
.create(("".to_owned(), "".to_owned(), "".to_owned()), db.clone())
.await
.unwrap();
// Wait for exactly 1 job (only u/admin/simple_bun, not hub_sync)
let job_id = in_test_worker(db, async { completed.next().await }, port)
.await
.expect("Expected one job to complete");
// Query the job's runnable_path
let runnable_path =
sqlx::query_scalar!("SELECT runnable_path FROM v2_job WHERE id = $1", job_id)
.fetch_one(db)
.await
.unwrap();
// The dependency map decides which runnables are redeployed, and is rebuilt before
// `create` returns.
let importers: Vec<String> = sqlx::query_scalar(
"SELECT importer_path FROM dependency_map
WHERE workspace_id = 'admins' AND imported_path = 'dependencies/package.json'
ORDER BY importer_path",
)
.fetch_all(db)
.await?;
assert_eq!(
runnable_path,
Some("u/admin/simple_bun".to_string()),
"Expected job runnable_path to be 'u/admin/simple_bun' (hub_sync should be blacklisted)"
importers,
vec!["u/admin/simple_bun".to_string()],
"hub_sync must not be recorded as importing the default workspace dependencies"
);
// Assert total job count is 1
let job_count = sqlx::query_scalar!("SELECT COUNT(*) FROM v2_job")
.fetch_one(db)
.await
.unwrap();
assert_eq!(job_count, Some(1), "Expected exactly one job total");
// Assert v2_job_queue is empty
let queue_count = sqlx::query_scalar!("SELECT COUNT(*) FROM v2_job_queue")
.fetch_one(db)
.await
.unwrap();
assert_eq!(queue_count, Some(0), "Expected job queue to be empty");
// The redeploy is pushed in the background as a debounced dependency job; it never needs
// to run for what is asserted here.
let mut jobs: Vec<(Option<String>, String)> = vec![];
for _ in 0..200 {
jobs = sqlx::query_as(
"SELECT runnable_path, kind::text FROM v2_job WHERE workspace_id = 'admins'",
)
.fetch_all(db)
.await?;
if !jobs.is_empty() {
break;
}
tokio::time::sleep(std::time::Duration::from_millis(50)).await;
}
assert_eq!(
jobs,
vec![(
Some("u/admin/simple_bun".to_string()),
"dependencies".to_string()
)],
"Expected exactly one dependency job, for u/admin/simple_bun (hub_sync should be blacklisted)"
);
Ok(())
}
+422
View File
@@ -0,0 +1,422 @@
#![cfg(all(feature = "enterprise", feature = "private"))]
use sqlx::{Pool, Postgres};
use windmill_test_utils::*;
const ERROR_HANDLER_EMAIL: &str = "error_handler@windmill.dev";
const SUCCESS_HANDLER_EMAIL: &str = "success_handler@windmill.dev";
/// Every test seeds `f/test/error_handler` or `f/test/success_handler` with a different hash,
/// each in its own database, while the deployed-script caches are process-global and keyed by
/// workspace and path. With them on, one test resolves the handler to another's hash and the
/// handler push 404s whenever that hash's info is not cached yet.
fn disable_deployed_script_cache() {
windmill_common::DEPLOYED_SCRIPT_CACHE_DISABLED
.store(true, std::sync::atomic::Ordering::Relaxed);
}
/// Polls so the assertion does not depend on the handler being pushed before
/// `run_until_complete` returns, which only holds while the worker drains its completions on exit.
async fn wait_for_handler_job(
db: &Pool<Postgres>,
handler_email: &str,
) -> anyhow::Result<Option<(Option<String>, Option<uuid::Uuid>)>> {
for _ in 0..100 {
let job = sqlx::query_as::<_, (Option<String>, Option<uuid::Uuid>)>(
"SELECT runnable_path, parent_job FROM v2_job
WHERE workspace_id = 'test-workspace' AND permissioned_as_email = $1",
)
.bind(handler_email)
.fetch_optional(db)
.await?;
if job.is_some() {
return Ok(job);
}
tokio::time::sleep(tokio::time::Duration::from_millis(100)).await;
}
Ok(None)
}
#[cfg(feature = "deno_core")]
async fn insert_bun_script(
db: &Pool<Postgres>,
hash: i64,
path: &str,
content: &str,
ws_error_handler_muted: bool,
) -> anyhow::Result<()> {
// 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, ws_error_handler_muted)
VALUES ('test-workspace', $1, $2, $3, 'bun', 'script', 'test-user', '{}', '', '', E'{}\n//bun.lock\n<empty>', $4)"#,
)
.bind(hash)
.bind(path)
.bind(content)
.bind(ws_error_handler_muted)
.execute(db)
.await?;
Ok(())
}
/// Configures `f/test/error_handler` and `f/test/success_handler` as the workspace handlers.
/// Both settings are cached per workspace id across the tests of this binary, and any test's
/// top-level job can fill either cache, so every test configures both, with the same paths.
async fn configure_workspace_handlers(db: &Pool<Postgres>) -> anyhow::Result<()> {
sqlx::query(
r#"UPDATE workspace_settings
SET error_handler = '{"path": "script/f/test/error_handler"}'::jsonb,
success_handler = '{"path": "script/f/test/success_handler"}'::jsonb
WHERE workspace_id = 'test-workspace'"#,
)
.execute(db)
.await?;
sqlx::query(
r#"INSERT INTO group_ (workspace_id, name, summary, extra_perms)
VALUES ('test-workspace', 'error_handler', '', '{"u/test-user": true}'),
('test-workspace', 'success_handler', '', '{"u/test-user": true}')
ON CONFLICT DO NOTHING"#,
)
.execute(db)
.await?;
Ok(())
}
/// Runs a deployed script by hash, which makes a `script` job rather than a preview.
#[cfg(feature = "deno_core")]
async fn run_script_hash(db: &Pool<Postgres>, port: u16, hash: i64, path: &str) -> CompletedJob {
use windmill_common::jobs::JobPayload;
use windmill_common::runnable_settings::{ConcurrencySettings, DebouncingSettings};
use windmill_common::scripts::{ScriptHash, ScriptLang};
RunJob::from(JobPayload::ScriptHash {
hash: ScriptHash(hash),
path: 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,
})
.run_until_complete(db, false, port)
.await
}
/// A job's handler, if any, is pushed before the worker that ran it exits, so once a control
/// job has been handled, every handler job that the jobs run before it would produce exists.
#[cfg(feature = "deno_core")]
async fn assert_only_handled(
db: &Pool<Postgres>,
control_job: uuid::Uuid,
message: &str,
) -> anyhow::Result<()> {
assert!(
wait_for_handler_job(db, ERROR_HANDLER_EMAIL)
.await?
.is_some(),
"Error handler should have handled the control failure"
);
let handled = sqlx::query_scalar::<_, Option<uuid::Uuid>>(
"SELECT parent_job FROM v2_job
WHERE workspace_id = 'test-workspace' AND permissioned_as_email = $1",
)
.bind(ERROR_HANDLER_EMAIL)
.fetch_all(db)
.await?;
assert_eq!(handled, vec![Some(control_job)], "{message}");
Ok(())
}
/// Test that a failed job triggers the workspace error handler
#[cfg(feature = "deno_core")]
#[sqlx::test(fixtures("base"))]
async fn test_error_handler_triggered_on_failure(db: Pool<Postgres>) -> anyhow::Result<()> {
initialize_tracing().await;
disable_deployed_script_cache();
let server = ApiServer::start(db.clone()).await?;
insert_bun_script(
&db,
1111111111,
"f/test/error_handler",
r#"
export async function main(path: string, email: string, job_id: string, is_flow: boolean, workspace_id: string, error: any) {
console.log("Error handler called for job:", job_id);
return { handled: true, original_path: path };
}
"#,
false,
)
.await?;
insert_bun_script(
&db,
2222222222,
"f/test/failing_script",
"export function main() { throw new Error('intentional failure'); }",
false,
)
.await?;
configure_workspace_handlers(&db).await?;
let completed_job =
run_script_hash(&db, server.addr.port(), 2222222222, "f/test/failing_script").await;
assert!(!completed_job.success, "Job should have failed");
assert_eq!(
wait_for_handler_job(&db, ERROR_HANDLER_EMAIL).await?,
Some((
Some("f/test/error_handler".to_string()),
Some(completed_job.id)
)),
"Error handler should run the configured script with the failed job as parent"
);
Ok(())
}
/// Test that error handler is NOT triggered when ws_error_handler_muted is set on the script
#[cfg(feature = "deno_core")]
#[sqlx::test(fixtures("base"))]
async fn test_error_handler_muted_on_script(db: Pool<Postgres>) -> anyhow::Result<()> {
initialize_tracing().await;
disable_deployed_script_cache();
let server = ApiServer::start(db.clone()).await?;
let port = server.addr.port();
insert_bun_script(
&db,
3333333333,
"f/test/error_handler",
r#"export function main() { return "handled"; }"#,
false,
)
.await?;
let failing = r#"export function main() { throw new Error("fail"); }"#;
insert_bun_script(
&db,
4444444444,
"f/test/muted_failing_script",
failing,
true,
)
.await?;
insert_bun_script(&db, 4444444445, "f/test/failing_script", failing, false).await?;
configure_workspace_handlers(&db).await?;
let muted_job = run_script_hash(&db, port, 4444444444, "f/test/muted_failing_script").await;
assert!(!muted_job.success, "Job should have failed");
let control_job = run_script_hash(&db, port, 4444444445, "f/test/failing_script").await;
assert!(!control_job.success, "Job should have failed");
assert_only_handled(
&db,
control_job.id,
"Error handler should NOT have been triggered for a muted script",
)
.await
}
/// Test that error handler is NOT triggered on successful job completion
#[cfg(feature = "deno_core")]
#[sqlx::test(fixtures("base"))]
async fn test_error_handler_not_triggered_on_success(db: Pool<Postgres>) -> anyhow::Result<()> {
initialize_tracing().await;
disable_deployed_script_cache();
let server = ApiServer::start(db.clone()).await?;
let port = server.addr.port();
insert_bun_script(
&db,
5555555555,
"f/test/error_handler",
r#"export function main() { return "handled"; }"#,
false,
)
.await?;
insert_bun_script(
&db,
6666666666,
"f/test/success_script",
r#"export function main() { return "ok"; }"#,
false,
)
.await?;
insert_bun_script(
&db,
6666666667,
"f/test/failing_script",
r#"export function main() { throw new Error("fail"); }"#,
false,
)
.await?;
configure_workspace_handlers(&db).await?;
let success_job = run_script_hash(&db, port, 6666666666, "f/test/success_script").await;
assert!(success_job.success, "Job should have succeeded");
let control_job = run_script_hash(&db, port, 6666666667, "f/test/failing_script").await;
assert!(!control_job.success, "Job should have failed");
assert_only_handled(
&db,
control_job.id,
"Error handler should NOT have been triggered for a successful job",
)
.await
}
/// A hub script run at the top level (a schedule, a trigger, the API) is a `script_hub` job,
/// and its failure must reach the workspace error handler like a workspace script's.
#[sqlx::test(fixtures("base"))]
async fn test_error_handler_triggered_on_hub_script_failure(
db: Pool<Postgres>,
) -> anyhow::Result<()> {
use windmill_common::jobs::JobPayload;
initialize_tracing().await;
disable_deployed_script_cache();
let server = ApiServer::start(db.clone()).await?;
let version = "990000002";
let hub_dir = &*windmill_common::worker::HUB_CACHE_DIR;
tokio::fs::create_dir_all(hub_dir).await?;
tokio::fs::write(
format!("{hub_dir}/{version}"),
r#"{"content":"exit 1","lockfile":null,"language":"bash","schema":{},"summary":null}"#,
)
.await?;
sqlx::query(
"INSERT INTO script (workspace_id, hash, path, content, language, kind, created_by, schema, summary, description, lock)
VALUES ('test-workspace', 1111111112, 'f/test/error_handler', 'echo handled', 'bash', 'script', 'test-user', '{}', '', '', '')",
)
.execute(&db)
.await?;
configure_workspace_handlers(&db).await?;
let completed_job = RunJob::from(JobPayload::ScriptHub {
path: format!("hub/{version}/test/fail"),
apply_preprocessor: false,
})
.run_until_complete(&db, false, server.addr.port())
.await;
assert!(!completed_job.success, "Hub script should have failed");
let handler_job = wait_for_handler_job(&db, ERROR_HANDLER_EMAIL).await?;
assert_eq!(
handler_job.map(|(_, parent)| parent),
Some(Some(completed_job.id)),
"Workspace error handler should handle the failed hub script"
);
Ok(())
}
/// Test that a successful job completion triggers the success handler
#[cfg(feature = "deno_core")]
#[sqlx::test(fixtures("base"))]
async fn test_success_handler_triggered_on_success(db: Pool<Postgres>) -> anyhow::Result<()> {
use serde_json::json;
initialize_tracing().await;
disable_deployed_script_cache();
let server = ApiServer::start(db.clone()).await?;
insert_bun_script(
&db,
1234567890,
"f/test/success_handler",
r#"
export async function main(path: string, email: string, job_id: string, is_flow: boolean, workspace_id: string, result: any) {
console.log("Success handler called for job:", job_id);
return { handled: true, original_path: path };
}
"#,
false,
)
.await?;
insert_bun_script(
&db,
9876543210,
"f/test/simple_script",
"export function main() { return 'success'; }",
false,
)
.await?;
configure_workspace_handlers(&db).await?;
let completed_job =
run_script_hash(&db, server.addr.port(), 9876543210, "f/test/simple_script").await;
assert_eq!(completed_job.json_result().unwrap(), json!("success"));
assert_eq!(
wait_for_handler_job(&db, SUCCESS_HANDLER_EMAIL).await?,
Some((
Some("f/test/success_handler".to_string()),
Some(completed_job.id)
)),
"Success handler should run the configured script with the main job as parent"
);
Ok(())
}
/// A hub script run at the top level (a schedule, a trigger, the API) is a `script_hub` job,
/// and its success must reach the workspace success handler like a workspace script's.
#[sqlx::test(fixtures("base"))]
async fn test_success_handler_triggered_on_hub_script_success(
db: Pool<Postgres>,
) -> anyhow::Result<()> {
use windmill_common::jobs::JobPayload;
initialize_tracing().await;
disable_deployed_script_cache();
let server = ApiServer::start(db.clone()).await?;
let version = "990000003";
let hub_dir = &*windmill_common::worker::HUB_CACHE_DIR;
tokio::fs::create_dir_all(hub_dir).await?;
tokio::fs::write(
format!("{hub_dir}/{version}"),
r#"{"content":"echo ok","lockfile":null,"language":"bash","schema":{},"summary":null}"#,
)
.await?;
sqlx::query(
"INSERT INTO script (workspace_id, hash, path, content, language, kind, created_by, schema, summary, description, lock)
VALUES ('test-workspace', 1234567891, 'f/test/success_handler', 'echo handled', 'bash', 'script', 'test-user', '{}', '', '', '')",
)
.execute(&db)
.await?;
configure_workspace_handlers(&db).await?;
let completed_job = RunJob::from(JobPayload::ScriptHub {
path: format!("hub/{version}/test/ok"),
apply_preprocessor: false,
})
.run_until_complete(&db, false, server.addr.port())
.await;
assert!(completed_job.success, "Hub script should have succeeded");
let handler_job = wait_for_handler_job(&db, SUCCESS_HANDLER_EMAIL).await?;
assert_eq!(
handler_job.map(|(_, parent)| parent),
Some(Some(completed_job.id)),
"Workspace success handler should handle the successful hub script"
);
Ok(())
}
+2
View File
@@ -12,6 +12,8 @@ mcp = ["dep:windmill-mcp"]
[lib]
name = "windmill_ai"
path = "src/lib.rs"
# src/ has no doctests: remove this line before adding one, or cargo test never runs it.
doctest = false
[dependencies]
windmill-common = { workspace = true, default-features = false }
+25 -20
View File
@@ -5,6 +5,9 @@
use serde::{Deserialize, Deserializer, Serialize};
use windmill_common::db::DB;
use windmill_common::error::{Error, Result};
use windmill_common::ssrf::{PrivateHostAllowance, SsrfValidationError, ValidatedTarget};
const ALLOW_PRIVATE_AI_BASE_URLS_ENV: &str = "ALLOW_PRIVATE_AI_BASE_URLS";
/// Deserializes an Option<String> where empty strings become None.
/// Use with `#[serde(default, deserialize_with = "empty_string_as_none")]`
@@ -20,10 +23,10 @@ where
lazy_static::lazy_static! {
static ref OPENAI_AZURE_BASE_PATH: Option<String> = std::env::var("OPENAI_AZURE_BASE_PATH").ok();
pub static ref ALLOW_PRIVATE_AI_BASE_URLS: bool = std::env::var("ALLOW_PRIVATE_AI_BASE_URLS")
.ok()
.map(|v| v == "true" || v == "1")
.unwrap_or(false);
/// Covers every AI base URL, whoever supplied it: the workspace or instance AI config, a
/// resource a member picked, or an inline resource value sent to the proxy.
pub static ref ALLOW_PRIVATE_AI_BASE_URLS: PrivateHostAllowance =
PrivateHostAllowance::from_env(ALLOW_PRIVATE_AI_BASE_URLS_ENV);
/// Drops the cache breakpoints from agent-step requests on every Anthropic platform,
/// not just the one that motivates it: a Google Cloud project can have explicit prompt
/// caching turned off (by request to Cloud support), and Vertex then rejects any request
@@ -131,6 +134,23 @@ pub enum AIProvider {
Cloudflare,
}
/// Check an AI endpoint URL against the SSRF rules, allowing the private hosts
/// `ALLOW_PRIVATE_AI_BASE_URLS` names. Callers that connect next pin the returned target.
pub async fn validate_ai_url(url: &str) -> Result<ValidatedTarget> {
windmill_common::ssrf::validate_url_for_ssrf_allowing(url, &ALLOW_PRIVATE_AI_BASE_URLS)
.await
.map_err(|e| match e {
// Only a private target is fixed by the env var; for a malformed URL or bad
// scheme the hint would send users the wrong way (issue #9171).
e @ SsrfValidationError::Private { .. } => Error::BadRequest(format!(
"{e}. To use a private/internal AI endpoint, add its host (host, host:port or \
CIDR range) to the comma-separated {ALLOW_PRIVATE_AI_BASE_URLS_ENV} environment \
variable, or set it to true to allow every private host"
)),
e => Error::from(e),
})
}
/// The Workers AI models URL of a Cloudflare account. The id goes into the path, so it is held to
/// the characters an account id has rather than trusted to stay inside its segment.
pub fn cloudflare_workers_ai_base_url(account_id: Option<&str>) -> Result<String> {
@@ -161,22 +181,7 @@ impl AIProvider {
/// Get the base URL for the AI provider
pub async fn get_base_url(&self, resource_base_url: Option<String>, db: &DB) -> Result<String> {
if let Some(base_url) = resource_base_url {
if !*ALLOW_PRIVATE_AI_BASE_URLS {
use windmill_common::ssrf::SsrfValidationError;
windmill_common::ssrf::validate_url_for_ssrf(&base_url)
.await
.map_err(|e| match e {
// The env-var hint is only actionable when the URL is
// well-formed but blocked for targeting a private
// address. For a malformed URL or bad scheme, surface
// the real error so users fix the URL (issue #9171).
e @ SsrfValidationError::Private { .. } => Error::BadRequest(format!(
"{e}. If you need to use private/internal AI endpoints, \
set the ALLOW_PRIVATE_AI_BASE_URLS=true environment variable"
)),
e => Error::from(e),
})?;
}
validate_ai_url(&base_url).await?;
return Ok(base_url);
}
+52
View File
@@ -19,6 +19,25 @@ pub struct ProxyBuildArgs<'a> {
pub credentials: &'a ProviderCredentials,
}
/// Refuses a client-supplied proxy path that could resolve outside the provider's base
/// path once appended to it. URL parsing treats `\` as `/`, drops tabs and newlines, trims
/// spaces and ends the path at `?` or `#`, so `.\t./`, `..\`, `.. ` and `..?x` climb a
/// segment like `../`. The path arrives decoded once, so any `%` left is a second encoding
/// (`%2e`, `%2f`) that the URL parser or a gateway in front of the provider may decode again.
pub fn validate_proxy_path(path: &str) -> Result<()> {
let invalid = || Error::BadRequest(format!("Invalid AI proxy path: {path}"));
if path
.chars()
.any(|c| matches!(c, '\\' | ' ' | '?' | '#' | '%') || c.is_control())
|| path
.split('/')
.any(|segment| segment == "." || segment == "..")
{
return Err(invalid());
}
Ok(())
}
/// Provider-specific request produced by proxy request builders.
#[derive(Clone, Debug)]
pub struct ProxyRequest {
@@ -271,6 +290,39 @@ mod tests {
}
}
#[test]
fn proxy_path_refuses_dot_segments() {
for path in [
"chat/completions",
"v1/messages",
"models",
"openai/deployments/gpt-4.1/chat/completions",
"a..b/c",
] {
assert!(validate_proxy_path(path).is_ok(), "{path}");
}
for path in [
"../key/info",
"..",
"models/../../key/info",
"./x",
"%2e%2e/key/info",
"%2E./key/info",
".%2E/key/info",
"..\\key/info",
".\t./key/info",
"..\n/key/info",
".. ",
"..?x=1",
"..#f",
"%2e%2e?x",
"..%2fkey/info",
"%2e%2e%2fkey",
] {
assert!(validate_proxy_path(path).is_err(), "{path:?}");
}
}
#[test]
fn builds_openai_compatible_proxy_request() {
let credentials = credentials(AIProvider::OpenRouter, "https://openrouter.ai/api/v1/");
+5 -18
View File
@@ -88,30 +88,17 @@ pub fn ai_http_client_builder() -> reqwest::ClientBuilder {
/// after the check (DNS-rebinding TOCTOU).
///
/// Returns the shared pooled [`AI_HTTP_CLIENT`] unchanged when there is nothing
/// to pin — an IP-literal host, or a deployment that opted into private AI
/// endpoints via `ALLOW_PRIVATE_AI_BASE_URLS`. The same opt-out and error hint
/// as `AIProvider::get_base_url` apply, so this is consistent with the
/// to pin — an IP-literal host, or a host `ALLOW_PRIVATE_AI_BASE_URLS` allows
/// by name or wholesale. The same allowlist and error hint as
/// `AIProvider::get_base_url` apply, so this is consistent with the
/// credential-time validation while additionally closing the connect-time window.
pub async fn pinned_ai_client_for(
url: &str,
) -> windmill_common::error::Result<std::borrow::Cow<'static, reqwest::Client>> {
use std::borrow::Cow;
use windmill_common::error::{to_anyhow, Error};
use windmill_common::ssrf::SsrfValidationError;
use windmill_common::error::to_anyhow;
if *crate::ai_providers::ALLOW_PRIVATE_AI_BASE_URLS {
return Ok(Cow::Borrowed(&AI_HTTP_CLIENT));
}
let target = windmill_common::ssrf::validate_url_for_ssrf(url)
.await
.map_err(|e| match e {
e @ SsrfValidationError::Private { .. } => Error::BadRequest(format!(
"{e}. If you need to use private/internal AI endpoints, \
set the ALLOW_PRIVATE_AI_BASE_URLS=true environment variable"
)),
e => Error::from(e),
})?;
let target = crate::ai_providers::validate_ai_url(url).await?;
if target.pinned_addrs().is_empty() {
return Ok(Cow::Borrowed(&AI_HTTP_CLIENT));
+3
View File
@@ -7,6 +7,9 @@ edition.workspace = true
[lib]
name = "windmill_alerting"
path = "src/lib.rs"
# src/ has no unit tests or doctests: remove both lines before adding one, or cargo test never runs it.
test = false
doctest = false
[dependencies]
windmill-common = { workspace = true, default-features = false }
@@ -7,17 +7,20 @@ edition.workspace = true
[lib]
name = "windmill_api_agent_workers"
path = "src/lib.rs"
# src/ has no doctests: remove this line before adding one, or cargo test never runs it.
doctest = false
[features]
default = []
enterprise = ["windmill-common/enterprise", "windmill-queue/enterprise"]
private = ["windmill-common/private", "windmill-queue/private"]
private = ["windmill-common/private", "windmill-queue/private", "windmill-audit/private"]
python = ["dep:windmill-parser-py-imports"]
benchmark = ["windmill-queue/benchmark"]
[dependencies]
windmill-api-auth.workspace = true
windmill-common = { workspace = true, default-features = false }
windmill-audit.workspace = true
windmill-queue.workspace = true
windmill-worker.workspace = true
axum.workspace = true
+3
View File
@@ -7,6 +7,9 @@ edition.workspace = true
[lib]
name = "windmill_api_assets"
path = "src/lib.rs"
# src/ has no unit tests or doctests: remove both lines before adding one, or cargo test never runs it.
test = false
doctest = false
[features]
private = ["windmill-common/private"]
+2
View File
@@ -7,6 +7,8 @@ edition.workspace = true
[lib]
name = "windmill_api_auth"
path = "src/lib.rs"
# src/ has no doctests: remove this line before adding one, or cargo test never runs it.
doctest = false
[features]
default = []
+69 -4
View File
@@ -6,6 +6,7 @@ use axum::{
};
use chrono::TimeZone;
use http::{request::Parts, StatusCode};
use itertools::Itertools;
use quick_cache::sync::Cache;
use serde::{Deserialize, Serialize};
use sqlx::FromRow;
@@ -1022,6 +1023,49 @@ where
}
}
/// Adds the suffixed form of each tag of an `if_jobs:filter_tags:` scope: in a dev workspace a
/// job allowed on `gpu` is queued on `gpu-dev`, and the token must still reach the jobs it starts.
fn expand_filter_tags_with_dev_suffix(scopes: &mut [String], suffix: &str) {
for scope in scopes.iter_mut() {
if let Some(tags) = scope.strip_prefix("if_jobs:filter_tags:") {
let expanded = tags
.split(',')
.flat_map(|t| {
let suffixed = windmill_common::worker::with_dev_workspace_suffix(t, suffix);
[t.to_string(), suffixed]
})
.unique()
.join(",");
*scope = format!("if_jobs:filter_tags:{expanded}");
}
}
}
/// Only while isolation is on and for a workspace whose jobs get the suffix then: otherwise the
/// suffixed tags are other tags the token was not given.
async fn expand_filter_tags_for_dev_workspace(
db: &DB,
workspace_id: &str,
scopes: Option<&mut Vec<String>>,
) {
let Some(scopes) = scopes else { return };
if !windmill_common::worker::DEV_WORKSPACE_ISOLATION.load(std::sync::atomic::Ordering::Relaxed)
|| !scopes.iter().any(|s| s.starts_with("if_jobs:filter_tags:"))
{
return;
}
let (is_dev, in_dev_lineage) = windmill_common::workspaces::dev_lineage(db, workspace_id)
.await
.unwrap_or((
workspace_id.starts_with(windmill_common::workspaces::WM_FORK_PREFIX),
true,
));
if windmill_common::worker::is_isolated_workspace(is_dev, in_dev_lineage) {
let suffix = windmill_common::worker::DEV_WORKSPACE_TAG_SUFFIX.load();
expand_filter_tags_with_dev_suffix(scopes, &suffix);
}
}
pub fn transform_old_scope_to_new_scope(scopes: Option<&mut Vec<String>>) {
if let Some(scopes) = scopes {
for scope in scopes.iter_mut() {
@@ -1110,10 +1154,10 @@ pub async fn resolve_opt_job_authed(
};
if is_no_auth() {
return Ok((
OptJobAuthed { authed: no_auth_admin_authed(), job_id: None },
parts,
));
let authed = no_auth_admin_authed();
// Handlers taking `Extension<ApiAuthed>` read this insert, as on the token path.
parts.extensions.insert(authed.clone());
return Ok((OptJobAuthed { authed, job_id: None }, parts));
}
// Safe only while what the route checks below read is fixed before the first
@@ -1172,6 +1216,14 @@ pub async fn resolve_opt_job_authed(
let authed = &mut opt_job_authed.authed;
if authed.scopes.is_some() && !own_job_runtime_route {
transform_old_scope_to_new_scope(authed.scopes.as_mut());
if let Some(w_id) = workspace_id.as_deref() {
expand_filter_tags_for_dev_workspace(
&cache.db,
w_id,
authed.scopes.as_mut(),
)
.await;
}
if let Err(err) = crate::scopes::check_scopes_for_route(
authed.scopes.as_deref(),
@@ -1359,6 +1411,19 @@ pub async fn list_tokens_internal(
mod tests {
use super::*;
#[test]
fn filter_tags_reach_their_dev_workspace_form() {
let mut scopes = vec![
"jobs:read".to_string(),
"if_jobs:filter_tags:gpu,bash-dev".to_string(),
];
expand_filter_tags_with_dev_suffix(&mut scopes, "-dev");
assert_eq!(
scopes,
vec!["jobs:read", "if_jobs:filter_tags:gpu,gpu-dev,bash-dev"]
);
}
/// Dropping the `AUTH_CACHE` entry between the two resolutions is what makes a memo
/// hit observable: only a working memo can answer the second one.
#[tokio::test]

Some files were not shown because too many files have changed in this diff Show More