@htilabs/platform-common-models 0.41.0 → 0.42.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 CHANGED
@@ -16,6 +16,104 @@ 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
+ ## share-resolver / 0.42.0 (additive)
20
+
21
+ 0.42.0 (Kickoff 13, GDR § 5.79 "ONE resolver per runtime") ships THE share
22
+ resolver beside the ceiling at `@htilabs/platform-common-models/sharing-ceiling`
23
+ (also from the root): `resolveShare(input)` — the one pure read Thread and
24
+ PAVE call to learn, for one sender (account + team) × one recipient × one
25
+ purpose, which **policy** governs and at which **level**, the **posture**,
26
+ whether the share is excluded as a whole, and which information-scope
27
+ **categories** may leave. Every answer names policy · version · level. The
28
+ contract of record is platform-prototype `src/data.js` @ becfab4
29
+ (`governingPolicyFor`, `effectiveCeiling`, `platformStarterScope`,
30
+ `scopeListCovers`); the vectors of its two behavioural smoke flows
31
+ (`one-resolver-k13`, `sharing-four-state-k13`) are the test suite.
32
+
33
+ What it reads, in order:
34
+
35
+ - **The ladder** (`governingPolicyFor`): the team-to-team row → [inside the
36
+ account: the account's inside default → the platform's inside starter (the
37
+ full record, open, v1) — stop] → the relationship (the partner id, or
38
+ `__external__`) → the account default → the Platform default (a versioned
39
+ document, `pol-starter-<purpose>`). One policy = one purpose; a policy that
40
+ ANSWERS shares received (`trigger.answers === "received"`) never governs a
41
+ send; a retired document governs nowhere. The index is built from each
42
+ document's `assignments` (`attachmentIndexFromPolicies`); `matchTeamRow`
43
+ finds the row the first rung reads, exactly as the prototype does.
44
+ - **The team ceiling**: the sending team's own policy for the purpose rides
45
+ as a ceiling on every rung's answer (inside the account too) when it is not
46
+ itself the governing one — only what both allow, the stricter posture,
47
+ never a widening.
48
+ - **Posture**: the relationship's, raised (never lowered) by the governing
49
+ policy, then by the ceiling. A `blocked` posture excludes a discretionary
50
+ share and CARVES OUT a report (`mandatory_reporting`, `authority_reporting`
51
+ — `SHARE_REPORTING_PURPOSES`, derived from the purpose, never a caller
52
+ flag): the posture still reads `blocked`, `reportCarveOut` names what
53
+ blocks ordinary sharing, and the share is not excluded. The account's
54
+ purpose switch (`purposeOff`) excludes the whole share, reports included —
55
+ the carve-out is a policy / partner-layer rule, the switch sits above it.
56
+ - **The Platform default as the four states** (`derivePlatformDefault`;
57
+ CVC-133 keys `always · default_on · default_off · never`, the words
58
+ Required · Default On · Default Off · Blocked): System metadata and a
59
+ category the platform requires for the purpose are Required and bypass
60
+ every account-grain clamp; an off-by-default (heightened) category is
61
+ Blocked for every account; the seed list covers a category by itself, by
62
+ an ancestor (a kind) or by any row of it; a Platform Admin's bound
63
+ overrides. Neither Required nor Blocked is read inside the account.
64
+ - **Which list binds** (K13-12): a synced account default or the raw
65
+ Platform default → the default's starting scope is the ceiling; an
66
+ authored policy (an edited account default, a relationship, a team row, an
67
+ inside default) → its own list, within the default's cap. A legacy cell
68
+ chain's list (`effectiveCeiling(...).allowed` from this same module) arrives
69
+ as `legacyCeiling` and stays a ceiling even over an authored policy.
70
+ - **Per category**: the account's Information Scope, the default's Blocked,
71
+ the binding list, the governing policy's list, the team ceiling's list —
72
+ then rows: the platform floor, heightened rows off in the account,
73
+ field-group limits (`infoScopeItems`), and a
74
+ category every row of which is withheld is withheld. `scopeListCovers`
75
+ reads a stored list the way the prototype does — a category, a kind above
76
+ it, or a row of it; never a flat `indexOf` (HANDOFF K13-14).
77
+
78
+ Helpers the apps adopt with: `platformDefaultFor(scope, purpose)` — the
79
+ Platform default from the PUBLISHED starter (day-one, version 1) with the
80
+ platform's Required list (`HTI_SHARE_PLATFORM_REQUIRED_BY_PURPOSE`: Identifying
81
+ information on every report), until the platform stores `pol-starter-<purpose>`
82
+ as a versioned document; `shareRowCeiling(resolution, scope)` — the ROW-grain
83
+ ceiling one answer amounts to (an allowed category by its code, or its rows minus
84
+ the withheld ones), which `maskSelectionToCeiling` (the composer) and
85
+ `rowsOverCeiling` (the send door) take as their ceiling; `legacyCeiling` takes
86
+ `effectiveCeiling`'s ANSWER and binds it only when an account rule answered — its
87
+ `platform_default` rung is the document the resolver already reads (passing that
88
+ as a list would clamp every authored policy to the starter and undo K13-12).
89
+
90
+ **The account's Information Scope starts from the codebook** (`accountScope`;
91
+ the prototype's clamps 4 / 4b). A CVC-236 heightened category or row
92
+ (`shareableDefault: false` — immigration & legal status, the full instrument
93
+ narratives) stays OFF until the account turns it on. `accountScope` carries
94
+ only the account's explicit choices: `categoriesOff` / `rowsOff` (switched
95
+ off) and `categoriesOn` / `rowsOn` (a heightened code turned on; turning a
96
+ grouping on does not turn on an off-by-default row beneath it). A caller that
97
+ omits `accountScope` gets the codebook's defaults — heightened information
98
+ held back, inside the account too — never everything. A code in both lists
99
+ is off.
100
+
101
+ Fail closed: an unknown purpose (no `platformDefault`) governs nothing —
102
+ `governing: null`, every category withheld. A document's `infoScope: null`
103
+ **or an absent `infoScope`** is "no category list" (the prototype reads every
104
+ non-array that way; the inside starter, a field-limits-only team ceiling and
105
+ a posture-only policy are written that way); an explicit `[]` binds an empty
106
+ list; a present value that is not a list of strings reads as `[]` (stricter
107
+ than the prototype). An assignment with an unknown `scope` is skipped.
108
+ `matchTeamRow` matches a sibling team's pair row on `their.id` alone, as the
109
+ prototype's `internalPairRow` does.
110
+
111
+ Left to the caller, deliberately: the partner row's direction / team-scoped
112
+ gates and item `restrictions`, the legacy `sharingPolicies` narrowing rows
113
+ (#451 moved them onto cards), the `byPurpose` virtual fork, and the
114
+ item-grain door (`rowsOverCeiling` / `maskSelectionToCeiling`, which take
115
+ `allowedCategories` as their ceiling).
116
+
19
117
  ## share-rules + sharing-ceiling defaults / 0.41.0 (additive)
20
118
 
21
119
  PAVE is adopting the shared Next Steps share window Thread already uses. The
@@ -1,4 +1,4 @@
1
- import { F as Form, l as buildFormSchema, h as Section, q as buildSectionSchema, Q as Question, o as buildQuestionSchema, f as ScoringRule, p as buildScoringRuleSchema, P as PlatformFunction, m as buildPlatformFunctionSchema, d as PlatformRole, n as buildPlatformRoleSchema, b as CvcRegistry, k as buildCvcRegistrySchema, a as CvcEntry, j as buildCvcEntrySchema } from './cvcEntry-DQEoFVL2.cjs';
1
+ import { F as Form, l as buildFormSchema, h as Section, q as buildSectionSchema, Q as Question, o as buildQuestionSchema, f as ScoringRule, p as buildScoringRuleSchema, P as PlatformFunction, m as buildPlatformFunctionSchema, d as PlatformRole, n as buildPlatformRoleSchema, b as CvcRegistry, k as buildCvcRegistrySchema, a as CvcEntry, j as buildCvcEntrySchema } from './cvcEntry-DAuhe0cd.cjs';
2
2
  import * as mongoose from 'mongoose';
3
3
  import { HydratedDocument, Connection, Model } from 'mongoose';
4
4
 
@@ -1,4 +1,4 @@
1
- import { F as Form, l as buildFormSchema, h as Section, q as buildSectionSchema, Q as Question, o as buildQuestionSchema, f as ScoringRule, p as buildScoringRuleSchema, P as PlatformFunction, m as buildPlatformFunctionSchema, d as PlatformRole, n as buildPlatformRoleSchema, b as CvcRegistry, k as buildCvcRegistrySchema, a as CvcEntry, j as buildCvcEntrySchema } from './cvcEntry-DQEoFVL2.js';
1
+ import { F as Form, l as buildFormSchema, h as Section, q as buildSectionSchema, Q as Question, o as buildQuestionSchema, f as ScoringRule, p as buildScoringRuleSchema, P as PlatformFunction, m as buildPlatformFunctionSchema, d as PlatformRole, n as buildPlatformRoleSchema, b as CvcRegistry, k as buildCvcRegistrySchema, a as CvcEntry, j as buildCvcEntrySchema } from './cvcEntry-DAuhe0cd.js';
2
2
  import * as mongoose from 'mongoose';
3
3
  import { HydratedDocument, Connection, Model } from 'mongoose';
4
4