Skip to content

fix: repair cross-package bugs so all tests and typecheck pass - #184

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2179-1790180462
Open

stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2179-1790180462

Conversation

@stooit

@stooit stooit commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all failing tests and type errors in the monorepo. Baseline was 8 pass / 5 fail with 5 tsc --noEmit errors; now 13 pass / 0 fail and tsc --noEmit is clean. The bugs spanned all three workspaces (packages/utils, packages/ui, apps/web).

Changes

  • packages/utils/src/format/date.ts — formatDate returned a zero-padded day (01/03/2024) because the en-AU CLDR data coerces day: "numeric" to 2-digit. Rewrote it to use Intl.DateTimeFormat(...).formatToParts() and strip the day pad, keeping the en-AU locale, day-first order, and a 4-digit year (1/03/2024). Corrected the misleading BUG: docblock.
  • packages/ui/src/components/Button/Button.tsx — aria-label was destructured but never applied to the <button> element (there is no {...rest} spread). Now forwarded to the element, with an icon-only fallback (explicit label → string children → "Button") and a dev-mode console.warn when an iconOnly button has no explicit label. Text buttons remain unaffected (attribute omitted when undefined). [WCAG 2.2 SC 4.1.2]
  • apps/web/src/lib/api.ts — the useThrottle hook was renamed to useDebounce in @e2e/utils (identical signature). Updated the import and the as useSearchDebounce re-export; removed the stale BUG: docblock.
  • tsconfig.json + bun-env.d.ts — bun:test didn't resolve under tsc. Added a scoped /// <reference types="bun-types" /> in a new root bun-env.d.ts (added to include) rather than a types allow-list, so automatic @types inclusion is preserved.

Verification

  • bun run test → 13 pass / 0 fail
  • ./node_modules/.bin/tsc --noEmit → exit 0, no errors

Assumptions / notes

  • DataTable was left untouched. The task flagged a possible stale-closure sort bug, but all three DataTable tests already pass — handleSort is recreated each render with the current sortDir and fireEvent.click flushes state between clicks via act(). No change was required; making one would have been speculative.
  • No test files were modified and no dependencies were added, per constraints.
  • Reviewed via the review agent (verdict: sound, no blockers). Non-blocking follow-ups noted for a future PR: the once-per-render Button dev-warn could be de-duped, and @testing-library/jest-dom matcher types are not currently wired into bun:test (unchanged from baseline — wiring them would require editing a test-setup file, which was out of scope here).

- utils: formatDate strips en-AU day pad via formatToParts (D/MM/YYYY, 4-digit year)
- ui: Button forwards aria-label to the element with an icon-only fallback + dev warn [WCAG 2.2 SC 4.1.2]
- web: api.ts imports useDebounce after upstream useThrottle rename
- tsconfig: scope bun-types via bun-env.d.ts so bun:test resolves without an @types allow-list

All 13 tests pass; tsc --noEmit is clean. No test files or dependencies changed.
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