A House Divided A House DividedDocumentation
↵
Changelog
Game Design/Elections & Campaigns

Executive Term Limits

Last updated 2026-10-29
Player wikiExecutive Term Limits
Source files

Summary#

Per-country configurable term limits on a single executive office (President, Uachtarán, etc.). The logic is the pure module . The per-country values sit in the executiveTermLimit block of each country's client config in , mirrored in src/lib/countries/<id>/institutionsFacts.ts, and typed in .

Player guide: Executive Term Limits

The limit exists so a single character cannot hold the top executive office forever, and so the vice-presidency cannot be used as a back door around the cap.

Rules#

Each country config carries an optional executiveTermLimit block:

executiveTermLimit?: {
  officeKey: string;               // e.g. "president", "uachtaran"
  maxTermsPerCharacter: number;    // e.g. 2
  blocksRunningMateSelection: boolean;
}

A country with no executiveTermLimit has no limit: getExecutiveTermLimit returns null and hasReachedExecutiveTermLimit is always false.

Country officeKey maxTermsPerCharacter blocksRunningMateSelection Source
United States president 2 true
Ireland (IE) uachtaran 2 false
Brazil (BR) president 2 true
Nigeria (NG) president 2 true

blocksRunningMateSelection distinguishes offices where a term-limited incumbent still cannot be picked as a running mate (US President under the 12th/22nd Amendment reading used here) from offices where the limit only blocks re-election to the office itself.

Terms-served count#

getExecutiveTermsServed(character, countryId) returns the greater of two sources:

  1. Stored counter: character.executiveTermsServed[countryId], incremented on each term start.
  2. Historical derivation: getHistoricalExecutiveTermsServed counts character.careerHistory events where event.office.type === officeKey, event.type is "appointed" or "elected", and event.partyCountryId is either this country or unset.

Taking the max means a character imported or backfilled with career history but no stored counter still gets an accurate count, and a stored counter that has already been incremented is never undercounted by a stale history scan.

Terms counted toward the limit#

getExecutiveTermsCountedTowardLimit = max(0, termsServed - foundingTerms). A founding term is a career event flagged foundingTerm: true for the executive office: the term won at a world's founding (cycle 0) election. It still counts as served for display but not toward the cap, so a seeded first president is not penalised for the world's starting point. The limit is reached when the counted number is greater than or equal to maxTermsPerCharacter.

Functions#

Function Purpose
getExecutiveTermsServed(character, countryId) Effective terms served, max(stored, historical)
getExecutiveTermLimit(countryId) maxTermsPerCharacter or null if the country has no limit configured
hasReachedExecutiveTermLimit(character, countryId) true when a limit exists and counted terms are at or past it
incrementExecutiveTermsServedUpdate(character, countryId) Returns a Mongo $set-shaped update ({"executiveTermsServed.<countryId>": n+1}) where n is the effective terms served, for callers to apply on term start

Rejection messages#

The checks reject with fixed messages. Filing returns HTTP 400 "This character has already served the maximum number of {office} terms." (). The running-mate route returns HTTP 400 "That character has already served the maximum number of presidential terms and cannot be selected as Vice President." (). Succession does not message the player: it logs a warning and returns false ().

Data#

Collection Field Read or written Notes
characters executiveTermsServed read, written Partial<Record<CountryId, number>>, one counter per country. Written by incrementExecutiveTermsServedUpdate at seating and succession.
characters careerHistory[] read, appended Events with office.type, type (elected, appointed), partyCountryId, electionId, foundingTerm. The seating and succession writers push the events that the historical scan later counts.
characters currentOffice written Set to { type: "president" } at seating and succession (not read by the limit itself).
electedOfficials president row written Updated by succession and seating. The limit does not read it.
elections cycle read cycle === 0 marks a founding election, which stamps foundingTerm: true on the event.

Player-visible: the White House page reads getExecutiveTermsServed to show the current term number (, floored at 1). The cap itself is shown on the executive pages from the country config. The counter and career history are visible on a character's profile.

