Feat/v1.0 hardening#13
Merged
Merged
Conversation
Replace manual type assertions and array checks with a strict Zod schema that validates the entire backup structure before importing. Covers exercises, routines, workouts, bodyMeasurements, and optional settings/badges arrays. Includes 18 tests for the schema.
Install babel-plugin-transform-remove-console and configure it to run only in production builds. Console statements remain available during development and testing.
Add maxLength to every TextInput that was missing it: - Search inputs: 100 - Name inputs: already had 100 - Notes/descriptions: 500 (some already had it) - Numeric inputs (weight, reps, duration, distance, measurements): 10 - Rest time seconds: 5 Prevents unbounded input that could cause UI or storage issues.
Export now includes is_predefined for exercises, is_template and description for routines, group_id and group_type for routine_exercises and workout_sets, plus user_settings and badges tables. Version bumped to 2 in export output.
Import now handles is_predefined for exercises, is_template and description for routines, group_id and group_type for routine_exercises and workout_sets. Adds import of user_settings (INSERT OR REPLACE) and badges (INSERT OR IGNORE). Body measurement photo paths are preserved as references in body_photos table.
Schema accepts version 1 and 2 with all new fields optional for backward compat. Fix variable name collision in useBackup import flow.
Add 20 new tests covering: - Export of isPredefined, isTemplate, description, groupId, groupType - Export of settings and badges - Import with all v2 fields populated - Import defaults when v3 fields are absent (backward compat) - Settings import with INSERT OR REPLACE - Badges import with INSERT OR IGNORE - Body photos path import - Full v1 backward compatibility (no crash, safe defaults) - Complete v2 roundtrip with all fields Total: 46 tests (was 26).
…ge.json Both packages were installed in node_modules and lockfile but missing from package.json, causing frozen-lockfile CI failures.
Widen routineId and finishedAt types in makeValidBackup helper to accept null, matching the zod schema definition.
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.
No description provided.