Fix stale codebase example in README.invariant.md#108
Conversation
#28 The "Good: Post-Validation Assertion" example cited lib/cloudinary/fetchCloudinaryImageMetadata.ts with a dimensions invariant that no longer exists. The file moved to io/cloudinary/ and the dimensions check was removed. Replace the stale example with the actual invariant present in that file: the publicId non-empty guard in generateResponsiveImageUrls. Update the section heading to "Pre-Condition Guard" to accurately describe the replacement. Also update the path in the "Bad" example from lib/cloudinary/ to io/cloudinary/ and clarify the parenthetical. Closes #28 https://claude.ai/code/session_01NX6Sqy1LRifn2ZbMjm4gcM
Code ReviewOverviewThis PR fixes stale documentation in Code Quality & Correctness
Minor ObservationThe comment in the "Good" snippet — // publicId has already been parsed from a validated Cloudinary URL— describes caller-side context that isn't visible in the snippet itself. A reader can't easily verify this from the example alone. That said, this is accurate (the function signature receives a Potential IssuesNone. This is a single-file documentation change with no runtime impact. Performance / SecurityN/A — documentation only. Test CoverageNo tests needed for a markdown documentation fix. SummaryClean, accurate, well-scoped fix. The PR description's validation steps match exactly what I verified in the code. LGTM. ✓ |
There was a problem hiding this comment.
Pull request overview
Updates the invariant() documentation examples so they reference current, findable code in the repository, resolving a stale example called out in issue #28.
Changes:
- Replaces the outdated “Good” example with an
invariant()call that exists inio/cloudinary/fetchCloudinaryImageMetadata.ts. - Renames the example heading to “Good: Pre-Condition Guard” to match the new example’s intent.
- Updates the “Bad” example’s file path from
lib/cloudinary/toio/cloudinary/.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| publicId, | ||
| }) | ||
| // io/cloudinary/fetchCloudinaryImageMetadata.ts | ||
| // publicId has already been parsed from a validated Cloudinary URL |
✅ What
io/cloudinary/fetchCloudinaryImageMetadata.tslib/cloudinary/path in the "Bad" example toio/cloudinary/🤔 Why
👩🔬 How to validate
utils/errors/README.invariant.mdand read the "Good: Pre-Condition Guard" example — expect the file path to beio/cloudinary/fetchCloudinaryImageMetadata.tsio/cloudinary/fetchCloudinaryImageMetadata.tsand search forpublicId.trim().length > 0— expect to find that exact invariant call ingenerateResponsiveImageUrls🔖 Related links
Closes #28
Generated by Claude Code