Skip to content

Petrinaut: Remove linter warnings#8731

Merged
kube merged 6 commits into
mainfrom
cf/petrinaut-clean-oxlint-warnings
May 20, 2026
Merged

Petrinaut: Remove linter warnings#8731
kube merged 6 commits into
mainfrom
cf/petrinaut-clean-oxlint-warnings

Conversation

@kube
Copy link
Copy Markdown
Collaborator

@kube kube commented May 19, 2026

🌟 What is the purpose of this PR?

Clean up Petrinaut lint diagnostics after the React Compiler/Oxlint updates, keeping behavior equivalent while replacing duplicated or lint-hostile patterns with clearer local helpers.

🔍 What does this change?

  • Adds small React helpers for latest values, stable callbacks, source-keyed draft fields, and subscription-backed value stores.
  • Refactors editor panels/components to avoid stale prop-to-state sync, unsafe ref access, and repeated validation input code.
  • Makes Spreadsheet controlled and clamps selection/focus/editing state against current data.
  • Tightens story-provider, drawer, resize, LSP, and timeline effects so subscriptions and cleanup are explicit.
  • Promotes Petrinaut React Compiler plugin diagnostics from warnings to errors.
  • Documents intentional lint/compiler opt-outs where the code relies on them.

Pre-Merge Checklist 🚀

🚢 Has this modified a publishable library?

This PR:

  • does not modify any publishable blocks or libraries, or modifications do not need publishing

📜 Does this require a change to the docs?

The changes in this PR:

  • are internal and do not require a docs change

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

The changes in this PR:

  • do not affect the execution graph

🛡 What tests cover this?

  • yarn workspace @hashintel/petrinaut lint:tsc
  • yarn workspace @hashintel/petrinaut lint:eslint
  • yarn workspace @hashintel/petrinaut test:unit

❓ How to test this?

  1. Run the checks above.
  2. Spot-check Petrinaut editor flows touched by the cleanup: property-panel field edits, spreadsheet initial-state edits, left-sidebar/search keyboard navigation, and simulation timeline playback.

@kube kube requested a review from a team as a code owner May 19, 2026 08:47
@vercel
Copy link
Copy Markdown

vercel Bot commented May 19, 2026

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

Project Deployment Actions Updated (UTC)
hash Ready Ready Preview, Comment May 20, 2026 8:45am
petrinaut Ready Ready Preview, Comment May 20, 2026 8:45am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
hashdotdesign-tokens Ignored Ignored Preview May 20, 2026 8:45am

@cursor
Copy link
Copy Markdown

cursor Bot commented May 19, 2026

PR Summary

Medium Risk
Moderate risk due to refactors in interactive editor UI (controlled Spreadsheet, selection/focus clamping, and new subscription-based state stores) that could subtly change runtime behavior despite aiming for equivalence.

Overview
Promotes React Compiler-related react-hooks-js/* oxlint rules to errors and refactors Petrinaut to comply, replacing render-time ref writes/prop→state syncing patterns with safer primitives.

Adds small helpers (createValueStore + useSyncExternalStore integration, useDraftField, DraftFieldInput, and clampIndex) and applies them across the editor: property panel name/identifier fields now share draft+validation behavior, list/search keyboard focus uses index clamping instead of syncing effects, and Spreadsheet becomes fully controlled (parent-owned data) with local UI state clamped against current rows.

Tightens lifecycle/cleanup in a few places (e.g. LSP client provider, drawer mounting, simulation timeline streaming store, Storybook provider subscriptions, resize drag callback refs) and documents/isolates intentional compiler/lint opt-outs (e.g. runtime visualizer component creation, useFiringDelta ref read).

Reviewed by Cursor Bugbot for commit cc9da36. Bugbot is set up for automated code reviews on this repo. Configure here.

@augmentcode
Copy link
Copy Markdown

augmentcode Bot commented May 19, 2026

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.

@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 area/apps type/legal Owned by the @legal team area/apps > hash.design Affects the `hash.design` design site (app) labels May 19, 2026
@kube kube changed the base branch from main to cf/fe-725-extract-hashintelpetrinautcore-into-hashintelpetrinaut-core May 19, 2026 08:49
@github-actions github-actions Bot removed area/deps Relates to third-party dependencies (area) area/infra Relates to version control, CI, CD or IaC (area) area/apps type/legal Owned by the @legal team area/apps > hash.design Affects the `hash.design` design site (app) labels May 19, 2026
@kube kube force-pushed the cf/petrinaut-clean-oxlint-warnings branch from c5fe123 to 87d19e3 Compare May 19, 2026 13:14
Comment thread libs/@hashintel/petrinaut/src/ui/components/spreadsheet.tsx Outdated
Comment thread libs/@hashintel/petrinaut/src/ui/resize/use-resize-drag.ts Outdated
@kube kube force-pushed the cf/fe-725-extract-hashintelpetrinautcore-into-hashintelpetrinaut-core branch 2 times, most recently from 577c80f to a0dd9b1 Compare May 19, 2026 16:51
@kube kube force-pushed the cf/petrinaut-clean-oxlint-warnings branch from b43512e to b06baf9 Compare May 19, 2026 17:55
- Strengthen useLatest JSDoc about which read sites are safe given the
  layout-effect write.
- Make Spreadsheet fully controlled — derive tableData from the prop and
  clamp selection/focus/editing at render time, dropping the
  reference-identity SourceKeyedValue pattern that lost local state on
  parent re-renders with a fresh outer array.
- Subscribe per net handle once via a ref-tracked map in the story
  provider, instead of tearing down every subscription whenever a new
  net is added.
- Extract the duplicated clampIndex helper from the side-bar and search
  subviews into ui/lib.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

There are 3 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 4aca92d. Configure here.

vilkinsons
vilkinsons previously approved these changes May 20, 2026
@kube kube added this pull request to the merge queue May 20, 2026
Merged via the queue into main with commit 5b8c159 May 20, 2026
44 checks passed
@kube kube deleted the cf/petrinaut-clean-oxlint-warnings branch May 20, 2026 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/libs Relates to first-party libraries/crates/packages (area) type/eng > frontend Owned by the @frontend team

Development

Successfully merging this pull request may close these issues.

3 participants