Skip to content

Conversation

alexisintech
Copy link
Member

@alexisintech alexisintech commented Oct 16, 2025

Description

In this PR, the Simplify type was introduced to wrap the type for VerifyTokenOptions, causing the docs for the verifyToken() to change

Before that PR:

Screen.Recording.2025-10-16.at.14.52.55.mov

After that PR:

Screen.Recording.2025-10-16.at.14.59.10.mov

The function signature incorrectly had <code> in the codeblock.

This PR updates our typedoc theme to disallow the injection of a <code> in function signatures, as function signatures are already output into codeblocks.

Changes regarding this PR:

Screen.Recording.2025-10-16.at.14.51.33.mov

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Summary by CodeRabbit

  • Documentation
    • Enhanced the presentation of function signatures and type information in generated documentation with improved code formatting and consistent wrapping behavior for better readability.

Copy link

changeset-bot bot commented Oct 16, 2025

⚠️ No Changeset found

Latest commit: 9e0261a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Oct 16, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
clerk-js-sandbox Ready Ready Preview Comment Oct 16, 2025 6:54pm

Copy link
Contributor

coderabbitai bot commented Oct 16, 2025

Walkthrough

Introduces an internal flag to track rendering context within function signatures, conditionally suppressing code-block wrapping for types in those contexts. Adds a new reflectionType partial for consistent type output handling. Removes JSDoc documentation from the verifyToken function.

Changes

Cohort / File(s) Summary
TypeDoc Theme Rendering
.typedoc/custom-theme.mjs
Added _insideFunctionSignature flag to conditionally suppress code-block wrapping when rendering types within function signatures. Updated multiple partials (signatureTitle, declarationType, unionType, arrayType, functionType) to respect this flag. Introduced new reflectionType partial to normalize and conditionally wrap reflection type output.
Documentation Cleanup
packages/backend/src/tokens/verify.ts
Removed JSDoc block documentation from verifyToken function, including @paramExtension tag and environment-variable guidance. No runtime or type signature changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

The TypeDoc theme changes introduce a new context-tracking mechanism with modifications across multiple partials, requiring careful review of the conditional logic and its interactions. The documentation removal is trivial but involves two distinct files with different purposes.

Poem

🐰 With flags to guide the rendering way,
Code blocks wrap just right each day,
Inside signatures they hide with grace,
And stale docs fade without a trace.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly and accurately describes the primary change—updating the Typedoc theme to prevent <code> tags from being injected into function signatures—and matches the content and purpose of the pull request without extraneous detail.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ 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 aa/handle-simplify-types

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.

@alexisintech alexisintech changed the title chore(repo): Typedoc: Handle simplify types chore(repo): Typedoc: Handle <code> injection in function signatures Oct 16, 2025
@alexisintech alexisintech marked this pull request as ready for review October 16, 2025 19:02
@alexisintech alexisintech requested a review from NWylynko October 16, 2025 19:03
Copy link
Contributor

@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.

Actionable comments posted: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 160dc93 and 9e0261a.

📒 Files selected for processing (2)
  • .typedoc/custom-theme.mjs (5 hunks)
  • packages/backend/src/tokens/verify.ts (0 hunks)
💤 Files with no reviewable changes (1)
  • packages/backend/src/tokens/verify.ts

Comment on lines +146 to 155
this._insideFunctionSignature = true;
md.push(this.partials.signatureParameters(model.parameters || []));
this._insideFunctionSignature = false;

if (model.type) {
md.push(`: ${this.partials.someType(model.type)}`);
this._insideFunctionSignature = true;
const typeOutput = this.partials.someType(model.type);
this._insideFunctionSignature = false;
md.push(`: ${typeOutput}`);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Restore _insideFunctionSignature after nested calls

When superPartials.signatureParameters/someType recurse into other signature renderers (e.g., function types inside parameter or return types), our overridden signatureTitle runs again and unconditionally clears _insideFunctionSignature. Without restoring the previous state, the outer signature loses the guard and nested fragments fall back to <code>-wrapping—the bug we’re trying to prevent resurfaces for composed signatures (think callbacks or higher-order function returns). Capture the prior value and restore it after the call.

-        this._insideFunctionSignature = true;
-        md.push(this.partials.signatureParameters(model.parameters || []));
-        this._insideFunctionSignature = false;
+        const prevInsideParams = this._insideFunctionSignature;
+        this._insideFunctionSignature = true;
+        md.push(this.partials.signatureParameters(model.parameters || []));
+        this._insideFunctionSignature = prevInsideParams;
 
         if (model.type) {
-          this._insideFunctionSignature = true;
-          const typeOutput = this.partials.someType(model.type);
-          this._insideFunctionSignature = false;
+          const prevInsideType = this._insideFunctionSignature;
+          this._insideFunctionSignature = true;
+          const typeOutput = this.partials.someType(model.type);
+          this._insideFunctionSignature = prevInsideType;
           md.push(`: ${typeOutput}`);
         }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
this._insideFunctionSignature = true;
md.push(this.partials.signatureParameters(model.parameters || []));
this._insideFunctionSignature = false;
if (model.type) {
md.push(`: ${this.partials.someType(model.type)}`);
this._insideFunctionSignature = true;
const typeOutput = this.partials.someType(model.type);
this._insideFunctionSignature = false;
md.push(`: ${typeOutput}`);
}
const prevInsideParams = this._insideFunctionSignature;
this._insideFunctionSignature = true;
md.push(this.partials.signatureParameters(model.parameters || []));
this._insideFunctionSignature = prevInsideParams;
if (model.type) {
const prevInsideType = this._insideFunctionSignature;
this._insideFunctionSignature = true;
const typeOutput = this.partials.someType(model.type);
this._insideFunctionSignature = prevInsideType;
md.push(`: ${typeOutput}`);
}
🤖 Prompt for AI Agents
In .typedoc/custom-theme.mjs around lines 146 to 155, the code unconditionally
sets this._insideFunctionSignature = true before calling signatureParameters and
someType but does not restore the previous value, which breaks nesting when
those calls re-enter signature rendering; save the current value (e.g., const
prev = this._insideFunctionSignature), set it to true for the nested call, then
after the call restore this._insideFunctionSignature = prev — apply this pattern
to both the signatureParameters and someType calls so the original flag is
always restored even when nested renders occur.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants