Repository navigation
refactor(adapters): eliminate data-mapper layer - #107
Merged
Merged
Conversation
Remove data-mapper.ts (1,097 LOC) and inline all 54 mapper functions directly into SupabaseAdapter and TauriAdapter. Add adapter-utils.ts with a shallow camelizeKeys transform (snake_case -> camelCase keys) applied per-call before read-path mapping, removing the need for manual field renaming in each to* function. New entity flow: adapter + domain type (2 files, not 4+). Build clean, 2,290 tests passing.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Critical: mapExercise now reads raw['supports_1rm'] directly -- camelizeKeys regex /_([a-z])/g skips digit-adjacent underscores, so supports_1rm was never camelized and supports1RM silently evaluated to undefined on every Supabase exercise read. - parseJsonOrValue: add required column param + try/catch for context-rich errors - supabase-adapter: add try/catch to 15 mapper methods missing it; add console.error to mapProgram/mapBlock catch blocks; remove misleading pre-check console.warn in mapGym/mapGymMember; fix unsafe (err as Error).message cast at both gym catch sites; update all 6 parseJsonOrValue call sites - tauri-adapter: intToBool now requires field param and logs console.warn on null fallback (resolves TODO P14-021); revert 4 parseJsonOrValue call sites to local parseJson helper; standardize 16 console.warn prefix to [tauri-adapter] Review: Context/Reviews/0017-pr107-camelcase-conv-2026-04-12.md (P17-001 through P17-006, P17-011, P17-012)
All 8 [FIX] findings resolved. 4 [TASK] findings (test coverage gaps) added to Context/Backlog/Ideas.md as the P17 adapter test coverage entry. Review: Context/Reviews/0017-pr107-camelcase-conv-2026-04-12.md
This branch was successfully deployed
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
data-mapper.ts(1,097 LOC) and its test files (3,155 LOC) entirelysrc/lib/adapter-utils.tswith a shallowcamelizeKeysutility (snake_case → camelCase keys) andparseJsonOrValueSupabaseAdapterandTauriAdapter— read paths applycamelizeKeysper-call so inline helpers only handle Zod validation and null coercion, not field renamingNew entity authoring flow: adapter file + domain type (2 files, not 4+)
Net: -3,385 LOC across the adapter layer
Post-review fixes (7a7b9ec)
Resolved all 8 findings from the PR review (P17):
mapExercisenow readsraw['supports_1rm']directly —camelizeKeysregex skips digit-adjacent underscores, sosupports1RMwas silentlyundefinedon every Supabase exercise readparseJsonOrValuenow requirescolumnparam + try/catch; all 6 Supabase call sites updatedconsole.erroradded to all 15 mapper methods that lacked itintToBoolrequiresfieldparam, logsconsole.warnon null fallback (resolves TODO P14-021)parseJsonOrValuecall sites reverted to localparseJsonhelperconsole.warnremoved frommapGym/mapGymMemberconsole.warncalls standardized to[tauri-adapter]bracket format(err as Error).messagecast fixed in both gym catch blocksTest plan
bun run build— clean, 0 TypeScript errorsbun run test— 129 files, 2,290 tests, all passingreview-verifyPASS)parseJsonOrValue)