Skip to content

fix: implement missing utilities and correct edge-case bugs - #299

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2216-1787361395
Open

fix: implement missing utilities and correct edge-case bugs#299
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2216-1787361395

Conversation

@stooit

@stooit stooit commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all 16 failing tests across the utility library. 60 pass / 0 fail (was 44/16). No test files modified, no dependencies added.

  • calculator: divide throws on a zero divisor instead of returning Infinity.
  • string-utils: wordCount collapses consecutive whitespace; truncate implemented (word-boundary cut, ellipsis counts toward maxLength, never exceeds it).
  • task-manager: implemented remove, update (partial-safe), and sortBy (priority / status / createdAt).
  • date-utils: strip sign before rounding the relative day count so 36h → "2 days" and future/past buckets stay symmetric.
  • validator: isEmail accepts long alphabetic TLDs (.museum) and subdomains; isUrl accepts and range-validates ports (1–65535). Both remain bounded allowlists — reviewed clear of ReDoS and over-permissiveness.

Testing

  • bun test → 60 pass, 0 fail
  • bunx tsc --noEmit → clean

Review notes

A review pass caught a symmetry bug the tests didn't cover (future dates rounded down one bucket) and it was fixed. Validator changes were checked against seven backtracking-attack shapes with linear scaling.

Assumptions

  • Only src/ implementation files were changed; test semantics were treated as the source of truth.
  • The docs/ review-findings scratch file was intentionally left out of the commit.

- calculator: divide now throws on zero divisor instead of returning Infinity
- string-utils: wordCount collapses consecutive whitespace; implement truncate
  with word-boundary cut and ellipsis counted toward maxLength
- task-manager: implement remove, update (partial-safe), and sortBy
  (priority/status/createdAt)
- date-utils: strip sign before rounding relative day count so future/past
  buckets are symmetric (36h -> 2 days)
- validator: isEmail accepts long alphabetic TLDs and subdomains; isUrl accepts
  and range-validates ports; both remain bounded allowlists (no ReDoS)

All 60 tests pass. 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