FE-1534: Run Storybook against the real optimizer service - #9395
Draft
kube wants to merge 1 commit into
Draft
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🌟 What is the purpose of this PR?
yarn dev:petrinaut-optimizationruns the real optimizer behind the demo website, but the website consumes Petrinaut's built dist, so editor changes need a rebuild. Storybook builds the editor from source with fast refresh, but only offered a fake optimizer. This combines them:yarn dev:petrinaut-optimization --storybookruns Petrinaut's Storybook against the real service.🔗 Related links
🔍 What does this change?
@local/petrinaut-optimizer-clientascreateServicePetrinautOptimization({ endpoint, fetchImpl }): the client construction plus the error-classification fields (category,httpStatus,retryAfter) Petrinaut's optimization provider reads for its reconnect logic. It was website-only code; now the website and Storybook share one implementation, and its tests move with it. The website file shrinks to its dev-proxy endpoint plus a delegation, and itstest:unitpasses--passWithNoTestssince its only test moved./api/petrinaut-opt/*proxy as the website's, targetingPETRINAUT_OPT_ORIGIN(harmless when nothing serves it).PetrinautOptimizationContextbacked by the real service, active whenVITE_PETRINAUT_OPT_PROVIDER=service; otherwise it renders instructions for launching. Story files are exempted from the "no unpublished local packages" lint rule — stories are not part of the published build, which is that rule's premise.--storybook: identical container lifecycle, but it skips the dist build (Storybook serves the editor from source) and starts Storybook through Turborepo with the provider environment; remaining arguments forward to the dev server in both modes.🐾 How to test
yarn dev:petrinaut-optimization --storybook, open the Petrinaut → With real optimizer story, create an optimization study in Simulate mode — it runs on the local container, and editor source edits fast-refresh.yarn storybookalone (or plainturbo run dev --filter @hashintel/petrinaut): the story renders launch instructions instead.Pre-Merge Checklist 🚀
🚢 Has this modified a publishable library?
This PR:
@hashintel/petrinaut— a Storybook-only story and lint override; changeset included)📜 Does this require a change to the docs?
The changes in this PR:
🕸️ Does this require a change to the Turbo Graph?
The changes in this PR:
🤖 Generated with Claude Code