e8be289660
CI / Build, lint & test (push) Successful in 3m16s
`consume_item` was a complete, tested, atomic apply transaction with zero
production callers and no route -- it could not be reached over HTTP because
its effect is an in-process `ItemMutation` trait object and the host is a
separate process on a synchronous JSON boundary.
Closes that gap with a CLOSED, Core-validated effect vocabulary rather than a
pass-through: `InstanceEffect::AddContractMatches { amount, cap,
default_when_unset }`. A generic "apply this field/value" escape hatch would
hand economic authority back to the caller and break the architecture.
The read-modify-write runs INSIDE the caller's transaction
(`min(cap, COALESCE(contract_matches, default) + amount)`) so two concurrent
applies cannot lose an update, and the reported `granted` stays the requested
amount even when the cap clamps the total.
Migration 0028 adds `owned_cards.contract_matches` NULLABLE: NULL means "Core
tracks no contract here", which keeps the pack-fresh default (a FIFA-specific
7) out of Core and leaves every existing row unchanged in meaning. ADD COLUMN,
not a rebuild -- a rebuild would drop 0026's transfer trigger.
Two ordering fixes forced by putting this on the live path:
* consume_item moves from DEFERRED `pool.begin()` to `BEGIN IMMEDIATE`, the
discipline economy.rs documents: three reads precede the first write, which
is exactly the shape that returns SQLITE_BUSY past the busy handler.
* the replay answer now precedes source validation. With DestroyInstance the
first apply deletes the source, so the old order answered a retry with 404
instead of the recorded outcome -- replay semantics were unreachable.
27 lines
463 B
Rust
27 lines
463 B
Rust
pub mod achievement;
|
|
pub mod card_db;
|
|
pub mod checkin;
|
|
pub mod club;
|
|
pub mod consume;
|
|
pub mod draft;
|
|
pub mod economy;
|
|
pub mod event;
|
|
pub mod fut_champs;
|
|
pub mod game_ext;
|
|
pub mod import;
|
|
pub mod instance_effect;
|
|
pub mod inventory;
|
|
pub mod market;
|
|
pub mod match_service;
|
|
pub mod notification;
|
|
pub mod objective;
|
|
pub mod pack;
|
|
pub mod profile;
|
|
pub mod sbc;
|
|
pub mod season;
|
|
pub mod settings;
|
|
pub mod squad;
|
|
pub mod squad_rules;
|
|
pub mod statistics;
|
|
pub mod upgrades;
|