Skip to content

Feat/v1.0 hardening#13

Merged
alvarotorresc merged 9 commits into
mainfrom
feat/v1.0-hardening
Mar 9, 2026
Merged

Feat/v1.0 hardening#13
alvarotorresc merged 9 commits into
mainfrom
feat/v1.0-hardening

Conversation

@alvarotorresc

Copy link
Copy Markdown
Owner

No description provided.

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).
@alvarotorresc alvarotorresc self-assigned this Mar 9, 2026
@alvarotorresc alvarotorresc added the bug Something isn't working label Mar 9, 2026
…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.
@alvarotorresc alvarotorresc merged commit 80b2735 into main Mar 9, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant