Skip to content

Improve predicate test coverage and stabilize CoreData tests - #37

Merged
colemancda merged 7 commits into
masterfrom
feature/predicate
Aug 16, 2026
Merged

Improve predicate test coverage and stabilize CoreData tests#37
colemancda merged 7 commits into
masterfrom
feature/predicate

Conversation

@colemancda

Copy link
Copy Markdown
Member

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:

  • Removed an unused PredicateValue.aggregateValues accessor — dead code from the traversal work, which the coverage report surfaced.
  • Added conversion tests for the paths that had no coverage: <= and > comparisons, contains over a collection property, localizedStandardContains, and an @objc root whose key paths resolve through Key-Value Coding (the path real CoreData usage takes, previously untested since the fixtures are plain structs).
  • Added evaluator tests for null relationships, an ALL/ANY modifier applied to a plain attribute, and a key path whose leading key isn't a relationship.

Line coverage: FoundationPredicate.swift 90.8% → 96.3%, Evaluate.swift 95.9% → 97.5%, with every function in the conversion layer now executed.

Test stabilization

While running the suite repeatedly, CoreDataModelTests.modifierPredicateFetch was found to fail intermittently (about 2 failures in 9 full-suite runs), with crashes such as NSArray 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 own NSPersistentStoreCoordinator/NSManagedObjectModel and 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 .serialized only 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.

@github-code-quality

Copy link
Copy Markdown

Code Coverage Overview

Languages: Swift

Swift / code-coverage/llvm-cov

The overall coverage in commit c34b014 in the feature/predicate branch is 95%. The coverage in commit 65503f5 in the master branch is 94%.

Show a code coverage summary of the most impacted files.
File master 65503f5 feature/predicate c34b014 +/-
Sources/CoreMod.../Evaluate.swift 95% 97% +2%
Sources/CoreMod...Predicate.swift 89% 94% +5%

@colemancda
colemancda merged commit 04ecd57 into master Aug 16, 2026
31 of 32 checks passed
@colemancda
colemancda deleted the feature/predicate branch August 16, 2026 16:25
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.

1 participant