fix(test): persist API key + anchor rights selector + idempotent createUser #19
Reference in New Issue
Block a user
Delete Branch "claude/sandbox-provision-run"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
First real run of
provisionSandbox.tsagainst the seeded sandbox surfaced three bugs inuserSetup.ts(verified live:ai_agent_sandboxrowid 4 hadapi_keyNULL and was missing onlyfacture/creerof the 11 intended rights):generateApiKeynever saved. It generated the key client-side and read it into.ai_agent_sandbox.key, but never submitted the edit form, so Dolibarr never persistedapi_key(DB stayed NULL → the key can't authenticate). → now clicks Save after generating.assignRightsselector was a substring match.[href*="rights=12"]also matchedrights=121/rights=1232, so.first()clicked the wrong link andfacture creer(12) was skipped. → anchored with the trailing&(rights=12&) for an exact match.createUserwasn't idempotent. A re-run hit the existing login and couldn't parse a new id. → addedfindUserId(look up by login in the user list) and return the existing id instead of creating a duplicate.deno checkpasses. The fixes make a re-run complete the provisioning: it finds the existing user, grants the missingfacture creer, and generates + persists the API key.🤖 Generated with Claude Code