Summary
Customer reactivation and invalid-phone filtering need canonical, data-preserving behavior.
Current behavior
main/routes/customers.ts:217-248 searches only canonical phone_digits, so raw legacy rows can be missed and duplicated.
- The soft-reactivation UPDATE does not write the canonical
phone field.
main/routes/customers.ts:48-54,112-114 uses an unparenthesized AND/OR invalid-phone predicate.
tests/customer-soft-reactivate-bindings.test.ts currently fails 5 assertions; its raw legacy fixture and contradictory country-code expectation also need correction.
Expected behavior
Equivalent customer records should reactivate without duplicate IDs, canonical phone fields should be updated consistently, and invalid-phone filters should apply exactly to the intended active rows.
Acceptance criteria
- Define lookup behavior for canonical and legacy national phone forms.
- Preserve the customer ID while updating phone, country code, name, email, address, notes, and active state atomically.
- Parenthesize and test the invalid-phone predicate for active/inactive valid/invalid combinations.
- Correct the regression fixture and add separate canonical and legacy cases.
Relevant files
main/routes/customers.ts, tests/customer-soft-reactivate-bindings.test.ts
Summary
Customer reactivation and invalid-phone filtering need canonical, data-preserving behavior.
Current behavior
main/routes/customers.ts:217-248searches only canonicalphone_digits, so raw legacy rows can be missed and duplicated.phonefield.main/routes/customers.ts:48-54,112-114uses an unparenthesizedAND/ORinvalid-phone predicate.tests/customer-soft-reactivate-bindings.test.tscurrently fails 5 assertions; its raw legacy fixture and contradictory country-code expectation also need correction.Expected behavior
Equivalent customer records should reactivate without duplicate IDs, canonical phone fields should be updated consistently, and invalid-phone filters should apply exactly to the intended active rows.
Acceptance criteria
Relevant files
main/routes/customers.ts,tests/customer-soft-reactivate-bindings.test.ts