Merge remote-tracking branch 'origin/main' into tag-min-job-isolation

# Conflicts:
#	backend/ee-repo-ref.txt
This commit is contained in:
Ruben Fiszel
2026-10-18 05:39:17 +02:00
168 changed files with 2493 additions and 1933 deletions
+9 -2
View File
@@ -206,14 +206,21 @@ jobs:
curl -sf http://localhost:8000/api/version > /dev/null || { echo "Windmill failed to start"; exit 1; }
- name: Run git sync E2E tests
timeout-minutes: 10
timeout-minutes: 75
env:
GITEA_DOCKER_URL: http://localhost:3000
LICENSE_KEY: ${{ secrets.WM_LICENSE_KEY_CI }}
run: |
python3 -m venv .venv
.venv/bin/pip install -r integration_tests/requirements.txt
cd integration_tests && ../.venv/bin/python -m unittest -v test.git_sync_test
cd integration_tests
fails=0
for i in $(seq 1 8); do
echo "TEMP-LOOP iteration $i"
../.venv/bin/python -m unittest -v test.git_sync_test || fails=$((fails+1))
done
echo "TEMP-LOOP failed iterations: $fails"
[ "$fails" = 0 ]
- name: Archive logs
uses: actions/upload-artifact@v4
+1 -1
View File
@@ -1,3 +1,3 @@
{
".": "1.839.0"
".": "1.840.0"
}
+24
View File
@@ -1,5 +1,29 @@
# Changelog
## [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)
+5
View File
@@ -254,6 +254,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"
}
@@ -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"
}
@@ -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"
}
@@ -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"
}
@@ -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"
}
@@ -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"
}
@@ -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": "\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"
}
@@ -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"
}
@@ -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"
}
@@ -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"
}
+93 -93
View File
@@ -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",
]
@@ -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.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"async-nats",
@@ -15576,7 +15576,7 @@ dependencies = [
[[package]]
name = "windmill-ai"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"async-stream",
"async-trait",
@@ -15611,7 +15611,7 @@ dependencies = [
[[package]]
name = "windmill-alerting"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"axum",
"chrono",
@@ -15624,7 +15624,7 @@ dependencies = [
[[package]]
name = "windmill-api"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"argon2",
@@ -15767,7 +15767,7 @@ dependencies = [
[[package]]
name = "windmill-api-agent-workers"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"axum",
"chrono",
@@ -15790,7 +15790,7 @@ dependencies = [
[[package]]
name = "windmill-api-assets"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"axum",
"chrono",
@@ -15807,7 +15807,7 @@ dependencies = [
[[package]]
name = "windmill-api-auth"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"axum",
@@ -15833,7 +15833,7 @@ dependencies = [
[[package]]
name = "windmill-api-client"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"reqwest 0.12.28",
"serde",
@@ -15843,7 +15843,7 @@ dependencies = [
[[package]]
name = "windmill-api-configs"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"axum",
"chrono",
@@ -15860,7 +15860,7 @@ dependencies = [
[[package]]
name = "windmill-api-debug"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"axum",
"base64 0.22.1",
@@ -15882,7 +15882,7 @@ dependencies = [
[[package]]
name = "windmill-api-embeddings"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"axum",
@@ -15905,7 +15905,7 @@ dependencies = [
[[package]]
name = "windmill-api-flow-conversations"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"axum",
"chrono",
@@ -15921,7 +15921,7 @@ dependencies = [
[[package]]
name = "windmill-api-flows"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"axum",
"chrono",
@@ -15943,7 +15943,7 @@ dependencies = [
[[package]]
name = "windmill-api-groups"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"axum",
"chrono",
@@ -15965,7 +15965,7 @@ dependencies = [
[[package]]
name = "windmill-api-inputs"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"axum",
"chrono",
@@ -15979,7 +15979,7 @@ dependencies = [
[[package]]
name = "windmill-api-integration-tests"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"async-nats",
@@ -16015,7 +16015,7 @@ dependencies = [
[[package]]
name = "windmill-api-jobs"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"axum",
@@ -16041,7 +16041,7 @@ dependencies = [
[[package]]
name = "windmill-api-npm-proxy"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"axum",
"chrono",
@@ -16069,7 +16069,7 @@ dependencies = [
[[package]]
name = "windmill-api-openapi"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"axum",
@@ -16091,7 +16091,7 @@ dependencies = [
[[package]]
name = "windmill-api-schedule"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"axum",
"chrono",
@@ -16111,7 +16111,7 @@ dependencies = [
[[package]]
name = "windmill-api-scripts"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"axum",
@@ -16153,7 +16153,7 @@ dependencies = [
[[package]]
name = "windmill-api-settings"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"axum",
@@ -16183,7 +16183,7 @@ dependencies = [
[[package]]
name = "windmill-api-sse"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"lazy_static",
"serde",
@@ -16195,7 +16195,7 @@ dependencies = [
[[package]]
name = "windmill-api-users"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"argon2",
"axum",
@@ -16219,7 +16219,7 @@ dependencies = [
[[package]]
name = "windmill-api-workers"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"axum",
"chrono",
@@ -16234,7 +16234,7 @@ dependencies = [
[[package]]
name = "windmill-api-workspaces"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"axum",
"chrono",
@@ -16273,7 +16273,7 @@ dependencies = [
[[package]]
name = "windmill-audit"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"chrono",
"lazy_static",
@@ -16288,7 +16288,7 @@ dependencies = [
[[package]]
name = "windmill-autoscaling"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"axum",
@@ -16307,7 +16307,7 @@ dependencies = [
[[package]]
name = "windmill-common"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"aes-gcm",
"aho-corasick",
@@ -16424,7 +16424,7 @@ dependencies = [
[[package]]
name = "windmill-dep-map"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"chrono",
"futures",
@@ -16444,7 +16444,7 @@ dependencies = [
[[package]]
name = "windmill-git-sync"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"regex",
"serde",
@@ -16461,7 +16461,7 @@ dependencies = [
[[package]]
name = "windmill-indexer"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"astral-tokio-tar",
@@ -16488,7 +16488,7 @@ dependencies = [
[[package]]
name = "windmill-jseval"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"futures",
@@ -16505,7 +16505,7 @@ dependencies = [
[[package]]
name = "windmill-macros"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"itertools 0.14.0",
"lazy_static",
@@ -16521,7 +16521,7 @@ dependencies = [
[[package]]
name = "windmill-mcp"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"async-trait",
@@ -16543,7 +16543,7 @@ dependencies = [
[[package]]
name = "windmill-native-triggers"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"async-trait",
@@ -16574,7 +16574,7 @@ dependencies = [
[[package]]
name = "windmill-oauth"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"arc-swap",
@@ -16599,7 +16599,7 @@ dependencies = [
[[package]]
name = "windmill-object-store"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"async-stream",
@@ -16635,7 +16635,7 @@ dependencies = [
[[package]]
name = "windmill-operator"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"futures",
@@ -16654,7 +16654,7 @@ dependencies = [
[[package]]
name = "windmill-parser"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"convert_case 0.6.0",
"serde",
@@ -16663,7 +16663,7 @@ dependencies = [
[[package]]
name = "windmill-parser-bash"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"lazy_static",
@@ -16675,7 +16675,7 @@ dependencies = [
[[package]]
name = "windmill-parser-csharp"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"serde_json",
@@ -16687,7 +16687,7 @@ dependencies = [
[[package]]
name = "windmill-parser-go"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"gosyn",
@@ -16699,7 +16699,7 @@ dependencies = [
[[package]]
name = "windmill-parser-graphql"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"lazy_static",
@@ -16711,7 +16711,7 @@ dependencies = [
[[package]]
name = "windmill-parser-java"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"serde_json",
@@ -16723,7 +16723,7 @@ dependencies = [
[[package]]
name = "windmill-parser-nu"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"nu-parser",
@@ -16734,7 +16734,7 @@ dependencies = [
[[package]]
name = "windmill-parser-php"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"itertools 0.14.0",
@@ -16745,7 +16745,7 @@ dependencies = [
[[package]]
name = "windmill-parser-py"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"itertools 0.14.0",
@@ -16757,7 +16757,7 @@ dependencies = [
[[package]]
name = "windmill-parser-py-asset"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"ruff_python_ast",
@@ -16768,7 +16768,7 @@ dependencies = [
[[package]]
name = "windmill-parser-py-imports"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"async-recursion",
@@ -16791,7 +16791,7 @@ dependencies = [
[[package]]
name = "windmill-parser-r"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"serde_json",
@@ -16803,7 +16803,7 @@ dependencies = [
[[package]]
name = "windmill-parser-ruby"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"lazy_static",
@@ -16817,7 +16817,7 @@ dependencies = [
[[package]]
name = "windmill-parser-rust"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"convert_case 0.6.0",
@@ -16834,7 +16834,7 @@ dependencies = [
[[package]]
name = "windmill-parser-sql"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"lazy_static",
@@ -16847,7 +16847,7 @@ dependencies = [
[[package]]
name = "windmill-parser-sql-asset"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"serde",
@@ -16859,7 +16859,7 @@ dependencies = [
[[package]]
name = "windmill-parser-ts"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"lazy_static",
@@ -16877,7 +16877,7 @@ dependencies = [
[[package]]
name = "windmill-parser-ts-asset"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"serde-wasm-bindgen",
@@ -16893,7 +16893,7 @@ dependencies = [
[[package]]
name = "windmill-parser-wac"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"ruff_python_ast",
@@ -16910,7 +16910,7 @@ dependencies = [
[[package]]
name = "windmill-parser-yaml"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"lazy_static",
@@ -16924,7 +16924,7 @@ dependencies = [
[[package]]
name = "windmill-queue"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"async-recursion",
@@ -16963,7 +16963,7 @@ dependencies = [
[[package]]
name = "windmill-runtime-nativets"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"const_format",
@@ -17001,7 +17001,7 @@ dependencies = [
[[package]]
name = "windmill-sql-datatype-parser-wasm"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"getrandom 0.3.4",
"wasm-bindgen",
@@ -17012,7 +17012,7 @@ dependencies = [
[[package]]
name = "windmill-store"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"async-recursion",
@@ -17047,7 +17047,7 @@ dependencies = [
[[package]]
name = "windmill-test-utils"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"async-trait",
@@ -17071,7 +17071,7 @@ dependencies = [
[[package]]
name = "windmill-trigger"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"async-trait",
@@ -17104,7 +17104,7 @@ dependencies = [
[[package]]
name = "windmill-trigger-amqp"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"async-trait",
@@ -17131,7 +17131,7 @@ dependencies = [
[[package]]
name = "windmill-trigger-azure"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"async-trait",
@@ -17164,7 +17164,7 @@ dependencies = [
[[package]]
name = "windmill-trigger-email"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"async-trait",
@@ -17184,7 +17184,7 @@ dependencies = [
[[package]]
name = "windmill-trigger-gcp"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"async-trait",
@@ -17218,7 +17218,7 @@ dependencies = [
[[package]]
name = "windmill-trigger-http"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"async-trait",
@@ -17255,7 +17255,7 @@ dependencies = [
[[package]]
name = "windmill-trigger-kafka"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"async-trait",
@@ -17278,7 +17278,7 @@ dependencies = [
[[package]]
name = "windmill-trigger-mqtt"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"async-trait",
@@ -17302,7 +17302,7 @@ dependencies = [
[[package]]
name = "windmill-trigger-nats"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"async-nats",
@@ -17326,7 +17326,7 @@ dependencies = [
[[package]]
name = "windmill-trigger-postgres"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"async-trait",
@@ -17361,7 +17361,7 @@ dependencies = [
[[package]]
name = "windmill-trigger-sqs"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"async-trait",
@@ -17389,7 +17389,7 @@ dependencies = [
[[package]]
name = "windmill-trigger-websocket"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"async-trait",
@@ -17414,7 +17414,7 @@ dependencies = [
[[package]]
name = "windmill-types"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"bitflags 2.13.2",
@@ -17433,7 +17433,7 @@ dependencies = [
[[package]]
name = "windmill-worker"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"async-once-cell",
@@ -17551,7 +17551,7 @@ dependencies = [
[[package]]
name = "windmill-worker-volumes"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"bytes",
"futures",
+15 -10
View File
@@ -1,6 +1,6 @@
[package]
name = "windmill"
version = "1.839.0"
version = "1.840.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.839.0"
version = "1.840.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" }
+1 -1
View File
@@ -1 +1 @@
1b6423df126e00aab58cf9e2943ee367d6ef2771
30eb5229e76e7e1dee442265cd719c7865db1ed2
@@ -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.839.0"
version = "1.840.0"
dependencies = [
"aes-gcm",
"aho-corasick",
@@ -6430,7 +6430,7 @@ dependencies = [
[[package]]
name = "windmill-macros"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"proc-macro2",
"quote",
@@ -6442,7 +6442,7 @@ dependencies = [
[[package]]
name = "windmill-parser"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"convert_case",
"serde",
@@ -6451,7 +6451,7 @@ dependencies = [
[[package]]
name = "windmill-parser-bash"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"lazy_static",
@@ -6463,7 +6463,7 @@ dependencies = [
[[package]]
name = "windmill-parser-csharp"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"serde_json",
@@ -6475,7 +6475,7 @@ dependencies = [
[[package]]
name = "windmill-parser-go"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"gosyn",
@@ -6487,7 +6487,7 @@ dependencies = [
[[package]]
name = "windmill-parser-graphql"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"lazy_static",
@@ -6499,7 +6499,7 @@ dependencies = [
[[package]]
name = "windmill-parser-java"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"serde_json",
@@ -6511,7 +6511,7 @@ dependencies = [
[[package]]
name = "windmill-parser-nu"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"nu-parser",
@@ -6522,7 +6522,7 @@ dependencies = [
[[package]]
name = "windmill-parser-php"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"itertools 0.14.0",
@@ -6533,7 +6533,7 @@ dependencies = [
[[package]]
name = "windmill-parser-py"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"itertools 0.14.0",
@@ -6545,7 +6545,7 @@ dependencies = [
[[package]]
name = "windmill-parser-py-asset"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"ruff_python_ast",
@@ -6556,7 +6556,7 @@ dependencies = [
[[package]]
name = "windmill-parser-py-imports"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"async-recursion",
@@ -6579,7 +6579,7 @@ dependencies = [
[[package]]
name = "windmill-parser-r"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"serde_json",
@@ -6591,7 +6591,7 @@ dependencies = [
[[package]]
name = "windmill-parser-ruby"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"lazy_static",
@@ -6605,7 +6605,7 @@ dependencies = [
[[package]]
name = "windmill-parser-rust"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"convert_case",
@@ -6622,7 +6622,7 @@ dependencies = [
[[package]]
name = "windmill-parser-sql"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"lazy_static",
@@ -6635,7 +6635,7 @@ dependencies = [
[[package]]
name = "windmill-parser-sql-asset"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"serde",
@@ -6647,7 +6647,7 @@ dependencies = [
[[package]]
name = "windmill-parser-ts"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"lazy_static",
@@ -6665,7 +6665,7 @@ dependencies = [
[[package]]
name = "windmill-parser-ts-asset"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"serde-wasm-bindgen",
@@ -6681,7 +6681,7 @@ dependencies = [
[[package]]
name = "windmill-parser-wac"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"ruff_python_ast",
@@ -6698,7 +6698,7 @@ dependencies = [
[[package]]
name = "windmill-parser-wasm"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"getrandom 0.2.17",
@@ -6730,7 +6730,7 @@ dependencies = [
[[package]]
name = "windmill-parser-yaml"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"lazy_static",
@@ -6744,7 +6744,7 @@ dependencies = [
[[package]]
name = "windmill-types"
version = "1.839.0"
version = "1.840.0"
dependencies = [
"anyhow",
"bitflags",
@@ -12,7 +12,7 @@ resolver = "2"
members = ["."]
[workspace.package]
version = "1.839.0"
version = "1.840.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
-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', '');
-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(())
}
+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 }
+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,6 +7,8 @@ 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 = []
+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 = []
+3
View File
@@ -7,6 +7,9 @@ edition.workspace = true
[lib]
name = "windmill_api_client"
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]
+2
View File
@@ -7,6 +7,8 @@ edition.workspace = true
[lib]
name = "windmill_api_configs"
path = "src/lib.rs"
# src/ has no doctests: remove this line before adding one, or cargo test never runs it.
doctest = false
[features]
default = []
+2
View File
@@ -7,6 +7,8 @@ edition.workspace = true
[lib]
name = "windmill_api_debug"
path = "src/lib.rs"
# src/ has no doctests: remove this line before adding one, or cargo test never runs it.
doctest = false
[features]
default = []
@@ -7,6 +7,8 @@ edition.workspace = true
[lib]
name = "windmill_api_embeddings"
path = "src/lib.rs"
# src/ has no doctests: remove this line before adding one, or cargo test never runs it.
doctest = false
[features]
default = []
@@ -7,6 +7,9 @@ edition.workspace = true
[lib]
name = "windmill_api_flow_conversations"
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-api-auth.workspace = true
+2
View File
@@ -7,6 +7,8 @@ edition.workspace = true
[lib]
name = "windmill_api_flows"
path = "src/lib.rs"
# src/ has no doctests: remove this line before adding one, or cargo test never runs it.
doctest = false
[features]
default = []
+2
View File
@@ -7,6 +7,8 @@ edition.workspace = true
[lib]
name = "windmill_api_groups"
path = "src/lib.rs"
# src/ has no doctests: remove this line before adding one, or cargo test never runs it.
doctest = false
[features]
default = []
+3
View File
@@ -7,6 +7,9 @@ edition.workspace = true
[lib]
name = "windmill_api_inputs"
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-api-auth.workspace = true
@@ -7,6 +7,9 @@ edition.workspace = true
[lib]
name = "windmill_api_integration_tests"
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]
default = []
@@ -14,14 +14,16 @@
//! (lowkey-vault), which the `AzureKeyVaultBackend` talks to via its
//! static-token / self-signed-cert emulator mode.
//!
//! Run it:
//! The test is `#[ignore]`d, so a plain `cargo test` skips it without creating
//! a database. Run it with `--ignored` (`AZURE_KV_URL` overrides the default
//! https://localhost:8443):
//! ```bash
//! podman run -d --name lowkey -p 8443:8443 \
//! -e LOWKEY_ARGS="--LOWKEY_VAULT_NAMES=default" \
//! docker.io/nagyesta/lowkey-vault:7.3.0
//!
//! RUN_AZURE_KV_TESTS=1 cargo test -p windmill-api-integration-tests \
//! --features private,enterprise --test fork_secret_replication_azure -- --nocapture
//! cargo test -p windmill-api-integration-tests \
//! --features private,enterprise --test fork_secret_replication_azure -- --ignored --nocapture
//! ```
#[cfg(all(feature = "private", feature = "enterprise"))]
@@ -55,11 +57,8 @@ mod azure_fork {
}
#[sqlx::test(migrations = "../migrations", fixtures("base"))]
#[ignore = "requires a lowkey-vault Azure Key Vault emulator at AZURE_KV_URL"]
async fn migrated_secret_is_replicated_on_fork(db: Pool<Postgres>) -> anyhow::Result<()> {
if std::env::var("RUN_AZURE_KV_TESTS").as_deref() != Ok("1") {
eprintln!("skipping: set RUN_AZURE_KV_TESTS=1 and start lowkey-vault to run");
return Ok(());
}
initialize_tracing().await;
// The Azure KV emulator persists across runs; derive unique names per run
@@ -236,14 +236,17 @@ async fn test_jobs_unauthed_complex_reachability(db: Pool<Postgres>) -> anyhow::
"GET /get_log_file",
);
let resp = authed(client().post(format!("{base}/queue/cancel_persistent/u/test-user/fake")))
// Unauthenticated, so the handler refuses before cancelling, which sleeps for seconds.
let resp = client()
.post(format!("{base}/queue/cancel_persistent/u/test-user/fake"))
.json(&serde_json::json!({"reason": "test"}))
.send()
.await?;
assert_route_reachable(
resp.status().as_u16(),
&resp.text().await?,
"POST /queue/cancel_persistent",
let status = resp.status().as_u16();
let body = resp.text().await?;
assert!(
status == 400 && body.contains("Cancelling persistent script require"),
"POST /queue/cancel_persistent did not reach its handler: {status} {body}"
);
Ok(())
@@ -432,13 +432,35 @@ async fn test_archive_takes_the_pairing_lock_for_a_standalone_workspace(
.execute(&mut *held)
.await?;
let finished =
tokio::time::timeout(std::time::Duration::from_secs(5), archive(port, "h-cand")).await;
assert!(
finished.is_err(),
"archive of a standalone workspace completed while its pairing lock was held: {finished:?}"
);
let archiving = tokio::spawn(async move { archive(port, "h-cand").await });
let mut parked = false;
for _ in 0..400 {
let waiting: i64 = sqlx::query_scalar(
"SELECT count(*) FROM pg_stat_activity WHERE wait_event_type = 'Lock' \
AND wait_event = 'advisory' AND datname = current_database() \
AND query LIKE '%dev_workspace_pairing%' AND pid <> pg_backend_pid()",
)
.fetch_one(&db)
.await?;
if waiting > 0 {
parked = true;
break;
}
assert!(
!archiving.is_finished(),
"archive of a standalone workspace completed while its pairing lock was held: {:?}",
archiving.await
);
tokio::time::sleep(std::time::Duration::from_millis(25)).await;
}
assert!(parked, "archive never waited on the pairing lock");
held.rollback().await?;
let (status, body) = archiving.await?;
assert!(
status.is_success(),
"archive after the lock was released returned {status}: {body}"
);
Ok(())
}
+2
View File
@@ -7,6 +7,8 @@ edition.workspace = true
[lib]
name = "windmill_api_jobs"
path = "src/lib.rs"
# src/ has no doctests: remove this line before adding one, or cargo test never runs it.
doctest = false
[features]
default = []
@@ -7,6 +7,8 @@ edition.workspace = true
[lib]
name = "windmill_api_npm_proxy"
path = "src/lib.rs"
# src/ has no doctests: remove this line before adding one, or cargo test never runs it.
doctest = false
[features]
default = []
+3
View File
@@ -7,6 +7,9 @@ edition.workspace = true
[lib]
name = "windmill_api_openapi"
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-api-auth.workspace = true
+3
View File
@@ -7,6 +7,9 @@ edition.workspace = true
[lib]
name = "windmill_api_schedule"
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]
default = []
+2
View File
@@ -7,6 +7,8 @@ edition.workspace = true
[lib]
name = "windmill_api_scripts"
path = "src/lib.rs"
# src/ has no doctests: remove this line before adding one, or cargo test never runs it.
doctest = false
[features]
default = []
+2
View File
@@ -7,6 +7,8 @@ edition.workspace = true
[lib]
name = "windmill_api_settings"
path = "src/lib.rs"
# src/ has no doctests: remove this line before adding one, or cargo test never runs it.
doctest = false
[features]
default = []
+3
View File
@@ -7,6 +7,9 @@ edition.workspace = true
[lib]
name = "windmill_api_sse"
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]
default = []
+2
View File
@@ -7,6 +7,8 @@ edition.workspace = true
[lib]
name = "windmill_api_users"
path = "src/lib.rs"
# src/ has no doctests: remove this line before adding one, or cargo test never runs it.
doctest = false
[features]
default = []
+3
View File
@@ -7,6 +7,9 @@ edition.workspace = true
[lib]
name = "windmill_api_workers"
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-api-auth.workspace = true
@@ -7,6 +7,8 @@ edition.workspace = true
[lib]
name = "windmill_api_workspaces"
path = "src/lib.rs"
# src/ has no doctests: remove this line before adding one, or cargo test never runs it.
doctest = false
[features]
default = []
+2
View File
@@ -7,6 +7,8 @@ edition.workspace = true
[lib]
name = "windmill_api"
path = "src/lib.rs"
# src/ has no doctests: remove this line before adding one, or cargo test never runs it.
doctest = false
[features]
default = []
+1 -1
View File
@@ -1,7 +1,7 @@
openapi: "3.0.3"
info:
version: 1.839.0
version: 1.840.0
title: Windmill API
contact:
+2
View File
@@ -7,6 +7,8 @@ edition.workspace = true
[lib]
name = "windmill_audit"
path = "./src/lib.rs"
# src/ has no doctests: remove this line before adding one, or cargo test never runs it.
doctest = false
[features]
enterprise = ["windmill-common/enterprise"]
+3
View File
@@ -7,6 +7,9 @@ edition.workspace = true
[lib]
name = "windmill_autoscaling"
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]
enterprise = ["windmill-queue/enterprise", "windmill-common/enterprise"]
@@ -640,6 +640,7 @@ pub fn parse_allowed_origins_setting(
pub const ENV_SETTINGS: &[&str] = &[
"DISABLE_NSJAIL",
"DISABLE_BUN_INSTALL_SANDBOX",
"MODE",
"NUM_WORKERS",
"METRICS_ADDR",
+19
View File
@@ -1207,6 +1207,7 @@ pub struct RlangAnnotations {
pub renv_verbose: bool,
pub renv_install_verbose: bool,
pub sandbox: bool,
pub no_network: bool,
}
#[annotations("#")]
@@ -1222,6 +1223,7 @@ pub struct PythonAnnotations {
pub py314: bool,
pub py315: bool,
pub sandbox: bool,
pub no_network: bool,
}
#[annotations("//")]
@@ -1332,6 +1334,7 @@ impl SqlAnnotations {
pub struct BashAnnotations {
pub docker: bool,
pub sandbox: bool,
pub no_network: bool,
}
impl BashAnnotations {
@@ -3855,6 +3858,22 @@ mod tests {
assert!(combined.prepare);
}
#[test]
fn test_no_network_annotation() {
assert!(PythonAnnotations::parse("# sandbox\n# no_network\ndef main(): pass").no_network);
assert!(!PythonAnnotations::parse("# sandbox\ndef main(): pass").no_network);
assert!(RlangAnnotations::parse("#no_network\nmain <- function() {}").no_network);
assert!(
TypeScriptAnnotations::parse("// no_network\nexport function main() {}").no_network
);
let bash = "# sandbox alpine\n# no_network\necho hi";
assert!(BashAnnotations::parse(bash).no_network);
assert_eq!(
BashAnnotations::sandbox_image(bash),
Some("alpine".to_string())
);
}
#[test]
fn test_python_sandbox_annotation_with_other_annotations() {
let content = "# no_cache\n# sandbox\ndef main():\n pass";
@@ -12,43 +12,24 @@
//! localstack/localstack:3.8
//! ```
//!
//! 2. Run the tests:
//! 2. Run the tests (they are `#[ignore]`d, so a plain `cargo test` skips them):
//!
//! ```bash
//! RUN_AWS_SM_TESTS=1 cargo test -p windmill-common --features private,enterprise \
//! aws_sm_integration -- --nocapture
//! cargo test -p windmill-common --features private,enterprise \
//! --test aws_sm_integration -- --ignored --nocapture
//! ```
//!
//! ## Environment variables
//!
//! - `RUN_AWS_SM_TESTS=1` - Required to run the tests
//! - `AWS_SM_ENDPOINT` - LocalStack endpoint (default: http://localhost:4566)
//! - `AWS_SM_REGION` - AWS region (default: us-east-1)
#[cfg(all(feature = "private", feature = "enterprise"))]
mod tests {
use windmill_common::secret_backend::{
test_aws_sm_connection, AwsSecretsManagerBackend, AwsSecretsManagerSettings,
SecretBackend,
test_aws_sm_connection, AwsSecretsManagerBackend, AwsSecretsManagerSettings, SecretBackend,
};
fn should_run_aws_sm_tests() -> bool {
std::env::var("RUN_AWS_SM_TESTS")
.map(|v| v == "1" || v.to_lowercase() == "true")
.unwrap_or(false)
}
macro_rules! skip_if_no_aws_sm {
() => {
if !should_run_aws_sm_tests() {
println!("Skipping test: RUN_AWS_SM_TESTS=1 not set");
println!("To run: RUN_AWS_SM_TESTS=1 cargo test -p windmill-common --features private,enterprise aws_sm_integration -- --nocapture");
println!("Requires: docker run -d -p 4566:4566 -e SERVICES=secretsmanager localstack/localstack:3.8");
return;
}
};
}
fn test_settings() -> AwsSecretsManagerSettings {
AwsSecretsManagerSettings {
region: std::env::var("AWS_SM_REGION").unwrap_or_else(|_| "us-east-1".to_string()),
@@ -63,16 +44,16 @@ mod tests {
}
#[tokio::test]
#[ignore = "requires LocalStack secretsmanager at AWS_SM_ENDPOINT"]
async fn test_connection() {
skip_if_no_aws_sm!();
let result = test_aws_sm_connection(&test_settings()).await;
assert!(result.is_ok(), "Connection test failed: {:?}", result.err());
println!(" ✓ Connection test passed");
}
#[tokio::test]
#[ignore = "requires LocalStack secretsmanager at AWS_SM_ENDPOINT"]
async fn test_create_and_get_secret() {
skip_if_no_aws_sm!();
let backend = AwsSecretsManagerBackend::new_with_client(test_settings())
.await
.unwrap();
@@ -81,16 +62,22 @@ mod tests {
.set_secret("test-ws", "u/admin/my_secret", "super-secret-value")
.await
.unwrap();
let value = backend.get_secret("test-ws", "u/admin/my_secret").await.unwrap();
let value = backend
.get_secret("test-ws", "u/admin/my_secret")
.await
.unwrap();
assert_eq!(value, "super-secret-value");
backend.delete_secret("test-ws", "u/admin/my_secret").await.unwrap();
backend
.delete_secret("test-ws", "u/admin/my_secret")
.await
.unwrap();
println!(" ✓ Create + Get + Delete roundtrip passed");
}
#[tokio::test]
#[ignore = "requires LocalStack secretsmanager at AWS_SM_ENDPOINT"]
async fn test_update_secret() {
skip_if_no_aws_sm!();
let backend = AwsSecretsManagerBackend::new_with_client(test_settings())
.await
.unwrap();
@@ -117,8 +104,8 @@ mod tests {
}
#[tokio::test]
#[ignore = "requires LocalStack secretsmanager at AWS_SM_ENDPOINT"]
async fn test_delete_and_verify_gone() {
skip_if_no_aws_sm!();
let backend = AwsSecretsManagerBackend::new_with_client(test_settings())
.await
.unwrap();
@@ -142,8 +129,8 @@ mod tests {
}
#[tokio::test]
#[ignore = "requires LocalStack secretsmanager at AWS_SM_ENDPOINT"]
async fn test_delete_nonexistent_is_ok() {
skip_if_no_aws_sm!();
let backend = AwsSecretsManagerBackend::new_with_client(test_settings())
.await
.unwrap();
@@ -160,8 +147,8 @@ mod tests {
}
#[tokio::test]
#[ignore = "requires LocalStack secretsmanager at AWS_SM_ENDPOINT"]
async fn test_get_nonexistent_returns_not_found() {
skip_if_no_aws_sm!();
let backend = AwsSecretsManagerBackend::new_with_client(test_settings())
.await
.unwrap();
@@ -178,8 +165,8 @@ mod tests {
}
#[tokio::test]
#[ignore = "requires LocalStack secretsmanager at AWS_SM_ENDPOINT"]
async fn test_unicode_and_special_chars() {
skip_if_no_aws_sm!();
let backend = AwsSecretsManagerBackend::new_with_client(test_settings())
.await
.unwrap();
@@ -203,8 +190,8 @@ mod tests {
}
#[tokio::test]
#[ignore = "requires LocalStack secretsmanager at AWS_SM_ENDPOINT"]
async fn test_workspace_isolation() {
skip_if_no_aws_sm!();
let backend = AwsSecretsManagerBackend::new_with_client(test_settings())
.await
.unwrap();
@@ -244,8 +231,8 @@ mod tests {
}
#[tokio::test]
#[ignore = "requires LocalStack secretsmanager at AWS_SM_ENDPOINT"]
async fn test_backend_name() {
skip_if_no_aws_sm!();
let backend = AwsSecretsManagerBackend::new_with_client(test_settings())
.await
.unwrap();

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