Skip to content

馃摝馃敡锛歛lign validators with runtime checks - #106

Merged
openinf-commit-queue[bot] merged 1 commit into
mainfrom
fix/validation-type-contracts
Oct 2, 2026
Merged

openinf-commit-queue[bot] merged 1 commit into
mainfrom
fix/validation-type-contracts

Conversation

@DerekNonGeneric

Copy link
Copy Markdown
Member

Several guards and helpers promised types their runtime checks did not prove.
That let strict TypeScript programs compile calls which then failed at runtime,
including unchecked array elements, equality matches, invalid dates, shallow
iterators, open-ended interfaces, and map() results.

This change:

  • leaves unchecked array and array-like elements as unknown;
  • makes shallow iterator and equality checks boolean validators;
  • adds branded valid-date and well-formed-string refinements;
  • restricts hasInterface to finite property interfaces and checks inherited
    validator declarations;
  • describes map()'s one-level flattening in its return type; and
  • adds strict compile-time and runtime regressions for every contract.

Fixes #99.

Stop guards from claiming element, iterator, equality, and refinement
types their runtime checks do not establish. Restrict interface guards
to finite property shapes and inspect inherited validator maps.

Describe map's one-level flattening and add runtime and compile tests.

Signed-off-by: Derek Lewis <DerekNonGeneric@inf.is>
Assisted-by: Codex:gpt-6-astra
Fixes: #99
@coderabbitai

coderabbitai Bot commented Oct 2, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

Next included review available in 57 minutes.

Check out review usage here.

View limit details

Limit details: You鈥檝e used all 4 included reviews currently available. Your 34 included PR review attempts over the past 7 days set your current allowance at 4 reviews per hour.

Learn how review limits work.

Review configuration:

鈿欙笍 Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Essentials

Run ID: 0a153f80-cad5-465b-8b79-16280abddb89

馃摜 Commits

Reviewing files that changed from the base of the PR and between 8177c45 and a64d68a.

馃搾 Files selected for processing (19)
  • .changeset/sound-validation-types.md
  • packages/assert/src/guards/is-deep-equal-to.ts
  • packages/assert/src/guards/is-equal-to.ts
  • packages/assert/src/guards/is-identical-to.ts
  • packages/assert/test/guards/equality-types.ts
  • packages/util-array/src/guards/is-array-like.ts
  • packages/util-array/src/helpers/map.ts
  • packages/util-array/test/guards/is-array-like.ts
  • packages/util-array/test/helpers/map.ts
  • packages/util-core/src/guards/has-interface.ts
  • packages/util-core/src/guards/is-array.ts
  • packages/util-core/test/guards/has-interface.ts
  • packages/util-core/test/guards/is-array.ts
  • packages/util-date/src/guards/is-valid-date.ts
  • packages/util-date/test/guards/is-valid-date.ts
  • packages/util-string/src/guards/is-well-formed-string.ts
  • packages/util-string/test/guards/is-well-formed-string.ts
  • packages/util-types/src/guards/is-iterator.ts
  • packages/util-types/test/guards/is-iterator.ts
  • Autopilot 路 Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Comment @coderabbitai help to get the list of available commands.

@DerekNonGeneric DerekNonGeneric added the 馃殌 Status: Commit Queue Land this pull request when its checks pass label Oct 2, 2026
@openinf-commit-queue
openinf-commit-queue Bot merged commit f9148e8 into main Oct 2, 2026
10 checks passed
@openinf-commit-queue openinf-commit-queue Bot removed the 馃殌 Status: Commit Queue Land this pull request when its checks pass label Oct 2, 2026
@openinf-commit-queue
openinf-commit-queue Bot deleted the fix/validation-type-contracts branch October 2, 2026 03:58

Copy link
Copy Markdown
Member Author

@coderabbitai full review

This merged while the review was rate-limited, so please review it now.


Generated by Claude Code

@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
鈿狅笍 Action not completed

Pull request is closed.

openinf-commit-queue Bot pushed a commit that referenced this pull request Oct 5, 2026
hasInterface skipped every "constructor" key in a validator map, so a
guard for { constructor: number } accepted {} on the strength of its
inherited Object constructor. Skip only a prototype's own back-reference
to its class, and validate a constructor the interface declares.

CodeRabbit raised this when it reviewed #106 after the merge.

Signed-off-by: Derek Lewis <DerekNonGeneric@inf.is>
Assisted-by: Claude-Code:claude-opus-5
PR-URL: #112
Refs: #106
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.

Validation and mapping types exceed their runtime guarantees

1 participant