@flisk-sh/flisk 1.4.0 → 1.4.2

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 (44) hide show
  1. package/README.md +305 -52
  2. package/cli/dist/commands/doctor.js +62 -0
  3. package/cli/dist/commands/runtime.js +6 -3
  4. package/cli/dist/generator/template-engine.js +7 -4
  5. package/cli/dist/utils/runtime-layout.js +7 -0
  6. package/cli/dist-bundle/{chunk-QQEV6D74.js → chunk-3XODDLRJ.js} +1 -1
  7. package/cli/dist-bundle/{chunk-VMB5673O.js → chunk-43XWL2PB.js} +30 -26
  8. package/cli/dist-bundle/{chunk-5EZ4EX6U.js → chunk-53L2JN7G.js} +1 -1
  9. package/cli/dist-bundle/{chunk-BWK6MPCB.js → chunk-5F7YP5IR.js} +1 -1
  10. package/cli/dist-bundle/{chunk-36SOQVAL.js → chunk-5QBYM33Q.js} +1 -1
  11. package/cli/dist-bundle/{chunk-HEMPQKD6.js → chunk-DU2BN46C.js} +1 -1
  12. package/cli/dist-bundle/{chunk-ICXF6PXA.js → chunk-ETKUVKJ2.js} +2 -2
  13. package/cli/dist-bundle/{chunk-PVBAGX5X.js → chunk-I7TGIK5N.js} +1 -1
  14. package/cli/dist-bundle/{chunk-B6Q5VKL7.js → chunk-IGN5UC3P.js} +1 -1
  15. package/cli/dist-bundle/chunk-MWOVYIBB.js +54 -0
  16. package/cli/dist-bundle/{chunk-D7N2GGJH.js → chunk-YHYRGWUH.js} +1 -1
  17. package/cli/dist-bundle/{chunk-VHFFSBVJ.js → chunk-YNCBBJ4V.js} +1 -1
  18. package/cli/dist-bundle/cli.js +153 -153
  19. package/cli/dist-bundle/{cold-preflight-ABU26DYW.js → cold-preflight-ZOPR7PWJ.js} +1 -1
  20. package/cli/dist-bundle/{demo-stage-EBIUCJBX.js → demo-stage-OHNTP2UJ.js} +1 -1
  21. package/cli/dist-bundle/{open-2KSAF6M2.js → open-XROJ6YEY.js} +1 -1
  22. package/cli/dist-bundle/project-7PTIOHGF.js +2 -0
  23. package/cli/dist-bundle/{services-V6Q55JR5.js → services-BIMF6MVU.js} +1 -1
  24. package/cli/dist-bundle/{tilt-port-owner-MWJ7P6NB.js → tilt-port-owner-ZY5M2JC4.js} +1 -1
  25. package/cli/package.json +1 -1
  26. package/package.json +12 -2
  27. package/runtime/platform/services/platform/proxy/service.yaml +14 -0
  28. package/cli/dist/commands/__tests__/project-e2e-helpers.js +0 -49
  29. package/cli/dist/commands/__tests__/ui-loading-screen.test.js +0 -16
  30. package/cli/dist/generator/__tests__/golden-helpers.js +0 -43
  31. package/cli/dist-bundle/chunk-763VK575.js +0 -54
  32. package/cli/dist-bundle/project-YD3C4ZV3.js +0 -2
  33. package/runtime/discovery/test_resource_snapshot.py +0 -253
  34. package/runtime/engine/assets/docker/wake-gateway/decide.test.ts +0 -177
  35. package/runtime/engine/topologies/tilt/manifest/tests/test_integration.star +0 -278
  36. package/runtime/engine/topologies/tilt/manifest/tests/test_loader_parser.star +0 -475
  37. package/runtime/engine/topologies/tilt/manifest/tests/test_manifest.star +0 -319
  38. package/runtime/engine/topologies/tilt/manifest/tests/test_validator.star +0 -472
  39. package/runtime/ext/ide-components/shared/test_config_service.py +0 -328
  40. /package/{shared-platform-engineering → runtime/shared-platform-engineering}/docker-templates/bun-hoisted-symlink-fix.sh +0 -0
  41. /package/{shared-platform-engineering → runtime/shared-platform-engineering}/docker-templates/infisical-entrypoint.sh +0 -0
  42. /package/{shared-platform-engineering → runtime/shared-platform-engineering}/docker-templates/install-deps.sh +0 -0
  43. /package/{shared-platform-engineering → runtime/shared-platform-engineering}/docker-templates/prisma-bun-client-link-fix.sh +0 -0
  44. /package/{shared-platform-engineering → runtime/shared-platform-engineering}/docker-templates/prisma-normalize-client.sh +0 -0
