Skip to content

[M2.3c3c1] Authorize and audit project and environment settings - #87

Merged
samuelmbabhazi merged 1 commit into
mainfrom
feat/m2.3c3c1-project-environment-commands
Nov 5, 2026
Merged

samuelmbabhazi merged 1 commit into
mainfrom
feat/m2.3c3c1-project-environment-commands

Conversation

@samuelmbabhazi

Copy link
Copy Markdown
Collaborator

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

  • M2.3c3c1 acceptance met; PLAN/SPEC updated
  • Relevant tests, lint, types and build pass
  • Malformed input, cross-tenant access and concurrent collisions covered
  • Every new mutation emits an atomic audit event
  • No secrets or generated files edited manually

@samuelmbabhazi
samuelmbabhazi force-pushed the feat/m2.3c3b2-organization-commands branch from e92e7fc to 80420d3 Compare November 5, 2026 12:48
Base automatically changed from feat/m2.3c3b2-organization-commands to main November 5, 2026 12:48
@samuelmbabhazi
samuelmbabhazi force-pushed the feat/m2.3c3c1-project-environment-commands branch from 3aaebca to 7abed80 Compare November 5, 2026 14:44
@samuelmbabhazi
samuelmbabhazi merged commit 4b66d6f into main Nov 5, 2026
2 of 11 checks passed
@samuelmbabhazi
samuelmbabhazi deleted the feat/m2.3c3c1-project-environment-commands branch November 5, 2026 14:45
samuelmbabhazi added a commit that referenced this pull request Nov 5, 2026
## Task

M2.3c3c2, stacked on #87. Review in order; do not merge automatically.

## What changed and why

Add account-bound organization discovery, tenant-filtered
project/environment catalogs and authorized detail queries. Membership
and resource grants are filtered in SQL before the page limit: a member
with access only to the oldest environment still sees its parent project
on the first page. Environment-only access never exposes siblings.

Queries recheck active/verified account and security version under the
account lock. Catalogs use descending UUID order, exclusive range
cursors and a maximum/default page size of 100. Arbitrary cursors never
trigger a cross-tenant existence lookup. Detail queries apply the same
live authority and ancestry rules as commands.

## How it was tested

- Six real restricted-PostgreSQL acceptance tests pass with 101
projects: account discovery, owner/admin pagination, project/environment
grants, parent navigation, role removal, wrong ancestry, stale/disabled
accounts and malformed bounds.
- Query application coverage: 97% statements, 90% branches, 100%
functions and lines.
- API lint, typecheck, 103 unit tests and production build pass.
- Existing full integration, web/domain, Go and protobuf checks passed
in preceding slices; CI runs the expanded full integration and browser
suites.

## Security considerations

Every resource predicate includes its tenant and environment parent.
Filtering happens before pagination; no credential or membership detail
is returned. Account and tenant RLS modes stay mutually exclusive and
context is cleared before pooled connection reuse. This read-only slice
adds no state mutation, shell invocation or dependency. CodeQL remains
skipped by repository configuration; enabled security checks run in CI.

## Checklist

- [x] M2.3c3c2 acceptance met; PLAN/SPEC updated
- [x] Local checks and new PostgreSQL acceptance pass
- [x] Cross-tenant, pagination and live-authority cases covered
- [x] No mutation needing an audit event
- [x] No secrets or generated artifacts edited manually
samuelmbabhazi added a commit that referenced this pull request Nov 5, 2026
…111)

## What changed

The PLAN now states what remains after the post-merge audit of PRs #30
to #110.

- **New status section.** It covers:
  - what is done;
- the verification gap: CI has been blocked by billing since #87, so
integration, browser, CodeQL and gosec runs are missing. New task CI-1
reruns them first;
  - the next tasks in dependency order;
  - previously unowned work, now assigned to tasks;
  - the decisions waiting for the maintainer.
- **M1.2 and M1.2b ticked.** Their acceptance is met. The join-token
REST endpoint, node list/revoke and the install command with the CA
fingerprint move to a new task, **M2.7**, which depends on M2.3d and
M2.3g1.
- **New splits:**
  - M1.4a/b/c (action dispatch over `Connect` becomes M1.4a);
- M2.3f1/f2 and M2.3g1/g2. M2.3g1 records that `node_certificates` lacks
`organization_id` and needs an ADR;
  - M2.4a/b (partly done: append-only grants and their test exist);
  - M2.5a/b.
- **Stale M2.3 bullet removed.** Live owner authorization for API tokens
was delivered in M2.3d2.
- **M2.6 marked partly done** by M2.2e. The SSE endpoint is assigned to
it.
- **`ExecStream`, `CollectFacts`, `UpgradeAgent` and retry-safe
renewal** are assigned to M6.1, M1.6, M8.3 and M4.5.
- **SPEC 4.** It now names the `public` schema actually used, instead of
`shipkeep`.
- **SPEC 16.** New open question on confirmation tokens for in-place
`RestoreVolume`/`RestoreDatabase`. This would change the action list, so
the maintainer decides.

## How it was tested

Docs only. Prettier and the local gate pass.

## Security considerations

None in code. The document records a missing confirmation requirement
and an unapproved license (`argparse`, PSF-2.0) as maintainer decisions.
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