Skip to content

react: expose per-component RCM extraction (docgen phase 2)#34956

Closed
JReinhold wants to merge 3 commits into
claude/wizardly-bartik-cc2705from
claude/docgen-phase-2-rcm-per-component
Closed

react: expose per-component RCM extraction (docgen phase 2)#34956
JReinhold wants to merge 3 commits into
claude/wizardly-bartik-cc2705from
claude/docgen-phase-2-rcm-per-component

Conversation

@JReinhold
Copy link
Copy Markdown
Contributor

What I did

Phase 2 of the docgen service rollout — telescoping on top of #34954. Targets that PR's branch as its base; merge after #34954 lands.

Adds `ComponentMetaManager.extractDocForComponent(storyRefs)` — a thin wrapper around the existing `batchExtract` that returns the first resolved `ComponentDoc`. The docgen open service will call this once per componentId in phase 3; keeping the helper on `ComponentMetaManager` means successive calls share the file-snapshot cache, TS program, and watcher already maintained there.

`batchExtract` already accepts an arbitrary subset of `StoryRef[]` and the manifest preset is its only existing caller — so per-component extraction has been possible all along, just not exposed as a first-class entry point with the right shape for a non-batch consumer. This PR makes that pattern explicit.

Three new tests cover the surface that matters for the docgen use case:

  1. Returning a `ComponentDoc` for a single-component subset.
  2. Sharing `fsFileSnapshots` across separate per-component calls (proves cache reuse).
  3. Producing fresh docs after an `onFilesChanged`-driven invalidation between calls (proves cache invalidation).

Telescoping plan

  1. #34954 — phase 1: DocgenService scaffolding + middleware preset + React mock provider
  2. This PR: phase 2: per-component RCM extraction entry point
  3. (next) phase 3: replace the React mock provider with a real RCM-backed provider that calls `extractDocForComponent`

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

No user-visible change in this PR — it only adds a programmatic entry point used by future docgen work. The new tests fully cover the behavior.

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add `ci:normal`, `ci:merged` or `ci:daily` GH label
  • Make sure this PR contains one of the labels below: `bug`, `maintenance`, `build`, `cleanup`, `feature request`, etc.

🦋 Canary release

This PR does not have a canary release associated.

🤖 Generated with Claude Code

Adds ComponentMetaManager.extractDocForComponent(storyRefs) — a thin
wrapper around batchExtract that returns the first resolved ComponentDoc.
The docgen open service will call this once per componentId in phase 3;
keeping the helper on ComponentMetaManager means successive calls share
the file-snapshot cache, TS program, and watcher already maintained
there.

Three new tests cover the surface that matters for the docgen use case:
returning a doc for a single-component subset, sharing fsFileSnapshots
across separate per-component calls, and producing fresh docs after an
onFilesChanged-driven invalidation.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 28, 2026

Fails
🚫

PR is not labeled with one of: ["cleanup","BREAKING CHANGE","feature request","bug","documentation","maintenance","build","dependencies"]

🚫

PR is not labeled with one of: ["ci:normal","ci:merged","ci:daily","ci:docs"]

🚫 PR title must be in the format of "Area: Summary", With both Area and Summary starting with a capital letter Good examples: - "Docs: Describe Canvas Doc Block" - "Svelte: Support Svelte v4" Bad examples: - "add new api docs" - "fix: Svelte 4 support" - "Vue: improve docs"
Warnings
⚠️

This PR targets claude/wizardly-bartik-cc2705. The default branch for contributions is next. Please make sure you are targeting the correct branch.

Generated by 🚫 dangerJS against be76928

@JReinhold
Copy link
Copy Markdown
Contributor Author

Folded into #34963 — phase 2 was small enough that keeping it as a separate PR didn't add value. The per-component RCM extraction (and its three tests) lives in the combined phase-2-and-3 branch.

@JReinhold JReinhold closed this May 29, 2026
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