Return a stable no-data strain target - #2015
Conversation
Preserve the explicit no-data state through tRPC so TanStack Query does not reject an omitted data field.
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
PR Summary by QodoReturn null for missing strain target to preserve no-data state
AI Description
Diagram
High-Level Assessment
Files changed (3)
|
📝 WalkthroughWalkthroughThe strain target endpoint now returns ChangesStrain target no-data handling
Estimated code review effort: 2 (Simple) | ~10 minutes Assessment against linked issues
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 1 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (1 passed)
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 |
|
Storybook previews for This comment updates automatically on each PR push. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/server/src/routers/recovery.ts`:
- Around line 606-608: Add a Zod schema named strainTargetResultSchema matching
StrainTargetResult near the existing schemas, then attach it to the strainTarget
cachedProtectedQuery with .output(strainTargetResultSchema.nullable()). Preserve
the nullable runtime contract so valid results or null are accepted and
malformed or undefined values are rejected.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: be47c6ac-177d-407b-849f-5362abf57358
📒 Files selected for processing (3)
packages/server/src/routers/recovery.test.tspackages/server/src/routers/recovery.tspackages/web/src/components/DailyOverview.tsx
Code Review by Qodo
Context used✅ Compliance rules (platform):
171 rules✅ Skills:
fix-provider, write-tests, cloudflare 1.
|
|
Review follow-up: I verified the optional null-cache note against the cache invalidation paths. |
|
🤖 Review skipped: Repository rate limit exceeded. Free accounts are limited to 2 reviews per 4 hours per repository. Upgrade to a paid plan for unlimited reviews. |
2 similar comments
|
🤖 Review skipped: Repository rate limit exceeded. Free accounts are limited to 2 reviews per 4 hours per repository. Upgrade to a paid plan for unlimited reviews. |
|
🤖 Review skipped: Repository rate limit exceeded. Free accounts are limited to 2 reviews per 4 hours per repository. Upgrade to a paid plan for unlimited reviews. |
Summary
nullwhen no strain target can be computedundefinedas a result with nodatafield, which TanStack Query rejectsCloses #1979
Validation
expected undefined to be nullpnpm exec vitest run packages/server/src/routers/recovery.test.ts --project unit(131 passed)pnpm exec tsc --noEmitpnpm --filter dofek-server exec tsc --noEmitpnpm --filter dofek-web exec tsc --noEmitpnpm --filter dofek-web buildpnpm lintpnpm test(836 files, 13,719 tests passed; 21 skipped)Summary by cubic
Return
nullfor missing strain targets and validate the response shape intRPC, ensuring a stable no‑data state and avoiding omitteddatafields (Linear #1979).Bug Fixes
recoveryRouter.strainTargetreturnsnullwhen no recovery summary exists and validates responses with.output(strainTargetResultSchema.nullable()).DailyOverviewacceptsStrainTargetResult | null; unit test updated to expectnull.Refactors
StrainTargetResultfromstrainTargetResultSchema(z.infer) to keep types and runtime validation in sync.Written for commit 745a223. Summary will update on new commits.
Summary by CodeRabbit
Bug Fixes
nullresult.Tests
nullresponse when no summary is available.