Repository navigation
Fix indexed profile matching for broad source keys - #34
Merged
Merged
Conversation
✅ Deploy Preview for kitbag-mapper ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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.
Description
Fixes
mapandmapManyaccepting unrelated source/destination pairs when a registered profile has astringsource key. The index introduced in #32 can combine entries in that case, allowing'b' → 'y'when only'a' → 'y'is registered.The source and destination type helpers now check the requested source key after looking up the profile in the index. This rejects the invalid calls while keeping the indexed lookup and leaving runtime behavior unchanged. Regression tests cover both methods, valid broad keys, literal and union keys, and async results.
A synthetic benchmark using TypeScript 5.6.3, 160 profiles, and 960 mapping calls measured 1,648,393 type instantiations versus 1,646,407 for #32 (+0.12%). Median check time across three runs was 0.30s for both. These are local benchmark results, not measurements from the app used in #32.
npm run types,npm run lint,npx vitest run --typecheck(12 tests), andnpm run buildpass. The new invalid-pair assertions fail against #32. Also removes an extra blank line inprofile.tsthat caused lint to fail on the current base.