feat(workflow): example covers security, platform, enterprise and resilience features

105 route tests, matrix crawl, spec and README updated.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-24 02:19:52 +02:00
co-authored by Claude Sonnet 5.5
parent 00af65613d
commit 62fdd08da8
90 changed files with 8038 additions and 11 deletions
+85 -2
View File
@@ -10,10 +10,11 @@ make -f example/example.mk example
./build/example/living-server 8080
```
Open `http://127.0.0.1:8080/` and click through the matrix. Narrow the
Open `http://127.0.0.1:8080/` and click through the matrix; `/stats` has the
charts (Chart.js is embedded in the binary, no CDN). Narrow the
window to 360px: the top nav collapses into a dropdown menu.
Run the suite (37 route-level integration tests, real stack, no mocks):
Run the suite (105 route-level integration tests, real stack, no mocks):
```sh
make -f example/example.mk example-test
@@ -78,6 +79,86 @@ on a missing row.
| workflow | `/workflow/release` | `tests/example/workflow/release_test.cpp` | `plans/10-workflow-example.md` 6.2 |
| redirects | `/redirect/here` | `tests/example/redirect/here_test.cpp` | `plans/05-request-routing.md` |
| statistics | `/stats` | `tests/example/stats/page_test.cpp` | `plans/02-observability.md` |
| statistics data | `/stats/data` | `tests/example/stats/data_test.cpp` | `plans/02-observability.md` |
### Extended features
Added in the second pass: security, platform, enterprise, resilience and
data-depth demos. Each row is a plain GET that answers 2xx; actions are
buttons or forms on the page. Per-module gaps versus `src/` are in the
header of `example/fw/{SecurityExtra,Platform,Enterprise,Resilience}.hpp`.
`tests/example/matrix_test.cpp` crawls every row of the index.
| Feature | Route | Test file |
|---|---|---|
| CSRF token form | `/security/csrf` | `tests/example/security/csrf_test.cpp` |
| CORS preflight allowlist | `/security/cors` | `tests/example/security/cors_test.cpp` |
| Rate limiter (429 + Retry-After) | `/security/rate` | `tests/example/security/rate_test.cpp` |
| Security headers | `/security/headers` | `tests/example/security/headers_test.cpp` |
| CSP nonce page | `/csp/page` | `tests/example/csp/page_test.cpp` |
| CSP report endpoint | `/csp/report` | `tests/example/csp/report_test.cpp` |
| SHA-256 and HMAC | `/crypto/hash` | `tests/example/crypto/hash_test.cpp` |
| Secure random token | `/crypto/random` | `tests/example/crypto/random_test.cpp` |
| Password hashing (demo) | `/crypto/password` | `tests/example/crypto/password_test.cpp` |
| Roles and permissions | `/security/roles` | `tests/example/security/` |
| Secrets provider (masked) | `/security/secrets` | `tests/example/security/secrets_test.cpp` |
| Upload validation | `/security/upload` | `tests/example/security/upload_test.cpp` |
| SQL and path guard | `/security/guard` | `tests/example/security/guard_test.cpp` |
| Denial sink | `/security/denials` | `tests/example/security/denials_test.cpp` |
| Login form with session cookie | `/security/login` | `tests/example/security/login_test.cpp` |
| i18n | `/i18n` | `tests/example/i18n/` |
| gzip compression | `/compress/demo` | `tests/example/compress/demo_test.cpp` |
| conditional GET and ranges | `/conditional/doc` | `tests/example/conditional/doc_test.cpp` |
| liveness probe | `/healthz` | `tests/example/healthz/` |
| readiness probe | `/readyz` | `tests/example/readyz/` |
| startup gate | `/startupz` | `tests/example/startupz/` |
| prometheus metrics | `/metrics` | `tests/example/metrics/` |
| structured logging | `/logging/records` | `tests/example/logging/records_test.cpp` |
| trace context | `/context/trace` | `tests/example/context/trace_test.cpp` |
| DI container | `/di/services` | `tests/example/di/services_test.cpp` |
| flash messages | `/flash` | `tests/example/flash/` |
| middleware builtins | `/middleware/demo` | `tests/example/middleware/demo_test.cpp` |
| expose stats | `/expose/stats` | `tests/example/expose/stats_test.cpp` |
| CLI commands | `/cli/commands` | `tests/example/cli/commands_test.cpp` |
| Tenant resolution (header, subdomain, path) | `/tenancy/resolve` | `tests/example/tenancy/resolve_test.cpp` |
| Tenant path resolution | `/tenancy/t/demo/whoami` | `tests/example/tenancy/` |
| Tenant data isolation | `/tenancy/data` | `tests/example/tenancy/data_test.cpp` |
| Tenant quotas | `/tenancy/quota` | `tests/example/tenancy/quota_test.cpp` |
| Tenant feature flags | `/tenancy/flags` | `tests/example/tenancy/flags_test.cpp` |
| Tenant config overlay | `/tenancy/config` | `tests/example/tenancy/config_test.cpp` |
| Per-tenant metrics | `/tenancy/metrics` | `tests/example/tenancy/metrics_test.cpp` |
| Tenant provisioning form | `/tenancy/provision` | `tests/example/tenancy/provision_test.cpp` |
| Hash-chained audit log | `/audit/log` | `tests/example/audit/log_test.cpp` |
| Audit tamper detection | `/audit/verify` | `tests/example/audit/verify_test.cpp` |
| PII masking and redaction | `/audit/mask` | `tests/example/audit/mask_test.cpp` |
| Retention and legal hold | `/audit/retention` | `tests/example/audit/retention_test.cpp` |
| Data subject export and erasure | `/audit/subject` | `tests/example/audit/subject_test.cpp` |
| API keys with scopes | `/governance/keys` | `tests/example/governance/keys_test.cpp` |
| Tiers and rate limit headers | `/governance/tiers` | `tests/example/governance/tiers_test.cpp` |
| API versions (Deprecation, Sunset) | `/v1/items` | `tests/example/v1/items_test.cpp` |
| API version list | `/governance/versions` | `tests/example/governance/versions_test.cpp` |
| Route linter | `/governance/lint` | `tests/example/governance/lint_test.cpp` |
| OpenAPI spec differ | `/governance/diff` | `tests/example/governance/diff_test.cpp` |
| RFC 7807 problem+json | `/governance/problem` | `tests/example/governance/problem_test.cpp` |
| Circuit breaker | `/operability/breaker` | `tests/example/operability/breaker_test.cpp` |
| Bulkhead | `/operability/bulkhead` | `tests/example/operability/bulkhead_test.cpp` |
| Load shedder | `/operability/shedder` | `tests/example/operability/shedder_test.cpp` |
| Deadline propagation | `/operability/deadline` | `tests/example/operability/deadline_test.cpp` |
| SLO error budget | `/operability/slo` | `tests/example/operability/slo_test.cpp` |
| Chaos experiment | `/operability/chaos` | `tests/example/operability/chaos_test.cpp` |
| Deploy strategies | `/operability/deploy` | `tests/example/operability/deploy_test.cpp` |
| Lease, election, fenced lock | `/operability/coord` | `tests/example/operability/coord_test.cpp` |
| Supply chain gate | `/supplychain` | `tests/example/supplychain/` |
| Client retry and backoff | `/clients/retry` | `tests/example/clients/retry_test.cpp` |
| Client session: cookies, pool, proxy, auth | `/clients/session` | `tests/example/clients/session_test.cpp` |
| Migrations: check then apply | `/data/migrations` | `tests/example/data/migrations_test.cpp` |
| Transaction rollback | `/data/transaction` | `tests/example/data/transaction_test.cpp` |
| Query builder and relations | `/data/query` | `tests/example/data/query_test.cpp` |
| Singleflight | `/data/singleflight` | `tests/example/data/singleflight_test.cpp` |
| TTL store, LRU, pubsub | `/data/ttl` | `tests/example/data/ttl_test.cpp` |
| Debug snapshot | `/operability/debug` | `tests/example/operability/debug_test.cpp` |
## Layout
```text
@@ -89,5 +170,7 @@ example/
fw/ # skeletal framework public API (namespace molo::example::fw)
app/ # demo routes (namespace molo::example::app)
static/ # disk static assets (responsive CSS, tiny JS)
assets/ # embedded at build time (Chart.js, stats.js) via src/cli/embed
tools/ # build helper wrapping the embedder
tests/example/ # route-level integration tests mirroring URLs
```