Skip to content

Rust Rewrite with Deck Federation and Yaml Deck Source#60

Open
jeprecated wants to merge 142 commits into
masterfrom
rust-brainbrew
Open

Rust Rewrite with Deck Federation and Yaml Deck Source#60
jeprecated wants to merge 142 commits into
masterfrom
rust-brainbrew

Conversation

@jeprecated

@jeprecated jeprecated commented May 25, 2026

Copy link
Copy Markdown
Owner

Issue/Discussion #4 is now achieved with this full rewrite. Only 6 years later! 😁

Ultimate Geography (in its entirety) is now a test fixture. The CrowdAnki output from before the rewrite and now is identical and fully tested for all regressions.

If its the same then why bother? This rewrite adds the following cababilities:

  • Deck Federation 😍 decks can be composed between one another. Add new fields, new cards, new templates, new note types, remove cards, translate any string in the deck. It all just works
    • Translations specifically are handled on a string by string basis, with the ability to override for a particular note/field, and errors if not all strings are translated
  • Yaml deck type 💪 a "CanonicalDeck" is now a deck.json. Csvs are dead, and should stay dead!
  • Extendable and understandable code. The code is split into three libraries: core, cli, formats. This setup is very flexible and will allow for easy changes in the future. I have plans for a web view (using the rust Iced framework) where one can import a deck, apply overlays, and see the changes live. Or an Anki extension where one can pick and choose which decks to combine / overlays to apply on import. These two would be rather than a repo having to output each and every possible combination of deck/overlay combinations.

I took a lot of inspiration from declarative systems like NixOS while doing this.

This is a work in progress, and thus marked as an alpha for now. Though parity in the output is achieved, which is the main concern. More to come.

jeprecated added 30 commits July 4, 2026 17:23
De-risk runtime swap, not a rewrite. Removes the entire iced/wgpu/tiny-skia
tree and replaces it with a minimal Leptos 0.8 CSR bootstrap, keeping the
imperative DOM layer (publish_*, event Closures, generation counters,
localStorage helpers) byte-for-byte functional.

- Cargo.toml: drop both iced deps; add leptos 0.8.20 (csr) + console_error_panic_hook
  under the wasm32 target; description now says Leptos.
- main.rs: wasm32 entry mounts leptos::mount::mount_to_body(App) with panic hook;
  native main() is empty so --all-targets builds stay green.
- lib.rs: delete run()/theme()/WorkbenchApp/Message/the Iced view()/panel() and
  the now-orphaned native no-op stubs. Add a wasm32-gated Leptos App component
  that, on mount, performs exactly the former bootstrap: probe -> loading, then
  fetch /api/workspace -> publish_workspace_probe(loaded/error) and fetch note
  pivot -> publish_note_pivot_panel / swallow stale / publish_note_pivot_error.
  Exact status strings preserved (asserted by E2E). WorkspaceSummary and
  from_workspace_json unchanged (tests/workspace_summary.rs untouched, green).
- crates/brain-brew-cli/assets/workbench: regenerated via workbench-ui-embed;
  shipped wasm shrinks 3.69MB -> 386KB with zero iced/wgpu strings.

Cargo.lock: wasm-bindgen held at 0.2.125 (no skew vs nix cli 0.2.121); iced/
wgpu/tiny-skia removed entirely.

Validation: fmt:check clean; workspace tests (excl e2e) green; clippy -D warnings
clean (native + wasm32); trunk WASM build succeeds; 13/13 E2E green. Zero edits
to the e2e oracle, the server, index.html, or tests/workspace_summary.rs.
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