foundry_dev_tools.utils.scope module#
Helpers for explaining the scope of the current Foundry token.
- foundry_dev_tools.utils.scope.COMPASS_RID_PREFIX = 'ri.compass.'#
Only Compass resources are reported; other resource types are ignored.
- foundry_dev_tools.utils.scope.COMPASS_NOT_FOUND_ERROR_NAME = 'Compass:NotFound'#
Foundry reports resources outside a token’s scope as not found instead of forbidden.
- foundry_dev_tools.utils.scope.SCOPE_DIAGNOSTICS_TIMEOUT = (5, 10)#
Connection/read timeout for the scope request so it cannot delay the original error.
- foundry_dev_tools.utils.scope.parse_compass_resources(payload)[source]#
Return the Compass resources referenced by a
/multipass/api/me/scoperesponse.
- foundry_dev_tools.utils.scope.describe_compass_resources(context)[source]#
Return the Compass resources referenced by the token scope, if it can be read.
- Parameters:
context (FoundryContext)
- Return type:
- foundry_dev_tools.utils.scope.build_auth_error_hint(context, status_code, error_name=None)[source]#
Build a user-facing hint for authentication and permission responses.
An expiry note is added for any token provider that knows when its current token expires. Providers that opt in via
supports_scope_diagnosticsadditionally get the Compass resources referenced by their token scope for403responses and404Compass responses, which Foundry uses to mask resources outside the token’s scope. The original exception is never replaced; callers append the returned text to it.- Parameters:
context (FoundryContext)
status_code (int)
error_name (str | None)
- Return type:
str | None