dryRun method

Map<String, List<String>> dryRun(
  1. JsonMap body,
  2. void apply()
)

The I1 conflicts the request body would cause: switches its resolve_i1 agents, runs apply and checks, then restores everything (a preview writes nothing, 07 9.3).

Throws 404 not_found for a resolve_i1 ID that is not an agent.

Implementation

Map<String, List<String>> dryRun(JsonMap body, void Function() apply) {
  final agents = resolveAgents(body);
  final saved = _Snapshot(world, audit);
  try {
    for (final a in agents) {
      setPolicy(a, 'organization', null);
    }
    apply();
    return world.i1Conflicts();
  } finally {
    saved.restore();
  }
}