Skip to content

Run Charts documentation examples - #1132

Open
tannerlinsley wants to merge 3 commits into
mainfrom
codex/charts-0.9.0-site
Open

Run Charts documentation examples#1132
tannerlinsley wants to merge 3 commits into
mainfrom
codex/charts-0.9.0-site

Conversation

@tannerlinsley

@tannerlinsley tannerlinsley commented Aug 9, 2026

Copy link
Copy Markdown
Member

Summary

  • move Charts site, catalog, and landing imports to the tree-shakeable @tanstack/charts 0.9.0 subpaths
  • run grouped documentation fences with Charts, React, and Octane environment bootstraps
  • align Charts package metadata and sidebar navigation with the catalog

Validation

  • pnpm test
  • pnpm build
  • pnpm charts:check-landing-svg
  • browser smoke: overview, React quick start, Octane quick start, and catalog detail
  • edited and reran each runnable docs environment successfully

Summary by CodeRabbit

  • New Features

    • Added support for Charts, React, and Octane example environments.
    • Live examples now support grouping, entry files, collapsed support files, and environment metadata.
    • Updated chart catalog integration for TanStack Charts 0.9.0.
  • Bug Fixes

    • Improved chart navigation, active menu states, and route handling.
    • Preserved example environment settings when workspaces are updated or cloned.
    • Improved compilation and rendering of interactive examples.

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a846e21d-7ac4-4651-8e65-37354de179fe

📥 Commits

Reviewing files that changed from the base of the PR and between 8ca1342 and ab840d3.

📒 Files selected for processing (4)
  • src/utils/markdown/live-example.ts
  • src/utils/notebook-environment.ts
  • tests/markdown-live-example.test.ts
  • tests/notebook-environment.test.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • tests/notebook-environment.test.ts
  • tests/markdown-live-example.test.ts
  • src/utils/markdown/live-example.ts

📝 Walkthrough

Walkthrough

The PR migrates TanStack Charts to 0.9.0, adds Charts and Octane example environments, updates workspace compilation, improves chart navigation, and replaces live-example metadata with grouped runnable examples and collapsed support files.

Changes

Charts migration and catalog

