Skip to content

fix(protect): handle undefined and null values in model interfaces - #144

Merged
calvinbrewer merged 2 commits into
mainfrom
bug/undefined-model-interface
Jun 2, 2025
Merged

fix(protect): handle undefined and null values in model interfaces#144
calvinbrewer merged 2 commits into
mainfrom
bug/undefined-model-interface

Conversation

@calvinbrewer

@calvinbrewer calvinbrewer commented Jun 2, 2025

Copy link
Copy Markdown
Contributor

Fixes an issue where the model interfaces don't handle undefined correctly. Now the model interfaces will handle both null and undefined values correctly

@calvinbrewer
calvinbrewer requested a review from Copilot June 2, 2025 17:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 extends model interface handling to cover undefined in addition to null, updating both single and bulk operations, and adds corresponding tests.

  • Expand nullFields type and logic to treat undefined as a first‐class case
  • Mirror changes in prepareBulkModelsForOperation
  • Add unit tests for encryption/decryption with undefined
  • Publish a changeset entry for the fix

Reviewed Changes

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

File Description
packages/protect/src/ffi/model-helpers.ts Allow nullFields to store undefined and adjust checks
packages/protect/tests/protect.test.ts New tests for single and bulk operations handling undefined
.changeset/thirty-otters-cough.md Document the fix for null/undefined handling (with typo)
Comments suppressed due to low confidence (1)

packages/protect/src/ffi/model-helpers.ts:131

  • [nitpick] The variable name nullFields now holds both null and undefined values, which may be misleading; consider renaming it to something like nullishFields to clarify its purpose.
nullFields: Record<string, null | undefined>

Comment thread .changeset/thirty-otters-cough.md Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@calvinbrewer
calvinbrewer merged commit fcb07b5 into main Jun 2, 2025
@calvinbrewer
calvinbrewer deleted the bug/undefined-model-interface branch June 2, 2025 22:45
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.

3 participants