@htilabs/platform-common-models 0.60.0 → 0.61.0
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.
- package/README.md +72 -0
- package/dist/index.cjs +81 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +81 -7
- package/dist/index.js.map +1 -1
- package/dist/sharing-ceiling/index.cjs +81 -7
- package/dist/sharing-ceiling/index.cjs.map +1 -1
- package/dist/sharing-ceiling/index.d.cts +64 -4
- package/dist/sharing-ceiling/index.d.ts +64 -4
- package/dist/sharing-ceiling/index.js +81 -7
- package/dist/sharing-ceiling/index.js.map +1 -1
- package/package.json +1 -1
- package/src/sharingCeiling/__tests__/resolveShare.purposeRule.test.ts +836 -0
- package/src/sharingCeiling/index.ts +4 -0
- package/src/sharingCeiling/resolve.ts +219 -15
package/README.md
CHANGED
|
@@ -16,6 +16,78 @@ Package exports are organized into a public root API and a small number of
|
|
|
16
16
|
dedicated subpaths (`/validation`, `/cvcs`) — consult `package.json` for the
|
|
17
17
|
authoritative `exports` map.
|
|
18
18
|
|
|
19
|
+
## 0.61.0 — the share resolver names an authored purpose-specific partner rule: `partnerPurposeRule` → the virtual `byPurpose` fork (additive; Crysta 2026-11-10, "match the prototype")
|
|
20
|
+
|
|
21
|
+
**What changed.** `resolveShare` gains one optional input and reads one more
|
|
22
|
+
rung of the prototype's ladder (`src/data.js` @ aa2c63a `governingPolicyFor`
|
|
23
|
+
L55006-L55028). When no policy is attached to the relationship for the
|
|
24
|
+
purpose, but the account has AUTHORED a purpose-specific rule for the partner
|
|
25
|
+
(`policies.partnerOverrides[partner].byPurpose[purpose]` with a
|
|
26
|
+
`sharingPosture` — the Share Partners "purpose-specific rule"), the answer
|
|
27
|
+
names that rule as the governing policy:
|
|
28
|
+
|
|
29
|
+
- input `partnerPurposeRule?: { posture: "open" | "approval" | "blocked";
|
|
30
|
+
partnerName?: string | null } | null`;
|
|
31
|
+
- `governing` = `{ id: "pol-bp-<partner>-<purpose>", familyId: (the same),
|
|
32
|
+
name: "<purposeLabel> — <partnerName> variant", version: 1, level:
|
|
33
|
+
"relationship", posture: <the rule's>, infoScope: null, infoScopeItems:
|
|
34
|
+
null, edited: true, origin: "fork", virtual: true, rulePath:
|
|
35
|
+
"policies.partnerOverrides[<partner>].byPurpose[<purpose>] (purpose-specific
|
|
36
|
+
rule, reported as its fork)" }` — `ShareNamedPolicy` gains `virtual?: true`;
|
|
37
|
+
- the rung sits after the relationship policy and before the account
|
|
38
|
+
default; a team-to-team row and an attached relationship policy still win;
|
|
39
|
+
the sending team's own policy still rides as a ceiling over it (data.js
|
|
40
|
+
`done()`), now also when that team policy is the account default the fork
|
|
41
|
+
sits over.
|
|
42
|
+
|
|
43
|
+
**What binds — the prototype's `effectiveCeiling`, with two deliberate corrections.**
|
|
44
|
+
|
|
45
|
+
- **Posture starts from the rule** whenever a rule is present, whatever the
|
|
46
|
+
ladder named (data.js L55342: `bp.sharingPosture || over.sharingPosture ||
|
|
47
|
+
…` — the rule first): **`relationshipPosture` is ignored when a
|
|
48
|
+
`partnerPurposeRule` is present**, so the answer never depends on a caller
|
|
49
|
+
keeping the two in sync. Policies and the team ceiling can only raise it.
|
|
50
|
+
Under the fork the account default's posture is not consulted (L55391 skips
|
|
51
|
+
a virtual policy) — so a rule saying open over an account default saying
|
|
52
|
+
blocked now ALLOWS the share (0.60.0, which had no fork, answered blocked).
|
|
53
|
+
- **Scope under the fork** = clamp 5's ceiling (L55504): `legacyCeiling` (a
|
|
54
|
+
rule's own category list, if the caller still carries one, goes there),
|
|
55
|
+
else an EDITED account default's category list — data.js projects it into
|
|
56
|
+
`sharingScopeEdits[__default__]` (`projectScopeEdits` L55163-L55164), read
|
|
57
|
+
as "Outside the payload for this purpose" — else the Platform default's
|
|
58
|
+
starting scope. The default's list does not bind as 5b (L55539). The team
|
|
59
|
+
ceiling (5d), the account's Information Scope, the Platform default's
|
|
60
|
+
Required / Blocked and the floor bind as everywhere.
|
|
61
|
+
- **Correction 1 — field groups (narrower than the prototype, pending the
|
|
62
|
+
owner's word).** The edited account default's field groups
|
|
63
|
+
(`infoScopeItems`) still bind under the fork. data.js drops them (its 5c,
|
|
64
|
+
L55658, reads only the governing policy) while keeping the same default's
|
|
65
|
+
category list; a posture-only partner rule must not silently release field
|
|
66
|
+
groups the admin withheld. For the same reason the edited default's
|
|
67
|
+
category list binds even when `legacyCeiling` is passed (data.js would read
|
|
68
|
+
the legacy partner rule instead of it, L55504; 0.60.0 bound both).
|
|
69
|
+
- **Wording.** When the rule itself blocked: a discretionary share is excluded
|
|
70
|
+
as "Partner is blocked for this purpose by your account's sharing policy"
|
|
71
|
+
(`policies.partnerOverrides[<p>].byPurpose[<purpose>].sharingPosture=blocked
|
|
72
|
+
(Share Partners — purpose-specific rule)`, L55447-L55448); a report is
|
|
73
|
+
carved out as "Partner is blocked for ordinary sharing — reachable for
|
|
74
|
+
reports" (`reports-never-blocked-at-partner-layer (…)`, L55436-L55446).
|
|
75
|
+
- **Correction 2 — the saved cause is the real cause.** data.js uses the
|
|
76
|
+
purpose-rule sentence whenever a rule exists, even when the rule is open
|
|
77
|
+
and an attached policy blocked (its path then claims the rule was
|
|
78
|
+
blocked). Here the policy that blocked is named; the decision is the same.
|
|
79
|
+
- A rule for an `__external__` recipient is ignored (L55333: `__external__`
|
|
80
|
+
stays scope-only); not applied inside the account; a posture that is not
|
|
81
|
+
one of the three is no rule.
|
|
82
|
+
|
|
83
|
+
**Consumers.** Nothing changes until an app passes `partnerPurposeRule`;
|
|
84
|
+
without it every answer is byte-identical to 0.60.0 (proved over 1,440
|
|
85
|
+
vectors). PAVE and Thread pass it
|
|
86
|
+
when the relationship row carries a purpose-specific posture for the purpose,
|
|
87
|
+
with `purposeLabel` and the partner's display name, and read
|
|
88
|
+
`governing.virtual` to know the governing policy is the rule (no document to
|
|
89
|
+
open).
|
|
90
|
+
|
|
19
91
|
## 0.60.0 — the Org record names who added an organization `addedBy` (BREAKING vs 0.59.0, which no app adopted)
|
|
20
92
|
|
|
21
93
|
An organization's arrival now uses the same three names a Program, a Service
|
package/dist/index.cjs
CHANGED
|
@@ -26378,8 +26378,31 @@ function resolveShare(input) {
|
|
|
26378
26378
|
};
|
|
26379
26379
|
}
|
|
26380
26380
|
}
|
|
26381
|
+
let fork = null;
|
|
26381
26382
|
if (gov === null && !inside && purposeKnown && recipientKey !== null) {
|
|
26382
26383
|
gov = hit(cell(att.relationships, recipientKey), "relationship");
|
|
26384
|
+
const rule = input.partnerPurposeRule;
|
|
26385
|
+
const rulePosture2 = rule?.posture;
|
|
26386
|
+
if (gov === null && recipient.kind === "partner" && // `__external__` stays scope-only (data.js L55333)
|
|
26387
|
+
(rulePosture2 === "open" || rulePosture2 === "approval" || rulePosture2 === "blocked")) {
|
|
26388
|
+
const partnerName = typeof rule?.partnerName === "string" && rule.partnerName !== "" ? rule.partnerName : recipientKey;
|
|
26389
|
+
fork = {
|
|
26390
|
+
policy: {
|
|
26391
|
+
id: `pol-bp-${recipientKey}-${purpose}`,
|
|
26392
|
+
name: `${purposeLabel} \u2014 ${partnerName} variant`,
|
|
26393
|
+
purpose,
|
|
26394
|
+
posture: rulePosture2,
|
|
26395
|
+
infoScope: null,
|
|
26396
|
+
cadences: null,
|
|
26397
|
+
version: 1,
|
|
26398
|
+
origin: { kind: "fork" },
|
|
26399
|
+
edited: true
|
|
26400
|
+
},
|
|
26401
|
+
level: "relationship",
|
|
26402
|
+
version: 1,
|
|
26403
|
+
rulePath: `policies.partnerOverrides[${recipientKey}].byPurpose[${purpose}] (purpose-specific rule, reported as its fork)`
|
|
26404
|
+
};
|
|
26405
|
+
}
|
|
26383
26406
|
if (gov === null)
|
|
26384
26407
|
gov = hit(own3(att.agencyDefaults, purpose), "agency_default");
|
|
26385
26408
|
if (gov === null && pd !== null) {
|
|
@@ -26401,18 +26424,36 @@ function resolveShare(input) {
|
|
|
26401
26424
|
};
|
|
26402
26425
|
}
|
|
26403
26426
|
}
|
|
26427
|
+
let defaultProjection = null;
|
|
26428
|
+
let defaultItems = null;
|
|
26429
|
+
if (fork !== null) {
|
|
26430
|
+
if (gov !== null && gov.level === "agency_default" && gov.policy.edited === true) {
|
|
26431
|
+
if (isStringList2(gov.policy.infoScope))
|
|
26432
|
+
defaultProjection = [...gov.policy.infoScope];
|
|
26433
|
+
const items = copyItems(gov.policy.infoScopeItems);
|
|
26434
|
+
if (items !== null)
|
|
26435
|
+
defaultItems = {
|
|
26436
|
+
rows: items,
|
|
26437
|
+
name: typeof gov.policy.name === "string" ? gov.policy.name : gov.policy.id
|
|
26438
|
+
};
|
|
26439
|
+
}
|
|
26440
|
+
gov = fork;
|
|
26441
|
+
}
|
|
26442
|
+
const rulePosture = input.partnerPurposeRule?.posture;
|
|
26443
|
+
const ruleAuthored = !inside && recipient.kind === "partner" && (rulePosture === "open" || rulePosture === "approval" || rulePosture === "blocked");
|
|
26404
26444
|
let tc = null;
|
|
26405
26445
|
if (teamId !== null && gov !== null) {
|
|
26406
26446
|
const t = hit(cell(att.teams, teamId), "team");
|
|
26407
26447
|
if (t !== null && t.policy.id !== gov.policy.id) tc = t;
|
|
26408
26448
|
}
|
|
26409
|
-
const govNamed = gov === null ? null : named(gov);
|
|
26449
|
+
const govNamed = gov === null ? null : fork !== null ? { ...named(gov), virtual: true } : named(gov);
|
|
26410
26450
|
const tcNamed = tc === null ? null : named(tc);
|
|
26411
26451
|
const rulePath = gov === null ? `no Platform default for purpose \u201C${purpose}\u201D \u2014 nothing governs (fails closed)` : tc === null ? gov.rulePath : `${gov.rulePath} \u2229 ${tc.rulePath} (the sending team's own policy is a ceiling \u2014 only what both allow)`;
|
|
26412
|
-
let posture = input.relationshipPosture === "approval" || input.relationshipPosture === "blocked" ? input.relationshipPosture : "open";
|
|
26452
|
+
let posture = ruleAuthored && rulePosture !== void 0 ? rulePosture : input.relationshipPosture === "approval" || input.relationshipPosture === "blocked" ? input.relationshipPosture : "open";
|
|
26413
26453
|
let postureSource = "relationship";
|
|
26414
26454
|
let posturePol = null;
|
|
26415
|
-
if (
|
|
26455
|
+
if (fork === null && // data.js L55391: a virtual policy's posture is never applied
|
|
26456
|
+
govNamed?.posture && SHARE_POSTURE_RANK[govNamed.posture] > SHARE_POSTURE_RANK[posture]) {
|
|
26416
26457
|
posture = govNamed.posture;
|
|
26417
26458
|
postureSource = "policy";
|
|
26418
26459
|
posturePol = govNamed;
|
|
@@ -26437,11 +26478,22 @@ function resolveShare(input) {
|
|
|
26437
26478
|
} else if (posture === "blocked") {
|
|
26438
26479
|
const pol = posturePol;
|
|
26439
26480
|
const path = pol === null ? "relationship posture = blocked" : `sharingPurposePolicies[${pol.id}].posture=blocked (policy \u201C${pol.name}\u201D \u2014 ${pol.levelLabel})`;
|
|
26440
|
-
|
|
26481
|
+
const byRule = ruleAuthored && postureSource === "relationship";
|
|
26482
|
+
if (report && byRule) {
|
|
26483
|
+
reportCarveOut = {
|
|
26484
|
+
note: "Partner is blocked for ordinary sharing \u2014 reachable for reports",
|
|
26485
|
+
rulePath: `reports-never-blocked-at-partner-layer (Crysta ruling 2026-08-23; policies.partnerOverrides[${recipientKey}].byPurpose[${purpose}].sharingPosture=blocked does not bind a legal duty \u2014 who may send is a role/function question)`
|
|
26486
|
+
};
|
|
26487
|
+
} else if (report) {
|
|
26441
26488
|
reportCarveOut = {
|
|
26442
26489
|
note: pol === null ? "Blocked for ordinary sharing \u2014 reachable for reports (nothing at the partner layer extinguishes the duty)" : `The \u201C${pol.name}\u201D policy blocks ordinary sharing \u2014 reachable for reports`,
|
|
26443
26490
|
rulePath: path
|
|
26444
26491
|
};
|
|
26492
|
+
} else if (byRule) {
|
|
26493
|
+
excluded = {
|
|
26494
|
+
reason: "Partner is blocked for this purpose by your account's sharing policy",
|
|
26495
|
+
rulePath: `policies.partnerOverrides[${recipientKey}].byPurpose[${purpose}].sharingPosture=blocked (Share Partners \u2014 purpose-specific rule)`
|
|
26496
|
+
};
|
|
26445
26497
|
} else {
|
|
26446
26498
|
excluded = {
|
|
26447
26499
|
reason: pol === null ? "Blocked for this purpose by the relationship" : `Blocked for this purpose by your account's \u201C${pol.name}\u201D policy`,
|
|
@@ -26454,9 +26506,11 @@ function resolveShare(input) {
|
|
|
26454
26506
|
const govList = govNamed?.infoScope ?? null;
|
|
26455
26507
|
const polScopeBinds = gov !== null && Array.isArray(govList) && (level === "team_row" || level === "relationship" || level === "account_internal" || level === "inside_starter" || level === "agency_default" && gov.policy.edited === true);
|
|
26456
26508
|
const legacy = legacyCeilingList(input.legacyCeiling);
|
|
26457
|
-
const
|
|
26458
|
-
|
|
26459
|
-
|
|
26509
|
+
const projectionPath = `policies.sharingScopeEdits[__default__][${purpose}] (projected from your account default policy)`;
|
|
26510
|
+
const projOverLegacy = legacy !== null ? defaultProjection : null;
|
|
26511
|
+
const ceilingIsStarter = legacy === null && defaultProjection === null;
|
|
26512
|
+
let groupCeiling = legacy ?? defaultProjection ?? pdRaw;
|
|
26513
|
+
let ceilingPath = legacy !== null ? "sharingScopeEdits (the account's partner / default rule \u2014 the legacy cell chain)" : defaultProjection !== null ? projectionPath : pd === null ? "no Platform default" : `pol-starter-${purpose} v${pd.version} (Platform default \u2014 the starting scope for this purpose)`;
|
|
26460
26514
|
if (ceilingIsStarter && polScopeBinds) {
|
|
26461
26515
|
groupCeiling = null;
|
|
26462
26516
|
ceilingPath = "";
|
|
@@ -26558,6 +26612,17 @@ function resolveShare(input) {
|
|
|
26558
26612
|
`Outside what the \u201C${govName}\u201D policy allows for this purpose`
|
|
26559
26613
|
);
|
|
26560
26614
|
}
|
|
26615
|
+
if (allowed && !req && projOverLegacy !== null && !scopeListCovers(scope, projOverLegacy, g)) {
|
|
26616
|
+
allowed = false;
|
|
26617
|
+
reason = "Outside the payload for this purpose";
|
|
26618
|
+
path = projectionPath;
|
|
26619
|
+
}
|
|
26620
|
+
if (allowed && !req && projOverLegacy !== null && !scopeListStrictlyCovers(scope, projOverLegacy, g)) {
|
|
26621
|
+
addExcluded(
|
|
26622
|
+
outside((r) => scopeListCovers(scope, projOverLegacy, g, r)),
|
|
26623
|
+
"Outside the payload for this purpose"
|
|
26624
|
+
);
|
|
26625
|
+
}
|
|
26561
26626
|
const govRows = polScopeBinds ? own3(govItems, g) : void 0;
|
|
26562
26627
|
if (allowed && !req && isStringList2(govRows)) {
|
|
26563
26628
|
const keep = new Set(govRows);
|
|
@@ -26567,6 +26632,15 @@ function resolveShare(input) {
|
|
|
26567
26632
|
`Outside what the \u201C${govName}\u201D policy allows for this purpose`
|
|
26568
26633
|
);
|
|
26569
26634
|
}
|
|
26635
|
+
const defRows = defaultItems === null ? void 0 : own3(defaultItems.rows, g);
|
|
26636
|
+
if (allowed && !req && isStringList2(defRows)) {
|
|
26637
|
+
const keep = new Set(defRows);
|
|
26638
|
+
const kept = (r) => keep.has(r) || scope.ancestorsOf(r).some((a) => a !== g && keep.has(a));
|
|
26639
|
+
addExcluded(
|
|
26640
|
+
outside(kept),
|
|
26641
|
+
`Outside what the \u201C${defaultItems?.name ?? ""}\u201D policy allows for this purpose`
|
|
26642
|
+
);
|
|
26643
|
+
}
|
|
26570
26644
|
if (allowed && !req && tcScope !== null && !scopeListCovers(scope, tcScope, g)) {
|
|
26571
26645
|
allowed = false;
|
|
26572
26646
|
reason = `Outside what your team's \u201C${tcNamed?.name}\u201D policy allows`;
|