Add three-member short alliance prototype
Verify and publish checkpoint container / container (push) Canceled after 0s

This commit is contained in:
Quintine committed 2026-10-29 02:31:50 +11:00
1 parent cdc47ed2e1
commit ef92ddf2b9
12 files changed
+343 -12

No files matched your search

+6 -4
View File
@@ -28,8 +28,9 @@ export type CoalitionAdmission = {
};
export type CoalitionState = {
version: 1;
/** Absent preserves the existing three-member maximum. */
variant?: 'unlimited';
/** Absent preserves the existing three-member limit and target selection.
* The distinct short variant retains that cap and uses the short target. */
variant?: 'three-short' | 'unlimited';
revision: number;
groups: CoalitionGroup[];
proposal: CoalitionAdmission | null;
@@ -64,7 +65,7 @@ const same = (left: unknown, right: unknown) => JSON.stringify(left) === JSON.st
const copy = <T>(value: T): T => structuredClone(value);
const legacyId = (members: readonly string[]) => `legacy:${JSON.stringify(sorted(members))}`;
export function emptyCoalitionState(variant?: 'unlimited'): CoalitionState {
export function emptyCoalitionState(variant?: CoalitionState['variant']): CoalitionState {
return { version: 1, ...(variant === undefined ? {} : {variant}), revision: 0, groups: [], proposal: null, usedEvents: [] };
}
function requireSeats(seats: readonly CoalitionSeat[]): void {
@@ -95,7 +96,8 @@ function requireGroup(group: CoalitionGroup, seats: readonly CoalitionSeat[], ma
check(same(actual, expected), 'A coalition must retain exactly one ordered edge for each pair.');
}
function requireState(state: CoalitionState): void {
check(record(state) && state.version === 1 && (state.variant === undefined || state.variant === 'unlimited') &&
check(record(state) && state.version === 1 &&
(state.variant === undefined || state.variant === 'three-short' || state.variant === 'unlimited') &&
Number.isSafeInteger(state.revision) && state.revision >= 0 &&
Array.isArray(state.groups) && Array.isArray(state.usedEvents) && state.usedEvents.every(id) &&
new Set(state.usedEvents).size === state.usedEvents.length &&