|
| 1 | +--- |
| 2 | +'@objectstack/spec': minor |
| 3 | +--- |
| 4 | + |
| 5 | +feat(spec): `SharingRuleEvaluationResult` declares `grantsRefused?: number` — the optional seventh key the sharing-rule evaluate route already answers (#14969) |
| 6 | + |
| 7 | +`minor`, derived: a new key on a published contract interface is additive public |
| 8 | +API (semver "backwards-compatible functionality"), and not `major` because the |
| 9 | +key is **optional** — every existing `ISharingRuleService` implementer, in-tree |
| 10 | +and out, keeps compiling unchanged, and every consumer typed against the six |
| 11 | +counts keeps reading them. |
| 12 | + |
| 13 | +`POST /api/v1/sharing/rules/:idOrName/evaluate` (ledgered `sdk`, |
| 14 | +`shares.rules.evaluate`) passes the service's return value through unfiltered, |
| 15 | +and `@objectstack/plugin-sharing` has counted refused grants on its own subtype |
| 16 | +since #14754 — so the wire carried `grantsRefused` while the declared client |
| 17 | +type (`client.shares.rules.evaluate`, typed `Promise<SharingRuleEvaluationResult>`) |
| 18 | +could not name it without a cast. The client gains the key through its spec |
| 19 | +import with no edit of its own. |
| 20 | + |
| 21 | +What the key means, and what its absence means: it counts the grants the |
| 22 | +engine **refused** during the pass (`ERR_SYSTEM_WRITE_ORGANIZATION_REQUIRED` on |
| 23 | +an organization-less insert into a tenant-scoped `sys_record_share`); the pass |
| 24 | +continues past a refusal, so `grantsRefused > 0` is not a failed pass. The key |
| 25 | +is **absent — not `0`** — from any implementation that does not count |
| 26 | +refusals. A consumer branching on it must read "unset" as "this implementation |
| 27 | +does not report refusals", never as "no grant was refused"; only a present `0` |
| 28 | +says the latter. Do not `?? 0` it. |
| 29 | + |
| 30 | +Optional in the spec composes with the plugin-local narrowing: an |
| 31 | +implementation that counts refusals may require the key on its own subtype |
| 32 | +(`SharingRuleReconcilePassResult extends SharingRuleEvaluationResult`), a legal |
| 33 | +covariant narrowing that still satisfies `ISharingRuleService`. |
0 commit comments