Conversation
- implement paginate() utility (was a throwing stub) - fix case-sensitivity bug in auth public-methods allow-list (POST now public) - add missing badRequest import in users route (was ReferenceError -> now 400) - rename User.userName -> username in shared types to match API/test usage - configure tsconfig types/lib so bun:test and process globals resolve
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 9 failing tests and all TypeScript type errors in the monorepo.
bun testnow reports 22 pass / 0 fail andbunx tsc --noEmitexits cleanly (was 14 errors).Changes
packages/shared/src/utils/pagination.ts— implementedpaginate(), which was a stub that threwnot implemented. Slices the page, computestotal/totalPages, and returnspage/pageSize. Out-of-range pages yield an empty slice; an empty array yieldstotalPages: 0.packages/api/src/middleware/auth.ts— fixed a case-sensitivity bug: the public-methods allow-list contained"post"(lowercase), so realPOSTrequests never matched and were forced down the token path. Corrected to"POST"and normalised the comparison with.toUpperCase().packages/api/src/routes/users.ts— added the missingbadRequestimport from../lib/errors. Its absence caused aReferenceErrorat runtime instead of the expected 400 for missing fields.packages/shared/src/types.ts— renamedUser.userName→usernameto match API and test usage.db.tsusesOmit<User, …>so it followed automatically.tsconfig.json— added"types": ["bun-types"]and"lib": ["ES2022", "DOM"]so thebun:testmodule andprocessglobal resolve. No dependency was installed —bun-typeswas already present.Verification
Constraints honoured
package.jsonfiles unchanged).Reviewer notes (non-blocking, deliberately left out of scope)
A review pass flagged two follow-ups that fall outside "fix only what the tests require":
paginate()propagatesNaNfor non-numericpage/sizeinput. No production caller exists and no test covers it, so it was left as-is.bun-typesis declared aslatestwith no lockfile; pinning it would be a dependency change, which the task forbids.README.md's "Known issues" section still references the seeded bugs — left untouched as it appears to be test-harness scaffolding.Assumptions
userName→usernamedirection was chosen because the immutable test files and README both use/specifyusername; the shared type was the defect.types/libfix is a configuration issue (bun-types already installed), not a missing dependency.