Improve predicate test coverage and stabilize CoreData tests - #37
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #35.
Coverage
The coverage bot flagged a 1% overall drop, so the uncovered paths in the new predicate code were reviewed line by line:
PredicateValue.aggregateValuesaccessor — dead code from the traversal work, which the coverage report surfaced.<=and>comparisons,containsover a collection property,localizedStandardContains, and an@objcroot whose key paths resolve through Key-Value Coding (the path real CoreData usage takes, previously untested since the fixtures are plain structs).ALL/ANYmodifier applied to a plain attribute, and a key path whose leading key isn't a relationship.Line coverage:
FoundationPredicate.swift90.8% → 96.3%,Evaluate.swift95.9% → 97.5%, with every function in the conversion layer now executed.Test stabilization
While running the suite repeatedly,
CoreDataModelTests.modifierPredicateFetchwas found to fail intermittently (about 2 failures in 9 full-suite runs), with crashes such asNSArray element failed to match the Swift Array Element type. It passes 10/10 in isolation, so the trigger is parallel execution: four suites each build their ownNSPersistentStoreCoordinator/NSManagedObjectModeland ran concurrently.Those four suites are now
@Suite(.serialized). No failure appeared in 12 consecutive runs afterwards, though one failure did occur across 7 later coverage-instrumented runs — so this reduces the flakiness rather than provably eliminating it, since.serializedonly orders tests within a suite and the suites still run in parallel with each other. This is the same family of intermittent macOS crash CI has been reporting on recent PRs, and it is reproducible locally, so it is not a CI runner problem. Fully removing cross-suite CoreData parallelism would be the next step if it recurs.