Skip to content

Server-wide heatmaps (Kills, Deaths, Lines) drop up to a third of the stored human kills once bot fights fill their cap: the 30,000-row read limit is shared by both classes #64

Open

Description

@matt-edmondson

What's wrong

Since 4f849d9, csp_kills keeps two classes per map under separate caps: MaxPointsPerMap (default 30,000) for kills with a human on either end, and MaxBotFightsPerMap (default 10,000) for kills between two bot personas (HeatmapSettings.cs:19,22). The README promises that "bot fights never push out a human's kills". That holds for storage.

The site's reads don't keep the classes apart:

  • HeatmapReader.ServerLimit = 30_000 (CounterStrikeProgression.Site/Data/HeatmapReader.cs:16) is the one limit for server-wide PointsAsync and FightsAsync (lines 53 and 66).
  • SelectKills, SelectDeaths and SelectFights in CounterStrikeProgression.Core/Heatmaps/MySqlKillMapStore.cs:56-71 are WHERE map = @map ORDER BY id DESC LIMIT @limit, with no bot_fight condition.

So a full map holds 40,000 rows and the page reads the newest 30,000 of them, whichever class they are.

Failure scenario

Take a server with one human and nine bot personas, where most kills are bot vs bot:

  1. Once the map is full, csp_kills holds 30,000 human kills and 10,000 bot fights.
  2. The bot fights are all recent, so the newest 30,000 rows are about 10,000 bot fights and 20,000 human kills.
  3. The Kills, Deaths and Lines tabs draw only the newest 20,000 human kills. A third of what the cap was sized to keep is never shown, and a third of the drawn points are bot-vs-bot.
  4. The map picker (SelectMaps, line 54, counts both classes) says 40,000 kills for a map that draws 30,000.

A review probe on MariaDB 10.11 reproduced this: 200,000 kills at 80% bot fights stored 30,000 human and 10,000 bot rows, and PointsAsync/FightsAsync returned 20,000 human and 10,000 bot rows.

MatchFights caps its live list at HeatmapReader.ServerLimit too, so it has the same mix.

Suggested fix / acceptance criteria

  • Read each class under its own limit. For example:

    (SELECT … WHERE map=@map AND bot_fight=0 ORDER BY id DESC LIMIT @human)
    UNION ALL
    (SELECT … WHERE map=@map AND bot_fight=1 ORDER BY id DESC LIMIT @bot)

    The existing idx_csp_kills_pair index serves this. Alternatively, raise the server-wide limit to at least MaxPointsPerMap + MaxBotFightsPerMap.

  • Keep MatchFights consistent with whichever approach is chosen.

  • Add a test against InMemoryKillMapStore (and, if run, the MySQL store): with both classes at their caps and bot fights newest, the server-wide read returns every stored human kill.

Activity

  1. added
    bug
    on Oct 29, 2026
  2. matt-edmondson commented on Oct 29, 2026

    @matt-edmondson
    ContributorAuthor

    Triage

    • Category: Bug. Confirmed on main: HeatmapReader.ServerLimit = 30_000 (Site/Data/HeatmapReader.cs:16) is applied to SelectKills/SelectDeaths/SelectFights (Core/Heatmaps/MySqlKillMapStore.cs:56-69), and those have no bot_fight filter. The prune at line 51 is per-class, so storage and reads disagree.
    • Priority: Medium. This breaks the README's promise that bot fights never push out a human's kills, on exactly the bot-heavy servers the separate cap was added for. The data is stored correctly, so only the view is wrong.
    • Area: heatmaps (MySqlKillMapStore, InMemoryKillMapStore, HeatmapReader, Live/MatchFights.cs)
    • Suggested assignment: the Site / heatmaps owner.
    • Duplicates / in progress: none found, and no open PR covers it. It is in the same area as Player page's "Heatmap" link opens the server's busiest map, where the player may have no kills, and the picker shows server-wide counts #44 and Heatmaps Lines tab draws nothing for kills whose killer and victim share a grid cell, but still counts them #60, but the defect is different.
    • Next step: the per-class UNION ALL read is the better fix, because it keeps the human share whatever the caps are set to. Raising the limit to MaxPointsPerMap + MaxBotFightsPerMap is the smaller change. Also update the SelectMaps count and MatchFights so all three agree, and add the in-memory store test.

    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions