Skip to content

Conversation

@TobiTenno
Copy link
Member

@TobiTenno TobiTenno commented Nov 27, 2025

What did you fix?

restore insist

Reproduction steps


Evidence/screenshot/link to line

Considerations

  • Does this contain a new dependency? [No]
  • Does this introduce opinionated data formatting or manual data entry? [No]
  • Does this pr include updated data files in a separate commit that can be reverted for a clean code-only pr? [No]
  • Have I run the linter? [Yes]
  • Is is a bug fix, feature request, or enhancement? [Bug Fix]

Summary by CodeRabbit

  • New Features

    • Added a new object validation utility to enforce presence of required properties; now available via the utilities surface.
  • Tests

    • Added unit tests covering missing keys, falsy values, null/empty inputs, and successful validations.

✏️ Tip: You can customize this high-level summary in your review settings.

Copilot AI review requested due to automatic review settings November 27, 2025 19:15
@TobiTenno TobiTenno enabled auto-merge (squash) November 27, 2025 19:16
@coderabbitai
Copy link

coderabbitai bot commented Nov 27, 2025

Warning

Rate limit exceeded

@TobiTenno has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 10 minutes and 18 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 80180a9 and edf7c8d.

📒 Files selected for processing (2)
  • test/utilities/integrity.spec.ts (1 hunks)
  • tools/integrity.ts (1 hunks)

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Adds a new exported utility insist that validates presence of specified object keys, re-exports it from tools/utilities.ts, and adds unit tests covering missing and present keys including falsy values.

Changes

Cohort / File(s) Summary
New integrity utility
tools/integrity.ts
Adds exported insist(thing: Record<string, unknown>, ...args: string[]) which verifies thing is a non-empty object and that each provided key exists, throwing TypeError on failure.
Unit tests for insist
test/utilities/integrity.spec.ts
Adds tests asserting insist throws for missing object or missing keys and does not throw for present keys, including falsy values (0, false, '').
Public API re-export
tools/utilities.ts
Adds export * from './integrity'; to re-export the new utility from the utilities module.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Attention points:
    • Runtime guard for thing (null / non-object) and TypeScript signature.
    • Error messages thrown for missing properties.
    • Tests cover falsy values and the null-cast scenario.
    • Ensure re-export doesn't introduce naming collisions.

Suggested reviewers

  • SlayerOrnstein

Poem

🐇 I hop through code with eager paw,
I sniff each key and find the flaw,
"Insist!" I hum — no gap, no miss,
Falsy or true, I guard your keys with bliss,
A tiny rabbit keeps your bits in law.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: restore insist' directly matches the PR's objective to restore the insist utility function, clearly identifying the main change.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@github-actions
Copy link

github-actions bot commented Nov 27, 2025

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

SlayerOrnstein
SlayerOrnstein previously approved these changes Nov 27, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR restores the insist utility function, which validates that an object has required properties. The implementation includes a new integrity module with the function, tests, and an export from the main utilities file.

Key changes:

  • Adds insist() function for validating required object properties with TypeErrors
  • Includes basic test coverage for the function
  • Exports the integrity module from tools/utilities.ts

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
tools/integrity.ts New file implementing the insist() validation function
test/utilities/integrity.spec.ts Test file for the integrity module
tools/utilities.ts Adds export for the new integrity module

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
test/utilities/integrity.spec.ts (1)

1-9: Tests cover core behavior; consider re-export path + edge cases

The tests exercise the main behaviors of insist (empty object, missing key, all keys present), which is enough to validate the basic contract.

Two optional improvements you might consider:

  1. Import via the utilities entrypoint
    Since tools/utilities.ts now re-exports from ./integrity, you could import from ../../tools/utilities instead. That would also verify the public re-export path works as expected, not just the direct module.

  2. Add an explicit falsy-value case if needed
    Given the current implementation, a property with value 0, '', or false will cause insist to throw (because the check is truthiness-based). If you intend those to count as “present”, an extra test (e.g. insist({ a: 0 }, 'a')) would help lock in the desired semantics and drive any implementation tweak in tools/integrity.ts.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d384f3f and a440f3c.

📒 Files selected for processing (3)
  • test/utilities/integrity.spec.ts (1 hunks)
  • tools/integrity.ts (1 hunks)
  • tools/utilities.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
test/utilities/integrity.spec.ts (1)
tools/integrity.ts (1)
  • insist (6-16)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Upload results
🔇 Additional comments (1)
tools/utilities.ts (1)

3-5: Re-export of ./integrity aligns with existing utilities pattern

Adding export * from './integrity'; is consistent with this file’s role as an export aggregator and cleanly exposes insist through the central utilities entrypoint. Just be aware this expands the public API in line with timeDate and translation, which seems intentional for a “restore insist” bugfix.

Copilot AI review requested due to automatic review settings November 27, 2025 19:22
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
test/utilities/integrity.spec.ts (1)

6-17: Excellent test coverage! All past feedback addressed.

The test suite now comprehensively covers the edge cases that were previously missing:

  • Falsy but valid values (0, false, '')
  • null as the first argument
  • No required properties

All test assertions correctly validate the expected behavior of the insist function.

Optional: Consider adding a test for undefined values to make the coverage even more explicit:

+    (() => insist({ a: undefined }, 'a')).should.not.throw();

This would explicitly verify that keys with undefined values are treated as present (since the implementation uses the in operator which checks key existence, not value).

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0da1f62 and 80180a9.

📒 Files selected for processing (2)
  • test/utilities/integrity.spec.ts (1 hunks)
  • tools/integrity.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • tools/integrity.ts
🧰 Additional context used
🧬 Code graph analysis (1)
test/utilities/integrity.spec.ts (1)
tools/integrity.ts (1)
  • insist (6-16)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Upload results
  • GitHub Check: Summary
🔇 Additional comments (1)
test/utilities/integrity.spec.ts (1)

1-4: LGTM! Past review feedback addressed.

The should() initialization has been correctly added as suggested in the previous review.

Copilot AI review requested due to automatic review settings November 27, 2025 19:35
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@TobiTenno TobiTenno merged commit a6933dc into master Nov 27, 2025
17 checks passed
@TobiTenno TobiTenno deleted the redo-insist branch November 27, 2025 19:38
@wfcd-bot-boi
Copy link
Contributor

🎉 This PR is included in version 3.1.12 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants