Skip to content

FE-1534: Run Storybook against the real optimizer service - #9395

Draft
kube wants to merge 1 commit into
cf/fe-1529-local-optimizer-loop-docs-and-launcherfrom
cf/fe-1534-run-storybook-against-the-real-optimizer-service
Draft

FE-1534: Run Storybook against the real optimizer service#9395
kube wants to merge 1 commit into
cf/fe-1529-local-optimizer-loop-docs-and-launcherfrom
cf/fe-1534-run-storybook-against-the-real-optimizer-service

Conversation

@kube

@kube kube commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

🌟 What is the purpose of this PR?

yarn dev:petrinaut-optimization runs 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 --storybook runs Petrinaut's Storybook against the real service.

🔗 Related links

🔍 What does this change?

  • The service adapter moves into @local/petrinaut-optimizer-client as createServicePetrinautOptimization({ 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 its test:unit passes --passWithNoTests since its only test moved.
  • Storybook's Vite server carries the same /api/petrinaut-opt/* proxy as the website's, targeting PETRINAUT_OPT_ORIGIN (harmless when nothing serves it).
  • A "With real optimizer" story under Petrinaut mounts the full editor on the supply-chain-profit net (the model used to demonstrate parameter search) inside a PetrinautOptimizationContext backed by the real service, active when VITE_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.
  • The launcher gains --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.
  • The arch-docs "Running the loop locally" page gains a "With Storybook, for editor work" section.

🐾 How to test

  1. 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.
  2. yarn storybook alone (or plain turbo run dev --filter @hashintel/petrinaut): the story renders launch instructions instead.

Pre-Merge Checklist 🚀

🚢 Has this modified a publishable library?

This PR:

  • modifies an existing block or library which will be updated (@hashintel/petrinaut — a Storybook-only story and lint override; changeset included)

📜 Does this require a change to the docs?

The changes in this PR:

  • require changes to docs which are made as part of this PR

🕸️ Does this require a change to the Turbo Graph?

The changes in this PR:

  • do not affect the execution graph

🤖 Generated with Claude Code

@kube kube self-assigned this Aug 28, 2026
@vercel

vercel Bot commented Aug 28, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hash Ready Ready Preview Aug 28, 2026 1:55am
petrinaut Ready Ready Preview Aug 28, 2026 1:55am
petrinaut-docs Ready Ready Preview Aug 28, 2026 1:55am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
hashdotdesign-tokens Ignored Ignored Aug 28, 2026 1:55am

Request Review

@github-actions github-actions Bot added area/deps Relates to third-party dependencies (area) area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) type/eng > frontend Owned by the @frontend team type/eng > backend Owned by the @backend team area/apps area/apps > hash.design Affects the `hash.design` design site (app) labels Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/apps > hash.design Affects the `hash.design` design site (app) area/apps area/deps Relates to third-party dependencies (area) area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) type/eng > backend Owned by the @backend team type/eng > frontend Owned by the @frontend team

Development

Successfully merging this pull request may close these issues.

1 participant