feat(balance): account form vehicle field + category rename via custom_label #207

Merged
maximus merged 1 commit from issue-203-account-form-vehicle-custom-label into main 2026-06-02 00:56:43 +00:00
Owner

Fixes #203

Issue 2 of overnight-2026-06-01-bilan-axe-vehicule — input UI on top of the merged #202 data layer.

What

  • AccountForm (account mode): optional vehicle_type dropdown — 6 fiscal envelopes (Non-enregistré/CELI/REER/FERR/CELIAPP/REEE) + None. Prefilled on edit, wired into create + update payloads. ⚠️ fiscal envelope, not an automobile.
  • AccountForm (category mode): custom_label text field, written to custom_label (never i18n_key); user-created categories anchor i18n_key on balance.category.<key>.
  • Category rename (AccountsPage): now writes custom_label, leaves i18n_key intact (fixes bug I). Blank answer clears the override.
  • Shared renderCategoryLabel helper (src/utils/) with two shape adapters (*FromCategory / *FromAccount) to bridge custom_label/i18n_key/key vs category_* — applied at all 5 sites: AccountsPage (list + rename preview), AccountForm, SnapshotEditor, BalanceAccountsTable, BalancePage.
  • Hidden deactivated seeds: useBalanceAccounts passes includeInactive: false (dropdown + management list). Kept listBalanceCategories default true to preserve #202 behavior-neutral tests.
  • BALANCE_VEHICLE_TYPES exported from shared/types as single source of truth; service reuses it.
  • i18n FR+EN: vehicleType.*, category.form.customLabel*, errors.vehicle_type_invalid.

Tests

  • npm run build: 0 type errors.
  • npm test: all green (canonical balance.service.test.ts 129 + new renderCategoryLabel.test.ts 8).
  • i18n parity: all 13 new keys present in both fr.json and en.json.

🤖 Generated with Claude Code

