Phase 7 (Bridge): response shaper, diff tool, expanded mapper

- shaper.rs: shape_response() dispatches on core_path to wrap Core
  JSON in FUT envelope format; shapes auth (/ut/auth → sid/pid/
  phishingToken/persona envelope), profile, club, squad, market,
  packs; unknown paths pass through unchanged
- proxy.rs: calls shape_response() on every successful Core response
  before returning to the FIFA 23 client
- mapper.rs: expanded from 6 to 18 speculative FUT endpoint mappings
  covering auth, profile/settings, club/usermassinfo, item/collection,
  squad (GET+PUT), packs+purchase, transfer market+watchlist+bid,
  objectives, events, squad battles, and match result submission
- admin.rs: GET /_bridge/captures/diff?a=<id>&b=<id> compares two
  captures; reports method/path/status changes, header diffs, and
  structured JSON body diffs (key-level for objects, length for others)
- main.rs: registers /_bridge/captures/diff route
- Unit tests: 4 shaper tests, 6 mapper tests (10 total, all passing)
- All 13 integration tests still passing

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
funman300
2026-06-25 16:32:37 -07:00
parent 3b7a4928c9
commit b8e766e9dd
6 changed files with 510 additions and 14 deletions
+2 -1
View File
@@ -18,6 +18,7 @@ use crate::{
config::Config,
error::BridgeResult,
mapper::{map_to_core, placeholder_response},
shaper::shape_response,
};
const CAPTURE_DEDUP_SECS: u64 = 1;
@@ -118,7 +119,7 @@ pub async fn catch_all_handler(
)
.await
{
Ok((body, status)) => (body, status),
Ok((body, status)) => (shape_response(mapping.core_path, body), status),
Err(e) => {
tracing::error!("Core request failed: {e}");
(serde_json::json!({ "error": e.to_string() }), 502)