Skip to content

fix: repair cross-package bugs so bun test and tsc pass - #111

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2293-1786205477
Open

fix: repair cross-package bugs so bun test and tsc pass#111
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2293-1786205477

Conversation

@stooit

@stooit stooit commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Makes bun test && tsc --noEmit fully pass from the repo root (was 9 fail / 4 pass + 5 type errors → now 13 pass / 0 fail, tsc exit 0). Fixes four cross-package defects plus the test-runner config that was masking all of the UI failures.

Root causes & fixes

# File Bug Fix
1 apps/web/src/lib/api.ts Imported useThrottle, but the utils hook was renamed to useDebounce (broke the import and tsc) Import useDebounce; keep the public useSearchDebounce alias unchanged
2 packages/ui/src/components/Button/Button.tsx aria-label destructured but never applied to <button> Pass it through with a children-derived fallback for icon-only buttons + dev-time warning when an icon-only button has no label
3 packages/ui/src/components/DataTable/DataTable.tsx Sort toggle read captured sortDir (stale closure) Functional updater setSortDir((prev) => …)
4 packages/utils/src/format/date.ts en-AU numeric format emitted a leading zero on the day (01/03/2024) Assemble via formatToParts so the day has no leading zero (1/03/2024)
5 bunfig.toml (root) Used the non-Bun environment = "happy-dom" key — silently ignored, so document was undefined and every UI test errored preload = ["./packages/ui/test/setup.ts"] so bare bun test works
6 tsconfig.json bun:test unresolved Add "types": ["bun-types"] (already installed)

All six UI test failures shared a single root cause (no DOM from #5); once fixed, the functional-updater change (#3) is defensive hardening of the flagged stale-closure area.

Verification

bun test        → 13 pass, 0 fail (17 expect() calls, 5 files)
bunx tsc --noEmit → exit 0, zero type errors

Constraints honoured

  • No test files modified, no dependencies added (bun-types was already a devDependency).
  • Tests treated as source of truth for correct names/behaviour.
  • packages/ui/bunfig.toml left unchanged so per-package runs keep working.

Follow-ups (out of scope, non-blocking)

  • Icon-only Button a11y: fallback label satisfies the test but a generic "Button" conveys nothing to a screen reader; a required aria-label when iconOnly (discriminated union) would enforce it at compile time.
  • DataTable keyboard sorting: onClick on a bare <th> with no tabIndex/onKeyDown (WCAG 2.2 SC 2.1.1) — pre-existing.

🤖 Generated with QuantCode

Fixes four cross-package defects plus the tooling config that hid them:

- utils: consumers imported the old hook name useThrottle; the hook was
  renamed to useDebounce. Update apps/web api.ts import and the
  useSearchDebounce re-export alias.
- ui/Button: aria-label was destructured but never applied to <button>.
  Pass it through with a children-derived fallback for icon-only buttons
  and a dev-time warning when an icon-only button has no label.
- ui/DataTable: sort-direction toggle read captured state; switch to a
  functional updater to avoid the stale-closure bug.
- utils/date: en-AU numeric format emitted a leading zero on the day;
  assemble via formatToParts so day has no leading zero (1/03/2024).
- config: root bunfig.toml used the non-Bun `environment` key (silently
  ignored, so document was undefined); preload the happy-dom setup file
  instead. Add bun-types to tsconfig so `bun:test` resolves.

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