Skip to content

fix: repair 4 cross-package bugs and resolve type errors - #112

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2299-1786291888
Open

fix: repair 4 cross-package bugs and resolve type errors#112
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2299-1786291888

Conversation

@stooit

@stooit stooit commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all failing tests and type errors in the monorepo. bun run test13 pass / 0 fail; bunx tsc --noEmit0 errors (also verified green under TZ=America/New_York). No test files modified, no dependencies added.

Bugs fixed

  • apps/web/src/lib/api.ts — renamed hook. The hook in packages/utils was renamed to useDebounce (correctly exported), but api.ts still imported the old useSearchDebounce/useThrottle names. Now imports useDebounce and re-exports it as useSearchDebounce (the name api.test.ts asserts). Verified useThrottle had no other consumers.
  • packages/ui/.../Button.tsx — accessibility (WCAG 4.1.2). Icon-only buttons now always expose an accessible name via aria-label. Explicit label used as-is; otherwise falls back to plain-string children, else a neutral "Button" label (deliberately not purpose-specific, to avoid mislabelling e.g. a delete button). Dev-only warning fires at most once per distinct label.
  • packages/ui/.../DataTable.tsx — sort toggle. Uses a functional setSortDir updater so ascending→descending toggling is correct across re-renders.
  • packages/utils/.../date.ts — en-AU formatting. formatDate now renders day-first with no leading zero on the day (1/03/2024, not 01/03/2024) via formatToParts, and pins timeZone: "Australia/Sydney" for deterministic output regardless of host TZ.

Supporting change

  • tsconfig.json — added "types": ["bun-types"] (already a devDependency) so bun:test resolves, and added apps/*/test/**/* to include so the web app's tests are type-checked. Eliminated the pre-existing Cannot find module 'bun:test' errors without editing any test file or adding a dependency.

Assumptions

  • The bun:test type errors were pre-existing config gaps; resolving them via tsconfig (not test-file edits) was treated as in-scope for "eliminate all type errors".
  • aria-label remains optional; discriminated-union enforcement would require changing a test's deliberately-unlabelled case, so it was left out of scope.

Verification

  • bun run test → 13 pass / 0 fail
  • bunx tsc --noEmit → exit 0
  • Re-ran tests under TZ=America/New_York → still green
  • Reviewed by the review subagent; the flagged blocker (misleading fallback label) was addressed.

- api.ts: import renamed hook useDebounce from @e2e/utils, re-export as useSearchDebounce
- Button: add accessible name for icon-only buttons (WCAG 4.1.2) with neutral fallback and once-per-label dev warning
- DataTable: use functional setState for sort-direction toggle
- date: format en-AU day-first without leading zero, pin timeZone for deterministic output
- tsconfig: reference bun-types and include apps test dir so all sources type-check
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