Repository navigation
Conversation
Phase 1 - Critical bugs: - Add missing IDs to family, lists, and list item tool responses - Fix addDays timezone bug using T12:00:00 instead of T00:00:00 - Fix get_chores dateEnd to default relative to startDate, not today - Fix day-of-week calculation to use configured timezone via Intl Phase 2 - Security & dead code: - Remove token logging from auth.ts - Remove dead 304 handler from client.ts - Remove unused auth cache code (cachedAuth, getAuth, clearAuthCache) - Deduplicate BASE_URL (export from client.ts, import in auth.ts) - Read version from package.json instead of hardcoding "1.0.0" Phase 3 - Robustness: - Add 30s fetch timeout via AbortSignal.timeout - Add date/time parse validation (hour/minute ranges, month/day ranges) - Fix partial name matching to prioritize exact matches - Fix update_calendar_event to use JSON:API envelope format Phase 4 - Tool response quality: - Replace Object.entries raw dumps with selective human-readable formatting - Add missing assignee param to update_reward - Add missing mealCategoryId param to update_recipe - Show recipe info in get_meal_sittings output - Remove redundant ?? defaults after Zod .default() https://claude.ai/code/session_01HFK4pdBrGsWHs5YFyEv5SW
Phase 5 - Type safety & consistency: - Consolidate local types from meals/misc/photos into shared types.ts with typed attributes instead of bare [key: string]: unknown - Use AuthenticationError/SkylightError in auth.ts instead of plain Error - Fix config double-parse: server.ts now uses getConfig() for caching Phase 6 - Test coverage: - Add tests/config.test.ts (6 tests) for Zod validation and auth methods - Add tests/client.test.ts (10 tests) for URL building, auth headers, error handling, and 401 retry logic - Add date/time edge case tests: timezone params, 12:xx AM/PM, invalid values, getDateOffsetFrom, invalid YYYY-MM-DD - Add ParseError tests in errors.test.ts All 62 tests passing across 4 test files. https://claude.ai/code/session_01HFK4pdBrGsWHs5YFyEv5SW
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (25)
📝 WalkthroughWalkthroughThe PR implements a comprehensive code remediation across multiple areas: centralizes type definitions from endpoints into a shared types module, restructures API response handling with JSON:API compliant payloads, improves error handling with structured error types, adds request timeout handling, enhances date/time parsing with validation, and introduces extensive test coverage for client, config, dates, and error handling. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~30 minutes Possibly related issues
Possibly related PRs
Poem
✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
This PR addresses critical bugs in date/timezone handling, API response parsing, and tool output formatting. It also consolidates type definitions, improves error handling, and adds comprehensive test coverage for the client and config modules.
Key Changes
Critical Bug Fixes
addDays()to useT12:00:00instead ofT00:00:00to prevent date shifts in negative-offset timezonesidfields to family member categories, lists, and list items outputdateEndto be 7 days from providedstartDateinstead of from todayparseDate()to determine current weekday using configured timezone viaIntl.DateTimeFormatRobustness Improvements
AbortSignal.timeout()parseTime()andparseDate()findCategoryByName()andfindListByName()to prioritize exact matches before falling back to partial.includes()matchingupdateCalendarEvent()body in JSON:API envelope{ data: { type, id, attributes } }Code Quality & Security
client.tsand imported inauth.tspackage.jsonviacreateRequire()auth.tsto throwAuthenticationErrorandSkylightErrorinstead of plainErrorType Safety & Consolidation
src/api/types.tsgetMealSittings()now returns both sittings and included recipes for easier accessObject.entries()dumps with selective, human-readable formatting in calendar, rewards, meals, photos, and misc toolsmealCategoryIdinupdate_recipeandcategoryIdsinupdate_rewardTest Coverage
getDateOffsetFrom(), timezone-aware date parsing, and time validation edge casesParseErrorclassImplementation Details
getDateOffsetFrom()helper added to support relative date calculations from arbitrary datesparseDate()andgetDateOffset()for accurate day-of-week and date calculationsmeal_reciperelationship to avoid separate lookupshttps://claude.ai/code/session_01HFK4pdBrGsWHs5YFyEv5SW
Summary by CodeRabbit
New Features
Bug Fixes
Improvements