Skip to content

[M2.3c2b2] Resolve tenant permissions from live resource state - #83

Merged
samuelmbabhazi merged 1 commit into
mainfrom
feat/m2.3c2b2-live-tenant-access
Nov 5, 2026
Merged

samuelmbabhazi merged 1 commit into
mainfrom
feat/m2.3c2b2-live-tenant-access

Conversation

@samuelmbabhazi

Copy link
Copy Markdown
Collaborator

Task

M2.3c2b2, stacked on #82 (feat/m2.3c2b1-organization-discovery).

What changed and why

Resolve current active/verified membership, organization/project ancestry, environment protection and role bindings before applying the tenant policy. Reject unknown capabilities, invalid identifiers and incomplete contexts before storage access. Ignore caller-supplied role/protection metadata, use a shared canonical UUIDv7 validator and return the same resource-not-found error for unavailable permissions and resources.

All reads include organization filters inside the tenant unit of work. Grant lookup is bounded to the unique project grant and the relevant environment grant (or one environment grant for parent navigation). The read-side module is independent of identity commands, preparing live token authorization without a module dependency cycle.

Validation

  • Seven restricted-login PostgreSQL tests cover foreign/sibling resource references, environment protection changes, explicit role downgrades, environment-only grants, account disabling, membership removal, malformed inputs and joining/rolling back the caller transaction.
  • All 143 PostgreSQL integration tests pass. The final bounded grant query also passes the targeted suite with 100% statement/branch/function coverage across the new authorization service and repository.
  • API/web/domain lint, types, tests and builds pass; final API lint/types pass after query bounding. Go tests and buf lint passed earlier in this session; their sources are unchanged.

Security considerations

No permission cache, HTTP endpoint, token-authority switch or unaudited mutation is introduced here. M2.3c3/c4 add audited commands and serialize role changes with identity locks; M2.3d wires session/bearer routes. Membership/account state and resource ancestry come only from current database rows. No dependency, secret or application shell invocation is added.

Checklist

  • M2.3c2b2 acceptance and cross-resource boundaries covered
  • Restricted-login integration and application coverage checks pass
  • SPEC and PLAN updated
  • No new application mutation requiring an audit event

@samuelmbabhazi
samuelmbabhazi force-pushed the feat/m2.3c2b1-organization-discovery branch from 48a2075 to 85f7cf6 Compare November 5, 2026 12:46
@samuelmbabhazi
samuelmbabhazi changed the base branch from feat/m2.3c2b1-organization-discovery to main November 5, 2026 12:46
@samuelmbabhazi
samuelmbabhazi force-pushed the feat/m2.3c2b2-live-tenant-access branch from fa90cb8 to dc34813 Compare November 5, 2026 12:47
@samuelmbabhazi
samuelmbabhazi merged commit b3fdebc into main Nov 5, 2026
10 checks passed
@samuelmbabhazi
samuelmbabhazi deleted the feat/m2.3c2b2-live-tenant-access branch November 5, 2026 12:47
samuelmbabhazi added a commit that referenced this pull request Nov 5, 2026
#84)

## Task

M2.3c3a, stacked on #83 (`feat/m2.3c2b2-live-tenant-access`).

## What changed and why

Add pure normalization/validation for organization, project and
environment settings. Bound Unicode display names, reject
control/format/unpaired-surrogate characters, require canonical
lowercase slugs and accept only supported configuration enums and
boolean protection. Defaults remain pull-request writes, protected
environments and no automatic failover. Normalized values are immutable
and include only explicitly supported fields.

Add explicit organization/project/environment update capabilities to the
role matrix and generated API contract. Organization settings require an
organization administrator; project/environment settings require
administration of the corresponding scope. Tighten UUID validation to
reject a terminal newline that JavaScript's dollar anchor otherwise
accepts.

## Validation

- 83 domain tests pass, including 24 setting tests and the full
five-role matrix for all 22 permissions.
- New settings and tenant policy have 100% statement/branch/function
coverage.
- 34 targeted PostgreSQL tests pass for tenant
schema/isolation/discovery/live authority and API-token HTTP behavior.
The full 143-test integration suite passed immediately before this
pure-policy slice.
- API/web/domain lint, typechecks, tests and builds pass. OpenAPI and
the TypeScript SDK were regenerated. Go tests and buf lint passed
earlier in this session; their sources are unchanged.

## Security considerations

No command or settings endpoint is exposed in this slice; audited
persistence follows in M2.3c3b/c. Inputs cannot inject ownership fields,
coerce protection from a string, widen settings permissions or silently
enable failover. No new dependency, shell invocation or secret is
introduced.

## Checklist

- [x] M2.3c3a policy/defaults acceptance and malicious inputs covered
- [x] Domain coverage, workspace checks and targeted integrations pass
- [x] SPEC/PLAN and generated contract updated
- [x] No new application mutation requiring an audit event
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant