Skip to content

fix: write vehicle, facility, character and daily aggregates to the right keys - #1024

Open
Maelstromeous wants to merge 1 commit into
mainfrom
fix/aggregate-write-keys
Open

Maelstromeous wants to merge 1 commit into
mainfrom
fix/aggregate-write-keys

Conversation

@Maelstromeous

@Maelstromeous Maelstromeous commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

Manual steps

Deploy while no alert is running (the early-morning UTC lull is the usual gap). Vehicle filters now include the event type, so an alert that runs across the deploy gets its per-alert vehicle counts split between an old untagged row and a new tagged one. Nothing else is needed: existing rows keep their current values, only new writes change, and a later rebuild from per-alert data corrects the history.

What this does

A drift audit and a plan review found several aggregate writes going to the wrong rows. This fixes the ones that are a key or filter mistake:

  • Vehicle kills from a vehicle (infantry kills, roadkills, infantry team kills) were written to the victim's global vehicle row. They now go to the killer's.
  • Vehicle deaths were filed under the killer's vehicle id (0 when the killer was on foot). They now go under the victim's vehicle.
  • Missing event type on vehicle aggregate filters let one write create an untagged duplicate row, or increment both the tagged and untagged rows. Every vehicle filter now carries it.
  • Facility captures matched on the whole embedded facility object. When a facility's details changed, the filter missed the existing row, the insert hit the unique index, and the capture was dropped. They now match on the facility id, like the bracketed path already did.
  • Daily keys used the process's local time. Faction combat now keys on the alert's start day and victories on its end day, both in UTC, so each alert lands on one day and a rebuild from per-alert rows reproduces it exactly.
  • Battle rank updates wrote character.battle_rank, while every reader uses character.battleRank, so a player's rank stayed at whatever it was when first seen.
  • World on the killer's global character row came from the victim.
  • Outfit Wars matches sent bracket messages that the API always drops; they are no longer sent.
  • Outfit id "0" on a capture now counts as no outfit.

Validation done

tsc --noEmit and ESLint clean. There is no test suite in this repo.

🤖 Generated with Claude Code

…ight keys

- Kills made from a vehicle credit the killer's global vehicle row, not
  the victim's.
- A destroyed vehicle's global row is filed under the victim's vehicle,
  not the killer's.
- Every vehicle aggregate write carries the event type, so a write no
  longer creates an untagged twin or increments several rows.
- Facility captures match on the facility id; a full-object match missed
  the row whenever facility details changed, and the capture was lost.
- Faction combat rows key on the alert's start day and victories on its
  end day, both in UTC.
- The killer's global character row takes its world from the alert.
- Battle rank updates write battleRank; they were writing battle_rank, so
  the rank shown on profiles never changed after first insert.
- Outfit Wars matches no longer send bracket messages the API drops.
- A capture with outfit id "0" counts as no outfit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant