FE-725: Create @hashintel/petrinaut-core package#8730
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
PR SummaryMedium Risk Overview Removes the Improves editor UX around long-running experiments/simulation. Adds a shared notifications system ( Reviewed by Cursor Bugbot for commit 6ff0fa5. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
This pull request is abnormally large and would use a significant amount of tokens to review. If you still wish to review it, comment "augment review" and we will review it. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a9d4c58. Configure here.
| const value: NotificationsContextValue = { | ||
| addNotification, | ||
| dismissNotification, | ||
| }; |
There was a problem hiding this comment.
Unstable context value causes simulation subscription churn
Medium Severity
NotificationsProvider defines addNotification and dismissNotification as plain functions recreated on every render, and the value object is also recreated without useMemo. This makes every consumer re-render when NotificationsProvider re-renders. Critically, SimulationProvider includes addNotification in its useEffect dependency array (line 159), so every re-render of NotificationsProvider tears down and re-creates the simulation event subscription. Other providers in the codebase use useStableCallback or useCallback to avoid exactly this pattern.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit a9d4c58. Configure here.
| scope.postMessage(message); | ||
| }, | ||
| onMessage(listener) { | ||
| scope.addEventListener("message", ({ data }) => listener(data)); |
2505197 to
36ba6da
Compare


🌟 What is the purpose of this PR?
Extracts the headless Petrinaut model, simulation, Monte Carlo, and LSP logic into
@hashintel/petrinaut-coreso@hashintel/petrinautcan focus on React/UI integration while consuming a publishable core package.🔗 Related links
🔍 What does this change?
@hashintel/petrinaut-corewith headless exports, package/build config, tests, README, and dedicated worker entry points for LSP, simulation, and Monte Carlo.SNAP_GRID_SIZEas a UI alias of coreGRID_SIZE.@hashintel/petrinautand@apps/petrinaut-websiteto consume core APIs from@hashintel/petrinaut-core.vscode-languageserver-typesdependency.@hashintel/petrinaut-coreand bumping@hashintel/petrinaut.Pre-Merge Checklist 🚀
🚢 Has this modified a publishable library?
This PR:
📜 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:
turbo.json's have been updated to reflect this🐾 Next steps
@hashintel/petrinautand@hashintel/petrinaut-corein follow-up PRs.🛡 What tests cover this?
yarn workspace @hashintel/petrinaut-core lint:tsc && yarn workspace @hashintel/petrinaut-core build && yarn workspace @hashintel/petrinaut-core test:unit runyarn workspace @hashintel/petrinaut lint:tsc && yarn workspace @hashintel/petrinaut build && yarn workspace @hashintel/petrinaut test:unit runyarn workspace @apps/petrinaut-website lint:tsc && yarn workspace @apps/petrinaut-website buildyarn constraints❓ How to test this?
@hashintel/petrinaut-core,@hashintel/petrinaut, and@apps/petrinaut-website.