Conversation
…eneral ownership
📝 WalkthroughWalkthroughThis pull request introduces path-based deployment resolution for documentation navigation. It adds utilities to infer deployment segments (network, oel, oss) from URLs, a new SameDeploymentLink component for preserving navigation within deployment contexts, and wires deployment awareness through the context system. Documentation and ownership references are also updated. ChangesPath-Based Deployment Infrastructure
Deployment-Aware Navigation Component
Documentation and Configuration Updates
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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 |
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 `@src/components/SameDeploymentLink.tsx`:
- Around line 51-55: overrideForCurrentDeployment is only normalized and
therefore bypasses deployment-scoped rewriting; change the href computation so
that when overrideForCurrentDeployment is present you pass the normalized
override through rewriteToCurrentDeployment (e.g. href =
rewriteToCurrentDeployment(normalizePath(overrideForCurrentDeployment))) instead
of using normalizePath(...) alone, keeping the existing fallback to
rewriteToCurrentDeployment(to) when no override exists; use the same symbols
overrideForCurrentDeployment, normalizePath, and rewriteToCurrentDeployment so
the override resolves to a deployment-scoped docs route and avoids broken links.
In `@src/theme/DocRoot/index.js`:
- Around line 83-90: docsDeploymentFromPathname currently returns "network" for
both explicit "/docs/network/..." URLs and default non-segmented routes, which
loses routing intent when only that value is passed to
QuickstartsDeploymentProvider; update the call site in DocRoot (where
docsDeploymentFromPathname(pathname) is computed) to also derive an explicit
flag (e.g. const isNetworkExplicit = pathname.includes('/docs/network/')) and
pass that flag to QuickstartsDeploymentProvider as syncFromInitialDeployment (in
addition to initialDeployment), and then update QuickstartsDeploymentProvider to
gate its useEffect sync on the syncFromInitialDeployment prop (instead of
checking initialDeployment === "network") so picker/sidebar state preserves
explicit-vs-default routing intent.
🪄 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 Plus
Run ID: 6fcb5101-f222-4f0b-be18-5d2ac0b8ee17
⛔ Files ignored due to path filters (1)
src/components/Shared/kratos/index.mdxis excluded by!**/*.mdx
📒 Files selected for processing (7)
.github/CODEOWNERSAGENTS.mdsrc/components/SameDeploymentLink.tsxsrc/contexts/QuickstartsDeploymentContext.tsxsrc/theme/DocRoot/index.jssrc/theme/MDXComponents.jssrc/utils/docsDeploymentFromPathname.ts
| const overrideForCurrentDeployment = { network, oel, oss }[segment] | ||
| const href = overrideForCurrentDeployment | ||
| ? normalizePath(overrideForCurrentDeployment) | ||
| : rewriteToCurrentDeployment(to) | ||
| const allDocs = useAllDocsData() |
There was a problem hiding this comment.
Override targets bypass deployment rewrite and can produce broken doc links.
overrideForCurrentDeployment is only normalized, not deployment-rewritten. For values like oel="kratos/self-hosted/intro", href becomes /kratos/self-hosted/intro instead of a deployment-scoped docs route. This can silently navigate to non-existent pages.
Proposed fix
- const href = overrideForCurrentDeployment
- ? normalizePath(overrideForCurrentDeployment)
- : rewriteToCurrentDeployment(to)
+ const href = overrideForCurrentDeployment
+ ? rewriteToCurrentDeployment(overrideForCurrentDeployment)
+ : rewriteToCurrentDeployment(to)📝 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.
| const overrideForCurrentDeployment = { network, oel, oss }[segment] | |
| const href = overrideForCurrentDeployment | |
| ? normalizePath(overrideForCurrentDeployment) | |
| : rewriteToCurrentDeployment(to) | |
| const allDocs = useAllDocsData() | |
| const overrideForCurrentDeployment = { network, oel, oss }[segment] | |
| const href = overrideForCurrentDeployment | |
| ? rewriteToCurrentDeployment(overrideForCurrentDeployment) | |
| : rewriteToCurrentDeployment(to) | |
| const allDocs = useAllDocsData() |
🤖 Prompt for 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.
In `@src/components/SameDeploymentLink.tsx` around lines 51 - 55,
overrideForCurrentDeployment is only normalized and therefore bypasses
deployment-scoped rewriting; change the href computation so that when
overrideForCurrentDeployment is present you pass the normalized override through
rewriteToCurrentDeployment (e.g. href =
rewriteToCurrentDeployment(normalizePath(overrideForCurrentDeployment))) instead
of using normalizePath(...) alone, keeping the existing fallback to
rewriteToCurrentDeployment(to) when no override exists; use the same symbols
overrideForCurrentDeployment, normalizePath, and rewriteToCurrentDeployment so
the override resolves to a deployment-scoped docs route and avoids broken links.
| const deploymentFromPath = docsDeploymentFromPathname(pathname) | ||
| const versionMetadata = useDocsVersion() ?? {} | ||
| const docsSidebars = versionMetadata.docsSidebars ?? {} | ||
|
|
||
| return ( | ||
| <div id="route-identifier" data-route={pathname}> | ||
| <HtmlClassNameProvider className={clsx(ThemeClassNames.page.docsDocPage)}> | ||
| <QuickstartsDeploymentProvider> | ||
| <QuickstartsDeploymentProvider initialDeployment={deploymentFromPath}> |
There was a problem hiding this comment.
Explicit vs implicit “network” context is currently collapsed.
docsDeploymentFromPathname() returns "network" for both explicit /docs/network/... and default non-segmented paths, but only that value is passed to the provider. This loses routing intent and can desync picker/sidebar state across navigations.
Suggested direction
-import { docsDeploymentFromPathname } from "@site/src/utils/docsDeploymentFromPathname"
+import {
+ docsDeploymentFromPathname,
+ isExplicitDocsDeploymentPath,
+} from "@site/src/utils/docsDeploymentFromPathname"
const pathname = props.location?.pathname ?? ""
const deploymentFromPath = docsDeploymentFromPathname(pathname)
+ const explicitDeploymentPath = isExplicitDocsDeploymentPath(pathname)
- <QuickstartsDeploymentProvider initialDeployment={deploymentFromPath}>
+ <QuickstartsDeploymentProvider
+ initialDeployment={deploymentFromPath}
+ syncFromInitialDeployment={explicitDeploymentPath}
+ >Then gate the useEffect sync in QuickstartsDeploymentProvider on syncFromInitialDeployment instead of checking initialDeployment === "network".
🤖 Prompt for 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.
In `@src/theme/DocRoot/index.js` around lines 83 - 90, docsDeploymentFromPathname
currently returns "network" for both explicit "/docs/network/..." URLs and
default non-segmented routes, which loses routing intent when only that value is
passed to QuickstartsDeploymentProvider; update the call site in DocRoot (where
docsDeploymentFromPathname(pathname) is computed) to also derive an explicit
flag (e.g. const isNetworkExplicit = pathname.includes('/docs/network/')) and
pass that flag to QuickstartsDeploymentProvider as syncFromInitialDeployment (in
addition to initialDeployment), and then update QuickstartsDeploymentProvider to
gate its useEffect sync on the syncFromInitialDeployment prop (instead of
checking initialDeployment === "network") so picker/sidebar state preserves
explicit-vs-default routing intent.
Related Issue or Design Document
Checklist
If this pull request addresses a security vulnerability,
I confirm that I got approval (please contact security@ory.com) from the maintainers to push the changes.
Further comments
Summary by CodeRabbit
New Features
Documentation