feat: map objectives, SBC, squad battles, and match endpoints #5

Open
funman300 wants to merge 1 commits from feat/map-objectives-sbc into main
Owner

Summary

Adds mapper coverage for several FIFA 23 FUT endpoints that were not yet handled, plus fixes a bug where prefix routes always returned method: "GET" regardless of the matched EA method.

New exact routes

EA endpoint Core endpoint Notes
GET /ut/game/fut/user/dynamicobjectives GET /objectives FIFA 23 actual objectives path
GET /ut/game/fut/sbs/challenges GET /sbc FIFA 23 uses /sbs/ not /sbc/
POST /ut/game/fut/squadbattle/result POST /matches/result Squad Battles result
POST /ut/game/fut/game/r POST /matches/result FIFA 23 short-form match path
GET /ut/game/fut/squads/user GET /squad Squad list on hub load

New prefix routes

EA prefix Core path Notes
GET /ut/game/fut/sbs/challenges/{id} GET /sbc/{id} Single SBC detail
POST /ut/game/fut/sbs/challenges/{id}/sets/{setId}/trade POST /sbc/submit SBC trade submission
POST /ut/game/fut/user/dynamicobjectives/{id}/milestones/{m}/claim POST /objectives/{id}/claim Per-objective claim

Bug fix

  • Prefix route dispatch was hardcoding method: "GET" instead of using the matched route's ea_method. Fixed to method: r.ea_method.
  • Added test_prefix_routes_preserve_method test to guard against regressions.

Closes #3 #4

What still needs to be done before merging

  1. Add response shapers in src/shaper.rs for the new endpoints:

    • shape_objectives(core_resp) → wrap in { "challenges": ..., "version": 1 }
    • shape_sbc_list(core_resp) → wrap in { "SBCSetSummary": { "challenges": ... } }
    • shape_match_result(core_resp) → wrap in { "resultCode": 200, "userInfo": { "coins": ... } }
  2. Register shapers in src/proxy.rs dispatch table.

  3. Add mapper unit tests for each new route:

    assert_eq!(map_to_core("GET", "/ut/game/fut/user/dynamicobjectives").unwrap().core_path, "/objectives");
    assert_eq!(map_to_core("POST", "/ut/game/fut/user/dynamicobjectives/obj1/milestones/1/claim").unwrap().core_path, "/objectives/obj1/claim");
    // ... etc
    
  4. Run cargo test to confirm all existing tests still pass alongside the new ones.

  5. Run cargo clippy -- -D warnings clean.

Test plan

  • cargo test passes (including the new test_prefix_routes_preserve_method)
  • Manual replay test: openfut-bridge-replay captures/session_YYYYMMDD.json and confirm objectives/SBC requests now map to Core rather than falling through to the placeholder
  • cargo clippy -- -D warnings clean
## Summary Adds mapper coverage for several FIFA 23 FUT endpoints that were not yet handled, plus fixes a bug where prefix routes always returned `method: "GET"` regardless of the matched EA method. ### New exact routes | EA endpoint | Core endpoint | Notes | |-------------|--------------|-------| | `GET /ut/game/fut/user/dynamicobjectives` | `GET /objectives` | FIFA 23 actual objectives path | | `GET /ut/game/fut/sbs/challenges` | `GET /sbc` | FIFA 23 uses `/sbs/` not `/sbc/` | | `POST /ut/game/fut/squadbattle/result` | `POST /matches/result` | Squad Battles result | | `POST /ut/game/fut/game/r` | `POST /matches/result` | FIFA 23 short-form match path | | `GET /ut/game/fut/squads/user` | `GET /squad` | Squad list on hub load | ### New prefix routes | EA prefix | Core path | Notes | |-----------|----------|-------| | `GET /ut/game/fut/sbs/challenges/{id}` | `GET /sbc/{id}` | Single SBC detail | | `POST /ut/game/fut/sbs/challenges/{id}/sets/{setId}/trade` | `POST /sbc/submit` | SBC trade submission | | `POST /ut/game/fut/user/dynamicobjectives/{id}/milestones/{m}/claim` | `POST /objectives/{id}/claim` | Per-objective claim | ### Bug fix - Prefix route dispatch was hardcoding `method: "GET"` instead of using the matched route's `ea_method`. Fixed to `method: r.ea_method`. - Added `test_prefix_routes_preserve_method` test to guard against regressions. Closes #3 #4 ## What still needs to be done before merging 1. **Add response shapers** in `src/shaper.rs` for the new endpoints: - `shape_objectives(core_resp)` → wrap in `{ "challenges": ..., "version": 1 }` - `shape_sbc_list(core_resp)` → wrap in `{ "SBCSetSummary": { "challenges": ... } }` - `shape_match_result(core_resp)` → wrap in `{ "resultCode": 200, "userInfo": { "coins": ... } }` 2. **Register shapers** in `src/proxy.rs` dispatch table. 3. **Add mapper unit tests** for each new route: ```rust assert_eq!(map_to_core("GET", "/ut/game/fut/user/dynamicobjectives").unwrap().core_path, "/objectives"); assert_eq!(map_to_core("POST", "/ut/game/fut/user/dynamicobjectives/obj1/milestones/1/claim").unwrap().core_path, "/objectives/obj1/claim"); // ... etc ``` 4. **Run `cargo test`** to confirm all existing tests still pass alongside the new ones. 5. **Run `cargo clippy -- -D warnings`** clean. ## Test plan - [ ] `cargo test` passes (including the new `test_prefix_routes_preserve_method`) - [ ] Manual replay test: `openfut-bridge-replay captures/session_YYYYMMDD.json` and confirm objectives/SBC requests now map to Core rather than falling through to the placeholder - [ ] `cargo clippy -- -D warnings` clean
funman300 added 1 commit 2026-06-26 05:12:08 +00:00
Adds exact and prefix routes for endpoints observed in FIFA 23 FUT that
were not yet covered:
- GET /ut/game/fut/user/dynamicobjectives → GET /objectives
- POST /ut/game/fut/user/dynamicobjectives/{id}/milestones/{m}/claim
    → POST /objectives/{id}/claim
- GET /ut/game/fut/sbs/challenges[/{id}] → GET /sbc[/{id}]
- POST /ut/game/fut/sbs/challenges/{id}/sets/{setId}/trade → POST /sbc/submit
- POST /ut/game/fut/squadbattle/result → POST /matches/result
- POST /ut/game/fut/game/r → POST /matches/result
- GET /ut/game/fut/squads/user → GET /squad

Also fixes prefix-route method forwarding bug: prefix routes were
unconditionally returning method "GET" instead of the matched EA method.

Closes #3 #4

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin feat/map-objectives-sbc:feat/map-objectives-sbc
git checkout feat/map-objectives-sbc
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: funman300/OpenFUT-Bridge#5