Workspace apps: discovery is hard-wired to the `app` crate, and a missing `discover` call fails silently
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 42/100
Research direction
Start with src/foundation/mod.rs around read_config and register, macros/core/src/testing.rs, and Registrar's seeder API. The issue outlines three possible changes but leaves their design and scope open; first decide which direction to pursue with maintainers, then trace the related discovery and test setup paths. Done means the agreed approach supports workspace crates and has coverage for the behavior described.
Written by the indexing model from the issue text.
Description
Large applications tend to become Cargo workspaces. I'm evaluating Laravel for Rust against a ~380-crate ERP workspace (one crate per screen/routine, grouped by module), and the multi-crate story currently goes through the package mechanism. That works, but a few things are hard-wired to the crate named app:
read_configandregistercallconfig.discover("app"),registrar.discover("app"),registrar.auth.discover("app")andregistrar.seeders.discover("app")(src/foundation/mod.rs#L1021, #L1045-L1048).#[laravel::test]defaults to::app::testing::create(macros/core/src/testing.rs#L64). A workspace crate can't depend onapp, becauseappdepends on it.
Why splitting matters beyond organization: compile times. On stable Rust the front-end of a crate (macro expansion, type checking) runs on one thread, while Cargo checks independent crates in parallel. We measured this on our real workspace (380 crates, ~314k lines in src/, Rust 1.99, 22 logical cores, third-party dependencies already built, no sccache):
| Measurement | Result |
|---|---|
cargo check of all workspace crates, CARGO_INCREMENTAL=0, -j22 |
9.1 s |
Same, -j1 |
51.8 s (so cross-crate parallelism gives 5.7×) |
Per-crate check cost (linear fit over the 380 crates, -j1) |
≈ 0.083 s fixed + 0.061 s per 1,000 lines (R² 0.54) |
| Edit loop, touching a leaf crate (3 dependents) | check 0.75 s, build 2.2 s |
| Edit loop, touching a base crate (311 dependents) | check 3.6 s, build ~8 s |
By that fit, the same ~314k lines in a single app crate would take about 19 s to check on one thread, roughly 2× the split workspace. That's an estimate, not a measurement of a merged crate. Splitting isn't free either: the fixed per-crate cost adds up to ~32 s of the 51.8 s serial total. That's why we'd like granularity to be the application's choice, not something the framework makes awkward.
I'm not asking for automatic provider discovery (I saw #50 was closed). I agree with the reasoning in packages.md that explicit providers keep the startup sequence transparent. The concerns are narrower:
- Silent failure. If a crate defines
#[listener],#[command],#[singleton]or#[schedule::tasks]items but its provider forgetsapp.discover(env!("CARGO_CRATE_NAME")), those items never run, with no warning. I opened #821, which logs a warning at boot naming each undiscovered item. - Seeders can't come from a provider.
Registrarhas no public way to discover#[seeder]functions of another crate, so per-module seeders must be re-exported throughapp. (Auth guards being app-only is documented and seems fine.) - Tests inside a workspace crate must always pass
app = ...and rebuild the application themselves.
Possible directions:
- The boot warning from #821 (or an
about/debug-only check, if you prefer another shape). - Add
app.seeders().discover(crate_name)(or include seeders inRegistrar::discover). - Let the default for
#[laravel::test]be configured once per crate (for example, a crate-level attribute or a documented convention such ascrate::testing::create) instead of the hard-coded::apppath.
- Dominant language
- Rust
- Stars
- 847
- Forks
- 174
- Avg merge
- 5h 40m
- Merged PRs (30d)
- 167
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from laravel/rust-framework
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
laravel/rust-framework#864 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 64/100
laravel/rust-framework#876 ·
Maintainers usually reply within 1 day
-
Case-sensitive contains, starts_with and ends_with that match % and _ literally on every databaseOpen
Difficulty 4/5 3-5 days Newbie friendliness 58/100
laravel/rust-framework#874 ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
laravel/rust-framework#873 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 58/100
laravel/rust-framework#872 ·
Maintainers usually reply within 1 day
All issues in laravel/rust-framework
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
neuralmagic/crucible#579 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
eclipse-score/kyron#249 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
seanmonstar/reqwest#3157 ·
Maintainers usually reply within 2 days