fix: prune model helpers by whole-identifier match, not substring#211
Merged
eseidel merged 1 commit intoJun 11, 2026
Merged
Conversation
## Summary Helper pruning used `body.contains(name)`, so a body calling `maybeParseDateTime` also matched `maybeParseDate` (same for `maybeParseUriTemplate` / `maybeParseUri`). The unused helper got written into `model_helpers.dart` with no caller, which reads as uncovered lines on the generated package. The `maybeParse*` helpers only show up for nullable fields, so any spec with a nullable date-time or uri-template field trips it. Hit it regenerating shorebird's `code_push_server`. ## Fix Match helper names as whole identifiers: `_referencedModelHelpers` tokenizes the body once and intersects with `ModelHelpers.all`, so the longer name no longer drags in the shorter. Both `SchemaUsage.fromBody` and `ApiUsage.fromBody` use it. No `gen_tests` fixture has a nullable date-time field, which is why this slipped through. Added unit and e2e coverage. ## Verification 547 tests pass, analyze and format clean. On the shorebird spec, `maybeParseDate` was emitted with zero call sites before and is gone after.
eseidel
approved these changes
Jun 11, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #211 +/- ##
=======================================
Coverage 94.64% 94.65%
=======================================
Files 21 21
Lines 5062 5066 +4
=======================================
+ Hits 4791 4795 +4
Misses 271 271 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Summary
Helper pruning used
body.contains(name), so a body callingmaybeParseDateTimealso matchedmaybeParseDate(same formaybeParseUriTemplate/maybeParseUri). The unused helper got written intomodel_helpers.dartwith no caller, which reads as uncovered lines on the generated package.The
maybeParse*helpers only show up for nullable fields, so any spec with a nullable date-time or uri-template field trips it. Hit it regenerating shorebird'scode_push_server.Fix
Match helper names as whole identifiers:
_referencedModelHelperstokenizes the body once and intersects withModelHelpers.all, so the longer name no longer drags in the shorter. BothSchemaUsage.fromBodyandApiUsage.fromBodyuse it.No
gen_testsfixture has a nullable date-time field, which is why this slipped through. Added unit and e2e coverage.Verification
547 tests pass, analyze and format clean. On the shorebird spec,
maybeParseDatewas emitted with zero call sites before and is gone after.