Conversation
…intlify codeblock
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughDeleted local OpenGraph JSON schema files, added a React component that fetches and displays JSON from GitHub, and updated docs to reference external schemas and include a Data Payload Validation section. Changes
Sequence Diagram(s)sequenceDiagram
participant Reader as Docs Page (Browser)
participant Component as GitHubJsonCodeblock
participant GitHub as raw.githubusercontent.com
participant Renderer as CodeBlock
Reader->>Component: Render with `sourceUrl`
Component->>GitHub: fetch(sourceUrl)
GitHub-->>Component: JSON response / error
Component->>Renderer: render formatted JSON or error/loading text
Component-->>Reader: display CodeBlock (and optional source link)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 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 |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (4)
docs/snippets/opengraph/github-json-codeblock.jsx (3)
19-25: Consider adding a timeout to the fetch request.The fetch has no timeout, which could cause the component to stay in loading state indefinitely if the GitHub raw URL is slow or unresponsive. While
AbortControllerhandles component unmount, it doesn't protect against slow requests while mounted.💡 Proposed timeout implementation
try { + const timeoutId = setTimeout(() => abortController.abort(), 10000); const response = await fetch(sourceUrl, { signal: abortController.signal, headers: { Accept: 'application/json, text/plain;q=0.9,*/*;q=0.8', }, }); + clearTimeout(timeoutId);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/snippets/opengraph/github-json-codeblock.jsx` around lines 19 - 25, Add a request timeout around the fetch of sourceUrl by starting a timer (e.g., TIMEOUT_MS constant) that calls abortController.abort() after the timeout, clear that timer immediately when fetch resolves or rejects, and also clear it on component unmount; update the fetch logic where abortController.signal is passed so the request is aborted both on unmount and when the timeout elapses, and ensure any timeout-related errors are handled the same as AbortError in the existing error handling.
82-91: Source link renders raw.githubusercontent.com URL.When
showSourceLinkis enabled, users see and can click a link toraw.githubusercontent.com. This may be intentional, but typically you'd want to link to the GitHub blob view (e.g.,github.com/SpecterOps/chow/blob/main/...) for a better user experience. The current raw URL downloads the file directly rather than showing it in GitHub's UI.💡 Transform raw URL to GitHub blob URL for better UX
+ const getGitHubBlobUrl = (rawUrl) => { + if (!rawUrl) return rawUrl; + // Transform raw.githubusercontent.com/owner/repo/refs/heads/branch/path + // to github.com/owner/repo/blob/branch/path + return rawUrl + .replace('raw.githubusercontent.com', 'github.com') + .replace('/refs/heads/', '/blob/'); + }; + return ( <> {showSourceLink && sourceUrl && ( <p> - Source: <a href={sourceUrl}>{fileName}</a> + Source: <a href={getGitHubBlobUrl(sourceUrl)}>{fileName}</a> </p> )}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/snippets/opengraph/github-json-codeblock.jsx` around lines 82 - 91, The source link currently renders the raw.githubusercontent.com URL (sourceUrl) which causes direct download; update the rendering logic that checks showSourceLink and sourceUrl to transform the raw URL into the GitHub blob view URL before using it (e.g., convert raw.githubusercontent.com/.../path to github.com/{owner}/{repo}/blob/{branch}/... or replace the raw host and adjust the path), then pass that transformed URL into the <a href={...}>{fileName}</a> output (keep using fileName and renderCode as-is). Ensure the transformation handles typical raw URL patterns and falls back to sourceUrl unchanged if it cannot be parsed.
1-9: Add a comment clarifying that React hooks and CodeBlock are provided by Mintlify globally.The component omits imports for
useState,useEffect,useMemo, andCodeBlock, which is intentional for Mintlify snippets (as indicated by the existing comment on line 1). Consider adding a brief clarification comment explaining that these are provided by Mintlify's global scope to help future maintainers understand the pattern and avoid confusion.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/snippets/opengraph/github-json-codeblock.jsx` around lines 1 - 9, Add a short clarifying comment at the top of the GitHubJsonCodeblock snippet (near the existing "Must use arrow function syntax in Mintlify snippets" note) stating that React hooks (useState, useEffect, useMemo) and the CodeBlock component are available from Mintlify's global scope and intentionally omitted from imports; reference the GitHubJsonCodeblock component name and the hook/component names (useState, useEffect, useMemo, CodeBlock) so future maintainers know this is deliberate.docs/assets/opengraph/schema.json (1)
1-3: Consider pinning to a commit SHA or tag instead ofmainbranch.The
$refpoints torefs/heads/main, meaning the schema can change unexpectedly when the upstream repository is updated. This could cause documentation examples to become invalid or user validation to break if the schema changes incompatibly. Pointing to a specific commit SHA or release tag would provide better stability.💡 Example with commit SHA (replace with actual SHA)
{ - "$ref": "https://raw.githubusercontent.com/SpecterOps/chow/refs/heads/main/pkg/validator/jsonschema/opengraph.json" + "$ref": "https://raw.githubusercontent.com/SpecterOps/chow/<COMMIT_SHA>/pkg/validator/jsonschema/opengraph.json" }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/assets/opengraph/schema.json` around lines 1 - 3, The $ref currently points to the upstream repo using refs/heads/main which allows the schema to change unexpectedly; update the "$ref" value in the JSON (the existing "$ref": "https://raw.githubusercontent.com/SpecterOps/chow/refs/heads/main/pkg/validator/jsonschema/opengraph.json") to reference a stable identifier—replace refs/heads/main with a specific commit SHA or a release tag (e.g., refs/heads/<commit-sha> or tags/vX.Y.Z) so the schema URL is deterministic and won't change with upstream branch updates.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/opengraph/developer/schema.mdx`:
- Around line 104-107: Remove the unused "language" prop from all
GitHubJsonCodeblock usages in this file: locate each JSX/MDX component instance
named GitHubJsonCodeblock (examples around the shown diff and the other
occurrences noted) and delete the language="json" attribute so only supported
props remain; do not change the component implementation itself, just remove the
extraneous language prop from each GitHubJsonCodeblock instance.
- Around line 67-72: Fix the duplicated phrase "that's hosted that's hosted" in
the sentence and clarify the allowlist guidance: replace the sentence with a
corrected version (remove the duplicate) and explicitly state that users should
allowlist the full schema URL
(https://bloodhound.specterops.io/assets/opengraph/schema.json) and, if their
editor requires directory-level access, the raw GitHub directory base URL
(https://raw.githubusercontent.com/SpecterOps/chow/refs/heads/main/pkg/validator/jsonschema/);
update the surrounding text to make clear which exact strings to add to editor
configuration and that one is a single schema file and the other is a repository
directory.
In `@docs/snippets/opengraph/github-json-codeblock.jsx`:
- Around line 2-6: The component GitHubJsonCodeblock currently ignores a
passed-in language prop; update the component signature to accept a language
prop (e.g., language = 'json') and replace the hardcoded language used in
renderCode with that variable so the success render path uses the provided
language; locate the renderCode call in the success branch (around the existing
line ~89) and swap the hardcoded 'json'/'text' argument for the new language
prop, leaving existing defaults and showSourceLink behavior intact.
---
Nitpick comments:
In `@docs/assets/opengraph/schema.json`:
- Around line 1-3: The $ref currently points to the upstream repo using
refs/heads/main which allows the schema to change unexpectedly; update the
"$ref" value in the JSON (the existing "$ref":
"https://raw.githubusercontent.com/SpecterOps/chow/refs/heads/main/pkg/validator/jsonschema/opengraph.json")
to reference a stable identifier—replace refs/heads/main with a specific commit
SHA or a release tag (e.g., refs/heads/<commit-sha> or tags/vX.Y.Z) so the
schema URL is deterministic and won't change with upstream branch updates.
In `@docs/snippets/opengraph/github-json-codeblock.jsx`:
- Around line 19-25: Add a request timeout around the fetch of sourceUrl by
starting a timer (e.g., TIMEOUT_MS constant) that calls abortController.abort()
after the timeout, clear that timer immediately when fetch resolves or rejects,
and also clear it on component unmount; update the fetch logic where
abortController.signal is passed so the request is aborted both on unmount and
when the timeout elapses, and ensure any timeout-related errors are handled the
same as AbortError in the existing error handling.
- Around line 82-91: The source link currently renders the
raw.githubusercontent.com URL (sourceUrl) which causes direct download; update
the rendering logic that checks showSourceLink and sourceUrl to transform the
raw URL into the GitHub blob view URL before using it (e.g., convert
raw.githubusercontent.com/.../path to
github.com/{owner}/{repo}/blob/{branch}/... or replace the raw host and adjust
the path), then pass that transformed URL into the <a href={...}>{fileName}</a>
output (keep using fileName and renderCode as-is). Ensure the transformation
handles typical raw URL patterns and falls back to sourceUrl unchanged if it
cannot be parsed.
- Around line 1-9: Add a short clarifying comment at the top of the
GitHubJsonCodeblock snippet (near the existing "Must use arrow function syntax
in Mintlify snippets" note) stating that React hooks (useState, useEffect,
useMemo) and the CodeBlock component are available from Mintlify's global scope
and intentionally omitted from imports; reference the GitHubJsonCodeblock
component name and the hook/component names (useState, useEffect, useMemo,
CodeBlock) so future maintainers know this is deliberate.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 0d5dec28-4871-48a3-a599-28e926edd12b
📒 Files selected for processing (5)
docs/assets/opengraph/opengraph-edge.jsondocs/assets/opengraph/opengraph-node.jsondocs/assets/opengraph/schema.jsondocs/opengraph/developer/schema.mdxdocs/snippets/opengraph/github-json-codeblock.jsx
💤 Files with no reviewable changes (2)
- docs/assets/opengraph/opengraph-edge.json
- docs/assets/opengraph/opengraph-node.json
There was a problem hiding this comment.
🧹 Nitpick comments (1)
docs/opengraph/developer/schema.mdx (1)
71-72: Prefer immutable URLs overrefs/heads/mainfor schema/example fetches.Line 71 and Lines 105-106, 240-241, 341-342, 355-356 currently point to moving branch refs. This can cause docs output to change unexpectedly without a docs change. Pinning to commit SHAs will make rendering deterministic.
Suggested direction
-https://raw.githubusercontent.com/SpecterOps/chow/refs/heads/main/pkg/validator/jsonschema/ +https://raw.githubusercontent.com/SpecterOps/chow/<chow_commit_sha>/pkg/validator/jsonschema/ -sourceUrl="https://raw.githubusercontent.com/SpecterOps/chow/refs/heads/main/pkg/validator/jsonschema/node.json" +sourceUrl="https://raw.githubusercontent.com/SpecterOps/chow/<chow_commit_sha>/pkg/validator/jsonschema/node.json" -sourceUrl="https://raw.githubusercontent.com/SpecterOps/chow/refs/heads/main/pkg/validator/jsonschema/edge.json" +sourceUrl="https://raw.githubusercontent.com/SpecterOps/chow/<chow_commit_sha>/pkg/validator/jsonschema/edge.json" -sourceUrl="https://raw.githubusercontent.com/SpecterOps/chow/refs/heads/main/pkg/validator/jsonschema/metadata.json" +sourceUrl="https://raw.githubusercontent.com/SpecterOps/chow/<chow_commit_sha>/pkg/validator/jsonschema/metadata.json" -sourceUrl="https://raw.githubusercontent.com/SpecterOps/bloodhound-docs/refs/heads/main/docs/assets/opengraph/opengraph-minimal.json" +sourceUrl="https://raw.githubusercontent.com/SpecterOps/bloodhound-docs/<docs_commit_sha>/docs/assets/opengraph/opengraph-minimal.json"Also applies to: 105-106, 240-241, 341-342, 355-356
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/opengraph/developer/schema.mdx` around lines 71 - 72, Replace branch-based raw.githubusercontent URLs that use "refs/heads/main" with immutable permalinks pinned to a specific commit SHA; locate occurrences of the string "https://raw.githubusercontent.com/SpecterOps/chow/refs/heads/main/pkg/validator/jsonschema/" (and the other similar refs/heads/main URLs in the file) and change them to the equivalent raw.githubusercontent.com URL using the repository commit SHA (obtain the SHA via git rev-parse or the GitHub UI and substitute it in place of refs/heads/main) so all schema/example fetches in schema.mdx are deterministic.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@docs/opengraph/developer/schema.mdx`:
- Around line 71-72: Replace branch-based raw.githubusercontent URLs that use
"refs/heads/main" with immutable permalinks pinned to a specific commit SHA;
locate occurrences of the string
"https://raw.githubusercontent.com/SpecterOps/chow/refs/heads/main/pkg/validator/jsonschema/"
(and the other similar refs/heads/main URLs in the file) and change them to the
equivalent raw.githubusercontent.com URL using the repository commit SHA (obtain
the SHA via git rev-parse or the GitHub UI and substitute it in place of
refs/heads/main) so all schema/example fetches in schema.mdx are deterministic.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 190548c0-3b6e-4052-aac4-b8fa992982c7
📒 Files selected for processing (1)
docs/opengraph/developer/schema.mdx
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/opengraph/developer/schema.mdx`:
- Around line 69-72: The docs use mutable branch URLs (refs/heads/main) for the
schema and examples; replace those with immutable, commit-pinned URLs: update
the inline code block URL (the
https://raw.githubusercontent.com/.../refs/heads/main path) to use the specific
commit SHA, update every GitHubJsonCodeblock sourceUrl attribute to point to the
same commit-pinned raw URL, and change the $ref in the payload schema file to
the commit-pinned URL as well so all references (the inline code block, the
GitHubJsonCodeblock sourceUrl attributes, and the $ref in the payload schema)
reference the exact commit SHA instead of refs/heads/main.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 0ab9c50c-14b1-4b93-8d84-03c402a0a145
📒 Files selected for processing (2)
docs/assets/opengraph/payload-schema.jsondocs/opengraph/developer/schema.mdx
✅ Files skipped from review due to trivial changes (1)
- docs/assets/opengraph/payload-schema.json
Purpose
This pull request (PR) adds a new section to the OpenGraph schema docs that describes an option for validating data payloads against the JSON schema stored in the
chowrepo. We want to host a new JSON file on the docs site that references the schema so that we have a more favorable URL that developers can use to configure their editors.In the interest of consolidating schema reference, we're also adding a custom React component to fetch JSON data from a raw GitHub URLs instead of hardcoding corresponding examples in the docs. This will reduce maintenance overhead, which currently requires updating examples in multiple places instead of one.
Note
The current implementation fetches data from the
mainbranch in thechowrepo, but it might be better to point to a commit SHA instead to avoid unexpected changes.Staging
https://specterops-fetch-json-component.mintlify.app/opengraph/developer/schema
Summary by CodeRabbit
New Features
Documentation