Repository navigation
fix(platform): keep invalid phone characters and block the contact save - #4402
Conversation
The shared contact fields stripped every character outside digits and phone punctuation inside the phone input's onChange, then set a manual error. The form's schema validated the cleaned value, so Save passed: typing `00kkkk` saved `00`, `+41abc` saved `+41`, and the only explanation vanished on submit. Keep what the person typed and only name the forbidden character as it is typed. The shared schema already refuses those characters, so the submit validation now fails on the raw value, the error stays under the field, focus returns to it and neither dialog calls its mutation until the letters are removed. The live check is a non-global regex, so `test` cannot resume from a previous match. The Contacts guide now states the phone rule in EN, DE and FR, and the manual automation register names the dialog tests that own it. Closes #3825 Closes #3824 Closes #3826
|
Independent exact-head review for TALE-932 / TALE-257 / TALE-359 Head: Verdict: PASS for the change; CI pending (incident
Verification, existing dependencies only:
CI snapshot remains queued/in progress; no CI rerun, push, merge or status change performed. Posting fallback: |
|
Branch updated for one fresh CI round on current main (TALE-257)
I did not push, rerun, cancel or merge anything. |
|
Merge-lane coverage dispositions at
Merge-gate dry run at 01:51:18Z: open, CLEAN, head matches; no required contexts. checks total=78 not-completed=0 failing=0 [neutral=1 skipped=25 success=52] neutral=[Trivy[github-advanced-security]] statuses=[pending total=0]. Every skip is on the by-design allowlist |
What changed
The shared contact fields (
ContactFormFields, used by both New contact and Edit contact) stripped every character outside digits and phone punctuation inside the phone input'sonChange, then set a manual error. The form's Zod schema then validated the already-cleaned value, so submit validation passed and the manual error disappeared: typing00kkkksaved00, and+41abcsaved+41.contact-form-fields.tsx: the field keeps what the person typed. The live check only names a forbidden character as it is typed (samecommon.validation.phonemessage as before, so no new copy). The shared schema already refuses those characters (CONTACT_PHONE_PATTERN), so on Save the raw value fails validation: the error stays under the field,aria-invalidstays set, focus returns to the field and neither dialog calls its mutation until the characters are removed. The check is now a non-global regex (PHONE_FORBIDDEN_CHARACTER), sotestcannot resume from a previous match.docs/{en,de,fr}/platform/knowledge/structured-data.mdnow states the phone rule.services/platform/tests/manual/reference/automation.md: a row beside the contact details dialog row names the two dialog test files that own this.How I verified it
contact-edit-dialog.test.tsx+contact-create-dialog.test.tsx(jsdom, one worker): 34/34 pass. New or changed tests:00kkkkto stay in the field, with the message andaria-invalid;00kkkkand+41abc, then Save: focus returns to the field, the value is unchanged, the alert keeps the message, and there is no mutation call, no toast and no close;00;+41 79 123 45 67,+1 (555) 010-0100and079.123.45.67save unchanged;+41abckeeps its value, shows the message and creates nothing.contact-view-dialog,contact-row-actions,contacts-crud,conversations/contact-recipient-picker): 35/35 pass.contact-form-fields.tsxunder the new tests): 5 failed and 29 passed. Every new letter test fails (value00, or the submit passed so focus never returned). The 3 valid-format controls pass on both bases.00kkkk/+41abcthen Save calls the mutation withphone: '00'/'+41', and no alert is left. On this branch the same probe finds no such call.oxlintandoxfmt --checkon the changed files: clean. Scopedtscover the changed files (2,693-file program): clean.bun run lint:manual,bun run lint:conflictsand commitlint: clean.docs,locale-outline,locale-components,locale-translationandlinks: 29/29.locale-componentsfirst hit vitest's 5 s timeout under host load, then passed alone in 2 s.git merge-tree) against all open PR heads: no new conflicts. Theautomation.mdconflict counts are the same against this head as against main, no open PR touches the contacts files, and fix(platform): show failed contact, product and website list reads #4290 (same docs pages) merges cleanly.Not run locally (light phase): browser E2E and the backend stack.
Closes #3825
Closes #3824
Closes #3826