Class FleetInvariants

java.lang.Object
ai.badmonkey.agentspaces.test.FleetInvariants

public final class FleetInvariants extends Object
The minimal fleet oracle of srad/spoiler-peers.md ยง3.5 (SP-O-01, SP-O-02), checked over a FleetProbe once a fleet is quiescent:
  1. no honest member raised an error on its own threads;
  2. every member holds the same root for every replicated state;
  3. the frame drops since the baseline, by reason, are exactly the drops the scenario expected (its injected bad frames, and the stale or replayed frames its holds made);
  4. in a class A scenario, no honest member struck or quarantined another.
The fuller set (views, caches, connections, SP-O-07) comes after 0.7.0.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    assertHolds(Map<String,Long> expectedDrops, boolean classA)
    Fails with the first broken invariant, listing the rest.
    Starts an oracle whose drop check counts from now: a scenario takes it after the fleet formed, so the joins' own refusals are not charged to the script.
    broken(Map<String,Long> expectedDrops, boolean classA)
    The invariants that do not hold, each as one line naming the member; empty when all hold.
    static List<String>
    state(FleetProbe probe, boolean noPunishment)
    The invariants that need no baseline: no member raised an error, every member holds the same roots, and, when noPunishment, no member struck or quarantined another.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • baseline

      public static FleetInvariants baseline(FleetProbe probe)
      Starts an oracle whose drop check counts from now: a scenario takes it after the fleet formed, so the joins' own refusals are not charged to the script.
      Parameters:
      probe - the fleet's probe
      Returns:
      the oracle
    • broken

      public List<String> broken(Map<String,Long> expectedDrops, boolean classA)
      The invariants that do not hold, each as one line naming the member; empty when all hold.
      Parameters:
      expectedDrops - drops the scenario expects by reason, summed over the members (absent means 0)
      classA - whether no member may be struck or quarantined
      Returns:
      the broken invariants, the first one first
    • state

      public static List<String> state(FleetProbe probe, boolean noPunishment)
      The invariants that need no baseline: no member raised an error, every member holds the same roots, and, when noPunishment, no member struck or quarantined another. A fleet's own quiet-point check delegates here (RobustnessFleet.assertInvariants, SP-O-01).
      Parameters:
      probe - the fleet's probe
      noPunishment - whether a strike or quarantine of an honest member breaks the fleet
      Returns:
      the broken invariants, empty when all hold
    • assertHolds

      public void assertHolds(Map<String,Long> expectedDrops, boolean classA)
      Fails with the first broken invariant, listing the rest.
      Parameters:
      expectedDrops - drops the scenario expects by reason
      classA - whether no member may be struck or quarantined