MR !1149

feat(ui): render insurance additional products generically on risk detail @navratilda · 2026-06-22

REQUEST CHANGES

Merge Request Info

Field Value
Title feat(ui): render insurance additional products generically on risk detail
Author @navratilda
Reviewers @blaskom
Branch feature/4287-ta -> main
Labels Backend, Frontend, Tests
Created 2026-06-22
Pipeline Passed (45736)
Conflicts No
State opened, ready
URL https://gitlab.allrisk.cz/core/core/-/merge_requests/1149

Summary

This MR adds generic rendering for insurance additional products on vehicle risk detail and scope-of-insurance views, including backend contract shape, generated clients, k6 coverage, FE mapping helpers, and Playwright coverage. The overall direction matches the requested product model, but the backend contract currently contains duplicate Institution members/assignments and needs to be fixed before merge.

Review Verdict

REQUEST CHANGES

The MR should not merge until the duplicate backend Institution property and object-initializer assignments are removed. There is also one FE lint/style cleanup from the local scanner.

Existing Review Threads

  • general (@coderabbitai): automated walkthrough/commentary only; no team-raised blocking thread observed in the discussions payload.

Changed Files Overview

File Change Type Lines +/- Risk
backend/src/Allrisk.Core.Contracts/Core/Contracts/InsuranceContract/AdditionalProducts/InsuranceAdditionalProduct.cs Modified +14 / -0 High
backend/src/Allrisk.Core.Contracts/Infrastructure/Services/AllriskContractDtoMapper/AllriskContractDtoMapper.AdditionalProducts.cs Modified +6 / -0 High
backend/src/Allrisk.Core.Contracts/Application/Commands/QaAutomation/**/VehicleInsurance.cs Modified +18 / -42 Medium
backend/tests/k6Tests/Allrisk.Core.Contracts/InsuranceSubjects/api-insurance-subject-test-methods.ts Modified +42 / -37 Medium
backend/tests/k6Tests/utils/codegen/gen/** Generated +11 / -0 Medium
frontend/apps/broker/src/features/insurance-scope/additional-products/** Added +359 / -0 Medium
frontend/apps/broker/src/features/insurance-scope/insurance-risk-content.tsx Modified +42 / -5 Medium
frontend/apps/broker/src/features/insurance-subjects/Vehicle/vehicle-insurance-subject-quick-overview.tsx Modified +48 / -59 Medium
frontend/apps/broker/src/features/insurance-subjects/insurance-subject-scope-of-insurance-card.tsx Modified +48 / -6 Medium
frontend/apps/broker/e2e/** Added/Modified +100 / -0 Medium
frontend/packages/api/src/client/** Generated +22 / -0 Medium
docs/specs/4287-ta/**, docs/specs/4662-home-service/README.md Added +464 / -0 Low

Critical Issues

Issue 1: Duplicate Institution member and duplicate object-initializer assignments break backend compilation

  • File: backend/src/Allrisk.Core.Contracts/Core/Contracts/InsuranceContract/AdditionalProducts/InsuranceAdditionalProduct.cs:28
  • Severity: Critical
  • Category: Correctness / Build
  • Description: InsuranceAdditionalProduct declares public Institution? Institution { get; set; } twice: once after CategoryName, then again after ProductCode. C# does not allow duplicate members with the same name/signature, so this file will not compile.
  • Suggestion: Keep one property with the intended semantics. If both upstream insurer and brokerage brand are required by the UI, introduce two explicitly named properties and regenerate FE/k6 clients.
// Current
public Institution? Institution { get; set; }
public string? ProductCode { get; set; }
public Institution? Institution { get; set; }

// Suggested, if one logo field is enough
public Institution? Institution { get; set; }
public string? ProductCode { get; set; }

Issue 2: The mapper assigns Institution twice in the same object initializer

  • File: backend/src/Allrisk.Core.Contracts/Infrastructure/Services/AllriskContractDtoMapper/AllriskContractDtoMapper.AdditionalProducts.cs:133
  • Severity: Critical
  • Category: Correctness / Build
  • Description: BuildAllriskStickerProduct() sets Institution = Institution.Allrisk twice, and BuildTechnicalAssistanceProduct() sets Institution = institution and then Institution = Institution.Allrisk. Even after fixing the duplicate property declaration, these duplicate initializers will still fail compilation and the two assignments encode conflicting semantics.
  • Suggestion: Decide whether this field represents the upstream insurer or the displayed brokerage brand, then assign it once. If both values are needed, model them as separate properties and update generated clients/tests.
// Current
Institution = institution,
ProductCode = null,
Institution = Institution.Allrisk,

// Suggested, if the field means upstream insurer
Institution = institution,
ProductCode = null,

Warnings

Issue 1: cn(...) uses the banned falsy-class pattern

// Current
<CardContent className={cn(data.length === 0 && 'py-8')}>

// Suggested
<CardContent className={cn({ 'py-8': data.length === 0 })}>

Suggestions

Positive Highlights

  • FE Kubb client regeneration is present with the backend contract change.
  • k6 generated schema/types are present; the scanner's generic "C# changed without k6 generated client" heuristic is not applicable here.
  • Mapping helpers have focused unit coverage, including locale fallback and visibility behavior.
  • The E2E coverage uses central helpers/test data and asserts seeded scope-product behavior.

Testing Assessment

Aspect Status
New tests added? Yes
k6 for new endpoints? N/A; k6 contract/generated coverage updated
Existing tests passing? Pipeline passed; local tests not run in this repair pass
Edge cases covered? Good
Test quality Good

Checklist

Backend

  • Core properties are uniquely named and compile
  • Mapper object initializers assign each property once
  • Reuses shared Core enums/types for institution and risk type
  • DateTimeOffset values normalized at ACL boundary

Frontend

  • Paraglide m imports used directly
  • Design-token colors used for new UI
  • @tabler/icons-react used for new icons
  • Generated API types used instead of hand-written HTTP types
  • No GritQL-banned class composition patterns

Testing

  • New unit tests added for mapping/rendering helpers
  • E2E uses central helpers/test data
  • E2E asserts real seeded values
  • k6 generated client/schema updated

Infra / cross-cutting

  • Generated FE Kubb client regenerated
  • k6 generated client regenerated