Skip to content

[M2.3c3b2] Create and update organizations with atomic ownership and auditing - #86

Merged
samuelmbabhazi merged 1 commit into
mainfrom
feat/m2.3c3b2-organization-commands
Nov 5, 2026
Merged

samuelmbabhazi merged 1 commit into
mainfrom
feat/m2.3c3b2-organization-commands

Conversation

@samuelmbabhazi

Copy link
Copy Markdown
Collaborator

Task

M2.3c3b2, stacked on #85. Review in order; no automatic merge.

What changed and why

Creating an organization now requires fresh password/configured MFA proof and commits its initial owner membership, ownership audit and security-version/session rotation together. Live owners/admins can update organization settings; removed memberships, outsiders and stale sessions fail closed. Globally occupied slugs return a fixed conflict without disclosing tenant metadata.

Preserve translated domain errors when a failed SQL statement also prevents transaction-context cleanup. This keeps a rename collision a stable conflict while rolling back its writes. Successful operations still fail if context cleanup fails.

These are application commands. Protected HTTP routes and the administration UI follow in M2.3d/f; no destructive resource endpoint is introduced.

How it was tested

  • Six new real-PostgreSQL tests run under the restricted runtime role: ownership/session rotation, invalid proof/input, role isolation, concurrent slug creation, rename rollback and failures of both ownership/session audits.
  • Full PostgreSQL integration suite: 154 tests pass.
  • New application commands: 100% statement/branch/function coverage; commands plus repository: 94% statements, 83% branches, 100% functions.
  • API/web/domain lint, typechecks, tests and builds pass; Go tests and buf lint pass.
  • HTTP unit tests require local sockets and pass with that permission; their initial sandboxed attempt returned EPERM.

Security considerations

Account locks serialize mutations against identity changes. Ownership cannot be supplied through input. Row isolation and explicit tenant predicates protect the commands. Audit or rotation failure rolls back all related state. No new dependency, shell invocation or secret exposure path. CodeQL remains skipped by repository configuration; enabled security checks run in CI.

Checklist

  • M2.3c3b2 acceptance met and PLAN/SPEC updated
  • Local lint, TypeScript/Go tests and buf lint pass
  • Invalid input, concurrency, tenant isolation and rollback tested
  • Every new mutation emits an atomic audit event
  • No secret or generated artifact edited manually

@samuelmbabhazi
samuelmbabhazi force-pushed the feat/m2.3c3b1-account-mutation-authority branch from 2c74fad to f7d7a56 Compare November 5, 2026 12:48
@samuelmbabhazi
samuelmbabhazi changed the base branch from feat/m2.3c3b1-account-mutation-authority to main November 5, 2026 12:48
@samuelmbabhazi
samuelmbabhazi force-pushed the feat/m2.3c3b2-organization-commands branch from e92e7fc to 80420d3 Compare November 5, 2026 12:48
@samuelmbabhazi
samuelmbabhazi merged commit 34a8d57 into main Nov 5, 2026
1 check passed
@samuelmbabhazi
samuelmbabhazi deleted the feat/m2.3c3b2-organization-commands branch November 5, 2026 12:48
samuelmbabhazi added a commit that referenced this pull request Nov 5, 2026
## Task

M2.3c3c1, stacked on #86. Review in stack order; do not merge
automatically.

## What changed and why

Add project and environment creation/settings commands with live tenant
authorization under the caller's account lock. New resources default to
pull-request writes, protected environments and no failover. Settings
replacement accepts only normalized fields and preserves resource
ownership. Resource writes and their audits commit or roll back
together.

Project slugs are unique within an organization and environment names
within a project. Concurrent collisions and conflicting renames return
fixed resource-name errors. Environment-only administrators cannot
change their parent project or create sibling environments. No resource
deletion or HTTP endpoint is exposed in this slice; catalogs and HTTP
wiring follow in M2.3c3c2/d.

## How it was tested

- Ten restricted-PostgreSQL tests pass: all five roles plus outsiders,
safe defaults, ownership injection, incorrect ancestry, environment-only
administration, concurrent duplicate creation by two administrators,
rename conflicts and audit rollback for all four commands.
- New application commands have 100% statement, branch and function
coverage.
- API lint, typecheck, all 103 unit tests and production build pass.
- The full 154-test integration suite, web/domain checks, Go tests and
buf lint passed on the immediately preceding slice. CI runs the expanded
full suite and browser acceptance.

## Security considerations

Live scope checks precede writes within the same account/tenant
transaction. Updates always include organization and parent-project
predicates. Audit metadata contains supported settings only. No new
dependency, shell invocation or credential exposure. CodeQL remains
skipped by repository configuration; enabled security jobs run in CI.

## Checklist

- [x] M2.3c3c1 acceptance met; PLAN/SPEC updated
- [x] Relevant tests, lint, types and build pass
- [x] Malformed input, cross-tenant access and concurrent collisions
covered
- [x] Every new mutation emits an atomic audit event
- [x] No secrets or generated files edited manually
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