Install TierPrices global in test harnesses; release v0.10.11
Integration and load tests build AppState but never installed the
process-global TierPrices, so any handler path calling CreatorTier's
toml-backed accessors (price_cents/max_file_bytes/max_storage_bytes)
panicked ("install_global was not called") — 78 integration failures.
The harnesses now install_test_default() and use the loaded value, the
same contract as main.rs. Drop the cfg gate on install_test_default so it
is available whether the gate build is debug or release.
Bump 0.10.10 -> 0.10.11: Sando keys its build workspace by version, so a
new version is needed to force a clean checkout of the fixed tree.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
5 files changed,
+20 insertions,
-6 deletions
| 4318 |
4318 |
|
|
| 4319 |
4319 |
|
[[package]]
|
| 4320 |
4320 |
|
name = "makenotwork"
|
| 4321 |
|
- |
version = "0.10.10"
|
|
4321 |
+ |
version = "0.10.11"
|
| 4322 |
4322 |
|
dependencies = [
|
| 4323 |
4323 |
|
"ammonia",
|
| 4324 |
4324 |
|
"anyhow",
|
| 1 |
1 |
|
[package]
|
| 2 |
2 |
|
name = "makenotwork"
|
| 3 |
|
- |
version = "0.10.10"
|
|
3 |
+ |
version = "0.10.11"
|
| 4 |
4 |
|
edition = "2024"
|
| 5 |
5 |
|
license-file = "LICENSE"
|
| 6 |
6 |
|
# Server binary — never published to a registry. Marks the crate private so
|
| 157 |
157 |
|
}
|
| 158 |
158 |
|
|
| 159 |
159 |
|
/// Install the canonical fixture into the global slot for test use.
|
| 160 |
|
- |
/// Idempotent; safe to call from multiple tests concurrently.
|
| 161 |
|
- |
#[cfg(any(test, debug_assertions))]
|
|
160 |
+ |
/// Idempotent; safe to call from multiple tests concurrently. Not
|
|
161 |
+ |
/// cfg-gated so it is available to integration-test harnesses regardless
|
|
162 |
+ |
/// of whether the gate build is debug or release; never called in prod
|
|
163 |
+ |
/// (main.rs installs from the live assumptions instead).
|
| 162 |
164 |
|
pub fn install_test_default() {
|
| 163 |
165 |
|
// If already installed (either by an earlier test or by an integration
|
| 164 |
166 |
|
// harness), leave it — the values are stable across tests.
|
| 370 |
370 |
|
let state = AppState {
|
| 371 |
371 |
|
db: pool.clone(),
|
| 372 |
372 |
|
config,
|
| 373 |
|
- |
tier_prices: makenotwork::tier_prices::TierPrices::default(),
|
|
373 |
+ |
tier_prices: {
|
|
374 |
+ |
// Install the process-global TierPrices so handler code paths
|
|
375 |
+ |
// that call CreatorTier::{price_cents,max_file_bytes,
|
|
376 |
+ |
// max_storage_bytes} work under test (they read the global,
|
|
377 |
+ |
// same as production). Idempotent across tests.
|
|
378 |
+ |
makenotwork::tier_prices::TierPrices::install_test_default();
|
|
379 |
+ |
makenotwork::tier_prices::TierPrices::global().clone()
|
|
380 |
+ |
},
|
| 374 |
381 |
|
runway_config: makenotwork::tier_prices::RunwayConfig::default(),
|
| 375 |
382 |
|
pricing_comparison: makenotwork::pricing_comparison::PricingComparison::load(
|
| 376 |
383 |
|
"docs/business/assumptions.toml",
|
| 106 |
106 |
|
let state = AppState {
|
| 107 |
107 |
|
db: pool.clone(),
|
| 108 |
108 |
|
config: app_config,
|
| 109 |
|
- |
tier_prices: makenotwork::tier_prices::TierPrices::default(),
|
|
109 |
+ |
tier_prices: {
|
|
110 |
+ |
// Install the process-global TierPrices so CreatorTier accessors
|
|
111 |
+ |
// work under the load harness (they read the global). Idempotent.
|
|
112 |
+ |
makenotwork::tier_prices::TierPrices::install_test_default();
|
|
113 |
+ |
makenotwork::tier_prices::TierPrices::global().clone()
|
|
114 |
+ |
},
|
| 110 |
115 |
|
runway_config: makenotwork::tier_prices::RunwayConfig::default(),
|
| 111 |
116 |
|
pricing_comparison: makenotwork::pricing_comparison::PricingComparison::load(
|
| 112 |
117 |
|
"docs/business/assumptions.toml",
|