@htilabs/platform-common-models 0.42.0 → 0.42.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -624,10 +624,17 @@ interface ShareCategoryEntry {
624
624
  } | null;
625
625
  /** Rows under the platform safety floor — never leave. */
626
626
  readonly floorItems: string[];
627
- /** Rows the governing list / the account's heightened toggles / the ceiling leave out. */
627
+ /**
628
+ * Rows the governing list / the account's heightened toggles / the ceiling leave out. A code is
629
+ * withheld when it OR AN ANCESTOR is listed here. Since 0.42.1 a grouping is listed only when
630
+ * nothing beneath it is covered — when a list names some of its rows, the grouping is NOT listed
631
+ * and its uncovered rows are listed one by one instead. So a grouping code's absence here does
632
+ * not mean the whole grouping may leave: for a send decision read `shareRowCeiling` +
633
+ * `rowsOverCeiling`, never a grouping-code check against `excludedItems` alone.
634
+ */
628
635
  readonly excludedItems: string[];
629
636
  readonly excludedReason: string | null;
630
- /** Rows the sending team's own policy leaves out (5d). */
637
+ /** Rows the sending team's own policy leaves out (5d). Same shape and same caveat as `excludedItems`. */
631
638
  readonly teamExcludedItems: string[];
632
639
  readonly teamExcludedReason: string | null;
633
640
  }
@@ -624,10 +624,17 @@ interface ShareCategoryEntry {
624
624
  } | null;
625
625
  /** Rows under the platform safety floor — never leave. */
626
626
  readonly floorItems: string[];
627
- /** Rows the governing list / the account's heightened toggles / the ceiling leave out. */
627
+ /**
628
+ * Rows the governing list / the account's heightened toggles / the ceiling leave out. A code is
629
+ * withheld when it OR AN ANCESTOR is listed here. Since 0.42.1 a grouping is listed only when
630
+ * nothing beneath it is covered — when a list names some of its rows, the grouping is NOT listed
631
+ * and its uncovered rows are listed one by one instead. So a grouping code's absence here does
632
+ * not mean the whole grouping may leave: for a send decision read `shareRowCeiling` +
633
+ * `rowsOverCeiling`, never a grouping-code check against `excludedItems` alone.
634
+ */
628
635
  readonly excludedItems: string[];
629
636
  readonly excludedReason: string | null;
630
- /** Rows the sending team's own policy leaves out (5d). */
637
+ /** Rows the sending team's own policy leaves out (5d). Same shape and same caveat as `excludedItems`. */
631
638
  readonly teamExcludedItems: string[];
632
639
  readonly teamExcludedReason: string | null;
633
640
  }
@@ -936,6 +936,9 @@ function resolveShare(input) {
936
936
  let excludedReason = null;
937
937
  const teamExcludedItems = [];
938
938
  let teamExcludedReason = null;
939
+ const outside = (covered) => items.filter(
940
+ (r) => !covered(r) && !items.some((d) => d !== r && covered(d) && scope.ancestorsOf(d).includes(r))
941
+ );
939
942
  const addExcluded = (rows, why) => {
940
943
  for (const r of rows)
941
944
  if (!floorItems.includes(r) && !excludedItems.includes(r))
@@ -971,7 +974,7 @@ function resolveShare(input) {
971
974
  }
972
975
  if (allowed && !req && groupCeiling !== null && !scopeListStrictlyCovers(scope, groupCeiling, g)) {
973
976
  addExcluded(
974
- items.filter((r) => !scopeListCovers(scope, groupCeiling, g, r)),
977
+ outside((r) => scopeListCovers(scope, groupCeiling, g, r)),
975
978
  "Outside the payload for this purpose"
976
979
  );
977
980
  }
@@ -982,17 +985,16 @@ function resolveShare(input) {
982
985
  }
983
986
  if (allowed && !req && polScopeBinds && !scopeListStrictlyCovers(scope, govList, g)) {
984
987
  addExcluded(
985
- items.filter((r) => !scopeListCovers(scope, govList, g, r)),
988
+ outside((r) => scopeListCovers(scope, govList, g, r)),
986
989
  `Outside what the \u201C${govName}\u201D policy allows for this purpose`
987
990
  );
988
991
  }
989
992
  const govRows = polScopeBinds ? own2(govItems, g) : void 0;
990
993
  if (allowed && !req && isStringList2(govRows)) {
991
994
  const keep = new Set(govRows);
995
+ const kept = (r) => keep.has(r) || scope.ancestorsOf(r).some((a) => a !== g && keep.has(a));
992
996
  addExcluded(
993
- items.filter(
994
- (r) => !keep.has(r) && !scope.ancestorsOf(r).some((a) => a !== g && keep.has(a))
995
- ),
997
+ outside(kept),
996
998
  `Outside what the \u201C${govName}\u201D policy allows for this purpose`
997
999
  );
998
1000
  }
@@ -1005,15 +1007,13 @@ function resolveShare(input) {
1005
1007
  const why = `Outside what your team's \u201C${tcNamed?.name}\u201D policy allows`;
1006
1008
  const outRows = /* @__PURE__ */ new Set();
1007
1009
  if (tcScope !== null && !scopeListStrictlyCovers(scope, tcScope, g)) {
1008
- for (const r of items)
1009
- if (!scopeListCovers(scope, tcScope, g, r)) outRows.add(r);
1010
+ for (const r of outside((x) => scopeListCovers(scope, tcScope, g, x))) outRows.add(r);
1010
1011
  }
1011
1012
  const tcRows = own2(tcItems, g);
1012
1013
  if (isStringList2(tcRows)) {
1013
1014
  const keep = new Set(tcRows);
1014
- for (const r of items)
1015
- if (!keep.has(r) && !scope.ancestorsOf(r).some((a) => a !== g && keep.has(a)))
1016
- outRows.add(r);
1015
+ const kept = (r) => keep.has(r) || scope.ancestorsOf(r).some((a) => a !== g && keep.has(a));
1016
+ for (const r of outside(kept)) outRows.add(r);
1017
1017
  }
1018
1018
  for (const r of outRows)
1019
1019
  if (!floorItems.includes(r) && !excludedItems.includes(r))