Repository navigation
feat(shared-data): per-category rating criteria, weights and review form rules - #1548
Conversation
…orm rules Phase P1 of the #1531 design (D1, D5). rules/rating-criteria.ts holds version 1 of the criteria lists and weights for smartphones, tablets, laptops, smartwatches, earbuds and services, the weighted review star at 0.1, the D5 check on criterion stars (half steps, at most two skipped, value or price never) and the map from the five legacy form keys. rules/review-form.ts holds the D5 text rules: verdict length, one to five pros and cons, line length, evasive cons, duplicates and a line given as both. No database change; wiring the web form is P3. Closes #1542 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
If your organization's extra usage balance is empty, an organization admin can add extra usage credits at claude.ai/admin-settings/usage. If its monthly spend limit was reached, an admin can raise it on the same page. If neither applies, contact Anthropic support.
Once extra usage is available, someone with write access to this repository can comment @claude review on this pull request to trigger a review.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 46 minutes. View limit details
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. |
…review Two reviews of #1548. Prototype keys ("toString", "__proto__") no longer reach Object.prototype as a category or a rating; null is a skipped criterion; the weighted star counts any stored star from 1 to 5, so legacy 0.1-step stars are kept; hasRatingCriteria tells a known category from the phone fallback. The text rules count characters as the writer sees them (NFKC, no zero-width characters), reject lines with no words or one repeated character, keep diacritics when comparing lines, never throw on a malformed body, and catch more dodging cons ("không có ạ", "chả có gì", "không chê được gì", "mọi thứ đều ổn"). Refs #1542 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ritics Round 2 review of #1548. Stripping diacritics made "hỏng luôn", "không gập", "chưa có lời" and "mọi thứ đều ồn" read as dodges. Each dodge word now matches as typed with its own diacritics or with none, never with other ones. A pronoun may lead ("mình không thấy gì để chê"), and "không có ý kiến", "không có gì để nói", "rất tốt" count. A con longer than 150 characters is never a dodge, which keeps the check linear on an oversized request. Refs #1542 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Closes #1542
Phase P1 of the #1531 design (
Docs/Proposals/2026-10-31-criteria-stars-pros-cons.html, sections 2.1, 2.2, 4.1, 4.2). JOY approved decisions D1 and D5 on 2026-10-31.Change (
packages/shared-data/src/rules/)rating-criteria.tsRATING_CRITERIA_VERSION = 1.requiredflag. The required criterion is value for products and price for services.getRatingCriteria(slug): an unknown or missing category rates as a phone.weightedReviewStar(slug, ratings): the weighted average over the rated criteria, at 0.1. Unknown keys and bad stars are ignored; it returns null when nothing valid is rated.validateCriteriaRatings(slug, ratings)follows D5. It flags:mapLegacyCriteriaRatings(slug, legacy)maps the five legacy form keys (screen,performance,camera,battery,value) per category. For earbuds, screen becomes sound and camera becomes anc, matching the labels the product page uses today. A key with no counterpart is dropped, and nothing is inferred.review-form.tsholds the D5 text rules:@repo/shared-data/rules. They are browser-safe: they import only each other.Not in this PR
Notes
validateCriteriaRatingsasks of a new review. That check is for new writes only.RATING_CRITERIA_VERSION. The issue called itCRITERIA_VERSION.@repo/shared-data/rulesonly, which is the browser-safe entry, and not from the root.hasRatingCriteria(slug)lets an API refuse a category that has no list instead of rating it as a phone.Tests
packages/shared-datatest step 11 covers:npm testinpackages/shared-datapasses (tsc and the suite), and prettier is clean.Review
Codex is not available in this session, so two independent fresh-context reviews ran in its place, followed by a round-2 review.
🤖 Generated with Claude Code