Skip to content

Group first-admin stamping happens only on the ScopedStack path #118

Description

@cuibonobo

Spec §Group (Bootstrap) states unconditionally: "The creator of a _group Record is automatically stamped as its first admin." But stampGroupAdmin runs only in ScopedStack.create() (stack.ts:1953-1956, 1656-1663). A _group created via plain Stack gets an empty roster.

Consequence: management still works (the owner is always a manager via isGroupManager's owner check), but a { access: 'group', groupId, role: 'admin' } ACL entry pointing at an owner-created group matches no one (empty admin roster), and the owner must hand-add the first admin before role-gated group ACLs mean anything.

Decided: stamp the creator on the unscoped path too

Make "creator is first admin" a uniform invariant across both paths. Recommended implementation — move the stamping into Stack.create(), keyed on the record's author, rather than adding a second stamping site:

  • In Stack.create(), for a _group (by baseId), stamp opts.entityId ?? ownerEntityId as an admin roster association (idempotent, via the existing stampGroupAdmin helper).
  • Remove the stamping from ScopedStack.create() — it delegates to Stack.create(), which now handles it.

This resolves cleanly for every path because opts.entityId already carries the correct author:

Doing it this way avoids the double-stamp / owner-in-every-roster hazard that a naive "also stamp owner in Stack.create" would cause when ScopedStack delegates.

Work items

  • Move _group admin stamping into Stack.create(), keyed on opts.entityId ?? ownerEntityId; drop it from ScopedStack.create()
  • Tests: owner-created group via plain Stack has the owner as first admin; non-owner group via ScopedStack has the requester (and not the owner) as admin; owner-via-ScopedStack stamps the owner exactly once
  • Confirm spec §Group text now holds for both paths (no wording change needed)

Refs

#58 (group roles / admin bootstrap), #69 (owner-writes-carry-no-entityId — why the owner path has no entityId to key on). From docs/design-assessment-2026-07.md §F2.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions