[codex] Endpoint audit fixes - #2
Conversation
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
There was a problem hiding this comment.
Code Review
This pull request introduces several new API endpoints and corresponding MCP tools for accessing game settings, bestiary metadata, and active-run glossary information including cards, relics, potions, and keywords. The menu_select tool has also been updated to automatically retry actions through the multiplayer route when a 409 conflict indicates an active multiplayer run. Feedback suggests improving the robustness of the 409 condition check, which currently relies on a specific string match, and refining the retry logic to avoid nested try-except blocks for better error reporting.
|
Codex Review: Didn't find any major issues. Keep it up! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
|
Codex Review: Didn't find any major issues. 👍 ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
|
@codex review |
|
Codex Review: Didn't find any major issues. Hooray! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
|
@codex review |
|
Codex Review: Didn't find any major issues. Hooray! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
|
@codex review |
1 similar comment
|
@codex review |
|
@codex review |
Summary
Adds endpoint audit fixes and Compendium/Glossary clarifications on top of the upstream sync work.
Changes
GET /as a structured API index withstatus,kind: api_index,version,endpoint_count, bound prefixes, and the advertised endpoint list./api/v1/settingsas a null-safe structured object withstatus,kind, display, audio, gameplay, mod, language, and skip-intro fields./api/v1/profileand/api/v1/compendiumwith explicitstatus/kindenvelopes while preserving their profile/save/current-run context./api/v1/profilesas a structured profile-slot object withstatus,kind,count, and per-slotprofile_id, save paths, profile root, save scope, and data-presence fields.run_in_progresswithout changing profile state.error_codevalues for POST validation failures such as invalid JSON, missing or non-string actions, missing/non-integer profile IDs, and action payload parsing failures.error_codevalues for unsupported methods, unknown paths, and top-level internal handler failures.method_not_allowedregardless of current game mode.PUTrequests return HTTP 405method_not_allowedfor every advertised endpoint plus/.method_not_allowedregardless of current game mode.error_codevalues for read endpoint exception paths such as settings, profile, compendium, state, glossary, and bestiary build/read failures.play_card.card_index,use_potion.slot, anddiscard_potion.slotpayloads without mutating the run.timeline_manual_action_requiredfor Timeline manual-reveal blocks so that menu automation errors remain branchable and return HTTP 409.action_errorfallbackerror_codefor older generic action failures that previously returned structured error JSON without an error code.http_statusinstead of flatteningHTTPStatusErrorresponses to a text prefix.menu_selectretry behavior, and profile switch/delete wrappers.mp_tools cannot regress to singleplayer route helpers, and non-MP tools cannot accidentally call multiplayer helpers.error_code: action_errorand enemy-targeting card/potion actions document bothentity_idand combat ID string targets.error_codeis optional for action/read/route/validation failures.run_state_unavailableHTTP 503 errors alongside no-run HTTP 409 errors, both retaining profile/save context.formatquery values so unsupported formats return HTTP 400 witherror_code: invalid_formatinstead of silently falling back to JSON./api/v1/singleplayerand/api/v1/multiplayerJSON state responses withstatus: okandkind(singleplayer_stateormultiplayer_state) envelopes while preserving existingstate_typeand screen-specific data./api/v1/bestiaryas a deterministic metadata object withstatus,kind,monster_count,encounter_count, sortedmonsters, and sortedencounters.run_id,seed,profile_id,progress_path,resolved_progress_path,profile_root,save_scope,net_type, and player roster details where applicable.current_runalways carries active profile/save identity whilerun_idandseedare present whencurrent_run.saveexposes them, and relaxes live audit accordingly.http_status.current_runexample so it shows full profile/save context and save-backed run identity availability.RunManager.Instancein glossary endpoints asrun_not_in_progressinstead of allowing startup/teardown 500s.pathandresolved_pathfields.run_historysection audits, including section shape, entry container type, file-history source/path metadata, entry count consistency, run ID prefix, run file metadata, optional parsed run fields, acts list shape, and player summary counts./api/v1/profileso profile, compendium, glossary, and state endpoints agree on active profile/run identity.resolved_progress_pathbesideprogress_pathon/api/v1/profile,/api/v1/compendium, and successful/api/v1/glossary/*responses so clients get the absolute local save file path./api/v1/compendium, includingprogress_path,profile_root, andsave_scopeat the top level./api/v1/glossary/*responses, includingprofile_id,progress_path,profile_root, andsave_scope.run_not_in_progresserrors, and guards net-type lookup so main-menu glossary calls return HTTP 409 instead of 500./api/v1/glossary/cards: energy/star costs, upgraded flag, upgradeability, current/max upgrade level, upgraded-preview cost/star cost, and upgraded-preview description.requires_targetandvalid_targetsto hand card state for enemy-targeted cards, matching potion target metadata and play-card action requirements.proceedstate and actions on visible enabled controls, while preserving the close-inventory-then-proceed behavior for shop screens./api/v1/bestiaryavailable as model metadata while/api/v1/compendiumcarries profile encounter/enemy progress where available.menu_selectin the MCP server to retry through/api/v1/multiplayerwhen the singleplayer route correctly rejects calls during an active multiplayer run.id,type,rarity,is_upgraded,keywords, andindex./api/v1/profilesvalidation so switch/delete requests missingprofile_idreturn HTTP 400.Validation
python3 -m py_compile scripts/audit_endpoints.py scripts/test_mcp_server.py mcp/server.pypython3 scripts/audit_endpoints.py --skip-liveuv run --project mcp python scripts/test_mcp_server.pypython3 scripts/audit_endpoints.py --base-url http://127.0.0.1:15526uv run --project mcp pythonhelper test confirmed_handle_errorpreserves a structured HTTP 409 endpoint error and addshttp_status.dotnet build STS2_MCP.csproj -c Release -o out/STS2_MCP -p:STS2GameDir="C:\\Program Files (x86)\\Steam\\steamapps\\common\\Slay the Spire 2"58edc32state-envelope,aa3454a/1698771path-normalization,6f80057API-index descriptions,5200398blocking-popup action errors,71f9ddePOST validation error codes,2e87f86route-level error codes,715076bread availability errors,37c3735read failure error codes,5e87785fallback action error codes,04f9933static endpoint manifest parity,a7a8d76MCP bridge tests,88885f2action target/error docs,09dc7e3Timeline manual-action errors,38c6242endpoint error-code contract docs,43e6a54glossary run-state error docs, and359e846MCP route-helper parity, and418b8a7current-run identity availability, and01df37bMCP glossary run identity docs, and2792596glossary keyword tip hardening, and2006023README API-index example coverage, ande7082cbbestiary nested metadata ordering, and14f6e0fMCP read endpoint error propagation, anddf6ba7aglossary item ordering, and3f28b32current-run state example docs, and1b136aaglossary keyword ordering, andba3bd17missing RunManager glossary guards, andbe1fcdelegacy profile path normalization audit, and3fd3eafnested settings schema audit, andb5bcd88docs normalized save-path audit, andf5fdd2dglossary item schema audits, and56a3640Compendium run-history section audit, and2165561profile stats schema audit, and82855b2MCP profile action wrapper tests, and6ad50dbmethod-before-run-mode route guard coverage, andc4157f6unsupported-method live audit coverage, and8dfd275profile/Compendium schema audit coverage, and8400282card upgrade preview audit coverage, andd7a16a7live combat state payload audit coverage, and363681eactive-run profile switch guard coverage, anda1be21dmultiplayer route guard audit coverage, and1a53acfBestiary entry schema audit coverage, ande1d2ae5settings value schema audit coverage, and13ec7bbglossary value schema audit coverage, anda4f296fprofile slot schema audit coverage, and71f0e68API-index schema audit coverage, and3f1eb62safe gameplay validation audit coverage, andd68eb77current-run context schema audit coverage, ande51d4a5profile value schema audit coverage, and625d9a3Compendium run-history schema audit coverage are covered by static audit, MCP bridge tests, anddotnet build; live verification requires restarting the game because the running process currently locksmods/STS2_MCP.dll; the latest install attempts throughba3bd17still failed with permission denied; a live audit against the currently loaded DLL still reports the old backslashprogress_pathbehavior on/api/v1/profile.GETand safe malformedPOSTrequests to/api/v1/multiplayerreturn structurednot_multiplayer_run; inside multiplayer, malformedPOSTrequests must remain structured validation errors.GET /returnsstatus: ok,kind: api_index,version: 0.4.0,endpoint_count: 14, and 14 advertised endpoints./api/v1/singleplayerreturns HTTP 400 withmissing_menu_optionandunknown_menu_optionfor invalid main-menumenu_selectcalls./api/v1/singleplayerreturns HTTP 409 witherror_code: run_not_in_progressfor a non-menu gameplay action posted with no active run./api/v1/singleplayer?format=xmlreturns HTTP 400 witherror_code: invalid_format, whileformat=jsonandformat=markdownstill work./api/v1/settingsreturnsstatus: ok,kind: settings, and display/audio/gameplay/mods/language fields./api/v1/profilereturnsstatus: ok,kind: profile, profile/save/current-run context, and sorted metadata arrays./api/v1/compendiumreturnsstatus: ok,kind: compendium, profile/save/current-run context, and sorted metadata arrays./api/v1/profilesreturnsstatus: ok,kind: profiles,count: 3, and per-slot profile/save context fields./api/v1/profilesreturns HTTP 400invalid_profile_id, HTTP 400unknown_profile_action, and HTTP 409active_profile_deletefor safe validation cases./api/v1/bestiaryreturnsstatus: ok,kind: bestiary,monster_count: 126,encounter_count: 95, and deterministic ID ordering./api/v1/glossary/cards,/api/v1/glossary/relics,/api/v1/glossary/potions, and/api/v1/glossary/keywordsreturn HTTP 409 withrun_not_in_progressplus profile/save context instead of 500.menu_select: continueto verify glossary success responses in combat./api/v1/profileand/api/v1/compendiumreturnresolved_progress_pathwith the absolute local progress save path.current_runin/api/v1/singleplayer?format=jsonand/api/v1/glossary/cardsincludesprofile_id,progress_path,resolved_progress_path,profile_root,save_scope,run_id, andseed./api/v1/compendiumnow returnsprofile_id,progress_path,profile_root,save_scope, andcurrent_runat the top level./api/v1/glossary/cards,/api/v1/glossary/relics,/api/v1/glossary/potions, and/api/v1/glossary/keywordsnow returnprofile_id,progress_path,resolved_progress_path,profile_root,save_scope, andcurrent_runat the top level./api/v1/glossary/cardsreturns 225 active-run cards with shared pools and upgraded preview metadata.Deal 9 damage..Upgrade ALL cards in your Hand..Deal 8 damage....proceedcan leave while inventory is open; state now advertises that viainventory_open,can_close_inventory, andcan_proceed./api/v1/glossary/relics,/api/v1/glossary/potions, and/api/v1/glossary/keywordsreturn active-run scoped payloads during combat/rewards/shop.PUTrequests to every advertised endpoint plus/return HTTP 405 witherror_code: method_not_allowed.