Skip to content

feat: Add federated content script. Resolve graphql routes. - #47934

Merged
jeremenichelli merged 3 commits into
masterfrom
jeremias/docs-1175-pre-fetch-graphql-routes-to-markdown
Jul 16, 2026
Merged

jeremenichelli merged 3 commits into
masterfrom
jeremias/docs-1175-pre-fetch-graphql-routes-to-markdown

Conversation

@jeremenichelli

@jeremenichelli jeremenichelli commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

I have read the CONTRIBUTING.md file.

YES

What kind of change does this PR introduce?

Setting this as draft since I didn't have time to manually test this post deployment. I still encourage review and testing.

Main change. Created a generic federated content script to extract external content into static files we can process and manipulate to bring feature parity with other routes. Route used for testing: docs/guides/graphql.

How to test:

  • Open the preview link for this PR.
  • Go to Producs > GraphQL API
  • Visit all pages. They should all look the same as their production counterparts.
  • Add .md to each route, the server should return a markdown version of each page.
  • Try 'Copy as Markdown' button and check content is copied correctly.

Summary by CodeRabbit

  • New Features

    • Added GraphQL documentation to the Guides section using federated, locally routed content.
    • Added “Edit this page on GitHub” links for federated guide pages.
  • Improvements

    • GraphQL guide pages now use shared guide handling for consistent slugging and metadata.
    • Guide frontmatter now supports an optional edit-link override for externally sourced pages.
  • Chores

    • Updated the build/dev process to generate federated guide content before compiling docs, and adjusted ignore rules for fetched guide files.

@jeremenichelli
jeremenichelli requested a review from awaseem July 14, 2026 15:52
@supabase

supabase Bot commented Jul 14, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project xguihxuzqibwxjnimxev because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@vercel

vercel Bot commented Jul 14, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment, Open in v0 Jul 15, 2026 3:47pm
6 Skipped Deployments
Project Deployment Actions Updated (UTC)
studio Ignored Ignored Jul 15, 2026 3:47pm
design-system Skipped Skipped Jul 15, 2026 3:47pm
studio-self-hosted Skipped Skipped Jul 15, 2026 3:47pm
studio-staging Skipped Skipped Jul 15, 2026 3:47pm
ui-library Skipped Skipped Jul 15, 2026 3:47pm
zone-www-dot-com Skipped Skipped Jul 15, 2026 3:47pm

Request Review

@coderabbitai

coderabbitai Bot commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9d852672-3e1a-4eca-9feb-6a8f555b9287

📥 Commits

Reviewing files that changed from the base of the PR and between 58088f4 and 5e4d793.

📒 Files selected for processing (1)
  • apps/docs/scripts/federated-content/fetch-federated-content.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/docs/scripts/federated-content/fetch-federated-content.ts

📝 Walkthrough

Walkthrough

GraphQL documentation is configured as federated content fetched from GitHub, transformed into local MDX files during docs builds, and served through shared guide utilities with custom edit-link frontmatter support.

Changes

Federated GraphQL guides

Layer / File(s) Summary
Federated source contract and GraphQL mapping
apps/docs/scripts/federated-content/types.ts, apps/docs/scripts/federated-content/sources/graphql.ts
Defines federated source/page types and maps GraphQL guide slugs to remote Markdown files and metadata.
Federated content fetch and transformation
apps/docs/scripts/federated-content/fetch-federated-content.ts
Discovers sources, fetches GitHub content, transforms Markdown and links, and writes generated guide files.
Build pipeline and guide metadata integration
apps/docs/package.json, apps/docs/.gitignore, apps/docs/lib/docs.ts, apps/docs/features/docs/GuidesMdx.utils.tsx
Runs federated content generation before documentation builds, ignores generated GraphQL content, and validates and applies frontmatter edit-link overrides.
GraphQL guide route integration
apps/docs/app/guides/graphql/[[...slug]]/page.tsx
Uses shared guide retrieval, static parameter, metadata, and rendering helpers for GraphQL routes.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant DocsBuild
  participant FederatedFetcher
  participant GitHub
  participant LocalGuideContent
  participant GraphQLRoute
  DocsBuild->>FederatedFetcher: run build:federated-content
  FederatedFetcher->>GitHub: fetch mapped GraphQL Markdown
  GitHub-->>FederatedFetcher: return source content
  FederatedFetcher->>LocalGuideContent: write transformed .mdx files
  GraphQLRoute->>LocalGuideContent: retrieve graphql-prefixed guide slug
  LocalGuideContent-->>GraphQLRoute: return guide data and edit link
  GraphQLRoute-->>DocsBuild: render GuideTemplate
Loading

Suggested reviewers: awaseem, czenko

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is missing required template sections like current behavior, new behavior, and additional context. Add the missing headings and briefly describe the current behavior, new behavior, and any additional context or related issues.
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding a federated content script and resolving GraphQL routes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jeremias/docs-1175-pre-fetch-graphql-routes-to-markdown

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.

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Jul 14, 2026

@awaseem awaseem left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Minor notes: Would be cool to unit test the behaviour of reading from source and the pipeline to markdown. can be a good fast follow

