feat(#62): ideology / government-type change (v0.39.0)
CI / build + unit + e2e (pull_request) Successful in 2m33s
CI / build + unit + e2e (pull_request) Successful in 2m33s
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
This commit is contained in:
@@ -19,6 +19,9 @@ export interface StubPayload {
|
||||
// `leader` (v0.38.0, #61) is the per-nation named leader stamped by the
|
||||
// engine; the stub ignores it — it never changes a leader (see
|
||||
// deterministicTurn).
|
||||
// `ideology` (v0.39.0, #62) is the per-nation form of government stamped
|
||||
// by the engine; the stub ignores it — it never changes an ideology (see
|
||||
// deterministicTurn).
|
||||
nations: Record<
|
||||
string,
|
||||
{
|
||||
@@ -26,6 +29,7 @@ export interface StubPayload {
|
||||
territory?: string[];
|
||||
nuclear?: boolean;
|
||||
leader?: { name: string };
|
||||
ideology?: string;
|
||||
}
|
||||
>;
|
||||
};
|
||||
@@ -160,6 +164,14 @@ function truncate(s: string, n: number): string {
|
||||
* strike (it always returns `nuclear: { arm: [], strikes: [] }`) — the
|
||||
* nuclear / WMD path is covered by unit tests only, keeping the e2e
|
||||
* assertions untouched.
|
||||
*
|
||||
* (v0.38.0, #61) The stub likewise NEVER changes a leader (it always returns
|
||||
* `leaders: { changes: [] }`) — the leader path is covered by unit tests
|
||||
* only, keeping the e2e assertions untouched.
|
||||
*
|
||||
* (v0.39.0, #62) The stub likewise NEVER changes a nation's ideology (it
|
||||
* always returns `ideology: { changes: [] }`) — the ideology path is covered
|
||||
* by unit tests only, keeping the e2e assertions untouched.
|
||||
*/
|
||||
export function deterministicTurn(p: StubPayload): TurnResult {
|
||||
const state = p.state;
|
||||
@@ -233,6 +245,7 @@ export function deterministicTurn(p: StubPayload): TurnResult {
|
||||
industry: { projects: [] }, // the stub never declares industry projects (see doc comment)
|
||||
nuclear: { arm: [], strikes: [] }, // the stub never arms or strikes (see doc comment)
|
||||
leaders: { changes: [] }, // the stub never changes leaders (see doc comment)
|
||||
ideology: { changes: [] }, // the stub never changes ideologies (see doc comment)
|
||||
markers: { add: [], remove: [] }, // the stub never touches markers (see doc comment)
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user