Skip to content

Refactor/code organization - #1

Merged
hccancan4 merged 9 commits into
mainfrom
refactor/code-organization
Jun 10, 2026
Merged

Refactor/code organization#1
hccancan4 merged 9 commits into
mainfrom
refactor/code-organization

Conversation

@hccancan4

Copy link
Copy Markdown
Owner

No description provided.

hccancan4 and others added 9 commits June 10, 2026 09:19
Fix all 22 @typescript-eslint/no-unused-vars warnings, nothing else:
- CanvasEditor: drop unused updateComponent/startConnection destructures,
  underscore the unused mousemove event param
- CfdOverlay: drop unused unit/label from the field-stats memo destructure
- ContextMenu: remove the entire react-icons import (icons arrive as JSX
  children from the parent; none used here)
- PortOverlay: remove dead SNAP_DISTANCE const (zero refs repo-wide), unused
  updateConnectionMouse destructure, unused compatible in handlePortEnter
- ComponentShapes: remove dead rad local (YJunction), unused comp param
  (FallbackShape)
- Sidebar: remove unused clsx import
- ExperimentImportDialog: remove vestigial rawText state (set but never read)
- portUtils: remove dead halfBranch local (characterization tests unchanged)

eslint warnings 45 -> 23 (remaining: 18 no-explicit-any, 1 exhaustive-deps,
4 react-refresh — intentionally untouched, behavior/structure risk).
Zero behavior change: tsc 0, vitest 72/72.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Move the four loose root-level overlay/feedback components into a folder,
per CONVENTIONS (components grouped by area): EditorLoading, KeyboardHelp,
Notifications, ProgressOverlay. Sole external importer (App.tsx) updated;
internal relative imports go one level deeper. Move-only, zero behavior
change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-locate the parametric-sweep vertical slice, matching the existing
features/experiment and features/export pattern: SweepDialog (UI),
useSweepStore (state), sweepRunner (batch loop), sweepHelpers (+ its
characterization test). Six external importers re-pointed (App,
useSimulationRun, useProjectIO, StatusBar, ResultsPanel, SweepTab);
sibling imports inside the feature become ./relative. SweepTab stays in
ResultsPanel/tabs/ (it is a results view, like the experiment views).

Move-only, zero behavior change: tsc 0, vitest 72/72 (test discovered at
its new path).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The shipped app actually made CDN calls when online: index.html loaded
Inter + JetBrains Mono from fonts.googleapis.com, and the Tauri CSP
explicitly allowed both Google hosts - contradicting the documented
zero-network guarantee. Inter was referenced nowhere; JetBrains Mono only
as Monaco/Ruler first choice, so the editor rendered differently online
(JetBrains Mono) vs offline (Consolas fallback).

- index.html: drop the two preconnects + Google Fonts stylesheet
- tauri.conf.json CSP: remove fonts.googleapis.com / fonts.gstatic.com
  (tighter CSP; unsafe-inline and data: kept - React inline styles and
  Monaco codicon need them)
- ScriptEditor (Monaco) + Ruler canvas font -> "IBM Plex Mono" (the
  self-hosted design-system font; consistent online/offline)
- drop the now-dead JetBrains Mono fallbacks from design-system.css and
  tailwind.config.js

Intentional, flagged fix: visual change only vs the online-with-CDN state
(editor/ruler font becomes the design-system mono everywhere). Verified:
repo-wide grep for googleapis/gstatic/JetBrains/Inter is zero; tsc 0;
vitest 72/72; build OK; cargo test 36/36; clippy clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Replace the leftover Vite-logo favicon with the real app icon (copy of
src-tauri/icons/32x32.png as public/icon.png). Delete unreferenced
template assets: public/vite.svg, public/tauri.svg, src/assets/react.svg
(src/assets/ folder gone with it). Remove the empty untracked
src/components/ExperimentData/ directory from the working tree.

Verified: no stale references (grep), tsc 0, build OK, icon.png lands in
dist/.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The three root-level .mflow files (parallel_channels, serpentine_mixer,
t_junction_droplet) use the pre-1.0 schema: top-level mflow_version as a
number with a nested design block. The Rust loader (project/mod.rs,
MFlowProject) requires version: String with no serde default, so opening
any of them fails with missing field error - they have been unloadable
dead weight. The loadable examples live in examples/projects/ (correct
schema, kept). Recoverable from git history if ever needed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
None of the three crates is referenced anywhere in src-tauri/src (grep
verified; component ids are generated frontend-side, the solvers use plain
Vec math, and nothing is parallelized via rayon). log + env_logger stay -
they ARE used (lib.rs env_logger::init, log::info in export/). Cargo.lock
regenerated via cargo build.

Zero behavior change: cargo build OK, cargo test --lib 36/36, clippy -D
warnings clean. Leaner dependency tree and faster cold builds.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Remote quality gate mirroring the local husky pre-commit hook: a frontend
job (node 22: npm ci, eslint, tsc, vitest, vite build) and a rust job
(ubuntu + webkit system deps, stable toolchain with clippy, Swatinem
rust-cache: clippy -D warnings, cargo test --lib). Triggers on pushes to
main / refactor/** / fix/** and PRs to main. The build step runs vite
directly since typecheck is its own step (npm run build would re-run tsc).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- delete docs/CODE_QUALITY_REPORT.md (one-off snapshot with pre-refactor
  paths; referenced nowhere; CHANGELOG carries history)
- ARCHITECTURE: utilities table becomes a feature-module table with correct
  features/export, features/experiment, features/sweep paths
- TESTING: Rust total 29 to 36 (real count), scripting 10 to 9 (phantom
  test_clear row removed), gds 5 to 7; new 72-test frontend Vitest section;
  stale "no frontend tests" claims rewritten
- README: CI badge; broken screenshots table replaced by a placeholder
  note; FORMULAS row in docs table; examples block matches the real tree
  (5 data, 5 scripts, 2 loadable projects)
- CODE_MAP: features/sweep flow paths; sweep + overlays rows
- CONVENTIONS: overlays/ and features/sweep examples; feature-store rule
- CHANGELOG: Phase 10 entry (repo structure and hygiene)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@hccancan4
hccancan4 merged commit 8f618c4 into main Jun 10, 2026
4 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.

1 participant