feat(#62): ideology / government-type change (v0.39.0) #73

Merged
kamilkrzywda merged 1 commits from feat/62-ideology into master 2026-10-15 22:57:36 +02:00
Owner

Fixes #62

Ideology / government-type change: a per-nation free-form ideology label (form of government) plus a TurnResult.ideology lever (coups / revolutions / reforms / constitutional changes) with a deterministic -5 stability dip and political narration.

  • Nation.ideology?: string (optional/additive; no db.ts change — a pre-v0.39 row loads with it absent)
  • IdeologyChange { target, to } + IdeologyOps { changes }; TurnResult.ideology required, placed between leaders and markers, default { changes: [] }
  • IDEOLOGY_STABILITY_EFFECT = -5 (the deterministic regime-shift dip)
  • validateIdeologyOps (exported, defensive, never throws) + applyIdeologyChange applied in applyTurnResult after leaders / before markers; wired into isMeaningful, validateTurnResult, the system prompt, and the runTurn unclear fallback
  • The change is a third, independent axis (distinct from a takeover rename and a leader swap); similar ideologies are a soft prompt-level compatibility nudge only
  • The stub never changes an ideology (ideology: { changes: [] }) — e2e (CI, LLM_STUB=1) is unaffected; the path is covered by unit tests
  • Tests: engine.test.ts (validate / isMeaningful / applyTurnResult / buildUserPrompt), protocol.test.ts (constant + nationForPrompt), db.test.ts (legacy load + round-trip); every TurnResult fixture updated

Local checks green: typecheck, lint, 511 unit tests, build.

Fixes #62 Ideology / government-type change: a per-nation free-form `ideology` label (form of government) plus a `TurnResult.ideology` lever (coups / revolutions / reforms / constitutional changes) with a deterministic -5 stability dip and political narration. - `Nation.ideology?: string` (optional/additive; no `db.ts` change — a pre-v0.39 row loads with it absent) - `IdeologyChange { target, to }` + `IdeologyOps { changes }`; `TurnResult.ideology` required, placed between `leaders` and `markers`, default `{ changes: [] }` - `IDEOLOGY_STABILITY_EFFECT = -5` (the deterministic regime-shift dip) - `validateIdeologyOps` (exported, defensive, never throws) + `applyIdeologyChange` applied in `applyTurnResult` after `leaders` / before `markers`; wired into `isMeaningful`, `validateTurnResult`, the system prompt, and the `runTurn` unclear fallback - The change is a third, independent axis (distinct from a takeover rename and a leader swap); similar ideologies are a soft prompt-level compatibility nudge only - The stub never changes an ideology (`ideology: { changes: [] }`) — e2e (CI, `LLM_STUB=1`) is unaffected; the path is covered by unit tests - Tests: `engine.test.ts` (validate / isMeaningful / applyTurnResult / buildUserPrompt), `protocol.test.ts` (constant + `nationForPrompt`), `db.test.ts` (legacy load + round-trip); every `TurnResult` fixture updated Local checks green: typecheck, lint, 511 unit tests, build.
kamilkrzywda added 1 commit 2026-10-15 22:54:50 +02:00
feat(#62): ideology / government-type change (v0.39.0)
CI / build + unit + e2e (pull_request) Successful in 2m33s
7866a1987d
Add a per-nation free-form ideology (form of government) field and a
TurnResult.ideology lever (coups / revolutions / reforms / constitutional
changes) with a deterministic -5 stability dip and political narration.

- shared/types.ts: Nation.ideology?: string (optional/additive)
- shared/protocol.ts: IdeologyChange / IdeologyOps, IDEOLOGY_STABILITY_EFFECT
  = -5, TurnResult.ideology (required, between leaders and markers),
  nationForPrompt now carries ideology
- server/engine.ts: validateIdeologyOps (exported, never throws),
  applyIdeologyChange (resolve -> set field -> -5 dip mirrored to regions +
  re-derived -> political event), ideology block in applyTurnResult after
  leaders / before markers, isMeaningful + validateTurnResult + system prompt
  + runTurn unclear fallback
- server/stub.ts: StubPayload gains ideology; deterministicTurn returns
  ideology: { changes: [] } (never changes one, e2e unaffected)
- Tests: engine.test.ts (validate / isMeaningful / applyTurnResult /
  buildUserPrompt), protocol.test.ts (constant + nationForPrompt),
  db.test.ts (legacy load + round-trip); every TurnResult fixture updated
- package.json -> 0.39.0; CHANGELOG v0.39.0 entry
kamilkrzywda scheduled this pull request to auto merge when all checks succeed 2026-10-15 22:57:33 +02:00
kamilkrzywda merged commit fff4163f2c into master 2026-10-15 22:57:36 +02:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: OpenCode/History#73