@a5c-ai/krate 5.0.1-staging.660d2b90f → 5.0.1-staging.69cb593ea
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.
- package/Dockerfile +31 -29
- package/bin/krate-demo.mjs +0 -0
- package/bin/krate-server.mjs +0 -0
- package/dist/krate-controller-ui.json +808 -10
- package/dist/krate-lifecycle.json +1 -1
- package/dist/krate-runtime-snapshot.json +223 -53
- package/dist/krate-summary.json +40 -3
- package/docs/agents/gaps-agent-mux-to-krate-crds.md +298 -0
- package/docs/architecture-v2.md +431 -0
- package/docs/openapi.yaml +1275 -0
- package/docs/requirements-v2.md +238 -0
- package/docs/sdk-api-reference.md +782 -0
- package/docs/system-spec-v2.md +352 -0
- package/docs/todos.md +4 -0
- package/docs/web-console-spec.md +433 -0
- package/package.json +1 -1
- package/scripts/validate-ui.mjs +305 -207
- package/src/agent-adapter-controller.js +169 -0
- package/src/agent-approval-controller.js +47 -0
- package/src/agent-dispatch-controller.js +130 -7
- package/src/agent-gateway-config-controller.js +147 -0
- package/src/agent-memory-controller.js +357 -0
- package/src/agent-memory-import.js +327 -0
- package/src/agent-memory-query.js +292 -0
- package/src/agent-memory-repository-source-controller.js +255 -0
- package/src/agent-mux-client.js +1 -1
- package/src/agent-permission-review.js +102 -14
- package/src/agent-project-controller.js +117 -0
- package/src/agent-provider-config-controller.js +150 -0
- package/src/agent-secret-config-grant-controller.js +282 -0
- package/src/agent-session-transcript-controller.js +189 -0
- package/src/agent-stack-controller.js +52 -1
- package/src/agent-subagent-controller.js +160 -0
- package/src/agent-transport-binding-controller.js +121 -0
- package/src/agent-trigger-controller.js +273 -0
- package/src/agent-workspace-controller.js +702 -0
- package/src/agent-writeback-controller.js +302 -0
- package/src/api-controller.js +338 -3
- package/src/async-controller.js +207 -0
- package/src/audit-controller.js +191 -0
- package/src/auth.js +48 -6
- package/src/controller-client.js +112 -38
- package/src/controller-ui.js +96 -16
- package/src/data-plane.js +3 -2
- package/src/event-bus.js +61 -0
- package/src/external/conflict-controller.js +225 -0
- package/src/external/github/auth.js +96 -0
- package/src/external/github/cicd.js +180 -0
- package/src/external/github/git-forge.js +240 -0
- package/src/external/github/index.js +144 -0
- package/src/external/github/issue-tracking.js +163 -0
- package/src/external/provider-adapter.js +161 -0
- package/src/external/provider-resource-factory.js +161 -0
- package/src/external/sync-controller.js +235 -0
- package/src/external/webhook-controller.js +144 -0
- package/src/external/write-controller.js +283 -0
- package/src/gitea-backend.js +36 -0
- package/src/gitea-service.js +173 -0
- package/src/http-server.js +226 -0
- package/src/index.js +27 -0
- package/src/kubernetes-controller-async.js +531 -0
- package/src/kubernetes-controller.js +156 -84
- package/src/notification-controller.js +178 -0
- package/src/org-scoping.js +5 -0
- package/src/resource-model.js +26 -8
- package/src/runner-controller.js +272 -0
- package/src/snapshot-cache.js +157 -0
- package/tests/agent-adapter-controller.test.js +361 -0
- package/tests/agent-dispatch-controller.test.js +139 -0
- package/tests/agent-gateway-config-controller.test.js +386 -0
- package/tests/agent-memory-controller.test.js +308 -0
- package/tests/agent-memory-import-snapshot.test.js +477 -0
- package/tests/agent-memory-query.test.js +404 -0
- package/tests/agent-memory-repository-source.test.js +514 -0
- package/tests/agent-permission-review-v2.test.js +317 -0
- package/tests/agent-project-controller.test.js +302 -0
- package/tests/agent-provider-config-controller.test.js +376 -0
- package/tests/agent-resources.test.js +35 -19
- package/tests/agent-secret-config-grant.test.js +231 -0
- package/tests/agent-session-transcript-controller.test.js +499 -0
- package/tests/agent-subagent-controller.test.js +201 -0
- package/tests/agent-transport-binding-controller.test.js +294 -0
- package/tests/agent-trigger-routes.test.js +190 -0
- package/tests/agent-trigger-sources.test.js +245 -0
- package/tests/agent-workspace-controller.test.js +181 -0
- package/tests/agent-writeback.test.js +292 -0
- package/tests/approval-persistence.test.js +171 -0
- package/tests/async-controller.test.js +252 -0
- package/tests/audit-controller.test.js +227 -0
- package/tests/codespace-controller.test.js +318 -0
- package/tests/controller-client.test.js +133 -0
- package/tests/deployment.test.js +43 -29
- package/tests/e2e/lifecycle.test.js +5 -2
- package/tests/event-bus-integration.test.js +190 -0
- package/tests/external-github-forge.test.js +560 -0
- package/tests/external-github-issues-cicd.test.js +520 -0
- package/tests/external-integration.test.js +470 -0
- package/tests/external-persistence.test.js +340 -0
- package/tests/external-provider-adapter.test.js +365 -0
- package/tests/external-resource-model.test.js +215 -0
- package/tests/external-webhook-sync.test.js +287 -0
- package/tests/external-write-conflict.test.js +353 -0
- package/tests/gitea-service.test.js +253 -0
- package/tests/health-check-real.test.js +165 -0
- package/tests/integration/full-flow.test.js +266 -0
- package/tests/krate.test.js +58 -6
- package/tests/memory-search-wiring.test.js +270 -0
- package/tests/notification-controller.test.js +196 -0
- package/tests/notification-integration.test.js +179 -0
- package/tests/org-scoping.test.js +687 -0
- package/tests/runner-controller.test.js +327 -0
- package/tests/runner-integration.test.js +231 -0
- package/tests/session-cookie-hmac.test.js +151 -0
- package/tests/snapshot-performance.test.js +315 -0
- package/tests/sse-events.test.js +107 -0
- package/tests/webhook-trigger.test.js +198 -0
- package/tests/workspace-volumes.test.js +312 -0
- package/tests/writeback-persistence.test.js +207 -0
package/scripts/validate-ui.mjs
CHANGED
|
@@ -1,207 +1,305 @@
|
|
|
1
|
-
import { readFileSync } from 'node:fs';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
'apps/web/app/
|
|
7
|
-
'apps/web/app/
|
|
8
|
-
'apps/web/
|
|
9
|
-
'apps/web/app/
|
|
10
|
-
'apps/web/app/
|
|
11
|
-
'apps/web/app/
|
|
12
|
-
'apps/web/app/
|
|
13
|
-
'apps/web/app/
|
|
14
|
-
'apps/web/app/
|
|
15
|
-
'apps/web/app/
|
|
16
|
-
'apps/web/app/
|
|
17
|
-
'apps/web/
|
|
18
|
-
'apps/web/app/
|
|
19
|
-
'apps/web/app/
|
|
20
|
-
'apps/web/app/
|
|
21
|
-
'apps/web/app/
|
|
22
|
-
'apps/web/app/
|
|
23
|
-
'apps/web/app/
|
|
24
|
-
'apps/web/app/
|
|
25
|
-
'
|
|
26
|
-
'
|
|
27
|
-
'
|
|
28
|
-
'
|
|
29
|
-
'
|
|
30
|
-
'
|
|
31
|
-
]
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
if (
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
for (const
|
|
73
|
-
if (!
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
'apps/web/app/
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
'apps/web/
|
|
106
|
-
}
|
|
107
|
-
for (const
|
|
108
|
-
files[
|
|
109
|
-
}
|
|
110
|
-
for (const [
|
|
111
|
-
if (!files[
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
if (
|
|
166
|
-
|
|
167
|
-
if (!
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
if (!
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
1
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { createControllerUiModel } from '../src/index.js';
|
|
4
|
+
|
|
5
|
+
const required = [
|
|
6
|
+
'apps/web/app/layout.jsx',
|
|
7
|
+
'apps/web/app/globals.css',
|
|
8
|
+
'apps/web/app/page.jsx',
|
|
9
|
+
'apps/web/app/ui-shell.jsx',
|
|
10
|
+
'apps/web/app/lib/krate-ui.jsx',
|
|
11
|
+
'apps/web/app/lib/page-frame.jsx',
|
|
12
|
+
'apps/web/app/pages/repo-pages.jsx',
|
|
13
|
+
'apps/web/app/pages/manage-pages.jsx',
|
|
14
|
+
'apps/web/app/pages/agent-pages.jsx',
|
|
15
|
+
'apps/web/app/pages/settings-pages.jsx',
|
|
16
|
+
'apps/web/app/pages/external-pages.jsx',
|
|
17
|
+
'apps/web/proxy.js',
|
|
18
|
+
'apps/web/app/components/app-settings.jsx',
|
|
19
|
+
'apps/web/app/components/code-editor.jsx',
|
|
20
|
+
'apps/web/app/components/resource-actions.jsx',
|
|
21
|
+
'apps/web/app/components/issue-editor.jsx',
|
|
22
|
+
'apps/web/app/components/repo-code-browser.jsx',
|
|
23
|
+
'apps/web/app/components/repo-runs.jsx',
|
|
24
|
+
'apps/web/app/components/krate-loading.jsx',
|
|
25
|
+
'apps/web/app/components/theme-runtime.jsx',
|
|
26
|
+
'apps/web/app/loading.jsx',
|
|
27
|
+
'apps/web/app/api/controller/route.js',
|
|
28
|
+
'apps/web/app/api/orgs/[org]/resources/route.js',
|
|
29
|
+
'apps/web/app/api/orgs/[org]/resources/[kind]/[name]/route.js',
|
|
30
|
+
'apps/web/app/api/orgs/[org]/repositories/route.js',
|
|
31
|
+
'apps/web/app/api/orgs/[org]/repositories/[name]/route.js',
|
|
32
|
+
'apps/web/app/api/orgs/[org]/pipelines/[name]/logs/route.js',
|
|
33
|
+
'apps/web/app/api/orgs/[org]/policies/route.js',
|
|
34
|
+
'apps/web/app/api/orgs/[org]/policy-reports/route.js',
|
|
35
|
+
'apps/web/app/api/orgs/[org]/policy-exception-requests/route.js',
|
|
36
|
+
'apps/web/app/api/watch/[[...resource]]/route.js',
|
|
37
|
+
'apps/web/app/api/git-proxy/route.js',
|
|
38
|
+
'apps/web/app/api/auth/[provider]/route.js',
|
|
39
|
+
'apps/web/app/api/auth/callback/[provider]/route.js',
|
|
40
|
+
'apps/web/app/api/auth/logout/route.js',
|
|
41
|
+
'apps/web/app/api/auth/delegated/route.js',
|
|
42
|
+
'apps/web/app/api/orgs/[org]/agents/events/stream/route.js',
|
|
43
|
+
'src/api-controller.js',
|
|
44
|
+
'src/kubernetes-resource-gateway.js',
|
|
45
|
+
'src/kubernetes-controller.js',
|
|
46
|
+
'src/controller-client.js',
|
|
47
|
+
'src/controller-ui.js',
|
|
48
|
+
'src/http-server.js',
|
|
49
|
+
'src/gitea-backend.js',
|
|
50
|
+
'../sdk/src/index.js',
|
|
51
|
+
'../charts/crds/agent-resources.yaml',
|
|
52
|
+
'../charts/crds/aggregated-resources.yaml'
|
|
53
|
+
];
|
|
54
|
+
function resolveRequiredFile(file) {
|
|
55
|
+
if (existsSync(file)) return file;
|
|
56
|
+
if (file.startsWith('apps/web/')) {
|
|
57
|
+
const packageRelative = path.join('..', 'web', file.slice('apps/web/'.length));
|
|
58
|
+
if (existsSync(packageRelative)) return packageRelative;
|
|
59
|
+
}
|
|
60
|
+
return file;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const files = Object.fromEntries(required.map((file) => [file, readFileSync(resolveRequiredFile(file), 'utf8')]));
|
|
64
|
+
function webUiSource() {
|
|
65
|
+
return Object.entries(files)
|
|
66
|
+
.filter(([file]) => file.startsWith('apps/web/app/'))
|
|
67
|
+
.map(([, source]) => source)
|
|
68
|
+
.join('\n');
|
|
69
|
+
}
|
|
70
|
+
const failures = [];
|
|
71
|
+
|
|
72
|
+
for (const [file, source] of Object.entries(files)) {
|
|
73
|
+
if (!source.trim()) failures.push(`${file} is empty`);
|
|
74
|
+
}
|
|
75
|
+
if (!/\.appBody\s*\{[\s\S]*?width:\s*100%;[\s\S]*?max-width:\s*none;/.test(files['apps/web/app/globals.css'])) {
|
|
76
|
+
failures.push('app shell body must use the full viewport width');
|
|
77
|
+
}
|
|
78
|
+
if (/\.appBody\s*\{[^}]*width:\s*min\(100%,\s*\d+px\)/.test(files['apps/web/app/globals.css'])) {
|
|
79
|
+
failures.push('app shell body is capped to a centered max width');
|
|
80
|
+
}
|
|
81
|
+
if (!/\.appTopbar,\s*\.appBody,\s*\.appContent,\s*\.routeMain\s*\{[\s\S]*?width:\s*100%;[\s\S]*?max-width:\s*none;[\s\S]*?margin-left:\s*0;[\s\S]*?margin-right:\s*0;/.test(files['apps/web/app/globals.css'])) {
|
|
82
|
+
failures.push('authenticated app shell must override centered layout caps at the final cascade layer');
|
|
83
|
+
}
|
|
84
|
+
if (!/\.loginMain\s*\{[\s\S]*?width:\s*100%;[\s\S]*?max-width:\s*none;[\s\S]*?margin:\s*0;/.test(files['apps/web/app/globals.css'])) {
|
|
85
|
+
failures.push('login shell must use the full viewport width');
|
|
86
|
+
}
|
|
87
|
+
if (/\.loginMain\s*\{[^}]*width:\s*min\([^;]*720px\)/.test(files['apps/web/app/globals.css'])) {
|
|
88
|
+
failures.push('login shell is capped to a centered card width');
|
|
89
|
+
}
|
|
90
|
+
if (!/\.loginCard\s*\{[\s\S]*?width:\s*min\(100%,\s*720px\)/.test(files['apps/web/app/globals.css'])) {
|
|
91
|
+
failures.push('login card must own the readable sign-in width cap');
|
|
92
|
+
}
|
|
93
|
+
for (const file of ['apps/web/app/api/controller/route.js', 'apps/web/app/api/watch/[[...resource]]/route.js', 'src/controller-client.js']) {
|
|
94
|
+
if (files[file].includes('createKrateUiDemoRuntime')) failures.push(`${file} imports or calls createKrateUiDemoRuntime`);
|
|
95
|
+
if (files[file].includes('createKrateRuntime()')) failures.push(`${file} creates an in-memory runtime fallback`);
|
|
96
|
+
}
|
|
97
|
+
for (const file of ['apps/web/app/page.jsx', 'apps/web/app/ui-shell.jsx']) {
|
|
98
|
+
if (files[file].includes('krate-demo')) failures.push(`${file} hardcodes krate-demo demo navigation`);
|
|
99
|
+
}
|
|
100
|
+
for (const [file, source] of Object.entries(files)) {
|
|
101
|
+
if (source.includes('sampleResource') || source.includes('exampleResource')) failures.push(`${file} synthesizes sample/example Krate resources`);
|
|
102
|
+
if (source.includes('new-repository') && file !== 'apps/web/app/components/resource-actions.jsx') failures.push(`${file} hardcodes synthetic Repository data`);
|
|
103
|
+
}
|
|
104
|
+
for (const token of ['export function proxy', 'NextResponse.redirect', 'KRATE_AUTH_COOKIE_NAME', 'krate_session', '/login', '/api/auth', 'matcher']) {
|
|
105
|
+
if (!files['apps/web/proxy.js'].includes(token)) failures.push(`web proxy missing ${token}`);
|
|
106
|
+
}
|
|
107
|
+
for (const token of ['spawnSync', 'spawn(', 'kubectl', 'getControllerSnapshot', 'listResource', 'getResource', 'applyResource', 'deleteResource', 'createRepository', 'watchResource', 'auth', 'can-i']) {
|
|
108
|
+
if (!files['src/kubernetes-controller.js'].includes(token)) failures.push(`kubernetes controller missing ${token}`);
|
|
109
|
+
}
|
|
110
|
+
for (const token of ['getControllerSnapshotAsync', 'fallbackSnapshot', 'controller.snapshot()', 'createControllerUiModel']) {
|
|
111
|
+
if (!files['src/controller-client.js'].includes(token)) failures.push(`controller client missing ${token}`);
|
|
112
|
+
}
|
|
113
|
+
for (const token of ['createKrateApiController', 'resourceGateway', 'withArchitecture', 'krate-api-controller', 'kubernetes-resource-gateway', 'kubernetes-resource-client', 'git-data-plane', 'never owns Kubernetes reconciliation loops', 'KRATE_API_CONTROLLER_BOUNDARY', 'listRepositoriesForForge', 'getRepositoryForgeView', 'krate-kubernetes-reconciler']) {
|
|
114
|
+
if (!files['src/api-controller.js'].includes(token)) failures.push(`api controller boundary missing ${token}`);
|
|
115
|
+
}
|
|
116
|
+
for (const token of ['createKubernetesResourceClient', 'repositoryManifest', 'async list', 'async get', 'async apply', 'async delete', 'watch(resourcePath', 'KUBERNETES_RESOURCE_GATEWAY_BOUNDARY', 'mustNotOwn']) {
|
|
117
|
+
if (!files['src/kubernetes-resource-gateway.js'].includes(token)) failures.push(`kubernetes resource gateway missing ${token}`);
|
|
118
|
+
}
|
|
119
|
+
for (const token of ['GET', 'POST', 'DELETE', 'controller.listResource', 'controller.getResource', 'controller.applyResource', 'controller.deleteResource', 'controller.createRepository']) {
|
|
120
|
+
const joinedRoutes = files['apps/web/app/api/orgs/[org]/resources/route.js'] + files['apps/web/app/api/orgs/[org]/resources/[kind]/[name]/route.js'] + files['apps/web/app/api/orgs/[org]/repositories/route.js'] + files['apps/web/app/api/orgs/[org]/repositories/[name]/route.js'];
|
|
121
|
+
if (!joinedRoutes.includes(token)) failures.push(`resource management routes missing ${token}`);
|
|
122
|
+
}
|
|
123
|
+
const policyRoutes = files['apps/web/app/api/orgs/[org]/policies/route.js'] + files['apps/web/app/api/orgs/[org]/policy-reports/route.js'] + files['apps/web/app/api/orgs/[org]/policy-exception-requests/route.js'];
|
|
124
|
+
for (const token of ['GET', 'POST', 'createKrateApiController', 'createControllerUiModel', 'policyEngine', 'controller.applyResource', 'PolicyBinding', 'PolicyExceptionRequest']) {
|
|
125
|
+
if (!policyRoutes.includes(token)) failures.push(`policy management routes missing ${token}`);
|
|
126
|
+
}
|
|
127
|
+
for (const token of ['--watch', 'text/event-stream', 'controller.watchResource', 'krate-error', 'request.signal']) {
|
|
128
|
+
if (!files['apps/web/app/api/watch/[[...resource]]/route.js'].includes(token)) failures.push(`watch route missing ${token}`);
|
|
129
|
+
}
|
|
130
|
+
for (const token of ['RepositoryManager', 'DeploymentManager', 'ResourceApplyPanel', '/api/orgs/${org}/repositories', '/api/orgs/${org}/resources', 'fetch(', 'Save changes', 'InviteReviewList', 'UserReviewList', 'PermissionReviewList', 'Mark accepted', 'Revoke invite', 'Disable user', 'Restore user', 'Revoke grant', 'SshKeyReviewList', 'Save SSH key', 'Revoke SSH key', 'Create deployment', 'Prepare deployment']) {
|
|
131
|
+
if (!(files['apps/web/app/components/resource-actions.jsx'] + webUiSource()).includes(token)) failures.push(`UI management surface missing ${token}`);
|
|
132
|
+
}
|
|
133
|
+
for (const token of ['DegradedBanner', 'No repositories are available yet.', 'No resource selected yet.', 'Access checks', 'Krate repositories']) {
|
|
134
|
+
if (!(webUiSource() + files['apps/web/app/components/resource-actions.jsx']).includes(token)) failures.push(`truthful degraded/empty UI missing ${token}`);
|
|
135
|
+
}
|
|
136
|
+
for (const token of ['KrateControllerRecovery', 'KrateLoadingView', 'KRATE_LOADING_MESSAGES', '/api/controller', 'setRecovered(true)', 'router.refresh()', 'sessionStorage']) {
|
|
137
|
+
if (!(webUiSource() + files['apps/web/app/components/krate-loading.jsx']).includes(token)) failures.push(`recovery loading UI missing ${token}`);
|
|
138
|
+
}
|
|
139
|
+
for (const token of ['KrateRouteLoadingOverlay', 'krate-route-loading-refresh']) {
|
|
140
|
+
if ((webUiSource() + files['apps/web/app/components/krate-loading.jsx']).includes(token)) failures.push(`route transitions must not render recovery loading UI token ${token}`);
|
|
141
|
+
}
|
|
142
|
+
if (!files['apps/web/app/loading.jsx'].includes('routeLoading') || !files['apps/web/app/loading.jsx'].includes('krateLoadingBar animated')) failures.push('route loading UI must render immediate non-overlay loading feedback');
|
|
143
|
+
if (files['apps/web/app/loading.jsx'].includes('KrateDelayedRouteLoading') || files['apps/web/app/loading.jsx'].includes('return null')) failures.push('route loading UI must not delay or render a blank fallback');
|
|
144
|
+
if (!files['apps/web/app/globals.css'].includes('krateRouteLoadingProgress') || !files['apps/web/app/globals.css'].includes('krateRouteLoadingPhase')) failures.push('route loading UI must animate progress and phase text without client hydration');
|
|
145
|
+
if (!files['apps/web/app/lib/krate-ui.jsx'].includes('useCache: true') || files['apps/web/app/lib/krate-ui.jsx'].includes('useCache: false')) failures.push('Krate page loader must use cached controller snapshots');
|
|
146
|
+
for (const token of ['KrateProject', 'Issue', 'syncHydratedModel', 'model.agents']) {
|
|
147
|
+
if (!files['apps/web/app/lib/krate-ui.jsx'].includes(token)) failures.push(`Krate page model hydration missing ${token}`);
|
|
148
|
+
if (!files['apps/web/app/api/controller/route.js'].includes(token === 'syncHydratedModel' ? 'KrateProject' : token)) failures.push(`controller API hydration missing ${token}`);
|
|
149
|
+
}
|
|
150
|
+
for (const token of ['ThemeRuntime', 'themeInitScript', 'krate-theme', 'suppressHydrationWarning']) {
|
|
151
|
+
if (!files['apps/web/app/layout.jsx'].includes(token)) failures.push(`root layout missing persistent theme token ${token}`);
|
|
152
|
+
}
|
|
153
|
+
for (const token of ['THEME_STORAGE_KEY', 'krate-theme', 'applyTheme', 'storeTheme', "window.addEventListener('storage'", 'prefers-color-scheme: dark']) {
|
|
154
|
+
if (!files['apps/web/app/components/theme-runtime.jsx'].includes(token)) failures.push(`theme runtime missing ${token}`);
|
|
155
|
+
}
|
|
156
|
+
for (const token of ['[style*="#374151"]', '[style*="#fafafa"]', 'outline: 3px solid #79c0ff', '::placeholder', 'background: #4d1512', '.pill.good { color: #7ee787', 'background: #ffb4ab', '[data-theme="dark"] h4', '.repoCommandBar > a', 'routeMain:has(.repoHeader) .repoCommandBar > a']) {
|
|
157
|
+
if (!files['apps/web/app/globals.css'].includes(token)) failures.push(`dark mode accessibility override missing ${token}`);
|
|
158
|
+
}
|
|
159
|
+
if (!files['apps/web/app/components/app-settings.jsx'].includes('storeTheme(newTheme)') || files['apps/web/app/components/app-settings.jsx'].includes("localStorage.setItem('krate-theme'")) failures.push('settings theme changes must go through the shared theme runtime');
|
|
160
|
+
if ((webUiSource() + files['apps/web/app/components/krate-loading.jsx']).includes('Krate workspace degraded or empty')) failures.push('degraded workspace copy should be replaced by recovery loading UI');
|
|
161
|
+
if ((webUiSource() + files['apps/web/app/components/krate-loading.jsx']).includes('window.location.reload')) failures.push('recovery loading UI must not reload the page');
|
|
162
|
+
for (const token of ['text/event-stream', 'globalEventBus', 'KRATE_CONTROLLER_URL', "type: 'connected'"]) {
|
|
163
|
+
if (!files['apps/web/app/api/orgs/[org]/agents/events/stream/route.js'].includes(token)) failures.push(`events stream route missing ${token}`);
|
|
164
|
+
}
|
|
165
|
+
if (!/\.krateRecoveryOverlay\s*\{[\s\S]*?position:\s*fixed;[\s\S]*?inset:\s*0;/.test(files['apps/web/app/globals.css'])) failures.push('recovery loading UI must be fixed overlay');
|
|
166
|
+
for (const token of ['duplex', 'KRATE_GITEA_HTTP_URL', 'fetch(target', 'degraded']) {
|
|
167
|
+
if (!files['apps/web/app/api/git-proxy/route.js'].includes(token)) failures.push(`git proxy route missing ${token}`);
|
|
168
|
+
}
|
|
169
|
+
for (const token of ['orgResourceCollectionMatch', 'orgRepositoryCollectionMatch', 'orgNamespaceName', 'createKubernetesResourceGateway', 'scopedController.listResource', 'scopedController.getResource', 'scopedController.applyResource', 'scopedController.deleteResource']) {
|
|
170
|
+
if (!files['src/http-server.js'].includes(token)) failures.push(`http controller missing ${token}`);
|
|
171
|
+
}
|
|
172
|
+
const pageContracts = {
|
|
173
|
+
'apps/web/app/orgs/[org]/controller-api/page.jsx': 'ControllerApiPage',
|
|
174
|
+
'apps/web/app/orgs/[org]/repositories/page.jsx': 'RepositoriesPage',
|
|
175
|
+
'apps/web/app/orgs/[org]/inbox/page.jsx': 'InboxPage',
|
|
176
|
+
'apps/web/app/orgs/[org]/runs/page.jsx': 'RunsPage',
|
|
177
|
+
'apps/web/app/orgs/[org]/runners-ci/page.jsx': 'RunnersCiPage',
|
|
178
|
+
'apps/web/app/orgs/[org]/hooks-events/page.jsx': 'HooksEventsPage',
|
|
179
|
+
'apps/web/app/orgs/[org]/insights/page.jsx': 'InsightsPage',
|
|
180
|
+
'apps/web/app/orgs/[org]/operations-install/page.jsx': 'OperationsInstallPage',
|
|
181
|
+
'apps/web/app/orgs/[org]/advanced-plans/page.jsx': 'AdvancedPlansPage',
|
|
182
|
+
'apps/web/app/orgs/[org]/people/page.jsx': 'PeoplePage',
|
|
183
|
+
'apps/web/app/login/page.jsx': 'LoginPage',
|
|
184
|
+
'apps/web/app/logout/page.jsx': 'LogoutPage',
|
|
185
|
+
'apps/web/app/orgs/[org]/repositories/[repo]/code/page.jsx': 'RepositoryCodePage',
|
|
186
|
+
'apps/web/app/orgs/[org]/repositories/[repo]/pull-requests/page.jsx': 'RepositoryPullRequestsPage',
|
|
187
|
+
'apps/web/app/orgs/[org]/repositories/[repo]/issues/page.jsx': 'RepositoryIssuesPage',
|
|
188
|
+
'apps/web/app/orgs/[org]/repositories/[repo]/issues/[issue]/page.jsx': 'RepositoryIssueDetailPage',
|
|
189
|
+
'apps/web/app/orgs/[org]/agents/projects/[projectId]/issues/page.jsx': 'ProjectIssuesPage',
|
|
190
|
+
'apps/web/app/orgs/[org]/agents/projects/[projectId]/issues/[issue]/page.jsx': 'ProjectIssueDetailPage',
|
|
191
|
+
'apps/web/app/orgs/[org]/repositories/[repo]/runs/page.jsx': 'RepositoryRunsPage',
|
|
192
|
+
'apps/web/app/orgs/[org]/repositories/[repo]/hooks/page.jsx': 'RepositoryHooksPage',
|
|
193
|
+
'apps/web/app/orgs/[org]/repositories/[repo]/settings/page.jsx': 'RepositorySettingsPage'
|
|
194
|
+
};
|
|
195
|
+
for (const file of Object.keys(pageContracts)) {
|
|
196
|
+
files[file] = readFileSync(resolveRequiredFile(file), 'utf8');
|
|
197
|
+
}
|
|
198
|
+
for (const [file, component] of Object.entries(pageContracts)) {
|
|
199
|
+
if (!files[file].includes(component)) failures.push(`${file} does not use dedicated ${component} route component`);
|
|
200
|
+
}
|
|
201
|
+
if (required.some((file) => file.includes('/pipelines') && !file.includes('/api/'))) failures.push('legacy pipelines route is still required');
|
|
202
|
+
for (const token of ['KrateProject', 'issues', 'issueSync', 'issueRepositoryRefs', 'issueProjectRefs']) {
|
|
203
|
+
if (!files['src/controller-ui.js'].includes(token)) failures.push(`controller UI issue scoping missing ${token}`);
|
|
204
|
+
}
|
|
205
|
+
for (const token of ['giteaIssueSyncPlan', 'githubProjectIssueSyncPlan', 'orgMemoryRepositoryName', 'ensureOrgMemoryRepository', 'writeIssueRepositoryMetadata']) {
|
|
206
|
+
if (!files['src/gitea-backend.js'].includes(token)) failures.push(`backend issue sync plan missing ${token}`);
|
|
207
|
+
}
|
|
208
|
+
for (const [file, token] of [['../charts/crds/agent-resources.yaml', 'repositoryRefs'], ['../charts/crds/aggregated-resources.yaml', 'repositoryRefs'], ['../sdk/src/index.js', 'issueRepositoryRefs'], ['apps/web/app/api/orgs/[org]/resources/[kind]/[name]/route.js', 'PATCH'], ['apps/web/app/api/orgs/[org]/resources/[kind]/[name]/route.js', 'applyResourceForOrg'], ['apps/web/app/components/issue-editor.jsx', 'IssueCreateForm'], ['apps/web/app/components/issue-editor.jsx', 'IssueEditor'], ['apps/web/app/components/issue-editor.jsx', 'Create scoped issue'], ['apps/web/app/components/issue-editor.jsx', 'Add comment']]) {
|
|
209
|
+
if (!files[file].includes(token)) failures.push(`${file} missing project issue scoping token ${token}`);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
for (const token of ['ControllerApiPage', 'RepositoriesPage', 'InboxPage', 'RunsPage', 'RunnersCiPage', 'HooksEventsPage', 'InsightsPage', 'OperationsInstallPage', 'AdvancedPlansPage', 'PeoplePage', 'LoginPage', 'LogoutPage', 'RepositoryCodePage', 'RepositoryPullRequestsPage', 'RepositoryIssuesPage', 'RepositoryIssueDetailPage', 'ProjectIssuesPage', 'ProjectIssueDetailPage', 'IssueScopePage', 'RepositoryRunsPage', 'RepositoryHooksPage', 'RepositorySettingsPage']) {
|
|
213
|
+
if (!webUiSource().includes(token)) failures.push(`ui shell missing dedicated flow component ${token}`);
|
|
214
|
+
}
|
|
215
|
+
for (const token of ['IssueWorkspace', 'IssueCreateForm', 'IssueViewSwitcher', 'IssueDetailPage', 'IssueDetailView', 'IssueEditor', 'IssueComments', 'issuesForScope', 'issueRepositoryRefs', 'issueProjectRefs', 'Invite people', 'identity links', 'repository permissions', 'Access overview', 'Access readiness', 'Use workspace identity', 'Sign in to Krate', 'Repository home', 'Review inbox', 'Run debugger', 'Capacity designer', 'Automation inspector', 'Clone and refs', 'Repository settings map', 'Advanced architecture details', 'ResourceList', 'PlanCard', 'ForgeFlowRail', 'RepositoryCommandBar', 'breadcrumbs', 'Create → review → merge → deploy', 'Advanced resource details']) {
|
|
216
|
+
if (!webUiSource().includes(token)) failures.push(`ui shell missing forge UX affordance ${token}`);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const model = createControllerUiModel({
|
|
220
|
+
source: 'kubernetes',
|
|
221
|
+
namespace: 'krate-org-default',
|
|
222
|
+
generatedAt: 'test-time',
|
|
223
|
+
correlationId: 'validation',
|
|
224
|
+
kubectl: { available: true, context: 'kind-krate', clientVersion: 'v1.test', errors: [] },
|
|
225
|
+
apiService: { metadata: { name: 'v1alpha1.krate.a5c.ai' } },
|
|
226
|
+
crds: [{ metadata: { name: 'repositories.krate.a5c.ai' } }],
|
|
227
|
+
storage: { etcd: 'etcd', postgres: 'postgres', repositories: 'rwx', objects: 'object' },
|
|
228
|
+
commands: [],
|
|
229
|
+
permissions: [],
|
|
230
|
+
events: [],
|
|
231
|
+
resources: {
|
|
232
|
+
Organization: [{ apiVersion: 'krate.a5c.ai/v1alpha1', kind: 'Organization', metadata: { name: 'default', namespace: 'krate-system' }, spec: { slug: 'default', namespaceName: 'krate-org-default', displayName: 'Default org' } }],
|
|
233
|
+
Repository: [{ apiVersion: 'krate.a5c.ai/v1alpha1', kind: 'Repository', metadata: { name: 'live-repo', namespace: 'krate-org-default' }, spec: { organizationRef: 'default', visibility: 'internal', defaultBranch: 'main' }, status: { phase: 'Ready' } }],
|
|
234
|
+
KrateProject: [{ apiVersion: 'krate.a5c.ai/v1alpha1', kind: 'KrateProject', metadata: { name: 'default-project', namespace: 'krate-org-default' }, spec: { organizationRef: 'default', displayName: 'Default project', repositories: ['live-repo'] }, status: { phase: 'Ready' } }],
|
|
235
|
+
Issue: [{ apiVersion: 'krate.a5c.ai/v1alpha1', kind: 'Issue', metadata: { name: 'issue-live', namespace: 'krate-org-default', annotations: { 'krate.a5c.ai/repositories': 'live-repo' } }, spec: { organizationRef: 'default', project: 'default-project', title: 'Scoped issue', repositoryRefs: [{ name: 'live-repo' }] }, status: { phase: 'Open', comments: [{ author: 'alice', body: 'linked to live repo' }] } }],
|
|
236
|
+
User: [{ apiVersion: 'krate.a5c.ai/v1alpha1', kind: 'User', metadata: { name: 'alice', namespace: 'krate-org-default' }, spec: { organizationRef: 'default', email: 'alice@example.com', username: 'alice' }, status: { phase: 'Active' } }],
|
|
237
|
+
RepositoryPermission: [{ apiVersion: 'krate.a5c.ai/v1alpha1', kind: 'RepositoryPermission', metadata: { name: 'live-repo-alice', namespace: 'krate-org-default' }, spec: { organizationRef: 'default', repository: 'live-repo', subject: 'alice', subjectKind: 'user', permission: 'write' }, status: { phase: 'Synced' } }],
|
|
238
|
+
SSHKey: [{ apiVersion: 'krate.a5c.ai/v1alpha1', kind: 'SSHKey', metadata: { name: 'alice-laptop', namespace: 'krate-org-default' }, spec: { organizationRef: 'default', owner: 'alice', title: 'laptop', scope: 'user', key: 'ssh-ed25519 AAAA' }, status: { phase: 'Synced' } }],
|
|
239
|
+
PolicyProfile: [{ apiVersion: 'krate.a5c.ai/v1alpha1', kind: 'PolicyProfile', metadata: { name: 'default-profile', namespace: 'krate-org-default' }, spec: { organizationRef: 'default', displayName: 'Default profile', mode: 'audit' }, status: { phase: 'Ready' } }],
|
|
240
|
+
PolicyTemplate: [{ apiVersion: 'krate.a5c.ai/v1alpha1', kind: 'PolicyTemplate', metadata: { name: 'require-pr-description', namespace: 'krate-org-default' }, spec: { organizationRef: 'default', displayName: 'Require PR description', targetKinds: ['PullRequest'], kyverno: { kind: 'ValidatingPolicy' } }, status: { phase: 'Ready' } }],
|
|
241
|
+
PolicyBinding: [{ apiVersion: 'krate.a5c.ai/v1alpha1', kind: 'PolicyBinding', metadata: { name: 'require-pr-description-audit', namespace: 'krate-org-default' }, spec: { organizationRef: 'default', templateRef: 'require-pr-description', mode: 'audit' }, status: { phase: 'Bound' } }],
|
|
242
|
+
PolicyExceptionRequest: [{ apiVersion: 'krate.a5c.ai/v1alpha1', kind: 'PolicyExceptionRequest', metadata: { name: 'temporary-bypass', namespace: 'krate-org-default' }, spec: { organizationRef: 'default', policyRef: { name: 'require-pr-description' }, justification: 'migration window', expiresAt: '2026-06-01T00:00:00Z' }, status: { phase: 'Requested' } }],
|
|
243
|
+
PullRequest: [],
|
|
244
|
+
Pipeline: [],
|
|
245
|
+
RunnerPool: [],
|
|
246
|
+
WebhookSubscription: []
|
|
247
|
+
},
|
|
248
|
+
kyverno: {
|
|
249
|
+
enabled: true,
|
|
250
|
+
detected: true,
|
|
251
|
+
mode: 'byo',
|
|
252
|
+
namespace: 'kyverno',
|
|
253
|
+
policyNamespace: 'krate-system',
|
|
254
|
+
health: 'ready',
|
|
255
|
+
degraded: [],
|
|
256
|
+
reports: {
|
|
257
|
+
policyReports: [{ metadata: { name: 'repo-policy', namespace: 'krate-org-default' }, results: [{ policy: 'require-pr-description', rule: 'description', result: 'fail', message: 'description required', resources: [{ kind: 'PullRequest', name: 'pr-1' }] }] }],
|
|
258
|
+
clusterPolicyReports: [],
|
|
259
|
+
results: [{ report: 'repo-policy', namespace: 'krate-org-default', policy: 'require-pr-description', rule: 'description', result: 'fail', message: 'description required', resource: { kind: 'PullRequest', name: 'pr-1' } }],
|
|
260
|
+
violations: [{ report: 'repo-policy', namespace: 'krate-org-default', policy: 'require-pr-description', rule: 'description', result: 'fail', message: 'description required', resource: { kind: 'PullRequest', name: 'pr-1' } }]
|
|
261
|
+
},
|
|
262
|
+
resources: { PolicyReport: [], ClusterPolicyReport: [], KyvernoPolicyException: [] }
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
if (model.controller.mode !== 'krate-workspace') failures.push('controller mode is not krate-workspace');
|
|
266
|
+
if (model.status !== 'ready') failures.push('model did not become ready for available Krate snapshot');
|
|
267
|
+
if (!model.resources.find((resource) => resource.kind === 'User')) failures.push('model missing User identity resource');
|
|
268
|
+
if (!model.identity || typeof model.identity.counts?.users !== 'number') failures.push('model missing identity admin projection');
|
|
269
|
+
if (model.identity.counts.sshKeys !== 1) failures.push('model missing SSH key identity projection');
|
|
270
|
+
if (!model.identity.reconciliation?.statuses?.some((status) => status.kind === 'SSHKey' && status.phase === 'Synced')) failures.push('model missing identity reconciliation projection');
|
|
271
|
+
if (!model.resources.find((resource) => resource.kind === 'Repository')?.action?.list?.includes('Open Repository records')) failures.push('repository model missing Krate action list command');
|
|
272
|
+
if (!model.controller.endpoints.some((endpoint) => endpoint.method === 'GET' && endpoint.path === '/api/orgs/:org/resources')) failures.push('model missing resource list endpoint');
|
|
273
|
+
if (!model.controller.endpoints.some((endpoint) => endpoint.method === 'POST' && endpoint.path === '/api/orgs/:org/resources')) failures.push('model missing resource apply endpoint');
|
|
274
|
+
if (!model.controller.endpoints.some((endpoint) => endpoint.method === 'GET' && endpoint.path === '/api/orgs/:org/policies')) failures.push('model missing policy center endpoint');
|
|
275
|
+
if (!model.controller.endpoints.some((endpoint) => endpoint.method === 'GET' && endpoint.path === '/api/orgs/:org/policy-exception-requests')) failures.push('model missing policy exception list endpoint');
|
|
276
|
+
if (model.controller.architecture?.apiController?.role !== 'krate-api-controller') failures.push('model missing API controller architecture boundary');
|
|
277
|
+
if (model.controller.architecture?.resourceGateway?.role !== 'krate-resource-gateway') failures.push('model missing resource gateway architecture boundary');
|
|
278
|
+
if (model.controller.architecture?.resourceClient?.role !== 'krate-resource-client') failures.push('model missing Krate client architecture boundary');
|
|
279
|
+
if (model.controller.architecture?.deliveryReconciler?.role !== 'krate-delivery-reconciler') failures.push('model missing delivery reconciler architecture boundary');
|
|
280
|
+
if (!model.controller.architecture?.apiController?.delegatesTo?.includes('krate-resource-gateway')) failures.push('API controller does not delegate to resource gateway');
|
|
281
|
+
if (model.resources.find((resource) => resource.kind === 'Repository')?.items?.[0]?.metadata?.name !== 'live-repo') failures.push('repository model missing live items');
|
|
282
|
+
if (model.resources.find((resource) => resource.kind === 'KrateProject')?.count !== 1) failures.push('project model missing live KrateProject items');
|
|
283
|
+
if (model.resources.find((resource) => resource.kind === 'Issue')?.count !== 1) failures.push('issue model missing live issue items');
|
|
284
|
+
if (model.views.dashboard.issueSync?.gitea?.repo !== '_default_') failures.push('issue sync view missing org memory repository');
|
|
285
|
+
if (!model.validation.some((item) => item.evidence.includes('/api/orgs/:org/repositories'))) failures.push('validation missing repository management evidence');
|
|
286
|
+
if (model.policyEngine.health !== 'ready') failures.push('policy engine did not project ready Kyverno health');
|
|
287
|
+
if (model.policyEngine.violations.length !== 1) failures.push('policy engine did not normalize Kyverno violations');
|
|
288
|
+
if (!model.policyEngine.exceptionRequests.some((request) => request.name === 'temporary-bypass')) failures.push('policy engine missing exception request projection');
|
|
289
|
+
const emptyModel = createControllerUiModel({ source: 'kubernetes', namespace: 'krate-org-default', kubectl: { available: true, context: 'kind-krate', errors: [] }, apiService: { metadata: { name: 'v1alpha1.krate.a5c.ai' } }, crds: [{ metadata: { name: 'repositories.krate.a5c.ai' } }], resources: { Repository: [] }, commands: [], events: [], permissions: [], storage: {} });
|
|
290
|
+
if (emptyModel.resources.find((resource) => resource.kind === 'Repository')?.yaml !== null) failures.push('empty Krate repository model synthesized plan');
|
|
291
|
+
|
|
292
|
+
if (failures.length) fail(failures);
|
|
293
|
+
console.log(JSON.stringify({
|
|
294
|
+
status: 'success',
|
|
295
|
+
checked: required,
|
|
296
|
+
contract: 'krate-task-led-controller-ui',
|
|
297
|
+
resources: model.metrics.resources,
|
|
298
|
+
endpoints: model.controller.endpoints.length,
|
|
299
|
+
validations: model.metrics.totalChecks
|
|
300
|
+
}, null, 2));
|
|
301
|
+
|
|
302
|
+
function fail(failures) {
|
|
303
|
+
console.error(JSON.stringify({ status: 'failed', failures }, null, 2));
|
|
304
|
+
process.exit(1);
|
|
305
|
+
}
|