@@ -1,472 +0,0 @@
1
- # Copyright (c) 2026 Flisk Landscape contributors
2
- # SPDX-License-Identifier: MIT
3
- # =============================================================================
4
- # 📋 MANIFEST MODULE - VALIDATOR TESTS (Phase 3)
5
- # =============================================================================
6
- # Path: .tilt/topologies/tilt/manifest/tests/test_validator.star
7
- # Purpose: Integration tests for validator module
8
- # Status: Phase 3 of manifest system refactoring
9
- # =============================================================================
10
-
11
- load("../__init__.star", "Manifest")
12
- load("../validator.star", "ManifestValidator")
13
-
14
- # =============================================================================
15
- # TEST FRAMEWORK
16
- # =============================================================================
17
-
18
- test_results = {
19
- 'passed': 0,
20
- 'failed': 0,
21
- 'errors': [],
22
- }
23
-
24
- def assert_true(condition, message="Assertion failed"):
25
- """Assert that condition is true."""
26
- if not condition:
27
- test_results['failed'] += 1
28
- test_results['errors'].append("FAIL: " + message)
29
- else:
30
- test_results['passed'] += 1
31
-
32
- def assert_equal(expected, actual, message="Values not equal"):
33
- """Assert that expected equals actual."""
34
- if expected != actual:
35
- test_results['failed'] += 1
36
- test_results['errors'].append(
37
- "FAIL: {} - expected '{}', got '{}'".format(message, expected, actual)
38
- )
39
- else:
40
- test_results['passed'] += 1
41
-
42
- def assert_not_none(value, message="Value is None"):
43
- """Assert that value is not None."""
44
- if value == None:
45
- test_results['failed'] += 1
46
- test_results['errors'].append("FAIL: " + message)
47
- else:
48
- test_results['passed'] += 1
49
-
50
- # =============================================================================
51
- # TEST SUITE: Validator Functions
52
- # =============================================================================
53
-
54
- def _test_validator_functions():
55
- """Test that validator functions are accessible."""
56
- print("🔍 Testing validator module accessibility...")
57
-
58
- # Test functions accessible via facade
59
- assert_not_none(Manifest.validate, "validate should be accessible")
60
- assert_not_none(Manifest.is_valid, "is_valid should be accessible")
61
- assert_not_none(Manifest.get_validation_report, "get_validation_report should be accessible")
62
- assert_not_none(Manifest.validate_schema, "validate_schema should be accessible")
63
- assert_not_none(Manifest.validate_values, "validate_values should be accessible")
64
- assert_not_none(Manifest.validate_dependencies, "validate_dependencies should be accessible")
65
-
66
- print("✅ Validator functions accessible\n")
67
-
68
- # =============================================================================
69
- # TEST SUITE: Schema Validation
70
- # =============================================================================
71
-
72
- def _test_schema_validation():
73
- """Test schema-level validation."""
74
- print("🔍 Testing schema validation...")
75
-
76
- # Valid manifest
77
- valid_manifest = {
78
- 'appName': 'test-service',
79
- 'appType': 'backend',
80
- 'stack': 'user',
81
- 'port': 4001,
82
- }
83
-
84
- result = Manifest.validate_schema(valid_manifest)
85
- assert_true(result.valid, "Valid manifest should pass schema validation")
86
- assert_equal(0, len(result.errors), "Valid manifest should have no errors")
87
-
88
- # Missing required field
89
- invalid_manifest = {
90
- 'appType': 'backend',
91
- 'stack': 'user',
92
- 'port': 4001,
93
- }
94
-
95
- result = Manifest.validate_schema(invalid_manifest)
96
- assert_true(not result.valid, "Missing required field should fail")
97
- assert_true(len(result.errors) > 0, "Should have errors for missing appName")
98
-
99
- # Invalid type
100
- wrong_type_manifest = {
101
- 'appName': 'test-service',
102
- 'appType': 'invalid-type',
103
- 'stack': 'user',
104
- 'port': 4001,
105
- }
106
-
107
- result = Manifest.validate_schema(wrong_type_manifest)
108
- # Note: Type checking might be lenient in initial implementation
109
-
110
- print("✅ Schema validation tests complete\n")
111
-
112
- # =============================================================================
113
- # TEST SUITE: Value Validation
114
- # =============================================================================
115
-
116
- def _test_value_validation():
117
- """Test value-level validation."""
118
- print("🔍 Testing value validation...")
119
-
120
- # Invalid port (too low)
121
- manifest_low_port = {
122
- 'appName': 'test-service',
123
- 'appType': 'backend',
124
- 'stack': 'user',
125
- 'port': 100, # Invalid: below 1024
126
- }
127
-
128
- result = Manifest.validate_values(manifest_low_port)
129
- assert_true(not result.valid or len(result.errors) > 0, "Port too low should fail")
130
-
131
- # Invalid port (too high)
132
- manifest_high_port = {
133
- 'appName': 'test-service',
134
- 'appType': 'backend',
135
- 'stack': 'user',
136
- 'port': 70000, # Invalid: above 65535
137
- }
138
-
139
- result = Manifest.validate_values(manifest_high_port)
140
- assert_true(not result.valid or len(result.errors) > 0, "Port too high should fail")
141
-
142
- # Valid port
143
- manifest_valid_port = {
144
- 'appName': 'test-service',
145
- 'appType': 'backend',
146
- 'stack': 'user',
147
- 'port': 4001,
148
- }
149
-
150
- result = Manifest.validate_values(manifest_valid_port)
151
- # Valid port should not have errors (might have warnings)
152
-
153
- # Invalid appName format
154
- manifest_bad_name = {
155
- 'appName': 'TestService', # Invalid: uppercase
156
- 'appType': 'backend',
157
- 'stack': 'user',
158
- 'port': 4001,
159
- }
160
-
161
- result = Manifest.validate_values(manifest_bad_name)
162
- assert_true(len(result.errors) > 0 or len(result.warnings) > 0,
163
- "Invalid appName format should produce error or warning")
164
-
165
- # Too many replicas
166
- manifest_many_replicas = {
167
- 'appName': 'test-service',
168
- 'appType': 'backend',
169
- 'stack': 'user',
170
- 'port': 4001,
171
- 'replicas': 10, # Exceeds max
172
- }
173
-
174
- result = Manifest.validate_values(manifest_many_replicas)
175
- # Should fail or warn
176
-
177
- print("✅ Value validation tests complete\n")
178
-
179
- # =============================================================================
180
- # TEST SUITE: Cross-Field Validation
181
- # =============================================================================
182
-
183
- def _test_cross_field_validation():
184
- """Test cross-field validation."""
185
- print("🔍 Testing cross-field validation...")
186
-
187
- # Frontend without backendName
188
- frontend_no_backend = {
189
- 'appName': 'test-frontend',
190
- 'appType': 'frontend',
191
- 'stack': 'user',
192
- 'port': 3000,
193
- # Missing backendName
194
- }
195
-
196
- result = Manifest.validate(frontend_no_backend, level='cross_field')
197
- assert_true(len(result.errors) > 0, "Frontend without backendName should fail")
198
-
199
- # Valid frontend
200
- frontend_valid = {
201
- 'appName': 'test-frontend',
202
- 'appType': 'frontend',
203
- 'stack': 'user',
204
- 'port': 3000,
205
- 'backendName': 'test-backend',
206
- }
207
-
208
- result = Manifest.validate(frontend_valid, level='cross_field')
209
- assert_true(len([e for e in result.errors if 'backendName' in str(e)]) == 0,
210
- "Valid frontend should not have backend errors")
211
-
212
- # Prisma without databaseName (warning)
213
- prisma_no_db = {
214
- 'appName': 'test-service',
215
- 'appType': 'backend',
216
- 'stack': 'user',
217
- 'port': 4001,
218
- 'featuresEnabled': ['prisma'],
219
- # Missing databaseName
220
- }
221
-
222
- result = Manifest.validate(prisma_no_db, level='cross_field')
223
- # Should have warning but not necessarily error
224
-
225
- print("✅ Cross-field validation tests complete\n")
226
-
227
- # =============================================================================
228
- # TEST SUITE: Cross-Service Validation
229
- # =============================================================================
230
-
231
- def _test_cross_resource_validation():
232
- """Test cross-service validation."""
233
- print("🔍 Testing cross-service validation...")
234
-
235
- # Create a set of manifests
236
- manifests = [
237
- {
238
- 'appName': 'identity-backend',
239
- 'appType': 'backend',
240
- 'stack': 'identity',
241
- 'port': 4004,
242
- },
243
- {
244
- 'appName': 'user-backend',
245
- 'appType': 'backend',
246
- 'stack': 'user',
247
- 'port': 4000,
248
- 'dependsOn': ['identity-backend'], # Valid
249
- },
250
- {
251
- 'appName': 'user-frontend',
252
- 'appType': 'frontend',
253
- 'stack': 'user',
254
- 'port': 3000,
255
- 'backendName': 'user-backend', # Valid
256
- },
257
- ]
258
-
259
- # Test valid dependency
260
- user_manifest = manifests[1]
261
- result = Manifest.validate_dependencies(user_manifest, manifests)
262
- assert_true(result.valid, "Valid dependency should pass")
263
-
264
- # Test invalid dependency
265
- bad_dep_manifest = {
266
- 'appName': 'bad-service',
267
- 'appType': 'backend',
268
- 'stack': 'user',
269
- 'port': 4002,
270
- 'dependsOn': ['nonexistent-service'], # Invalid
271
- }
272
-
273
- result = Manifest.validate_dependencies(bad_dep_manifest, manifests)
274
- assert_true(len(result.errors) > 0, "Invalid dependency should fail")
275
-
276
- # Test port conflict
277
- conflict_manifest = {
278
- 'appName': 'conflict-service',
279
- 'appType': 'backend',
280
- 'stack': 'user',
281
- 'port': 4000, # Same as user-backend
282
- }
283
-
284
- result = Manifest.validate_dependencies(conflict_manifest, manifests)
285
- assert_true(len(result.errors) > 0, "Port conflict should fail")
286
-
287
- # Test frontend with non-existent backend
288
- bad_frontend = {
289
- 'appName': 'bad-frontend',
290
- 'appType': 'frontend',
291
- 'stack': 'user',
292
- 'port': 3001,
293
- 'backendName': 'nonexistent-backend',
294
- }
295
-
296
- result = Manifest.validate_dependencies(bad_frontend, manifests)
297
- assert_true(len(result.errors) > 0, "Frontend with bad backend should fail")
298
-
299
- print("✅ Cross-service validation tests complete\n")
300
-
301
- # =============================================================================
302
- # TEST SUITE: Full Validation
303
- # =============================================================================
304
-
305
- def _test_full_validation():
306
- """Test full validation at all levels."""
307
- print("🔍 Testing full validation...")
308
-
309
- # Valid complete manifest
310
- valid_manifest = {
311
- 'appName': 'user-management-backend',
312
- 'appType': 'backend',
313
- 'stack': 'user',
314
- 'port': 4000,
315
- 'replicas': 1,
316
- 'runtime': 'bun',
317
- 'featuresEnabled': ['nats', 'prisma'],
318
- 'databaseName': 'Flisk_user',
319
- 'dependsOn': [],
320
- 'traefik': {
321
- 'pathPrefix': '/api/v1/users',
322
- 'priority': 100,
323
- },
324
- }
325
-
326
- result = Manifest.validate(valid_manifest, level='all')
327
-
328
- # Should be valid (may have warnings but no errors)
329
- assert_true(len([e for e in result.errors if e.severity == 'error' or e.severity == 'critical']) == 0,
330
- "Valid manifest should not have critical errors")
331
-
332
- # Check stats
333
- assert_true(result.stats['fields_checked'] > 0, "Should check fields")
334
-
335
- print("✅ Full validation tests complete\n")
336
-
337
- # =============================================================================
338
- # TEST SUITE: is_valid Convenience Function
339
- # =============================================================================
340
-
341
- def _test_is_valid():
342
- """Test the is_valid convenience function."""
343
- print("🔍 Testing is_valid function...")
344
-
345
- valid = {
346
- 'appName': 'test-service',
347
- 'appType': 'backend',
348
- 'stack': 'user',
349
- 'port': 4001,
350
- }
351
-
352
- result = Manifest.is_valid(valid)
353
- assert_true(result, "Valid manifest should return True from is_valid")
354
-
355
- invalid = {
356
- 'appType': 'backend', # Missing appName
357
- 'stack': 'user',
358
- 'port': 4001,
359
- }
360
-
361
- result = Manifest.is_valid(invalid)
362
- assert_true(not result, "Invalid manifest should return False from is_valid")
363
-
364
- print("✅ is_valid tests complete\n")
365
-
366
- # =============================================================================
367
- # TEST SUITE: Validation Report
368
- # =============================================================================
369
-
370
- def _test_validation_report():
371
- """Test validation report generation."""
372
- print("🔍 Testing validation report...")
373
-
374
- manifest = {
375
- 'appName': 'test-service',
376
- 'appType': 'backend',
377
- 'stack': 'user',
378
- 'port': 4001,
379
- }
380
-
381
- report = Manifest.get_validation_report(manifest)
382
-
383
- assert_not_none(report, "Report should be generated")
384
- assert_true('VALIDATION REPORT' in report, "Report should have title")
385
- assert_true('Status:' in report, "Report should have status")
386
-
387
- # Test with errors
388
- bad_manifest = {
389
- 'appType': 'backend', # Missing required fields
390
- 'stack': 'user',
391
- }
392
-
393
- report = Manifest.get_validation_report(bad_manifest)
394
- assert_true('FAILED' in report or 'failed' in report.lower(),
395
- "Report should show failure for invalid manifest")
396
-
397
- print("✅ Validation report tests complete\n")
398
-
399
- # =============================================================================
400
- # TEST SUITE: Strict Mode
401
- # =============================================================================
402
-
403
- def _test_strict_mode():
404
- """Test strict mode (warnings as errors)."""
405
- print("🔍 Testing strict mode...")
406
-
407
- # Manifest with warnings
408
- manifest = {
409
- 'appName': 'test-service',
410
- 'appType': 'frontend',
411
- 'stack': 'user',
412
- 'port': 3000,
413
- 'backendName': 'test-backend',
414
- # Missing basePath - might cause warning
415
- }
416
-
417
- # Normal mode
418
- result_normal = Manifest.validate(manifest, level='all')
419
-
420
- # Strict mode
421
- result_strict = Manifest.validate(manifest, context={'strict': True}, level='all')
422
-
423
- # In strict mode, warnings should be converted to errors
424
- # (This depends on specific validation rules that generate warnings)
425
-
426
- print("✅ Strict mode tests complete\n")
427
-
428
- # =============================================================================
429
- # MAIN
430
- # =============================================================================
431
-
432
- def run_tests():
433
- """Run all Phase 3 validator tests."""
434
- print("\n" + "="*70)
435
- print("📋 MANIFEST MODULE - PHASE 3 VALIDATOR TESTS")
436
- print("="*70 + "\n")
437
-
438
- # Run all test suites
439
- _test_validator_functions()
440
- _test_schema_validation()
441
- _test_value_validation()
442
- _test_cross_field_validation()
443
- _test_cross_resource_validation()
444
- _test_full_validation()
445
- _test_is_valid()
446
- _test_validation_report()
447
- _test_strict_mode()
448
-
449
- # Print results
450
- print("\n" + "="*70)
451
- print("📊 TEST RESULTS")
452
- print("="*70)
453
- print("✅ Passed: {}".format(test_results['passed']))
454
- print("❌ Failed: {}".format(test_results['failed']))
455
-
456
- if test_results['errors']:
457
- print("\n📝 ERRORS:")
458
- for error in test_results['errors']:
459
- print(" " + error)
460
- else:
461
- print("\n🎉 All Phase 3 validator tests passed!")
462
-
463
- print("="*70 + "\n")
464
-
465
- return test_results['failed'] == 0
466
-
467
- # Export test runner
468
- TestValidator = struct(
469
- run=run_tests,
470
- )
471
-
472
- VALIDATION = {}