Skip to content

Conversation

beltradini
Copy link

This pull request adds a regression test and a code fix to ensure that duplicate outcome validation in the CareKit store works correctly when outcomes have newer versions. The test verifies that outcomes with a next version skip duplicate validation, and the code fix implements this logic in the validation method.

Testing improvements:

  • Added a new test case in TestOutcomeDuplicate.swift to verify that outcomes with a next version do not trigger duplicate validation, and that outcomes without a next version correctly throw an error when duplicates exist.

Bug fix:

  • Updated the validateForInsert() method in OCKCDOutcome.swift to skip duplicate validation if the outcome has a next version, preventing false positives when validating outcomes that are part of a version chain.

- Skip duplicate check in validateForInsert() if outcome has next version
- Add unit test for validation behavior
- Resolves carekit-apple#700
@gavirawson-apple
Copy link
Collaborator

Thanks @beltradini! I may be thinking about this wrong, but isn't it important we prevent a client from updating an old version of an outcome? It's been some time since I've toyed with the versioning system here, but I believe a client should only be able to update the latest version of an object to ensure the version chain remains accurate. If you have a specific situation in mind where a client needs to update an old version of an outcome that might clear this up for me.

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