UX fixes, delta review follow-ups: a contract's Email travels as text, end to end; no empty tel: link
Claude Fable 5.1, delta review of b99376e: APPROVED, two optional follow-ups, both taken. TestContractReleaseThroughRealAdmission now releases Name and Email and checks every field's kind in the signed payload is text (fails if releaseFields sends the field's own kind).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 files changed,
+13
−4
internal/fichas/read.go+1 −1internal/fichastest/contract_test.go+12 −3
CI passed — run details
CI log
=== vet === go vet ./... go vet -tags browser ./internal/fichastest/ === fmt === === test === go test ./... ? amadan.net/oficina/fichas/cmd/fichas [no test files] ok amadan.net/oficina/fichas/internal/fichas 1.935s ? amadan.net/oficina/fichas/internal/fichas/icons [no test files] ok amadan.net/oficina/fichas/internal/fichas/seal (cached) ok amadan.net/oficina/fichas/internal/fichastest 1.202s ? amadan.net/oficina/fichas/scripts/mockups [no test files] ? amadan.net/oficina/fichas/scripts/preview [no test files] ? amadan.net/oficina/fichas/scripts/writeestilo [no test files] === migration-check === go tool rastrillo migration check rastrillo migration check: models and migrations agree
diff --git a/internal/fichas/read.go b/internal/fichas/read.go| index 7ac16e6..f27f9af 100644 |
| --- a/internal/fichas/read.go |
| +++ b/internal/fichas/read.go |
| @@ -396,7 +396,7 @@ func (c CardView) DetailItems() []map[string]any { |
| href, v, external = safeHref(v), displayURL(v), true |
| case f.Def.Kind == KindEmail && looksLikeAnEmail(v): |
| href = "mailto:" + v // html/template allows mailto: and escapes it |
| - case f.Def.Kind == KindPhone && looksLikeAPhoneNumber(v): |
| + case f.Def.Kind == KindPhone && telDigits(v) != "" && looksLikeAPhoneNumber(v): |
| // html/template refuses tel: unless told it is safe. It is: only |
| // ASCII digits and a leading + survive telDigits. |
| href = template.URL("tel:" + telDigits(v)) |
diff --git a/internal/fichastest/contract_test.go b/internal/fichastest/contract_test.go| index c9103a8..f6d338a 100644 |
| --- a/internal/fichastest/contract_test.go |
| +++ b/internal/fichastest/contract_test.go |
| @@ -84,7 +84,7 @@ func TestContractReleaseThroughRealAdmission(t *testing.T) { |
| if w = req("GET", path, nil, cfg.Origin); w.Code != 200 || !strings.Contains(w.Body.String(), "Live-style customer") { |
| t.Fatalf("source picker %d %s", w.Code, w.Body) |
| } |
| - form := url.Values{"flow": {flow}, "card": {strconv.FormatInt(card.ID, 10)}, "revision": {strconv.FormatInt(card.Revision, 10)}, "field": {fichas.FieldName}} |
| + form := url.Values{"flow": {flow}, "card": {strconv.FormatInt(card.ID, 10)}, "revision": {strconv.FormatInt(card.Revision, 10)}, "field": {fichas.FieldName, fichas.FieldEmail}} |
| if w = req("POST", "/contracts/review", form, "https://evil.example.com"); w.Code != 403 { |
| t.Fatalf("CSRF %d", w.Code) |
| } |
| @@ -117,11 +117,20 @@ func TestContractReleaseThroughRealAdmission(t *testing.T) { |
| Purpose string `json:"purpose"` |
| Fields []struct { |
| Key string `json:"key"` |
| + Kind string `json:"kind"` |
| Value string `json:"value"` |
| } `json:"fields"` |
| } |
| - if json.Unmarshal(raw, &payload) != nil || payload.Purpose != "oficina.contract.self-sign.v1" || len(payload.Fields) != 1 || payload.Fields[0].Key != fichas.FieldName { |
| - t.Fatal("released unselected field") |
| + if json.Unmarshal(raw, &payload) != nil || payload.Purpose != "oficina.contract.self-sign.v1" || len(payload.Fields) != 2 || |
| + payload.Fields[0].Key != fichas.FieldName || payload.Fields[1].Key != fichas.FieldEmail { |
| + t.Fatalf("released other than the selected fields: %+v", payload.Fields) |
| + } |
| + // Docs knows text and date only: the Email field (its own kind since |
| + // 2026-11-12) travels as text, or Docs refuses it. |
| + for _, f := range payload.Fields { |
| + if f.Kind != "text" { |
| + t.Errorf("%s travels as %q; Docs accepts text", f.Key, f.Kind) |
| + } |
| } |
| if !strings.Contains(w.Header().Get("Content-Security-Policy"), "form-action 'self' "+cfg.ContractRelease.Destination) { |
| t.Fatal("browser would block outbound form") |