Skip to content

Commit e419388

Browse files
James Blairclaude
andcommitted
DC-273: Fix dashboard error caused by empty card status from CBMS
CardStatusSchema Zod preprocess now maps empty strings to 'Unknown' instead of passing them through to fail enum validation. Added console.error logging for schema validation failures in apiFetch. Also suppressed verbose USWDS compile notifications via $theme-show-notifications: false in the SASS token generator. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 79fdc18 commit e419388

4 files changed

Lines changed: 12 additions & 1 deletion

File tree

packages/design-system/design/scripts/generate-sass-tokens.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,11 @@ function generateSettingsContent(state, variables, timestamp) {
265265
settingsLines.push(' $theme-alert-icon-size: 3,')
266266
settingsLines.push('')
267267

268+
// Suppress USWDS release notes printed on every compile
269+
settingsLines.push(' // Suppress verbose USWDS compile notifications')
270+
settingsLines.push(' $theme-show-notifications: false,')
271+
settingsLines.push('')
272+
268273
// Add utility settings - ensures utility classes override component styles
269274
settingsLines.push(' // Utility settings')
270275
settingsLines.push(' $utilities-use-important: true')

src/SEBT.Portal.Web/src/api/client.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ export async function apiFetch<T>(endpoint: string, options: ApiFetchOptions<T>
106106
if (schema && data !== undefined) {
107107
const result = schema.safeParse(data)
108108
if (!result.success) {
109+
console.error(`[apiFetch] Validation failed for ${endpoint}:`, result.error.issues)
110+
console.error(`[apiFetch] Raw response data:`, data)
109111
throw new ApiValidationError(
110112
`Response validation failed for ${endpoint}`,
111113
result.error.issues

src/SEBT.Portal.Web/src/features/household/api/schema.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ describe('CardStatusSchema', () => {
3434
it('passes through string values unchanged', () => {
3535
expect(CardStatusSchema.parse('Active')).toBe('Active')
3636
})
37+
38+
it('maps empty string to Unknown (CBMS returns "" for denied/pending children)', () => {
39+
expect(CardStatusSchema.parse('')).toBe('Unknown')
40+
})
3741
})
3842

3943
describe('ApplicationStatusSchema', () => {

src/SEBT.Portal.Web/src/features/household/api/schema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export const CardStatusSchema = z.preprocess(
6464
typeof val === 'number'
6565
? (CARD_STATUS_MAP[val as keyof typeof CARD_STATUS_MAP] ?? 'Unknown')
6666
: typeof val === 'string'
67-
? (CARD_STATUS_STRING_MAP[val.toUpperCase()] ?? val)
67+
? (CARD_STATUS_STRING_MAP[val.toUpperCase()] ?? (val || 'Unknown'))
6868
: val,
6969
z.enum([
7070
'Unknown',

0 commit comments

Comments
 (0)