Treat stamped questionnaire as empty in copy-from-spouse target guard #71

Merged
parkerhdavis merged 1 commit from fix-copy-from-spouse-empty-guard into main 2026-06-16 15:19:39 -06:00
parkerhdavis commented 2026-06-16 15:19:33 -06:00 (Migrated from github.com)

Problem

Copy from Spouse failed with:

Target directory already has a non-empty .lily project. Choose an empty folder.

The target was the boilerplate .lily that gets created when you create a new client — which you have to do before the copy-from-spouse action is even available.

Cause

copy_from_spouse_lily guards the target via is_empty_project, which still required questionnaire_id.is_none(). Since #63, every freshly-created client is stamped with a questionnaire_id/questionnaire_version at creation, so that boilerplate .lily was treated as non-empty and rejected.

This is the backend twin of the frontend isFreshWorkspace regression fixed in #70.

Fix

Drop the questionnaire_id condition from is_empty_project. Emptiness is now determined solely by actual client data — variables, documents, contacts, bindings, questionnaire notes, and required documents. Added a regression test covering a fresh client stamped with only a questionnaire id/version.

Verification

make test (96 passed) and make lint both pass.

## Problem Copy from Spouse failed with: > Target directory already has a non-empty .lily project. Choose an empty folder. The target was the boilerplate `.lily` that gets created when you create a new client — which you have to do *before* the copy-from-spouse action is even available. ## Cause `copy_from_spouse_lily` guards the target via `is_empty_project`, which still required `questionnaire_id.is_none()`. Since #63, every freshly-created client is stamped with a `questionnaire_id`/`questionnaire_version` at creation, so that boilerplate `.lily` was treated as non-empty and rejected. This is the backend twin of the frontend `isFreshWorkspace` regression fixed in #70. ## Fix Drop the `questionnaire_id` condition from `is_empty_project`. Emptiness is now determined solely by actual client data — variables, documents, contacts, bindings, questionnaire notes, and required documents. Added a regression test covering a fresh client stamped with only a questionnaire id/version. ## Verification `make test` (96 passed) and `make lint` both pass.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
parker/lily!71
No description provided.