Skip to content

fix: repair cross-package monorepo bugs (all tests + types green) - #118

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2221-1786638157
Open

fix: repair cross-package monorepo bugs (all tests + types green)#118
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2221-1786638157

Conversation

@stooit

@stooit stooit commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all failing tests and eliminates all TypeScript errors in the monorepo.

  • Before: 8 pass / 5 fail, plus tsc errors
  • After:13 pass / 0 fail, ✅ tsc --noEmit clean (0 errors)

Bugs fixed

# Package Fix
1 apps/web api.ts imported a hook name that no longer exists in @e2e/utils. Corrected to import useDebounce and re-alias it as useSearchDebounce to preserve the app-local export name the test expects.
2 packages/ui Icon-only Button had no accessible name. Now applies aria-label (WCAG 2.2 AA — 4.1.2 Name, Role, Value), with a dev-mode console.warn fallback when a label is omitted.
3 packages/ui DataTable sort direction now read via a functional setState updater. (Defensive hardening — see note below.)
4 packages/utils formatDate produces a day-first, unpadded day (e.g. 1/03/2024) using Intl.formatToParts with explicit day-first assembly, so output stays correct even under locale fallback.
5 build tsconfig.json: added "types": ["bun-types"] so bun:test imports resolve, and added apps/*/test/**/* to include so api.test.ts is typechecked.

Constraints honoured

  • ✅ No test files modified (zero files under /test/ in the diff)
  • ✅ No new dependencies added (bun-types was already in devDependencies)
  • ✅ Minimal changes, each contained to the file owning the defect

Notes & assumptions

  • DataTable (bug fix: resolve 4 cross-package bugs causing test failures #3): the three DataTable tests already passed at baseline — the planted "stale closure" was not reproducible because handleSort is recreated each render. The functional-updater change is kept as the idiomatic, more-robust form, but it is a defensive refactor, not a behaviour fix.
  • tsconfig "types" override: disables auto-inclusion of other @types/* globals packages. Verified @types/react still resolves (reached via module resolution) and tsc stays clean.

Follow-ups (out of scope, not blocking)

  • Enforce aria-label on icon-only Button at the type level (discriminated union).
  • formatDate is host-timezone dependent (as was the original); consider pinning timeZone: "Australia/Sydney".
  • formatDate and formatDateTime render the same instant with different formats — worth unifying.

Verification

bun run test   → 13 pass / 0 fail
tsc --noEmit   → 0 errors

Fixes all failing tests (13/13 pass) and eliminates all tsc errors.

- fix(web): import renamed useDebounce hook from @e2e/utils
  (api.ts imported a hook name that no longer existed; re-aliased
  as useSearchDebounce to preserve the app-local export name)
- fix(utils): format AU dates with unpadded day via formatToParts
  (formatDate now yields day-first, unpadded day e.g. 1/03/2024)
- fix(a11y): give icon-only Button an accessible name via aria-label
  [WCAG 4.1.2] with a dev-mode warn when a label is omitted
- refactor(ui): read live sort direction via functional setState in
  DataTable (defensive hardening against stale-closure sorting)
- fix(build): register bun-types in tsconfig and include apps tests
  so bun:test imports resolve and api.test.ts is typechecked
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