getCanonicalName = (compartment, trustRoot = true) => {
  // NOTE: the algorithm creating paths happens to be identical to the one in @lavamoat/aa package. Not that it matters because policies cannot be reused between this and other lavamoat tools.
  if (!compartment.path) {
    throw new GenerationError(
      `Computing canonical name failed: compartment "${compartment.name}" (${compartment.location}) has no "path" property; this is a bug`
    )
  }
  if (isEntryCompartment(compartment)) {
    if (trustRoot) {
      return LAVAMOAT_PKG_POLICY_ROOT
    }
    return compartment.name
  }
  return compartment.path.join('>')
}
Determine the canonical name for a compartment descriptor

@param {CompartmentDescriptor} compartment Compartment descriptor
@param {boolean} [trustRoot=true] If `false`, never return a canonical name
  of {@link LAVAMOAT_PKG_POLICY_ROOT}. Default is `true`
@returns {CanonicalName} Canonical name
@throws {ReferenceError} If compartment has no path
@internal