From f7f79d45cf23e99f650062e64feda71d6ab72d9a Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Sat, 5 Sep 2026 03:32:21 +0200 Subject: [PATCH] test: take the rename test's parent hash from the create response MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `format!("{:x}", …)` over the stored i64 drops leading zeros, while `ScriptHash`'s deserializer hex-decodes and demands 8 bytes — so a hash below 2^60 would 422 the request instead of reaching the refusal it asserts on, on roughly one in sixteen spellings of that script body. The create response already carries the zero-padded form, as the rest of the suite uses. Co-Authored-By: Claude Opus 5 (1M context) --- ...07f75182ea2f25162fe6e3c9b99a8a8cfacdb.json | 20 ------------------- .../tests/dbt_materialize_target.rs | 12 +++++------ 2 files changed, 5 insertions(+), 27 deletions(-) delete mode 100644 backend/.sqlx/query-87877da7342ee745514442387c707f75182ea2f25162fe6e3c9b99a8a8cfacdb.json diff --git a/backend/.sqlx/query-87877da7342ee745514442387c707f75182ea2f25162fe6e3c9b99a8a8cfacdb.json b/backend/.sqlx/query-87877da7342ee745514442387c707f75182ea2f25162fe6e3c9b99a8a8cfacdb.json deleted file mode 100644 index 8435668f14..0000000000 --- a/backend/.sqlx/query-87877da7342ee745514442387c707f75182ea2f25162fe6e3c9b99a8a8cfacdb.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT hash FROM script WHERE workspace_id = 'test-workspace' AND path = 'u/test-user/ingest' AND archived = false", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "hash", - "type_info": "Int8" - } - ], - "parameters": { - "Left": [] - }, - "nullable": [ - false - ] - }, - "hash": "87877da7342ee745514442387c707f75182ea2f25162fe6e3c9b99a8a8cfacdb" -} diff --git a/backend/windmill-api-integration-tests/tests/dbt_materialize_target.rs b/backend/windmill-api-integration-tests/tests/dbt_materialize_target.rs index 477ed1d680..d93a9562c4 100644 --- a/backend/windmill-api-integration-tests/tests/dbt_materialize_target.rs +++ b/backend/windmill-api-integration-tests/tests/dbt_materialize_target.rs @@ -95,6 +95,10 @@ async fn test_dbt_materialize_target_deploy_contract(db: Pool) -> anyh ) .await; assert_eq!(resp.status(), 201); + // The create response, not `{:x}` over the stored i64: `ScriptHash` decodes + // hex and demands 8 bytes, while `LowerHex` drops leading zeros, so a hash + // under 2^60 would 422 the rename below instead of reaching the refusal. + let ingest_hash = resp.text().await?; let write = sqlx::query_scalar!( "SELECT path FROM asset WHERE workspace_id = 'test-workspace' AND kind = 'dbt' \ AND usage_path = 'u/test-user/ingest' AND usage_access_type = 'w'" @@ -150,12 +154,6 @@ async fn test_dbt_materialize_target_deploy_contract(db: Pool) -> anyh // OLD path in the committed snapshot this deploy reads, while the same // transaction removes it — so it must not count as the producer that would // wake the subscription the rename adds. - let hash = sqlx::query_scalar!( - "SELECT hash FROM script WHERE workspace_id = 'test-workspace' \ - AND path = 'u/test-user/ingest' AND archived = false" - ) - .fetch_one(&db) - .await?; sqlx::query!( "INSERT INTO asset (workspace_id, path, kind, usage_access_type, usage_path, usage_kind) VALUES ('test-workspace', 'main/analytics/orders', 'dbt', 'w', 'u/test-user/project', @@ -168,7 +166,7 @@ async fn test_dbt_materialize_target_deploy_contract(db: Pool) -> anyh ))) .json(&json!({ "path": "u/test-user/ingest_renamed", - "parent_hash": format!("{:x}", hash), + "parent_hash": ingest_hash, "summary": "", "description": "", "content": "// on dbt://main/analytics/orders\nexport async function main() {}",