diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index ef96b07..5e0d851 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -20,12 +20,12 @@ notes, and contacts. - Leptos 0.8.20 (SSR + hydration), reactive_stores 0.4.3 for state - leptos_actix 0.8.7 + actix-web 4 for the server - nucleo-matcher for fuzzy item search, num-format for number display, - chrono for dates, lazy_static for one-time data loading + chrono for dates, std::sync::LazyLock for one-time data loading - SCSS sources in `style/` (compiled by cargo-leptos) - Bundled game data in `data/` (5e.tools-format JSON, ~3.9 MB total) Features: `ssr` (server binary), `hydrate` (WASM), `csr` (optional pure-client -mode for `trunk`). `Cargo.lock` is gitignored. +mode for `trunk`). `Cargo.lock` is tracked for reproducible builds. ## Directory layout @@ -73,10 +73,9 @@ nothing is persisted. The header's Save/Load/Clear buttons do nothing yet ## Data layer (items) -- `statics::ITEMS_REFS` is a `lazy_static` map of name → `BookItem`, built +- `statics::ITEMS_REFS` is a `LazyLock` map of name → `BookItem`, built once by `utils::read_items` over the bundled JSON files (`items.json`, - `base.json`, `foundry.json` loaded twice — a known duplication — and - `magic.json`), roughly 5k items. + `base.json`, `foundry.json`, `magic.json`), roughly 5k items. - `BookItem` keeps `name`, `weight`, `rarity`, and `rest`, which holds all other JSON fields verbatim for future detail views. - Duplicate names merge: the later entry fills a missing weight and appends @@ -155,11 +154,10 @@ currently mounted on any page. - Prepared spells list is empty; `Spell` is a name-only stub; attunements have no UI; `Settings` is empty - Save/Load/Clear buttons and the item "+"/"…" buttons are dead -- `foundry.json` is loaded twice; ~3.9 MB of JSON is bundled into the WASM - and parsed on startup -- Several unused dependencies (`leptos-use`, `dotenvy`, - `pretty_env_logger`, `seq_macro`, `itertools`, `thiserror`) and 12 - compiler warnings -- `Cargo.lock` is gitignored, so builds are not reproducible +- `foundry.json` was loaded twice (fixed); ~3.9 MB of JSON is bundled + into the WASM and parsed on startup +- Several unused dependencies (see `MODERNIZE.md`); kept for now by + decision +- `Cargo.lock` is tracked since 2026-08-04; builds are reproducible See [ROADMAP.md](./ROADMAP.md) for the ordered plan to fix these. diff --git a/MODERNIZE.md b/MODERNIZE.md index 78bdc15..ec95bae 100644 --- a/MODERNIZE.md +++ b/MODERNIZE.md @@ -8,10 +8,11 @@ Status notes: - Every "unused" claim below was verified with a grep: 0 references in `src/`. - Toolchain decision: stay on nightly (channel = "nightly"). The stable-Rust item is listed for awareness only. -- The item 3.2 note about the double `foundry.json` load stays true. - Dependency decision (2026-08-04): `itertools`, `thiserror`, `anyhow`, `pretty_env_logger`, `dotenvy` stay for certain. The rest of section 1 is under consideration. +- Applied 2026-08-04: `lazy_static` → `std::sync::LazyLock` (section 2.1). + Everything else in this file is still pending. ## 1. Unused dependencies @@ -35,7 +36,8 @@ under consideration. ## 2. Replace crates with std or small local code 1. **`lazy_static` → `std::sync::LazyLock`** (stable since 1.80). - Rewrite `src/statics/mod.rs`: + APPLIED 2026-08-04: `src/statics/mod.rs` now uses `LazyLock`; + `lazy_static` removed from `Cargo.toml`. Reference sketch: ```rust use std::sync::LazyLock; diff --git a/ROADMAP.md b/ROADMAP.md index 700dcdb..39f808a 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -54,16 +54,19 @@ The MVP is done when a player can run a real session with the app: Cheap, unblocks the rest. Can happen any time; do it first. -- [ ] rewrite README (currently the stock template) -- [ ] deduplicate `foundry.json` load in `src/statics/mod.rs` (loaded twice) -- [ ] clear compiler warnings (unused imports, unused `qty` in `item.rs`) -- [ ] decide Cargo.lock policy — currently gitignored, builds are non-reproducible; commit it -- [ ] dependency and idiom cleanup — see `MODERNIZE.md` (drop unused deps, +- [x] rewrite README (currently the stock template) +- [x] deduplicate `foundry.json` load in `src/statics/mod.rs` (loaded twice) +- [x] clear compiler warnings (unused imports, unused `qty` in `item.rs`) +- [x] decide Cargo.lock policy — currently gitignored, builds are non-reproducible; commit it + (done: committed 2026-08-04) +- [~] dependency and idiom cleanup — see `MODERNIZE.md` (drop unused deps, `lazy_static` → `LazyLock`, local replacements for `num-format`/`num-traits`) -- [ ] decide on the under-consideration unused deps from `MODERNIZE.md` + (done: `lazy_static` → `LazyLock` only; the rest stays pending) +- [~] decide on the under-consideration unused deps from `MODERNIZE.md` (`seq-macro`, `leptos-use`, `http`, `console_log`, `js-sys`); the rest (`itertools`, `thiserror`, `anyhow`, `pretty_env_logger`, `dotenvy`) stay -- [ ] replace `end2end/tests/example.spec.ts` with a smoke test (app boots, nav renders, no console errors) + (decision: nothing removed; revisit later) +- [x] replace `end2end/tests/example.spec.ts` with a smoke test (app boots, nav renders, no console errors) ## Phase 1 — Persistence: localStorage + JSON export/import (L, ~3-5 days)