Fixes #203 Issue 2 of `overnight-2026-06-01-bilan-axe-vehicule` — input UI on top of the merged #202 data layer. ## What - **AccountForm (account mode):** optional `vehicle_type` dropdown — 6 fiscal envelopes (Non-enregistré/CELI/REER/FERR/CELIAPP/REEE) + None. Prefilled on edit, wired into create + update payloads. ⚠️ fiscal envelope, not an automobile. - **AccountForm (category mode):** `custom_label` text field, written to `custom_label` (never `i18n_key`); user-created categories anchor `i18n_key` on `balance.category.<key>`. - **Category rename (AccountsPage):** now writes `custom_label`, leaves `i18n_key` intact (**fixes bug I**). Blank answer clears the override. - **Shared `renderCategoryLabel` helper** (`src/utils/`) with two shape adapters (`*FromCategory` / `*FromAccount`) to bridge `custom_label`/`i18n_key`/`key` vs `category_*` — applied at all **5 sites**: AccountsPage (list + rename preview), AccountForm, SnapshotEditor, BalanceAccountsTable, BalancePage. - **Hidden deactivated seeds:** `useBalanceAccounts` passes `includeInactive: false` (dropdown + management list). Kept `listBalanceCategories` default `true` to preserve #202 behavior-neutral tests. - `BALANCE_VEHICLE_TYPES` exported from `shared/types` as single source of truth; service reuses it. - i18n FR+EN: `vehicleType.*`, `category.form.customLabel*`, `errors.vehicle_type_invalid`. ## Tests - `npm run build`: **0 type errors**. - `npm test`: **all green** (canonical `balance.service.test.ts` 129 + new `renderCategoryLabel.test.ts` 8). - i18n parity: all 13 new keys present in both fr.json and en.json. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
maximus added 1 commit 2026-06-02 00:50:59 +00:00
feat(balance): account form vehicle field + category rename via custom_label (#203)
All checks were successful
PR Check / rust (pull_request) Successful in 22m29s
PR Check / frontend (pull_request) Successful in 2m23s
344c27ee6d
- AccountForm: optional vehicle_type dropdown (account mode, 6 fiscal
  envelopes + none) wired into create/update; custom_label field (category
  mode) written to custom_label, never i18n_key.
- AccountsPage rename: writes custom_label, leaves i18n_key intact (fixes
  bug I where renaming clobbered the translation key).
- New shared renderCategoryLabel helper (+ shape adapters) applied at the 5
  sites: AccountsPage, AccountForm, SnapshotEditor, BalanceAccountsTable,
  BalancePage.
- Hide v13-deactivated seeds: useBalanceAccounts passes includeInactive=false
  (keeps #202 behavior-neutral default + tests green).
- BALANCE_VEHICLE_TYPES exported from shared/types as single source of truth
  (service reuses it).
- i18n FR+EN: vehicleType.*, category.form.customLabel*, errors.vehicle_type_invalid.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Author
Owner

Review — APPROVE

Revue indépendante (orchestrateur /sprint), diff vérifié sur la branche.

Vérifications

  • Helper renderCategoryLabel : core scalaire + 2 adaptateurs (FromCategory / FromAccount) → gère la divergence de shape (custom_label/i18n_key/key vs category_*). Appliqué aux 5 sites : AccountsPage (liste + cellule compte), AccountForm (dropdown), SnapshotEditor, BalanceAccountsTable, BalancePage. 8 tests unitaires (précédence + adaptateurs).
  • Pas de régression : l'ancien code utilisait déjà t(i18n_key, {defaultValue: key}) — le helper le préserve à l'identique et ajoute la précédence custom_label par-dessus. Les catégories user legacy s'affichent comme avant.
  • Renommage (AccountsPage:414) : écrit custom_label, ne touche plus i18n_key (corrige bug I). Annuler (null) = no-op ; réponse vide = efface l'override (retour à la traduction).
  • AccountForm : dropdown vehicle_type optionnel (""→null), préfill à l'édition, payload create+update ; BALANCE_VEHICLE_TYPES source unique partagée avec la validation service.
  • Filtre is_active : listBalanceCategories({includeInactive:false}) dans useBalanceAccounts → seeds tfsa/rrsp désactivés absents du dropdown ET de la gestion. Sûr (v13 a re-rattaché les comptes à other).
  • i18n parité 13/13 dans fr.json + en.json. npm run build ok, vitest vert.

Déviation acceptée : la création de catégorie écrit désormais custom_label + i18n_key=balance.category.<key> (au lieu de free-text dans i18n_key) — cohérent avec le renommage, étend le fix bug I à la création.

Verdict : APPROVE.

## Review — APPROVE ✅ Revue indépendante (orchestrateur `/sprint`), diff vérifié sur la branche. **Vérifications** - ✅ **Helper `renderCategoryLabel`** : core scalaire + 2 adaptateurs (`FromCategory` / `FromAccount`) → gère la divergence de shape (`custom_label`/`i18n_key`/`key` vs `category_*`). Appliqué aux **5 sites** : AccountsPage (liste + cellule compte), AccountForm (dropdown), SnapshotEditor, BalanceAccountsTable, BalancePage. 8 tests unitaires (précédence + adaptateurs). - ✅ **Pas de régression** : l'ancien code utilisait déjà `t(i18n_key, {defaultValue: key})` — le helper le préserve à l'identique et ajoute la précédence `custom_label` par-dessus. Les catégories user legacy s'affichent comme avant. - ✅ **Renommage** (AccountsPage:414) : écrit `custom_label`, ne touche plus `i18n_key` (corrige bug I). Annuler (`null`) = no-op ; réponse vide = efface l'override (retour à la traduction). - ✅ **AccountForm** : dropdown `vehicle_type` optionnel (`""`→null), préfill à l'édition, payload create+update ; `BALANCE_VEHICLE_TYPES` source unique partagée avec la validation service. - ✅ **Filtre is_active** : `listBalanceCategories({includeInactive:false})` dans `useBalanceAccounts` → seeds tfsa/rrsp désactivés absents du dropdown ET de la gestion. Sûr (v13 a re-rattaché les comptes à `other`). - ✅ **i18n parité 13/13** dans fr.json + en.json. `npm run build` ok, `vitest` vert. **Déviation acceptée** : la création de catégorie écrit désormais `custom_label` + `i18n_key=balance.category.<key>` (au lieu de free-text dans i18n_key) — cohérent avec le renommage, étend le fix bug I à la création. Verdict : **APPROVE**.
maximus merged commit 6cf0c8850e into main 2026-06-02 00:56:43 +00:00
maximus deleted branch issue-203-account-form-vehicle-custom-label 2026-06-02 00:56:44 +00:00
Sign in to join this conversation.
No reviewers
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: maximus/Simpl-Resultat#207
No description provided.