From 3840eddf490e1379163acd4e35110651ba349405 Mon Sep 17 00:00:00 2001 From: Simon Gagnon Date: Thu, 8 Oct 2026 12:37:49 -0400 Subject: [PATCH] fix(acquire): keep the lease's role for the same database acquire derived the role name on every call. After #44 changed role naming for long worktree names, an existing long-named dev database mapped to a new role: ensureDatabase handed the database to it while its tables stayed owned by the old role (permission denied), and the rewritten lease lost the old one. acquire now reuses the role stored in an existing lease when that lease is for the same database (fresh drops by it too); new databases keep the new naming. CHANGELOG corrected to describe the real behaviour. Refs: cedar-pg-n8i Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 2 +- src/core/lifecycle.ts | 12 +++- tests/lifecycle-acquire.test.ts | 120 ++++++++++++++++++++++++++++++++ 3 files changed, 130 insertions(+), 4 deletions(-) create mode 100644 tests/lifecycle-acquire.test.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 9233d07..ec5bc34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,7 +35,7 @@ - TEMPLATE `cloneWorkerDatabase` reuses the worker's `