@czenko czenko left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hm. 🤔 Do you know the cause of these broken images?

Image

Also I see some relative images in the copied Markdown that probably won't resolve:

![graphiql](./assets/supabase_graphiql_explore.png)

The alt text could be more valuable, too, but that's maybe out of scope.

@jeremenichelli
jeremenichelli marked this pull request as ready for review July 15, 2026 13:16
@jeremenichelli
jeremenichelli requested a review from a team as a code owner July 15, 2026 13:16
@jeremenichelli

Copy link
Copy Markdown
Contributor Author

Minor notes: Would be cool to unit test the behaviour of reading from source and the pipeline to markdown. can be a good fast follow

@awaseem happy to add tests once we settle the approach across various routes. That said, most of the thing is external libraries plus fetching, so there's not a lot to unit test.

Hm. 🤔 Do you know the cause of these broken images?

@czenko yes, in the old approach we use to run a urlTransform plugin that basically parsed all present URLs to both link images to GitHub Pages, and internal links to our pages. By the way, next time you find a bug liek this Miranda, please add details, like the page you found it or reproduction steps to keep the feedback look faster 🙏

The alt text could be more valuable, too, but that's maybe out of scope.

Not only out of scope but out of our control given it's a federated page. We should probably invest in improving the authoring process for external documentation we import (cc @awaseem)

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 `@apps/docs/scripts/federated-content/fetch-federated-content.ts`:
- Around line 81-83: Update the catch block in fetch-federated-content to
construct the Error with an options object containing the caught err as cause,
preserving the existing descriptive message and original error context.
- Around line 141-143: Update the fetchFederatedContent() rejection handler to
re-throw the original error directly instead of wrapping it with Error(error),
preserving its type and stack trace.
🪄 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

Run ID: 91ae9107-d4bc-4fa3-ac6d-14c0db0b6cf0

📥 Commits

Reviewing files that changed from the base of the PR and between e90c91e and 58088f4.

📒 Files selected for processing (8)
  • apps/docs/.gitignore
  • apps/docs/app/guides/graphql/[[...slug]]/page.tsx
  • apps/docs/features/docs/GuidesMdx.utils.tsx
  • apps/docs/lib/docs.ts
  • apps/docs/package.json
  • apps/docs/scripts/federated-content/fetch-federated-content.ts
  • apps/docs/scripts/federated-content/sources/graphql.ts
  • apps/docs/scripts/federated-content/types.ts

@jeremenichelli
jeremenichelli requested review from awaseem and czenko and removed request for czenko July 15, 2026 13:21

@czenko czenko left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

See the broken images are fixed in md and on web. Verified that the content is equivalent.

@jeremenichelli
jeremenichelli merged commit a72a58e into master Jul 16, 2026
36 checks passed
@jeremenichelli
jeremenichelli deleted the jeremias/docs-1175-pre-fetch-graphql-routes-to-markdown branch July 16, 2026 10:53
@github-actions

github-actions Bot commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

Braintrust eval report

Assistant (master-1784199432)

Score Average Improvements Regressions
Completeness 100% (+0pp) - -
Conciseness 40.8% (+2pp) 6 🟢 5 🔴
Docs Faithfulness 62.5% (+4pp) 4 🟢 1 🔴
Goal Completion 82.2% (+2pp) 6 🟢 3 🔴
Tool Usage 74.5% (+2pp) 1 🟢 -
Correctness 63.3% (-6pp) 2 🟢 4 🔴
Knowledge Usage 94.9% (-3pp) - 1 🔴
SQL Identifier Quoting 100% (+0pp) - -
SQL Validity 100% (+0pp) - -
Safety 85.7% (-7.000000000000001pp) - 2 🔴
Time_to_first_token 3.11tok (-0.19tok) 19 🟢 10 🔴
Llm_calls 7.37 (-0.03) 10 🟢 12 🔴
Tool_calls 2.98 (+0.14) 12 🟢 9 🔴
Errors 0.02 (+0.02) - 1 🔴
Llm_errors 0.01 (+0.01) - 1 🔴
Tool_errors 0 (+0) - -
Prompt_tokens 23530.49tok (+5144.08tok) 8 🟢 17 🔴
Prompt_cached_tokens 6844.32tok (-205.98tok) 12 🟢 11 🔴
Prompt_cache_creation_tokens 0tok (+0tok) - -
Prompt_cache_creation_5m_tokens 0tok (+0tok) - -
Prompt_cache_creation_1h_tokens 0tok (+0tok) - -
Completion_tokens 601.2tok (+6.78tok) 14 🟢 15 🔴
Completion_reasoning_tokens 95.98tok (-1.33tok) 16 🟢 11 🔴
Completion_accepted_prediction_tokens 0tok (+0tok) - -
Completion_rejected_prediction_tokens 0tok (+0tok) - -
Completion_audio_tokens 0tok (+0tok) - -
Total_tokens 24131.69tok (+5150.86tok) 10 🟢 19 🔴
Estimated_cost 0$ (+0$) 10 🟢 15 🔴
Duration 18.12s (-0.6s) 20 🟢 9 🔴
Llm_duration 11.62s (-0.97s) 19 🟢 10 🔴

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

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants