@a5c-ai/krate 5.0.1-staging.00fa5317c

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (256) hide show
  1. package/Dockerfile +31 -0
  2. package/README.md +183 -0
  3. package/bin/krate-demo.mjs +23 -0
  4. package/bin/krate-server.mjs +14 -0
  5. package/dist/krate-controller-ui.json +3205 -0
  6. package/dist/krate-lifecycle.json +201 -0
  7. package/dist/krate-runtime-snapshot.json +3125 -0
  8. package/dist/krate-summary.json +724 -0
  9. package/docs/README.md +61 -0
  10. package/docs/agents/README.md +83 -0
  11. package/docs/agents/acceptance-test-matrix.md +193 -0
  12. package/docs/agents/agent-mux-adapter-contract.md +167 -0
  13. package/docs/agents/agent-mux-source-map.md +310 -0
  14. package/docs/agents/agent-run-memory-import-spec.md +256 -0
  15. package/docs/agents/agent-stack-management-spec.md +421 -0
  16. package/docs/agents/api-contract-spec.md +309 -0
  17. package/docs/agents/artifacts-writeback-spec.md +145 -0
  18. package/docs/agents/chart-packaging-spec.md +128 -0
  19. package/docs/agents/ci-orchestration-spec.md +140 -0
  20. package/docs/agents/context-assembly-spec.md +219 -0
  21. package/docs/agents/controller-reconciliation-spec.md +255 -0
  22. package/docs/agents/crd-schema-spec.md +315 -0
  23. package/docs/agents/decision-log-open-questions.md +169 -0
  24. package/docs/agents/developer-implementation-checklist.md +329 -0
  25. package/docs/agents/dispatching-design.md +262 -0
  26. package/docs/agents/gaps-agent-mux-to-krate-crds.md +298 -0
  27. package/docs/agents/glossary.md +66 -0
  28. package/docs/agents/implementation-blueprint.md +324 -0
  29. package/docs/agents/implementation-rollout-slices.md +251 -0
  30. package/docs/agents/memory-context-integration-spec.md +194 -0
  31. package/docs/agents/memory-ontology-schema-spec.md +253 -0
  32. package/docs/agents/memory-operations-runbook.md +121 -0
  33. package/docs/agents/mvp-vertical-slice-spec.md +146 -0
  34. package/docs/agents/observability-audit-spec.md +265 -0
  35. package/docs/agents/operator-runbook.md +174 -0
  36. package/docs/agents/org-memory-api-payload-examples.md +333 -0
  37. package/docs/agents/org-memory-controller-sequence-spec.md +181 -0
  38. package/docs/agents/org-memory-e2e-fixture-plan.md +161 -0
  39. package/docs/agents/org-memory-ui-implementation-map.md +114 -0
  40. package/docs/agents/org-memory-vertical-slice-spec.md +168 -0
  41. package/docs/agents/org-resource-model-delta-spec.md +111 -0
  42. package/docs/agents/org-route-resource-model-spec.md +183 -0
  43. package/docs/agents/org-scoping-namespace-spec.md +114 -0
  44. package/docs/agents/rbac-secrets-management-spec.md +406 -0
  45. package/docs/agents/repository-page-integration-spec.md +255 -0
  46. package/docs/agents/resource-contract-examples.md +808 -0
  47. package/docs/agents/resource-relationship-map.md +190 -0
  48. package/docs/agents/security-threat-model.md +188 -0
  49. package/docs/agents/shared-memory-company-brain-spec.md +358 -0
  50. package/docs/agents/storage-migration-spec.md +168 -0
  51. package/docs/agents/subagent-orchestration-spec.md +152 -0
  52. package/docs/agents/system-overview.md +88 -0
  53. package/docs/agents/tools-mcp-skills-spec.md +189 -0
  54. package/docs/agents/traceability-matrix.md +79 -0
  55. package/docs/agents/ui-flow-spec.md +211 -0
  56. package/docs/agents/ui-ux-system-spec.md +426 -0
  57. package/docs/agents/workspace-lifecycle-spec.md +166 -0
  58. package/docs/architecture-spec.md +78 -0
  59. package/docs/components/control-plane.md +78 -0
  60. package/docs/components/data-plane.md +69 -0
  61. package/docs/components/hooks-events.md +67 -0
  62. package/docs/components/identity-rbac-policy.md +73 -0
  63. package/docs/components/kubevela-oam.md +70 -0
  64. package/docs/components/operations-publishing.md +81 -0
  65. package/docs/components/runners-ci.md +66 -0
  66. package/docs/components/web-ui.md +94 -0
  67. package/docs/external/README.md +47 -0
  68. package/docs/external/bidirectional-sync-design.md +134 -0
  69. package/docs/external/cicd-interface.md +64 -0
  70. package/docs/external/external-backend-controllers.md +170 -0
  71. package/docs/external/external-backend-crds.md +234 -0
  72. package/docs/external/external-backend-ui-spec.md +151 -0
  73. package/docs/external/external-backend-ux-flows.md +115 -0
  74. package/docs/external/external-object-mapping.md +125 -0
  75. package/docs/external/git-forge-interface.md +68 -0
  76. package/docs/external/github-integration-design.md +151 -0
  77. package/docs/external/issue-tracking-interface.md +66 -0
  78. package/docs/external/provider-capability-manifests.md +204 -0
  79. package/docs/external/provider-catalog.md +139 -0
  80. package/docs/external/provider-rollout-testing.md +78 -0
  81. package/docs/external/research-results.md +48 -0
  82. package/docs/external/security-auth-permissions.md +81 -0
  83. package/docs/external/sync-state-machines.md +108 -0
  84. package/docs/external/unified-external-backend-model.md +107 -0
  85. package/docs/external/user-facing-changes.md +67 -0
  86. package/docs/gaps.md +161 -0
  87. package/docs/install.md +94 -0
  88. package/docs/krate-design.md +334 -0
  89. package/docs/local-minikube.md +55 -0
  90. package/docs/ontology/README.md +32 -0
  91. package/docs/ontology/bounded-contexts.md +29 -0
  92. package/docs/ontology/events-and-hooks.md +32 -0
  93. package/docs/ontology/oam-kubevela.md +32 -0
  94. package/docs/ontology/operations-and-release.md +25 -0
  95. package/docs/ontology/personas-and-actors.md +32 -0
  96. package/docs/ontology/policies-and-invariants.md +33 -0
  97. package/docs/ontology/problem-space.md +30 -0
  98. package/docs/ontology/resource-contracts.md +40 -0
  99. package/docs/ontology/resource-taxonomy.md +42 -0
  100. package/docs/ontology/runners-and-ci.md +29 -0
  101. package/docs/ontology/solution-space.md +24 -0
  102. package/docs/ontology/storage-and-data-boundaries.md +29 -0
  103. package/docs/ontology/validation-matrix.md +24 -0
  104. package/docs/ontology/web-ui-excellent-flows.md +32 -0
  105. package/docs/ontology/workflows.md +39 -0
  106. package/docs/ontology/world.md +35 -0
  107. package/docs/openapi.yaml +1275 -0
  108. package/docs/product-requirements.md +62 -0
  109. package/docs/roadmap-mvp.md +87 -0
  110. package/docs/system-requirements.md +90 -0
  111. package/docs/tests/README.md +53 -0
  112. package/docs/tests/agent-qa-plan.md +63 -0
  113. package/docs/tests/browser-ui-tests.md +62 -0
  114. package/docs/tests/ci-quality-gates.md +48 -0
  115. package/docs/tests/coverage-model.md +64 -0
  116. package/docs/tests/e2e-scenario-tests.md +53 -0
  117. package/docs/tests/fixtures-test-data.md +63 -0
  118. package/docs/tests/observability-reliability-tests.md +54 -0
  119. package/docs/tests/product-test-matrix.md +145 -0
  120. package/docs/tests/qa-adoption-roadmap.md +130 -0
  121. package/docs/tests/qa-automation-plan.md +101 -0
  122. package/docs/tests/security-compliance-tests.md +57 -0
  123. package/docs/tests/test-framework-tools.md +88 -0
  124. package/docs/tests/test-suite-layout.md +121 -0
  125. package/docs/tests/unit-integration-tests.md +48 -0
  126. package/docs/todo-kyverno +714 -0
  127. package/docs/todos.md +4 -0
  128. package/docs/user-stories.md +78 -0
  129. package/examples/minikube-demo.yaml +190 -0
  130. package/examples/oam-application.yaml +23 -0
  131. package/examples/policy-kyverno-pr-title.yaml +18 -0
  132. package/package.json +63 -0
  133. package/scripts/build.mjs +29 -0
  134. package/scripts/setup-minikube.mjs +65 -0
  135. package/scripts/smoke.mjs +37 -0
  136. package/scripts/validate-doc-coverage.mjs +152 -0
  137. package/scripts/validate-package.mjs +93 -0
  138. package/scripts/validate-ui.mjs +278 -0
  139. package/src/agent-adapter-controller.js +169 -0
  140. package/src/agent-approval-controller.js +170 -0
  141. package/src/agent-context-bundles.js +242 -0
  142. package/src/agent-dispatch-controller.js +209 -0
  143. package/src/agent-gateway-config-controller.js +147 -0
  144. package/src/agent-memory-controller.js +357 -0
  145. package/src/agent-memory-import.js +327 -0
  146. package/src/agent-memory-query.js +292 -0
  147. package/src/agent-memory-repository-source-controller.js +255 -0
  148. package/src/agent-mux-client.js +280 -0
  149. package/src/agent-permission-review.js +250 -0
  150. package/src/agent-project-controller.js +117 -0
  151. package/src/agent-provider-config-controller.js +150 -0
  152. package/src/agent-secret-config-grant-controller.js +282 -0
  153. package/src/agent-session-transcript-controller.js +189 -0
  154. package/src/agent-stack-controller.js +347 -0
  155. package/src/agent-subagent-controller.js +160 -0
  156. package/src/agent-transport-binding-controller.js +121 -0
  157. package/src/agent-trigger-controller.js +381 -0
  158. package/src/agent-workspace-controller.js +702 -0
  159. package/src/agent-writeback-controller.js +302 -0
  160. package/src/api-controller.js +541 -0
  161. package/src/argocd-gitops.js +43 -0
  162. package/src/async-controller.js +207 -0
  163. package/src/audit-controller.js +191 -0
  164. package/src/auth.js +307 -0
  165. package/src/component-catalog.js +41 -0
  166. package/src/control-plane.js +136 -0
  167. package/src/controller-client.js +72 -0
  168. package/src/controller-ui.js +617 -0
  169. package/src/data-plane.js +179 -0
  170. package/src/event-bus.js +61 -0
  171. package/src/external/conflict-controller.js +225 -0
  172. package/src/external/github/auth.js +96 -0
  173. package/src/external/github/cicd.js +180 -0
  174. package/src/external/github/git-forge.js +240 -0
  175. package/src/external/github/index.js +144 -0
  176. package/src/external/github/issue-tracking.js +163 -0
  177. package/src/external/provider-adapter.js +161 -0
  178. package/src/external/provider-resource-factory.js +161 -0
  179. package/src/external/sync-controller.js +235 -0
  180. package/src/external/webhook-controller.js +144 -0
  181. package/src/external/write-controller.js +283 -0
  182. package/src/gitea-backend.js +131 -0
  183. package/src/gitea-service.js +173 -0
  184. package/src/handoff.js +98 -0
  185. package/src/hooks-events.js +63 -0
  186. package/src/http-server.js +377 -0
  187. package/src/identity-policy.js +86 -0
  188. package/src/index.js +57 -0
  189. package/src/kubernetes-controller-async.js +511 -0
  190. package/src/kubernetes-controller.js +878 -0
  191. package/src/kubernetes-resource-gateway.js +48 -0
  192. package/src/notification-controller.js +178 -0
  193. package/src/operations.js +112 -0
  194. package/src/org-scoping.js +5 -0
  195. package/src/resource-model.js +221 -0
  196. package/src/runner-controller.js +272 -0
  197. package/src/runners-ci.js +48 -0
  198. package/src/runtime.js +196 -0
  199. package/src/snapshot-cache.js +157 -0
  200. package/src/web-ui.js +40 -0
  201. package/tests/agent-adapter-controller.test.js +361 -0
  202. package/tests/agent-approval-controller.test.js +173 -0
  203. package/tests/agent-context-bundles.test.js +278 -0
  204. package/tests/agent-dispatch-controller.test.js +315 -0
  205. package/tests/agent-gateway-config-controller.test.js +386 -0
  206. package/tests/agent-memory-controller.test.js +308 -0
  207. package/tests/agent-memory-import-snapshot.test.js +477 -0
  208. package/tests/agent-memory-query.test.js +404 -0
  209. package/tests/agent-memory-repository-source.test.js +514 -0
  210. package/tests/agent-mux-client.test.js +204 -0
  211. package/tests/agent-permission-review-v2.test.js +317 -0
  212. package/tests/agent-permission-review.test.js +209 -0
  213. package/tests/agent-project-controller.test.js +302 -0
  214. package/tests/agent-provider-config-controller.test.js +376 -0
  215. package/tests/agent-resources.test.js +228 -0
  216. package/tests/agent-secret-config-grant.test.js +231 -0
  217. package/tests/agent-session-transcript-controller.test.js +499 -0
  218. package/tests/agent-stack-controller.test.js +221 -0
  219. package/tests/agent-subagent-controller.test.js +201 -0
  220. package/tests/agent-transport-binding-controller.test.js +294 -0
  221. package/tests/agent-trigger-controller.test.js +211 -0
  222. package/tests/agent-trigger-routes.test.js +190 -0
  223. package/tests/agent-trigger-sources.test.js +245 -0
  224. package/tests/agent-workspace-controller.test.js +181 -0
  225. package/tests/agent-writeback.test.js +292 -0
  226. package/tests/approval-persistence.test.js +171 -0
  227. package/tests/async-controller.test.js +252 -0
  228. package/tests/audit-controller.test.js +227 -0
  229. package/tests/codespace-controller.test.js +318 -0
  230. package/tests/deployment.test.js +407 -0
  231. package/tests/e2e/lifecycle.test.js +117 -0
  232. package/tests/event-bus-integration.test.js +190 -0
  233. package/tests/external-github-forge.test.js +560 -0
  234. package/tests/external-github-issues-cicd.test.js +520 -0
  235. package/tests/external-integration.test.js +470 -0
  236. package/tests/external-persistence.test.js +340 -0
  237. package/tests/external-provider-adapter.test.js +365 -0
  238. package/tests/external-resource-model.test.js +215 -0
  239. package/tests/external-webhook-sync.test.js +287 -0
  240. package/tests/external-write-conflict.test.js +353 -0
  241. package/tests/gitea-service.test.js +253 -0
  242. package/tests/health-check-real.test.js +165 -0
  243. package/tests/integration/full-flow.test.js +266 -0
  244. package/tests/krate.test.js +756 -0
  245. package/tests/memory-search-wiring.test.js +270 -0
  246. package/tests/notification-controller.test.js +196 -0
  247. package/tests/notification-integration.test.js +179 -0
  248. package/tests/org-scoping.test.js +687 -0
  249. package/tests/runner-controller.test.js +327 -0
  250. package/tests/runner-integration.test.js +231 -0
  251. package/tests/session-cookie-hmac.test.js +151 -0
  252. package/tests/snapshot-performance.test.js +247 -0
  253. package/tests/sse-events.test.js +107 -0
  254. package/tests/webhook-trigger.test.js +198 -0
  255. package/tests/workspace-volumes.test.js +312 -0
  256. package/tests/writeback-persistence.test.js +207 -0
