feat(fifa17): own FUT hub tile counts in Rust
Migrate GET /hub from the Python proxy to a Rust handler deriving counts from authoritative state: clubPlayers = owned PLAYER cards in Core (consumables/staff excluded via catalog kind; may be lower than Python's profile count by the deferred Legend instances = DIFFERENT-BY-DESIGN), auction/tradePile counts from the durable market store via the async bridge. Fail-closed 503 on Core error; market read failure degrades cosmetic counts to 0. Adds classify arm, handler, ownership + integration tests; reachability tool marks hub migrated.
This commit is contained in:
@@ -1408,3 +1408,29 @@ fn non_economy_routes_rust_owned_no_python_no_core() {
|
||||
"no Python fallback for migrated non-economy routes"
|
||||
);
|
||||
}
|
||||
|
||||
/// `GET /hub` is served from Rust: `clubPlayers` counts owned PLAYER cards in
|
||||
/// Core, auction/tradePile counts come from the durable market store (0 with no
|
||||
/// economy wired), and Python is never consulted.
|
||||
#[test]
|
||||
fn hub_counts_players_from_core_no_python() {
|
||||
let items = vec![
|
||||
item("oc1", "card_a", 84, "ST", "Brazil", "La Liga", "Barcelona"),
|
||||
item("oc2", "card_b", 80, "CM", "Spain", "La Liga", "Real Madrid"),
|
||||
item("oc3", "card_c", 77, "CB", "France", "Ligue 1", "PSG"),
|
||||
];
|
||||
let core = Arc::new(FakeCore::new(items, 3));
|
||||
let (py_url, rec) = spawn_mock_python();
|
||||
let server = build_server(core, &py_url, None);
|
||||
|
||||
let resp = server.handle("GET", "/ut/game/fifa17/hub", &[], b"");
|
||||
assert_eq!(resp.status, 200);
|
||||
let body: Value = serde_json::from_slice(&resp.body).unwrap();
|
||||
assert_eq!(body["clubPlayers"], 3, "counts owned player cards");
|
||||
assert_eq!(body["auctionCount"], 0, "no economy wired => 0 listings");
|
||||
assert_eq!(
|
||||
body["tradePile"],
|
||||
serde_json::json!({ "count": 0, "selling": 0, "sold": 0 })
|
||||
);
|
||||
assert_eq!(rec.lock().len(), 0, "hub never reaches Python");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user