Skip to content

prevent reccursion in quoted drops#1919

Merged
simo6529 merged 1 commit intomainfrom
prevent-recursion-in-quoted-drops
Feb 10, 2026
Merged

prevent reccursion in quoted drops#1919
simo6529 merged 1 commit intomainfrom
prevent-recursion-in-quoted-drops

Conversation

@simo6529
Copy link
Copy Markdown
Collaborator

@simo6529 simo6529 commented Feb 10, 2026

Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced quote link embedding with depth limits and cycle detection to prevent infinite loops.
    • Improved quote path tracking through nested quotes.
  • Tests

    • Refactored test suites to verify proper prop propagation and quote path handling.

Signed-off-by: Simo <simo@6529.io>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 10, 2026

📝 Walkthrough

Walkthrough

Removes three wave drop interaction components and refactors the drop markdown rendering pipeline to thread embed depth, quote/embed path tracking, and cycle-prevention logic throughout link handlers and markdown renderers. Tests are updated to capture mocked component props for verification.

Changes

Cohort / File(s) Summary
Deleted Components
components/waves/drops/WaveDropFollowAuthor.tsx, components/waves/drops/WaveDropActionsQuote.tsx, components/waves/drops/WaveDropMobileMenuFollow.tsx
Removed three React components handling follow/unfollow, quote actions, and mobile follow UI. Total 382 lines deleted.
Deleted Test Files
__tests__/components/WaveDropFollowAuthor.test.tsx, __tests__/components/waves/drops/WaveDropActionsQuote.test.tsx, __tests__/components/waves/drops/WaveDropMobileMenuFollow.test.tsx
Removed test suites for the deleted components; 155 lines deleted across three files.
Test Refactoring
__tests__/components/drops/view/part/DropPartContent.test.tsx, __tests__/components/waves/drops/WaveDropPartContentMarkdown.test.tsx, __tests__/components/waves/drops/WaveDropQuote.test.tsx
Updated tests to capture and assert on mocked component props (markdownProps, quoteProps), verifying prop propagation of path/depth data.
Link Handler Test Enhancement
__tests__/components/drops/view/part/dropPartMarkdown/linkHandlersRegistry.test.tsx
Added test constants and three new test cases for embed depth overflow, cycle detection, and drop path matching fallback scenarios.
Drop Rendering Props Threading
components/drops/create/utils/storm/CreateDropStormViewPartQuote.tsx, components/drops/view/part/DropPart.tsx, components/drops/view/part/DropPartContent.tsx, components/drops/view/part/DropPartMarkdown.tsx
Introduced and threaded dropId and currentDropId props through the rendering chain; DropPartMarkdown now accepts embedPath, quotePath, embedDepth, maxEmbedDepth with memoization and normalization logic.
Quote Component Props Extension
components/waves/drops/WaveDropPartContentMarkdown.tsx, components/waves/drops/WaveDropQuote.tsx, components/waves/drops/WaveDropQuoteWithDropId.tsx, components/waves/drops/WaveDropQuoteWithSerialNo.tsx
Added optional embedPath, quotePath, embedDepth, maxEmbedDepth props to quote components; WaveDropQuote computes effectiveQuotePath via useMemo.
Link Renderer Configuration
components/drops/view/part/dropPartMarkdown/linkHandlers.tsx, components/drops/view/part/dropPartMarkdown/renderers.tsx
Exposed DEFAULT_MAX_EMBED_DEPTH constant; extended LinkRendererConfig and createLinkRenderer with embed context params; renderSeizeQuote now accepts SeizeQuoteRenderOptions.
Seize Handler Recursion Guards
components/drops/view/part/dropPartMarkdown/handlers/seize.tsx
Added embedPath, quotePath, embedDepth, maxEmbedDepth to CreateSeizeHandlersConfig; implemented max depth enforcement, cycle detection via quoteCycleKey, and self-embedding prevention logic in quote and drop handlers.
Memoization Update
components/drops/view/part/DropPartMarkdownWithPropLogger.tsx
Extended areEqual comparator to include embedPath, quotePath, embedDepth, maxEmbedDepth in memoization dependencies.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • #1605 — Modifies drop markdown link-handling and embedding plumbing to thread current drop context into link handlers.
  • #1874 — Modifies dropPartMarkdown link-rendering stack to thread additional rendering context (tweetPreviewMode) into createLinkRenderer.
  • #1618 — Modifies the same link-rendering stack to thread recursion/embedding context into renderer and related components.

Suggested reviewers

  • ragnep
  • prxt6529

Poem

🐰 A rabbit hops through paths so deep,
Now tracking cycles, guarding steep,
Embed depth counted, quotes contained,
No self-loops shall go unstained!
Clean components, guards in place,
This PR's a hoppy, tested space. 🎉

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'prevent reccursion in quoted drops' directly describes the main change: adding recursion prevention logic for quoted/embedded drops through depth tracking and cycle detection.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch prevent-recursion-in-quoted-drops

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
__tests__/components/drops/view/part/dropPartMarkdown/linkHandlersRegistry.test.tsx (1)

162-164: ⚠️ Potential issue | 🟡 Minor

Duplicate type declaration: EnsureStableSeizeLinkWithSetter is already defined at Lines 9–11.

This type alias is identical to the one at the top of the file. Remove the duplicate.

🧹 Proposed fix
-type EnsureStableSeizeLinkWithSetter = typeof ensureStableSeizeLink & {
-  __setCurrentHref?: ((href?: string) => void) | undefined;
-};
-
 const setEnsureCurrentHref = (href?: string) => {
🧹 Nitpick comments (1)
components/drops/view/part/dropPartMarkdown/handlers/seize.tsx (1)

62-68: quoteInfo.dropId check appears unreachable for quote links.

parseSeizeQuoteLink (in SeizeLinkParser.ts, Lines 148–151) returns null when the URL has a drop query parameter, so quoteInfo.dropId will always be undefined here. This guard will never trigger in the quote handler path.

This is harmless as defensive code, but it may give a false sense of coverage. If the intent is to guard against future changes to parseSeizeQuoteLink, consider adding a comment explaining that.

@simo6529 simo6529 merged commit 67be2f7 into main Feb 10, 2026
7 checks passed
@simo6529 simo6529 deleted the prevent-recursion-in-quoted-drops branch February 10, 2026 11:31
This was referenced Apr 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants