@rip-lang/server 1.3.125 → 1.4.1

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 (69) hide show
  1. package/{docs/READ_VALIDATORS.md → API.md} +41 -119
  2. package/CONFIG.md +408 -0
  3. package/README.md +246 -1109
  4. package/acme/crypto.rip +0 -2
  5. package/browse.rip +62 -0
  6. package/control/cli.rip +95 -36
  7. package/control/lifecycle.rip +67 -1
  8. package/control/manager.rip +250 -0
  9. package/control/mdns.rip +3 -0
  10. package/middleware.rip +1 -1
  11. package/package.json +14 -11
  12. package/server.rip +189 -673
  13. package/serving/config.rip +766 -0
  14. package/{edge → serving}/forwarding.rip +2 -2
  15. package/serving/logging.rip +101 -0
  16. package/{edge → serving}/metrics.rip +29 -1
  17. package/serving/proxy.rip +99 -0
  18. package/{edge → serving}/queue.rip +1 -1
  19. package/{edge → serving}/ratelimit.rip +1 -1
  20. package/{edge → serving}/realtime.rip +71 -2
  21. package/{edge → serving}/registry.rip +1 -1
  22. package/{edge → serving}/router.rip +3 -3
  23. package/{edge → serving}/runtime.rip +18 -16
  24. package/{edge → serving}/security.rip +1 -1
  25. package/serving/static.rip +393 -0
  26. package/{edge → serving}/tls.rip +3 -7
  27. package/{edge → serving}/upstream.rip +4 -4
  28. package/{edge → serving}/verify.rip +16 -16
  29. package/streams/{tls_clienthello.rip → clienthello.rip} +1 -1
  30. package/streams/config.rip +8 -8
  31. package/streams/index.rip +5 -5
  32. package/streams/router.rip +2 -2
  33. package/tests/acme.rip +1 -1
  34. package/tests/config.rip +215 -0
  35. package/tests/control.rip +1 -1
  36. package/tests/{runtime_entrypoints.rip → entrypoints.rip} +11 -7
  37. package/tests/extracted.rip +118 -0
  38. package/tests/helpers.rip +4 -4
  39. package/tests/metrics.rip +3 -3
  40. package/tests/proxy.rip +9 -8
  41. package/tests/read.rip +1 -1
  42. package/tests/realtime.rip +3 -3
  43. package/tests/registry.rip +4 -4
  44. package/tests/router.rip +27 -27
  45. package/tests/runner.rip +70 -0
  46. package/tests/security.rip +4 -4
  47. package/tests/servers.rip +102 -136
  48. package/tests/static.rip +2 -2
  49. package/tests/streams_clienthello.rip +2 -2
  50. package/tests/streams_index.rip +4 -4
  51. package/tests/streams_pipe.rip +1 -1
  52. package/tests/streams_router.rip +10 -10
  53. package/tests/streams_runtime.rip +4 -4
  54. package/tests/streams_upstream.rip +1 -1
  55. package/tests/upstream.rip +2 -2
  56. package/tests/verify.rip +18 -18
  57. package/tests/watchers.rip +4 -4
  58. package/default.rip +0 -435
  59. package/docs/edge/CONFIG_LIFECYCLE.md +0 -111
  60. package/docs/edge/CONTRACTS.md +0 -137
  61. package/docs/edge/EDGEFILE_CONTRACT.md +0 -282
  62. package/docs/edge/M0B_REVIEW_NOTES.md +0 -102
  63. package/docs/edge/SCHEDULER.md +0 -46
  64. package/docs/logo.png +0 -0
  65. package/docs/logo.svg +0 -13
  66. package/docs/social.png +0 -0
  67. package/edge/config.rip +0 -607
  68. package/edge/static.rip +0 -69
  69. package/tests/edgefile.rip +0 -165
@@ -1,9 +1,9 @@
1
1
  # security.rip — rate limiter, request validation, and request ID tests
2
2
 
3
- import { test, eq, ok } from '../test.rip'
4
- import { createRateLimiter, rateLimitResponse } from '../edge/ratelimit.rip'
5
- import { validateRequest } from '../edge/security.rip'
6
- import { generateRequestId } from '../edge/forwarding.rip'
3
+ import { test, eq, ok } from './runner.rip'
4
+ import { createRateLimiter, rateLimitResponse } from '../serving/ratelimit.rip'
5
+ import { validateRequest } from '../serving/security.rip'
6
+ import { generateRequestId } from '../serving/forwarding.rip'
7
7
 
