Skip to content

docs(swc): retire story-level JSDoc, description-only tag, and section-order parameter#6352

Open
caseyisonit wants to merge 4 commits into
caseyisonit/docs-mdx-patternsfrom
caseyisonit/docs-retire-description-only
Open

docs(swc): retire story-level JSDoc, description-only tag, and section-order parameter#6352
caseyisonit wants to merge 4 commits into
caseyisonit/docs-mdx-patternsfrom
caseyisonit/docs-retire-description-only

Conversation

@caseyisonit
Copy link
Copy Markdown
Contributor

Description

Final cleanup in the JSDoc-to-MDX conversion chain. Now that components, patterns, and controllers all author their docs page in per-unit MDX (PRs #6349 and #6351), retire the workarounds that JSDoc-on-stories required, and rewrite the authoring rules and migration skills so future contributors learn the new pattern.

This branch is based on caseyisonit/docs-mdx-patterns (SWC-2230). Merge that PR first; this PR depends on it.

Scope:

  • Runtime simplification: SpectrumStories.tsx drops the description-only branch and the section-order sort. validate-story-tags.js removes description-only from the allowed-tags allowlist.
  • Stories-file guidance (.ai/rules/stories-format.md, contributor-docs Phase 4 step, migration-styling skill + template): the stories file is definitions-only. No story-level JSDoc above story exports. Playground uses tags: ['dev'] (no 'autodocs') when a per-unit MDX exists. Genre coverage extended to patterns and controllers.
  • Per-unit MDX authoring guide (.ai/rules/stories-documentation.md): reframed from "what to put in JSDoc above stories" to "what to author in the per-unit MDX". New sections cover the per-unit MDX file template, canonical section order, genre-specific table (MDX path, blocks import path, ApiTable branch for DocsFooter, production-build inclusion), per-story title rules (PascalCase → Title Case, storyName override), single-story-section guidance, and untagged-stories-do-not-render warning.
  • Code conformance (.ai/rules/code-conformance.md): storybook checks now cover both surfaces. Stories file: no story-level JSDoc, no section-order, no description-only, correct Playground tags. Per-unit MDX: file exists, <Meta of={Stories} /> declared once, <DocsHeader />/<DocsFooter /> placement, canonical section order, every section-tagged story surfaced via <Canvas>, controller-API hand-authoring branch.
  • Migration documentation skill (migration-documentation/SKILL.md): Phase 7 now authors the per-component MDX docs page + public-API JSDoc on Component.ts. The Upcoming features pattern moves to MDX prose-only sections.
  • Other skill + index updates (documentation/SKILL.md, .ai/README.md): documentation skill and AI README reflect MDX as the primary 2nd-gen docs surface.

Motivation and context

With per-unit MDX as the docs surface, the runtime workarounds — description-only (suppressing Canvas under JSDoc-only stories) and section-order (sorting stories inside a tag-rendered section) — are no longer needed. Removing them simplifies SpectrumStories.tsx and prevents future contributors from reaching for the retired patterns.

The rule and skill rewrites are the more impactful piece: they teach the new pattern to humans and AI agents authoring docs for new units. Without these updates, contributors would continue authoring story-level JSDoc by following the existing rules, which would no longer match how the docs page actually renders.

Related issue(s)

  • Tracked internally as SWC-2232 under epic SWC-2229.

Screenshots (if appropriate)

N/A — runtime behavior for converted units is unchanged (the dropped logic was unreachable after SWC-2230). Storybook should render identically.

Author's checklist

  • I have read the CONTRIBUTING and PULL_REQUESTS documents.
  • I have reviewed at the Accessibility Practices for this feature, see: Aria Practices
  • I have added automated tests to cover my changes.
  • I have included a well-written changeset if my change needs to be published.
  • I have included updated documentation if my change required it.

Reviewer's checklist

  • Includes a Github Issue with appropriate flag or Jira ticket number without a link
  • Includes thoughtfully written changeset if changes suggested include patch, minor, or major features
  • Automated tests cover all use cases and follow best practices for writing
  • Validated on all supported browsers
  • All VRTs are approved before the author can update Golden Hash

Manual review test cases

  • No remaining description-only or section-order usage in 2nd-gen

    1. From the repo root, run grep -rn "description-only\\|'section-order'" 2nd-gen/packages/ | grep -v node_modules
    2. Expect: no hits (the runtime block and tag allowlist are clean).
  • Docs pages still render

    1. Run yarn storybook in 2nd-gen/packages/swc/
    2. Open a converted unit (e.g. /docs/components-badge--docs, /docs/patterns-conversational-ai-system-message--docs, /docs/core-controllers-focus-group-navigation-controller--docs)
    3. Expect: each renders identically to the patterns branch. No Storybook console errors. Sections appear in canonical order.
  • Updated rules describe the new pattern

    1. Read .ai/rules/stories-format.md and .ai/rules/stories-documentation.md
    2. Expect: the per-unit MDX model is described clearly; story-level JSDoc is explicitly prohibited; genre table covers components, internal components, patterns, and controllers.
  • Migration-documentation skill targets MDX

    1. Read .ai/skills/migration-documentation/SKILL.md
    2. Expect: Phase 7 workflow now authors the per-component MDX file as the primary deliverable; story-level JSDoc is called out as prohibited; public-API JSDoc on Component.ts remains as the second surface.

Device review

  • Did it pass in Desktop?
  • Did it pass in (emulated) Mobile?
  • Did it pass in (emulated) iPad?

Accessibility testing checklist

Required: Complete each applicable item and document your testing steps.

  • Keyboard (required — document steps below)

    1. No interactive surface changes in this PR (rules, skills, and a runtime simplification that produces identical output).
    2. Spot-check one converted Docs page with Tab to confirm focus order through anchor links and Canvas content is unchanged versus the patterns branch.
  • Screen reader (required — document steps below)

    1. With VoiceOver or NVDA, navigate one converted Docs page by heading.
    2. Expect: section headings and per-story titles read in the canonical order. No new announcements introduced by the runtime simplification.

caseyisonit and others added 4 commits May 28, 2026 14:58
…time

With per-unit MDX as the source of truth for docs page layout, the
description-only tag and section-order parameter workarounds are no
longer needed.

- SpectrumStories.tsx: drop the description-only branch (Canvas is now
  always rendered for tagged stories) and the section-order sort
  (stories render in definition order; ordering is hand-authored in
  MDX).
- validate-story-tags.js: remove description-only from the allowed-tags
  allowlist.

The retired patterns are documented in the corresponding rule and skill
updates landing alongside this commit.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Rework stories-format.md and related Phase 5 / contributor-docs guidance
to reflect the per-unit MDX model: the stories file is definitions-only;
story-level JSDoc is not authored; section ordering and prose-only
sections live in MDX.

stories-format.md:

- Frontmatter and scope now cover components, patterns, and controllers
- New "Source of truth: per-unit MDX, not JSDoc" section names the MDX
  location per genre and clarifies that only the meta-level JSDoc is
  retained
- Required tags: drop autodocs from Playground when a per-unit MDX
  exists (avoids duplicate Docs entries); add controller for the
  controller meta tag
- Story types (Playground, Overview, Anatomy, Options, States,
  Behaviors, Accessibility): drop story-level JSDoc requirements and
  examples; redirect prose to MDX
- Do/Don't and checklist updated to match

migration-styling/SKILL.md and stories-template.md:

- Phase 5 scope is now "scaffold the stories file with no story-level
  JSDoc"; Phase 7 authors the per-component MDX
- Template drops section-order params

CONTRIBUTOR-DOCS Phase 4 step:

- Playground guidance: omit autodocs when an MDX file exists
- Options guidance: section ordering is hand-authored in MDX

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Flip stories-documentation.md from "what to put in JSDoc above stories"
to "what to author in the per-unit MDX". Add genre coverage so the rule
applies to components, internal components, patterns, and controllers.
Update code-conformance.md storybook checks to verify both surfaces
(stories file and per-unit MDX).

stories-documentation.md:

- New "Authoring surface: per-unit MDX" section at the top, with file
  template, canonical section order, genre-specific notes table (MDX
  path, blocks import path, Anatomy section presence, ApiTable branch
  for DocsFooter, production-build inclusion)
- Per-story title rules (PascalCase -> Title Case, storyName override)
  and single-story-section subheading guidance
- Untagged-stories-do-not-render guidance to prevent surfacing content
  production excludes
- Existing section patterns reframed: prose lives in MDX under each
  ## Section / ### Story Title heading, not in JSDoc above stories
- Component-linking guidance covers both meta JSDoc and MDX prose
- MDX heading-level convention (h2 sections, h3 stories, h4+ inside
  prose), replacing the previous JSDoc heading-level rule
- Checklist split into Stories file vs Per-unit MDX vs Cross-checks

code-conformance.md:

- Storybook section now checks both the stories file (no story-level
  JSDoc, no section-order, no description-only, drop autodocs from
  Playground when MDX exists) and the per-unit MDX (file exists at
  unit root, Meta of={Stories} declared once, DocsHeader/DocsFooter
  placement, canonical section order, every section-tagged story
  surfaced via Canvas, controller-API hand-authoring branch)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Phase 7 of the migration workflow now authors the per-component MDX file
as the docs surface, not story-level JSDoc.

migration-documentation/SKILL.md:

- Goal updated: per-component MDX docs page + public-API JSDoc on
  Component.ts. Story-level JSDoc is not authored.
- Mindset clarified: meta-level JSDoc is retained (drives Description);
  prose lives in MDX.
- Workflow Step 2 (Phase 5 scaffold check) and Step 3 (write story
  JSDoc) reworked to author the per-component MDX and add the
  Accessibility prose to ## Accessibility. The Upcoming features
  pattern points to MDX prose-only sections rather than description-only
  story exports.
- "What NOT to include" gains a new "Story-level JSDoc" prohibition at
  the top; renamed and rebranded from "stories JSDoc" to "MDX or JSDoc"
  so it covers both surfaces consistently.

documentation/SKILL.md:

- "When to Use" lists MDX docs pages and Component.ts JSDoc explicitly;
  drops the dated "story JSDoc" framing.
- "Key patterns" calls out the three doc surfaces in 2nd-gen
  (per-unit MDX, public-API JSDoc, meta-level JSDoc) and links to the
  per-unit MDX authoring rule.

.ai/README.md:

- Migration phase 7 summary updated to "author the per-component MDX
  + finalize Storybook stories + public-API JSDoc".
- Documentation skill summary covers MDX, public-API JSDoc, meta-level
  JSDoc, and traditional markdown surfaces.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 28, 2026

⚠️ No Changeset found

Latest commit: 1a82bc8

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@caseyisonit
Copy link
Copy Markdown
Contributor Author

I have read through all the proposed changes and agree with them. The updates are the context so nothing to add self review wise.

@caseyisonit caseyisonit marked this pull request as ready for review May 28, 2026 21:07
@caseyisonit caseyisonit requested a review from a team as a code owner May 28, 2026 21:07
@caseyisonit caseyisonit added Component:Documentation Issues or PRs involving changes to docs or docs website. Component prefix is for Jira integration. Status:Ready for review PR ready for review or re-review. 2nd gen These issues or PRs map to our 2nd generation work to modernizing infrastructure. AI tooling labels May 28, 2026
@github-actions
Copy link
Copy Markdown
Contributor

📚 Branch Preview Links

🔍 First Generation Visual Regression Test Results

When a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:

Deployed to Azure Blob Storage: pr-6352

If the changes are expected, update the current_golden_images_cache hash in the circleci config to accept the new images. Instructions are included in that file.
If the changes are unexpected, you can investigate the cause of the differences and update the code accordingly.

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

Labels

2nd gen These issues or PRs map to our 2nd generation work to modernizing infrastructure. AI tooling Component:Documentation Issues or PRs involving changes to docs or docs website. Component prefix is for Jira integration. Status:Ready for review PR ready for review or re-review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant