Skip to content

Storybook investigation#145

Merged
eviltester merged 6 commits into
masterfrom
storybook-investigation
May 29, 2026
Merged

Storybook investigation#145
eviltester merged 6 commits into
masterfrom
storybook-investigation

Conversation

@eviltester

@eviltester eviltester commented May 29, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • Added Storybook component library with interactive stories for export format previews (CSV, JSON, SQL, XML, etc.) and test data editors.
    • Added test environment publishing workflow to GitHub Pages for easy preview access.
  • Documentation

    • Updated README with Storybook startup commands and story descriptions.
  • Tests

    • Added test suite for Storybook harness functionality.
  • Chores

    • Updated package configuration and dependencies to support Storybook development environment.

Review Change Stack

Copilot AI review requested due to automatic review settings May 29, 2026 12:36
@coderabbitai

coderabbitai Bot commented May 29, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@eviltester, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 16 minutes and 13 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 5863b9d8-9ba2-4fa8-b64f-fa467b6eb97d

📥 Commits

Reviewing files that changed from the base of the PR and between 46f293b and 417048d.

📒 Files selected for processing (6)
  • .github/workflows/publish-testenv.yml
  • apps/web/src/stories/export-format-code-unit-test-python-pytest.stories.js
  • apps/web/src/stories/export-format-interactions.js
  • apps/web/src/stories/storybook-harnesses.js
  • apps/web/src/tests/jest/storybook/storybook-harnesses.test.js
  • scripts/create-testenv.mjs
📝 Walkthrough

Walkthrough

This PR introduces Storybook 10.4.1 with a comprehensive library of 50+ export format preview stories (covering code languages like JavaScript, Java, Python, and unit test frameworks like Jest, PyTest, JUnit), interactive story harnesses for test-data and grid-preview UI surfaces, and a GitHub Pages deployment pipeline for publishing a static test environment.

Changes

Storybook Framework & Configuration

Layer / File(s) Summary
Storybook Core Configuration
.storybook/main.js, .storybook/preview.js, .storybook/package.json, .gitignore, README.md
Configured Storybook with HTML/Vite framework, story discovery, Vite aliases for @faker-js/faker and @anywaydata/* packages, preview layout/controls/story sorting, and documented Storybook commands and workflows.
Package Dependencies & Scripts
package.json, pnpm-workspace.yaml, apps/web/styles.css
Added Storybook core and addons (@storybook/addon-docs, @storybook/addon-a11y), dev scripts for Storybook, build, and test environment creation; enabled esbuild builds in workspace config; fixed help-icon CSS path from absolute to relative.

Export Format Story Library

Layer / File(s) Summary
Story Factory & Shared Infrastructure
apps/web/src/stories/export-format-story-factory.js
Defines sharedArgTypes for Storybook controls (row limits, formatting options, action callbacks) and createExportPreviewStory factory that merges format-specific defaults and wires story rendering with action extraction.
Export Format Interaction Helpers
apps/web/src/stories/export-format-interactions.js
Exports play functions (playCodePreview, playCsvRoundTrip, playDelimitedOptionsPreview, playJsonOptionsPreview, playPreviewEditMode, playSetTextFromGrid) that simulate user interactions in preview/edit workflows with DOM queries and waitFor assertions.
50+ Export Format Preview Stories
apps/web/src/stories/export-format-*.stories.js
Code preview stories for 9+ languages (JavaScript, TypeScript, Java, Kotlin, Python, Ruby, Perl, PHP, C#); unit test framework stories for 25+ frameworks (Jest, Mocha, Vitest, PyTest, RSpec, Minitest, JUnit variants, MSTest, NUnit, xUnit, TestNG, PHPUnit, Pest, and more); data format stories (ASCII, CSV, Delimited, Gherkin, HTML, JSON, JSONL, Markdown, SQL, XML)—each with StartBlank and Previewed story variants.
Test Data UI Stories
apps/web/src/stories/test-data-embedded-panel.stories.js, apps/web/src/stories/test-data-generator.stories.js
Four-variant story suites (EmptyEditor, SampleSchema, TextModeRoundTrip, ValidationState) for the embedded test-data panel and generator editor, rendered via harness helpers with scenario-specific documentation.

Story Harnesses & Testing

Layer / File(s) Summary
Storybook Harness Implementation
apps/web/src/stories/storybook-harnesses.js
Implements DOM-scoped rendering harnesses with StoryMemoryGrid for in-memory grids, export format UI helpers, ImportExportControls method wrapping (to emit action payloads), and three render entry points: renderEmbeddedTestDataStory, renderGeneratorStory, renderGridPreviewStory (with extensive UI wiring for format selection, text/grid conversion, preview/edit modes, options, copy, download).
Harness Unit Tests
apps/web/src/tests/jest/storybook/storybook-harnesses.test.js
Jest test suite validating harness rendering, callback isolation, format selection, text-to-grid/grid-to-text conversion (including error handling), options application (JSON, CSV, delimited), and preview mode/auto-preview toggling across concurrent stories.

Test Environment Build & Deployment

Layer / File(s) Summary
Build Script
scripts/create-testenv.mjs
Node.js script that orchestrates app and Storybook builds, generates a landing index.html with build metadata (branch, commit SHA, timestamp), and outputs to the testenv/ directory.
GitHub Pages Workflow
.github/workflows/publish-testenv.yml
Publishes the test environment to GitHub Pages on master push or manual trigger via workflow_dispatch; downloads build artifacts and deploys via actions/deploy-pages@v4 with concurrency control.

🎯 4 (Complex) | ⏱️ ~60 minutes

A rabbit hops through a forest of export formats tall,
Fifty stories in the trees—JavaScript, Java, and them all!
With Storybook's light and harnesses true,
Test environments bloom like morning dew. 🐰📚✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Storybook investigation' is vague and generic, using a non-descriptive term that doesn't convey meaningful information about the specific changes in the changeset. Replace the vague title with a specific, descriptive summary of the primary change. For example: 'Add Storybook configuration and export format preview stories' or 'Implement Storybook setup with export preview components'.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch storybook-investigation

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 and usage tips.

Copilot AI 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.

Pull request overview

Introduces a Storybook-based investigation environment for UI components, along with a script and GitHub Pages workflow that publishes a combined static "test environment" (app, generator, Storybook) for review. Adds Storybook configuration, a large set of stories for the Test Data panels and export-format previews, and a Jest test suite covering the new story harnesses.

Changes:

  • Add Storybook 10.4.1 setup (.storybook/, dependencies, pnpm run storybook / build-storybook scripts) with stories for Test Data (embedded panel, generator) and many Export Formats (CSV, JSON, code/unit-test variants, etc.) plus shared harnesses and interaction plays.
  • Add scripts/create-testenv.mjs and .github/workflows/publish-testenv.yml to build and deploy a static testenv bundle (app, generator, Storybook) to GitHub Pages, plus README guidance and .gitignore updates.
  • Add Jest coverage for storybook harnesses and a small CSS path tweak (/images/..../images/...) to support Storybook serving.

Reviewed changes

Copilot reviewed 60 out of 62 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
scripts/create-testenv.mjs New script orchestrating vite + storybook builds and rendering an index page.
.github/workflows/publish-testenv.yml New workflow that builds testenv and deploys to GitHub Pages on push to master.
.storybook/main.js, .storybook/preview.js, .storybook/package.json Storybook config (html-vite framework, aliases, addons).
README.md Documents Storybook usage and story groups.
package.json, pnpm-lock.yaml, pnpm-workspace.yaml Add Storybook deps and esbuild to allowBuilds.
apps/web/src/stories/*.stories.js Story files for Test Data panels and many export formats.
apps/web/src/stories/storybook-harnesses.js Core harness that mounts app fragments and emits Storybook actions.
apps/web/src/stories/export-format-story-factory.js, export-format-interactions.js Shared story factory and Storybook play helpers.
apps/web/src/stories/package.json Marks the stories folder as ES modules.
apps/web/src/tests/jest/storybook/storybook-harnesses.test.js Jest coverage for the harnesses.
apps/web/styles.css Switches helpicon background image to a relative URL for Storybook compatibility.
.gitignore Ignores storybook-static/ and testenv/ outputs.

Comment thread scripts/create-testenv.mjs
Comment thread apps/web/src/stories/storybook-harnesses.js

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 46f293b465

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/web/src/stories/storybook-harnesses.js Outdated
Comment thread apps/web/src/stories/export-format-interactions.js Outdated

@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: 2

🧹 Nitpick comments (3)
apps/web/src/stories/export-format-code-unit-test-jest.stories.js (1)

8-35: ⚡ Quick win

Consider extending documentation pattern to other unit test stories.

The comprehensive documentation and playCodePreview interaction in this Jest story provide excellent context and interactivity. The other unit test framework stories (JUnit, Mocha, Vitest, etc.) currently lack this documentation and interactive demo, which creates an inconsistent user experience across the story library.

Consider applying a similar documentation pattern to the other unit test story files to improve discoverability and consistency across the Storybook UI.

Also applies to: 40-61

🤖 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 `@apps/web/src/stories/export-format-code-unit-test-jest.stories.js` around
lines 8 - 35, The Jest story's docs block
(parameters.docs.description.component) and its interactive play handler
(playCodePreview) provide rich documentation and demo behavior that should be
replicated across the other unit-test stories (e.g., the JUnit, Mocha, Vitest
story modules that define "Start Blank" and "Previewed" stories). For each
unit-test story file, copy the descriptive markdown from
parameters.docs.description.component and wire the same playCodePreview
interaction into the story exports so the preview area and Actions demo behave
identically; ensure story names ("Start Blank", "Previewed") and any
controls/Set Text From Grid button selectors used by playCodePreview are
consistent or adapted per file. Replace only the docs string and play handler
wiring—do not change the story logic—and run Storybook to verify consistent
documentation and interactivity across all unit-test format stories.
apps/web/src/stories/export-format-code-unit-test-python-pytest.stories.js (1)

4-4: 💤 Low value

Consider using official "pytest" capitalization.

The official framework name is "pytest" (lowercase), not "PyTest". For consistency with the project's branding, consider updating the title to match.

♻️ Suggested capitalization fix
-  title: 'Export Formats/Previews/Code (Unit Test)/Python/PyTest',
+  title: 'Export Formats/Previews/Code (Unit Test)/Python/pytest',
🤖 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 `@apps/web/src/stories/export-format-code-unit-test-python-pytest.stories.js`
at line 4, The story title string currently uses "PyTest" which is inconsistent
with the official lowercase branding; update the title value in the file (the
string passed to title, e.g. "Export Formats/Previews/Code (Unit
Test)/Python/PyTest") to use "pytest" instead (so it reads "Export
Formats/Previews/Code (Unit Test)/Python/pytest") to maintain consistent
capitalization across stories.
.github/workflows/publish-testenv.yml (1)

8-11: ⚡ Quick win

Scope permissions to job level for least privilege.

Currently, pages: write and id-token: write are granted at the workflow level, but only the deploy job requires them. The build job only needs contents: read. Following the principle of least privilege, move these permissions to their respective jobs:

🔐 Recommended permission scoping
-permissions:
-  contents: read
-  pages: write
-  id-token: write
-
 concurrency:
   group: pages
   cancel-in-progress: true
 
 jobs:
   build:
     name: Build testenv
     runs-on: ubuntu-latest
+    permissions:
+      contents: read
     env:
   deploy:
     name: Deploy to GitHub Pages
     needs: build
     runs-on: ubuntu-latest
+    permissions:
+      pages: write
+      id-token: write
     environment:
       name: github-pages
       url: ${{ steps.deployment.outputs.page_url }}

As per coding guidelines, this aligns with GitHub Actions security best practices for limiting blast radius of compromised jobs.

🤖 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 @.github/workflows/publish-testenv.yml around lines 8 - 11, The
workflow-level permissions block currently grants permissions: contents: read,
pages: write, id-token: write; restrict these by moving pages: write and
id-token: write into the deploy job's permissions and ensure the build job only
has contents: read (or move workflow-level permissions to none/minimal), i.e.,
update the jobs named "build" and "deploy" so "build" has permissions: contents:
read and "deploy" has permissions: pages: write and id-token: write (add
contents: read to deploy if needed).
🤖 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 @.github/workflows/publish-testenv.yml:
- Around line 27-28: The checkout step ("Check out repository" using
actions/checkout@v4) is leaving credentials persisted and could leak when the
testenv artifact is uploaded; update that step to disable credential persistence
by adding persist-credentials: false (and optionally set fetch-depth: 0 if full
history is needed) so the runner won't retain repository credentials before the
artifact upload.

In `@apps/web/src/stories/storybook-harnesses.js`:
- Around line 113-136: withScopedDocument currently restores document overrides
immediately because it returns callback() inside a try/finally; change it to
capture callback() result, detect if it's a Promise (has a then), and if so
return result.finally(() => { restore document.querySelector, querySelectorAll,
getElementById to originalQuerySelector, originalQuerySelectorAll,
originalGetElementById }); otherwise restore synchronously and return the value.
Update the implementation around the callback invocation in withScopedDocument
to use this promise-aware restore logic so async callbacks (e.g.,
importExportController.importTextArea / _previewThenImportToGrid) see the scoped
document for the full async duration.

---

Nitpick comments:
In @.github/workflows/publish-testenv.yml:
- Around line 8-11: The workflow-level permissions block currently grants
permissions: contents: read, pages: write, id-token: write; restrict these by
moving pages: write and id-token: write into the deploy job's permissions and
ensure the build job only has contents: read (or move workflow-level permissions
to none/minimal), i.e., update the jobs named "build" and "deploy" so "build"
has permissions: contents: read and "deploy" has permissions: pages: write and
id-token: write (add contents: read to deploy if needed).

In `@apps/web/src/stories/export-format-code-unit-test-jest.stories.js`:
- Around line 8-35: The Jest story's docs block
(parameters.docs.description.component) and its interactive play handler
(playCodePreview) provide rich documentation and demo behavior that should be
replicated across the other unit-test stories (e.g., the JUnit, Mocha, Vitest
story modules that define "Start Blank" and "Previewed" stories). For each
unit-test story file, copy the descriptive markdown from
parameters.docs.description.component and wire the same playCodePreview
interaction into the story exports so the preview area and Actions demo behave
identically; ensure story names ("Start Blank", "Previewed") and any
controls/Set Text From Grid button selectors used by playCodePreview are
consistent or adapted per file. Replace only the docs string and play handler
wiring—do not change the story logic—and run Storybook to verify consistent
documentation and interactivity across all unit-test format stories.

In `@apps/web/src/stories/export-format-code-unit-test-python-pytest.stories.js`:
- Line 4: The story title string currently uses "PyTest" which is inconsistent
with the official lowercase branding; update the title value in the file (the
string passed to title, e.g. "Export Formats/Previews/Code (Unit
Test)/Python/PyTest") to use "pytest" instead (so it reads "Export
Formats/Previews/Code (Unit Test)/Python/pytest") to maintain consistent
capitalization across stories.
🪄 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 898636b2-58bf-460e-be7d-0841e74b67fc

📥 Commits

Reviewing files that changed from the base of the PR and between 7e3f84d and 46f293b.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (61)
  • .github/workflows/publish-testenv.yml
  • .gitignore
  • .storybook/main.js
  • .storybook/package.json
  • .storybook/preview.js
  • README.md
  • apps/web/src/stories/export-format-ascii.stories.js
  • apps/web/src/stories/export-format-code-csharp.stories.js
  • apps/web/src/stories/export-format-code-java.stories.js
  • apps/web/src/stories/export-format-code-javascript.stories.js
  • apps/web/src/stories/export-format-code-kotlin.stories.js
  • apps/web/src/stories/export-format-code-perl.stories.js
  • apps/web/src/stories/export-format-code-php.stories.js
  • apps/web/src/stories/export-format-code-python.stories.js
  • apps/web/src/stories/export-format-code-ruby.stories.js
  • apps/web/src/stories/export-format-code-typescript.stories.js
  • apps/web/src/stories/export-format-code-unit-test-csharp-mstest.stories.js
  • apps/web/src/stories/export-format-code-unit-test-csharp-nunit.stories.js
  • apps/web/src/stories/export-format-code-unit-test-csharp-xunit.stories.js
  • apps/web/src/stories/export-format-code-unit-test-java-junit4.stories.js
  • apps/web/src/stories/export-format-code-unit-test-java-junit5.stories.js
  • apps/web/src/stories/export-format-code-unit-test-java-junit6.stories.js
  • apps/web/src/stories/export-format-code-unit-test-java-testng.stories.js
  • apps/web/src/stories/export-format-code-unit-test-javascript-mocha.stories.js
  • apps/web/src/stories/export-format-code-unit-test-javascript-vitest.stories.js
  • apps/web/src/stories/export-format-code-unit-test-jest.stories.js
  • apps/web/src/stories/export-format-code-unit-test-kotlin-junit5-kotlin.stories.js
  • apps/web/src/stories/export-format-code-unit-test-kotlin-kotest.stories.js
  • apps/web/src/stories/export-format-code-unit-test-kotlin-spek.stories.js
  • apps/web/src/stories/export-format-code-unit-test-perl-test-more.stories.js
  • apps/web/src/stories/export-format-code-unit-test-perl-test2-suite.stories.js
  • apps/web/src/stories/export-format-code-unit-test-php-pest.stories.js
  • apps/web/src/stories/export-format-code-unit-test-php-phpunit.stories.js
  • apps/web/src/stories/export-format-code-unit-test-python-nose2.stories.js
  • apps/web/src/stories/export-format-code-unit-test-python-pytest.stories.js
  • apps/web/src/stories/export-format-code-unit-test-python-unittest.stories.js
  • apps/web/src/stories/export-format-code-unit-test-ruby-minitest.stories.js
  • apps/web/src/stories/export-format-code-unit-test-ruby-rspec.stories.js
  • apps/web/src/stories/export-format-code-unit-test-typescript-jest.stories.js
  • apps/web/src/stories/export-format-code-unit-test-typescript-mocha.stories.js
  • apps/web/src/stories/export-format-code-unit-test-typescript-vitest.stories.js
  • apps/web/src/stories/export-format-csv.stories.js
  • apps/web/src/stories/export-format-delimited.stories.js
  • apps/web/src/stories/export-format-gherkin.stories.js
  • apps/web/src/stories/export-format-html.stories.js
  • apps/web/src/stories/export-format-interactions.js
  • apps/web/src/stories/export-format-json.stories.js
  • apps/web/src/stories/export-format-jsonl.stories.js
  • apps/web/src/stories/export-format-markdown.stories.js
  • apps/web/src/stories/export-format-sql.stories.js
  • apps/web/src/stories/export-format-story-factory.js
  • apps/web/src/stories/export-format-xml.stories.js
  • apps/web/src/stories/package.json
  • apps/web/src/stories/storybook-harnesses.js
  • apps/web/src/stories/test-data-embedded-panel.stories.js
  • apps/web/src/stories/test-data-generator.stories.js
  • apps/web/src/tests/jest/storybook/storybook-harnesses.test.js
  • apps/web/styles.css
  • package.json
  • pnpm-workspace.yaml
  • scripts/create-testenv.mjs

Comment thread .github/workflows/publish-testenv.yml
Comment thread apps/web/src/stories/storybook-harnesses.js
@eviltester eviltester merged commit 91984be into master May 29, 2026
7 checks passed
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.

2 participants