# Environments Domain

**Status:** Approved target-state baseline  
**Activation:** I6.

## Target State

`Environment` is a durable deployment target/context such as development, staging or production. It owns environment-specific configuration/resource bindings and promotion policy references, not application artifact identity.

```text
Project
  -> Environment*
       provider/resource binding
       configuration overrides
       Connection bindings
       promotion/approval policy
       health context
  <- Deployment of Release
```

## Identity and Ownership

Environment has stable AWP ID, Project relation, name/kind, target provider/resource/cluster/namespace, configuration references, connection binding, protection policy, status and metadata.

## Invariants From Day 1

- Environment does not mutate Release/Artifact contents;
- environment-specific secrets remain CredentialReferences;
- production/high-risk environments can require stricter Approval/security policy;
- lower environment config cannot broaden Project/System security ceilings;
- same Environment identity survives individual Deployment attempts;
- provider namespace/project ID is mapping, not sole identity;
- health observations are current state, not Deployment history.

## Lifecycle

```text
configured -> ready -> degraded/unavailable -> disabled/archived
```

Readiness includes provider connection/resource/config policy requirements, not application release health.

## Configuration

Effective deployment configuration combines System/Project/Environment/Release/Deployment-allowed values using typed configuration rules. Runtime secret material is projected at deployment/runtime, not persisted as ordinary config.

## Promotion

Promotion policy can express environment order, required evidence/Approval, allowed release sources and whether automatic production promotion is enabled.

## Increment Realization

| Increment | Environment realization |
|---|---|
| I2 | Planning recommends environment strategy and connection requirements. |
| I6 | Environment primitive/settings/promotion/deployment target activates. |
| I9 | tenant isolation, quotas, retention, enterprise environment governance. |

## Current Implementation State

Target spec only; I1 dogfood does not need production environment semantics.

## Deferred Realization

Multi-region/fleet environments and dynamic preview environment productization are later features if required.

## Temporary Dogfood Behavior

Developer K3s namespace may be used operationally before I6 but is not silently treated as a full product Environment record.

## Failure / Recovery

Provider/resource unavailable yields Environment degraded and blocks dependent Deployments while preserving Release readiness. Rebinding target resources is audited and may require Decision/Approval.

## UI Implications

Release/Deployment and Settings pages show environment target, protection, health, effective config provenance and current/previous Deployments.

## Decisions / ADRs

Environment protection is policy/configuration; artifact immutability remains separate.