Skip to content

refactor(web-gen): extract web-gen-core (crate split step 1, #8960) - #12876

Merged
dezren39 merged 1 commit into
mainfrom
lane-dx/8960-web-gen-core
Nov 23, 2026
Merged

dezren39 merged 1 commit into
mainfrom
lane-dx/8960-web-gen-core

Conversation

@dezren39

@dezren39 dezren39 commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Step 1 of the pkgs/web-gen crate split (#8958): extract web-gen-core.

What

  • pkgs/web-gen becomes a Cargo workspace (root package + crates/web-gen-core); shared rand/futures versions pinned in [workspace.dependencies]. Step 0 (pkgs/web-gen crate split — step 0: workspace conversion + baselines (no code motion) #8959) closed with the baseline recorded but the conversion unlanded — the project did not build at the time — so the conversion lands here as the mechanical prerequisite for a member crate. No other step's extraction is bundled.
  • The six pure helpers (generate_random_number, generate_divisible_i_from_n_up_to_m, generate_random_number_and_multiply, parse_input, generate_random_number_and_multiply_result, generate_random_number_and_multiply_str_future) move verbatim from src/main.rs into web-gen-core (leaf: rand + futures only, no Leptos/wasm deps). The moved code now exists solely in the new crate.
  • Components in main.rs call the helpers through the web_gen_core:: path; imports and direct rand/futures dependencies that only the helpers used leave the binary crate.
  • 10 unit tests added for the helpers in web-gen-core (the project's first tests; they were previously untested). Each test names its oracle: i32::from_str semantics for parse_input, the 0..101 draw range and its scaling bounds for the random helpers, the n..m subject walk with integer division for the divisible table, and error pass-through/stringification for the result/future variants.

Behavior

Behavior-preserving: no functional changes, no dependency version bumps (identical versions, re-declared via the workspace), no renames beyond the crate-path move.

Verification

  • cargo test -p web-gen-core --offline: 10 passed, 0 failed.
  • cargo check --locked --offline (via ~/tools/fleet-build-lock, stable): passes.
  • cargo test --workspace --offline: passes.
  • cargo fmt -- --check: clean.

Prerequisite #12274 (stable Leptos build restore) is closed via #12369, so this step's extraction is unblocked.

Closes #8960.


Prove it works
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Convert pkgs/web-gen to a Cargo workspace (root package + crates/
web-gen-core; shared rand/futures versions pinned in
[workspace.dependencies]) — step 0 (#8959) closed with the baseline
recorded but the conversion unlanded, so it lands here as the
mechanical prerequisite for a member crate.

Move the six pure helpers verbatim from src/main.rs into web-gen-core
(leaf: rand + futures only, no Leptos/wasm deps). Components call them
through the web_gen_core:: path; the moved code exists solely in the
new crate. Add the project's first tests: 10 unit tests for the
helpers, each naming its oracle (from_str semantics, the 0..101 draw
range and scaling bounds, the n..m subject walk, error pass-through).

Behavior-preserving: no functional changes, no dependency version
bumps, no renames beyond the crate-path move.

Verified: cargo test --workspace --offline green (10 passed),
cargo check --locked --offline green on stable via fleet-build-lock,
cargo fmt -- --check clean.
@dezren39
dezren39 requested a review from a team as a code owner November 23, 2026 04:15
@coderabbitai

coderabbitai Bot commented Nov 23, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 14 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 487daa35-ab32-4b01-a356-4faea1eda7d0
Commits

Reviewing files that changed from the base of the PR and between 8e79a27 and 71f5989.

Files ignored due to path filters: 1

  • pkgs/web-gen/Cargo.lock is excluded by !**/*.lock
Files selected for processing: 4

  • pkgs/web-gen/Cargo.toml
  • pkgs/web-gen/crates/web-gen-core/Cargo.toml
  • pkgs/web-gen/crates/web-gen-core/src/lib.rs
  • pkgs/web-gen/src/main.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

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.

pkgs/web-gen crate split — step 1: extract web-gen-core (pure helpers, leaf)

1 participant