fix: repair cross-package bugs so all tests and typecheck pass - #168
Open
stooit wants to merge 1 commit into
Open
fix: repair cross-package bugs so all tests and typecheck pass#168stooit wants to merge 1 commit into
stooit wants to merge 1 commit into
Conversation
- fix(web): update stale useThrottle import to useDebounce in api.ts - fix(a11y): apply aria-label to icon-only Button [WCAG 4.1.2] - fix(ui): resolve DataTable sort stale-closure via atomic sort state - fix(utils): format dates day-first, non-zero-padded for en-AU - chore(ts): reference bun-types so bun:test resolves under tsc --noEmit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes all failing tests and eliminates all
tsc --noEmiterrors in the monorepo. Bugs spanned three packages. Only source code was changed — no test files modified, no dependencies added.Result:
13 pass / 0 fail·npx tsc --noEmitclean (exit 0).Fixes
apps/web/src/lib/api.ts— stale import:useThrottlewas renamed touseDebounceinpackages/utilsbut the consumer still imported the old name (TS2305). Updated the import and theuseSearchDebouncere-export to useuseDebounce. Utils package left untouched as the source of truth.packages/ui/.../Button.tsx—aria-labelwas destructured but never applied to the<button>. Now passed through, giving icon-only buttons an accessible name (WCAG 4.1.2). A dev-onlyconsole.warnfires when aniconOnlybutton has no label (this is the expected warning visible in test output).packages/ui/.../DataTable.tsx— stale-closure sort bug caught by the controlled re-render test. Consolidated the two separateuseStates (key + dir) into one atomicSortState<T>updated via the functional updater form, so direction toggles correctly across re-renders and stays StrictMode-safe.packages/utils/.../date.ts—formatDatezero-padded the day. Switched toIntl.DateTimeFormat.formatToPartsto un-pad the day only, yielding day-first non-padded output (2024-03-01→1/03/2024) as the test expects.tsconfig.json— added"types": ["bun-types"]sobun:testresolves undertsc --noEmit(cleared 4 pre-existingTS2307errors).bun-typeswas already a devDependency.Assumptions
bun testinvocation in the task lacks the DOM preload; the repo's ownpackage.jsontest script uses--preload ./packages/ui/test/setup.ts, so verification was run with that (thedocument is not definederrors were a harness config artefact, not a source bug).formatDate's resultingD/MM/YYYYshape is what the tests assert, so it was preserved even though it's a hybrid of standard AU short-date conventions.Reviewer notes (out of scope, not fixed)
Flagged during review but beyond what the tests require: sortable
<th>headers are click-only (no keyboard handler — likely WCAG 2.1.1); the icon-only fallback label"Button"technically satisfies 4.1.2 but hides genuinely unlabelled controls from linters; the date formatter is now module-scoped (caches TZ at import). Left as-is to honour "fix only what the tests require."Test plan