test: take the rename test's parent hash from the create response

`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) <noreply@anthropic.com>
This commit is contained in:
Ruben Fiszel
2026-09-05 03:32:21 +02:00
co-authored by Claude Opus 5
parent 9981b05da4
commit f7f79d45cf
2 changed files with 5 additions and 27 deletions
@@ -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"
}
@@ -95,6 +95,10 @@ async fn test_dbt_materialize_target_deploy_contract(db: Pool<Postgres>) -> 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<Postgres>) -> 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<Postgres>) -> 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() {}",