<span id="精简角色上下文与能力对象"></span>

# Compact role context and capability objects

POST/user/info uses the compact App Shell projection. Independent GET/iam/me/roles and capabilities retain full metadata. Do not copy field tables between these response families.

| Field | Type | Contract |
| --- | --- | --- |
| iam_context.roles | array (array of objects) | Direct role options, not a permission union |
| roles[].role_id / role_name | string | Canonical role identifier and name |
| roles[].lifecycle_version | integer | Role lifecycle version |
| roles[].selectable | boolean | Whether currently selectable |
| roles[].disabled_reason | string | Empty when available. ROLE_NOT_ACTIVE or ROLE_PROVISIONING_NOT_READY indicates unavailability |
| iam_context.default_role_id / explicit_role_id / effective_role_id | string | Default role, unvalidated explicit candidate, and current single effective role. Empty values have distinct meanings |
| iam_context.default_role_version | integer | Default-role binding version, not role lifecycle version |
| iam_context.role_context_status | string | ready/default_missing/candidate_invalid/role_disabled |
| iam_capabilities.effective_role_id | string | Effective role used for capabilities |
| iam_capabilities.request_id / trace_id | string | Diagnostic identifiers; not found in compact iam_context |
| iam_capabilities.items | array (array of objects) | Compact capabilities. Nonready contexts currently skip calculation and return an empty array |
| items[].capability_id / reason_code | string | Stable capability identifier and returned reason code. Do not infer from display names |
| items[].allowed / all_resources | boolean | Explicit permission and resource-scope type |
| items[].resource_ids | string[] (array of strings) | Exact resource scope; should be empty when all_resources=true |

Bootstrap omits role-option lifecycle_state/system_role, iam_context schema/capability/request/trace metadata, iam_capabilities.capability_version, and item.action_id/resource_type. This compactness is the handler/proto contract, not SDK field loss. Use corresponding independent APIs for full metadata.

Do not fill unrequested/nonready empty capabilities with old cached allow results. Object operations also require allowed=true and either all_resources=true or an exact canonical-ID match. Actual writes recheck permissions. Clear old context/capability/dependent caches after switching candidates, then bootstrap again. One summary is not permanent authorization.

iam_snapshot_version hashes display facts, full internal roles/versions, capabilities, and authorization snapshots. Some inputs are absent from compact JSON, so callers cannot recompute it from JSON alone or treat it as a write version. Existing service Owner/reserved-member display/routing exceptions remain subject to IAM conflict records. Documentation must not expand the authorization model.
