fix(statistics): F8 classification reads enveloped mission_name (was excluding all replays) - #14
Merged
Merged
Conversation
extractMissionName read replay[key] only when typeof === 'string' and the
candidate keys lacked the real snake_case 'mission_name'. In the parser artifact
the field is at replay.mission_name wrapped in the present/value envelope
({state:'present',value:'mace@…'}), so classification returned null (excluded)
for every replay → game_type NULL for all 23556 → empty aggregates on real data.
Now reads mission_name (first) + world_name/map_name and unwraps the
{state:'present',value} envelope (local unwrapMissionField, mirrors presentValue),
still accepting plain strings. Unit tests add enveloped + absent cases (fail on
old, pass on new); real-pg seeds use the faithful enveloped mission_name shape so
the harness exercises the production extraction path.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Critical F8 fix
On real data, F8 game-type classification excluded every replay →
replays.game_typeNULL for all 23,556, all aggregates empty (parity-driver confirmed against the live DB after deploying #12).Root cause:
extractMissionNamereadreplay[key]only whentypeof === "string", and the candidate keys lacked the real snake_casemission_name. In the parser artifact the field isreplay.mission_namewrapped in the present/value envelope{"state":"present","value":"mace@…"}(an object, not a string). So extraction returned null →classifyGameTypereturned null (excluded) for all.Fix: read
mission_namefirst (+world_name/map_name) and unwrap the{state:"present",value}envelope (localunwrapMissionField, mirrors the existingpresentValuehelper; classifier stays dependency-free; plain strings still accepted). Classification spec otherwise unchanged.Why the green tests missed it: the unit test fed a plain-string
missionName, never the enveloped artifact shape. Now: unit tests add enveloped +{state:"absent"}cases (fail against old code, pass against fix); the real-pg seeds were converted to the faithful envelopedmission_nameshape so the harness exercises the production extraction path end-to-end.pnpm verifygreen: 807 tests, 100% coverage, OpenAPI contract diff empty.Follow-up (not in this PR)
public-stats/replay-mapper.tsextractMapNamehas the identical envelope bug (the public replay map label is also empty on live data). Display-only, not parity-blocking — flagged for a separate fix.🤖 Generated with Claude Code