docs(P03): complete domain-derived-docs phase

This commit is contained in:
Jon Chery
2026-08-05 00:30:31 +00:00
parent 2c15282ad4
commit 530ce3efed
27 changed files with 1556 additions and 0 deletions
+50
View File
@@ -0,0 +1,50 @@
# CI/CD — Derived Rules
> Derives from `domains/devops/first-principles.md` P2 (Automation), P4 (Rollback First), P5 (Progressive Delivery).
## The Pipeline is the Process (P2)
- If it is not in the pipeline, it does not happen. Manual deploys are a bug.
- The pipeline: lint → test → build → deploy → verify.
- Every step is scripted, versioned, and reproducible. No "run this command on the server."
## Lint (P2, core C2 Clarity)
- Run the linter on every commit. Fail the build on lint errors.
- Format check (prettier, gofmt, rustfmt). Format is not a debate; it is automated.
- Security lint (eslint-plugin-security, bandit, gosec). Catch the obvious ones.
## Test (P2, domains/testing)
- Unit tests in the pipeline. Fast. Every commit.
- Integration tests on merge to main. Slower. Every merge.
- E2E tests before deploy. Slowest. Every deploy candidate.
## Build (P7 Immutability)
- Build once. The artifact is immutable. The same artifact goes to every environment.
- The build is reproducible: same commit → same artifact (modulo timestamps, which are stripped).
- Build artifacts are signed and stored. A deploy is a reference to an artifact, not a rebuild.
## Deploy (P4 Rollback First, P5 Progressive Delivery)
- Every deploy has a rollback. The rollback is tested before the deploy.
- Progressive: canary (1% → 10% → 100%), blue-green, or feature flags.
- No big-bang deploys. A big-bang deploy is a rollback with no rehearsal.
## Verify (P3 Observability)
- After deploy, verify: health checks, smoke tests, metric watching.
- A deploy is not "done" when the code is on the server. It is done when the metrics are healthy.
- Auto-rollback on metric regression. The pipeline watches; humans sleep.
## What Violates CI/CD Discipline
| Violation | Principle |
|-----------|-----------|
| Manual deploy script | P2 Automation |
| No rollback path | P4 Rollback First |
| Big-bang deploy to prod | P5 Progressive Delivery |
| Rebuild per environment | P7 Immutability |
| Deploy without health check | P3 Observability |
| No lint in CI | P2, C2 |
+44
View File
@@ -0,0 +1,44 @@
# Environments — Derived Rules
> Derives from `domains/devops/first-principles.md` P1 (Reproducibility), P6 (Configuration as Code), P7 (Immutability).
## Environment Parity (P1 Reproducibility)
- Dev, staging, prod are the same system, different data.
- The same artifact runs in all three. The same config schema, different values.
- "Works on my machine" is a parity failure. The machine is the pipeline.
## Configuration (P6 Configuration as Code)
- Config is in the repo (default values) + environment overrides (secrets, endpoints).
- No snowflake servers. No "this one is different because we edited it in prod."
- Config changes are PRs, not SSH sessions.
## Secrets (P9 Secret Hygiene via security)
- Secrets are per-environment. Dev secrets ≠ prod secrets.
- Secrets come from a secrets manager (Vault, AWS Secrets Manager, Doppler), not env files in prod.
- `.env` files are for local dev only. Prod uses the manager.
## Promotion (P5 Progressive Delivery via devops)
- Code moves dev → staging → prod. Never the reverse.
- A hotfix to prod is backported to staging and dev. Don't let them diverge.
- Promotion is automated. The pipeline decides when code is ready, not a human.
## Data (P1, domains/data P8 Lifecycle Awareness)
- Prod data is sacred. Never copy prod to dev without anonymization.
- Staging uses prod-like data (anonymized, sampled). Dev uses synthetic data.
- A test that runs against prod data is a test that can destroy prod data. Don't.
## What Violates Environment Discipline
| Violation | Principle |
|-----------|-----------|
| "It works on my machine" | P1 Parity |
| Manual config edit in prod | P6 Configuration as Code |
| Dev secret reused in prod | P9 Secret Hygiene |
| Copy prod DB to dev | P1, data P8 |
| Hotfix in prod not backported | P5 (divergence) |
| A snowflake server | P1, P6 |