Skip to content

Conversation

@unadlib
Copy link
Owner

@unadlib unadlib commented Oct 7, 2025

@github-actions
Copy link

github-actions bot commented Oct 7, 2025

Coverage after merging apply-patches into main will be

100.00%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
index.ts100%100%100%100%
src
   apply.ts100%100%100%100%
   constant.ts100%100%100%100%
   create.ts100%100%100%100%
   current.ts100%100%100%100%
   draft.ts100%100%100%100%
   draftify.ts100%100%100%100%
   index.ts100%100%100%100%
   interface.ts100%100%100%100%
   internal.ts100%100%100%100%
   makeCreator.ts100%100%100%100%
   map.ts100%100%100%100%
   original.ts100%100%100%100%
   patch.ts100%100%100%100%
   rawReturn.ts100%100%100%100%
   set.ts100%100%100%100%
   unsafe.ts100%100%100%100%
src/utils
   cast.ts100%100%100%100%
   copy.ts99.30%98.41%100%100%15
   deepFreeze.ts96.64%93.10%100%100%67–68, 75, 84
   draft.ts100%100%100%100%
   finalize.ts100%100%100%100%
   forEach.ts100%100%100%100%
   index.ts100%100%100%100%
   mark.ts100%100%100%100%
   marker.ts100%100%100%100%
   proto.ts100%100%100%100%

@unadlib unadlib requested a review from Copilot October 7, 2025 17:19
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 fixes issues with applying patches when dealing with non-string keys in objects and maps, specifically handling object keys, symbol keys, and proper key coercion for intermediate paths.

  • Enhanced key handling logic to properly support symbol keys and object keys in patch paths
  • Added safety checks to prevent patching reserved attributes like __proto__ and constructor with non-string keys
  • Implemented proper key coercion for non-primitive keys when accessing object properties

Reviewed Changes

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

File Description
src/apply.ts Updated key handling logic to support symbols and properly coerce non-primitive keys
test/index.test.ts Added test cases for map with object keys, symbol keys on objects, and key coercion
test/immer-non-support.test.ts Added comprehensive test coverage comparing behavior between applyPatches and apply functions

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@unadlib unadlib requested a review from Copilot October 7, 2025 17:39
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.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@github-actions
Copy link

github-actions bot commented Oct 7, 2025

Coverage after merging apply-patches into main will be

100.00%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
index.ts100%100%100%100%
src
   apply.ts100%100%100%100%
   constant.ts100%100%100%100%
   create.ts100%100%100%100%
   current.ts100%100%100%100%
   draft.ts100%100%100%100%
   draftify.ts100%100%100%100%
   index.ts100%100%100%100%
   interface.ts100%100%100%100%
   internal.ts100%100%100%100%
   makeCreator.ts100%100%100%100%
   map.ts100%100%100%100%
   original.ts100%100%100%100%
   patch.ts100%100%100%100%
   rawReturn.ts100%100%100%100%
   set.ts100%100%100%100%
   unsafe.ts100%100%100%100%
src/utils
   cast.ts100%100%100%100%
   copy.ts99.30%98.41%100%100%15
   deepFreeze.ts96.64%93.10%100%100%67–68, 75, 84
   draft.ts100%100%100%100%
   finalize.ts100%100%100%100%
   forEach.ts100%100%100%100%
   index.ts100%100%100%100%
   mark.ts100%100%100%100%
   marker.ts100%100%100%100%
   proto.ts100%100%100%100%

@unadlib unadlib merged commit dd70a2b into main Oct 7, 2025
3 checks passed
@unadlib unadlib deleted the apply-patches branch October 7, 2025 17:52
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.

2 participants