|
| 1 | +<!-- |
| 2 | +Sync Impact Report: |
| 3 | +- Version change: [unversioned template] → 1.0.0 |
| 4 | +- Modified principles: All (initialized from template) |
| 5 | +- Added sections: All core principles and governance sections |
| 6 | +- Removed sections: None |
| 7 | +- Templates requiring updates: |
| 8 | + ✅ plan-template.md - Reviewed, Constitution Check section aligns |
| 9 | + ✅ spec-template.md - Reviewed, requirement structure aligns |
| 10 | + ✅ tasks-template.md - Reviewed, task organization aligns |
| 11 | + ✅ checklist-template.md - Reviewed, compatible with principles |
| 12 | +- Follow-up TODOs: None |
| 13 | +--> |
| 14 | + |
| 15 | +# Wave Containers Constitution |
| 16 | + |
| 17 | +## Core Principles |
| 18 | + |
| 19 | +### I. Service-Oriented Architecture |
| 20 | + |
| 21 | +Wave MUST maintain a clear separation of concerns through distinct service boundaries. Each service (ContainerBuildService, |
| 22 | +ContainerMirrorService, ContainerScanService, RegistryProxyService, BlobCacheService) MUST be independently testable and |
| 23 | +have a single, well-defined responsibility. Controllers MUST remain thin, delegating business logic to services. |
| 24 | + |
| 25 | +**Rationale**: Microservices architecture enables independent scaling, testing, and maintenance of distinct container |
| 26 | +provisioning capabilities. Clear boundaries prevent coupling and facilitate parallel development. |
| 27 | + |
| 28 | +### II. Container Platform Agnosticism |
| 29 | + |
| 30 | +Wave MUST support multiple container platforms (Docker, Kubernetes, Singularity) and registries (Docker Hub, Quay.io, |
| 31 | +AWS ECR, Azure CR) without hardcoding platform-specific assumptions into core logic. Platform-specific strategies |
| 32 | +MUST be isolated behind abstract interfaces. |
| 33 | + |
| 34 | +**Rationale**: Container ecosystem diversity requires flexible provisioning that adapts to client infrastructure without |
| 35 | +forcing migration or lock-in. |
| 36 | + |
| 37 | +### III. Ephemeral-First Design |
| 38 | + |
| 39 | +All container operations MUST assume ephemeral lifecycle by default. Containers, build contexts, and intermediate |
| 40 | +artifacts MUST be automatically garbage-collected. Long-term persistence MUST be explicit opt-in through user-provided |
| 41 | +registry credentials and push operations. |
| 42 | + |
| 43 | +**Rationale**: Wave's core value is on-demand provisioning without manual registry management. Ephemeral-first design |
| 44 | +prevents storage bloat and reduces operational overhead. |
| 45 | + |
| 46 | +### IV. Proxy Transparency |
| 47 | + |
| 48 | +When acting as a registry proxy, Wave MUST remain transparent to Docker clients and comply strictly with the Docker |
| 49 | +Registry v2 API specification. Manifest instrumentation and layer injection MUST appear seamless to standard container |
| 50 | +tooling. |
| 51 | + |
| 52 | +**Rationale**: Compatibility with existing container toolchains (docker pull, kubectl, etc.) is non-negotiable for adoption. |
| 53 | +Protocol compliance prevents breaking changes in client workflows. |
| 54 | + |
| 55 | +### V. Async-by-Default Operations |
| 56 | + |
| 57 | +All I/O-bound operations (registry pulls, builds, scans, blob storage) MUST use Micronaut Reactor non-blocking patterns. |
| 58 | +Blocking calls are prohibited in HTTP request handlers. Long-running operations MUST use JobManager for background processing. |
| 59 | + |
| 60 | +**Rationale**: Container operations involve large data transfers and external API calls. Blocking threads under load |
| 61 | +causes cascading failures. Reactive patterns ensure resource efficiency and throughput under concurrency. |
| 62 | + |
| 63 | +### VI. Security Scanning Integration |
| 64 | + |
| 65 | +Container security scanning MUST be an opt-in, asynchronous operation that never blocks image provisioning. Scan results |
| 66 | +MUST be persisted independently and queryable after container delivery. Scanning failures MUST NOT prevent container access. |
| 67 | + |
| 68 | +**Rationale**: Security scanning adds latency. Making it non-blocking preserves Wave's primary value (fast provisioning) |
| 69 | +while enabling security workflows for teams that require them. |
| 70 | + |
| 71 | +### VII. Multi-Platform Build Support |
| 72 | + |
| 73 | +Container builds MUST support cross-platform compilation (linux/amd64, linux/arm64) without requiring users to manage |
| 74 | +build infrastructure. Platform selection MUST be declarative via API parameters. Build strategy selection (Docker vs Kubernetes) |
| 75 | +MUST be transparent to users. |
| 76 | + |
| 77 | +**Rationale**: ARM64 adoption in cloud and edge requires transparent multi-platform support. Kubernetes-based builds |
| 78 | +provide scalability and isolation that local Docker daemon cannot. |
| 79 | + |
| 80 | +## Storage & Persistence Requirements |
| 81 | + |
| 82 | +### Data Layer Principles |
| 83 | + |
| 84 | +- PostgreSQL MUST be used for structured metadata (build records, scan results, job state) |
| 85 | +- Redis MUST be used for ephemeral caching and rate-limiting state |
| 86 | +- Object storage (S3-compatible) MUST be used for blobs, layers, and build contexts |
| 87 | +- Database migrations MUST be versioned and reversible |
| 88 | +- No business logic in SQL; use application-layer queries via Micronaut Data JDBC |
| 89 | + |
| 90 | +**Rationale**: Clear storage tier separation prevents cross-cutting concerns. Postgres handles ACID requirements, Redis |
| 91 | +handles high-frequency ephemeral state, S3 handles blob scale. |
| 92 | + |
| 93 | +### Authentication & Authorization |
| 94 | + |
| 95 | +- Registry credentials MUST be encrypted at rest |
| 96 | +- JWT tokens MUST be used for Tower integration authentication |
| 97 | +- Rate limiting MUST be enforced per-user via Spillway library |
| 98 | +- Service-to-service calls within Kubernetes MUST use pod identity where available |
| 99 | + |
| 100 | +**Rationale**: Wave handles sensitive registry credentials and must prevent credential leakage. Rate limiting prevents |
| 101 | +abuse of compute-intensive build operations. |
| 102 | + |
| 103 | +## Testing & Quality Standards |
| 104 | + |
| 105 | +### Testing Requirements |
| 106 | + |
| 107 | +- All services MUST have unit tests using Spock 2 framework |
| 108 | +- Integration tests MUST use Testcontainers for external dependencies (Postgres, Redis) |
| 109 | +- Controller tests MUST mock service layer dependencies |
| 110 | +- Test coverage MUST be measured via JaCoCo and reported after test runs |
| 111 | +- Tests MUST NOT depend on external registries; use local registry containers or mocks |
| 112 | + |
| 113 | +**Rationale**: Groovy + Spock provide expressive BDD-style tests. Testcontainers ensure consistent CI/CD environments. |
| 114 | +External registry dependencies cause flaky tests and rate-limiting issues. |
| 115 | + |
| 116 | +### Performance Standards |
| 117 | + |
| 118 | +- HTTP endpoints MUST respond within 200ms p95 for proxy operations (excluding upstream registry latency) |
| 119 | +- Build operations MUST queue within 100ms and report job ID |
| 120 | +- Blob cache MUST serve layers with 90%+ hit rate under normal load |
| 121 | +- Memory usage MUST remain under 2GB heap for typical workloads |
| 122 | + |
| 123 | +**Rationale**: Wave sits in the critical path for container pulls. Latency directly impacts developer and CI/CD workflows. |
| 124 | +Performance budgets prevent regressions. |
| 125 | + |
| 126 | +## Governance |
| 127 | + |
| 128 | +### Amendment Process |
| 129 | + |
| 130 | +Constitution changes MUST be documented in Git commit messages with rationale. MAJOR changes (removing principles, |
| 131 | +incompatible policy shifts) require version bump to next major. MINOR changes (new principles, expanded guidance) require |
| 132 | +minor version bump. PATCH changes (clarifications, wording) require patch version bump. |
| 133 | + |
| 134 | +### Compliance Review |
| 135 | + |
| 136 | +All pull requests MUST be reviewed against constitution principles. Violations MUST be explicitly justified with |
| 137 | +"Why Needed" and "Simpler Alternative Rejected" documentation in design docs. Unjustified complexity MUST be rejected. |
| 138 | + |
| 139 | +### Versioning Policy |
| 140 | + |
| 141 | +Wave follows semantic versioning (MAJOR.MINOR.PATCH): |
| 142 | +- MAJOR: Breaking API changes, incompatible registry protocol changes |
| 143 | +- MINOR: New features (new registry support, new build capabilities) |
| 144 | +- PATCH: Bug fixes, performance improvements, security patches |
| 145 | + |
| 146 | +Release process: |
| 147 | +1. Update VERSION file |
| 148 | +2. Update changelog.txt with changes since last release |
| 149 | +3. Commit with `[release]` tag in first line of commit message |
| 150 | +4. Push to upstream master branch |
| 151 | + |
| 152 | +**Rationale**: Semantic versioning provides clear upgrade expectations. Tagged release commits enable automated CI/CD |
| 153 | +release workflows. |
| 154 | + |
| 155 | +**Version**: 1.0.0 | **Ratified**: 2025-10-28 | **Last Amended**: 2025-10-28 |
0 commit comments