8
8
  # --- Request ID ---
9
9
 
package/tests/servers.rip CHANGED
@@ -1,126 +1,110 @@
1
- import { test, eq, ok } from '../test.rip'
2
- import { normalizeEdgeConfig } from '../edge/config.rip'
1
+ import { test, eq, ok } from './runner.rip'
2
+ import { normalizeConfig } from '../serving/config.rip'
3
3
 
4
- # --- v2 basic normalization ---
4
+ getErrors = (fn) ->
5
+ try
6
+ fn()
7
+ []
8
+ catch e
9
+ e.validationErrors or []
5
10
 
6
- test "normalizes hosts into sites object shape", ->
7
- config = normalizeEdgeConfig({
8
- version: 2
9
- edge: {}
11
+ test "normalizes hosts into concrete site entries", ->
12
+ config = normalizeConfig({
10
13
  hosts:
11
14
  '*.trusthealth.com':
12
15
  cert: '/ssl/trusthealth.com.crt'
13
16
  key: '/ssl/trusthealth.com.key'
14
17
  root: '/mnt/trusthealth'
15
- routes: [
18
+ rules: [
16
19
  { path: '/*', static: '.', spa: true }
17
20
  ]
18
21
  }, '/home/shreeve')
19
- eq config.version, 2
20
- eq config.kind, 'edge'
22
+ eq config.version, 1
23
+ eq config.kind, 'serve'
21
24
  ok config.sites['*.trusthealth.com']
22
25
  eq config.sites['*.trusthealth.com'].host, '*.trusthealth.com'
23
26
  eq config.sites['*.trusthealth.com'].routes.length, 1
24
27
 
25
- test "v2 extracts cert map from server blocks", ->
26
- config = normalizeEdgeConfig({
27
- version: 2
28
- edge: {}
28
+ test "extracts cert map from host blocks and certs", ->
29
+ config = normalizeConfig({
30
+ certs:
31
+ zion: '/ssl/zionlabshare.com'
29
32
  hosts:
30
33
  '*.trusthealth.com':
31
34
  cert: '/ssl/trusthealth.com.crt'
32
35
  key: '/ssl/trusthealth.com.key'
33
- routes: [
36
+ rules: [
34
37
  { path: '/*', static: '/mnt/web' }
35
38
  ]
36
39
  '*.zionlabshare.com':
37
- cert: '/ssl/zionlabshare.com.crt'
38
- key: '/ssl/zionlabshare.com.key'
39
- routes: [
40
+ cert: 'zion'
41
+ rules: [
40
42
  { path: '/*', static: '/mnt/zion' }
41
43
  ]
42
44
  }, '/home/shreeve')
43
- ok config.certs
44
- ok config.certs['*.trusthealth.com']
45
- ok config.certs['*.zionlabshare.com']
46
- ok config.certs['*.trusthealth.com'].certPath.endsWith('trusthealth.com.crt')
45
+ ok config.resolvedCerts['*.trusthealth.com']
46
+ ok config.resolvedCerts['*.zionlabshare.com']
47
+ ok config.resolvedCerts['*.trusthealth.com'].certPath.endsWith('trusthealth.com.crt')
48
+ ok config.resolvedCerts['*.zionlabshare.com'].certPath.endsWith('zionlabshare.com.crt')
47
49
 
48
- test "v2 inherits server root into routes", ->
49
- config = normalizeEdgeConfig({
50
- version: 2
51
- edge: {}
50
+ test "inherits host root into static routes", ->
51
+ config = normalizeConfig({
52
52
  hosts:
53
53
  '*.example.com':
54
54
  root: '/mnt/site'
55
- routes: [
55
+ rules: [
56
56
  { path: '/*', static: '.' }
57
57
  ]
58
58
  }, '/home/shreeve')
59
59
  route = config.sites['*.example.com'].routes[0]
60
60
  ok route.root.includes('mnt/site')
61
61
 
62
- test "v2 route root overrides server root", ->
63
- config = normalizeEdgeConfig({
64
- version: 2
65
- edge: {}
62
+ test "route root overrides host root", ->
63
+ config = normalizeConfig({
66
64
  hosts:
67
65
  '*.example.com':
68
66
  root: '/mnt/default'
69
- routes: [
67
+ rules: [
70
68
  { path: '/*', static: '.', root: '/mnt/override' }
71
69
  ]
72
70
  }, '/home/shreeve')
73
71
  route = config.sites['*.example.com'].routes[0]
74
72
  ok route.root.includes('mnt/override')
75
73
 
76
- test "v2 routes inherit host from server key", ->
77
- config = normalizeEdgeConfig({
78
- version: 2
79
- edge: {}
74
+ test "rules inherit host from the host block", ->
75
+ config = normalizeConfig({
80
76
  hosts:
81
77
  app.example.com:
82
- routes: [
78
+ rules: [
83
79
  { path: '/*', static: '/mnt/app' }
84
80
  ]
85
81
  }, '/home/shreeve')
86
82
  route = config.sites['app.example.com'].routes[0]
87
83
  eq route.host, 'app.example.com'
88
84
 
89
- test "v2 preserves spa flag on routes", ->
90
- config = normalizeEdgeConfig({
91
- version: 2
92
- edge: {}
85
+ test "preserves spa flag on rules", ->
86
+ config = normalizeConfig({
93
87
  hosts:
94
88
  '*.example.com':
95
- routes: [
89
+ rules: [
96
90
  { path: '/*', static: '/mnt/app', spa: true }
97
91
  ]
98
92
  }, '/home/shreeve')
99
93
  route = config.sites['*.example.com'].routes[0]
100
94
  eq route.spa, true
101
95
 
102
- # --- validation errors ---
103
-
104
- test "rejects server block with no routes and no root", ->
105
- threw = false
106
- try
107
- normalizeEdgeConfig({
108
- version: 1
109
- edge: {}
96
+ test "rejects host block with no rules and no root", ->
97
+ errors = getErrors ->
98
+ normalizeConfig({
110
99
  hosts:
111
100
  '*.example.com':
112
101
  cert: '/ssl/example.com.crt'
113
102
  key: '/ssl/example.com.key'
114
103
  }, '/home/shreeve')
115
- catch e
116
- threw = true
117
- ok e.validationErrors.some((err) -> err.code is 'E_SERVER_ROUTES')
118
- ok threw
104
+ ok errors.some((err) -> err.code is 'E_SERVER_RULES')
119
105
 
120
- test "root-only server block generates implicit static route", ->
121
- config = normalizeEdgeConfig({
122
- version: 1
123
- edge: {}
106
+ test "root-only host block generates implicit static route", ->
107
+ config = normalizeConfig({
124
108
  hosts:
125
109
  '*.example.com':
126
110
  root: '/mnt/site'
@@ -130,10 +114,8 @@ test "root-only server block generates implicit static route", ->
130
114
  eq routes[0].static, '.'
131
115
  ok routes[0].root.includes('mnt/site')
132
116
 
133
- test "root-only server block with spa", ->
134
- config = normalizeEdgeConfig({
135
- version: 1
136
- edge: {}
117
+ test "root-only host block with spa", ->
118
+ config = normalizeConfig({
137
119
  hosts:
138
120
  '*.example.com':
139
121
  root: '/mnt/site'
@@ -141,83 +123,72 @@ test "root-only server block with spa", ->
141
123
  }, '/home/shreeve')
142
124
  eq config.sites['*.example.com'].routes[0].spa, true
143
125
 
144
- test "passthrough server block creates stream entries", ->
145
- config = normalizeEdgeConfig({
146
- version: 1
126
+ test "passthrough host block creates stream entries", ->
127
+ config = normalizeConfig({
128
+ proxies:
129
+ incus:
130
+ hosts: ['tcp://127.0.0.1:8443']
147
131
  hosts:
148
132
  incus.example.com:
149
- passthrough: '127.0.0.1:8443'
133
+ proxy: 'incus'
150
134
  }, '/home/shreeve')
151
- ok config.streamUpstreams['passthrough-incus.example.com']
135
+ ok config.streamUpstreams['incus']
152
136
  eq config.streams.length, 1
137
+ eq config.streams[0].proxy, 'incus'
153
138
  eq config.streams[0].sni[0], 'incus.example.com'
154
139
 
155
- test "passthrough server block has no sites entry", ->
156
- config = normalizeEdgeConfig({
157
- version: 1
140
+ test "passthrough host block has no sites entry", ->
141
+ config = normalizeConfig({
142
+ proxies:
143
+ incus:
144
+ hosts: ['tcp://127.0.0.1:8443']
158
145
  hosts:
159
146
  incus.example.com:
160
- passthrough: '127.0.0.1:8443'
147
+ proxy: 'incus'
161
148
  }, '/home/shreeve')
162
149
  eq config.sites['incus.example.com'], undefined
163
150
 
164
- test "edge and version are optional", ->
165
- config = normalizeEdgeConfig({
151
+ test "server settings and version are optional", ->
152
+ config = normalizeConfig({
166
153
  hosts:
167
154
  '*.example.com':
168
155
  root: '/mnt/site'
169
156
  }, '/home/shreeve')
170
157
  eq config.version, 1
171
- ok config.edge
158
+ ok config.server
172
159
 
173
- test "v2 rejects route with host field", ->
174
- threw = false
175
- try
176
- normalizeEdgeConfig({
177
- version: 2
178
- edge: {}
160
+ test "rejects route host fields inside host blocks", ->
161
+ errors = getErrors ->
162
+ normalizeConfig({
179
163
  hosts:
180
164
  '*.example.com':
181
- routes: [{ path: '/*', static: '.', host: 'other.com' }]
165
+ rules: [{ path: '/*', static: '.', host: 'other.com' }]
182
166
  }, '/home/shreeve')
183
- catch e
184
- threw = true
185
- ok e.validationErrors.some((err) -> err.code is 'E_SERVER_ROUTE_HOST')
186
- ok threw
187
-
188
- test "v2 validates upstream references in server routes", ->
189
- threw = false
190
- try
191
- normalizeEdgeConfig({
192
- version: 2
193
- edge: {}
167
+ ok errors.some((err) -> err.code is 'E_SERVER_ROUTE_HOST')
168
+
169
+ test "validates proxy references in host rules", ->
170
+ errors = getErrors ->
171
+ normalizeConfig({
172
+ proxies:
173
+ api:
174
+ hosts: ['http://127.0.0.1:4000']
194
175
  hosts:
195
176
  '*.example.com':
196
- routes: [{ path: '/api/*', upstream: 'nonexistent' }]
177
+ rules: [{ path: '/api/*', proxy: 'nonexistent' }]
197
178
  }, '/home/shreeve')
198
- catch e
199
- threw = true
200
- ok e.validationErrors.some((err) -> err.code is 'E_ROUTE_UPSTREAM_REF')
201
- ok threw
179
+ ok errors.some((err) -> err.code is 'E_ROUTE_PROXY_REF')
202
180
 
203
- test "v2 validates app references in server routes", ->
204
- threw = false
205
- try
206
- normalizeEdgeConfig({
207
- version: 2
208
- edge: {}
181
+ test "validates app references in host rules", ->
182
+ errors = getErrors ->
183
+ normalizeConfig({
209
184
  hosts:
210
185
  '*.example.com':
211
- routes: [{ path: '/*', app: 'nonexistent' }]
186
+ rules: [{ path: '/*', app: 'nonexistent' }]
212
187
  }, '/home/shreeve')
213
- catch e
214
- threw = true
215
- ok e.validationErrors.some((err) -> err.code is 'E_ROUTE_APP_REF')
216
- ok threw
188
+ ok errors.some((err) -> err.code is 'E_ROUTE_APP_REF')
217
189
 
218
-
219
- test "server block with app field creates app route", ->
220
- config = normalizeEdgeConfig({
190
+ test "host block with app field creates app route", ->
191
+ config = normalizeConfig({
221
192
  hosts:
222
193
  'dev.example.com':
223
194
  cert: '/ssl/example.com.crt'
@@ -225,38 +196,33 @@ test "server block with app field creates app route", ->
225
196
  app: 'browser'
226
197
  apps:
227
198
  browser:
228
- entry: '/srv/default.rip'
199
+ entry: '/srv/browse.rip'
229
200
  root: '/mnt/www'
230
201
  }, '/home/shreeve')
231
202
  route = config.sites['dev.example.com'].routes[0]
232
203
  eq route.app, 'browser'
233
204
  eq route.host, 'dev.example.com'
234
- ok config.certs['dev.example.com']
205
+ ok config.resolvedCerts['dev.example.com']
235
206
 
236
- test "server block rejects unknown app reference", ->
237
- threw = false
238
- try
239
- normalizeEdgeConfig({
207
+ test "host block rejects unknown app reference", ->
208
+ errors = getErrors ->
209
+ normalizeConfig({
240
210
  hosts:
241
211
  'dev.example.com':
242
212
  app: 'nonexistent'
243
213
  }, '/home/shreeve')
244
- catch e
245
- threw = true
246
- ok e.validationErrors.some((err) -> err.code is 'E_SERVER_APP_REF')
247
- ok threw
248
-
249
- test "inline app definition on host block", ->
250
- config = normalizeEdgeConfig({
251
- hosts:
252
- 'api.example.com':
253
- cert: '/ssl/example.com.crt'
254
- key: '/ssl/example.com.key'
255
- app:
256
- entry: '/srv/myapi/index.rip'
257
- root: '/srv/myapi'
258
- }, '/home/shreeve')
259
- route = config.sites['api.example.com'].routes[0]
260
- eq route.app, 'app-api.example.com'
261
- ok config.apps['app-api.example.com']
262
- ok config.apps['app-api.example.com'].entry.includes('myapi')
214
+ ok errors.some((err) -> err.code is 'E_SERVER_APP_REF')
215
+
216
+ test "rejects TCP proxy host blocks that also terminate TLS", ->
217
+ errors = getErrors ->
218
+ normalizeConfig({
219
+ proxies:
220
+ incus:
221
+ hosts: ['tcp://127.0.0.1:8443']
222
+ hosts:
223
+ 'incus.example.com':
224
+ proxy: 'incus'
225
+ cert: '/ssl/example.com.crt'
226
+ key: '/ssl/example.com.key'
227
+ }, '/home/shreeve')
228
+ ok errors.some((err) -> err.code is 'E_SERVER_TCP_PROXY_ONLY')
package/tests/static.rip CHANGED
@@ -1,5 +1,5 @@
1
- import { test, eq, ok } from '../test.rip'
2
- import { serveStaticRoute, buildRedirectResponse } from '../edge/static.rip'
1
+ import { test, eq, ok } from './runner.rip'
2
+ import { serveStaticRoute, buildRedirectResponse } from '../serving/static.rip'
3
3
 
4
4
  # --- helpers ---
5
5
 
@@ -1,5 +1,5 @@
1
- import { test, eq, ok } from '../test.rip'
2
- import { parseSNI } from '../streams/tls_clienthello.rip'
1
+ import { test, eq, ok } from './runner.rip'
2
+ import { parseSNI } from '../streams/clienthello.rip'
3
3
 
4
4
  buildClientHello = (hostname = 'incus.example.com', opts = {}) ->
5
5
  hostBytes = new TextEncoder().encode(hostname)
@@ -1,4 +1,4 @@
1
- import { test, eq } from '../test.rip'
1
+ import { test, eq } from './runner.rip'
2
2
  import { buildStreamRuntime, resolveHandshakeTarget } from '../streams/index.rip'
3
3
 
4
4
  test "resolveHandshakeTarget falls through to http fallback when no route matches", ->
@@ -7,7 +7,7 @@ test "resolveHandshakeTarget falls through to http fallback when no route matche
7
7
  incus:
8
8
  targets: [{ host: '127.0.0.1', port: 8443 }]
9
9
  streams: [
10
- { id: 'incus', order: 0, listen: 443, sni: ['incus.example.com'], upstream: 'incus' }
10
+ { id: 'incus', order: 0, listen: 443, sni: ['incus.example.com'], proxy: 'incus' }
11
11
  ]
12
12
  )
13
13
  result = resolveHandshakeTarget(runtime, 443, 'app.example.com',
@@ -24,7 +24,7 @@ test "resolveHandshakeTarget prefers configured stream routes over fallback", ->
24
24
  incus:
25
25
  targets: [{ host: '127.0.0.1', port: 8443 }]
26
26
  streams: [
27
- { id: 'incus', order: 0, listen: 443, sni: ['incus.example.com'], upstream: 'incus' }
27
+ { id: 'incus', order: 0, listen: 443, sni: ['incus.example.com'], proxy: 'incus' }
28
28
  ]
29
29
  )
30
30
  result = resolveHandshakeTarget(runtime, 443, 'incus.example.com',
@@ -41,7 +41,7 @@ test "resolveHandshakeTarget rejects when stream route matches but upstream is u
41
41
  incus:
42
42
  targets: []
43
43
  streams: [
44
- { id: 'incus', order: 0, listen: 443, sni: ['incus.example.com'], upstream: 'incus' }
44
+ { id: 'incus', order: 0, listen: 443, sni: ['incus.example.com'], proxy: 'incus' }
45
45
  ]
46
46
  )
47
47
  result = resolveHandshakeTarget(runtime, 443, 'incus.example.com',
@@ -1,4 +1,4 @@
1
- import { test, eq, ok } from '../test.rip'
1
+ import { test, eq, ok } from './runner.rip'
2
2
  import { createPipeState, writeChunk, flushPending } from '../streams/pipe.rip'
3
3
 
4
4
  fakeSocket = (returns = []) ->
@@ -1,39 +1,39 @@
1
- import { test, eq } from '../test.rip'
1
+ import { test, eq } from './runner.rip'
2
2
  import { compileStreamTable, matchStreamRoute, describeStreamRoute } from '../streams/router.rip'
3
3
 
4
4
  test "compileStreamTable expands sni patterns", ->
5
5
  table = compileStreamTable([
6
- { id: 'incus', order: 0, listen: 8443, sni: ['incus.example.com', '*.example.com'], upstream: 'incus' }
6
+ { id: 'incus', order: 0, listen: 8443, sni: ['incus.example.com', '*.example.com'], proxy: 'incus' }
7
7
  ])
8
8
  eq table.routes.length, 2
9
9
 
10
10
  test "matchStreamRoute prefers exact sni", ->
11
11
  table = compileStreamTable([
12
- { id: 'wild', order: 0, listen: 8443, sni: ['*.example.com'], upstream: 'wild' }
13
- { id: 'exact', order: 1, listen: 8443, sni: ['incus.example.com'], upstream: 'exact' }
12
+ { id: 'wild', order: 0, listen: 8443, sni: ['*.example.com'], proxy: 'wild' }
13
+ { id: 'exact', order: 1, listen: 8443, sni: ['incus.example.com'], proxy: 'exact' }
14
14
  ])
15
- eq matchStreamRoute(table, 8443, 'incus.example.com').upstream, 'exact'
15
+ eq matchStreamRoute(table, 8443, 'incus.example.com').proxy, 'exact'
16
16
 
17
17
  test "matchStreamRoute matches wildcard sni", ->
18
18
  table = compileStreamTable([
19
- { id: 'wild', order: 0, listen: 8443, sni: ['*.example.com'], upstream: 'wild' }
19
+ { id: 'wild', order: 0, listen: 8443, sni: ['*.example.com'], proxy: 'wild' }
20
20
  ])
21
- eq matchStreamRoute(table, 8443, 'api.example.com').upstream, 'wild'
21
+ eq matchStreamRoute(table, 8443, 'api.example.com').proxy, 'wild'
22
22
 
23
23
  test "matchStreamRoute wildcard is single-label only", ->
24
24
  table = compileStreamTable([
25
- { id: 'wild', order: 0, listen: 8443, sni: ['*.example.com'], upstream: 'wild' }
25
+ { id: 'wild', order: 0, listen: 8443, sni: ['*.example.com'], proxy: 'wild' }
26
26
  ])
27
27
  eq matchStreamRoute(table, 8443, 'a.b.example.com'), null
28
28
 
29
29
  test "matchStreamRoute filters by listen port", ->
30
30
  table = compileStreamTable([
31
- { id: 'incus', order: 0, listen: 8443, sni: ['incus.example.com'], upstream: 'incus' }
31
+ { id: 'incus', order: 0, listen: 8443, sni: ['incus.example.com'], proxy: 'incus' }
32
32
  ])
33
33
  eq matchStreamRoute(table, 443, 'incus.example.com'), null
34
34
 
35
35
  test "describeStreamRoute summarizes route", ->
36
36
  table = compileStreamTable([
37
- { id: 'incus', order: 0, listen: 8443, sni: ['incus.example.com'], upstream: 'incus' }
37
+ { id: 'incus', order: 0, listen: 8443, sni: ['incus.example.com'], proxy: 'incus' }
38
38
  ])
39
39
  eq describeStreamRoute(table.routes[0]), '8443 incus.example.com -> incus'
@@ -1,4 +1,4 @@
1
- import { test, eq } from '../test.rip'
1
+ import { test, eq } from './runner.rip'
2
2
  import { createStreamRuntime, describeStreamRuntime, buildStreamConfigInfo, streamUsesListenPort } from '../streams/runtime.rip'
3
3
 
4
4
  test "createStreamRuntime starts empty", ->
@@ -20,7 +20,7 @@ test "buildStreamConfigInfo reports counts and descriptions", ->
20
20
  streamUpstreams:
21
21
  incus: {}
22
22
  streams: [
23
- { id: 'incus', order: 0, listen: 8443, sni: ['incus.example.com'], upstream: 'incus' }
23
+ { id: 'incus', order: 0, listen: 8443, sni: ['incus.example.com'], proxy: 'incus' }
24
24
  ]
25
25
  )
26
26
  eq info.streamCounts.streamUpstreams, 1
@@ -30,8 +30,8 @@ test "buildStreamConfigInfo reports counts and descriptions", ->
30
30
  test "streamUsesListenPort detects shared listener ports", ->
31
31
  runtime = createStreamRuntime(null, null,
32
32
  routes: [
33
- { listen: 443, sni: 'incus.example.com', upstream: 'incus' }
34
- { listen: 8443, sni: 'db.example.com', upstream: 'db' }
33
+ { listen: 443, sni: 'incus.example.com', proxy: 'incus' }
34
+ { listen: 8443, sni: 'db.example.com', proxy: 'db' }
35
35
  ]
36
36
  )
37
37
  eq streamUsesListenPort(runtime, 443), true
@@ -1,4 +1,4 @@
1
- import { test, eq } from '../test.rip'
1
+ import { test, eq } from './runner.rip'
2
2
  import { createStreamUpstreamPool, addStreamUpstream, getStreamUpstream, selectStreamTarget, openStreamConnection, releaseStreamConnection } from '../streams/upstream.rip'
3
3
 
4
4
  test "addStreamUpstream registers targets", ->
@@ -1,4 +1,4 @@
1
- import { test, eq, ok } from '../test.rip'
1
+ import { test, eq, ok } from './runner.rip'
2
2
  import {
3
3
  createUpstreamPool
4
4
  addUpstream
@@ -11,7 +11,7 @@ import {
11
11
  shouldRetry
12
12
  computeRetryDelayMs
13
13
  updateTargetHealth
14
- } from '../edge/upstream.rip'
14
+ } from '../serving/upstream.rip'
15
15
 
16
16
  test "createUpstreamPool starts empty", ->
17
17
  pool = createUpstreamPool()
package/tests/verify.rip CHANGED
@@ -1,10 +1,10 @@
1
- import { test, eq, ok } from '../test.rip'
2
- import { compileRouteTable } from '../edge/router.rip'
3
- import { collectRouteRequirements, verifyRouteRuntime } from '../edge/verify.rip'
1
+ import { test, eq, ok } from './runner.rip'
2
+ import { compileRouteTable } from '../serving/router.rip'
3
+ import { collectRouteRequirements, verifyRouteRuntime } from '../serving/verify.rip'
4
4
 
5
- test "collectRouteRequirements gathers upstreams and managed apps", ->
5
+ test "collectRouteRequirements gathers proxies and managed apps", ->
6
6
  table = compileRouteTable([
7
- { path: '/api/*', upstream: 'api' }
7
+ { path: '/api/*', proxy: 'api' }
8
8
  { path: '/admin/*', app: 'admin' }
9
9
  ])
10
10
  appRegistry =
@@ -13,17 +13,17 @@ test "collectRouteRequirements gathers upstreams and managed apps", ->
13
13
  ['reports', { config: { entry: '/srv/reports/index.rip' } }]
14
14
  ])
15
15
  reqs = collectRouteRequirements(table, appRegistry, 'default')
16
- eq reqs.upstreamIds, ['api']
16
+ eq reqs.proxyIds, ['api']
17
17
  ok reqs.appIds.includes('admin')
18
18
  ok reqs.appIds.includes('reports')
19
19
 
20
- test "verifyRouteRuntime returns upstream reason code", ->
20
+ test "verifyRouteRuntime returns proxy reason code", ->
21
21
  runtime =
22
22
  upstreamPool:
23
23
  upstreams: new Map([
24
24
  ['api', { id: 'api', targets: [{ targetId: 'api:0' }, { targetId: 'api:1' }] }]
25
25
  ])
26
- routeTable: compileRouteTable([{ path: '/api/*', upstream: 'api' }])
26
+ routeTable: compileRouteTable([{ path: '/api/*', proxy: 'api' }])
27
27
  appRegistry = { apps: new Map() }
28
28
  result = verifyRouteRuntime(
29
29
  runtime,
@@ -34,8 +34,8 @@ test "verifyRouteRuntime returns upstream reason code", ->
34
34
  ((registry, appId) -> registry.apps.get(appId))
35
35
  )
36
36
  eq result.ok, false
37
- eq result.code, 'upstream_no_healthy_targets'
38
- eq result.details.upstreamId, 'api'
37
+ eq result.code, 'proxy_no_healthy_targets'
38
+ eq result.details.proxyId, 'api'
39
39
  eq result.details.requiredHealthyTargets, 1
40
40
 
41
41
  test "verifyRouteRuntime returns app worker reason code", ->
@@ -59,14 +59,14 @@ test "verifyRouteRuntime returns app worker reason code", ->
59
59
  eq result.code, 'app_no_ready_workers'
60
60
  eq result.details.appId, 'admin'
61
61
 
62
- test "verifyRouteRuntime succeeds when referenced upstreams and apps are healthy", ->
62
+ test "verifyRouteRuntime succeeds when referenced proxies and apps are healthy", ->
63
63
  runtime =
64
64
  upstreamPool:
65
65
  upstreams: new Map([
66
66
  ['api', { id: 'api', targets: [{ targetId: 'api:0' }] }]
67
67
  ])
68
68
  routeTable: compileRouteTable([
69
- { path: '/api/*', upstream: 'api' }
69
+ { path: '/api/*', proxy: 'api' }
70
70
  { path: '/admin/*', app: 'admin' }
71
71
  ])
72
72
  appRegistry =
@@ -90,7 +90,7 @@ test "verifyRouteRuntime honors minimum healthy targets policy", ->
90
90
  upstreams: new Map([
91
91
  ['api', { id: 'api', targets: [{ targetId: 'api:0' }, { targetId: 'api:1' }] }]
92
92
  ])
93
- routeTable: compileRouteTable([{ path: '/api/*', upstream: 'api' }])
93
+ routeTable: compileRouteTable([{ path: '/api/*', proxy: 'api' }])
94
94
  appRegistry = { apps: new Map() }
95
95
  healthyCount = 0
96
96
  result = verifyRouteRuntime(
@@ -103,18 +103,18 @@ test "verifyRouteRuntime honors minimum healthy targets policy", ->
103
103
  healthyCount is 1
104
104
  ),
105
105
  ((registry, appId) -> registry.apps.get(appId)),
106
- minHealthyTargetsPerUpstream: 2
106
+ minHealthyTargetsPerProxy: 2
107
107
  )
108
108
  eq result.ok, false
109
- eq result.code, 'upstream_no_healthy_targets'
109
+ eq result.code, 'proxy_no_healthy_targets'
110
110
  eq result.details.healthyTargets, 1
111
111
  eq result.details.requiredHealthyTargets, 2
112
112
 
113
- test "verifyRouteRuntime can skip healthy upstream checks", ->
113
+ test "verifyRouteRuntime can skip healthy proxy checks", ->
114
114
  runtime =
115
115
  upstreamPool:
116
116
  upstreams: new Map()
117
- routeTable: compileRouteTable([{ path: '/api/*', upstream: 'api' }])
117
+ routeTable: compileRouteTable([{ path: '/api/*', proxy: 'api' }])
118
118
  appRegistry = { apps: new Map() }
119
119
  result = verifyRouteRuntime(
120
120
  runtime,
@@ -123,7 +123,7 @@ test "verifyRouteRuntime can skip healthy upstream checks", ->
123
123
  ((pool, id) -> pool.upstreams.get(id)),
124
124
  ((pool, target) -> false),
125
125
  ((registry, appId) -> registry.apps.get(appId)),
126
- requireHealthyUpstreams: false
126
+ requireHealthyProxies: false
127
127
  )
128
128
  eq result.ok, true
129
129