Configuration#

There are no gameConfig fields, flags or era presets for this system. The only configuration is the static executiveTermLimit block per country, in the table under Rules.

Setting Default Where set
executiveTermLimit.officeKey none (no limit) executiveTermLimit in , mirrored in src/lib/countries/<id>/institutionsFacts.ts
executiveTermLimit.maxTermsPerCharacter none same
executiveTermLimit.blocksRunningMateSelection none same

The runtime reads getCountryClientConfig(countryId).executiveTermLimit, so the client config is the live source. Changing a value needs a deploy. A new country gets a limit only by adding the block.

Timing#

Nothing runs on a schedule. The limit is checked at three moments and the counter moves at two:

The seating write is guarded by a filter that matches only when no career event of the same type and electionId already exists, which is what makes the retry safe.

Worked trace#

A US character has executiveTermsServed.US = 1 and career history showing two elected president events, one of them the founding term (foundingTerm: true, from a cycle 0 election).

Step Computation Result
Limit getExecutiveTermLimit("US") 2
Stored terms executiveTermsServed.US 1
Historical terms 2 events with office.type = "president", type = "elected", partyCountryId = "US" 2
Terms served max(1, 2) 2
Founding terms events with foundingTerm === true 1
Counted toward limit max(0, 2 - 1) 1
Reached? 1 >= 2 false, filing allowed

The character files, wins the next cycle (cycle 1, not a founding election), and is seated:

Step Computation Result
Increment payload {"executiveTermsServed.US": 2 + 1} (effective terms served is 2, so the write is 3) 3
New career event type: "elected", office.type: "president", electionId set, no foundingTerm 3 events in history
Terms served max(3, 3) 3
Counted toward limit 3 - 1 2
Reached? 2 >= 2 true, filing and running-mate picks (US) blocked

Now the contingent case. A different US character with stored counter 0 and no history is seated as acting president after a House deadlock. Seating skips the counter write (acting), pushes an appointed event labelled "Acting President", and the history scan counts it: terms served max(0, 1) = 1. If that character later wins an election, the history has 2 counted events and the counter is written as 1 + 1 = 2, so the limit is reached after only one elected term.

Edge cases and limits#

Invariants#

Invariant Enforced by
The effective count never goes down when career history is added: it is max(stored, historical) By construction in getExecutiveTermsServed; executiveTermLimits.test.ts covers stored-only, history-only and both
Counted terms are never negative Math.max(0, ...) in getExecutiveTermsCountedTowardLimit; not directly tested with a negative case
A seating retry never records a second term The $not $elemMatch filter on the seating write; presidentExecutiveSeating.test.ts checks the increment and event fields, not the retry path
An acting seating never touches the stored counter presidentExecutiveSeating.test.ts ("seats an acting president without counting a term")
A limited vice president never succeeds presidentialSuccession.test.ts ("blocks succession when the VP character already reached the presidential term limit")
Counters are per country Keyed by countryId; executiveTermLimits.test.ts covers IE versus US events
Stored counter and history agree Not enforced. Only the max of the two is used, so drift in either direction is tolerated rather than detected.

Failure and recovery#

Connections#

Driven by:

Affects:

Tests#

Test file Covers
Limit lookup, stored versus historical count, founding term exclusion, next-term payload, Ireland uachtaran counting, US regression
src/lib/turn/election/presidentExecutiveSeating.test.ts Counter increment per country, foundingTerm for cycle 0, acting seating leaves the counter alone
Succession blocked when the vice president has reached the limit
The Ireland config block
White House term display

Known gaps: mocks hasReachedExecutiveTermLimit to always return false, so the filing rejection itself has no test. There are no tests for the running-mate routes or primaryRunningMates.ts limit checks, and nothing tests the seating retry path.

Known issues and history#

Last checked: 2026-10-29, version 1.18.0

Ask