Skip to content

fix: repair cross-package bugs so all tests and tsc pass - #102

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2282-1785516110
Open

fix: repair cross-package bugs so all tests and tsc pass#102
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2282-1785516110

Conversation

@stooit

@stooit stooit commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all failing tests and type errors across the monorepo. Bugs spanned all three packages plus test/build config. bun test13 pass / 0 fail; tsc --noEmitclean. No test files or dependencies were changed.

Fixes

Area Bug Fix
apps/web/src/lib/api.ts Imported useThrottle from @e2e/utils, which was renamed and no longer exported (TS2305) Import the compatible useDebounce export
packages/utils/src/format/date.ts formatDate emitted a leading-zero day (01/03/2024), failing the "day 1 not confused with month 1" assertion (/^1/) Use Intl parts so the day has no leading zero (1/03/2024)
packages/ui/.../Button.tsx Icon-only buttons had no accessible name; test expects an aria-label (WCAG 2.2 AA 4.1.2) Add aria-label fallback scoped to iconOnly so text buttons keep their visible label as the accessible name
packages/ui/.../DataTable.tsx Sort toggle read state directly in the handler Use functional setState to harden against React 18 auto-batching (defensive)
bunfig.toml Root config had no DOM preload, so component tests threw document is not defined Add happy-dom preload
tsconfig.json bun:test type declarations unresolved (TS2307) Add bun-types

Verification

  • bun test (from repo root): 13 pass / 0 fail
  • npx tsc --noEmit: exit 0, no errors
  • No changes to any test file; no new dependencies

Notes / assumptions

  • The actual cause of the component-test failures was the missing DOM preload in the root bunfig.toml (the packages/ui one already had it). The DataTable functional-setState change is defensive hardening and independently correct.
  • formatDate uses local time. This is TZ-sensitive at extreme offsets (> UTC+12) but correct for the test's fixtures and standard CI/AU environments.
  • Independently reviewed by the review subagent: all fixes confirmed as genuine root-cause fixes.

- api.ts: update stale import after hook rename (useThrottle -> useDebounce);
  useThrottle no longer exists in @e2e/utils, useDebounce is the compatible export
- date.ts: use Intl formatToParts to emit day without leading zero (1/03/2024)
- Button.tsx: add aria-label fallback for icon-only buttons (WCAG 4.1.2),
  scoped to iconOnly so text buttons keep their visible label as accessible name
- DataTable.tsx: use functional setState in sort toggle to harden against
  React 18 auto-batching (defensive; real test failure was the missing DOM env)
- bunfig.toml: add happy-dom preload so React component tests have a document
- tsconfig.json: add bun-types so bun:test declarations resolve
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