Skip to content

permission-matrix-edit-loop: the field-level half of the permission matrix is dead for every object (MetadataClient.get() does not unwrap the envelope) #4271

Description

@huangyiirene

Symptom

The object-verb permission loop works, but the field-level half is dead for every object. Open /_console/apps/<app>/metadata/permission/<set> and expand any object row.

  • Expected a field sub-table listing that object's fields with a readable/editable checkbox pair each.
  • Actual "No fields registered for this object." and zero field checkboxes — for every object. Reproduced twice on fresh loads for two objects.

Not a data problem: the network shows GET /api/v1/meta/object/showcase_project → 200 carrying 21 fields.

Root cause

Located by the run. PermissionMatrixEditor.tsx ensureFields() does const obj = await client.get('object', objectName); const raw = obj?.fields; — but MetadataClient.get() (packages/data-objectstack/src/metadata-client.ts, ~L495-512) returns the raw server envelope with no unwrapping, and the framework answers {type, name, item:{…fields}}. So obj.fields is always undefined and every object reports zero fields. The client's own docblock (~metadata-client.ts:522) asserts the opposite ("the legacy get() returns the unwrapped body") — that is where the two sides disagree.

Not a stale bundle — the same code is on objectui origin/main (6d01319dd); the files live at packages/app-shell/src/views/metadata-admin/PermissionMatrixEditor.tsx and packages/data-objectstack/src/metadata-client.ts, both present on the default branch.

Collateral: the RLS CEL editor's field lint/autocomplete (loadObjectFields) is empty for the same reason.

Reproduction

  1. Boot showcase + console; open /_console/apps/<app>/metadata/permission/<set>.
  2. Expand any object row (e.g. showcase_project).
  3. Observe "No fields registered for this object." with zero checkboxes, while the underlying GET /api/v1/meta/object/showcase_project returns 21 fields.

Suggested fix

Unwrap the envelope in ensureFields() (read obj.item.fields) or have MetadataClient.get() unwrap {type,name,item} to the body as its docblock at :522 already claims. Fix loadObjectFields in the RLS CEL editor the same way.

Source

Extracted from the QA run objectstack-ai/objectstack#7637 (framework 92f26f75, console 09987b6).

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingpm:queue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions