Files
HiveGrid-Wireframes/03 Quellen und Referenzen/hivegrid-cloud/docs/agent-playbooks/foundation-boundaries.md
T
2026-07-08 16:15:37 +02:00

25 lines
1.5 KiB
Markdown

# Foundation Boundary Playbook
Use this when moving feature logic into the reusable boilerplate layer or when touching audit, idempotency, flags, permissions, billing usage, or notifications.
## Ownership Rules
- Runtime apps may orchestrate requests, headers, sessions, and responses.
- Shared business rules belong in `packages/*`, preferably `@hivegrid/foundation` for pure policy and `@hivegrid/db` for schema-backed server boundaries.
- UI and route modules must not reach around package boundaries for tenant-scoped persistence.
- Foundation exports must stay generic. Do not add product-specific roles, flags, templates, adapters, or catalog entries.
## Required Checks
- Audit writes use `@hivegrid/db/audit-events.server`.
- Idempotency keys use `@hivegrid/db/idempotency-keys.server` or the API idempotency store bridge.
- API usage limits use `@hivegrid/db/usage.server`; API routes should not recompute subscription feature math locally.
- Notification deliveries use `sourceKey` whenever a producer can derive a stable event key, so DB upsert prevents duplicate delivery records.
- Feature flags resolve in this order: explicit override, user scope, tenant scope, global scope, default.
## Done Criteria
- Add or update focused tests in the owning package.
- Update feature manifests when a feature changes ownership, billing, provider, worker, or admin-managed behavior.
- Run `pnpm run test:foundation`, the affected package tests, and the app-level route tests for changed runtimes.