--- id: TASK-36 title: Remove optional helper undefined args status: In Progress assignee: [] created_date: '2026-06-06 21:15' updated_date: '2026-06-06 21:23' labels: [] dependencies: [] priority: high ordinal: 38000 --- ## Description Fix remaining spec-review issues in auditGenerationAction by avoiding explicit undefined auditId and nested usage fields in helper call arguments. ## Acceptance Criteria - [x] #1 persistAuditStage callsites include auditId only by conditional spread - [x] #2 recordOpenRouterUsage/recordAuditUsageEvent/capture helper callsites include optional auditId only by conditional spread - [x] #3 stage usage helper args are built without explicit undefined token fields ## Implementation Plan 1. Inspect auditId and usage helper callsites 2. Add RED source contracts for optional auditId and nested usage args 3. Run focused test and record RED 4. Implement minimal conditional spreads and usage arg helper 5. Run focused tests green and full pnpm test if fast 6. Self-review scope and leave task In Progress ## Implementation Notes RED: tsc passed. Focused node --test .test-output/tests/audit-generation-action-source.test.js failed as expected on persistAuditStage auditId callsites, helper auditId callsites, and inline nested usage objects. GREEN: pnpm exec tsc -p tsconfig.test.json passed. Focused node --test .test-output/tests/audit-generation-action-source.test.js passed 24/24. Full pnpm test passed 356/356. Implemented conditional auditId spreads at persist/helper callsites and stage usage builder for callsite usage objects.