docs(rest): align Roles 'global_access' usage and DELETE-SA token-invalidation status with backend#231
Merged
rohan-chaturvedi merged 1 commit intoMay 28, 2026
Conversation
…h backend
After re-validation against `phasehq/console@api--apps-envs-accounts`:
- Roles POST/PUT examples shipped `"global_access": false`, but the
server rejects any `global_access` / `globalAccess` under `permissions`
with `400 Bad Request` (`backend/api/views/roles.py:58`, allowed_keys =
{"permissions", "app_permissions"}). Removed the rejected key from
both cURL + Python examples and rewrote the Required-fields /
PUT-body descriptions to match. The Note block at the top of the
page (line 60) already said only `permissions` + `app_permissions`
are accepted, so the page is now internally consistent.
- DELETE Service Account paragraph said revoked tokens return
`403 Forbidden`. Actual behaviour is `401 Unauthorized` with
`{"error": "Token expired or deleted"}`
(`backend/api/auth.py:88-89` raises `AuthenticationFailed`, which DRF
maps to 401). Matches the sibling DELETE Token paragraph and
`errors.mdx` line 40.
Related: phasehq/console#798, PH-618
Deploying phase-docs with
|
| Latest commit: |
712ecdc
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://c4fab5eb.phase-docs.pages.dev |
| Branch Preview URL: | https://nimish-ph-618-docs-revalidat.phase-docs.pages.dev |
rohan-chaturvedi
approved these changes
May 28, 2026
335fd35
into
feat--apis--envs-apps-access
1 check passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two small corrections found while re-validating the merged feature branch against the current backend (
phasehq/console@api--apps-envs-accounts). Stacks under #213.Roles — request examples sent a rejected key
The POST/PUT examples in
roles.mdxshipped"global_access": falseinsidepermissions. The server unconditionally rejects this:Copy-pasting the docs' cURL or Python snippet failed with 400. Also reconciled the Required-fields / PUT-body prose, which previously said
global_accesswas required — the Note at the top of the page already correctly said onlypermissions+app_permissionsare accepted, so the page now reads consistently.Service Accounts — DELETE-SA paragraph cited the wrong status code
Delete Service Account said revoked tokens return
403 Forbidden. Actual behaviour is401 Unauthorized:This matches the sibling Delete Token paragraph (already says 401) and
errors.mdx:40. Single-line fix.Follow-up worth tracking separately (not in this PR)
Custom-role response omits
globalAccess. Per Rohan's comment on PH-618 (May 25), the intent is forglobalAccessto be returned on all role responses, including custom roles. Current code only returns it for built-in defaults — verified again today against the dev backend:The doc examples (POST/PUT response, lines 321 + 436) still show
"globalAccess": falseon custom roles, which matches Rohan's stated intent. Leaving them unchanged here so the docs reflect intended behaviour; needs a backend tweak so the response actually includes it.POST /v1/environmentsreturns 400,PUTreturns 409 for the same "name already exists" condition — same error string, different status. Backend fix, not docs.backend/api/utils/environments.py:239raisesValueError; the POST handler atbackend/api/views/environments.py:130-134blanket-converts to 400, while the PUT handler at line 280 hard-codes 409. 409 is consistent with the Roles duplicate-name behaviour. Will open a separate console PR.Test plan
roles.mdxPOST cURL example POSTs cleanly againsthttps://localhost/service/public/v1/roles/(returns 201)roles.mdxPUT cURL example PUTs cleanly against an existing custom role (returns 200)service-accounts.mdxDELETE paragraph now matcheserrors.mdx401 contractglobal_accessleft inroles.mdxrequest payloads (grep -n 'global_access' src/pages/public-api/roles.mdx→ only descriptive prose, no example keys)Related: phasehq/console#798, PH-618