[STU-176] Fix CodeRabbit nitpicks — portalIcons typing and fragile index logic#39
Conversation
- portalIcons now derives keys from portalRoles union type instead of
loose Record<string, string>, so indexed access is type-checked
- Replace index === 1 PDF/Live check with explicit {label, status}
objects so reordering the array cannot silently break rendering
Tests: none (type-only change verified via npx tsc --noEmit)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Deployment failed with the following error: Learn More: https://vercel.com/khalid-proj?upgradeToPro=build-rate-limit |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
WalkthroughThe landing page improves type safety and clarity: ChangesLanding page role and status typing refinement
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
BAWES
left a comment
There was a problem hiding this comment.
Staff Engineer Review — APPROVE (comment-only, own PR)
Clean, targeted fix. Both changes improve correctness with minimal diff.
What's good
- portalIcons typing:
Record<(typeof portalRoles)[number], string>makes indexed access fully type-checked — no implicitundefinedonportalIcons[role]. Exactly the right fix. - Index logic: Replacing
index === 1 ? "PDF" : "Live"with explicit{label, status}objects eliminates a silent rendering bug waiting to happen if the array is ever reordered.
Merge order note
PR #41 (Tailwind redesign) touches the same sections of src/app/page.tsx. #39 should merge first — it's small (+10/-5) and uncontroversial. After #39 lands, #41 will need a rebase to carry forward the {label, status} pattern into the Tailwind version.
Verification
- CI: all green ✓
- Branch naming:
fix/STU-176-*✓ - Commit: conventional ✓
Summary
Record<string, string>toRecord<(typeof portalRoles)[number], string>so indexed access (portalIcons[role]) is fully type-checked — no implicitundefined.index === 1 ? "PDF" : "Live"with explicit{label, status}objects so reordering the array cannot silently break rendering.Verification
npx tsc --noEmitpasses with zero errorsNotes
maininstead.feature/STU-154-landing-ux-improvementsimplicitly got these fixes when merging main ahead; this PR applies them cleanly to main.🤖 Generated with Claude Code
Summary by CodeRabbit