Repository navigation
Conversation
PoracleNG's v1 tracking/humans/profiles API is frozen and deprecated; new features (incident tracking, max_distance enforcement, saved locations) only ship on /api/v2. Talk v2 when the server offers it and keep v1 for PoracleJS and older PoracleNG. - New webhook option `apiVersion`: 'auto' (default), 'v1' or 'v2'. 'auto' checks the public /openapi.json for every v2 route the service uses. - server/src/services/poracleV2.js translates rules both ways: v1 sentinels <-> v2 null/omitted, int enums <-> string enums, clean bitmask <-> clean/edit/summary. The frontend and GraphQL schema keep the v1 shape. - Pokestop events (gold-stop, kecleon, showcase) stay under invasion in the UI but are written to and read from v2's incident type. - v2 requests are sent without an empty body (bulk DELETE is strict about it). - A cached detection result never overrides a configured apiVersion. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Editing a tracked rule sent back only the fields the GraphQL schema exposes, and Poracle replaces a rule wholesale, so settings made elsewhere were reset: gym battle_changes, the edit and summary clean bits, pokemon/raid costume, raid evolution, PVP mega evolution, and override_areas / override_location_label. - expose battle_changes to the client, and show `clean` as the clean bit only - before an edit is sent, copy the hidden settings over from the stored rule (v1 and v2), dropping ones the edit made invalid - v2: edits replace the rule by uid (PUT) instead of POSTing a new one, costume / pvp evolution / overrides map both ways, and incident rules get negative uids so they no longer collide with invasion uids - PVP pokemon edits keep their uid Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ReactMap has a battle_changes toggle and the field is now in the GraphQL schema, so every edit carries it; the fallback never applied. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
|
Superseded by WatWowMap#1273. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PoracleNG's v1 tracking, humans and profiles routes are frozen and deprecated. New behaviour only ships on
/api/v2: the separateincidenttype,[tracking] max_distanceenforcement (v1 fix pending in jfberry/PoracleNG#343), and saved-location updates. This PR makes ReactMap use v2 when the Poracle server offers it, and keeps v1 for PoracleJS and older PoracleNG.The v1/v2 translation happens entirely in the server's Poracle service; v2 results are converted back into the v1 row shape the UI already uses.
It also fixes edits losing settings ReactMap has no input for, on both v1 and v2 (see below).
How it works
apiVersion(autoby default, orv1/v2).autofetches the public/openapi.jsononce at init and switches to v2 only if every v2 route ReactMap uses is listed. PoracleJS has no spec, so it stays on v1 quietly, without an error log or payload dump. A cached detection result never overrides an explicitly configured version.server/src/services/poracleV2.jsmaps rules in both directions:9000,-1,4096,9000000, …) ⇄ v2 omitted/nullteam,gender,rsvp_changes)cleanbitmask ⇄clean/edit/summary.editis dropped for types v2 rejects it on;summaryis kept for quest only.pokemon_id/levelderivation (boss, by-level, everything)uid,description,allForms)gold-stop,kecleon,showcase) stay in the invasion tab. On v2 they are written to and read from theincidenttype, which v2 keeps separate frominvasion. Incident rules have their own uid sequence, so ReactMap shows them with negative uids; edits and deletes are routed toincidentby the sign.PUT …/tracking/{type}/{uid}), so the rule keeps its id. New rules are POSTed.enable/disable,profile,location,areas,profilesCRUD and copy). Active hours become strict integers on write and padded strings on read. Profile update still writes onlyactive_hours, as v1 did.DELETEaccepts?uid=or a body, not both.Edits no longer reset hidden settings (v1 and v2)
Editing a tracked rule sent back only the fields in ReactMap's GraphQL schema, and Poracle replaces a rule wholesale, so anything set from a bot command or PoracleWeb was reset:
battle_changes: the toggle existed, but the stored value never reached iteditandsummarybits ofclean(GraphQL'sBooleanturned3intotrue, saved back as1)costume, raidevolution, pokemonpvp_ranking_evolutionoverride_areas/override_location_labelFixes:
battle_changesis now in the GraphQL schema, andcleanresolves to the clean bit only.server/src/services/poracleRules.js: before an edit is sent, the hidden settings are copied over from the stored rule. A setting the edit made invalid is dropped: an area override once a distance is set, a location override once the distance is 0, a PVP evolution once the rule is no longer PVP or changes league.uid, so they update the rule instead of adding a second one.Test plan
server/test/poracleV2.test.js: mapping for every category, plus a stub HTTP server covering detection (v2 spec / no spec / partial spec / forced), the invasion/incident split and PUT-by-uid edits, bulk delete by uid sign without a body, the profile PATCH body, cache-vs-config precedence, the clean-bit merge, hidden-setting merging, and a v1 edit carrying the stored settingsnode --test(local Node 22.23.3 is one patch below the engine pin, soyarn testrefuses to start): 174/174 passadditionalProperties: false, enums, minimums): all validcostume, an override,battle_changesor the edit bit set from a bot command, and confirm it survivesKnown limitations
costume, overrides, PVP evolution or the edit/summary bits; it only keeps them on edit.gold-stop,kecleonandshowcaseare mapped todisplay_type7, 8 and 9 in code, matching PoracleNG'sutil.json.🤖 Generated with Claude Code