Skip to content

fix: repair cross-package bugs failing tests and typecheck - #133

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2215-1787414862
Open

fix: repair cross-package bugs failing tests and typecheck#133
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2215-1787414862

Conversation

@stooit

@stooit stooit commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all failing tests and type errors across the monorepo. bun run test now passes 13/13 and tsc --noEmit exits 0. Five production source files changed; no test files touched, no dependencies added.

Bugs fixed

Package File Bug Fix
apps/web src/lib/api.ts Imported useThrottle from @e2e/utils, but the hook was renamed to useDebounce — caused a runtime SyntaxError and TS2305 Import useDebounce; re-export as useSearchDebounce
packages/ui Button/Button.tsx Icon-only buttons rendered with no accessible name (WCAG 2.2 SC 4.1.2) Apply aria-label prop; dev-mode console.warn + "Unlabelled button" fallback when icon-only and no label given
packages/ui DataTable/DataTable.tsx Stale-closure sort toggle read sortDir captured at handler-creation time Use functional setSortDir(prev => ...)
packages/utils format/date.ts formatDate zero-padded the day (01/03/2024), failing the day-first assertion Use Intl.DateTimeFormat en-AU with formatToParts to strip the day's leading zero → 1/03/2024 (keeps 4-digit year, 2-digit month)
root tsconfig.json bun:test unresolved (TS2307 x4) because bun-types lives outside @types/* Add "types": ["bun-types"]

Verification

  • bun run test -> 13 pass / 0 fail
  • ./node_modules/.bin/tsc --noEmit -> exit 0

Assumptions & decisions

  • formatDate: the original code comment misdiagnosed the bug as MM/DD ordering; Intl ignores option declaration order and en-AU is already day-first. The real defect was zero-padding. Chose formatToParts over dateStyle: "short" to preserve a 4-digit year (short style silently truncated to 1/3/24), avoiding a public-API output regression.
  • Button aria-label: kept the runtime fallback rather than type-enforcing aria-label for iconOnly — the latter is a breaking API change and would require editing the test file, which is out of scope. Fallback is "Unlabelled button" (not "button") so genuinely unlabelled buttons stay greppable/detectable rather than masking the defect.
  • Fixed only what the tests/typecheck require; the DataTable functional-setState change is also a latent-bug hardening.

Out of scope (noted, not changed)

  • DataTable sortable <th> elements are mouse-only (no tabIndex/role/onKeyDown) — a pre-existing WCAG 2.2 SC 2.1.1 keyboard-access gap not covered by any test. Worth a separate follow-up.

- api.ts: import renamed hook useDebounce (was useThrottle) from @e2e/utils
- Button: apply aria-label on icon-only buttons with dev warning + fallback
- DataTable: use functional setSortDir to fix stale-closure sort toggle
- formatDate: emit day-first en-AU output with unpadded day, 4-digit year
- tsconfig: add bun-types to types so bun:test resolves
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant