getValidCompartmentDescriptor = (compartmentName) => {
      /* c8 ignore next */
      if (!compartmentName) {
        // The `compartment` prop can be `undefined` per the typings, though
        // I'm not sure if this will ever occur in practice.
        return
      }

      const moduleDescriptorCompartment =
        compartmentMap.compartments[compartmentName]

      /* c8 ignore next */
      if (!moduleDescriptorCompartment) {
        // "should never happen". maybe throw instead
        return
      }

      // All compartment descriptors will have a module descriptor which
      // refers to itself. We can safely ignore the module descriptor for
      // the current compartment, since we only wish to consider _other_
      // imports.
      if (moduleDescriptorCompartment === compartmentDescriptor) {
        return
      }

      return moduleDescriptorCompartment
    }
Gets a valid {@link CompartmentDescriptor} from a compartment name, but
only if it's not the entry compartment or the
{@link compartmentDescriptor current one}.

@param {string} [compartmentName] Compartment name
@returns {CompartmentDescriptor | undefined}