web/docs/design/CLAN-REBELLION-JARVIS.md

3.6 KiB

Clan rebellion — DR_DEV-000009M

The current ordinary clan leader declares rebellion from Clan → Decisions. The declaration is a QST key, bound to the clan, linked player identity, current office deed, incumbent main clan, registered Home Block, world and active season. There is no election application window. A declaration alone changes no office. Companies and protected institutional clans cannot use this conquest route. House offices require matching player allegiance and clan home-world alignment; Bene/Guild allegiance and the existing Council/sietch eligibility still apply.

Website / game contract

  1. GET /api/clans/decisions/rebellion returns the current leader's choices and journal. Each available choice contains its current target bindings.
  2. Same-origin authenticated POST declare takes clanId, officeKey, expectedTermId, expectedHomeBlockId, UUID requestId, and confirmed:true. Changed targets require reviewing a fresh choice. POST cancel takes only questKeyId. Neither browser action can claim victory.
  3. A future registered game producer calls recordCapture(producer, {questKeyId, eventId}). Its injected resolveVictory must read authoritative game evidence, never copy an untrusted request payload. The default producer authorizer denies all callers; this batch includes no Minecraft producer or browser override.
  4. Evidence fields: confirmed:true, source:'minecraft', mode:'open-rebellion', event/declaration key IDs, attacking/defending clan IDs, Home Block/world IDs, linked winner UUID, source office term ID, declaration timestamp and capture timestamp. The QSM key records this immutable proof.
  5. applyCapture(producer, {evidenceKeyId}) verifies both keys and the current domain bindings, consumes the QST once, supersedes the incumbent term, records the successor deed and credits Reputation in one central transaction. The successor keeps the original election cycle and scheduled expiry. Elections, ballots and ordinary clan membership are not rewritten. Existing term-bound access follows the new deed. Return the stored completion receipt to the game; repeating the same evidence returns the same receipt.

Development/simulated claim snapshots cannot prove a production capture. Tests simulate the trusted producer in isolated databases, including the round trip.

Rewards and funding

Emperor: 10,000 Reputation XP and 25,000 DM. Other compatible offices: 2,500 Reputation XP and 5,000 DM. Reputation goes to the incoming holder; DM goes to the winning clan. Rewards are once per clan, office and season. Repeated succession does not create another reward. Personal XP remains separate.

The DM job waits until both settings are configured:

  • REBELLION_REWARD_SOURCE_ACCOUNT: an existing active payment account ID.
  • REBELLION_REWARD_SOURCE_OWNER_ID: its currently authorised funding user UUID.

The minute scheduler submits through existing PostbankPayments.transfer in standard mode. Existing bank processing posts it at the ordinary processing window. No balances are written by the quest consumer, no money is minted, and the defeated player is never debited. Missing funds, expired debit authority or an unavailable clan payment account leave the reward waiting for review. The quest-key UUID is the bank request ID; recovery checks the existing bank order before resubmitting. The journal distinguishes awaiting funding, bank processing and paid. No production funding account has been selected by this change.

Seasonal cross-type guard/holding awards and their templates remain deferred.