ENGINEERING SPECS
Development and Testing
Testing must protect the aligned model:
View source1. Goal
Testing must protect the aligned model:
Node + CapabilityBinding + RuntimeBinding + Endpoint + Subscription
2. Test Layers
Control Plane:
- repository tests.
- service tests.
- transaction tests.
- compiler tests.
- API contract tests.
Edge Runtime:
- identity tests.
- desired state pull tests.
- runtime adapter tests.
- apply and rollback tests.
- usage collector tests.
Console:
- route rendering.
- form validation.
- auth guard.
- mobile navigation.
- API integration smoke.
3. MVP E2E Flow
Target fake-runtime E2E:
create tenant
-> create user
-> create enrollment token with traffic.entry intent
-> fake Node register
-> fake heartbeat
-> create enrollment token with traffic.exit intent
-> fake Node register
-> fake heartbeat
-> create subscription
-> fetch public subscription
-> update traffic policy
-> publish desired state
-> report usage
-> enforce quota
Assertions:
- Nodes become online.
- CapabilityBindings become ready.
- RuntimeBindings become running.
- DesiredState version is node-scoped.
- Subscription fetch does not expose internal DesiredState.
- Usage attribution includes subscription, node, capability role, runtime binding, runtime, and direction.
4. Real Runtime Smoke
Target real-runtime smoke:
- one Node with
traffic.entry. - one Node with
traffic.exit. - ready Traffic Entry endpoint with certificate.
- sing-box runtime installed and running.
- subscription URL rendered.
- GitHub request succeeds through Traffic Entry -> Traffic Exit.
- stopping Traffic Exit degrades health within expected timeout.
5. SQL Migration Tests
For breaking migrations:
- apply migration to a production-like snapshot.
- verify old type values become capability roles.
- verify old client configuration rows become subscriptions.
- verify runtime bindings point to nodes and capability bindings.
- verify endpoint TLS bindings are populated.
- verify old columns are dropped after validation.
6. Commands
Common checks:
go test ./...
pnpm --dir apps/console build
buf lint
buf breaking --against '.git#branch=main'
During this development phase, buf breaking may intentionally fail when proto contracts are being replaced. Record intentional breaks in the migration PR.