fix(monsters): finish deleting experienceReward, column included

Design ruling R7 abolishes XP as a concept and says the column goes with
it, but no task in the plan actually dropped it -- the plan only dropped
characters.experience and combat_rewards.experience_granted. Task 9
removed experienceReward from the seed literals, leaving
monster_definitions.experience_reward as a NOT NULL column with no
default that nothing supplies. The first monster insert against a real
database would have failed on a constraint violation.

No suite here could have caught it: none of them connect to Postgres.

Drops the column in the slice migration (which has never been run, so
amending it in place is correct rather than stacking a second one),
removes the entity field, and clears the three test fixtures that still
set it. silver_min/silver_max deliberately stay -- spec 15 keeps a
direct currency drop available as a lore-valid exception, and XP has no
such carve-out.

Also retargets the seed idempotency test off renown: 1, which is the
seed's own default and so could not distinguish "preserved" from
"reset to default".

NOTE ON SCOPE: this commit also absorbs a Prettier reformatting pass
that was already sitting uncommitted in the working tree, which is why
it touches ~59 files. That churn is purely cosmetic line-rewrapping --
verified by inspection, and the suite is green at 267/267 with the build
at exactly the 3 expected errors owned by Tasks 10 and 11. The repo is
not Prettier-clean at baseline (119 files still flagged), so this was a
partial run by an earlier step, not a deliberate repo-wide format.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Bastian Wagner
2026-08-21 14:07:47 +02:00
parent dce26e00ad
commit 8835671657
59 changed files with 1368 additions and 399 deletions

View File

@@ -20,7 +20,10 @@ describe('CombatController', () => {
const module = await Test.createTestingModule({
controllers: [CombatController],
providers: [
{ provide: CombatService, useValue: { getCombat, getActiveCombat, performAction } },
{
provide: CombatService,
useValue: { getCombat, getActiveCombat, performAction },
},
],
}).compile();
@@ -34,20 +37,40 @@ describe('CombatController', () => {
});
it('delegates GET /api/combats/:combatId to combatService.getCombat', async () => {
const combat = { id: 'combat-1', status: 'ACTIVE', round: 1, player: {}, monster: {}, events: [], rewards: null };
const combat = {
id: 'combat-1',
status: 'ACTIVE',
round: 1,
player: {},
monster: {},
events: [],
rewards: null,
};
getCombat.mockResolvedValue(combat);
const response = await request(app.getHttpServer()).get('/api/combats/combat-1').expect(200);
const response = await request(app.getHttpServer())
.get('/api/combats/combat-1')
.expect(200);
expect(getCombat).toHaveBeenCalledWith(DEMO_CHARACTER_ID, 'combat-1');
expect(response.body).toEqual(combat);
});
it('delegates GET /api/combats/active to combatService.getActiveCombat', async () => {
const combat = { id: 'combat-1', status: 'ACTIVE', round: 3, player: {}, monster: {}, events: [], rewards: null };
const combat = {
id: 'combat-1',
status: 'ACTIVE',
round: 3,
player: {},
monster: {},
events: [],
rewards: null,
};
getActiveCombat.mockResolvedValue(combat);
const response = await request(app.getHttpServer()).get('/api/combats/active').expect(200);
const response = await request(app.getHttpServer())
.get('/api/combats/active')
.expect(200);
expect(getActiveCombat).toHaveBeenCalledWith(DEMO_CHARACTER_ID);
expect(getCombat).not.toHaveBeenCalled();
@@ -57,7 +80,9 @@ describe('CombatController', () => {
it('returns an empty body from GET /api/combats/active when no combat is running', async () => {
getActiveCombat.mockResolvedValue(null);
const response = await request(app.getHttpServer()).get('/api/combats/active').expect(200);
const response = await request(app.getHttpServer())
.get('/api/combats/active')
.expect(200);
expect(getActiveCombat).toHaveBeenCalledWith(DEMO_CHARACTER_ID);
expect(response.body).toEqual({});
@@ -65,7 +90,15 @@ describe('CombatController', () => {
});
it('delegates POST /api/combats/:combatId/actions with only the action field', async () => {
const combat = { id: 'combat-1', status: 'ACTIVE', round: 2, player: {}, monster: {}, events: [], rewards: null };
const combat = {
id: 'combat-1',
status: 'ACTIVE',
round: 2,
player: {},
monster: {},
events: [],
rewards: null,
};
performAction.mockResolvedValue(combat);
const response = await request(app.getHttpServer())
@@ -73,7 +106,11 @@ describe('CombatController', () => {
.send({ action: 'ATTACK' })
.expect(201);
expect(performAction).toHaveBeenCalledWith(DEMO_CHARACTER_ID, 'combat-1', 'ATTACK');
expect(performAction).toHaveBeenCalledWith(
DEMO_CHARACTER_ID,
'combat-1',
'ATTACK',
);
expect(response.body).toEqual(combat);
});
@@ -89,7 +126,13 @@ describe('CombatController', () => {
it('rejects server-owned combat fields the client must never send', async () => {
await request(app.getHttpServer())
.post('/api/combats/combat-1/actions')
.send({ action: 'ATTACK', damage: 999, playerHp: 1, monsterHp: 1, round: 99 })
.send({
action: 'ATTACK',
damage: 999,
playerHp: 1,
monsterHp: 1,
round: 99,
})
.expect(400);
expect(performAction).not.toHaveBeenCalled();