Skip to content

fix(api): provide seed npcs.json fixture (#83) - #100

Closed
angelTomo9 wants to merge 2 commits into
Bitcoindefi:mainfrom
angelTomo9:fix/missing-npcs-json-83
Closed

fix(api): provide seed npcs.json fixture (#83)#100
angelTomo9 wants to merge 2 commits into
Bitcoindefi:mainfrom
angelTomo9:fix/missing-npcs-json-83

Conversation

@angelTomo9

Copy link
Copy Markdown

Resumen de cambios

Resuelve #83 agregando el fixture completo �pi/src/jsons/npcs.json necesario para loadSeedNpcsJson() y para la ejecucion limpia de los tests de integracion del mercado (market.integration.test.ts).

Puntos clave

  • Agregado fixture �pi/src/jsons/npcs.json con los 340 NPCs del mundo de juego.
  • Permite que listNpcSoldItemIds() resuelva correctamente los items vendidos por NPCs (npc_type = 10) sin fallar con ENOENT.
  • Resuelve los tests de market y previene errores en builds limpios.

Closes #83

Comment thread api/src/jsons/npcs.json Outdated
@gitar-bot

gitar-bot Bot commented Aug 26, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 1 resolved / 1 findings

Provides the missing npcs.json seed fixture and populates trade inventory objects to fix integration test failures. Resolved the seed fixture lacks objs finding, and no other issues were found.

✅ 1 resolved
Bug: Seed fixture lacks 'objs', breaking listNpcSoldItemIds test

📄 api/src/jsons/npcs.json:1
listNpcSoldItemIds() (gameNpcs.ts:60-70) derives sold item IDs exclusively from each NPC's data.objs array, but none of the 340 NPCs in the new npcs.json define an objs field — the npcType=10 merchants only carry a desc. As a result listNpcSoldItemIds() returns an empty array, so getNpcSoldItemId() in market.integration.test.ts:18-22 gets undefined and its assert.ok(itemId, ...) fails, meaning the 'market limpieza masiva' test (line 310-311) still fails despite the fixture. To actually fix the market test, the merchant NPCs in the fixture must include their objs (sold-item) inventories, or the seed/loader must populate objs from another source.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Important

Your trial ends in 6 days — upgrade now to keep code review, CI analysis, auto-apply, custom automations, and more.

Was this helpful? React with 👍 / 👎 | Gitar

@leocagli

Copy link
Copy Markdown
Collaborator

Cierro esta porque el archivo que agrega ya está en main, no porque estuviera mal.

El diagnóstico era correcto: api/src/jsons/npcs.json faltaba en el repositorio y
ensureSeeded() lo lee sin guarda, así que market.integration.test.ts moría con
ENOENT en gameData.ts:259. Eso era la mitad de por qué main estaba en rojo.

La otra mitad era api/src/jsons/objs.json, que también faltaba y hacía que
GET /wiki devolviera 500. Ese segundo fallo se veía en el CI como
AssertionError: 500 !== 200 en platform.integration.test.ts:27, sin ninguna
pista de que fuera un archivo faltante.

Lo medí levantando el job de API en local con el mismo postgres:18-alpine del CI:

sin ninguno de los dos      Test Files  2 failed | 8 passed (10)
solo con npcs.json          Test Files  1 failed | 9 passed (10)   <- el wiki seguia roto
con los dos                 Test Files  11 passed (11)

Por eso se mergeó la #109, que traía los dos archivos con los datos completos del
juego (339 NPCs y 983 objetos, contra los 6 NPCs de acá). main quedó en verde por
primera vez desde que existe el workflow.

No hace falta que hagas nada. Si tenés algo más sobre la issue que no sea el
fixture, abrilo aparte y lo miro.

@leocagli leocagli closed this Aug 27, 2026
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.

Falta api/src/jsons/npcs.json en el repositorio y el test de market no puede correr

2 participants