Layer / File(s) Summary
Charts 0.9 package and catalog migration
package.json, scripts/charts-landing/*, src/components/charts/*, src/components/landing/ChartsLanding.tsx, src/libraries/libraries.ts, src/utils/charts-catalog*, src/utils/notebook-examples.ts, src/utils/npm-packages.ts, tests/charts-*, tests/octane-framework-support.test.ts
Chart imports and catalog mappings now use @tanstack/charts 0.9.0. Legacy chart packages were removed. Framework package resolution uses configured package mappings.
Shared chart navigation routing
src/components/library-layout-navigation.ts, src/components/LibraryLayout.tsx, tests/charts-sidebar-navigation.test.ts
Shared helpers match nested chart catalog routes, normalize trailing slashes, and calculate menu-group open state. Desktop and mobile links use the same chart route predicate.

Environment-aware workspaces

Layer / File(s) Summary
Environment-aware workspace builds
src/utils/example-workspace.ts, src/utils/example-esbuild.client.ts, src/utils/notebook-environment.ts, src/types/octane-compiler.d.ts, src/components/examples/ExampleWorkbench.client.tsx, tests/example-workspace.test.ts, tests/notebook-environment.test.ts
Workspaces preserve validated environments. Environment profiles generate browser entries. .tsrx files compile through octane/compiler before esbuild processing.

Grouped runnable examples

Layer / File(s) Summary
Grouped runnable Markdown examples
src/utils/markdown/live-example.ts, src/components/markdown/LiveExample.tsx, tests/markdown-live-example.test.ts
Examples now use group, env, entry, and collapsed metadata. Parsing validates groups, paths, entries, environments, and duplicate attributes. Collapsed files render in an expandable “Support files” section.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant MarkdownParser
  participant WorkspaceBuilder
  participant EnvironmentProfile
  participant OctaneCompiler
  participant Browser
  MarkdownParser->>WorkspaceBuilder: parse grouped example metadata
  WorkspaceBuilder->>EnvironmentProfile: resolve example environment
  WorkspaceBuilder->>OctaneCompiler: compile .tsrx sources
  OctaneCompiler-->>WorkspaceBuilder: return compiled source and diagnostics
  WorkspaceBuilder->>Browser: provide generated entry module
  Browser->>EnvironmentProfile: mount configured chart application
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 2.56% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: updating and running Charts documentation examples.
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 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/charts-0.9.0-site

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.

@socket-security

socket-security Bot commented Aug 9, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedoctane@​0.1.13751008296100
Addedvite@​8.0.16991008298100
Added@​tanstack/​charts@​0.9.09810010097100

View full report

@socket-security

socket-security Bot commented Aug 9, 2026

Copy link
Copy Markdown

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn Medium
Low adoption: npm octane

Location: Package overview

From: package.jsonnpm/octane@0.1.13

ℹ Read more on: This package | This alert | What are unpopular packages?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Unpopular packages may have less maintenance and contain other problems.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/octane@0.1.13. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 9, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
tanstack-com ab840d3 Commit Preview URL

Branch Preview URL
Aug 10 2026, 04:13 AM

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (5)
src/utils/example-esbuild.client.ts (1)

139-146: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Surface octane compiler diagnostics instead of discarding them.

compileOctaneSource reads only .code. It drops diagnostics. If the octane compiler reports syntax errors through diagnostics and still returns code, a broken .tsrx file produces a misleading esbuild error or silently wrong output. Return the diagnostics to the onLoad callback and map them to esbuild errors.

♻️ Proposed change
-          const contents = args.path.endsWith('.tsrx')
-            ? await compileOctaneSource(source, args.path)
-            : source
+          if (args.path.endsWith('.tsrx')) {
+            const compiled = await compileOctaneSource(source, args.path)
+            if (compiled.diagnostics.length) {
+              return {
+                errors: compiled.diagnostics.map((diagnostic) => ({
+                  text: String(diagnostic),
+                })),
+              }
+            }
+            return {
+              contents: compiled.code,
+              loader: getLoader(args.path),
+              resolveDir: getDirectory(args.path),
+            }
+          }
+
+          const contents = source
 async function compileOctaneSource(source: string, path: string) {
   const { compile } = await import('octane/compiler')
   return compile(source, path, {
     dev: false,
     hmr: false,
     mode: 'client',
-  }).code
+  })
 }
🤖 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/utils/example-esbuild.client.ts` around lines 139 - 146, Update
compileOctaneSource to preserve and return the compiler diagnostics alongside
code instead of selecting only .code. In the onLoad callback, consume those
diagnostics and map them into esbuild errors before returning the compiled
contents, while retaining the existing successful compilation behavior.
src/utils/markdown/live-example.ts (2)

166-172: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Reject the reserved environment entry path at parse time.

isCanonicalExamplePath accepts /__tanstack-example-entry.ts. An author can declare that path in a fence. Parsing succeeds, the page renders, and addEnvironmentEntry in src/utils/example-esbuild.client.ts then throws Reserved environment file only after the reader presses Run. Fail open to static code here instead, which matches the other validation in this function.

♻️ Proposed guard
   const entry = entryItem.attributes.file
   const environment = entryItem.attributes.env
   if (!entry || !environment || !isExampleEnvironment(environment)) {
     return undefined
   }
 
+  if (files[getExampleEnvironmentProfile(environment).entryPath] !== undefined) {
+    return undefined
+  }
+
   const workspace = createExampleWorkspace({ entry, environment, files })
🤖 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/utils/markdown/live-example.ts` around lines 166 - 172, Update the
validation in the live-example parsing function around entryItem.attributes.file
and isExampleEnvironment to reject the reserved /__tanstack-example-entry.ts
path before createExampleWorkspace runs. Return undefined for that entry so
parsing falls back to static code, while preserving the existing validation for
missing or invalid entry and environment values.

188-202: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Two parsers read the same meta string and can disagree.

readAttributeNames re-tokenizes block.meta with its own regex, while parseAttributes parses the same string separately. Duplicate detection depends on both parsers agreeing on token boundaries. Any divergence makes countAttribute return a wrong count, which either rejects a valid fence or lets a duplicate attribute through.

Consider extending parseAttributes to return the ordered attribute names alongside the values, then remove this second pass.

🤖 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/utils/markdown/live-example.ts` around lines 188 - 202, The
duplicate-detection path currently reparses meta independently of
parseAttributes, allowing tokenization discrepancies. Extend parseAttributes to
return ordered attribute names alongside parsed values, update countAttribute’s
callers to use those names, and remove readAttributeNames so both validation and
values share the same parser.
tests/notebook-environment.test.ts (1)

59-76: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert entryPath and derive the environment list from the source of truth.

The test name states "every Charts environment", but the three environments are hardcoded. A new entry in exampleEnvironmentNames without a profile still passes this test. The test also never asserts entryPath, which addEnvironmentEntry in src/utils/example-esbuild.client.ts uses for the reserved-path collision check.

💚 Proposed additions
+import { exampleEnvironmentNames } from '../src/utils/example-workspace'
+
 test('provides hidden entry modules for every Charts environment', () => {
+  for (const name of exampleEnvironmentNames) {
+    const profile = exampleEnvironmentProfiles[name]
+    assert.equal(typeof profile.createEntrySource, 'function')
+    assert.equal(profile.entryPath, '/__tanstack-example-entry.ts')
+  }
+
   const charts =
     exampleEnvironmentProfiles.charts.createEntrySource('/src/chart.ts')
🤖 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 `@tests/notebook-environment.test.ts` around lines 59 - 76, Update the test
around createEntrySource to iterate over the source-of-truth
exampleEnvironmentNames and validate each corresponding Charts profile, ensuring
missing profiles fail the test. For every generated environment entry, assert
that its configured entryPath is present and retain the existing
environment-specific source assertions where applicable.
tests/markdown-live-example.test.ts (1)

183-194: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add negative cases for zero and duplicate env declarations.

createLiveComponent requires exactly one env in a group and requires it on the entry fence. The list covers an unknown env value and env on a support file. It does not cover a group with no env at all, and it does not cover two fences that both declare a valid env. Both rules are stated in liveDocsRules.

💚 Proposed additions
     'group=counter env=charts file=/main.tsx entry collapsed=false',
     'live=counter file=/main.tsx',
+    'group=counter file=/main.tsx entry',

Add the duplicate-env case as a separate multi-fence fixture next to the checks at lines 219-231.

🤖 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 `@tests/markdown-live-example.test.ts` around lines 183 - 194, Extend the
invalid metadata coverage in the test named “invalid runnable metadata fails
open to static code” with a zero-env case, then add a separate multi-fence
fixture near the existing checks around lines 219-231 where two fences declare
valid env values. Assert both cases fail open to static code, preserving the
rules that each group has exactly one env declaration and the entry fence must
provide it.
🤖 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/utils/markdown/live-example.ts`:
- Around line 174-186: Update transformBlocks and the live-example component
construction so each component receives a unique occurrence-based id, including
for non-adjacent groups with the same name. Pass the occurrence counter into the
component-building flow and append it to attributes.id, while keeping
data-example-group set to the raw group name.

---

Nitpick comments:
In `@src/utils/example-esbuild.client.ts`:
- Around line 139-146: Update compileOctaneSource to preserve and return the
compiler diagnostics alongside code instead of selecting only .code. In the
onLoad callback, consume those diagnostics and map them into esbuild errors
before returning the compiled contents, while retaining the existing successful
compilation behavior.

In `@src/utils/markdown/live-example.ts`:
- Around line 166-172: Update the validation in the live-example parsing
function around entryItem.attributes.file and isExampleEnvironment to reject the
reserved /__tanstack-example-entry.ts path before createExampleWorkspace runs.
Return undefined for that entry so parsing falls back to static code, while
preserving the existing validation for missing or invalid entry and environment
values.
- Around line 188-202: The duplicate-detection path currently reparses meta
independently of parseAttributes, allowing tokenization discrepancies. Extend
parseAttributes to return ordered attribute names alongside parsed values,
update countAttribute’s callers to use those names, and remove
readAttributeNames so both validation and values share the same parser.

In `@tests/markdown-live-example.test.ts`:
- Around line 183-194: Extend the invalid metadata coverage in the test named
“invalid runnable metadata fails open to static code” with a zero-env case, then
add a separate multi-fence fixture near the existing checks around lines 219-231
where two fences declare valid env values. Assert both cases fail open to static
code, preserving the rules that each group has exactly one env declaration and
the entry fence must provide it.

In `@tests/notebook-environment.test.ts`:
- Around line 59-76: Update the test around createEntrySource to iterate over
the source-of-truth exampleEnvironmentNames and validate each corresponding
Charts profile, ensuring missing profiles fail the test. For every generated
environment entry, assert that its configured entryPath is present and retain
the existing environment-specific source assertions where applicable.
🪄 Autofix

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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 1836501d-ce90-4da1-8f45-4fb0248f46f7

📥 Commits

Reviewing files that changed from the base of the PR and between c1697b8 and b291551.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (40)
  • package.json
  • scripts/charts-landing/activation-chart.ts
  • scripts/charts-landing/kinetic-area-chart.ts
  • scripts/charts-landing/kinetic-bar-chart.ts
  • scripts/charts-landing/kinetic-donut-chart.ts
  • scripts/charts-landing/kinetic-dumbbell-chart.ts
  • scripts/charts-landing/kinetic-heatmap-chart.ts
  • scripts/charts-landing/kinetic-layered-chart.ts
  • scripts/charts-landing/kinetic-line-chart.ts
  • scripts/charts-landing/kinetic-lollipop-chart.ts
  • scripts/charts-landing/kinetic-radar-chart.ts
  • scripts/charts-landing/kinetic-scatter-chart.ts
  • scripts/generate-charts-landing-svg.ts
  • src/components/LibraryLayout.tsx
  • src/components/charts/TimeSeriesChart.tsx
  • src/components/examples/ExampleWorkbench.client.tsx
  • src/components/intent/SkillDependencyGraph.tsx
  • src/components/intent/SkillSparkline.tsx
  • src/components/landing/ChartsLanding.tsx
  • src/components/library-layout-navigation.ts
  • src/components/markdown/LiveExample.tsx
  • src/components/npm-stats/NPMStatsChart.tsx
  • src/libraries/libraries.ts
  • src/types/octane-compiler.d.ts
  • src/utils/charts-catalog-example.ts
  • src/utils/charts-catalog.server.ts
  • src/utils/example-esbuild.client.ts
  • src/utils/example-workspace.ts
  • src/utils/markdown/live-example.ts
  • src/utils/notebook-environment.ts
  • src/utils/notebook-examples.ts
  • src/utils/npm-packages.ts
  • tests/charts-catalog-example.test.ts
  • tests/charts-catalog-source.test.ts
  • tests/charts-framework-support.test.ts
  • tests/charts-sidebar-navigation.test.ts
  • tests/example-workspace.test.ts
  • tests/markdown-live-example.test.ts
  • tests/notebook-environment.test.ts
  • tests/octane-framework-support.test.ts

Comment thread src/utils/markdown/live-example.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant