feat(notebooks): require feed tile summary when leading markdown is noisy#4761
feat(notebooks): require feed tile summary when leading markdown is noisy#4761leonardthethird wants to merge 1 commit into
Conversation
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdds detection of "noisy" notebook markdown previews (raw HTML or table-like rows) and a Zod cross-field validation that requires a non-empty ChangesFeed Tile Summary Validation for Formatted Content
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
🚀 Preview EnvironmentYour preview environment is ready!
Details
ℹ️ Preview Environment InfoIsolation:
Limitations:
Cleanup:
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 `@front_end/src/app/`(main)/questions/components/notebook_form.tsx:
- Around line 272-276: Remove the temporary debug console logging calls in the
notebook_form.tsx onValid handler (the console.log("[FEED_TILE_DEBUG] onValid ->
submitting", ...) lines and the similar debug log at 279-281); delete these
console statements so no console.debug/console.log remains in the onValid
submission path (keep all functional logic unchanged).
- Around line 93-101: Temporary diagnostic console logging inside the
superRefine validation (the console.log call logging "[FEED_TILE_DEBUG]
superRefine fired" and fields like data.markdown, summary, noisy, willAddIssue)
must be removed before merge; delete the console.log statement (or replace it
with a dev-only debug logger behind an environment/feature flag) so no markdown
snippets or internal validation state are emitted to production consoles.
🪄 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: CHILL
Plan: Pro
Run ID: 517260d1-a100-4dc3-8da1-60115213c737
📒 Files selected for processing (1)
front_end/src/app/(main)/questions/components/notebook_form.tsx
When the visible start of a notebook's body would render as raw HTML or table-like pipe noise on a feed tile, require feed_tile_summary so authors set a clean plain-text preview at creation time instead of discovering the broken tile after publish. Implementation: - Reuses the tile's own getMarkdownSummary helper to compute exactly what a reader sees, sized to the widest realistic tile (~900px / ~450 rendered chars). Anything past that point is past every tile size and doesn't trigger the rule, so a clean intro followed by a table past the visible area still submits cleanly. - Scans the rendered preview for two surviving-after-strip-markdown patterns: raw HTML tags (iframes, divs) and 3+ pipes on a line (table-like content MDXEditor didn't promote to a real table). Links, inline code, fenced code, images, emphasis, and lists all render correctly on the tile and are intentionally not flagged. - A 2000 source-char slice bounds remark parse cost on long notebooks. - Adds a zod superRefine on the notebook schema that attaches a ZodIssueCode.custom issue to feed_tile_summary; the existing Textarea + FormError pair already renders field errors as red inline text. - New i18n key feedTileSummaryRequiredForFormattedContent with the explainer copy. Server-side validation was skipped intentionally: this is a UX rule, not a data integrity rule, and NotebookWriteSerializer has no equivalent cross-field validation pattern. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
4ac3388 to
97e6620
Compare
Summary
Adds a conditional validation rule to the notebook create/edit form: if the first ~250 characters of the notebook's
markdowncontain formatting tokens that the feed tile cannot cleanly render as plain text,feed_tile_summarybecomes a required field, with a red inline explanation under the field telling the author why.Motivation
Notebook feed tiles fall back to
getMarkdownSummary(markdown, ...)whenfeed_tile_summaryis empty. That helper runsstrip-markdownwithkeep: ["link"], then walks tokens with a regex that preserves inline code as well. The result: notebooks whose openings include links, inline / fenced code, raw HTML, images, or tables render with visible syntax on feed cards (e.g.[click here](https://...), backticks,<iframe ...>). Authors then have to discover the Feed Tile Summary field on their own to clean it up after the fact.This shifts the discovery to creation time. The author is told, at submit, exactly why the summary is required and what to do.
Implementation
front_end/src/app/(main)/questions/components/notebook_form.tsxFEED_TILE_PREVIEW_CHAR_LIMIT = 250constant (conservative upper bound; actual tile budget is width/height-derived at render time).NOISY_MARKDOWN_PATTERNSlist of regexes: images, links, inline code, fenced code, HTML tags, table rows. Plain emphasis (**bold**,*italic*) is intentionally excluded since strip-markdown cleans those up on the tile.createNotebookSchemanow wraps itsz.object({...})in a.superRefine()that adds aZodIssueCode.customissue withpath: ["feed_tile_summary"]when the markdown preview is noisy and the summary is empty / whitespace-only. The existingTextareaalready renders field errors as red text viaFormError.front_end/messages/en.jsonfeedTileSummaryRequiredForFormattedContentwith the explainer text shown under the field.Server-side validation was intentionally skipped — this is a UX rule, not a data integrity rule, and the existing notebook write serializer has no equivalent cross-field validation pattern.
Test plan
[text](url)) — submit blocked, red explainer text appears under Feed Tile Summary.`foo`, fenced code block, raw<iframe>tag, image syntax, and a markdown table — each should trigger the requirement.🤖 Generated with Claude Code
Summary by CodeRabbit
Improvements
Localization