You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix testimonial headings, category links on community domain (#139)
* Fix testimonial heading collisions crashing generation job
Remove hard uniqueness constraint on heading (DB index + model validation)
to prevent crashes when AI generates duplicate headings. Instead, deduplicate
at display time — homepage selects one testimonial per unique heading via
GROUP BY subquery. Improve generation prompt: allow 1-3 word headings with
richer examples, raise temperature to 0.8, increase retries from 3 to 5,
and gracefully save on exhausted retries instead of crashing.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix homepage testimonials to show random selection per unique heading
The previous MIN(id) approach always picked the same testimonial per
heading. Use a window function with RANDOM() ordering so each page load
gets a truly random testimonial per unique heading, all in a single query.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Remove NOT NULL constraint from users.email column
GitHub users may not have a public email, causing failures when
syncing GitHub data. Allow email to be nullable.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: app/jobs/validate_testimonial_job.rb
+2-3Lines changed: 2 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -21,11 +21,10 @@ def perform(testimonial)
21
21
VALIDATION RULES:
22
22
1. First check the user's QUOTE against the content policy. If it violates (including being negative about Ruby), reject immediately with reject_reason "quote".
23
23
2. If the quote is fine, check the AI-generated fields (heading/subheading/body). ONLY reject generation if there is a CLEAR problem:
24
-
- The heading duplicates an existing one listed below
25
24
- The body contradicts or misrepresents the quote
26
25
- The subheading is nonsensical or unrelated
27
26
- The content is factually wrong about Ruby
28
-
Do NOT reject just because the fields could be "better" or "more creative". Good enough is good enough — publish it.
27
+
Do NOT reject for duplicate headings (handled elsewhere). Do NOT reject just because the fields could be "better" or "more creative". Good enough is good enough — publish it.
If the quote itself is fine but the generated text sounds like AI wrote it, set reject_reason to "generation" and explain which phrases sound artificial.
39
38
40
-
Existing published testimonials (avoid duplicate headings/themes):
39
+
Existing published testimonials (for context):
41
40
#{existing.presence || "None yet."}
42
41
43
42
Respond with valid JSON only: {"publish": true/false, "reject_reason": "quote" or "generation" or null, "feedback": "..."}
Copy file name to clipboardExpand all lines: test/models/testimonial_test.rb
+3-4Lines changed: 3 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -22,16 +22,15 @@ class TestimonialTest < ActiveSupport::TestCase
22
22
assert_includesduplicate.errors[:user_id],"has already been taken"
23
23
end
24
24
25
-
test"validates uniqueness of heading allowing nil"do
25
+
test"allows duplicate headings"do
26
26
existing=testimonials(:published)
27
27
other_user=users(:user_no_testimonial)
28
28
new_testimonial=Testimonial.new(
29
29
user: other_user,
30
-
quote: "My quote",
30
+
quote: "I love Ruby because it makes programming feel like poetry. The syntax reads so naturally that you can focus on solving problems instead of fighting the language. It truly is a joy.",
31
31
heading: existing.heading
32
32
)
33
-
assert_notnew_testimonial.valid?
34
-
assert_includesnew_testimonial.errors[:heading],"has already been taken"
0 commit comments