update the spec doc with this decoder-contract change and run a quick ts-prune/dependency pass next.

This commit is contained in:
jableader 2025-10-21 19:23:26 +11:00
parent 94072019a0
commit e7bf843c98
3 changed files with 64 additions and 0 deletions

View file

@ -40,6 +40,12 @@ Status update (2025-10-21)
- Resolved typecheck errors after domain ref opt-in changes: updated ShoppingListItem.vue to remove person ref usage and guard optional ingredient access; TS + vue-tsc + tests pass. - Resolved typecheck errors after domain ref opt-in changes: updated ShoppingListItem.vue to remove person ref usage and guard optional ingredient access; TS + vue-tsc + tests pass.
- Verified end-to-end: lint PASS, typecheck PASS, vue-tsc PASS, tests PASS (no regressions). - Verified end-to-end: lint PASS, typecheck PASS, vue-tsc PASS, tests PASS (no regressions).
- Reduced nullability in public SDK APIs where safe: getRecipe/getMeal/markMealConsumed/getCurrentShoppingList now return non-null and throw on errors; updated call sites accordingly. - Reduced nullability in public SDK APIs where safe: getRecipe/getMeal/markMealConsumed/getCurrentShoppingList now return non-null and throw on errors; updated call sites accordingly.
- Domain decoders now return non-null and throw on invalid input (decodeRecipe/decodeMeal/decodeMealRecipe/decodeIngredient/decodeShoppingListItem/decodeShoppingList); list decoders return arrays.
- Lint/typecheck/vue-tsc/tests: all PASS after decoder contract tightening.
Latest analysis artifacts (2025-10-21)
- ts-prune (current): saved to ts-prune.current.txt; notable false-positives include dateformats.ago and units functions used inside SFCs.
- depcheck (current): saved to depcheck.current.json; flags core-js and several dev deps as unused. These are likely required by Vue CLI/babel/coverage tooling; defer removal pending deeper validation.
Scope Scope
- In: TS/Vue app code, tests, configs, scripts; Python utilities if present. - In: TS/Vue app code, tests, configs, scripts; Python utilities if present.
@ -70,6 +76,7 @@ Ordered checklist (actionable)
2) Dead code inventory 2) Dead code inventory
- [ ] ts-prune: list unused exports; verify via rg searches. - [ ] ts-prune: list unused exports; verify via rg searches.
- [x] Refreshed ts-prune; review and mark SFC-used exports to avoid accidental removals.
- [ ] Find unreferenced files: - [ ] Find unreferenced files:
rg -l "export default|export const|export function" | rg -l "export default|export const|export function" |
while read f; do rg -q "(from|import).*$f" -g "!$f" . || echo "$f"; done while read f; do rg -q "(from|import).*$f" -g "!$f" . || echo "$f"; done
@ -138,6 +145,7 @@ Acceptance
8) Dependency cleanup 8) Dependency cleanup
- [ ] Remove unused npm deps (depcheck) and scripts. - [ ] Remove unused npm deps (depcheck) and scripts.
- [x] Refreshed depcheck results saved; plan conservative removals only after confirming toolchain needs.
- [ ] Prefer stdlib/small helpers over heavy libs where equal. - [ ] Prefer stdlib/small helpers over heavy libs where equal.
- [ ] npm prune && clean install; verify build. - [ ] npm prune && clean install; verify build.
@ -189,6 +197,7 @@ Next actions (clear, actionable)
4) Shrink public API surface 4) Shrink public API surface
- [x] Use ts-prune results to remove unused exports in domain and sdk - [x] Use ts-prune results to remove unused exports in domain and sdk
- [ ] Second pass: validate remaining ts-prune hints against .vue usage; prune safely - [ ] Second pass: validate remaining ts-prune hints against .vue usage; prune safely
- [ ] Consider reducing parseRecipe nullability (throw on parse failures) if UI updated accordingly
5) Test suite consolidation 5) Test suite consolidation
- [x] De-duplicate tests with .js and .ts counterparts (e.g., prefer TypeScript) - [x] De-duplicate tests with .js and .ts counterparts (e.g., prefer TypeScript)
6) Dependency cleanup 6) Dependency cleanup

1
depcheck.current.json Normal file

File diff suppressed because one or more lines are too long

54
ts-prune.current.txt Normal file
View file

@ -0,0 +1,54 @@
src/dateformats.ts:6 - ago
src/units.ts:104 - getConversionFactor (used in module)
src/units.ts:130 - calculateTotals
src/units.ts:2 - UnitKey (used in module)
src/units.ts:4 - equivalentUnits (used in module)
src/units.ts:127 - Quantity (used in module)
src/units.ts:128 - Total (used in module)
src/api/sdk.ts:58 - mapPurchasedShoppingList (used in module)
src/api/sdk.ts:96 - mapCurrentShoppingList (used in module)
src/api/sdk.ts:140 - listRecipes
src/api/sdk.ts:153 - getRecipe
src/api/sdk.ts:161 - saveRecipe
src/api/sdk.ts:167 - deleteRecipe
src/api/sdk.ts:172 - parseRecipe
src/api/sdk.ts:178 - parseIngredients
src/api/sdk.ts:186 - parseProduct
src/api/sdk.ts:197 - listPersons (used in module)
src/api/sdk.ts:210 - getPersonsInHome
src/api/sdk.ts:214 - searchPersons
src/api/sdk.ts:219 - getUpcomingMeals
src/api/sdk.ts:231 - getMeal
src/api/sdk.ts:239 - saveMeal
src/api/sdk.ts:255 - markMealConsumed
src/api/sdk.ts:265 - deleteMeal
src/api/sdk.ts:303 - PurchaseExisting (used in module)
src/api/sdk.ts:304 - PurchaseRefs (used in module)
src/composables/useAlert.ts:27 - useAlert
src/composables/useAlert.ts:4 - AlertMessage (used in module)
src/composables/useAuth.ts:8 - loadUser (used in module)
src/composables/useAuth.ts:16 - login (used in module)
src/composables/useAuth.ts:21 - useAuth
src/composables/usePagination.ts:7 - usePagination
src/composables/usePagination.ts:4 - PageParams (used in module)
src/composables/usePagination.ts:5 - PageFetcher (used in module)
src/composables/useShopping.ts:8 - groupsToItems (used in module)
src/composables/useShopping.ts:12 - uniqueMeals (used in module)
src/composables/useShopping.ts:24 - itemsToGroups (used in module)
src/composables/useShopping.ts:54 - useShopping
src/composables/useShopping.ts:4 - GroupByProduct (used in module)
src/composables/useShopping.ts:5 - GroupByName (used in module)
src/composables/useShopping.ts:6 - Group (used in module)
src/domain/decoders.ts:54 - decodeMealRecipe (used in module)
src/domain/decoders.ts:73 - decodeShoppingListItem (used in module)
src/domain/decoders.ts:99 - toMealInput
src/domain/types.ts:4 - Replace (used in module)
src/domain/types.ts:5 - WithDates (used in module)
src/domain/types.ts:8 - Lookup (used in module)
src/domain/types.ts:10 - WithRefs (used in module)
src/domain/types.ts:18 - RecipeInput
src/domain/types.ts:20 - MealRecipeOut (used in module)
src/domain/types.ts:49 - ShoppingListWithRefs
src/router/helpers.ts:12 - parseRouteId
src/router/helpers.ts:24 - parseQueryString
src/router/index.ts:14 - createAppRouter