Skip to content

feat(platform-objects): add sys_user.manager_id to back the own_and_reports scope (ADR-0057) - #2133

Merged
xuyushun441-sys merged 2 commits into
mainfrom
feat/sys-user-manager-hierarchy
Jun 21, 2026
Merged

xuyushun441-sys merged 2 commits into
mainfrom
feat/sys-user-manager-hierarchy

Conversation

@xuyushun441-sys

Copy link
Copy Markdown
Collaborator

What

The ADR-0057 own_and_reports hierarchy scope (caller + everyone down their manager chain) was implemented in the resolver (it walks sys_user.manager_id) but unbacked — nothing on sys_user modelled a manager, so the scope silently degraded to owner-only. This adds the missing field and proves the scope end-to-end.

Changes

  • sys_user.manager_id — a self-lookup (Field.lookup('sys_user')) in a new Organization group. The reporting chain own_and_reports walks.
  • i18n — manager_id label in en / zh / ja / es (Manager / 经理 / マネージャー / Gerente).
  • Dogfood — showcase-scope-depth.dogfood.test.ts now covers own_and_reports: a user sees their own records plus everyone down their manager_id chain (alice ← bob ← carol), not off-chain peers; a leaf report sees only their own. 7/7 green (was 5).

Why now

Surfaced while rounding out the enterprise hierarchy-authz verification: unit / unit_and_below are proven (here + the cloud security-enterprise conformance test), but own_and_reports had no data model behind it. This makes all three scopes real and tested.

Follow-up (separate, cloud repo): extend the cloud security-enterprise conformance test to assert own_and_reports against the real resolver — needs a .framework-sha bump to include this field.

🤖 Generated with Claude Code

os-zhuang and others added 2 commits June 21, 2026 22:41
…e path (ADR-0056 D7)

`createStandaloneStack` (the boot path used by `objectstack dev`/`serve`/`start`
when serving a compiled `dist/objectstack.json` with no host
`objectstack.config.ts`) surfaced `objects`/`requires`/`manifest` from the
artifact bundle but dropped `permissions[]` and `roles[]`. So the CLI's
`appDefaultProfileName(config.permissions)` saw `undefined` and SecurityPlugin
fell back to the built-in owner-only `member_default` — an app `isDefault`
profile carrying e.g. `readScope: 'unit_and_below'` was silently ignored. The
config-load path was unaffected (the app's `permissions` survived via the
original stack object).

Surface `permissions[]` and `roles[]` from the artifact bundle, mirroring the
existing `objects`/`requires`/`manifest` handling, so the artifact-serve path
applies the app default profile exactly like the config-load path.

Tests:
- packages/runtime/src/standalone-stack.test.ts — the artifact-serve path now
  surfaces permissions/roles (incl. readScope) and drives appDefaultProfileName.
- packages/dogfood/test/showcase-scope-depth-fallback.dogfood.test.ts — a
  profile resolved by name as fallbackPermissionSet widens the visibility matrix
  (unit_and_below) with the reference hierarchy resolver, and fails closed
  without it.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…eports scope (ADR-0057)

The own_and_reports hierarchy scope was implemented in the resolver (walks
sys_user.manager_id) but no field backed it, so it always degraded to owner-only.
Add manager_id (self-lookup) + en/zh/ja/es labels, and extend the scope-depth
dogfood to prove it: a user sees their own records plus everyone down their
manager chain (alice ← bob ← carol), not off-chain peers. Dogfood 7/7.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 21, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
spec Ready Ready Preview, Comment Jun 21, 2026 2:47pm

Request Review

@github-actions github-actions Bot added 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 Jun 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 3 package(s): @objectstack/dogfood, @objectstack/platform-objects, @objectstack/runtime.

18 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:

  • content/docs/concepts/cloud-artifact-api.mdx (via packages/runtime)
  • content/docs/concepts/implementation-status.mdx (via @objectstack/runtime)
  • content/docs/concepts/north-star.mdx (via packages/runtime)
  • content/docs/concepts/packages.mdx (via @objectstack/platform-objects, @objectstack/runtime)
  • content/docs/concepts/setup-app.mdx (via @objectstack/platform-objects)
  • content/docs/guides/api-reference.mdx (via @objectstack/runtime)
  • content/docs/guides/authentication.mdx (via @objectstack/runtime)
  • content/docs/guides/cloud-deployment.mdx (via @objectstack/runtime)
  • content/docs/guides/deployment-vercel.mdx (via @objectstack/runtime)
  • content/docs/guides/driver-configuration.mdx (via @objectstack/runtime)
  • content/docs/guides/hook-bodies.mdx (via @objectstack/runtime)
  • content/docs/guides/packages.mdx (via @objectstack/platform-objects, @objectstack/runtime)
  • content/docs/guides/plugin-chatbot-integration.mdx (via @objectstack/runtime)
  • content/docs/guides/production-readiness.mdx (via @objectstack/runtime)
  • content/docs/guides/single-project-mode.mdx (via @objectstack/runtime)
  • content/docs/protocol/objectos/http-protocol.mdx (via @objectstack/runtime)
  • content/docs/protocol/objectos/index.mdx (via @objectstack/runtime)
  • content/docs/protocol/objectos/lifecycle.mdx (via @objectstack/runtime)

Advisory only. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs origin/main → pass the list as args.docs.

This branch was successfully deployed

1 active deployment
Preview — 94fedccc Deployed Jun 21, 2026 by vercel[bot]
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

Development

Successfully merging this pull request may close these issues.

2 participants