-
Notifications
You must be signed in to change notification settings - Fork 390
chore(backend): Add JSDoc around machines and m2m resource types #6774
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: 2dce5b0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 11 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (1)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including You can disable this status message by setting the WalkthroughDocumentation-only update: Added JSDoc comments to Backend resource classes (Machine, MachineScope, MachineSecretKey, M2MToken) and added a patch-level changeset documenting these doc updates. No code, signatures, or behavior changed. Changes
Sequence Diagram(s)(No sequence diagram generated — changes are documentation-only and do not alter control flow.) Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
Comment Pre-merge checks✅ Passed checks (3 passed)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (4)
.changeset/honest-plants-kneel.md (1)
1-5
: Patch changeset looks correct for docs-only change.Patch bump for @clerk/backend is appropriate. Consider capitalizing “M2M” for consistency with class names in the changelog entry.
packages/backend/src/api/resources/Machine.ts (1)
3-6
: Enrich the JSDoc with tags, links, and property notes.Recommend clarifying what this represents and documenting fields for TypeDoc. Also add an explicit visibility tag.
Please confirm the time unit for createdAt/updatedAt (ms vs s) so we can state it explicitly.
-/** - * The Backend `Machine` object holds information about a machine. - */ +/** + * Represents a Machine resource in the Backend API. + * @public + * @see {@link MachineJSON} + * @remarks A Machine can scope other machines via {@link Machine.scopedMachines}. + * @property id - Unique identifier of the machine. + * @property name - Human-readable name. + * @property instanceId - Owning instance ID. + * @property createdAt - Creation timestamp (please confirm unit). + * @property updatedAt - Update timestamp (please confirm unit). + * @property scopedMachines - Directly scoped machines (no deep nesting by default). + * @property defaultTokenTtl - Default token TTL for this machine. + * @property secretKey - Present when the secret is provisioned/returned by the API. + */packages/backend/src/api/resources/MachineScope.ts (1)
3-6
: Add JSDoc details and visibility; document optional fields.Call out semantics of “deleted” and confirm timestamp units to avoid ambiguity in generated docs.
-/** - * The Backend `MachineScope` object holds information about a machine scope. - */ +/** + * Represents a scoping relationship between two machines. + * @public + * @see {@link MachineScopeJSON} + * @property fromMachineId - The scoping (source) machine ID. + * @property toMachineId - The scoped (target) machine ID. + * @property createdAt - When the scope was created (please confirm unit). + * @property deleted - Soft-deletion flag for this scope relationship. + */packages/backend/src/api/resources/M2MToken.ts (1)
3-6
: Clarify doc, add security/behavior notes, and tag as public.Helpful to document token visibility, expiration units, and revocation semantics for consumers.
Please confirm:
- Whether token is only returned at creation time.
- Timestamp unit for expiration/createdAt/updatedAt.
-/** - * The Backend `M2MToken` object holds information about a machine-to-machine token. - */ +/** + * Represents a machine-to-machine (M2M) access token. + * @public + * @see {@link M2MTokenJSON} + * @property id - Token ID. + * @property subject - Subject (e.g., machine or service principal). + * @property scopes - Authorized scopes for this token. + * @property claims - Additional JWT claims attached to the token. + * @property revoked - True if the token has been revoked. + * @property revocationReason - Optional reason for revocation. + * @property expired - True if the token is past its expiration. + * @property expiration - Expiration timestamp (please confirm unit). + * @property createdAt - Creation timestamp (please confirm unit). + * @property updatedAt - Update timestamp (please confirm unit). + * @property token - Raw token string when returned by the API (often only at creation; please confirm). + */
📜 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.
📒 Files selected for processing (4)
.changeset/honest-plants-kneel.md
(1 hunks)packages/backend/src/api/resources/M2MToken.ts
(1 hunks)packages/backend/src/api/resources/Machine.ts
(1 hunks)packages/backend/src/api/resources/MachineScope.ts
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (7)
.changeset/**
📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)
Automated releases must use Changesets.
Files:
.changeset/honest-plants-kneel.md
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
**/*.{js,jsx,ts,tsx}
: All code must pass ESLint checks with the project's configuration
Follow established naming conventions (PascalCase for components, camelCase for variables)
Maintain comprehensive JSDoc comments for public APIs
Use dynamic imports for optional features
All public APIs must be documented with JSDoc
Provide meaningful error messages to developers
Include error recovery suggestions where applicable
Log errors appropriately for debugging
Lazy load components and features when possible
Implement proper caching strategies
Use efficient data structures and algorithms
Profile and optimize critical paths
Validate all inputs and sanitize outputs
Implement proper logging with different levels
Files:
packages/backend/src/api/resources/M2MToken.ts
packages/backend/src/api/resources/MachineScope.ts
packages/backend/src/api/resources/Machine.ts
**/*.{js,jsx,ts,tsx,json,css,scss,md,yaml,yml}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Use Prettier for consistent code formatting
Files:
packages/backend/src/api/resources/M2MToken.ts
packages/backend/src/api/resources/MachineScope.ts
packages/backend/src/api/resources/Machine.ts
packages/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
TypeScript is required for all packages
Files:
packages/backend/src/api/resources/M2MToken.ts
packages/backend/src/api/resources/MachineScope.ts
packages/backend/src/api/resources/Machine.ts
packages/**/*.{ts,tsx,d.ts}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Packages should export TypeScript types alongside runtime code
Files:
packages/backend/src/api/resources/M2MToken.ts
packages/backend/src/api/resources/MachineScope.ts
packages/backend/src/api/resources/Machine.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Use proper TypeScript error types
**/*.{ts,tsx}
: Always define explicit return types for functions, especially public APIs
Use proper type annotations for variables and parameters where inference isn't clear
Avoidany
type - preferunknown
when type is uncertain, then narrow with type guards
Useinterface
for object shapes that might be extended
Usetype
for unions, primitives, and computed types
Preferreadonly
properties for immutable data structures
Useprivate
for internal implementation details
Useprotected
for inheritance hierarchies
Usepublic
explicitly for clarity in public APIs
Preferreadonly
for properties that shouldn't change after construction
Prefer composition and interfaces over deep inheritance chains
Use mixins for shared behavior across unrelated classes
Implement dependency injection for loose coupling
Let TypeScript infer when types are obvious
Useconst assertions
for literal types:as const
Usesatisfies
operator for type checking without widening
Use mapped types for transforming object types
Use conditional types for type-level logic
Leverage template literal types for string manipulation
Use ES6 imports/exports consistently
Use default exports sparingly, prefer named exports
Use type-only imports:import type { ... } from ...
Noany
types without justification
Proper error handling with typed errors
Consistent use ofreadonly
for immutable data
Proper generic constraints
No unused type parameters
Proper use of utility types instead of manual type construction
Type-only imports where possible
Proper tree-shaking friendly exports
No circular dependencies
Efficient type computations (avoid deep recursion)
Files:
packages/backend/src/api/resources/M2MToken.ts
packages/backend/src/api/resources/MachineScope.ts
packages/backend/src/api/resources/Machine.ts
**/*.{js,ts,tsx,jsx}
📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)
Support multiple Clerk environment variables (CLERK_, NEXT_PUBLIC_CLERK_, etc.) for configuration.
Files:
packages/backend/src/api/resources/M2MToken.ts
packages/backend/src/api/resources/MachineScope.ts
packages/backend/src/api/resources/Machine.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: Formatting | Dedupe | Changeset
- GitHub Check: Build Packages
- GitHub Check: semgrep/ci
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: semgrep-cloud-platform/scan
- GitHub Check: semgrep-cloud-platform/scan
@clerk/agent-toolkit
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/dev-cli
@clerk/elements
@clerk/clerk-expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/clerk-react
@clerk/react-router
@clerk/remix
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/themes
@clerk/types
@clerk/upgrade
@clerk/vue
commit: |
Description
Adding JSDoc for Machine and M2M related backend types for typedoc
will be used to reference objects here clerk/clerk-docs#2593
Checklist
pnpm test
runs as expected.pnpm build
runs as expected.Type of change
Summary by CodeRabbit
Documentation
Chores