Skip to content

fix(sharing): a declared sharing rule grants in an organization created after boot, without a restart - #37012

Merged
objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/issue-36982-sharing-rule-hooks-late-org
Nov 24, 2026
Merged

objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/issue-36982-sharing-rule-hooks-late-org

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #36982
Clause-②: no
Metadata-protocol: none

维护者速读

  • 新建的组织(例如新环境的第一次注册)里,应用自带的共享规则从创建那一刻就生效,被指派人立即能看到并编辑任务,不再需要重启服务器。
  • 属于平台记录共享这条线,替任务与备忘那张卡(内置任务对象的被指派人授权)解决新组织里授权缺失的问题。
  • 出错时表现为新组织里某条应用自带规则没有授权(只会少给,不会多给;每个组织的授权仍只落在本组织内);这次改动可以直接撤回,撤回后回到重启才生效的旧行为。
  • 无

What changes

SharingServicePlugin bound its per-record rule hooks once at boot, on the objects of the rules it served then. Under a walled posture a declared rule is served once per organization that exists (ADR-0131 D2), so a kernel that booted with no organization bound no hook on a declared rule's object. The organization-created middleware (addDeclaredRuleScope) added the new organization's scope and bound nothing, so a record written in that organization got no sys_record_share grant until the next restart. It under-granted; it never over-granted.

  • SharingRuleService.listRuleHookObjects() (new): the objects the record hooks bind on — every object an active sys_sharing_rule row names, plus every object an active DECLARATION names, whatever organizations serve it at that moment and whatever the activation ledger says of it. The binding is per object and organization-agnostic; the organization is resolved when a record is evaluated (evaluateAllForRecord lists the projections live, each sweeping inside its own organization at the driver), so isolation is unchanged.
  • rule-hooks.ts: new rebindRuleHooks(engine, service, logger) reads listRuleHookObjects(), then unbinds and calls bindRuleHooks with that object set; the read runs before the unbind, so a failed read keeps the previous bindings (as before). bindRuleHooks' rules parameter widens to the two fields it reads (object_name, active), a non-breaking widening; its hook bodies are unchanged and stay in that symbol (the system-context census row keys the afterDelete elevation read to it).
  • sharing-plugin.ts: boot and the sys_sharing_rule data-change rebind both go through one private bindRuleHooks method (the binding site ADR-0057 anchors as sharing-plugin.ts#bindRuleHooks), which calls rebindRuleHooks, so the two cannot derive different object sets. The organization-created middleware is unchanged: it still adds the scope, and the hooks already bound now serve it.
  • Same derivation closes the sibling shape: a declared rule switched off in the activation ledger at boot and on later keeps its object bound (the ledger reconcile never rebinds).

Why per object rather than a rebind in the organization-created middleware: a rebind there would re-derive the hook set from the served projections each time, which is exactly the snapshot that drifted (and an unknown-scope boot, or a ledger switch, would still bind nothing). Binding from the declaration cannot drift with the organizations at all. A hook on an object no projection serves yet evaluates no rule and grants nothing.

Tests

  • packages/plugins/plugin-sharing/src/declared-rule-late-organization.test.ts (new, real stack, ONE boot): ObjectKernel + ObjectQLPlugin over better-sqlite3 + SharingServicePlugin, isolated posture (the tenancy service plus the engine posture accessor the security plugin hands it), a package-declared field rule (assignee_id, edit) on a private object; every organization is inserted after bootstrap().
    • Case 1: in the first organization created after boot, a task's assignee gets exactly one edit grant from the declared rule and reads the record; a member the rule does not name still reads nothing. RED on origin/main 57445a69981 (expected [] to deeply equal [ ObjectContaining ]), green with the fix.
    • Case 2 (isolation, both directions): organization A authors its own rule on the same object; control — it grants on A's record; B's record matching A's criteria gets exactly one grant, B's projection of the declared rule, stamped organization_id B; A's watcher does not read it. Green on origin/main and with the fix.
  • sharing-rule.test.ts (walled describe): listRuleHookObjects() names the declared rule's object with no scope, with unknown scopes, and with the rule switched off in the ledger (while listRules serves nothing in each); a stored row's object joins; an inactive declaration binds nothing.
  • rule-rebind.test.ts: mocks moved from listRules to listRuleHookObjects, the rebind seam's new read; assertions unchanged.
  • Ablation at head e67a0507ced (fix committed first; scripts/ablation-replace.mjs, anchor x1 to x0, blob 6558c83dc6c3 to d440ba76857c): the declaration loop in listRuleHookObjects removed, so only served projections bind. Over the three touched suites: Tests 2 failed | 160 passed — exactly the two new pins (the one-boot late-organization case and the listRuleHookObjects pin). Restored: blob 6558c83dc6c3 equals the HEAD blob, git diff HEAD empty. No dist rebuild needed: the suites import the subject from src.
  • At head e67a0507ced: pnpm --filter @objectstack/plugin-sharing test — Test Files 78 passed, Tests 1629 passed, 11 skipped; pnpm --filter @objectstack/plugin-sharing typecheck — exit 0, check:test-typecheck: OK (the new test is in the tsconfig.test.json program, --listFilesOnly 1 hit).
Derived gates at e67a050

node scripts/pm/dispatch-gates.mjs --commands (7 paths vs merge base 57445a699): 73 families, all run after a full pnpm build (120 tasks, lock VERDICT command-exit 0), each exit captured before any pipe: 73 exit 0. --ran: 73 derived, 73 run, 0 NOT-MEASURED, 0 UNRUN (exit 0). On the first pass two families were red and are green now: check:adr-symbol-anchors (ADR-0057 anchors the plugin's binding site as sharing-plugin.ts#bindRuleHooks; kept as the private method) and check:system-context-census (row 31 keys the rule hooks' afterDelete elevation read to bindRuleHooks; the hook bodies stay in that symbol). test:repo is CI's (Test Core).

Acceptance notes

Verification

Read first: packages/plugins/plugin-sharing/src/sharing-rule-service.ts (listRuleHookObjects, the derivation), packages/plugins/plugin-sharing/src/rule-hooks.ts (rebindRuleHooks), packages/plugins/plugin-sharing/src/sharing-plugin.ts (the private bindRuleHooks and its two callers).

Two minutes: pnpm --filter @objectstack/plugin-sharing exec vitest run src/declared-rule-late-organization.test.ts — expect 2 passed; on origin/main the first case fails with no grant row.


Generated by Claude Code

…ed after boot

The per-record rule hooks bound once at boot on the objects of the rules
served then. Under a walled posture a declared rule is served once per
existing organization, so a server that booted with no organization bound
no hook on a declared rule's object, and an organization created later was
served the rule with nothing to evaluate it until the next restart.

The hooks now bind per object from the declarations and stored rows
(SharingRuleService.listRuleHookObjects), never from the organizations a
declared rule is served in at that moment; the organization is resolved
when a record is evaluated. Boot and the sys_sharing_rule rebind share one
binder (rebindRuleHooks).

Claude-Session: https://claude.ai/code/session_01QSeKYpEsWWE9Y5YtSsDgqZ
Co-authored-by: Claude <noreply@anthropic.com>
…Hooks

ADR-0057 anchors the plugin's boot binding of the per-record rule hooks as
sharing-plugin.ts#bindRuleHooks. Boot and the sys_sharing_rule rebind now
go through one private bindRuleHooks method, which calls rebindRuleHooks.

Claude-Session: https://claude.ai/code/session_01QSeKYpEsWWE9Y5YtSsDgqZ
Co-authored-by: Claude <noreply@anthropic.com>
The system-context census row for the rule hooks' afterDelete elevation read
is keyed to bindRuleHooks. rebindRuleHooks now hands bindRuleHooks the
object set as rows, so the read stays in the symbol that row names;
bindRuleHooks' rules parameter widens to the two fields it reads.

Claude-Session: https://claude.ai/code/session_01QSeKYpEsWWE9Y5YtSsDgqZ
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/plugin-sharing, touching 7 documentable anchor(s).

11 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/automation/queues-and-assignment-rules.mdx (via object_name (literal, a string literal in bindRuleHooks))
  • content/docs/automation/webhooks.mdx (via object_name (literal, a string literal in bindRuleHooks))
  • content/docs/data-modeling/field-types.mdx (via object_name (literal, a string literal in bindRuleHooks))
  • content/docs/deployment/cli.mdx (via object_name (literal, a string literal in bindRuleHooks))
  • content/docs/frontend/plugins/plugin-detail.mdx (via object_name (literal, a string literal in bindRuleHooks))
  • content/docs/kernel/runtime-services/audit-service.mdx (via object_name (literal, a string literal in bindRuleHooks))
  • content/docs/permissions/record-view-auditing.mdx (via object_name (literal, a string literal in bindRuleHooks))
  • content/docs/permissions/sharing-rules.mdx (via SharingRuleService (symbol, a top-level class), SharingServicePlugin (symbol, a top-level class))
  • content/docs/permissions/system-context.mdx (via bindRuleHooks (symbol, a method of class SharingServicePlugin; a top-level function))
  • content/docs/protocol/kernel/http-protocol.mdx (via object_name (literal, a string literal in bindRuleHooks))
  • content/docs/protocol/kernel/i18n-standard.mdx (via object_name (literal, a string literal in bindRuleHooks))

⛔ 1 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v17/17-6.mdx (via object_name (literal, a string literal in bindRuleHooks))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • 1 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 69 of 252 client-bound route-ledger rows — the other 183 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 183: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 124 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 12 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json a73edb3cd784e212c7b8b21757a44c0cfed9adfe → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 098e898f4cd135e80f8e68d9028ce9866bb53efe — the merge of head e67a0507cedb338f8669ae31e4a5e82139586a5a into base a73edb3cd784e212c7b8b21757a44c0cfed9adfe, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 098e898f4cd135e80f8e68d9028ce9866bb53efe && git checkout 098e898f4cd135e80f8e68d9028ce9866bb53efe
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin a73edb3cd784e212c7b8b21757a44c0cfed9adfe e67a0507cedb338f8669ae31e4a5e82139586a5a && git checkout -B drift-repro a73edb3cd784e212c7b8b21757a44c0cfed9adfe && git merge --no-ff e67a0507cedb338f8669ae31e4a5e82139586a5a

node scripts/docs-audit/affected-docs.mjs --json a73edb3cd784e212c7b8b21757a44c0cfed9adfe

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs a73edb3cd784e212c7b8b21757a44c0cfed9adfe → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ

席位核对 — ACCEPT · L1 · head e67a0507cedb338f8669ae31e4a5e82139586a5a · 2026-11-24T15:50Z

  • Shape. Draft PR to main, first line Fixes #36982; the diff delivers the card's whole Expected (one producer fixed, isolation pinned), so Fixes is right. 7 files, all under packages/plugins/plugin-sharing/ plus one changeset; no governed path. Clause-②: no · Metadata-protocol: none, as claimed. l1-face: every line ok.
  • Premise and fix. Reproduced red on origin/main 57445a69981 with one real boot (ObjectKernel + ObjectQLPlugin over better-sqlite3 + SharingServicePlugin, walled posture, every organization created after bootstrap()): no sys_record_share row, the assignee reads nothing. The fix is at the one producer: SharingRuleService.listRuleHookObjects() derives the hook objects from active stored rows and every active declaration, not from the per-organization projections served at bind time; rebindRuleHooks reads before it unbinds, so a failed read keeps the previous bindings. Boot and the sys_sharing_rule rebind both go through the plugin's private bindRuleHooks (the site ADR-0057 anchors and the system-context census keys), so the two cannot derive different sets. Organization resolution stays at evaluation time (evaluateAllForRecord lists projections live, each sweep inside its own organization).
  • Tests. New declared-rule-late-organization.test.ts: case 1 red on main, green here; case 2 pins isolation (org A's authored rule plus the declared rule; a record in org B gets exactly one grant, B's projection, stamped B; control on A). Ablation of the declaration loop in listRuleHookObjects turns exactly the two new pins red; restore blob-equal. Package suite 1629 passed / 11 skipped; typecheck and test-typecheck OK; 73 derived gate families exit 0.
  • Sentence read. The changeset's three bullets match the code: late organization served without a restart; a declared rule switched off and on keeps its object bound; one binder for boot and rebind; bindRuleHooks's parameter widened to rows carrying object_name and active, existing callers unaffected.
  • Gates. Check-runs at this head: all green when this record was posted (read by pr-state.mjs --pr 37012).
  • Accepted. The second out-of-scope note (a composition with SharingServicePlugin and no security plugin reads its posture as walled while the engine applies no tenant scope) describes a composition with no tenant wall at all; it stays in the PR's Acceptance notes, not filed.
  • Follow-up owned by this seat. PR feat(platform-objects): built-in sys_task and sys_note objects #36965 (平台内置任务、备忘对象(第一步:不挂关联) #36942) drops its two-boot workaround once this lands; measured there, not here.
  • No must-fix, no should-fix.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 24, 2026 15:50
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 24, 2026
Merged via the queue into main with commit 30778f3 Nov 24, 2026
54 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-36982-sharing-rule-hooks-late-org branch November 24, 2026 16:22
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…tstack-ai#36965)

Fixes objectstack-ai#36942

Clause-②: yes (widening)
Metadata-protocol: none

## 维护者速读

-
用户能看到什么变化:每个环境都会自带「任务」「备忘」两个对象,普通成员默认就能新建、查看、修改(不能删除),任何应用都能把它们放进菜单;菜单和字段文字已有十一种语言。
- 为什么做:起步应用专题的第一步,平台自带任务和备忘,权限各自独立,不挂到其它记录。
- 出错会怎样:成员只看得到自己建的任务、分配给自己的任务和自己写的备忘,别人的看不到;只新增两个对象和一条成员默认权限,可以整体撤回。
- 要你做的:无。

## What changes

- `packages/platform-objects/src/work/` (new): `sys_task` and
`sys_note`, ordinary customizable objects (no `isSystem`, attachments
on, comment feed left on).
- `sys_task`: `title` (required), `description` (rich text), `status`
(`todo` / `in_progress` / `done`, default `todo`), `due_at`,
`assignee_id` (user, default `current_user`), `completed_at`
(read-only), and a declared `owner_id`.
- `sys_note`: optional `title`, rich-text `body`, a read-only `heading`
(the title, or the body's first line when the title is empty) that is
the object's `nameField`, and a declared `owner_id`.
- Default list views: tasks `assigned_to_me` (assignee is me, status not
done, by due time), `created_by_me`, `all` (kanban by status); notes
`mine`, `all`.
- Sharing, the object's own only: `sharingModel: 'private'` over the
declared `owner_id` (a `sys_*` object never gets the injected one; the
security plugin stamps it with the creator), plus one declared sharing
rule `sys_task_assignee` (the existing record-relative `field` recipient
naming `assignee_id`, access `edit`). Nothing links to, grants or
derives access from another record.
- `completed_at` and `heading` are kept by before-write hooks
(`work/hooks.ts`). They assign the platform value over the writer's,
because the engine's create-side read-only strip leaves a `sys_*` object
to its own guards.
- `PlatformObjectsPlugin` registers both objects and the sharing rule on
a manifest of their own (`com.objectstack.platform-objects.work`,
project database) and installs the hooks in `start()`. A refused
registration is logged at `warn`.
- `member_default`
(`packages/plugins/plugin-security/src/objects/default-permission-sets.ts`)
grants `sys_task` and `sys_note` read, create and edit, no delete, in
the `sys_comment` shape, per maintainer ruling 7131539862 (option A,
verbatim 「1. objectstack-ai#36942 任务/备忘默认权限: A。」). It opens the objects; no row policy
is added. The rider (a per-object update alternative for `sys_task`) is
**not** added: measured below, the `owner_only_writes` floor does not
refuse the assignee's edit.
- `packages/spec/src/system/constants/platform-object-names.ts`:
`sys_note` and `sys_task` join
`PLATFORM_OBJECTS_BY_PACKAGE['platform-objects']`.
- Labels: `packages/platform-objects/scripts/i18n-extract.config.ts`
imports both objects; the bundles are regenerated by `node
scripts/check-i18n-bundles.mjs --write` and the ten translated locales
hand-written (zh-CN 任务 / 备忘, zh-Hant 任務 / 備忘, ja-JP タスク / メモ, ko 작업 /
메모, es-ES Tarea / Nota, fr Tâche / Note, de Aufgabe / Notiz, pt-BR
Tarefa / Nota, ru Задача / Заметка, ar مهمة / ملاحظة), all 33 leaves per
locale. Five leaves equal the English word and stay source-hashed as
such: de and pt-BR `Status`, fr `Description`, `Note`, `Notes`.
- `packages/cli/src/utils/organization-ownership-inventory.ts`: ADR-0131
D10 fate rows for `sys_task` and `sys_note`, beside `sys_unit`: fate
`attribution`, census `PMAIN`, no anchors (members write them, the
organization column is stamped from the writing context, and no parent
row anchors a task or a note). Without them every `os migrate
organization-ownership` / `os dev` ceremony refused with "sys_note
carries organization_id but the ADR-0131 D10 inventory gives it no
fate".
-
`packages/cli/src/commands/migrate/organization-ownership.declared-rule-mirrors.integration.test.ts`:
its `servedRules` helper lists the rules served on the fixture's object
(`listRules({ object: 'crm_deal' }, …)`), because platform packages
declare sharing rules of their own that every boot serves
(`sys_task_assignee`). Every rule the fixture declares or inserts is on
`crm_deal`, so both `toEqual` assertions still count each of them
exactly; nothing is loosened. The edit put the file under
`check:test-source-alias`'s source-reach half, so it now also pays its
two dynamic workspace loads (`@objectstack/platform-objects/system`,
`@objectstack/driver-sql`) at module top, as that gate prescribes.
- `scripts/platform-object-tenancy-census.json` regenerated by its
generator: registered 108 → 110, in reach 57 → 59 (both
`organization_id`), out of reach unchanged at 51.
- Changeset, all at patch: `@objectstack/platform-objects` (the
objects), `@objectstack/spec` (the registry names),
`@objectstack/plugin-security` (the `member_default` grant) and
`@objectstack/cli` (the two inventory fate rows). `Clause-②: yes
(widening)`: `defineStack` now accepts a top-level action whose
`objectName` is `sys_task` or `sys_note`, and the public surface grows;
nothing narrows. `Metadata-protocol: none`, on the `sys_unit`
roster-addition precedent: no metadata key, type or schema value is
added, and a reference that already parsed now resolves.

## Tests

- `packages/plugins/plugin-security/src/task-note-objects-36942.test.ts`
(new, 6 cases, real runtime, one boot, the organization created after
`bootstrap()`: `ObjectKernel` + `ObjectQLPlugin` over in-memory
better-sqlite3, `PlatformObjectsPlugin`, `SecurityPlugin` with the
platform sets only, `SharingServicePlugin`; members hold
`member_default` and nothing else, with the positions an ordinary member
holds: `user`, `org_member`, `everyone`):
- both objects register from `PlatformObjectsPlugin` with no application
declaring either;
- `member_default` carries exactly read, create and edit, no delete and
no widening bit, on both;
- status to done writes `completed_at` through the engine's write path,
and leaving done clears it;
- a task is read by its creator and its assignee, and not by a third
member, by id and by list;
- a note is read by its creator only, by id and by list (the assignee of
another task included);
- the assignee edits the task and marks it done (`landed`,
`completed_at` written, `updated_by` the assignee); the third member's
edit answers `RECORD_NOT_FOUND` / 404 and the row is unchanged.
- `packages/platform-objects/src/work/work-objects.test.ts` (23 cases):
declarations, sharing, views, the completion stamp and the note heading
as units, plugin registration and its loud refusal.
- `packages/lint/src/validate-object-references.test.ts`: the item-6
pin, an app that declares neither object puts both in its navigation
with `requiresObject` beside `objectName`; `defineStack` accepts it and
`validateObjectReferences` reports nothing.
-
`packages/platform-objects/src/apps/translations/bundle-ownership.test.ts`:
the bundle owns both objects, and the duplicate-label walk covers them
in every locale.

## Acceptance notes

**The ruling's premise holds with the grant in place.** A second member
holding the same baseline reads neither another member's task nor note,
by id or by list (the runtime test above). Ablation of the two
`member_default` lines: 5 of the 6 cases go red (the creator's insert is
refused without an object grant), and the file restores byte-identical
to HEAD.

**Assignee edit under the ownership floor: allowed, measured with the
floor in force.** The runtime test's members carry the positions the
auth layer gives an ordinary member (`user`, `org_member`, the
`everyone` anchor), and `owner_only_writes` is bound to `org_member`. A
one-off probe on this composition (not committed) read the update-row
filter `member_default` gives the assignee on `sys_task`: `null` with no
positions, `{"created_by":"usr_tn_assignee"}` with the member's
positions, so the floor applies. Under it, the assignee's `update` of a
task another member created still goes through (`landed`, `completed_at`
written), because the `sys_task_assignee` rule's `edit` share replaces
the floor as the floor's deferral to the sharing verdict says. The third
member's edit is refused with `RECORD_NOT_FOUND` / 404 and the row is
unchanged. So the rider's per-object alternative is not added.

**Navigation entries need `requiresObject`.** `defineStack` refuses `{
type: 'object', objectName: 'sys_task' }` in an app that does not
declare `sys_task`, and accepts it with `requiresObject: 'sys_task'`
beside it (seat decision Q3 = A: the contract stays). The starter app
(objectstack-ai#36944) spells the gate.

**Found on the way, filed as objectstack-ai#36982 and fixed there (objectstack-ai#37012, merged into
this branch):** a declared sharing rule wrote no per-record grants in an
organization created after boot until the next boot. The runtime test
now runs on ONE boot with the organization inserted after `bootstrap()`,
as a fresh environment's first sign-up does, and the `sys_task_assignee`
grant is still written: the assignee reads and edits the task, and the
second member still reads neither the task nor the note, by id or by
list.

Also noted, not changed: `sys_*` objects get no recycle bin (ADR-0148),
are not AI-readable unless they opt in with `aiReadable`, and are
skipped by the user-deactivation "assigned work" census. The app-facing
platform catalog for project authors
(`skills/objectstack-project/references/platform-catalog.md`, built from
a hand-kept subset) does not list either object yet; that is follow-up
objectstack-ai#37058.

## Verification

Read first:
1.
`packages/plugins/plugin-security/src/objects/default-permission-sets.ts`:
the two `member_default` lines and their ruling comment, beside
`sys_comment`.
2. `packages/platform-objects/src/work/hooks.ts` ›
`stampTaskCompletion`: the insert branch assigns over the client value;
the update branch acts only when `status` is in the write.
3. `packages/platform-objects/src/work/sharing-rules.ts`: the assignee
rule (`field` recipient, `edit`).

Two minutes: `pnpm --filter @objectstack/plugin-security exec vitest run
src/task-note-objects-36942.test.ts` → 6 passed.

<details><summary>Local readings</summary>

Head `ab1bfc643c0` unless a line names another. That head merges
origin/main (`719ef290776`).

- `pnpm --filter @objectstack/plugin-security exec vitest run
src/task-note-objects-36942.test.ts`: the members hold `user`,
`org_member` and `everyone`; one boot, the organization inserted after
`bootstrap()`. Test Files 1 passed, Tests 6 passed.
- Floor probe (one-off file, not committed; same boot): the update-row
filter `member_default` gives the assignee on `sys_task` is `null` with
no positions and `{"created_by":"usr_tn_assignee"}` with the member's
positions. Under that filter the assignee's update is `landed` and the
third member's update is refused `RECORD_NOT_FOUND` / 404.
- Ablation of the two `member_default` lines (head `f55bc30d727`): 5
failed, 1 passed; the restored blob equals HEAD.
- `vitest run --project integration
src/commands/migrate/organization-ownership.declared-rule-mirrors.integration.test.ts`
(head `39ff0ba2a26`): 2 passed. Neighbours (head `a34239ba506`): the
platform-global column drop, the `os dev` ceremony and the sqlite-wasm
integration files: Test Files 3 passed, Tests 15 passed. The inventory
unit test: 26 passed.
- `pnpm --filter @objectstack/plugin-security test` (head
`f55bc30d727`): Test Files 289 passed, Tests 7296 passed, 45 skipped.
`pnpm --filter @objectstack/platform-objects test`: Test Files 126
passed, Tests 2161 passed.
- Full `pnpm build` on this head: exit 0. `node
scripts/pm/dispatch-gates.mjs --commands`: 106 families, all run with
exit codes captured before any pipe, and all 106 exit 0. `--ran` with
the codes: 106 derived, 106 run, 0 NOT-MEASURED, 0 UNRUN. The derivation
warned that the tree is 2 commits behind origin/main, and that 2
derivation files changed across that range; this round makes one push
only, so I did not merge again.
- PR check-runs on this head: every required context is success (Test
Core, Lint & Repo Gates, TypeScript Type Check, Build Core, Governed
Surface Queue Guard, Type Check UI, Test UI, Build & E2E UI, Live E2E
UI, Dogfood Regression Gate), and Check Changeset is success too. Lint
UI was skipped.

</details>

---
_Generated by [Claude
Code](https://claude.ai/code/session_01QSeKYpEsWWE9Y5YtSsDgqZ)_

<!-- signed: repo:objectstack#4 · os-justin ·
session_01QSeKYpEsWWE9Y5YtSsDgqZ -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: objectstack-fleet[bot] <332303061+objectstack-fleet[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

2 participants