fix(contacts): bind list Role column to contact_type, not title #230

Merged
nrupard merged 1 commit from fix/PMS-368-contact-role-column-rebind into main 2026-06-16 20:43:08 +02:00
Owner

Problem

The contact list "Role" column header did not match its cell data. The cell rendered each contact's free-text title (a job title like "IT Manager") under a header that reads Role, so the header and the data disagreed about which field the column shows (PMS-368, external Claude Chrome review #2 finding #11).

Fix

contact_type (Primary / Technical / Billing / Other) is the field that actually classifies a contact's role, and the server already serializes it on the contact response. Bind the column to contact_type and keep the existing "Role" header. This is scenario (b) from the issue: the header was correct, the binding had drifted.

Both contact lists are corrected because both decode the shared RemoteContact struct:

  • the main contacts list, and
  • the company-detail Contacts card.

Reuses the existing humanize_contact_type helper for the label. The now-unused title field is dropped from RemoteContact; the free-text title is still surfaced on the contact detail page, which decodes its own struct.

Scope

mokosh-apps only. No server change needed: the wire already carries contact_type (snake_case) on the Contact/ContactResponse shape. PMS-368 was filed against mokosh-server but the bug is entirely in the frontend.

Tests

  • New unit test contact_type_humanizes_canonical_set covering the canonical set plus pass-through of unknown/empty values.
  • cargo fmt --all --check, cargo clippy --target wasm32-unknown-unknown --lib -- -D warnings, and the lib test suite all pass.

Follow-up (AC #2, not in this PR)

The issue also asks for a sweep of other list pages (tickets, companies, projects, assets, invoices) for header/cell drift. Not done here; worth a separate pass.

#PMS-368

## Problem The contact list "Role" column header did not match its cell data. The cell rendered each contact's free-text `title` (a job title like "IT Manager") under a header that reads **Role**, so the header and the data disagreed about which field the column shows (PMS-368, external Claude Chrome review #2 finding #11). ## Fix `contact_type` (Primary / Technical / Billing / Other) is the field that actually classifies a contact's role, and the server already serializes it on the contact response. Bind the column to `contact_type` and keep the existing "Role" header. This is scenario (b) from the issue: the header was correct, the binding had drifted. Both contact lists are corrected because both decode the shared `RemoteContact` struct: - the main contacts list, and - the company-detail Contacts card. Reuses the existing `humanize_contact_type` helper for the label. The now-unused `title` field is dropped from `RemoteContact`; the free-text title is still surfaced on the contact detail page, which decodes its own struct. ## Scope mokosh-apps only. No server change needed: the wire already carries `contact_type` (snake_case) on the `Contact`/`ContactResponse` shape. PMS-368 was filed against mokosh-server but the bug is entirely in the frontend. ## Tests - New unit test `contact_type_humanizes_canonical_set` covering the canonical set plus pass-through of unknown/empty values. - `cargo fmt --all --check`, `cargo clippy --target wasm32-unknown-unknown --lib -- -D warnings`, and the lib test suite all pass. ## Follow-up (AC #2, not in this PR) The issue also asks for a sweep of other list pages (tickets, companies, projects, assets, invoices) for header/cell drift. Not done here; worth a separate pass. #PMS-368
fix(contacts): bind list Role column to contact_type, not title
All checks were successful
Check / clippy + fmt + tests (pull_request) Successful in 2m33s
Create release / Create release from merged PR (pull_request) Has been skipped
f54de819af
The contact list "Role" column header rendered each contact's free-text `title` (a job title like "IT Manager"), so the header and the data disagreed about which field the column shows. `contact_type` (Primary / Technical / Billing / Other) is the field that actually classifies a contact's role, and the server already serializes it on the contact response, so the fix is to bind the column to it and keep the existing "Role" header. Both contact lists are affected: the main contacts list and the company-detail Contacts card (both decode `RemoteContact`). Reuse the existing `humanize_contact_type` helper for the label. Drop the now-unused `title` field from `RemoteContact`; the free-text title is still shown on the contact detail page, which decodes its own struct.

#PMS-368

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
nrupard deleted branch fix/PMS-368-contact-role-column-rebind 2026-06-16 20:43:08 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
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
psa-systems/mokosh-apps!230
No description provided.