diegosouzapw
|
4e58a86cf8
|
fix(batch): round-2 polish — TS2305 unmask, a11y dialog, BOM stripping, 24h window, Provider column, race guard, banner toast, i18n cleanup
13 fixes from independent round-2 code review:
- B-1: Fix FileRecord wrong import in batch-utils.ts (TS2305 masked by limited typecheck-core scope); include batch-utils.ts + 5 lib/batches/* in tsconfig.typecheck-core.json so future regressions are caught
- A-2: role="dialog" + aria-modal + aria-labelledby on NewBatchWizard + BatchDetailModal panels (a11y consistency with UploadFileModal)
- A-3: "Janela de conclusão de 24h" line in CostEstimateStep (spec §5 explicit)
- A-7: "campos obrigatórios válidos" appended to JsonlValidationStep success summary (spec §5)
- A-9 + B-7: 18 hardcoded UI strings → i18n keys (Size, Refresh/Refreshing, Remove, Uploading, Reading file, Ready, Large file warning, JSONL generated, etc.)
- B-4: Strip UTF-8 BOM in validateJsonl + csvToJsonl (Windows-saved files no longer fail "invalid JSON" cryptically)
- B-5: Remove dead exports WizardStep + BatchProviderConfig from types.ts
- A-1: Add Provider column with derived heuristic (gpt-/o1-/o3-/text-embedding-/dall-e- → OpenAI; claude- → Anthropic; gemini → Gemini; else "—") in BatchListTab (BatchRecord has no provider field, so derivation is display-only)
- A-5: Enter key advances wizard step via data-wizard-next button trigger (skip when focus in INPUT/TEXTAREA/SELECT)
- A-6: Auto-dismiss "Batch {id} criado" banner on /batch page after wizard completes; consumes onCreated id (was discarded as _id)
- B-2: Race guard in InputStep.processFile (early-return if isReading) + drop zone pointer-events-none while reading
- C-tests: 6 new regression tests covering body=[] Array.isArray guard, BOM stripping, alias-match pricing path, (partial) suffix on expired_with_failures, -50% inline badge on Cost column, Provider column derivation per family
Side fix: narrow Record<string,unknown> child navigation in csvToJsonl.ts:135 to silence TS2322 once file is in typecheck scope.
22 new i18n keys (filesListSizeColumn, batchListProviderColumn/Unknown/BatchCreated/Dismiss/Refreshing/Refresh, uploadFileModalRemove/Uploading, wizardInputReading/Ready/LargeFileLabel/CsvJsonlReady/LargeFileWarning, wizardCostWindow24h, wizardValidationFieldsOk) added in en.json + pt-BR.json and propagated to 40 locales via fill-missing-from-en.mjs.
|
2026-05-28 18:33:31 -03:00 |
|
diegosouzapw
|
5dd75be1b9
|
test(batch): add integration tests + sanitization asserts + coverage gap fillers (F9)
- Add tests/unit/batches-f9-helpers.test.ts (19 tests, top-level for c8 coverage gate)
covering uncovered branches: alias-match pricing, blank CSV rows, body.input/prompt paths,
non-object JSON lines, invalid Anthropic params, body-is-array validation
- Add tests/unit/dashboard/batch/concept-cards.test.tsx (16 tests)
covering BatchConceptCard + FilesConceptCard: render, toggle, localStorage hydration, sanitization
- Add tests/unit/dashboard/batch/list-regression.test.tsx (15 tests)
covering BatchListTab + FilesListTab: render N items, Remove-completed flow,
status/purpose filter, loading/empty states, sanitization
- Add tests/unit/dashboard/batch/sanitization.test.tsx (8 tests)
covering NewBatchWizard + UploadFileModal + useBatchActions: each error path
asserts zero stack-trace/path leakage into the UI (D14 / Hard Rule #12)
- Fix bug in validateJsonl.ts: body=array was not caught as invalid
(typeof array === "object" is true — add Array.isArray guard, 1-line fix)
Local src/lib/batches/ coverage: 100% stmts / 93.7% branches / 100% funcs / 100% lines.
Global coverage gate: 75.96% stmts / 71.97% branches / 75.52% funcs (all above 75/75/75/70).
|
2026-05-27 23:14:17 -03:00 |
|