@@ -0,0 +1,40 @@
1
+ # Resource Contracts
2
+
3
+ All resources use `apiVersion: krate.a5c.ai/v1alpha1`, `kind`, `metadata`, `spec`, and `status`.
4
+
5
+ ## Common metadata
6
+
7
+ - `metadata.name` is required.
8
+ - `metadata.namespace` defaults to `default`.
9
+ - `metadata.labels` and `metadata.annotations` default to empty maps.
10
+ - `metadata.resourceVersion` increments on every stored mutation.
11
+
12
+ ## Lifecycle contract
13
+
14
+ 1. Caller submits a resource mutation.
15
+ 2. Control plane normalizes metadata and validates kind support.
16
+ 3. RBAC checks `user`, verb, kind, and namespace.
17
+ 4. Admission policies evaluate in audit or enforce mode.
18
+ 5. Resource is routed to etcd or Postgres by storage class.
19
+ 6. Audit and watch events are emitted.
20
+ 7. Status is patched by controllers or workflow services.
21
+
22
+ ## Kind-specific contracts
23
+
24
+ - `User`, `Team`, `Invite`, `IdentityMapping`, and `AuthProvider` drive sign-in, admin-managed user mapping, teams, invites, and access configuration.
25
+ - `RepositoryPermission` and `SSHKey` reconcile repository access and key material into the repository backend.
26
+ - `Repository` status includes Gitea backend integration and health.
27
+ - `PullRequest` includes repository, source ref, target ref, title, and phase.
28
+ - `Pipeline` includes repository, ref, steps, trust tier, and resume point.
29
+ - `Job` includes service-account scopes, step name, and isolation metadata.
30
+ - `RunnerPool` includes warm replicas, maximum replicas, and cache policy.
31
+ - `WebhookDelivery` includes request, signature, response, phase, latency, and replay metadata.
32
+ - `RefPolicy` and `BranchProtection` are enforced before protected writes.
33
+ - `View` and `Selector` are label/query definitions used by UI and workflows.
34
+
35
+ ## Validation requirements
36
+
37
+ - Unsupported kinds fail fast.
38
+ - Missing names fail fast.
39
+ - Selectors match labels deterministically.
40
+ - Storage class is inspectable in status.
@@ -0,0 +1,42 @@
1
+ # Resource Taxonomy
2
+
3
+ ## CRD-backed configuration resources
4
+
5
+ These are low-cardinality desired-state contracts and are safe for etcd-backed storage.
6
+
7
+ | Kind | Owner | Purpose |
8
+ | --- | --- | --- |
9
+ | `Organization` | Identity/data plane | Workspace organization, owners, teams, and default repository policy |
10
+ | `User` | Identity | Human account profile, sign-in state, and linked identities |
11
+ | `Team` | Identity | Team membership, maintainers, and repository permission grants |
12
+ | `Invite` | Identity | Pending invitation, role, requested teams, and expiry |
13
+ | `IdentityMapping` | Identity | Mapping between sign-in subjects, Kubernetes identities, and repository accounts |
14
+ | `AuthProvider` | Identity | Installation sign-in provider status and delegated identity settings |
15
+ | `Repository` | Data plane | Repository identity, visibility, Gitea hosting integration, object/search settings |
16
+ | `SSHKey` | Identity/data plane | User, deploy, and automation keys reconciled into repository hosting |
17
+ | `RepositoryPermission` | Identity/data plane | Collaborator and team grants synced to repository hosting |
18
+ | `WebhookSubscription` | Hooks/events | Endpoint, event filters, signing configuration, retry policy |
19
+ | `RefPolicy` | Data plane/hooks | Deny refs, force-push policy, signing and linear-history policy |
20
+ | `BranchProtection` | Data plane/control | PR requirement and protected ref rules |
21
+ | `RunnerPool` | Runners/CI | Runner capacity, scale limits, cache configuration |
22
+ | `View` | Web UI | Saved triage view and presentation contract |
23
+ | `Selector` | Web UI/control | Reusable label/query selector for workflows |
24
+
25
+ ## Aggregated Postgres-backed resources
26
+
27
+ These are high-cardinality runtime records and must not store primary records in etcd.
28
+
29
+ | Kind | Owner | Purpose |
30
+ | --- | --- | --- |
31
+ | `PullRequest` | Control/UI | Review unit, refs, status, checks, merge lifecycle |
32
+ | `Issue` | Control/UI | Work item, labels, assignment, lifecycle |
33
+ | `Review` | Control/UI | Approval/comment/change-request records |
34
+ | `Pipeline` | Runners/CI | Pipeline run state and resume point |
35
+ | `Job` | Runners/CI | Step execution record and service-account scope |
36
+ | `WebhookDelivery` | Hooks/events | Durable delivery attempt, signature, response, replay chain |
37
+
38
+ ## Taxonomy invariants
39
+
40
+ - Config resources can drive reconciliation and must remain small.
41
+ - Aggregated resources can be listed, watched, and label-selected through the API server but store primary state outside etcd.
42
+ - Every kind has metadata, spec, status, storage class, owner context, and executable tests.
@@ -0,0 +1,29 @@
1
+ # Runners and CI
2
+
3
+ ## Runner pools
4
+
5
+ `RunnerPool` records declare warm replicas, maximum replicas, queue scaling, cache settings, and trust boundaries.
6
+
7
+ ## Pipelines
8
+
9
+ `Pipeline` records represent a run for repository/ref work. They include steps, status, trust tier, and optional `resumeFrom` state for rerun/resume.
10
+
11
+ ## Jobs
12
+
13
+ `Job` records represent executable steps. Each job receives a service-account profile derived from the pipeline trust tier.
14
+
15
+ ## Fork isolation
16
+
17
+ - Fork PR pipelines are untrusted.
18
+ - Untrusted jobs have `secrets: false` and `clusterApi: false`.
19
+ - Trusted jobs may use configured scopes, but scopes remain explicit.
20
+
21
+ ## Scaling
22
+
23
+ Queue depth maps to desired replicas within warm and max bounds. Scaling is deterministic and inspectable from pool spec/status.
24
+
25
+ ## Acceptance gates
26
+
27
+ - Starting a fork pipeline produces jobs with no secrets and no cluster API access.
28
+ - Rerun from a named step sets `resumeFrom`.
29
+ - Pool replica planning respects warm and maximum replica limits.
@@ -0,0 +1,24 @@
1
+ # Solution-Space Ontology
2
+
3
+ The MVP is a deterministic Kubernetes-native contract implementation of the Krate architecture. Local tests do not require a live cluster, but the modules, chart, examples, Argo CD Application surface, and Gitea backend integration model the cluster contracts described in `docs/`.
4
+
5
+ ## Architectural shape
6
+
7
+ - `src/resource-model.js` defines resource kinds, storage classes, metadata normalization, selectors, and Kubernetes-list output.
8
+ - `src/control-plane.js` models create/update/status verbs, RBAC, admission, audit, storage boundary routing, and watches.
9
+ - `src/identity-policy.js` maps OIDC identities, groups, trust tiers, service accounts, admission policies, and policy rollout.
10
+ - `src/data-plane.js` and `src/gitea-backend.js` model repository creation, Gitea-backed Git hosting, SSH keys, collaborators/teams, branch protection, ref policy, webhooks, object metadata, and search hooks.
11
+ - `src/runners-ci.js` models runner pools, pipelines, jobs, queue scaling, fork isolation, and rerun/resume.
12
+ - `src/hooks-events.js` models webhook subscriptions, signing, durable deliveries, failure inspection, and replay.
13
+ - `src/web-ui.js` models excellent UI flows as resource-backed view models.
14
+ - `src/operations.js` and `src/argocd-gitops.js` model manifests, Argo CD GitOps Applications, observability, backup/restore, release gates, and the MVP demo.
15
+
16
+ ## MVP boundaries
17
+
18
+ - In scope: Kubernetes resource contracts, Argo CD Application generation, Gitea API-shaped backend integration, deterministic control-plane behavior, workflow models, tests, docs coverage, and smokeable demo output.
19
+ - Out of scope for local validation: requiring a live APIService deployment, live Argo CD controller, live Gitea server, real Postgres, real etcd, real ARC runners, and real browser rendering.
20
+ - Required fidelity: storage classes, Gitea integration calls, Argo CD Application fields, policy decisions, eventing, and operational gates must behave like the docs even when validated through deterministic JavaScript harnesses.
21
+
22
+ ## Quality strategy
23
+
24
+ The solution converges through ontology authoring, module implementation, acceptance tests, doc coverage, smoke output, and final quality review.
@@ -0,0 +1,29 @@
1
+ # Storage and Data Boundaries
2
+
3
+ ## etcd boundary
4
+
5
+ etcd stores CRD-backed configuration: `Repository`, `WebhookSubscription`, `RefPolicy`, `BranchProtection`, `RunnerPool`, `View`, and `Selector`. These are low-cardinality desired-state resources.
6
+
7
+ ## Postgres boundary
8
+
9
+ Postgres stores aggregated records: `PullRequest`, `Issue`, `Review`, `Pipeline`, `Job`, and `WebhookDelivery`. These records can be listed and watched through Kubernetes APIs but their primary storage is not etcd.
10
+
11
+ ## Gitea repository boundary
12
+
13
+ Gitea stores repositories and terminates smart-HTTP/SSH Git traffic. Repository status points to the Gitea backend integration, protected branch state, deploy keys, collaborators/teams, webhooks, and health, while Krate routing remains stateless.
14
+
15
+ ## Object storage boundary
16
+
17
+ Object storage contains large immutable objects such as LFS blobs, archives, and artifacts. Repository specs reference object storage configuration without embedding large data.
18
+
19
+ ## Search boundary
20
+
21
+ Search indexing hooks observe Git and resource events. Search lag must not block Git write success.
22
+
23
+ ## Boundary invariant
24
+
25
+ No workflow should require copying high-cardinality logs, comments, jobs, or webhook attempts into etcd.
26
+
27
+ ## Deterministic runtime snapshot boundary
28
+
29
+ The deterministic harness can export and import a KrateRuntimeSnapshot that preserves the control-plane etcd/postgres resource split, audit log, and events. This is the executable backup/restore boundary for the current package contract; production cluster backup still requires the external Postgres, object storage, Gitea repository storage, and declarative resource backup plan described in the operations docs.
@@ -0,0 +1,24 @@
1
+ # Validation Matrix
2
+
3
+ | Requirement | Ontology | Implementation | Validation |
4
+ | --- | --- | --- | --- |
5
+ | CRD vs aggregated storage | `resource-taxonomy.md`, `storage-and-data-boundaries.md` | `src/resource-model.js`, `src/control-plane.js` | storage tests, `validate-doc-coverage.mjs` |
6
+ | RBAC and admission | `policies-and-invariants.md` | `src/identity-policy.js`, `src/control-plane.js` | RBAC/admission tests |
7
+ | Warm Gitea receive path | `workflows.md`, `storage-and-data-boundaries.md` | `src/data-plane.js` | Gitea backend tests |
8
+ | BranchProtection and RefPolicy | `resource-contracts.md`, `events-and-hooks.md` | `src/data-plane.js` | protected branch/ref tests |
9
+ | Fork CI isolation | `runners-and-ci.md` | `src/runners-ci.js` | runner scheduler tests |
10
+ | Webhook signing/replay | `events-and-hooks.md` | `src/hooks-events.js` | webhook bus tests |
11
+ | UI YAML transparency | `web-ui-excellent-flows.md` | `src/web-ui.js` | smoke assertions |
12
+ | Backup/restore/release gates | `operations-and-release.md` | `src/operations.js`, `scripts/build.mjs`, `scripts/smoke.mjs` | `npm run check` with docs and ontology coverage |
13
+
14
+ ## Local validation commands
15
+
16
+ - `npm run build`
17
+ - `npm run validate:docs`
18
+ - `npm test`
19
+ - `npm run smoke`
20
+ - `npm run check`
21
+
22
+ ## Green definition
23
+
24
+ The project is green only when all ontology files exist, coverage terms are found in docs and source, tests pass, smoke assertions pass, and the Babysitter run returns a successful completion proof.
@@ -0,0 +1,32 @@
1
+ # Web UI Excellent Flows
2
+
3
+ The UI ontology is a set of resource-backed view models rather than a hidden application state machine.
4
+
5
+ ## Required flows
6
+
7
+ - Create and inspect a repository.
8
+ - Open and review a pull request.
9
+ - Inspect failed checks and rerun/resume CI.
10
+ - Edit runner pool capacity and cache policy.
11
+ - Inspect and replay webhook deliveries.
12
+ - Open YAML/resource views for UI actions.
13
+
14
+ ## View model invariants
15
+
16
+ - Dashboard cards summarize repositories, PRs, pipelines, runner pools, and webhook deliveries.
17
+ - PR review surfaces changed files, pipeline checks, comments, and YAML.
18
+ - Runner pool editor exposes scaling limits and resource YAML.
19
+ - Webhook inspector exposes request, response, phase, signature, and replay action.
20
+ - Every view includes enough resource identity for kubectl-style workflows.
21
+
22
+ ## Traceability
23
+
24
+ `View` and `Selector` resources support saved triage and cross-repository work. UI filters should map to selector labels or query metadata.
25
+
26
+ ## Current executable UI contract
27
+
28
+ - Breadcrumbs orient each organization and repository route.
29
+ - `ForgeFlowRail` makes the default Git forge flow explicit: create, clone, branch, open PR, merge, deploy, and notify.
30
+ - `RepositoryCommandBar` keeps clone, branch, watch, RBAC, PR-flow, and YAML actions visible across repository tabs.
31
+ - Degraded-state banners render on every route that depends on the controller model, not only on the dashboard.
32
+ - Architecture boundaries include the API controller, Kubernetes resource gateway, Kubernetes client, Kubernetes reconciler, and Git data plane.
@@ -0,0 +1,39 @@
1
+ # Workflows
2
+
3
+ ## Repository creation
4
+
5
+ 1. Repository admin creates a `Repository` resource.
6
+ 2. Control plane authorizes and stores it in etcd.
7
+ 3. Data plane provisions a Gitea repository integration and initializes repository storage.
8
+ 4. Status exposes Gitea backend integration and health.
9
+
10
+ ## Pull request review
11
+
12
+ 1. Developer creates a `PullRequest` with source/target refs and title.
13
+ 2. Admission validates required fields and policy.
14
+ 3. CI starts a `Pipeline` and one or more `Job` records.
15
+ 4. UI shows checks, changed files, comments, and YAML/resource equivalent.
16
+ 5. Branch protection requires PR flow for protected refs.
17
+
18
+ ## Git receive-pack
19
+
20
+ 1. Gitea backend resolves repository routing.
21
+ 2. `RefPolicy` denies forbidden refs or unsafe writes.
22
+ 3. `BranchProtection` blocks direct protected writes unless actor has repo-admin permission.
23
+ 4. Write event is emitted and optional search indexing hook is queued.
24
+
25
+ ## Webhook delivery and replay
26
+
27
+ 1. Repository admin creates a `WebhookSubscription`.
28
+ 2. Event dispatch signs payload and stores a `WebhookDelivery` record.
29
+ 3. Failure status remains inspectable with request/response metadata.
30
+ 4. Replay creates a new delivery using the current secret and links replay metadata.
31
+
32
+ ## Backup and restore
33
+
34
+ 1. Export CRDs and low-cardinality config.
35
+ 2. Backup Postgres aggregated records.
36
+ 3. Snapshot Gitea repository integration state.
37
+ 4. Preserve object storage.
38
+ 5. Restore API/config, Postgres, repositories, objects, then controllers.
39
+ 6. Validate by listing resources, reading refs, opening a PR, and replaying a webhook.
@@ -0,0 +1,35 @@
1
+ # World Ontology
2
+
3
+ Krate is a Kubernetes-native forge: repositories, review, CI, policy, hooks, and operations are expressed through Kubernetes-style resources rather than a separate opaque application model.
4
+
5
+ ## Domain entities
6
+
7
+ - **Kubernetes API server** is the interaction contract for discovery, verbs, watches, RBAC, admission, and status.
8
+ - **etcd** stores low-cardinality configuration resources such as `Repository`, `WebhookSubscription`, `RefPolicy`, `BranchProtection`, `RunnerPool`, `View`, and `Selector`.
9
+ - **Postgres** stores high-cardinality aggregated records such as `PullRequest`, `Issue`, `Review`, `Pipeline`, `Job`, and `WebhookDelivery`.
10
+ - **Gitea backend** stores repositories and keeps the write path warm for `receive-pack`.
11
+ - **Object storage** stores LFS objects, archives, and large immutable artifacts.
12
+ - **Search index** receives repository indexing hooks without blocking Git writes.
13
+
14
+ ## Human actors
15
+
16
+ - **Developer** opens pull requests, comments, reviews, runs pipelines, and investigates failures.
17
+ - **Repository admin** creates repositories, branch protection, ref policies, webhook subscriptions, and triage views.
18
+ - **Platform engineer** installs Krate, manages runner pools, admission rollout, observability, backup, and release gates.
19
+ - **Team lead** uses views and selectors to triage cross-repository work.
20
+
21
+ ## Machine actors
22
+
23
+ - **Controllers** reconcile resource state and patch status.
24
+ - **Runner jobs** execute pipeline steps with scoped service-account identity.
25
+ - **Admission policies** validate mutations in audit or enforce mode.
26
+ - **Webhook dispatchers** sign, deliver, retry, and replay outbound events.
27
+ - **Git clients** use smart HTTP/SSH routes resolved by the Gitea backend integration.
28
+
29
+ ## Non-negotiable assumptions
30
+
31
+ - Kubernetes RBAC remains authoritative for user and machine actions.
32
+ - UI state must be explainable as resources, YAML, events, and status.
33
+ - High-cardinality activity must not overload etcd.
34
+ - Untrusted fork work must not access secrets or the cluster API.
35
+ - Operations must be installable, observable, backupable, restorable, and release-gated.