fix: Critical bugs - assets, goals, Mislaka crash (#37, #38, #39)#17
Merged
fix: Critical bugs - assets, goals, Mislaka crash (#37, #38, #39)#17
Conversation
Add defense-in-depth validation for AssetCategory in the service layer, returning 400 with clear error message for invalid values. Replace unsafe `as never` casts in the repository with proper Prisma enum types.
The frontend sends belongsToId when creating/updating goals to link them to a family member, but the field was missing from the Prisma schema and the repository never persisted it. Adds the column with FK to family_members, updates repository create/update to include the field, and removes the workaround that stripped it in the update path.
XLSX.read() throws unhandled exceptions on corrupted/invalid files, crashing the Express process. Wraps it in try-catch, validates the buffer is non-empty and has valid Excel magic bytes before parsing, and maps all parser errors to 400 BAD_REQUEST responses.
This was referenced Apr 15, 2026
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
Fixes 3 Critical bugs reported by Dror during MVP testing:
assetService.create(). Replaced unsafeas nevercasts with proper Prisma enum types.belongsToIdfield toFinancialGoalPrisma model with FK relation toFamilyMember. Updated repository, service, and model schema.XLSX.read()in try-catch, and routes parser errors to 400 instead of crashing the server.Closes codama-dev/clearplan-tickets#37
Closes codama-dev/clearplan-tickets#38
Closes codama-dev/clearplan-tickets#39
Test plan