You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Browse filesBrowse the repository at this point in the historyBrowse files
authored
refactor(spec,plugin-sharing,runtime): one canonical predicate for publicSharing.enabled (#16029)
* refactor(spec,plugin-sharing,runtime): one canonical `publicSharing.enabled` predicate
`isPublicSharingEnabled` is now exported from `@objectstack/spec/data`, declared
beside the `publicSharing` block in `src/data/object.zod.ts` (the same shape as
the neighbouring `isTenancyDisabled`). `plugin-sharing`'s service and route
probe consume it, and `packages/runtime`'s documented private mirror in
`src/domains/share-links.ts` is deleted.
The mirror's stated justification — importing the plugin would invert the
dependency direction, it being a dev dependency of the runtime — held only for
that home: both packages already depend on `@objectstack/spec`, so the shared
home needed no new edge.
Behaviour unchanged, fail-closed included: an absent block, an absent schema and
an engine that cannot answer `getSchema` remain one answer, `false`.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ARYe3yQTQCUFm5qPYNgKaJ
* docs(permissions): re-anchor row 37's five citations after the -10 line shift
`check-system-context-census` red on `1f294f94a`: this PR's edit to
`plugin-sharing/src/share-link-service.ts` is +10 above line 45 and -20 above
line 108, so every line below shifts by exactly -10, and row 37 of
`content/docs/permissions/system-context.mdx` cites five of them by number.
All five are PURE LINE ROT, checked per anchor with the file open rather than
assumed: the text now at 459 / 513 / 517 / 590 / 620 is byte-identical to the
text that was at 469 / 523 / 527 / 600 / 630 at the merge base, and the diff's
two hunks both end above line 108 — no line at or below the first anchor was
touched at all. Row 37's claim ("share-link policy `enabled` check bypassed;
system callers re-enter under a system context") is unchanged and still
described by the same five `context.isSystem` reads, so no ledger row with a
needle is owed here.
Repaired with `node scripts/check-system-context-census.mjs --fix`, which
rewrote exactly those five numbers and no prose.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ARYe3yQTQCUFm5qPYNgKaJ
* chore: regenerate the system-context census from the merged tree
`content/docs/permissions/system-context.mdx` is an os-regen artifact and both
sides moved it since `f7db8f4fd`: this branch re-anchored row 37 after its own
-10 line shift, and `origin/main` carried the census rows that #15996's
share-link admission seam moved. The driver merges such a path with exit 0
while silently keeping ONE side, so it is regenerated from the merged tree
rather than resolved by picking a side or by hand.
`pnpm gen:system-context-census` re-derives BOTH sides at once, which is
visible in the result: row 37 keeps this branch's anchors
(`share-link-service.ts:459`, `:513`, `:517`, `:590`, `:620`) while main's
shifts land beside them (`sharing-plugin.ts:1088` becomes `:1189`,
`rest-server.ts:1553`/`:1582`/`:1585` become `:1565`/`:1594`/`:1597`,
`domains/packages.ts:422` becomes `:535`, and row 50's five `rest-server.ts`
anchors move). No prose changed — only anchors.
Landed through `scripts/pm/os-regen-merge.sh`: merge first, then regenerate.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ARYe3yQTQCUFm5qPYNgKaJ
---------
Co-authored-by: Claude <zhuangjianguo@steedos.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
`publicSharing.enabled` now has one canonical predicate, exported from the package that declares the key.
8
+
9
+
`isPublicSharingEnabled(schema)` is a new export of `@objectstack/spec/data`, declared in `src/data/object.zod.ts` beside the `publicSharing` block itself — the same shape as the neighbouring `isTenancyDisabled`. It is additive: nothing was removed or narrowed from the spec's public API.
10
+
11
+
Until now the same policy read existed in two spellings. `@objectstack/plugin-sharing` defined it (for the share-link service's redemption gate and the route probe above it), and `@objectstack/runtime` carried a documented private mirror for its `/share-links` dispatcher domain — copied rather than imported because the plugin is only a **dev** dependency of the runtime. That reasoning was true of that one home and not of the question: both packages already depend on `@objectstack/spec`, so a shared home existed all along and the de-duplication adds no dependency edge. Both surfaces now consume the exported predicate and the runtime copy is deleted.
12
+
13
+
Behaviour is unchanged, fail-closed included: an absent `publicSharing` block, an absent schema, and an engine that cannot answer `getSchema` at all remain **one** answer, `false`, and only the boolean `true` enables. The two pins that held the copies equal — `share-link-eligibility.test.ts` in the plugin and `share-links-enforcement-context.test.ts` in the runtime, which assert the same observable answer on both surfaces rather than trusting the copy — are unchanged and still green; they are what proves the merge did not move behaviour. The predicate's own contract, which those tests can only observe indirectly, is now pinned directly in `packages/spec/src/data/object.test.ts`.
Copy file name to clipboardExpand all lines: content/docs/permissions/system-context.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -135,7 +135,7 @@ The largest single consumer — **17 of the 105 sites**.
135
135
| 34 |`revoke()` deletes directly, **before** the non-manual-source guard | Get: the evaluator can revoke its own grants. Lose: the `CONFLICT` guard that warns a rule-materialised grant will be silently re-granted on the next reconcile |`plugin-sharing/src/sharing-service.ts:1476` (guard at `:1501`) |
136
136
| 35 |`listShares()` skips the management gate | Get: full enumeration of who can see a record |`plugin-sharing/src/sharing-service.ts:1528`|
137
137
| 36 |`sys_record_share` reads are **not** self-scoped | Get: tenant-wide share listing without `manage_sharing`|`sharing-plugin.ts:1189`|
138
-
| 37 | Share-link policy `enabled` check bypassed; system callers re-enter under a system context | Get: link **creation** while the policy is off — resolution is **not** bypassed since #14033 (`publicSharing.enabled` is a standing policy held at every redemption): a link minted this way does not resolve until the block is enabled |`plugin-sharing/src/share-link-service.ts:469`, `:523`, `:527`, `:600`, `:630`|
138
+
| 37 | Share-link policy `enabled` check bypassed; system callers re-enter under a system context | Get: link **creation** while the policy is off — resolution is **not** bypassed since #14033 (`publicSharing.enabled` is a standing policy held at every redemption): a link minted this way does not resolve until the block is enabled |`plugin-sharing/src/share-link-service.ts:459`, `:513`, `:517`, `:590`, `:620`|
139
139
| 38 | Sharing-rule provenance stamp skipped | Lose: the row is not marked as an admin customization — seeder / `defineRule` / boot reconcilers are "the package door" |`sharing-rule-provenance.ts:47`|
140
140
| 39 | Sharing-rule service write + delete paths return early | Lose: the manage-rules gate on the service surface, and the platform-global-rule delete guard |`sharing-rule-service.ts:278`, `:503`|
0 commit comments