[workspace] resolver = "2" members = [ "crates/core", "crates/geo", "crates/scenario", "crates/vio", "crates/gnss", "crates/human", "crates/face", "crates/materials", "crates/e2ee", "crates/chat", "crates/web_chat", "crates/calls", "crates/simulator", "crates/atlas", "crates/server", "crates/viewer", "crates/cartopolis", "crates/cartopolis_android", "crates/mcp_server", "crates/voice", "crates/big_space", "crates/web_task", "crates/mithril_bevy", ] default-members = ["crates/cartopolis"] # Not members, unlike `web_task`: they are dependencies patched in below, and as # members `cargo test --workspace` would build and run all of their doctests. exclude = ["crates/wgpu", "crates/bevy_shader", "crates/mvt_reader", "crates/tract_tflite"] [workspace.package] version = "1.0.0" edition = "2021" # `MIT OR Apache-2.0`: the Rust ecosystem's default pair, and the licence of the # vendored `big_space` fork in `crates/big_space`, so the notice obligations for # the largest piece of third-party *source* in this tree line up with our own. # `LICENSE` says the rest; `LICENSE-THIRD-PARTY.md` is the notice for everything # that is not source — the map data, the models, the font. # # Declaring it here does not apply it: a crate only picks it up by writing # `license.workspace = true` in its own `[package]`, the way each already does # for `version`. Every member does. license = "MIT OR Apache-2.0" # Warnings are a signal only while there are none standing. The wasm lane carried # twelve dead-code warnings for weeks — native-only code missing its # `cfg(not(target_arch = "wasm32"))` — and the cost was not the code, it was that # nobody could see a *new* warning arrive in that list. `unused` is the group that # rotted (it contains `dead_code`, `unused_imports`, `unused_must_use` and the # rest), so it is the group that is denied. # # In the manifest rather than `RUSTFLAGS` in CI, for two reasons: it costs no # rebuild (the level is baked into the crate, so the fingerprint is the one cargo # already has), and it is opt-in per crate, which is how `crates/big_space` stays # out. That vendored fork is kept diff-comparable with upstream and carries # upstream's own `[lints]` — the same reason it is excluded from the fmt gate. # # Opted into by a `[lints] workspace = true` in each owned crate. It binds local # builds too, so an in-progress unused binding is an error, not a warning: # `cargo check` names the lint and `#[allow(unused)]` on the item is the escape # hatch while you iterate. Note this also binds the Android target, which no CI # lane compiles — if `build-apk.sh` ever fails on a lint, that is this rule, and # the fix is the gate, not the lint level. [workspace.lints.rust] unused = "deny" [workspace.dependencies] anyhow = "1.0" # `default-features = false`, and it is not a size trim — it is what keeps the # whole Bevy stack down to one artifact per build. # # `approx` is `cartopolis_core`'s dev-dependency *and* a dependency of # `bevy_winit`, which asks for it with no features. Taking the default (`std`) # here made the resolved feature set for `approx` depend on whether core's tests # were in the build — they are under `--workspace`, they are not under # `cargo test -p cartopolis`. Features are part of a unit's `-C metadata` and # that hash propagates upward, so `approx` → `bevy_winit` → `bevy_internal` → # `bevy` → `cartopolis` each resolved to two different artifacts: switching # build scope recompiled the client's test target (89 s) and left a second # 164 MB copy of it in `target/`. # # The feature costs nothing to give up. `approx` is `#![no_std]` unconditionally # and declares `std = []` — an empty feature that gates no code — so # `assert_relative_eq!` is identical either way. # # It must be set *here* rather than on the dev-dependency: cargo ignores a # member's `default-features = false` when the workspace entry did not say so, # and only warns. approx = { version = "0.5", default-features = false } # The simulator's HTTP surface: the browser transport (`/ws`) and the account # admin API, on one listener. Only `cartopolis_simulator` depends on it — the # client never does, so this costs the Bevy build nothing. axum = { version = "0.8", features = ["ws"] } # Password hashing for server-side auth (ADR-016). `std` enables OsRng via # password-hash/getrandom (salt + session-token generation). argon2 = { version = "0.5", features = ["std"] } arboard = { version = "3.4", default-features = false, features = ["wayland-data-control"] } # Slimmer than `default`: drops UI, the 2D sprite stack, gamepads and picking — less LLVM work per build. bevy = { version = "0.20", default-features = false, features = [ # Auto-registers all `#[derive(Reflect)]` types (inventory-based). Required so # bevy_world_serialization can reflect-spawn glTF scenes (the avatar fox) — # without it, spawning panics on the first unregistered component type. "reflect_auto_register", "bevy_animation", # `bevy::curve`, which the sit pose builds its clip from. Split out of # `bevy_math` in 0.20; `bevy_animation` already depends on the crate, so this # only adds the re-export. "bevy_curve", # FXAA, and it is the price of ambient occlusion rather than a taste. # `ScreenSpaceAmbientOcclusion` refuses to run unless `Msaa` is `Off` (it # reads a depth and a normal prepass, neither of which is multisampled), so # switching AO on takes the desktop rung's 2× multisampling with it. With no # anti-aliasing at all in the graph that trade is a bad one — a city is # railings, window reveals and roof edges, which is the worst case for # aliasing — so the rung that gains AO gains a post-process edge filter in # the same breath. FXAA and not TAA: this world re-anchors its whole # coordinate frame as you move (`big_space`), and a history buffer indexed by # last frame's motion vectors is precisely what that breaks. "bevy_anti_alias", # `bevy_animation` only enables the animation crate; the glTF *loader's* # clip parsing is behind bevy_gltf's own `bevy_animation` feature, wired via # this umbrella feature. Without it `GltfAssetLabel::Animation(n)` loads zero # `AnimationClip`s and every glТF (the fox, a prim model) stays in rest pose. "gltf_animation", "async_executor", "bevy_asset", "bevy_core_pipeline", "bevy_gizmos", # The half of gizmos that *draws* them. Since the 0.19 upgrade `bevy_gizmos` # alone is only the immediate-mode API: every `Gizmos` call is accepted and # then dropped, nothing logs, and the prim editor's move/rotate/scale handles # were invisible from 2026-07-16 until this was added. `gizmo_render` in # `--dump-state` (`--ui gizmo`) is what notices if it goes again. "bevy_gizmos_render", "bevy_gltf", "bevy_log", "bevy_pbr", # Bloom (moved out of bevy_core_pipeline in 0.19): the glare around the sun # disk and the sunlit limb from orbit — see `free_camera::setup_camera`. "bevy_post_process", "bevy_render", "bevy_scene", "bevy_state", "bevy_window", "bevy_winit", "multi_threaded", # The avatar pack's skins and garments are JPEG (`crates/human`): a 1024-pixel # skin is about 250 KB as JPEG and over a megabyte as PNG, times eighteen # skins. The decoder is the `image` crate's, already in the build. "jpeg", "png", "std", # Keeps TonyMcMapface's LUT, which the camera's tonemapper needs. Note it is # also what pulls `ktx2` + `bevy_image/zstd` into the graph — the pair are not # separately requested anywhere and removing this would take them too. "tonemapping_luts", # # Three features were removed here on 2026-08-14 after checking what each # actually resolves to. Recorded so nobody adds them back by pattern-matching # on a Bevy example: # # * `hdr` is `bevy_image/hdr` — the **Radiance `.hdr` image decoder**, not HDR # rendering. HDR rendering is the `Hdr` component and is not feature-gated at # all. `find assets -iname '*.hdr'` returns nothing, so this was decoding a # format the tree does not contain. This is the only one of the three that # was costing anything. # * `smaa_luts` is `bevy_anti_alias?/smaa_luts` + `ktx2` + `bevy_image/zstd`. # `tonemapping_luts` above already pulls the other two, so this only ever # bought SMAA's own lookup textures. Still off: `bevy_anti_alias` is enabled # now (above) but the client uses `Fxaa`, which needs no LUT at all. Adding # it back is only worth it if somebody switches the edge filter to `Smaa`. # * `default_font` is `bevy_text?/default_font`, and `bevy_text` is not enabled # either — the client embeds its own faces and hands them to the # component library (`systems::theme`, `lib_host`'s `FontMap`). A pure # no-op. # # Two more went on 2026-08-19, by the same audit: # # * `custom_cursor` — zero hits for `CustomCursor`/`CursorIcon` in the client. # * `jpeg` — bevy_image's JPEG decoder for `asset_server.load`, and no image # in this tree goes through the asset server at all: tiles, photos and the # window icon decode via the `image` crate directly, and the glTFs embed # PNG. The place-photo JPEGs are encoded/decoded by `image` too. # NOTE: the Linux-only `wayland` windowing feature is added per-target in # crates/cartopolis/Cargo.toml so macOS/Windows never resolve the wayland stack. ] } # bevy_atmosphere removed in the 0.19 migration — replaced by Bevy's built-in # bevy_pbr atmosphere (Atmosphere/AtmosphereSettings on the camera). bevy_image = { version = "0.20", features = ["zstd_rust"] } big_space = { path = "crates/big_space" } bytes = "1.9" clap = { version = "4.5", features = ["derive"] } earcutr = "0.4" figment = { version = "0.10", features = ["toml", "env"] } # Polygon boolean operations, used by `cartopolis_geo::road_stitch` to cut the # road ribbons against each other so no two of them cover the same ground. Pure # Rust with no C in the tree, which is what the Android and wasm lanes need; the # integer API is the one we call, because a shared boundary computed on a fixed # lattice is the same two points for both pieces and so cannot open into a crack. i_overlay = { version = "8.1", default-features = false } fontdue = "0.9" # The same minor version bevy_math pins, or every `Vec3` crossing between the # shared crates and the client is two incompatible types (bevy 0.20 → glam 0.33). glam = { version = "0.33", features = ["serde"] } # Only the formats something in this tree can actually hand it. `image`'s default # feature set is `default-formats` + `rayon`, and the expensive half of that is # **avif**, which is an AV1 *encoder*: `ravif` → `rav1e` and ~27 further crates, # every one of them built at `opt-level = 3` by `[profile.dev.package."*"]` below. # Nothing here encodes AVIF, and nothing decodes it either (decoding is # `avif-native`, which was never enabled). # # `bevy_image` already declares `image` with `default-features = false` and asks # only for `image/png`, so this line was the sole thing turning the rest on — # which is what makes trimming it effective rather than moot under feature # unification. # # The five kept are each reachable: `png` (window icon, raster tiles, every # `save_buffer` in the tree), `jpeg` (place photos — `utils::photo` encodes it, # and it is what a phone camera writes), `webp` (VersaTiles' satellite basemap), # and `bmp` + `gif` because `platform::photo`'s desktop file dialog offers both # by name — dropping those would turn "pick a photo" into a decode error for a # file the picker itself advertised. # # `rayon` goes with them: the only APIs it gates are `par_pixels` and friends, # which nothing calls, and its other two effects are weak deps on `ravif` and # `exr` — both now gone. It was the last thing keeping rayon in the graph at all. image = { version = "0.25", default-features = false, features = [ "png", "jpeg", "webp", "bmp", "gif", ] } # Float32 GeoTIFF decoding for the height layer (PDOK's AHN rasters). Pure Rust. # # This is a genuinely additional dependency, and used to not be: the line above # carried `image`'s own TIFF backend, so naming `tiff` cost nothing. Trimming # `image` to five formats ended that, and `systems::height` still needs a decoder # for AHN's single-band f32 rasters — which `image` cannot express anyway, since # it has no f32-per-sample `DynamicImage`. # # `default-features = false` for the same reason as above: the defaults are # `deflate`, `lzw`, `fax` and `jpeg`, and the last two cannot appear in an f32 # band — `fax` is CCITT bilevel and TIFF-JPEG is 8-bit-only. `jpeg` in particular # pulled a *second, older* copy of `zune-jpeg` (0.4) alongside the one `image` # resolves (0.5). `deflate` and `lzw` stay because the WCS server picks the # compression and we do not get to choose it. tiff = { version = "0.10", default-features = false, features = [ "deflate", "lzw", ] } # Client-side vector-tile rendering (VersaTiles / Shortbread MVT → RGBA). # Both are pure Rust with no C deps, so they survive the wasm32 target (ADR-033). mvt-reader = "2.4" # `png-format` (a default feature) is off: nothing calls tiny-skia's PNG # encode/decode — test PNGs go through `image` — so the feature only compiled # an extra encoder into every build. tiny-skia = { version = "0.12", default-features = false, features = [ "std", "simd", ] } # The geometry types `mvt-reader` hands back; kept in lockstep with its own dep. geo-types = "0.7" postcard = { version = "1.1", features = ["alloc"] } refinery = { version = "0.8", features = ["rusqlite-bundled"] } rusqlite = { version = "0.30", features = ["bundled"] } serde = { version = "1.0", features = ["derive"] } thiserror = "2.0" tokio = { version = "1.42", features = [ "macros", "net", "rt-multi-thread", "signal", "sync", "time", "io-util", ] } tokio-util = { version = "0.7", features = ["codec"] } # One version for the whole workspace, and 0.29 on purpose: axum 0.8's `ws` # feature resolves tokio-tungstenite 0.29, and the client naming 0.30 compiled # seven packages twice (tungstenite, sha1, digest, block-buffer, crypto-common, # cpufeatures and itself). The rustls/webpki-roots reasoning is at the client's # use site. tokio-tungstenite = { version = "0.29", default-features = false, features = [ "connect", "handshake", "rustls-tls-webpki-roots", ] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } # `brotli`: the map tile server stores its tiles Brotli-compressed and re-packs # each one as gzip for a client that asks for nothing else (0.157 s against # 0.069 s a tile, 2026-10-21), and atlas writes a `.br` beside its cells. ureq = { version = "2.9", features = ["gzip", "brotli"] } dotenvy = "0.15" serde_json = "1" uuid = { version = "1.11", features = ["v4", "serde"] } # Named by two crates or more, so the version is said once. A member adds # features with `{ workspace = true, features = [..] }`; it cannot take away # what an entry here turns on (see `approx` above), so an entry carries only # what every member needs. base64 = "0.22" flate2 = "1.1" futures-util = { version = "0.3", default-features = false, features = ["std"] } gltf = { version = "1.4", default-features = false, features = ["utils"] } matroska-demuxer = "0.8" # The client predicts the avatar with the same Rapier the simulator steps, with # the same features, so the two must stay one version and share one artifact. rapier3d = { version = "0.36", features = ["simd8"] } rustls = { version = "0.23", default-features = false, features = ["ring"] } sha2 = "0.10" tempfile = "3" url = "2.5" # The single dev profile — the full Bevy book recipe (O3 on every dependency, # our own crates left cheap to rebuild), which is what makes a debug build # playable. https://bevy.org/learn/quick-start/getting-started/setup/#compile-with-performance-optimizations # # There used to be two: `dev` with dependencies at opt-level 0, and `dev-bevy` # with this shape. Nobody ran the client on `dev` — it is unplayable, and the # visual work this project does needs a real framerate — but `cargo check` # defaulted to it, so the two commands in CLAUDE.md landed in different artifact # sets and alternating between them rebuilt the other from scratch. Measured # 2026-08-06: target/ at 170 GB across the two, and a `cargo check` no-op after # a `dev-bevy` run costing 9.5 s. One profile, so `--profile` disappears from # every command. See docs/notes/client-build-cost.md. [profile.dev] opt-level = 1 incremental = true codegen-units = 256 # Line tables only, matching what CI already sets. Panic backtraces keep their # function names and line numbers; what goes is type- and variable-level info, # which is codegen this crate's 45 s tail cannot spare. Step-debugging a # workspace crate wants `CARGO_PROFILE_DEV_DEBUG=full` for that one build. debug = "line-tables-only" # Faster incremental links on Linux: debug info in `.dwo` files instead of monolithic binary. split-debuginfo = "unpacked" [profile.dev.package."*"] opt-level = 3 codegen-units = 256 # No debuginfo for dependencies. Three reasons, one measurement each: their # .dwo files (split-debuginfo=unpacked) embed the absolute target-dir path, so # an sccache-shared artifact would point its debug info at another worktree's # (possibly deleted) target; dep debuginfo is most of the profile's disk # weight; and nobody steps through Bevy internals at opt-level=3 anyway — # backtraces keep symbol names without it. debug = false # `package."*"` catches path dependencies too, and cartopolis_core is small, pure and # rebuilt constantly — O3 on it buys nothing and costs every edit. [profile.dev.package.cartopolis_core] opt-level = 0 # Shipped builds: trade compile time for runtime frame times (per the Bevy # cheatbook's performance guidance). Fat LTO + a single codegen unit let the # optimizer inline across crate boundaries (Bevy's hot ECS / render paths benefit # most); abort-on-panic drops unwind tables and landing pads. `lto = true` (fat) # is slow to link — drop to "thin" if the release compile becomes painful. [profile.release] opt-level = 3 lto = true codegen-units = 1 incremental = false debug = false panic = "abort" # The deployed simulator's profile (`deploy-sim.yml`). One deliberate difference # from `release`: panics unwind. `release`'s `panic = "abort"` is a client-side # trade (drops unwind tables and landing pads from a Bevy binary), but the server # built with it has no per-connection isolation at all — every connection runs in # its own tokio task precisely so one client's failure costs that client alone, # and abort turns any panic reachable from one client's input into a # process-wide outage for every session. With unwind, tokio catches the panic at # the task boundary, `net::AvatarGuard` retires the avatar on the way out, and # `SimHandle::task_ended` turns a dead *critical* task into a supervised exit. [profile.sim-release] inherits = "release" panic = "unwind" # The web build's working profile (ADR-033), and the reason it is not `dev`: # that profile optimises *dependencies* and leaves this crate at opt-level 1, which # is backwards for the browser. Bevy is hot, but so are our own streaming, # tessellation and collision systems, and on wasm there is no fast native fallback # to hide them. `debug = false` matters twice over here — debuginfo dominated a # 135 MB module, and every byte is parsed and compiled by the browser on load. # # Thin LTO over 16 codegen units rather than the shipped profile's fat LTO over # one: near-identical frame times for a fraction of the link, which is what makes # this usable as a dev loop when a rebuild already has to re-do std. # `debug = false` is not enough on its own: it drops DWARF, but the wasm `name` # section is not DWARF and survives it. Measured on the module as built, that # section was 43.4 MB of a 114.6 MB file — 38% of everything the browser # downloads, parses and hands to its compiler, to hold nothing but the mangled # names of 181k monomorphised functions. Stripping takes it to 71.3 MB (21.3 MB # gzipped to 17.5 MB). # # The cost is that a browser stack trace becomes a list of indices. That is a # real loss while the web build is still being debugged, so it is one env var to # get back for a single build, without editing this file or invalidating anyone # else's cache: # # CARGO_PROFILE_WEB_RELEASE_STRIP=none ./crates/cartopolis/serve-threads.sh [profile.web-release] inherits = "release" lto = "thin" codegen-units = 16 debug = false strip = "symbols" # The APK's profile, and it exists for a hard reason rather than a preference: # **`release` cannot link this target here.** Fat LTO over one codegen unit means # one rustc process holding the bitcode for the whole Bevy stack at once, and on a # 22 GB build box that process was killed by the OOM killer (signal 9, during the # `cartopolis_android` cdylib) after an hour of compiling everything below it. Thin # LTO over 16 units is the same trade `web-release` above already documents — # near-identical frame times for a fraction of the link — and it fits in memory. # # NOT stripped, unlike `web-release`. There the symbol table was 38% of what a # browser downloads and parses on every load; in an APK it is inert weight next to # 63 MB of glTF, and it is the difference between a native crash address and a # function name. The Android build has never run on hardware # (`docs/notes/android-build.md`), so the first traces are worth more than the # megabytes. Revisit when the phone is boring, with `CARGO_PROFILE_ANDROID_RELEASE_STRIP=symbols` # to try it for one build without invalidating anyone's cache. [profile.android-release] inherits = "release" lto = "thin" # One codegen unit, unlike `web-release`'s 16, and this is the one knob on the # build side that plausibly moves a frame time. # # Thin LTO with 16 CGUs per crate chops every crate into 16 modules, and # cross-module inlining then depends on ThinLTO's *import* heuristics — LLVM's # default import-instruction limit is ~100. Bevy's hot paths are exactly the shape # that loses to that: many small generic functions crossing CGU boundaries within # one crate (`Query` iteration, `bevy_ecs`'s archetype and table access, # `big_space` transform propagation, `bevy_render`'s extract/queue/batch). # `codegen-units = 1` removes the intra-crate boundaries so the ordinary inliner # sees the whole crate; ThinLTO still does the inter-crate work. # # This does **not** reopen the fat-LTO question above. `codegen-units` does not # reduce fat LTO's peak memory — it merges all bitcode into one module regardless # — so the OOM that profile documents stands. Thin LTO with one unit still links # module-by-module in parallel, bounded by `CARGO_BUILD_JOBS`. # # The cost is compile time, and it is not small: intra-crate codegen parallelism # is gone, so expect roughly double. That is affordable here specifically because # `deploy-android.yml` is `workflow_dispatch`-only and no per-push gate builds # this profile. If the final link ever does OOM, lower `CARGO_BUILD_JOBS` for it # rather than reverting this. codegen-units = 1 # `web-task` is the executor every `bevy_tasks` task runs on in the browser. # 1.1.3 (the latest) leaves a freed callback registered when a waiting task is # cancelled, which both throws in the console and can leave a later task asleep # for good; `crates/web_task` is that release with the fix. Remove both lines # when upstream publishes one. `docs/notes/web-task-stale-waiters.md`. [patch.crates-io] web-task = { path = "crates/web_task" } # wgpu's browser backend asked the page for every feature name and limit on each # `Device::features()` / `limits()` call — several per material bevy prepares, # and the largest single cost in the web build's hitches. `crates/wgpu` is 30.0.1 # with those two answers cached. Re-copy it on every wgpu bump, and drop it when # upstream caches them. `docs/notes/wasm-performance.md`. wgpu = { path = "crates/wgpu" } # bevy composes every WESL shader to WGSL on the web's one thread, ~2 s a load. # `crates/bevy_shader` is 0.20.0 with WESL's own validation skipped in release # builds and composed shaders kept between runs (`shader_store.rs`). Re-copy it # on every bevy bump. `docs/notes/wasm-performance.md`. bevy_shader = { path = "crates/bevy_shader" } # mvt-reader 2.4.0 reserved a whole feature's command count for every ring it # decoded and kept it, so a 108 kB zoomed-out tile with 695 water polygons held # 214 MB, and a few of them at once ran the web build's 4 GiB heap out # (`rust_oom`, a hang in Firefox). `crates/mvt_reader` reserves exactly. Drop it # when upstream does the same. `docs/notes/wasm-performance.md`. mvt-reader = { path = "crates/mvt_reader" } # tract-tflite 0.23.9 reads no DEQUANTIZE, PRELU, NEG or SQUARED_DIFFERENCE, and # MediaPipe's float16 face models (`cartopolis_face`) use all four: the weights # are float16 constants turned to float32 in the graph. `crates/tract_tflite` # adds them (`src/ops/mod.rs`, at the end). Drop it when upstream reads them. # `docs/notes/avatar-faces.md`. tract-tflite = { path = "crates/tract_tflite" }