Skip to content

fix(game-data): degrade gracefully when items_game_cdn is unavailable#1

Merged
marttinm merged 1 commit into
masterfrom
fix/items-game-cdn-404
Jul 10, 2026
Merged

fix(game-data): degrade gracefully when items_game_cdn is unavailable#1
marttinm merged 1 commit into
masterfrom
fix/items-game-cdn-404

Conversation

@marttinm

Copy link
Copy Markdown

Problem

`items_game_cdn.txt` was removed from SteamDatabase/GameTracking-CS2. The download URL in `lib/game_data.js` now returns 404:

```
https://raw.githubusercontent.com/SteamDatabase/GameTracking-CS2/master/game/csgo/pak01_dir/scripts/items/items_game_cdn.txt
```

Confirmed via `gh api search/code` against SteamDatabase/GameTracking-CS2: the file no longer exists at any path (0 results).

Because of that, `this.items_game_cdn` stays `false` forever, and the guard in `addAdditionalItemProperties()`:

```js
if (!this.items_game || !this.items_game_cdn || !this.csgo_english) return;
```

aborts enrichment for every single item, so the price service receives responses with no usable float/paint data ("Inspect service returned no usable float data").

Upstream status

Open, unmerged upstream PR csfloat#250 ("Changed service to steamapis") addresses the same root cause by swapping the dead GameTracking-CS2 URL for a paid third-party API (`api.steamapis.com/image/items/730`, requires an API key). That's the right call for consumers who need `imageurl`, but it adds an external paid dependency we don't need: nothing in our price_service (`floatInspectClient.js`) reads `imageurl` — only `floatvalue`, `paintseed`, and `paintindex` are consumed.

Fix

Instead of replacing the CDN source, make it optional:

  • Split the guard so enrichment only requires `items_game` and `csgo_english` (which are still fetched successfully).
  • Make the `imageurl` lookup conditional on `items_game_cdn` actually being loaded, instead of blocking the whole function.
  • `items_game_cdn_url` fetch attempt is left in place (harmless if it keeps 404ing; free to revisit if GameTracking-CS2 restores/relocates the file).

No new external dependency, no API key required, smaller diff than upstream csfloat#250.

Test plan

No test harness in this repo. Manual smoke test (documented here, not committed):

```js
const GameData = require('./lib/game_data.js');
const gd = Object.create(GameData.prototype);
gd.items_game = { paint_kits: {...}, items: {...}, rarities:{}, qualities:{}, sticker_kits:{}, keychain_definitions:{} };
gd.items_game_cdn = false; // simulates the permanent 404 state
gd.csgo_english = new Proxy({...}, LanguageHandler);
gd.schema = { originNames: [] };
gd.addAdditionalItemProperties(iteminfo);
```

Result with `items_game_cdn = false`:

  • Before fix: function returns immediately, `iteminfo` unchanged.
  • After fix: `iteminfo` gets `min`, `max`, `weapon_type`, `item_name`, `full_item_name` populated correctly; `imageurl` is simply absent (as expected, since there's no CDN data to map it from). No crash.

Deploy plan (not executed by this PR)

Server compose builds this service from `../inspect` (sibling of `magicmarket_docker`):

  1. Merge this PR to `master`.
  2. On the server: `git pull` in the `inspect` checkout.
  3. `docker compose build inspect`
  4. `docker compose up -d inspect`

items_game_cdn.txt was removed from SteamDatabase/GameTracking-CS2 and
its raw.githubusercontent.com URL now 404s (see csfloat#250).
items_game_cdn therefore stays false forever, and the enrichment guard
in addAdditionalItemProperties bailed out entirely whenever it was
falsy, silently dropping floatvalue/paintseed/paintindex/names for
every inspected item.

The CDN file only ever fed the optional imageurl field, which is not
consumed by any downstream consumer in this fork. Split the guard so
enrichment only requires items_game and csgo_english, and make the
imageurl lookup conditional on items_game_cdn actually being loaded.
@marttinm marttinm merged commit b22ae74 into master Jul 10, 2026
@marttinm marttinm deleted the fix/items-game-cdn-404 branch July 10, 2026 21:05
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