@native-sdk/cli 0.8.3 → 0.9.0
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/build/app.zig +905 -61
- package/build.zig +674 -373
- package/build.zig.zon +1 -0
- package/native-sdk.d.ts +6 -0
- package/package.json +12 -11
- package/packages/core/compile-surface/core.ts +455 -3
- package/packages/core/package-lock.json +11 -11
- package/packages/core/package.json +2 -2
- package/packages/core/scripts/compiler_typecheck.mjs +116 -15
- package/packages/core/scripts/gen_service_surface.mjs +268 -0
- package/packages/core/scripts/npm_static_spike.mjs +64 -0
- package/packages/core/scripts/run_external_core_compiler.mjs +77 -6
- package/packages/core/scripts/run_external_service_compiler.mjs +240 -0
- package/packages/core/scripts/stage_external_core.mjs +9 -1
- package/packages/core/scripts/stage_external_services.mjs +172 -0
- package/packages/core/scripts/surface_manifest_diff.mjs +253 -0
- package/packages/core/scripts/vendor_service_packages.mjs +189 -0
- package/packages/core/sdk/core.d.ts +214 -2
- package/packages/core/sdk/core.ts +715 -42
- package/packages/core/sdk/events.d.ts +50 -0
- package/packages/core/sdk/events.ts +75 -0
- package/packages/core/src/checker.ts +528 -15
- package/packages/core/src/cli.ts +143 -3
- package/packages/core/src/contract.ts +26 -5
- package/packages/core/src/devhost.ts +1849 -18
- package/packages/core/src/devhost_journal.mjs +181 -0
- package/packages/core/src/devhost_resolver.mjs +17 -1
- package/packages/core/src/devhost_service_worker.mjs +90 -0
- package/packages/core/src/diagnostics.ts +84 -18
- package/packages/core/src/frontend.ts +204 -34
- package/packages/core/src/modules.ts +129 -80
- package/packages/core/src/service_contract.ts +597 -0
- package/packages/core/src/sqlite_cli.ts +93 -0
- package/packages/core/src/sqlite_codegen.ts +806 -0
- package/packages/core/src/sqlite_runtime_policy.ts +364 -0
- package/packages/core/src/typed_ast.ts +36 -8
- package/skill-data/core/SKILL.md +4 -2
- package/skill-data/core/references/project-anatomy.md +3 -2
- package/skill-data/core/references/web-engines-packaging-debugging.md +3 -1
- package/skill-data/native-ui/SKILL.md +55 -8
- package/skill-data/ts-core/SKILL.md +92 -40
- package/skill-data/ts-services/SKILL.md +126 -0
- package/skill-data/ts-services/references/service-surface.md +603 -0
- package/skill-data/zig/SKILL.md +1 -1
- package/skills/native-sdk/SKILL.md +1 -1
- package/src/app_runner/no_migrations.zig +3 -0
- package/src/app_runner/no_services.zig +20 -0
- package/src/app_runner/root.zig +104 -4
- package/src/app_runner/ts_core_main.zig +268 -4
- package/src/automation/snapshot.zig +23 -5
- package/src/embed/app_exports.zig +11 -1
- package/src/embed/c_api.zig +48 -2
- package/src/embed/conversions.zig +4 -5
- package/src/embed/host.zig +115 -1
- package/src/embed/root.zig +7 -0
- package/src/embed/tests.zig +213 -0
- package/src/embed/types.zig +51 -0
- package/src/embed/ui_host.zig +121 -5
- package/src/platform/android/NativeSdkActivity.java +131 -0
- package/src/platform/android/android_host.c +182 -1
- package/src/platform/android/native_sdk_app.h +17 -0
- package/src/platform/ios/native_sdk_app.h +17 -0
- package/src/platform/ios/uikit_host.m +115 -0
- package/src/platform/linux/cef_host.cpp +1 -1
- package/src/platform/linux/gtk_host.c +89 -17
- package/src/platform/linux/gtk_host.h +3 -0
- package/src/platform/linux/root.zig +41 -18
- package/src/platform/macos/appkit_host.h +26 -3
- package/src/platform/macos/appkit_host.m +1051 -129
- package/src/platform/macos/capture_info_plist.c +25 -0
- package/src/platform/macos/cef_host.mm +270 -36
- package/src/platform/macos/root.zig +312 -34
- package/src/platform/null_platform.zig +281 -19
- package/src/platform/null_platform_tests.zig +74 -0
- package/src/platform/root.zig +16 -0
- package/src/platform/types.zig +279 -15
- package/src/platform/windows/root.zig +243 -21
- package/src/platform/windows/webview2_host.cpp +464 -46
- package/src/primitives/app_manifest/comptime_scene.zig +2 -0
- package/src/primitives/app_manifest/root.zig +4 -0
- package/src/primitives/app_manifest/tests.zig +3 -0
- package/src/primitives/app_manifest/types.zig +34 -0
- package/src/primitives/app_manifest/validation.zig +19 -1
- package/src/primitives/canvas/code_tests.zig +9 -9
- package/src/primitives/canvas/events.zig +12 -11
- package/src/primitives/canvas/frame.zig +44 -9
- package/src/primitives/canvas/icons/mic.svg +1 -0
- package/src/primitives/canvas/icons.zig +2 -0
- package/src/primitives/canvas/root.zig +8 -0
- package/src/primitives/canvas/text_span_tests.zig +39 -0
- package/src/primitives/canvas/ui.zig +23 -4
- package/src/primitives/canvas/ui_markup.zig +15 -0
- package/src/primitives/canvas/ui_markup_compiled.zig +9 -0
- package/src/primitives/canvas/ui_markup_compiled_tests.zig +1 -1
- package/src/primitives/canvas/ui_markup_tests.zig +5 -0
- package/src/primitives/canvas/ui_markup_view.zig +9 -0
- package/src/primitives/canvas/ui_markup_view_tests.zig +9 -6
- package/src/primitives/canvas/ui_schema.zig +19 -10
- package/src/primitives/canvas/ui_schema_tests.zig +5 -3
- package/src/primitives/canvas/ui_tests.zig +18 -4
- package/src/primitives/canvas/widget_invalidation.zig +9 -2
- package/src/primitives/canvas/widget_render.zig +296 -114
- package/src/primitives/canvas/widget_runtime_tests.zig +133 -0
- package/src/primitives/canvas/widget_text_input.zig +10 -10
- package/src/primitives/canvas/widget_tree.zig +1 -1
- package/src/primitives/canvas/widgets.zig +29 -5
- package/src/root.zig +56 -0
- package/src/runtime/api.zig +11 -0
- package/src/runtime/automation_snapshot.zig +4 -0
- package/src/runtime/automation_widget_dispatch.zig +1 -0
- package/src/runtime/bridge_payload.zig +2 -0
- package/src/runtime/bridge_permission_tests.zig +23 -2
- package/src/runtime/bridge_responses.zig +3 -1
- package/src/runtime/canvas_frame.zig +31 -13
- package/src/runtime/canvas_frame_animation_tests.zig +4 -0
- package/src/runtime/canvas_frame_invalidation_tests.zig +35 -10
- package/src/runtime/canvas_widget_anchored_tests.zig +83 -0
- package/src/runtime/canvas_widget_events.zig +69 -24
- package/src/runtime/canvas_widget_runtime.zig +101 -6
- package/src/runtime/canvas_widget_scroll_driver_tests.zig +47 -4
- package/src/runtime/canvas_widget_scroll_drivers.zig +3 -3
- package/src/runtime/canvas_widget_semantics_tests.zig +2 -0
- package/src/runtime/canvas_widget_split_tree_tests.zig +228 -0
- package/src/runtime/canvas_widget_state.zig +6 -1
- package/src/runtime/canvas_widget_text_tests.zig +112 -3
- package/src/runtime/clock.zig +13 -1
- package/src/runtime/core.zig +133 -1
- package/src/runtime/credentials_store.zig +115 -0
- package/src/runtime/effects.zig +2568 -75
- package/src/runtime/effects_audio_capture_tests.zig +251 -0
- package/src/runtime/effects_credentials_tests.zig +332 -0
- package/src/runtime/effects_host_tests.zig +208 -1
- package/src/runtime/effects_relational_tests.zig +314 -0
- package/src/runtime/effects_store_tests.zig +211 -0
- package/src/runtime/flow.zig +14 -1
- package/src/runtime/gpu_surface_events.zig +6 -1
- package/src/runtime/native_command_event_tests.zig +42 -0
- package/src/runtime/persist_store.zig +666 -0
- package/src/runtime/record_store.zig +788 -0
- package/src/runtime/relational_store.zig +854 -0
- package/src/runtime/root.zig +52 -0
- package/src/runtime/runtime_event_tests.zig +70 -0
- package/src/runtime/service_host.zig +711 -0
- package/src/runtime/service_pool.zig +1314 -0
- package/src/runtime/session_blobs.zig +1 -1
- package/src/runtime/session_journal.zig +102 -0
- package/src/runtime/session_record.zig +177 -0
- package/src/runtime/session_replay.zig +109 -4
- package/src/runtime/shell_layout.zig +1 -0
- package/src/runtime/shell_layout_tests.zig +120 -0
- package/src/runtime/sqlite_engine.zig +474 -0
- package/src/runtime/state.zig +6 -0
- package/src/runtime/system_services.zig +49 -10
- package/src/runtime/tests.zig +5 -0
- package/src/runtime/ts_core_host.zig +1189 -118
- package/src/runtime/ts_core_host_tests.zig +638 -11
- package/src/runtime/ts_ui_app.zig +537 -1
- package/src/runtime/ui_app.zig +160 -19
- package/src/runtime/ui_app_tests.zig +203 -5
- package/src/runtime/validation.zig +22 -0
- package/src/runtime/view.zig +11 -0
- package/src/runtime/view_widget_scroll.zig +56 -5
- package/src/runtime/view_widget_text.zig +24 -5
- package/src/runtime/view_widget_tree.zig +1 -1
- package/src/runtime/window_storage.zig +1 -0
- package/src/runtime/window_view_runtime.zig +2 -3
- package/src/runtime/window_views.zig +19 -0
- package/src/tooling/android.zig +21 -16
- package/src/tooling/db.zig +160 -0
- package/src/tooling/ios.zig +7 -1
- package/src/tooling/manifest.zig +1248 -2
- package/src/tooling/package.zig +953 -6
- package/src/tooling/raw_manifest.zig +65 -0
- package/src/tooling/root.zig +1 -0
- package/src/tooling/templates.zig +216 -4
- package/src/tooling/ts_core.zig +283 -17
- package/src/tooling/verbs.zig +7 -0
- package/third_party/sqlite/README.md +13 -0
- package/third_party/sqlite/sqlite3.c +269649 -0
- package/third_party/sqlite/sqlite3.h +14349 -0
- package/tools/corewire/core_abi.zig +14 -2
- package/tools/corewire/emit.zig +98 -29
- package/tools/corewire/emit_facade.zig +414 -23
- package/tools/corewire/emit_profile.zig +6 -2
- package/tools/corewire/emit_service.zig +924 -0
- package/tools/corewire/main.zig +122 -0
- package/tools/corewire/service_contract.zig +250 -0
- package/tools/corewire/sidecar.zig +26 -15
package/build.zig
CHANGED
|
@@ -43,6 +43,60 @@ pub const MobileLibOptions = @import("build/app.zig").MobileLibOptions;
|
|
|
43
43
|
pub const addMobileLib = @import("build/app.zig").addMobileLib;
|
|
44
44
|
const mobile_export_symbol_names = @import("build/app.zig").mobile_export_symbol_names;
|
|
45
45
|
|
|
46
|
+
test "service archive support matches ScriptC localized object formats" {
|
|
47
|
+
const app_build = @import("build/app.zig");
|
|
48
|
+
const host = @import("builtin").target;
|
|
49
|
+
const resolved = struct {
|
|
50
|
+
fn target(os: std.Target.Os.Tag, arch: std.Target.Cpu.Arch, abi: std.Target.Abi) std.Build.ResolvedTarget {
|
|
51
|
+
var result = host;
|
|
52
|
+
result.os.tag = os;
|
|
53
|
+
result.cpu.arch = arch;
|
|
54
|
+
result.abi = abi;
|
|
55
|
+
return .{
|
|
56
|
+
.query = .{ .os_tag = os, .cpu_arch = arch, .abi = abi },
|
|
57
|
+
.result = result,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
}.target;
|
|
61
|
+
|
|
62
|
+
var macos_host = host;
|
|
63
|
+
macos_host.os.tag = .macos;
|
|
64
|
+
macos_host.cpu.arch = .aarch64;
|
|
65
|
+
macos_host.abi = .none;
|
|
66
|
+
try std.testing.expect(app_build.serviceArchiveSupported(macos_host, resolved(.windows, .x86_64, .gnu)));
|
|
67
|
+
try std.testing.expect(!app_build.serviceArchiveSupported(macos_host, resolved(.windows, .x86_64, .msvc)));
|
|
68
|
+
try std.testing.expect(!app_build.serviceArchiveSupported(macos_host, resolved(.windows, .aarch64, .gnu)));
|
|
69
|
+
try std.testing.expect(app_build.serviceArchiveSupported(macos_host, resolved(.linux, .x86_64, .musl)));
|
|
70
|
+
try std.testing.expect(app_build.serviceArchiveSupported(macos_host, resolved(.linux, .aarch64, .musl)));
|
|
71
|
+
try std.testing.expect(!app_build.serviceArchiveSupported(macos_host, resolved(.linux, .riscv64, .musl)));
|
|
72
|
+
try std.testing.expect(app_build.serviceArchiveSupported(macos_host, resolved(.macos, .x86_64, .none)));
|
|
73
|
+
|
|
74
|
+
var linux_host = host;
|
|
75
|
+
linux_host.os.tag = .linux;
|
|
76
|
+
linux_host.cpu.arch = .riscv64;
|
|
77
|
+
linux_host.abi = .musl;
|
|
78
|
+
try std.testing.expect(app_build.serviceArchiveSupported(linux_host, .{ .query = .{}, .result = linux_host }));
|
|
79
|
+
try std.testing.expect(!app_build.serviceArchiveSupported(linux_host, resolved(.macos, .aarch64, .none)));
|
|
80
|
+
|
|
81
|
+
var gnu_linux_host = host;
|
|
82
|
+
gnu_linux_host.os.tag = .linux;
|
|
83
|
+
gnu_linux_host.cpu.arch = .x86_64;
|
|
84
|
+
gnu_linux_host.abi = .gnu;
|
|
85
|
+
const explicit_same_triple_gnu = resolved(.linux, .x86_64, .gnu);
|
|
86
|
+
try std.testing.expect(!app_build.scriptcTargetIsCross(gnu_linux_host, explicit_same_triple_gnu));
|
|
87
|
+
try std.testing.expect(app_build.linuxGlibcSpellingHitsDefaultFloor(explicit_same_triple_gnu));
|
|
88
|
+
try std.testing.expect(!app_build.linuxGlibcSpellingHitsDefaultFloor(.{ .query = .{}, .result = gnu_linux_host }));
|
|
89
|
+
|
|
90
|
+
var windows_host = host;
|
|
91
|
+
windows_host.os.tag = .windows;
|
|
92
|
+
windows_host.cpu.arch = .x86_64;
|
|
93
|
+
windows_host.abi = .gnu;
|
|
94
|
+
const native_windows_msvc = resolved(.windows, .x86_64, .msvc);
|
|
95
|
+
try std.testing.expect(!app_build.scriptcTargetIsCross(windows_host, native_windows_msvc));
|
|
96
|
+
try std.testing.expect(app_build.scriptcCompileSupported(windows_host, native_windows_msvc));
|
|
97
|
+
try std.testing.expect(app_build.serviceArchiveSupported(windows_host, native_windows_msvc));
|
|
98
|
+
}
|
|
99
|
+
|
|
46
100
|
pub fn build(b: *std.Build) void {
|
|
47
101
|
const target = b.standardTargetOptions(.{});
|
|
48
102
|
const host_target = b.graph.host;
|
|
@@ -141,9 +195,28 @@ pub fn build(b: *std.Build) void {
|
|
|
141
195
|
desktop_mod.addImport("json", json_mod);
|
|
142
196
|
desktop_mod.addImport("canvas", canvas_mod);
|
|
143
197
|
desktop_mod.addImport("terminal_vt", terminalVtModule(b, target, optimize));
|
|
198
|
+
desktop_mod.addIncludePath(b.path("third_party/sqlite"));
|
|
199
|
+
desktop_mod.addCSourceFile(.{
|
|
200
|
+
.file = b.path("third_party/sqlite/sqlite3.c"),
|
|
201
|
+
.flags = sqliteCompileFlags(),
|
|
202
|
+
});
|
|
203
|
+
desktop_mod.link_libc = true;
|
|
144
204
|
const desktop_tests = testArtifact(b, desktop_mod);
|
|
145
205
|
const desktop_test_shards = desktopTestShardArtifacts(b, desktop_mod);
|
|
146
206
|
|
|
207
|
+
// SQLite is capability-shed from ordinary app artifacts. Its focused
|
|
208
|
+
// engine/store suite gets a dedicated module that explicitly compiles the
|
|
209
|
+
// vendored amalgamation, so framework tests cover it without making every
|
|
210
|
+
// unrelated example carry the database object.
|
|
211
|
+
const record_store_mod = module(b, target, optimize, "src/runtime/record_store.zig");
|
|
212
|
+
record_store_mod.addIncludePath(b.path("third_party/sqlite"));
|
|
213
|
+
record_store_mod.addCSourceFile(.{
|
|
214
|
+
.file = b.path("third_party/sqlite/sqlite3.c"),
|
|
215
|
+
.flags = sqliteCompileFlags(),
|
|
216
|
+
});
|
|
217
|
+
record_store_mod.link_libc = true;
|
|
218
|
+
const record_store_tests = testArtifact(b, record_store_mod);
|
|
219
|
+
|
|
147
220
|
// The embeddable static library's root module carries only the C ABI
|
|
148
221
|
// exports (fixed WebView shell host); user-app canvas libraries are
|
|
149
222
|
// produced by `addMobileLib` from src/embed/app_exports.zig instead.
|
|
@@ -188,6 +261,13 @@ pub fn build(b: *std.Build) void {
|
|
|
188
261
|
tooling_mod.addImport("app_icon", app_icon_mod);
|
|
189
262
|
tooling_mod.addImport("ios_host", ios_host_mod);
|
|
190
263
|
tooling_mod.addImport("android_host", android_host_mod);
|
|
264
|
+
tooling_mod.addImport("sqlite_engine", module(b, target, optimize, "src/runtime/sqlite_engine.zig"));
|
|
265
|
+
tooling_mod.addIncludePath(b.path("third_party/sqlite"));
|
|
266
|
+
tooling_mod.addCSourceFile(.{
|
|
267
|
+
.file = b.path("third_party/sqlite/sqlite3.c"),
|
|
268
|
+
.flags = sqliteCompileFlags(),
|
|
269
|
+
});
|
|
270
|
+
tooling_mod.link_libc = true;
|
|
191
271
|
const tooling_tests = testArtifact(b, tooling_mod);
|
|
192
272
|
|
|
193
273
|
// Ejected-component identity proofs: a separate test module because
|
|
@@ -209,6 +289,8 @@ pub fn build(b: *std.Build) void {
|
|
|
209
289
|
const corewire_emit_tests = testArtifact(b, module(b, target, optimize, "tools/corewire/emit.zig"));
|
|
210
290
|
const corewire_facade_tests = testArtifact(b, module(b, target, optimize, "tools/corewire/emit_facade.zig"));
|
|
211
291
|
const corewire_profile_tests = testArtifact(b, module(b, target, optimize, "tools/corewire/emit_profile.zig"));
|
|
292
|
+
const corewire_service_contract_tests = testArtifact(b, module(b, target, optimize, "tools/corewire/service_contract.zig"));
|
|
293
|
+
const corewire_service_emit_tests = testArtifact(b, module(b, target, optimize, "tools/corewire/emit_service.zig"));
|
|
212
294
|
const corewire_shim_rt_tests = testArtifact(b, module(b, target, optimize, "tools/corewire/shim_rt.zig"));
|
|
213
295
|
|
|
214
296
|
// TypeScript-core end-to-end suite: each fixture core is compiled
|
|
@@ -245,6 +327,7 @@ pub fn build(b: *std.Build) void {
|
|
|
245
327
|
// where the failure reads as the graded app's, not the tooling's.
|
|
246
328
|
const evals_cmdview_mod = module(b, target, optimize, "evals/harness-lib/cmdview.zig");
|
|
247
329
|
const evals_cmdview_tests = testArtifact(b, evals_cmdview_mod);
|
|
330
|
+
const build_graph_tests = testArtifact(b, module(b, host_target, optimize, "build.zig"));
|
|
248
331
|
|
|
249
332
|
// `native version` names the commit the binary was built from, so
|
|
250
333
|
// binary/framework skew ("your native binary may be stale") is a
|
|
@@ -298,6 +381,13 @@ pub fn build(b: *std.Build) void {
|
|
|
298
381
|
host_tooling_mod.addImport("app_icon", host_app_icon_mod);
|
|
299
382
|
host_tooling_mod.addImport("ios_host", host_ios_host_mod);
|
|
300
383
|
host_tooling_mod.addImport("android_host", host_android_host_mod);
|
|
384
|
+
host_tooling_mod.addImport("sqlite_engine", module(b, host_target, optimize, "src/runtime/sqlite_engine.zig"));
|
|
385
|
+
host_tooling_mod.addIncludePath(b.path("third_party/sqlite"));
|
|
386
|
+
host_tooling_mod.addCSourceFile(.{
|
|
387
|
+
.file = b.path("third_party/sqlite/sqlite3.c"),
|
|
388
|
+
.flags = sqliteCompileFlags(),
|
|
389
|
+
});
|
|
390
|
+
host_tooling_mod.link_libc = true;
|
|
301
391
|
const host_ui_markup_mod = module(b, host_target, optimize, "src/primitives/canvas/ui_markup.zig");
|
|
302
392
|
const host_markup_lsp_mod = module(b, host_target, optimize, "tools/native-sdk/markup_lsp.zig");
|
|
303
393
|
host_markup_lsp_mod.addImport("ui_markup", host_ui_markup_mod);
|
|
@@ -462,6 +552,7 @@ pub fn build(b: *std.Build) void {
|
|
|
462
552
|
};
|
|
463
553
|
|
|
464
554
|
const test_step = b.step("test", "Run package and framework tests");
|
|
555
|
+
test_step.dependOn(&b.addRunArtifact(build_graph_tests).step);
|
|
465
556
|
test_step.dependOn(&b.addRunArtifact(geometry_tests).step);
|
|
466
557
|
test_step.dependOn(&b.addRunArtifact(assets_tests).step);
|
|
467
558
|
test_step.dependOn(&b.addRunArtifact(app_dirs_tests).step);
|
|
@@ -472,6 +563,7 @@ pub fn build(b: *std.Build) void {
|
|
|
472
563
|
test_step.dependOn(&b.addRunArtifact(json_tests).step);
|
|
473
564
|
test_step.dependOn(&b.addRunArtifact(app_runner_assets_tests).step);
|
|
474
565
|
test_step.dependOn(&b.addRunArtifact(canvas_tests).step);
|
|
566
|
+
test_step.dependOn(&b.addRunArtifact(record_store_tests).step);
|
|
475
567
|
for (desktop_test_shards) |shard_tests| {
|
|
476
568
|
test_step.dependOn(&b.addRunArtifact(shard_tests).step);
|
|
477
569
|
}
|
|
@@ -482,10 +574,14 @@ pub fn build(b: *std.Build) void {
|
|
|
482
574
|
test_step.dependOn(&b.addRunArtifact(corewire_emit_tests).step);
|
|
483
575
|
test_step.dependOn(&b.addRunArtifact(corewire_facade_tests).step);
|
|
484
576
|
test_step.dependOn(&b.addRunArtifact(corewire_profile_tests).step);
|
|
577
|
+
test_step.dependOn(&b.addRunArtifact(corewire_service_contract_tests).step);
|
|
578
|
+
test_step.dependOn(&b.addRunArtifact(corewire_service_emit_tests).step);
|
|
485
579
|
test_step.dependOn(&b.addRunArtifact(corewire_shim_rt_tests).step);
|
|
580
|
+
const ts_services_e2e_step = b.step("test-ts-services-e2e", "Run both TypeScript service carriers end to end: the out-of-process child (crash recovery, timeout, replay) and the in-process pool (parallel keys, FIFO, trap isolation, replay)");
|
|
486
581
|
if (ts_core_e2e_tests) |ts_core_artifacts| {
|
|
487
582
|
const ts_core_e2e_step = b.step("test-ts-core-e2e", "Run the TypeScript-core end-to-end suites over externally compiled fixture cores (requires node and `npm ci` in packages/core)");
|
|
488
583
|
const host_e2e_run = b.addRunArtifact(ts_core_artifacts.host);
|
|
584
|
+
const persist_e2e_run = b.addRunArtifact(ts_core_artifacts.persist);
|
|
489
585
|
const markup_e2e_run = b.addRunArtifact(ts_core_artifacts.markup);
|
|
490
586
|
const kanban_e2e_run = b.addRunArtifact(ts_core_artifacts.kanban);
|
|
491
587
|
const soundboard_e2e_run = b.addRunArtifact(ts_core_artifacts.soundboard);
|
|
@@ -495,6 +591,30 @@ pub fn build(b: *std.Build) void {
|
|
|
495
591
|
// no build inputs/outputs to hash, so always run it.
|
|
496
592
|
scaffold_ide_e2e_run.has_side_effects = true;
|
|
497
593
|
const ai_chat_e2e_run = b.addRunArtifact(ts_core_artifacts.ai_chat);
|
|
594
|
+
const services_e2e_run = b.addRunArtifact(ts_core_artifacts.services);
|
|
595
|
+
ts_services_e2e_step.dependOn(&services_e2e_run.step);
|
|
596
|
+
// The same fixture through the in-process carrier (ServicePool over
|
|
597
|
+
// the linked service archive): parallel keys, per-key FIFO,
|
|
598
|
+
// cooperative cancellation/deadlines, trap isolation, streaming,
|
|
599
|
+
// and replay without initializing the archive.
|
|
600
|
+
const services_pool_e2e_run: ?*std.Build.Step.Run = if (ts_core_artifacts.services_pool) |pool_tests| pool: {
|
|
601
|
+
const run = b.addRunArtifact(pool_tests);
|
|
602
|
+
ts_services_e2e_step.dependOn(&run.step);
|
|
603
|
+
break :pool run;
|
|
604
|
+
} else null;
|
|
605
|
+
// Service carrier benchmark: cold start, warm round-trip latency
|
|
606
|
+
// for small and large payloads, and queued throughput, through the
|
|
607
|
+
// production carrier bindings of BOTH carriers — the out-of-process
|
|
608
|
+
// child and the in-process pool — against one bytes-echo service
|
|
609
|
+
// (see tools/bench_service_host.zig).
|
|
610
|
+
const bench_service_host_run = b.addRunArtifact(ts_core_artifacts.service_host_bench);
|
|
611
|
+
bench_service_host_run.has_side_effects = true;
|
|
612
|
+
// Repo root as cwd so the generated service executable path and the
|
|
613
|
+
// benchmark's scratch directory resolve regardless of where
|
|
614
|
+
// `zig build` ran from.
|
|
615
|
+
bench_service_host_run.setCwd(b.path("."));
|
|
616
|
+
const bench_service_host_step = b.step("bench-service-host", "Run the service carrier benchmark over both carriers (cold start, round-trip latency, queued throughput; requires node and `npm ci` in packages/core; pass -Doptimize=ReleaseFast for baselines)");
|
|
617
|
+
bench_service_host_step.dependOn(&bench_service_host_run.step);
|
|
498
618
|
const sidecar_conformance_run = b.addRunArtifact(ts_core_artifacts.sidecar_conformance);
|
|
499
619
|
const sidecar_conformance_step = b.step("sidecar-conformance", "Validate corewire-generated mirrors over every fixture's frontend-emitted contract (requires node)");
|
|
500
620
|
sidecar_conformance_step.dependOn(&sidecar_conformance_run.step);
|
|
@@ -505,6 +625,19 @@ pub fn build(b: *std.Build) void {
|
|
|
505
625
|
const abi_laws_step = b.step("test-external-core-abi", "Run the compiled-core ABI-law suite over the markup fixture's archive (requires node and `npm ci` in packages/core)");
|
|
506
626
|
abi_laws_step.dependOn(&abi_laws_run.step);
|
|
507
627
|
test_step.dependOn(&abi_laws_run.step);
|
|
628
|
+
// The cross-execution battery staging: the host-fixture and
|
|
629
|
+
// markup batteries (update/snapshot/effects and the markup view
|
|
630
|
+
// over genuinely compiled cores) plus, where the target admits
|
|
631
|
+
// the in-process archive, the service pool battery, installed
|
|
632
|
+
// under <prefix>/e2e for execution on the target machine. Pair
|
|
633
|
+
// with -Dtarget and -p; scripts/cross-e2e.sh is the driver.
|
|
634
|
+
const cross_e2e_step = b.step("stage-cross-e2e", "Install the TS-core e2e batteries under <prefix>/e2e for execution on the build target (pair with -Dtarget and -p; see scripts/cross-e2e.sh)");
|
|
635
|
+
const e2e_dir: std.Build.Step.InstallArtifact.Options.Dir = .{ .override = .{ .custom = "e2e" } };
|
|
636
|
+
cross_e2e_step.dependOn(&b.addInstallArtifact(ts_core_artifacts.host, .{ .dest_dir = e2e_dir }).step);
|
|
637
|
+
cross_e2e_step.dependOn(&b.addInstallArtifact(ts_core_artifacts.markup, .{ .dest_dir = e2e_dir }).step);
|
|
638
|
+
if (ts_core_artifacts.services_pool) |pool_tests| {
|
|
639
|
+
cross_e2e_step.dependOn(&b.addInstallArtifact(pool_tests, .{ .dest_dir = e2e_dir }).step);
|
|
640
|
+
}
|
|
508
641
|
// The corpus contract artifacts an external core toolchain
|
|
509
642
|
// consumes: per fixture, the frontend-emitted contract sidecar
|
|
510
643
|
// (after projection), the generated entry module, and the
|
|
@@ -517,19 +650,25 @@ pub fn build(b: *std.Build) void {
|
|
|
517
650
|
contracts_step.dependOn(&b.addInstallFileWithDir(contract.profile, dir, "core_profile.json").step);
|
|
518
651
|
}
|
|
519
652
|
ts_core_e2e_step.dependOn(&host_e2e_run.step);
|
|
653
|
+
ts_core_e2e_step.dependOn(&persist_e2e_run.step);
|
|
520
654
|
ts_core_e2e_step.dependOn(&markup_e2e_run.step);
|
|
521
655
|
ts_core_e2e_step.dependOn(&kanban_e2e_run.step);
|
|
522
656
|
ts_core_e2e_step.dependOn(&soundboard_e2e_run.step);
|
|
523
657
|
ts_core_e2e_step.dependOn(&monitor_e2e_run.step);
|
|
524
658
|
ts_core_e2e_step.dependOn(&scaffold_ide_e2e_run.step);
|
|
525
659
|
ts_core_e2e_step.dependOn(&ai_chat_e2e_run.step);
|
|
660
|
+
ts_core_e2e_step.dependOn(&services_e2e_run.step);
|
|
661
|
+
if (services_pool_e2e_run) |run| ts_core_e2e_step.dependOn(&run.step);
|
|
526
662
|
test_step.dependOn(&host_e2e_run.step);
|
|
663
|
+
test_step.dependOn(&persist_e2e_run.step);
|
|
527
664
|
test_step.dependOn(&markup_e2e_run.step);
|
|
528
665
|
test_step.dependOn(&kanban_e2e_run.step);
|
|
529
666
|
test_step.dependOn(&soundboard_e2e_run.step);
|
|
530
667
|
test_step.dependOn(&monitor_e2e_run.step);
|
|
531
668
|
test_step.dependOn(&scaffold_ide_e2e_run.step);
|
|
532
669
|
test_step.dependOn(&ai_chat_e2e_run.step);
|
|
670
|
+
test_step.dependOn(&services_e2e_run.step);
|
|
671
|
+
if (services_pool_e2e_run) |run| test_step.dependOn(&run.step);
|
|
533
672
|
test_step.dependOn(&sidecar_conformance_run.step);
|
|
534
673
|
}
|
|
535
674
|
test_step.dependOn(&b.addRunArtifact(markup_lsp_tests).step);
|
|
@@ -604,6 +743,28 @@ pub fn build(b: *std.Build) void {
|
|
|
604
743
|
.{ .path = "build/app.zig", .pattern = "npm ci --include=dev" },
|
|
605
744
|
.{ .path = "build/app.zig", .pattern = "cannot resolve its TypeScript toolchain" },
|
|
606
745
|
.{ .path = "build/app.zig", .pattern = "std.process.exit(1);" },
|
|
746
|
+
// SQLite schema generation shares node/toolchain resolution but
|
|
747
|
+
// never the TS-core-only src/app.native shape assertion: Zig cores
|
|
748
|
+
// may own their view in code while still embedding migrations.
|
|
749
|
+
.{ .path = "build/app.zig", .pattern = "return tsToolingPreflight(b, dep, .app_core);" },
|
|
750
|
+
.{ .path = "build/app.zig", .pattern = "const node = tsToolingPreflight(b, dep, .sqlite_schema);" },
|
|
751
|
+
});
|
|
752
|
+
addFileContainsCheckStep(b, file_contains_checker, test_step, "test-scriptc-pin-cache-inputs", "Verify both TypeScript service build graphs invalidate frontend contracts when the exact scriptc pin changes", &.{
|
|
753
|
+
.{ .path = "build.zig", .pattern = "if (spec.emit_services) check.addFileInput(b.path(\"packages/core/package.json\"));" },
|
|
754
|
+
.{ .path = "build/app.zig", .pattern = "if (has_services) check.addFileInput(dep.path(\"packages/core/package.json\"));" },
|
|
755
|
+
});
|
|
756
|
+
addFileContainsCheckStep(b, file_contains_checker, test_step, "test-scriptc-cross-target-plumbing", "Verify core and service archives share the target-aware ScriptC lane, and every direct Windows archive consumer links its runtime import libraries", &.{
|
|
757
|
+
.{ .path = "build/app.zig", .pattern = ".linux => !cross or target.result.cpu.arch == .x86_64 or target.result.cpu.arch == .aarch64" },
|
|
758
|
+
.{ .path = "build/app.zig", .pattern = ".windows => !cross or target.result.abi == .gnu" },
|
|
759
|
+
.{ .path = "build/app.zig", .pattern = ".windows => target.result.cpu.arch == .x86_64" },
|
|
760
|
+
.{ .path = "build/app.zig", .pattern = "if (linuxGlibcSpellingHitsDefaultFloor(target)) {" },
|
|
761
|
+
.{ .path = "build.zig", .pattern = "if (!app_build.linuxGlibcSpellingHitsDefaultFloor(target)) return;" },
|
|
762
|
+
.{ .path = "build/app.zig", .pattern = "scriptcPlatformTriple(b, target),\n // Keep the core and service archives on the same cross compiler" },
|
|
763
|
+
.{ .path = "build.zig", .pattern = "app_build.scriptcPlatformTriple(b, target),\n \"--zig-exe\",\n b.graph.zig_exe," },
|
|
764
|
+
.{ .path = "build.zig", .pattern = "compile.addArgs(&.{ \"--host-platform\", host_platform, \"--target-platform\", app_build.scriptcPlatformTriple(b, target), \"--zig-exe\", b.graph.zig_exe });\n addScriptcGlibcFloorTeaching(b, target, &compile.step);" },
|
|
765
|
+
.{ .path = "build.zig", .pattern = "app_build.scriptcPlatformTriple(b, target),\n \"--zig-exe\",\n b.graph.zig_exe,\n });\n addScriptcGlibcFloorTeaching(b, target, &compile.step);" },
|
|
766
|
+
.{ .path = "build.zig", .pattern = "abi_laws_mod.addObjectFile(markup_fixture.archive);\n addScriptcArchiveSystemLibs(abi_laws_mod, target);" },
|
|
767
|
+
.{ .path = "packages/core/scripts/run_external_core_compiler.mjs", .pattern = "SCRIPTC_TARGET: args[\"target-platform\"]" },
|
|
607
768
|
});
|
|
608
769
|
addFileContainsCheckStep(b, file_contains_checker, test_step, "test-app-test-entry-analysis", "Verify the managed app test step force-analyzes the entry point (UiApp.create's Model-defaults rule must teach at `native test`, not ambush at `native build`)", &.{
|
|
609
770
|
.{ .path = "build/app.zig", .pattern = "app_analysis.zig" },
|
|
@@ -783,6 +944,11 @@ pub fn build(b: *std.Build) void {
|
|
|
783
944
|
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "NSAccessibilityProgressIndicatorRole" },
|
|
784
945
|
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "view.accessibilityRole = NativeSdkAccessibilityRoleForNativeViewKind(kind)" },
|
|
785
946
|
});
|
|
947
|
+
addFileContainsCheckStep(b, file_contains_checker, test_step, "test-appkit-audio-capture-start-stop-serialized", "Verify asynchronous ScreenCaptureKit startup cannot publish a stream after stop returns", &.{
|
|
948
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "@property(nonatomic, strong) NSLock *lifecycleLock;" },
|
|
949
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "[strongSelf.lifecycleLock lock];\n if (![strongSelf.target isCaptureActive]) {\n [strongSelf.lifecycleLock unlock];\n return;\n }\n strongSelf.stream = stream;" },
|
|
950
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "[self.lifecycleLock lock];\n SCStream *stream = self.stream;\n self.stream = nil;\n [self.lifecycleLock unlock];" },
|
|
951
|
+
});
|
|
786
952
|
addFileContainsCheckStep(b, file_contains_checker, test_step, "test-appkit-gpu-input-repaints-retained-canvas", "Verify GPU input wakes retained canvas frames", &.{
|
|
787
953
|
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "- (void)requestRetainedCanvasFrame" },
|
|
788
954
|
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "[self requestRetainedCanvasFrame];" },
|
|
@@ -1017,6 +1183,8 @@ pub fn build(b: *std.Build) void {
|
|
|
1017
1183
|
addFileContainsCheckStep(b, file_contains_checker, test_step, "test-appkit-gpu-packet-blur-effects", "Verify AppKit GPU packet presenter applies blur effects", &.{
|
|
1018
1184
|
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "NativeSdkPacketApplyBlur" },
|
|
1019
1185
|
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "CGBitmapContextGetData(context)" },
|
|
1186
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "NativeSdkGaussianBoxRadii" },
|
|
1187
|
+
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "vImageBoxConvolve_ARGB8888" },
|
|
1020
1188
|
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "NSIntersectionRect(rect, clipRect)" },
|
|
1021
1189
|
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "NativeSdkPacketTransformRect(transformValue, NativeSdkPacketRect(effect[@\"rect\"]))" },
|
|
1022
1190
|
.{ .path = "src/platform/macos/appkit_host.m", .pattern = "return NativeSdkPacketApplyBlur(effect, opacity, context, scale, transformValue, hasClip, clipRect)" },
|
|
@@ -1408,12 +1576,15 @@ pub fn build(b: *std.Build) void {
|
|
|
1408
1576
|
addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-gpu-surface", "Run GPU surface example tests", "examples/gpu-surface", .managed),
|
|
1409
1577
|
addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-gpu-dashboard", "Run GPU dashboard example tests", "examples/gpu-dashboard", .managed),
|
|
1410
1578
|
addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-gpu-components", "Run GPU components example tests", "examples/gpu-components", .managed),
|
|
1579
|
+
addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-record-store", "Run record-store example tests", "examples/record-store", .managed),
|
|
1580
|
+
addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-relational-notes", "Run relational notes example tests", "examples/relational-notes", .managed),
|
|
1411
1581
|
addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-ui-inbox", "Run ui builder inbox example tests", "examples/ui-inbox", .owned),
|
|
1412
1582
|
addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-kanban", "Run ui builder kanban example tests", "examples/kanban", .managed),
|
|
1413
1583
|
addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-habits", "Run markup habits example tests", "examples/habits", .managed),
|
|
1414
1584
|
addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-soundboard", "Run soundboard example tests", "examples/soundboard", .managed),
|
|
1415
1585
|
addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-video-player", "Run video player example tests", "examples/video-player", .managed),
|
|
1416
1586
|
addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-soundboard-ts", "Run soundboard-ts example tests", "examples/soundboard-ts", .managed),
|
|
1587
|
+
addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-voice-memo", "Run voice memo example tests", "examples/voice-memo", .managed),
|
|
1417
1588
|
addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-deck", "Run deck example tests", "examples/deck", .managed),
|
|
1418
1589
|
addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-markdown-viewer", "Run markdown viewer example tests", "examples/markdown-viewer", .managed),
|
|
1419
1590
|
addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-code-editor", "Run code editor example tests", "examples/code-editor", .managed),
|
|
@@ -1428,6 +1599,7 @@ pub fn build(b: *std.Build) void {
|
|
|
1428
1599
|
addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-channel-monitor", "Run channel monitor example tests", "examples/channel-monitor", .managed),
|
|
1429
1600
|
addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-menu-bar", "Run menu-bar lifecycle example tests", "examples/menu-bar", .managed),
|
|
1430
1601
|
addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-feed", "Run feed example tests", "examples/feed", .managed),
|
|
1602
|
+
addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-service-feed-reader", "Run TypeScript service feed-reader example tests", "examples/service-feed-reader", .managed),
|
|
1431
1603
|
addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-canvas-preview", "Run canvas preview example tests", "examples/canvas-preview", .managed),
|
|
1432
1604
|
addExampleTestStep(b, host_cli_exe, native_examples_step, "test-example-capabilities", "Run capabilities example tests", "examples/capabilities", .owned),
|
|
1433
1605
|
};
|
|
@@ -1614,14 +1786,63 @@ pub fn build(b: *std.Build) void {
|
|
|
1614
1786
|
mobile_canvas_lib_step.dependOn(&build_mobile_canvas_lib.step);
|
|
1615
1787
|
mobile_examples_step.dependOn(&build_mobile_canvas_lib.step);
|
|
1616
1788
|
|
|
1617
|
-
|
|
1618
|
-
|
|
1789
|
+
const build_mobile_canvas_store_lib = b.addSystemCommand(&.{ "zig", "build", "lib", "-Dstore=true" });
|
|
1790
|
+
build_mobile_canvas_store_lib.setCwd(b.path("examples/mobile-canvas"));
|
|
1791
|
+
const mobile_canvas_store_lib_step = b.step("test-example-mobile-canvas-lib-store", "Build a record-store-capable mobile embed static library");
|
|
1792
|
+
mobile_canvas_store_lib_step.dependOn(&build_mobile_canvas_store_lib.step);
|
|
1793
|
+
mobile_examples_step.dependOn(&build_mobile_canvas_store_lib.step);
|
|
1794
|
+
|
|
1795
|
+
const build_mobile_canvas_relational_lib = b.addSystemCommand(&.{ "zig", "build", "lib", "-Dsqlite=true", "--prefix", "zig-out/test-relational" });
|
|
1796
|
+
build_mobile_canvas_relational_lib.setCwd(b.path("examples/mobile-canvas"));
|
|
1797
|
+
const mobile_canvas_relational_lib_step = b.step("test-example-mobile-canvas-lib-sqlite", "Build a relational-SQLite-capable mobile embed static library");
|
|
1798
|
+
mobile_canvas_relational_lib_step.dependOn(&build_mobile_canvas_relational_lib.step);
|
|
1799
|
+
mobile_examples_step.dependOn(&build_mobile_canvas_relational_lib.step);
|
|
1800
|
+
|
|
1801
|
+
const build_mobile_canvas_both_storage_lib = b.addSystemCommand(&.{ "zig", "build", "lib", "-Dstore=true", "-Dsqlite=true", "--prefix", "zig-out/test-both-storage" });
|
|
1802
|
+
build_mobile_canvas_both_storage_lib.setCwd(b.path("examples/mobile-canvas"));
|
|
1803
|
+
const mobile_canvas_both_storage_lib_step = b.step("test-example-mobile-canvas-lib-storage", "Build both SQLite-backed mobile tiers with one vendored engine object");
|
|
1804
|
+
mobile_canvas_both_storage_lib_step.dependOn(&build_mobile_canvas_both_storage_lib.step);
|
|
1805
|
+
mobile_examples_step.dependOn(&build_mobile_canvas_both_storage_lib.step);
|
|
1806
|
+
|
|
1807
|
+
// Android cross-compile proofs: the capability-free archive remains pure
|
|
1808
|
+
// Zig, while the store variant must discover the NDK sysroot and compile
|
|
1809
|
+
// the vendored SQLite amalgamation for bionic. Keeping both catches a
|
|
1810
|
+
// capability branch that a host-only store build cannot exercise.
|
|
1619
1811
|
const build_mobile_canvas_lib_android = b.addSystemCommand(&.{ "zig", "build", "lib", "-Dtarget=aarch64-linux-android" });
|
|
1620
1812
|
build_mobile_canvas_lib_android.setCwd(b.path("examples/mobile-canvas"));
|
|
1621
1813
|
const mobile_canvas_lib_android_step = b.step("test-example-mobile-canvas-lib-android", "Cross-compile the mobile-canvas embed static library for aarch64-linux-android");
|
|
1622
1814
|
mobile_canvas_lib_android_step.dependOn(&build_mobile_canvas_lib_android.step);
|
|
1623
1815
|
mobile_examples_step.dependOn(&build_mobile_canvas_lib_android.step);
|
|
1624
1816
|
|
|
1817
|
+
const build_mobile_canvas_store_lib_android = b.addSystemCommand(&.{
|
|
1818
|
+
"zig", "build", "lib", "-Dstore=true", "-Dtarget=aarch64-linux-android",
|
|
1819
|
+
"--prefix", "zig-out/test-android-store",
|
|
1820
|
+
});
|
|
1821
|
+
build_mobile_canvas_store_lib_android.setCwd(b.path("examples/mobile-canvas"));
|
|
1822
|
+
const mobile_canvas_store_lib_android_step = b.step("test-example-mobile-canvas-lib-android-store", "Cross-compile SQLite-backed mobile storage for aarch64-linux-android");
|
|
1823
|
+
mobile_canvas_store_lib_android_step.dependOn(&build_mobile_canvas_store_lib_android.step);
|
|
1824
|
+
mobile_examples_step.dependOn(&build_mobile_canvas_store_lib_android.step);
|
|
1825
|
+
|
|
1826
|
+
// Apple SDK headers only exist on macOS. This is still part of the local
|
|
1827
|
+
// mobile aggregate there, and CI invokes the named step on its macOS tier.
|
|
1828
|
+
if (b.graph.host.result.os.tag == .macos) {
|
|
1829
|
+
const build_mobile_canvas_store_lib_ios = b.addSystemCommand(&.{
|
|
1830
|
+
"zig", "build", "lib", "-Dstore=true", "-Dtarget=aarch64-ios-simulator",
|
|
1831
|
+
"--prefix", "zig-out/test-ios-store",
|
|
1832
|
+
});
|
|
1833
|
+
build_mobile_canvas_store_lib_ios.setCwd(b.path("examples/mobile-canvas"));
|
|
1834
|
+
const build_mobile_canvas_store_lib_ios_device = b.addSystemCommand(&.{
|
|
1835
|
+
"zig", "build", "lib", "-Dstore=true", "-Dtarget=aarch64-ios",
|
|
1836
|
+
"--prefix", "zig-out/test-ios-device-store",
|
|
1837
|
+
});
|
|
1838
|
+
build_mobile_canvas_store_lib_ios_device.setCwd(b.path("examples/mobile-canvas"));
|
|
1839
|
+
const mobile_canvas_store_lib_ios_step = b.step("test-example-mobile-canvas-lib-ios-store", "Cross-compile SQLite-backed mobile storage for iOS simulator and device");
|
|
1840
|
+
mobile_canvas_store_lib_ios_step.dependOn(&build_mobile_canvas_store_lib_ios.step);
|
|
1841
|
+
mobile_canvas_store_lib_ios_step.dependOn(&build_mobile_canvas_store_lib_ios_device.step);
|
|
1842
|
+
mobile_examples_step.dependOn(&build_mobile_canvas_store_lib_ios.step);
|
|
1843
|
+
mobile_examples_step.dependOn(&build_mobile_canvas_store_lib_ios_device.step);
|
|
1844
|
+
}
|
|
1845
|
+
|
|
1625
1846
|
const examples_step = b.step("test-examples", "Run all example tests and layout checks");
|
|
1626
1847
|
examples_step.dependOn(frontend_examples_step);
|
|
1627
1848
|
examples_step.dependOn(native_examples_step);
|
|
@@ -2226,7 +2447,8 @@ pub fn build(b: *std.Build) void {
|
|
|
2226
2447
|
// numbers only mean something on a controlled machine. Runs via
|
|
2227
2448
|
// `scripts/gate.sh full --perf` locally and a dedicated macos-14 CI job.
|
|
2228
2449
|
// Knobs: NATIVE_SDK_PERF_LAUNCHES, NATIVE_SDK_PERF_INTERACTIONS, NATIVE_SDK_PERF_BUDGET_MS,
|
|
2229
|
-
// NATIVE_SDK_PERF_INPUT_BUDGET_MS — see
|
|
2450
|
+
// NATIVE_SDK_PERF_INPUT_BUDGET_MS, and NATIVE_SDK_PERF_ANIMATION_* — see
|
|
2451
|
+
// scripts/perf-gpu-dashboard.sh.
|
|
2230
2452
|
const gpu_dashboard_perf_step = b.step("test-gpu-dashboard-perf", "Run macOS GPU dashboard percentile performance check (N launches; slow)");
|
|
2231
2453
|
const gpu_dashboard_perf_build = managedExampleRun(b, cli_exe, &.{ "build", "-Dplatform=macos", "-Dweb-engine=system", "-Dautomation=true", "-Doptimize=Debug" });
|
|
2232
2454
|
gpu_dashboard_perf_build.setCwd(b.path("examples/gpu-dashboard"));
|
|
@@ -2284,7 +2506,7 @@ pub fn build(b: *std.Build) void {
|
|
|
2284
2506
|
canvas_preview_smoke_run.step.dependOn(&cli_exe.step);
|
|
2285
2507
|
canvas_preview_smoke_step.dependOn(&canvas_preview_smoke_run.step);
|
|
2286
2508
|
|
|
2287
|
-
const gpu_components_smoke_step = b.step("test-gpu-components-smoke", "Run
|
|
2509
|
+
const gpu_components_smoke_step = b.step("test-gpu-components-smoke", "Run the TypeScript component gallery automation smoke test");
|
|
2288
2510
|
const gpu_components_smoke_build = managedExampleRun(b, cli_exe, &.{ "build", "-Dplatform=macos", "-Dweb-engine=system", "-Dautomation=true", "-Doptimize=Debug" });
|
|
2289
2511
|
gpu_components_smoke_build.setCwd(b.path("examples/gpu-components"));
|
|
2290
2512
|
const gpu_components_smoke_run = b.addSystemCommand(&.{
|
|
@@ -2296,361 +2518,115 @@ pub fn build(b: *std.Build) void {
|
|
|
2296
2518
|
\\case "$cli" in /*) ;; *) cli="../../$cli" ;; esac
|
|
2297
2519
|
\\automation_dir=".zig-cache/native-sdk-automation"
|
|
2298
2520
|
\\mkdir -p "$automation_dir"
|
|
2299
|
-
|
|
2300
|
-
\\# NATIVE_SDK_SMOKE_BUDGET_MS raises the first-frame latency budget (default
|
|
2301
|
-
\\# stays 150 ms) and the automation-ready ceiling (default stays
|
|
2302
|
-
\\# 500 ms; the ceiling never drops below it) without weakening the
|
|
2303
|
-
\\# local defaults; every correctness assertion stays strict.
|
|
2304
|
-
\\smoke_budget_ms="${NATIVE_SDK_SMOKE_BUDGET_MS:-150}"
|
|
2305
|
-
\\case "$smoke_budget_ms" in ''|*[!0-9]*) echo "NATIVE_SDK_SMOKE_BUDGET_MS must be a positive integer of milliseconds: $smoke_budget_ms" >&2; exit 1 ;; esac
|
|
2306
|
-
\\if [ "$smoke_budget_ms" -le 0 ]; then echo "NATIVE_SDK_SMOKE_BUDGET_MS must be a positive integer of milliseconds: $smoke_budget_ms" >&2; exit 1; fi
|
|
2307
|
-
\\smoke_budget_ns=$((smoke_budget_ms * 1000000))
|
|
2308
|
-
\\ready_budget_ms="$smoke_budget_ms"
|
|
2309
|
-
\\if [ "$ready_budget_ms" -lt 500 ]; then ready_budget_ms=500; fi
|
|
2310
|
-
\\ready_budget_ns=$((ready_budget_ms * 1000000))
|
|
2311
|
-
\\rm -f "$automation_dir/snapshot.txt" "$automation_dir/accessibility.txt" "$automation_dir/windows.txt" "$automation_dir"/command*.txt
|
|
2521
|
+
\\rm -f "$automation_dir/snapshot.txt" "$automation_dir/accessibility.txt" "$automation_dir/windows.txt" "$automation_dir/screenshot-components-canvas.png" "$automation_dir/screenshot-components-house.png" "$automation_dir/screenshot-components-geist.png" "$automation_dir"/command*.txt
|
|
2312
2522
|
\\"$app" > .zig-cache/native-sdk-gpu-components-smoke.log 2>&1 &
|
|
2313
2523
|
\\pid=$!
|
|
2314
2524
|
\\trap 'status=$?; kill "$pid" >/dev/null 2>&1 || true; wait "$pid" >/dev/null 2>&1 || true; if [ "$status" -ne 0 ]; then echo "---- app log (.zig-cache/native-sdk-gpu-components-smoke.log) ----" >&2; cat .zig-cache/native-sdk-gpu-components-smoke.log >&2 2>/dev/null || true; fi' EXIT
|
|
2315
2525
|
\\ready="$("$cli" automate wait 2>&1)"
|
|
2316
2526
|
\\case "$ready" in *"ready=true"*) ;; *) echo "gpu-components automation snapshot was not ready" >&2; exit 1 ;; esac
|
|
2317
|
-
\\
|
|
2318
|
-
\\
|
|
2319
|
-
\\
|
|
2320
|
-
\\
|
|
2321
|
-
\\
|
|
2322
|
-
\\case "$snapshot" in *'view @w1/main kind=webview'*) echo "components should not create an implicit main WebView" >&2; exit 1 ;; *) ;; esac
|
|
2323
|
-
\\case "$snapshot" in *'source kind=html bytes=0'*) echo "components should not publish an empty default WebView source" >&2; exit 1 ;; *) ;; esac
|
|
2324
|
-
\\attempts=0
|
|
2325
|
-
\\while [ "$attempts" -lt 50 ]; do
|
|
2326
|
-
\\ snapshot="$(cat "$automation_dir/snapshot.txt" 2>/dev/null || true)"
|
|
2327
|
-
\\ case "$snapshot" in *'view @w1/components-canvas kind=gpu_surface'*'gpu_nonblank=true'*'canvas_frame_gpu_packet_unsupported=0'*'canvas_frame_gpu_packet_representable=true'*) break ;; esac
|
|
2328
|
-
\\ attempts=$((attempts + 1))
|
|
2329
|
-
\\ sleep 0.1
|
|
2330
|
-
\\done
|
|
2331
|
-
\\case "$snapshot" in *'view @w1/components-canvas kind=gpu_surface'*'gpu_nonblank=true'*) ;; *) echo "components GPU surface was not ready and nonblank" >&2; exit 1 ;; esac
|
|
2332
|
-
\\case "$snapshot" in *'view @w1/components-canvas kind=gpu_surface'*'canvas_frame_gpu_packet_unsupported=0'*'canvas_frame_gpu_packet_representable=true'*) ;; *) echo "components GPU frame was not packet-representable" >&2; exit 1 ;; esac
|
|
2333
|
-
\\first_frame_latency="$(printf '%s\n' "$snapshot" | sed -n 's/.*view @w1\/components-canvas kind=gpu_surface.* gpu_first_frame_latency_ns=\([0-9][0-9]*\).*/\1/p')"
|
|
2334
|
-
\\case "$first_frame_latency" in ''|*[!0-9]*) echo "components GPU first frame latency was missing" >&2; exit 1 ;; esac
|
|
2335
|
-
\\if [ "$first_frame_latency" -le 0 ] || [ "$first_frame_latency" -gt "$smoke_budget_ns" ]; then echo "components GPU first frame exceeded $smoke_budget_ms ms: $first_frame_latency ns" >&2; exit 1; fi
|
|
2336
|
-
\\# The runtime publishes its own fixed 150 ms budget verdict. Within that
|
|
2337
|
-
\\# budget the verdict must agree exactly; beyond it (reachable only when
|
|
2338
|
-
\\# NATIVE_SDK_SMOKE_BUDGET_MS > 150) the runtime must report the overrun honestly.
|
|
2339
|
-
\\if [ "$first_frame_latency" -le 150000000 ]; then
|
|
2340
|
-
\\ case "$snapshot" in *'view @w1/components-canvas kind=gpu_surface'*'gpu_first_frame_latency_budget_ns=150000000'*'gpu_first_frame_latency_budget_exceeded=0'*'gpu_first_frame_latency_budget_ok=true'*) ;; *) echo "components GPU first frame exceeded the latency budget" >&2; exit 1 ;; esac
|
|
2341
|
-
\\else
|
|
2342
|
-
\\ case "$snapshot" in *'view @w1/components-canvas kind=gpu_surface'*'gpu_first_frame_latency_budget_ns=150000000'*'gpu_first_frame_latency_budget_ok=false'*) ;; *) echo "components runtime did not report the first-frame budget overrun" >&2; exit 1 ;; esac
|
|
2343
|
-
\\fi
|
|
2344
|
-
\\gpu_frame_from_snapshot() {
|
|
2345
|
-
\\ printf '%s\n' "$snapshot" | sed -n 's/.*view @w1\/components-canvas kind=gpu_surface.* gpu_frame=\([0-9][0-9]*\).*/\1/p'
|
|
2346
|
-
\\}
|
|
2347
|
-
\\canvas_revision_from_snapshot() {
|
|
2348
|
-
\\ printf '%s\n' "$snapshot" | sed -n 's/.*view @w1\/components-canvas kind=gpu_surface.* canvas_revision=\([0-9][0-9]*\).*/\1/p'
|
|
2527
|
+
\\snapshot="$automation_dir/snapshot.txt"
|
|
2528
|
+
\\widget_id() {
|
|
2529
|
+
\\ role="$1"
|
|
2530
|
+
\\ name="$2"
|
|
2531
|
+
\\ sed -n "s/.*widget @w1\\/components-canvas#\\([0-9][0-9]*\\) role=$role name=\\\"$name\\\".*/\\1/p" "$snapshot" | head -1
|
|
2349
2532
|
\\}
|
|
2350
|
-
\\snapshot_contains() {
|
|
2351
|
-
\\ case "$snapshot" in *"$1"*) return 0 ;; *) return 1 ;; esac
|
|
2352
|
-
\\}
|
|
2353
|
-
\\case "$snapshot" in *'widget @w1/components-canvas#113 role=checkbox'*'value=1'*'actions=[focus,toggle]'*) ;; *) echo "checkbox widget was not initially selected" >&2; exit 1 ;; esac
|
|
2354
|
-
\\case "$snapshot" in *'widget @w1/components-canvas#114 role=switch'*'value=1'*'actions=[focus,toggle]'*) ;; *) echo "switch widget was not initially selected" >&2; exit 1 ;; esac
|
|
2355
|
-
\\case "$snapshot" in *'widget @w1/components-canvas#116 role=progressbar'*'value=1'*) ;; *) echo "progress widget was missing from the initial snapshot" >&2; exit 1 ;; esac
|
|
2356
|
-
\\case "$snapshot" in *'widget @w1/components-canvas#117 role=tab'*'value=1'*'actions=[focus,select]'*) ;; *) echo "small segmented control was not initially selected" >&2; exit 1 ;; esac
|
|
2357
|
-
\\case "$snapshot" in *'widget @w1/components-canvas#119 role=tab'*'value=0'*'actions=[focus,select]'*) ;; *) echo "large segmented control was not initially available" >&2; exit 1 ;; esac
|
|
2358
|
-
\\case "$snapshot" in *'widget @w1/components-canvas#142 role=menuitem'*'actions=[focus,press,select]'*) ;; *) echo "menu item widget was not initially actionable" >&2; exit 1 ;; esac
|
|
2359
|
-
\\case "$snapshot" in *'widget @w1/components-canvas#86 role=tab'*'actions=[focus,press,select]'*) ;; *) echo "theme toolbar trigger was not initially actionable" >&2; exit 1 ;; esac
|
|
2360
|
-
\\case "$snapshot" in *'widget @w1/components-canvas#83 role=button'*'actions=[focus,press]'*) ;; *) echo "refresh toolbar widget was not initially actionable" >&2; exit 1 ;; esac
|
|
2361
|
-
\\gpu_frame_before="$(gpu_frame_from_snapshot)"
|
|
2362
|
-
\\case "$gpu_frame_before" in ''|*[!0-9]*) gpu_frame_before=0 ;; esac
|
|
2363
|
-
\\gpu_frame_after="$gpu_frame_before"
|
|
2364
|
-
\\canvas_revision_before="$(canvas_revision_from_snapshot)"
|
|
2365
|
-
\\case "$canvas_revision_before" in ''|*[!0-9]*) canvas_revision_before=0 ;; esac
|
|
2366
|
-
\\canvas_revision_after="$canvas_revision_before"
|
|
2367
|
-
\\"$cli" automate widget-click components-canvas 86 >/dev/null 2>&1
|
|
2368
|
-
\\attempts=0
|
|
2369
|
-
\\while [ "$attempts" -lt 50 ]; do
|
|
2370
|
-
\\ snapshot="$(cat "$automation_dir/snapshot.txt" 2>/dev/null || true)"
|
|
2371
|
-
\\ gpu_frame_after="$(gpu_frame_from_snapshot)"
|
|
2372
|
-
\\ case "$gpu_frame_after" in ''|*[!0-9]*) gpu_frame_after=0 ;; esac
|
|
2373
|
-
\\ canvas_revision_after="$(canvas_revision_from_snapshot)"
|
|
2374
|
-
\\ case "$canvas_revision_after" in ''|*[!0-9]*) canvas_revision_after=0 ;; esac
|
|
2375
|
-
\\ if [ "$gpu_frame_after" -gt "$gpu_frame_before" ] || [ "$canvas_revision_after" -gt "$canvas_revision_before" ]; then
|
|
2376
|
-
\\ if snapshot_contains 'GPU component theme: ' && snapshot_contains ' from native_view. Count 1.' && snapshot_contains 'view @w1/components-canvas kind=gpu_surface' && snapshot_contains 'canvas_frame_gpu_packet_unsupported=0' && snapshot_contains 'canvas_frame_gpu_packet_representable=true'; then break; fi
|
|
2377
|
-
\\ fi
|
|
2378
|
-
\\ attempts=$((attempts + 1))
|
|
2379
|
-
\\ sleep 0.1
|
|
2380
|
-
\\done
|
|
2381
|
-
\\if [ "$gpu_frame_after" -le "$gpu_frame_before" ] && [ "$canvas_revision_after" -le "$canvas_revision_before" ]; then echo "theme automation command did not update the retained GPU canvas" >&2; exit 1; fi
|
|
2382
|
-
\\case "$snapshot" in *'GPU component theme: '*' from native_view. Count 1.'*) ;; *) echo "theme automation command did not update status" >&2; exit 1 ;; esac
|
|
2383
|
-
\\case "$snapshot" in *'view @w1/components-canvas kind=gpu_surface'*'canvas_frame_gpu_packet_unsupported=0'*'canvas_frame_gpu_packet_representable=true'*) ;; *) echo "theme automation command did not present a packet-renderable GPU frame" >&2; exit 1 ;; esac
|
|
2384
|
-
\\"$cli" automate widget-action components-canvas 111 focus >/dev/null 2>&1
|
|
2385
|
-
\\attempts=0
|
|
2386
|
-
\\while [ "$attempts" -lt 50 ]; do
|
|
2387
|
-
\\ snapshot="$(cat "$automation_dir/snapshot.txt" 2>/dev/null || true)"
|
|
2388
|
-
\\ case "$snapshot" in *'widget @w1/components-canvas#111 role=textbox'*'focused=true'*'text="native-sdk"'*) break ;; esac
|
|
2389
|
-
\\ attempts=$((attempts + 1))
|
|
2390
|
-
\\ sleep 0.1
|
|
2391
|
-
\\done
|
|
2392
|
-
\\case "$snapshot" in *'widget @w1/components-canvas#111 role=textbox'*'focused=true'*'text="native-sdk"'*) ;; *) echo "widget focus automation did not focus retained text" >&2; exit 1 ;; esac
|
|
2393
|
-
\\"$cli" automate widget-key components-canvas z z >/dev/null 2>&1
|
|
2394
|
-
\\attempts=0
|
|
2395
|
-
\\while [ "$attempts" -lt 50 ]; do
|
|
2396
|
-
\\ snapshot="$(cat "$automation_dir/snapshot.txt" 2>/dev/null || true)"
|
|
2397
|
-
\\ case "$snapshot" in *'widget @w1/components-canvas#111 role=textbox'*'focused=true'*'text="native-sdkz"'*) break ;; esac
|
|
2398
|
-
\\ attempts=$((attempts + 1))
|
|
2399
|
-
\\ sleep 0.1
|
|
2400
|
-
\\done
|
|
2401
|
-
\\case "$snapshot" in *'widget @w1/components-canvas#111 role=textbox'*'focused=true'*'text="native-sdkz"'*) ;; *) echo "widget keyboard automation did not update retained text" >&2; exit 1 ;; esac
|
|
2402
|
-
\\"$cli" automate widget-key components-canvas tab >/dev/null 2>&1
|
|
2403
2533
|
\\attempts=0
|
|
2404
2534
|
\\while [ "$attempts" -lt 50 ]; do
|
|
2405
|
-
\\
|
|
2406
|
-
\\ case "$
|
|
2407
|
-
\\ attempts=$((attempts + 1))
|
|
2408
|
-
\\ sleep 0.1
|
|
2409
|
-
\\done
|
|
2410
|
-
\\case "$snapshot" in *'widget @w1/components-canvas#112 role=textbox'*'focused=true'*) ;; *) echo "widget keyboard automation did not move focus" >&2; exit 1 ;; esac
|
|
2411
|
-
\\"$cli" automate widget-action components-canvas 105 press >/dev/null 2>&1
|
|
2412
|
-
\\attempts=0
|
|
2413
|
-
\\while [ "$attempts" -lt 50 ]; do
|
|
2414
|
-
\\ snapshot="$(cat "$automation_dir/snapshot.txt" 2>/dev/null || true)"
|
|
2415
|
-
\\ if snapshot_contains 'Keyed icon_button #105.' && snapshot_contains 'widget @w1/components-canvas#105 role=button' && snapshot_contains 'actions=[focus,press]'; then break; fi
|
|
2535
|
+
\\ ready_snapshot="$(cat "$snapshot" 2>/dev/null || true)"
|
|
2536
|
+
\\ case "$ready_snapshot" in *'view @w1/components-canvas kind=gpu_surface'*'gpu_nonblank=true'*'canvas_frame_gpu_packet_representable=true'*) break ;; esac
|
|
2416
2537
|
\\ attempts=$((attempts + 1))
|
|
2417
2538
|
\\ sleep 0.1
|
|
2418
2539
|
\\done
|
|
2419
|
-
\\
|
|
2420
|
-
\\"$
|
|
2421
|
-
\\
|
|
2422
|
-
\\
|
|
2423
|
-
\\
|
|
2424
|
-
\\
|
|
2425
|
-
\\
|
|
2426
|
-
\\
|
|
2427
|
-
\\
|
|
2428
|
-
\\case "$
|
|
2429
|
-
\\"$cli" automate widget-
|
|
2430
|
-
\\
|
|
2431
|
-
\\
|
|
2432
|
-
\\
|
|
2433
|
-
\\
|
|
2434
|
-
\\
|
|
2435
|
-
\\
|
|
2436
|
-
\\
|
|
2437
|
-
\\
|
|
2438
|
-
\\
|
|
2439
|
-
\\
|
|
2440
|
-
\\
|
|
2441
|
-
\\
|
|
2442
|
-
\\
|
|
2443
|
-
\\case "$
|
|
2444
|
-
\\
|
|
2445
|
-
\\
|
|
2446
|
-
\\
|
|
2447
|
-
\\
|
|
2448
|
-
\\
|
|
2449
|
-
\\ gpu_frame_after="$(gpu_frame_from_snapshot)"
|
|
2450
|
-
\\ case "$gpu_frame_after" in ''|*[!0-9]*) gpu_frame_after=0 ;; esac
|
|
2451
|
-
\\ if [ "$gpu_frame_after" -gt "$gpu_frame_before" ]; then
|
|
2452
|
-
\\ if snapshot_contains 'Clicked slider #115: value 0.82.' && snapshot_contains 'widget @w1/components-canvas#115 role=slider' && { snapshot_contains 'value=0.82' || snapshot_contains 'value=0.819'; }; then
|
|
2453
|
-
\\ case "$snapshot" in *'view @w1/components-canvas kind=gpu_surface'*'canvas_frame_full_repaint=false'*'canvas_frame_pipeline_uploads=0'*'canvas_frame_image_uploads=0'*'canvas_frame_glyph_uploads=0'*'canvas_frame_text_uploads=0'*'canvas_frame_gpu_packet_unsupported=0'*'canvas_frame_gpu_packet_representable=true'*) break ;; esac
|
|
2454
|
-
\\ fi
|
|
2455
|
-
\\ fi
|
|
2456
|
-
\\ attempts=$((attempts + 1))
|
|
2457
|
-
\\ sleep 0.1
|
|
2458
|
-
\\done
|
|
2459
|
-
\\if [ "$gpu_frame_after" -le "$gpu_frame_before" ]; then echo "slider automation drag did not request a GPU frame" >&2; exit 1; fi
|
|
2460
|
-
\\if ! snapshot_contains 'Clicked slider #115: value 0.82.' || ! snapshot_contains 'widget @w1/components-canvas#115 role=slider' || { ! snapshot_contains 'value=0.82' && ! snapshot_contains 'value=0.819'; }; then echo "slider automation drag did not update retained slider state" >&2; exit 1; fi
|
|
2461
|
-
\\case "$snapshot" in *'view @w1/components-canvas kind=gpu_surface'*'canvas_frame_full_repaint=false'*'canvas_frame_pipeline_uploads=0'*'canvas_frame_image_uploads=0'*'canvas_frame_glyph_uploads=0'*'canvas_frame_text_uploads=0'*'canvas_frame_gpu_packet_unsupported=0'*'canvas_frame_gpu_packet_representable=true'*) ;; *) echo "slider automation drag did not present an incremental GPU packet without interaction-time uploads" >&2; exit 1 ;; esac
|
|
2462
|
-
\\"$cli" automate widget-action components-canvas 156 press >/dev/null 2>&1
|
|
2463
|
-
\\attempts=0
|
|
2464
|
-
\\while [ "$attempts" -lt 50 ]; do
|
|
2465
|
-
\\ snapshot="$(cat "$automation_dir/snapshot.txt" 2>/dev/null || true)"
|
|
2466
|
-
\\ if snapshot_contains 'Keyed data_cell #156: selected.' && snapshot_contains 'widget @w1/components-canvas#156 role=gridcell' && snapshot_contains 'focused=true' && snapshot_contains 'value=1'; then break; fi
|
|
2467
|
-
\\ attempts=$((attempts + 1))
|
|
2468
|
-
\\ sleep 0.1
|
|
2469
|
-
\\done
|
|
2470
|
-
\\if ! snapshot_contains 'Keyed data_cell #156: selected.' || ! snapshot_contains 'widget @w1/components-canvas#156 role=gridcell' || ! snapshot_contains 'focused=true' || ! snapshot_contains 'value=1'; then echo "grid cell automation press did not focus and report status" >&2; exit 1; fi
|
|
2471
|
-
\\gpu_frame_before="$(gpu_frame_from_snapshot)"
|
|
2472
|
-
\\case "$gpu_frame_before" in ''|*[!0-9]*) gpu_frame_before=0 ;; esac
|
|
2473
|
-
\\gpu_frame_after="$gpu_frame_before"
|
|
2474
|
-
\\"$cli" automate widget-click components-canvas 119 >/dev/null 2>&1
|
|
2475
|
-
\\attempts=0
|
|
2476
|
-
\\while [ "$attempts" -lt 50 ]; do
|
|
2477
|
-
\\ snapshot="$(cat "$automation_dir/snapshot.txt" 2>/dev/null || true)"
|
|
2478
|
-
\\ gpu_frame_after="$(gpu_frame_from_snapshot)"
|
|
2479
|
-
\\ case "$gpu_frame_after" in ''|*[!0-9]*) gpu_frame_after=0 ;; esac
|
|
2480
|
-
\\ if [ "$gpu_frame_after" -gt "$gpu_frame_before" ]; then
|
|
2481
|
-
\\ if snapshot_contains 'Clicked segmented_control #119: selected.' && snapshot_contains 'widget @w1/components-canvas#117 role=tab' && snapshot_contains 'value=0' && snapshot_contains 'widget @w1/components-canvas#119 role=tab' && snapshot_contains 'focused=true' && snapshot_contains 'value=1'; then
|
|
2482
|
-
\\ case "$snapshot" in *'view @w1/components-canvas kind=gpu_surface'*'canvas_frame_full_repaint=false'*'canvas_frame_pipeline_uploads=0'*'canvas_frame_image_uploads=0'*'canvas_frame_glyph_uploads=0'*'canvas_frame_text_uploads=0'*'canvas_frame_gpu_packet_unsupported=0'*'canvas_frame_gpu_packet_representable=true'*) break ;; esac
|
|
2483
|
-
\\ fi
|
|
2484
|
-
\\ fi
|
|
2485
|
-
\\ attempts=$((attempts + 1))
|
|
2486
|
-
\\ sleep 0.1
|
|
2487
|
-
\\done
|
|
2488
|
-
\\if [ "$gpu_frame_after" -le "$gpu_frame_before" ]; then echo "segmented control automation click did not request a GPU frame" >&2; exit 1; fi
|
|
2489
|
-
\\if ! snapshot_contains 'Clicked segmented_control #119: selected.' || ! snapshot_contains 'widget @w1/components-canvas#117 role=tab' || ! snapshot_contains 'value=0' || ! snapshot_contains 'widget @w1/components-canvas#119 role=tab' || ! snapshot_contains 'focused=true' || ! snapshot_contains 'value=1'; then echo "segmented control automation click did not update retained selection state" >&2; exit 1; fi
|
|
2490
|
-
\\case "$snapshot" in *'view @w1/components-canvas kind=gpu_surface'*'canvas_frame_full_repaint=false'*'canvas_frame_pipeline_uploads=0'*'canvas_frame_image_uploads=0'*'canvas_frame_glyph_uploads=0'*'canvas_frame_text_uploads=0'*'canvas_frame_gpu_packet_unsupported=0'*'canvas_frame_gpu_packet_representable=true'*) ;; *) echo "segmented control automation click did not present an incremental GPU packet without interaction-time uploads" >&2; exit 1 ;; esac
|
|
2491
|
-
\\# The catalog's project menu is an ACTIONS menu (no sibling declares a
|
|
2492
|
-
\\# committed row), so automation select mints NO selection: value
|
|
2493
|
-
\\# stays 0. Automation focus follows the pointer contract (rows take
|
|
2494
|
-
\\# focus QUIETLY, no visible affordance), so nothing repaints and no
|
|
2495
|
-
\\# frame is requested — the republished snapshot alone carries the
|
|
2496
|
-
\\# focus move. A picker menu would mint value=1 and repaint; the
|
|
2497
|
-
\\# select specimen's committed-row tests cover that register.
|
|
2498
|
-
\\"$cli" automate widget-action components-canvas 142 select >/dev/null 2>&1
|
|
2499
|
-
\\attempts=0
|
|
2500
|
-
\\while [ "$attempts" -lt 50 ]; do
|
|
2501
|
-
\\ snapshot="$(cat "$automation_dir/snapshot.txt" 2>/dev/null || true)"
|
|
2502
|
-
\\ case "$(printf '%s\\n' "$snapshot" | grep -F 'components-canvas#142 role=menuitem' | head -1)" in *'focused=true'*'value=0'*) break ;; esac
|
|
2503
|
-
\\ attempts=$((attempts + 1))
|
|
2504
|
-
\\ sleep 0.1
|
|
2540
|
+
\\case "$ready_snapshot" in *'window @w1 "Native SDK GPU Components"'*) ;; *) echo "gpu-components window was missing" >&2; exit 1 ;; esac
|
|
2541
|
+
\\case "$ready_snapshot" in *'view @w1/components-canvas kind=gpu_surface'*'gpu_nonblank=true'*'canvas_frame_gpu_packet_representable=true'*) ;; *) echo "component gallery GPU surface was not ready" >&2; exit 1 ;; esac
|
|
2542
|
+
\\case "$ready_snapshot" in *'view @w1/main kind=webview'*) echo "component gallery created an implicit WebView" >&2; exit 1 ;; *) ;; esac
|
|
2543
|
+
\\"$cli" automate assert 'role=tree name="Components"' 'role=treeitem name="Components".*state=\[expanded\]' 'role=treeitem name="Accordion".*state=\[selected\]' 'role=group name="Details".*state=\[selected,expanded\]' 'name="Accordion details are visible. The model owns this expanded state."'
|
|
2544
|
+
\\"$cli" automate assert 'role=group name="Theme"' 'role=button name="Default".*state=\[selected\]' 'role=button name="Geist"'
|
|
2545
|
+
\\"$cli" automate screenshot components-canvas >/dev/null 2>&1
|
|
2546
|
+
\\cp "$automation_dir/screenshot-components-canvas.png" "$automation_dir/screenshot-components-house.png"
|
|
2547
|
+
\\rm -f "$automation_dir/screenshot-components-canvas.png"
|
|
2548
|
+
\\theme_geist_id="$(widget_id button Geist)"
|
|
2549
|
+
\\case "$theme_geist_id" in ''|*[!0-9]*) echo "Geist theme toggle id was missing" >&2; exit 1 ;; esac
|
|
2550
|
+
\\"$cli" automate widget-click components-canvas "$theme_geist_id" >/dev/null 2>&1
|
|
2551
|
+
\\"$cli" automate assert 'role=button name="Geist".*state=\[[^]]*selected'
|
|
2552
|
+
\\"$cli" automate screenshot components-canvas >/dev/null 2>&1
|
|
2553
|
+
\\cp "$automation_dir/screenshot-components-canvas.png" "$automation_dir/screenshot-components-geist.png"
|
|
2554
|
+
\\test -s "$automation_dir/screenshot-components-house.png" || { echo "house theme screenshot was empty" >&2; exit 1; }
|
|
2555
|
+
\\test -s "$automation_dir/screenshot-components-geist.png" || { echo "Geist theme screenshot was empty" >&2; exit 1; }
|
|
2556
|
+
\\if cmp -s "$automation_dir/screenshot-components-house.png" "$automation_dir/screenshot-components-geist.png"; then echo "theme toggle did not change rendered pixels" >&2; exit 1; fi
|
|
2557
|
+
\\accordion_id="$(widget_id group Details)"
|
|
2558
|
+
\\case "$accordion_id" in ''|*[!0-9]*) echo "accordion id was missing" >&2; exit 1 ;; esac
|
|
2559
|
+
\\"$cli" automate widget-action components-canvas "$accordion_id" toggle >/dev/null 2>&1
|
|
2560
|
+
\\"$cli" automate assert --absent 'name="Accordion details are visible. The model owns this expanded state."'
|
|
2561
|
+
\\"$cli" automate widget-action components-canvas "$accordion_id" toggle >/dev/null 2>&1
|
|
2562
|
+
\\"$cli" automate assert 'name="Accordion details are visible. The model owns this expanded state."'
|
|
2563
|
+
\\accordion_row_id="$(widget_id treeitem Accordion)"
|
|
2564
|
+
\\case "$accordion_row_id" in ''|*[!0-9]*) echo "accordion navigation id was missing" >&2; exit 1 ;; esac
|
|
2565
|
+
\\"$cli" automate widget-action components-canvas "$accordion_row_id" focus >/dev/null 2>&1
|
|
2566
|
+
\\arrow_count=0
|
|
2567
|
+
\\while [ "$arrow_count" -lt 33 ]; do
|
|
2568
|
+
\\ "$cli" automate widget-key components-canvas arrowdown >/dev/null 2>&1
|
|
2569
|
+
\\ arrow_count=$((arrow_count + 1))
|
|
2505
2570
|
\\done
|
|
2506
|
-
\\
|
|
2507
|
-
\\
|
|
2508
|
-
\\"$
|
|
2509
|
-
\\
|
|
2510
|
-
\\
|
|
2511
|
-
\\
|
|
2512
|
-
\\
|
|
2513
|
-
\\
|
|
2514
|
-
\\
|
|
2515
|
-
\\
|
|
2516
|
-
\\
|
|
2517
|
-
\\
|
|
2518
|
-
\\
|
|
2519
|
-
\\
|
|
2520
|
-
\\"$cli" automate widget-click components-canvas
|
|
2521
|
-
\\
|
|
2522
|
-
\\
|
|
2523
|
-
\\
|
|
2524
|
-
\\
|
|
2525
|
-
\\
|
|
2526
|
-
\\
|
|
2527
|
-
\\
|
|
2528
|
-
\\
|
|
2529
|
-
\\
|
|
2530
|
-
\\
|
|
2531
|
-
\\
|
|
2532
|
-
\\
|
|
2533
|
-
\\
|
|
2534
|
-
\\
|
|
2535
|
-
\\
|
|
2536
|
-
\\case "$
|
|
2537
|
-
\\"$cli" automate widget-
|
|
2538
|
-
\\
|
|
2539
|
-
\\
|
|
2540
|
-
\\
|
|
2541
|
-
\\
|
|
2542
|
-
\\
|
|
2543
|
-
\\
|
|
2544
|
-
\\
|
|
2545
|
-
\\
|
|
2546
|
-
\\
|
|
2547
|
-
\\
|
|
2548
|
-
\\
|
|
2549
|
-
\\"$cli" automate
|
|
2550
|
-
\\
|
|
2551
|
-
\\
|
|
2552
|
-
\\
|
|
2553
|
-
\\
|
|
2554
|
-
\\
|
|
2555
|
-
\\
|
|
2556
|
-
\\
|
|
2557
|
-
\\
|
|
2558
|
-
\\
|
|
2559
|
-
\\
|
|
2560
|
-
\\
|
|
2561
|
-
\\
|
|
2562
|
-
\\
|
|
2563
|
-
\\
|
|
2564
|
-
\\
|
|
2565
|
-
\\case "$snapshot" in *'view @w1/components-canvas kind=gpu_surface'*'canvas_frame_full_repaint=false'*'canvas_frame_pipeline_uploads=0'*'canvas_frame_image_uploads=0'*'canvas_frame_glyph_uploads=0'*'canvas_frame_text_uploads=0'*'canvas_frame_gpu_packet_unsupported=0'*'canvas_frame_gpu_packet_representable=true'*) ;; *) echo "switch automation click did not present an incremental GPU packet without interaction-time uploads" >&2; exit 1 ;; esac
|
|
2566
|
-
\\gpu_frame_before="$(gpu_frame_from_snapshot)"
|
|
2567
|
-
\\case "$gpu_frame_before" in ''|*[!0-9]*) gpu_frame_before=0 ;; esac
|
|
2568
|
-
\\gpu_frame_after="$gpu_frame_before"
|
|
2569
|
-
\\canvas_revision_before="$(canvas_revision_from_snapshot)"
|
|
2570
|
-
\\case "$canvas_revision_before" in ''|*[!0-9]*) canvas_revision_before=0 ;; esac
|
|
2571
|
-
\\canvas_revision_after="$canvas_revision_before"
|
|
2572
|
-
\\"$cli" automate widget-action components-canvas 120 increment >/dev/null 2>&1
|
|
2573
|
-
\\attempts=0
|
|
2574
|
-
\\while [ "$attempts" -lt 50 ]; do
|
|
2575
|
-
\\ snapshot="$(cat "$automation_dir/snapshot.txt" 2>/dev/null || true)"
|
|
2576
|
-
\\ gpu_frame_after="$(gpu_frame_from_snapshot)"
|
|
2577
|
-
\\ case "$gpu_frame_after" in ''|*[!0-9]*) gpu_frame_after=0 ;; esac
|
|
2578
|
-
\\ canvas_revision_after="$(canvas_revision_from_snapshot)"
|
|
2579
|
-
\\ case "$canvas_revision_after" in ''|*[!0-9]*) canvas_revision_after=0 ;; esac
|
|
2580
|
-
\\ if [ "$gpu_frame_after" -gt "$gpu_frame_before" ] || [ "$canvas_revision_after" -gt "$canvas_revision_before" ]; then
|
|
2581
|
-
\\ if snapshot_contains 'Keyed list #120: offset 56.' && snapshot_contains 'widget @w1/components-canvas#120 role=list' && snapshot_contains 'scroll=[offset=56,viewport=56,content=168]'; then
|
|
2582
|
-
\\ case "$snapshot" in *'view @w1/components-canvas kind=gpu_surface'*'canvas_frame_full_repaint=false'*'canvas_frame_pipeline_uploads=0'*'canvas_frame_image_uploads=0'*'canvas_frame_glyph_uploads=0'*'canvas_frame_text_uploads=0'*'canvas_frame_gpu_packet_unsupported=0'*'canvas_frame_gpu_packet_representable=true'*) break ;; esac
|
|
2583
|
-
\\ fi
|
|
2584
|
-
\\ fi
|
|
2585
|
-
\\ attempts=$((attempts + 1))
|
|
2586
|
-
\\ sleep 0.1
|
|
2587
|
-
\\done
|
|
2588
|
-
\\if [ "$gpu_frame_after" -le "$gpu_frame_before" ] && [ "$canvas_revision_after" -le "$canvas_revision_before" ]; then echo "list automation increment did not update the retained GPU canvas" >&2; exit 1; fi
|
|
2589
|
-
\\if ! snapshot_contains 'Keyed list #120: offset 56.' || ! snapshot_contains 'widget @w1/components-canvas#120 role=list' || ! snapshot_contains 'scroll=[offset=56,viewport=56,content=168]'; then echo "list automation increment did not update retained scroll semantics" >&2; exit 1; fi
|
|
2590
|
-
\\case "$snapshot" in *'view @w1/components-canvas kind=gpu_surface'*'canvas_frame_full_repaint=false'*'canvas_frame_pipeline_uploads=0'*'canvas_frame_image_uploads=0'*'canvas_frame_glyph_uploads=0'*'canvas_frame_text_uploads=0'*'canvas_frame_gpu_packet_unsupported=0'*'canvas_frame_gpu_packet_representable=true'*) ;; *) echo "list automation increment did not present an incremental GPU packet without interaction-time uploads" >&2; exit 1 ;; esac
|
|
2591
|
-
\\gpu_frame_before="$(gpu_frame_from_snapshot)"
|
|
2592
|
-
\\case "$gpu_frame_before" in ''|*[!0-9]*) gpu_frame_before=0 ;; esac
|
|
2593
|
-
\\gpu_frame_after="$gpu_frame_before"
|
|
2594
|
-
\\canvas_revision_before="$(canvas_revision_from_snapshot)"
|
|
2595
|
-
\\case "$canvas_revision_before" in ''|*[!0-9]*) canvas_revision_before=0 ;; esac
|
|
2596
|
-
\\canvas_revision_after="$canvas_revision_before"
|
|
2597
|
-
\\"$cli" automate widget-action components-canvas 150 increment >/dev/null 2>&1
|
|
2598
|
-
\\attempts=0
|
|
2599
|
-
\\while [ "$attempts" -lt 50 ]; do
|
|
2600
|
-
\\ snapshot="$(cat "$automation_dir/snapshot.txt" 2>/dev/null || true)"
|
|
2601
|
-
\\ gpu_frame_after="$(gpu_frame_from_snapshot)"
|
|
2602
|
-
\\ case "$gpu_frame_after" in ''|*[!0-9]*) gpu_frame_after=0 ;; esac
|
|
2603
|
-
\\ canvas_revision_after="$(canvas_revision_from_snapshot)"
|
|
2604
|
-
\\ case "$canvas_revision_after" in ''|*[!0-9]*) canvas_revision_after=0 ;; esac
|
|
2605
|
-
\\ if [ "$gpu_frame_after" -gt "$gpu_frame_before" ] || [ "$canvas_revision_after" -gt "$canvas_revision_before" ]; then
|
|
2606
|
-
\\ if snapshot_contains 'Keyed table #150: offset 56.' && snapshot_contains 'widget @w1/components-canvas#150 role=grid' && snapshot_contains 'scroll=[offset=56,viewport=28,content=140]'; then
|
|
2607
|
-
\\ case "$snapshot" in *'view @w1/components-canvas kind=gpu_surface'*'canvas_frame_full_repaint=false'*'canvas_frame_pipeline_uploads=0'*'canvas_frame_image_uploads=0'*'canvas_frame_glyph_uploads=0'*'canvas_frame_text_uploads=0'*'canvas_frame_gpu_packet_unsupported=0'*'canvas_frame_gpu_packet_representable=true'*) break ;; esac
|
|
2608
|
-
\\ fi
|
|
2609
|
-
\\ fi
|
|
2610
|
-
\\ attempts=$((attempts + 1))
|
|
2611
|
-
\\ sleep 0.1
|
|
2612
|
-
\\done
|
|
2613
|
-
\\if [ "$gpu_frame_after" -le "$gpu_frame_before" ] && [ "$canvas_revision_after" -le "$canvas_revision_before" ]; then echo "data grid automation increment did not update the retained GPU canvas" >&2; exit 1; fi
|
|
2614
|
-
\\if ! snapshot_contains 'Keyed table #150: offset 56.' || ! snapshot_contains 'widget @w1/components-canvas#150 role=grid' || ! snapshot_contains 'scroll=[offset=56,viewport=28,content=140]'; then echo "data grid automation increment did not update retained scroll semantics" >&2; exit 1; fi
|
|
2615
|
-
\\case "$snapshot" in *'view @w1/components-canvas kind=gpu_surface'*'canvas_frame_full_repaint=false'*'canvas_frame_pipeline_uploads=0'*'canvas_frame_image_uploads=0'*'canvas_frame_glyph_uploads=0'*'canvas_frame_text_uploads=0'*'canvas_frame_gpu_packet_unsupported=0'*'canvas_frame_gpu_packet_representable=true'*) ;; *) echo "data grid automation increment did not present an incremental GPU packet without interaction-time uploads" >&2; exit 1 ;; esac
|
|
2616
|
-
\\gpu_frame_before="$(gpu_frame_from_snapshot)"
|
|
2617
|
-
\\case "$gpu_frame_before" in ''|*[!0-9]*) gpu_frame_before=0 ;; esac
|
|
2618
|
-
\\gpu_frame_after="$gpu_frame_before"
|
|
2619
|
-
\\canvas_revision_before="$(canvas_revision_from_snapshot)"
|
|
2620
|
-
\\case "$canvas_revision_before" in ''|*[!0-9]*) canvas_revision_before=0 ;; esac
|
|
2621
|
-
\\canvas_revision_after="$canvas_revision_before"
|
|
2622
|
-
\\"$cli" automate widget-wheel components-canvas 130 20 >/dev/null 2>&1
|
|
2623
|
-
\\attempts=0
|
|
2624
|
-
\\while [ "$attempts" -lt 50 ]; do
|
|
2625
|
-
\\ snapshot="$(cat "$automation_dir/snapshot.txt" 2>/dev/null || true)"
|
|
2626
|
-
\\ gpu_frame_after="$(gpu_frame_from_snapshot)"
|
|
2627
|
-
\\ case "$gpu_frame_after" in ''|*[!0-9]*) gpu_frame_after=0 ;; esac
|
|
2628
|
-
\\ canvas_revision_after="$(canvas_revision_from_snapshot)"
|
|
2629
|
-
\\ case "$canvas_revision_after" in ''|*[!0-9]*) canvas_revision_after=0 ;; esac
|
|
2630
|
-
\\ if [ "$gpu_frame_after" -gt "$gpu_frame_before" ] || [ "$canvas_revision_after" -gt "$canvas_revision_before" ]; then
|
|
2631
|
-
\\ case "$snapshot" in *'widget @w1/components-canvas#130 role=group'*'scroll=[offset=84,viewport=56,content=140]'*)
|
|
2632
|
-
\\ case "$snapshot" in *'view @w1/components-canvas kind=gpu_surface'*'canvas_frame_full_repaint=false'*'canvas_frame_pipeline_uploads=0'*'canvas_frame_image_uploads=0'*'canvas_frame_glyph_uploads=0'*'canvas_frame_text_uploads=0'*'canvas_frame_gpu_packet_unsupported=0'*'canvas_frame_gpu_packet_representable=true'*) break ;; esac
|
|
2633
|
-
\\ ;;
|
|
2634
|
-
\\ esac
|
|
2635
|
-
\\ fi
|
|
2636
|
-
\\ attempts=$((attempts + 1))
|
|
2637
|
-
\\ sleep 0.1
|
|
2638
|
-
\\done
|
|
2639
|
-
\\if [ "$gpu_frame_after" -le "$gpu_frame_before" ] && [ "$canvas_revision_after" -le "$canvas_revision_before" ]; then echo "scroll automation wheel did not update the retained GPU canvas" >&2; exit 1; fi
|
|
2640
|
-
\\case "$snapshot" in *'widget @w1/components-canvas#130 role=group'*'scroll=[offset=84,viewport=56,content=140]'*) ;; *) echo "scroll automation wheel did not update retained scroll semantics" >&2; exit 1 ;; esac
|
|
2641
|
-
\\case "$snapshot" in *'view @w1/components-canvas kind=gpu_surface'*'canvas_frame_full_repaint=false'*'canvas_frame_pipeline_uploads=0'*'canvas_frame_image_uploads=0'*'canvas_frame_glyph_uploads=0'*'canvas_frame_text_uploads=0'*'canvas_frame_gpu_packet_unsupported=0'*'canvas_frame_gpu_packet_representable=true'*) ;; *) echo "scroll automation wheel did not present an incremental GPU packet without interaction-time uploads" >&2; exit 1 ;; esac
|
|
2642
|
-
\\input_timestamp="$(printf '%s\n' "$snapshot" | sed -n 's/.*view @w1\/components-canvas kind=gpu_surface.* gpu_input_timestamp_ns=\([0-9][0-9]*\).*/\1/p')"
|
|
2643
|
-
\\case "$input_timestamp" in ''|*[!0-9]*) echo "components GPU input timestamp was missing after widget interaction" >&2; exit 1 ;; esac
|
|
2644
|
-
\\if [ "$input_timestamp" -le 0 ]; then echo "components GPU input timestamp was not recorded" >&2; exit 1; fi
|
|
2645
|
-
\\input_latency="$(printf '%s\n' "$snapshot" | sed -n 's/.*view @w1\/components-canvas kind=gpu_surface.* gpu_input_latency_ns=\([0-9][0-9]*\).*/\1/p')"
|
|
2646
|
-
\\case "$input_latency" in ''|*[!0-9]*) echo "components GPU input latency was missing after widget interaction" >&2; exit 1 ;; esac
|
|
2647
|
-
\\# gpu_input_latency now stamps at the RESPONDING present's completion
|
|
2648
|
-
\\# (input to glass), which legitimately spans the paced render wait —
|
|
2649
|
-
\\# up to a couple of display intervals while animations hold the paced
|
|
2650
|
-
\\# loop. Assert an explicit input-to-glass bound (the perf harness
|
|
2651
|
-
\\# budgets the same channel at 100 ms) instead of the one-interval
|
|
2652
|
-
\\# budget flag the old completion-channel stamp happened to satisfy.
|
|
2653
|
-
\\if [ "$input_latency" -le 0 ] || [ "$input_latency" -gt 100000000 ]; then echo "components GPU input-to-glass latency was implausible: $input_latency ns" >&2; exit 1; fi
|
|
2571
|
+
\\"$cli" automate assert 'role=treeitem name="Tree".*state=\[[^]]*selected' 'role=text name="Tree"'
|
|
2572
|
+
\\scroll_line="$(grep 'name="Scrollable component tree"' "$snapshot" | head -1)"
|
|
2573
|
+
\\case "$scroll_line" in *'scroll=[offset=0,'*) echo "tree selection did not scroll the final row into view" >&2; exit 1 ;; *'scroll=[offset='*) ;; *) echo "component tree scroll semantics were missing" >&2; exit 1 ;; esac
|
|
2574
|
+
\\"$cli" automate widget-key components-canvas arrowleft >/dev/null 2>&1
|
|
2575
|
+
\\"$cli" automate widget-key components-canvas arrowleft >/dev/null 2>&1
|
|
2576
|
+
\\"$cli" automate assert --absent 'role=treeitem name="Accordion"'
|
|
2577
|
+
\\"$cli" automate widget-key components-canvas arrowright >/dev/null 2>&1
|
|
2578
|
+
\\"$cli" automate assert 'role=treeitem name="Accordion"'
|
|
2579
|
+
\\dropdown_row_id="$(widget_id treeitem "Dropdown Menu")"
|
|
2580
|
+
\\case "$dropdown_row_id" in ''|*[!0-9]*) echo "dropdown navigation id was missing" >&2; exit 1 ;; esac
|
|
2581
|
+
\\"$cli" automate widget-action components-canvas "$dropdown_row_id" press >/dev/null 2>&1
|
|
2582
|
+
\\"$cli" automate assert 'role=text name="Dropdown Menu"' 'role=button name="Actions"'
|
|
2583
|
+
\\actions_id="$(widget_id button Actions)"
|
|
2584
|
+
\\case "$actions_id" in ''|*[!0-9]*) echo "dropdown trigger id was missing" >&2; exit 1 ;; esac
|
|
2585
|
+
\\"$cli" automate widget-click components-canvas "$actions_id" >/dev/null 2>&1
|
|
2586
|
+
\\"$cli" automate assert 'role=menu name=""' 'role=menuitem name="Duplicate"' 'role=menuitem name="Rename"' 'role=menuitem name="Download"' 'role=menuitem name="Delete"'
|
|
2587
|
+
\\"$cli" automate widget-key components-canvas arrowdown >/dev/null 2>&1
|
|
2588
|
+
\\"$cli" automate widget-key components-canvas arrowdown >/dev/null 2>&1
|
|
2589
|
+
\\"$cli" automate widget-key components-canvas enter >/dev/null 2>&1
|
|
2590
|
+
\\"$cli" automate assert --absent 'role=menu name=""' 'role=menuitem name="Duplicate"'
|
|
2591
|
+
\\"$cli" automate assert 'role=text name="Last action: Rename"'
|
|
2592
|
+
\\"$cli" automate widget-click components-canvas "$actions_id" >/dev/null 2>&1
|
|
2593
|
+
\\"$cli" automate widget-key components-canvas arrowup >/dev/null 2>&1
|
|
2594
|
+
\\"$cli" automate widget-key components-canvas enter >/dev/null 2>&1
|
|
2595
|
+
\\"$cli" automate assert 'role=text name="Last action: Delete"'
|
|
2596
|
+
\\select_row_id="$(widget_id treeitem Select)"
|
|
2597
|
+
\\case "$select_row_id" in ''|*[!0-9]*) echo "select navigation id was missing" >&2; exit 1 ;; esac
|
|
2598
|
+
\\"$cli" automate widget-action components-canvas "$select_row_id" press >/dev/null 2>&1
|
|
2599
|
+
\\"$cli" automate assert 'role=text name="Select"' 'role=button name="Environment selector"'
|
|
2600
|
+
\\select_id="$(widget_id button "Environment selector")"
|
|
2601
|
+
\\case "$select_id" in ''|*[!0-9]*) echo "select trigger id was missing" >&2; exit 1 ;; esac
|
|
2602
|
+
\\"$cli" automate widget-click components-canvas "$select_id" >/dev/null 2>&1
|
|
2603
|
+
\\"$cli" automate assert 'role=menuitem name="Production".*state=\[selected\]' 'role=menuitem name="Staging"' 'role=menuitem name="Development"'
|
|
2604
|
+
\\"$cli" automate widget-key components-canvas arrowdown >/dev/null 2>&1
|
|
2605
|
+
\\"$cli" automate widget-key components-canvas arrowdown >/dev/null 2>&1
|
|
2606
|
+
\\"$cli" automate widget-key components-canvas enter >/dev/null 2>&1
|
|
2607
|
+
\\"$cli" automate assert --absent 'role=menu name=""'
|
|
2608
|
+
\\"$cli" automate widget-click components-canvas "$select_id" >/dev/null 2>&1
|
|
2609
|
+
\\"$cli" automate assert 'role=menuitem name="Staging".*state=\[selected\]'
|
|
2610
|
+
\\"$cli" automate widget-key components-canvas arrowup >/dev/null 2>&1
|
|
2611
|
+
\\"$cli" automate widget-key components-canvas arrowup >/dev/null 2>&1
|
|
2612
|
+
\\"$cli" automate widget-key components-canvas enter >/dev/null 2>&1
|
|
2613
|
+
\\"$cli" automate widget-click components-canvas "$select_id" >/dev/null 2>&1
|
|
2614
|
+
\\"$cli" automate assert 'role=menuitem name="Production".*state=\[selected\]'
|
|
2615
|
+
\\"$cli" automate widget-key components-canvas escape >/dev/null 2>&1
|
|
2616
|
+
\\"$cli" automate assert --absent 'role=menu name=""'
|
|
2617
|
+
\\navigation_scroll_id="$(widget_id group "Scrollable component tree")"
|
|
2618
|
+
\\case "$navigation_scroll_id" in ''|*[!0-9]*) echo "component navigation scroll id was missing" >&2; exit 1 ;; esac
|
|
2619
|
+
\\"$cli" automate widget-wheel components-canvas "$navigation_scroll_id" 220 >/dev/null 2>&1
|
|
2620
|
+
\\switch_row_id="$(widget_id treeitem Switch)"
|
|
2621
|
+
\\case "$switch_row_id" in ''|*[!0-9]*) echo "switch navigation id was missing" >&2; exit 1 ;; esac
|
|
2622
|
+
\\"$cli" automate widget-action components-canvas "$switch_row_id" press >/dev/null 2>&1
|
|
2623
|
+
\\"$cli" automate assert 'role=text name="Switch"' 'role=switch name="Notifications".*value=1' 'role=switch name="Airplane mode".*value=0'
|
|
2624
|
+
\\airplane_id="$(widget_id switch "Airplane mode")"
|
|
2625
|
+
\\case "$airplane_id" in ''|*[!0-9]*) echo "airplane mode switch id was missing" >&2; exit 1 ;; esac
|
|
2626
|
+
\\"$cli" automate widget-click components-canvas "$airplane_id" >/dev/null 2>&1
|
|
2627
|
+
\\"$cli" automate assert 'role=switch name="Notifications".*value=1' 'role=switch name="Airplane mode".*value=1'
|
|
2628
|
+
\\"$cli" automate screenshot components-canvas >/dev/null 2>&1
|
|
2629
|
+
\\test -s "$automation_dir/screenshot-components-canvas.png" || { echo "component gallery screenshot was empty" >&2; exit 1; }
|
|
2654
2630
|
\\echo "gpu-components smoke ok"
|
|
2655
2631
|
,
|
|
2656
2632
|
"sh",
|
|
@@ -2895,19 +2871,28 @@ pub fn build(b: *std.Build) void {
|
|
|
2895
2871
|
const notarize_step = b.step("notarize", "Package, sign with identity, and notarize for macOS distribution");
|
|
2896
2872
|
notarize_step.dependOn(¬arize_run.step);
|
|
2897
2873
|
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
,
|
|
2874
|
+
// Run the same styled archive path app developers get from
|
|
2875
|
+
// `native package --archive`: generated/custom background, Applications
|
|
2876
|
+
// alias, Finder geometry, then compressed UDZO output. Keeping this as a
|
|
2877
|
+
// CLI invocation means the repository helper cannot drift into producing
|
|
2878
|
+
// a plainer image than the product surface it documents.
|
|
2879
|
+
const dmg_run = b.addRunArtifact(host_cli_exe);
|
|
2880
|
+
dmg_run.addArgs(&.{
|
|
2881
|
+
"package",
|
|
2882
|
+
"--target",
|
|
2883
|
+
"macos",
|
|
2884
|
+
"--output",
|
|
2885
|
+
b.fmt("zig-out/package/native-sdk-{s}-macos-{s}.app", .{ package_version, optimize_name }),
|
|
2886
|
+
"--binary",
|
|
2907
2887
|
});
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2888
|
+
dmg_run.addFileArg(embed_lib.getEmittedBin());
|
|
2889
|
+
dmg_run.addArgs(&.{ "--manifest", "app.zon", "--assets", "assets", "--optimize", optimize_name, "--signing", @tagName(signing_mode), "--web-engine", @tagName(web_engine), "--cef-dir", cef_dir, "--archive" });
|
|
2890
|
+
if (cef_auto_install) dmg_run.addArg("--cef-auto-install");
|
|
2891
|
+
dmg_run.step.dependOn(&embed_lib.step);
|
|
2892
|
+
dmg_run.step.dependOn(&bundle_run.step);
|
|
2893
|
+
dmg_run.has_side_effects = true;
|
|
2894
|
+
const dmg_step = b.step("dmg", "Create a styled macOS .dmg with a drag-to-Applications layout");
|
|
2895
|
+
dmg_step.dependOn(&dmg_run.step);
|
|
2911
2896
|
|
|
2912
2897
|
const cef_bundle_script = b.addSystemCommand(&.{
|
|
2913
2898
|
"sh", "-c",
|
|
@@ -2934,6 +2919,19 @@ pub fn build(b: *std.Build) void {
|
|
|
2934
2919
|
cef_bundle_step.dependOn(&cef_bundle_script.step);
|
|
2935
2920
|
}
|
|
2936
2921
|
|
|
2922
|
+
fn sqliteCompileFlags() []const []const u8 {
|
|
2923
|
+
return &.{
|
|
2924
|
+
"-DSQLITE_THREADSAFE=2",
|
|
2925
|
+
"-DSQLITE_OMIT_LOAD_EXTENSION",
|
|
2926
|
+
"-DSQLITE_DQS=0",
|
|
2927
|
+
"-DSQLITE_ENABLE_FTS5",
|
|
2928
|
+
"-DSQLITE_ENABLE_JSON1",
|
|
2929
|
+
"-DSQLITE_ENABLE_UPDATE_HOOK",
|
|
2930
|
+
"-DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1",
|
|
2931
|
+
"-DSQLITE_DEFAULT_MEMSTATUS=0",
|
|
2932
|
+
};
|
|
2933
|
+
}
|
|
2934
|
+
|
|
2937
2935
|
fn module(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.builtin.OptimizeMode, path: []const u8) *std.Build.Module {
|
|
2938
2936
|
return b.createModule(.{
|
|
2939
2937
|
.root_source_file = b.path(path),
|
|
@@ -2981,6 +2979,7 @@ fn testArtifact(b: *std.Build, mod: *std.Build.Module) *std.Build.Step.Compile {
|
|
|
2981
2979
|
/// installed dependency (`npm ci` in packages/core) is missing.
|
|
2982
2980
|
const TsCoreE2eArtifacts = struct {
|
|
2983
2981
|
host: *std.Build.Step.Compile,
|
|
2982
|
+
persist: *std.Build.Step.Compile,
|
|
2984
2983
|
/// The markup battery is its own binary: the compiled-core symbol
|
|
2985
2984
|
/// set is a fixed-prefix C ABI, so one process carries ONE archive
|
|
2986
2985
|
/// — every fixture battery links exactly its own core.
|
|
@@ -2993,6 +2992,20 @@ const TsCoreE2eArtifacts = struct {
|
|
|
2993
2992
|
/// paths, and builds keep working with node_modules deleted.
|
|
2994
2993
|
scaffold_ide: *std.Build.Step.Compile,
|
|
2995
2994
|
ai_chat: *std.Build.Step.Compile,
|
|
2995
|
+
/// The phase-1 service seam: a real compiled core plus a real plain-scriptc
|
|
2996
|
+
/// service executable driven through the out-of-process carrier.
|
|
2997
|
+
services: *std.Build.Step.Compile,
|
|
2998
|
+
/// The in-process service carrier: the same fixture compiled as a
|
|
2999
|
+
/// thread-instanced library archive, linked into this battery and driven
|
|
3000
|
+
/// through ServicePool (parallel keys, per-key FIFO, cooperative
|
|
3001
|
+
/// cancellation/deadlines, trap isolation, streaming, replay). Null when
|
|
3002
|
+
/// the target cannot carry the archive (cross or non-desktop builds).
|
|
3003
|
+
services_pool: ?*std.Build.Step.Compile,
|
|
3004
|
+
/// The service-host carrier benchmark: a bytes-echo service compiled
|
|
3005
|
+
/// through the same lane, driven directly through the production
|
|
3006
|
+
/// carrier bindings of BOTH carriers (cold start, round-trip latency,
|
|
3007
|
+
/// queued throughput).
|
|
3008
|
+
service_host_bench: *std.Build.Step.Compile,
|
|
2996
3009
|
/// Sidecar-shim conformance (tests/sidecar): every fixture's
|
|
2997
3010
|
/// generated mirror validated over its frontend-emitted contract
|
|
2998
3011
|
/// (plus the hand-written ground-truth sidecars), and every shim
|
|
@@ -3043,16 +3056,17 @@ fn tsCoreE2eArtifact(
|
|
|
3043
3056
|
|
|
3044
3057
|
// corewire (the contract-sidecar mirror/facade/profile generator),
|
|
3045
3058
|
// compiled for the build host: the fixture compiles and the
|
|
3046
|
-
// conformance shims all run it
|
|
3059
|
+
// conformance shims all run it, including under a cross -Dtarget
|
|
3060
|
+
// (the batteries compile for the target; this tool never does).
|
|
3047
3061
|
const corewire_mod = b.createModule(.{
|
|
3048
3062
|
.root_source_file = b.path("tools/corewire/main.zig"),
|
|
3049
|
-
.target =
|
|
3063
|
+
.target = b.graph.host,
|
|
3050
3064
|
.optimize = optimize,
|
|
3051
3065
|
});
|
|
3052
3066
|
const corewire_exe = b.addExecutable(.{
|
|
3053
3067
|
.name = "corewire",
|
|
3054
3068
|
.root_module = corewire_mod,
|
|
3055
|
-
.use_llvm = @import("build/app.zig").useLlvmWorkaround(
|
|
3069
|
+
.use_llvm = @import("build/app.zig").useLlvmWorkaround(b.graph.host),
|
|
3056
3070
|
});
|
|
3057
3071
|
|
|
3058
3072
|
// Each fixture core compiles through the external core compiler at
|
|
@@ -3068,12 +3082,26 @@ fn tsCoreE2eArtifact(
|
|
|
3068
3082
|
.entry = "tests/ts-core/fixture.ts",
|
|
3069
3083
|
.src_dir = host_src.getDirectory(),
|
|
3070
3084
|
.name = "host_fixture_core",
|
|
3085
|
+
.store_capability = true,
|
|
3086
|
+
.relational_capability = true,
|
|
3087
|
+
.credentials_capability = true,
|
|
3071
3088
|
// The fixture drives pastBytes to the f64-exact boundary (2^53):
|
|
3072
3089
|
// no honest i64 declaration exists there, so the compiled
|
|
3073
3090
|
// projection carries the slot as f64.
|
|
3074
3091
|
.f64_slots = &.{"Model.pastBytes"},
|
|
3075
3092
|
});
|
|
3076
3093
|
const fixture_mod = host_fixture.module;
|
|
3094
|
+
const persist_src = b.addWriteFiles();
|
|
3095
|
+
_ = persist_src.addCopyFile(b.path("tests/ts-core/persist_fixture.ts"), "persist_fixture.ts");
|
|
3096
|
+
const persist_fixture = externalCoreFixtureModule(b, target, optimize, node, corewire_exe, .{
|
|
3097
|
+
.entry = "tests/ts-core/persist_fixture.ts",
|
|
3098
|
+
.src_dir = persist_src.getDirectory(),
|
|
3099
|
+
.name = "persist_fixture_core",
|
|
3100
|
+
.persist_capability = true,
|
|
3101
|
+
});
|
|
3102
|
+
const persist_mod = module(b, target, optimize, "tests/ts-core/persist_e2e_tests.zig");
|
|
3103
|
+
persist_mod.addImport("native_sdk", desktop_mod);
|
|
3104
|
+
persist_mod.addImport("ts_persist_core", persist_fixture.module);
|
|
3077
3105
|
const markup_src = b.addWriteFiles();
|
|
3078
3106
|
_ = markup_src.addCopyFile(b.path("tests/ts-core/markup_fixture.ts"), "markup_fixture.ts");
|
|
3079
3107
|
const markup_fixture = externalCoreFixtureModule(b, target, optimize, node, corewire_exe, .{
|
|
@@ -3163,18 +3191,18 @@ fn tsCoreE2eArtifact(
|
|
|
3163
3191
|
const scaffold_ide_mod = module(b, target, optimize, "tests/ts-core/scaffold_ide_e2e_tests.zig");
|
|
3164
3192
|
scaffold_ide_mod.addImport("tooling", tooling_mod);
|
|
3165
3193
|
|
|
3166
|
-
// The
|
|
3194
|
+
// The Chatbot example's core and markup, tested the same way:
|
|
3167
3195
|
// the chat client for an OpenAI-compatible endpoint, driven through
|
|
3168
3196
|
// the fake fetch feed (no network) with its shipping markup.
|
|
3169
3197
|
const ai_chat_fixture = externalCoreFixtureModule(b, target, optimize, node, corewire_exe, .{
|
|
3170
|
-
.entry = "examples/
|
|
3171
|
-
.src_dir = b.path("examples/
|
|
3198
|
+
.entry = "examples/chatbot/src/core.ts",
|
|
3199
|
+
.src_dir = b.path("examples/chatbot/src"),
|
|
3172
3200
|
.name = "ai_chat_core",
|
|
3173
3201
|
});
|
|
3174
3202
|
const ai_chat_core_mod = ai_chat_fixture.module;
|
|
3175
3203
|
const ai_chat_stage = b.addWriteFiles();
|
|
3176
3204
|
const ai_chat_root = ai_chat_stage.addCopyFile(b.path("tests/ts-core/ai_chat_e2e_tests.zig"), "ai_chat_e2e_tests.zig");
|
|
3177
|
-
_ = ai_chat_stage.addCopyFile(b.path("examples/
|
|
3205
|
+
_ = ai_chat_stage.addCopyFile(b.path("examples/chatbot/src/app.native"), "app.native");
|
|
3178
3206
|
const ai_chat_mod = b.createModule(.{
|
|
3179
3207
|
.root_source_file = ai_chat_root,
|
|
3180
3208
|
.target = target,
|
|
@@ -3183,6 +3211,93 @@ fn tsCoreE2eArtifact(
|
|
|
3183
3211
|
ai_chat_mod.addImport("native_sdk", desktop_mod);
|
|
3184
3212
|
ai_chat_mod.addImport("ts_ai_chat_core", ai_chat_core_mod);
|
|
3185
3213
|
|
|
3214
|
+
// Phase-1 TypeScript services, end to end: the frontend emits BOTH
|
|
3215
|
+
// sidecars from one checked two-class program; corewire derives the
|
|
3216
|
+
// registry/host only from the service sidecar; plain scriptc compiles the
|
|
3217
|
+
// child executable; and the Zig battery drives that executable through
|
|
3218
|
+
// the production ServiceHost + effects/session boundary.
|
|
3219
|
+
const services_fixture = externalCoreFixtureModule(b, target, optimize, node, corewire_exe, .{
|
|
3220
|
+
.entry = "tests/ts-services/ok/src/core.ts",
|
|
3221
|
+
.src_dir = b.path("tests/ts-services/ok/src"),
|
|
3222
|
+
.name = "services_fixture_core",
|
|
3223
|
+
.emit_services = true,
|
|
3224
|
+
.service_packages = &.{"escape-string-regexp|5.0.0|705f4bb4b92fd3469e264a93f2a2e4b24cf7e663d73a5318abaf29ee72674f6d"},
|
|
3225
|
+
});
|
|
3226
|
+
const service_host_fixture = externalServiceFixture(
|
|
3227
|
+
b,
|
|
3228
|
+
target,
|
|
3229
|
+
optimize,
|
|
3230
|
+
node,
|
|
3231
|
+
corewire_exe,
|
|
3232
|
+
b.path("tests/ts-services/ok/src"),
|
|
3233
|
+
services_fixture.services_contract.?,
|
|
3234
|
+
"ts_services_fixture_services",
|
|
3235
|
+
);
|
|
3236
|
+
const services_e2e_mod = module(b, target, optimize, "tests/ts-services/service_e2e_tests.zig");
|
|
3237
|
+
services_e2e_mod.addImport("native_sdk", desktop_mod);
|
|
3238
|
+
services_e2e_mod.addImport("ts_services_core", services_fixture.module);
|
|
3239
|
+
services_e2e_mod.addImport("ts_services_registry", service_host_fixture.registry);
|
|
3240
|
+
const service_test_options = b.addOptions();
|
|
3241
|
+
service_test_options.addOptionPath("service_executable", service_host_fixture.executable);
|
|
3242
|
+
service_test_options.addOption([]const u8, "node_executable", node);
|
|
3243
|
+
services_e2e_mod.addOptions("ts_services_options", service_test_options);
|
|
3244
|
+
|
|
3245
|
+
// The same fixture against the in-process carrier: the service archive
|
|
3246
|
+
// links into the battery beside the fixture core's archive (distinct
|
|
3247
|
+
// symbol prefixes), and ServicePool drives it through the identical
|
|
3248
|
+
// TsUiApp/Effects seam.
|
|
3249
|
+
const services_pool_mod: ?*std.Build.Module = if (service_host_fixture.archive) |service_archive| pool: {
|
|
3250
|
+
const pool_mod = module(b, target, optimize, "tests/ts-services/service_pool_e2e_tests.zig");
|
|
3251
|
+
pool_mod.addImport("native_sdk", desktop_mod);
|
|
3252
|
+
pool_mod.addImport("ts_services_core", services_fixture.module);
|
|
3253
|
+
pool_mod.addImport("ts_services_registry", service_host_fixture.registry);
|
|
3254
|
+
pool_mod.link_libc = true;
|
|
3255
|
+
pool_mod.addObjectFile(service_archive);
|
|
3256
|
+
addScriptcArchiveSystemLibs(pool_mod, target);
|
|
3257
|
+
break :pool pool_mod;
|
|
3258
|
+
} else null;
|
|
3259
|
+
|
|
3260
|
+
// Service-host carrier benchmark: the same production service lane
|
|
3261
|
+
// (frontend contract -> corewire host/registry -> exact-pinned
|
|
3262
|
+
// plain-scriptc executable) over a bytes-echo operation that returns
|
|
3263
|
+
// its request unchanged, so tools/bench_service_host.zig measures the
|
|
3264
|
+
// carrier — lazy spawn, framing, pipes, worker queueing — and never a
|
|
3265
|
+
// workload.
|
|
3266
|
+
const service_bench_core = externalCoreFixtureModule(b, target, optimize, node, corewire_exe, .{
|
|
3267
|
+
.entry = "tools/service-host-bench/src/core.ts",
|
|
3268
|
+
.src_dir = b.path("tools/service-host-bench/src"),
|
|
3269
|
+
.name = "service_host_bench_core",
|
|
3270
|
+
.emit_services = true,
|
|
3271
|
+
});
|
|
3272
|
+
const service_bench_fixture = externalServiceFixture(
|
|
3273
|
+
b,
|
|
3274
|
+
target,
|
|
3275
|
+
optimize,
|
|
3276
|
+
node,
|
|
3277
|
+
corewire_exe,
|
|
3278
|
+
b.path("tools/service-host-bench/src"),
|
|
3279
|
+
service_bench_core.services_contract.?,
|
|
3280
|
+
"service_host_bench_services",
|
|
3281
|
+
);
|
|
3282
|
+
const service_bench_mod = module(b, target, optimize, "tools/bench_service_host.zig");
|
|
3283
|
+
service_bench_mod.addImport("native_sdk", desktop_mod);
|
|
3284
|
+
service_bench_mod.addImport("service_registry", service_bench_fixture.registry);
|
|
3285
|
+
const service_bench_options = b.addOptions();
|
|
3286
|
+
service_bench_options.addOptionPath("service_executable", service_bench_fixture.executable);
|
|
3287
|
+
service_bench_options.addOption(bool, "has_archive", service_bench_fixture.archive != null);
|
|
3288
|
+
service_bench_mod.addOptions("bench_options", service_bench_options);
|
|
3289
|
+
if (service_bench_fixture.archive) |bench_archive| {
|
|
3290
|
+
// The in-process carrier's half of the benchmark: the same echo
|
|
3291
|
+
// service as a linked archive, driven through ServicePool.
|
|
3292
|
+
service_bench_mod.link_libc = true;
|
|
3293
|
+
service_bench_mod.addObjectFile(bench_archive);
|
|
3294
|
+
addScriptcArchiveSystemLibs(service_bench_mod, target);
|
|
3295
|
+
}
|
|
3296
|
+
const service_bench_exe = b.addExecutable(.{
|
|
3297
|
+
.name = "bench-service-host",
|
|
3298
|
+
.root_module = service_bench_mod,
|
|
3299
|
+
});
|
|
3300
|
+
|
|
3186
3301
|
// Sidecar-shim conformance: a corewire-generated mirror per corpus
|
|
3187
3302
|
// fixture. The markup fixture's sidecar is the committed
|
|
3188
3303
|
// hand-written one (independent ground truth for the schema); the
|
|
@@ -3252,21 +3367,152 @@ fn tsCoreE2eArtifact(
|
|
|
3252
3367
|
abi_laws_mod.addImport("core_abi", module(b, target, optimize, "tools/corewire/core_abi.zig"));
|
|
3253
3368
|
abi_laws_mod.addImport("shim_core", sidecarShimModule(b, target, optimize, corewire_exe, markup_fixture.sidecar));
|
|
3254
3369
|
abi_laws_mod.addObjectFile(markup_fixture.archive);
|
|
3370
|
+
addScriptcArchiveSystemLibs(abi_laws_mod, target);
|
|
3255
3371
|
|
|
3256
3372
|
return .{
|
|
3257
3373
|
.host = filteredTestArtifact(b, e2e_mod, "ts-core-e2e-tests", &.{}),
|
|
3374
|
+
.persist = filteredTestArtifact(b, persist_mod, "ts-persist-e2e-tests", &.{}),
|
|
3258
3375
|
.markup = filteredTestArtifact(b, markup_e2e_mod, "ts-markup-e2e-tests", &.{}),
|
|
3259
3376
|
.kanban = filteredTestArtifact(b, kanban_mod, "ts-kanban-e2e-tests", &.{}),
|
|
3260
3377
|
.soundboard = filteredTestArtifact(b, soundboard_mod, "ts-soundboard-e2e-tests", &.{}),
|
|
3261
3378
|
.system_monitor = filteredTestArtifact(b, monitor_mod, "ts-system-monitor-e2e-tests", &.{}),
|
|
3262
3379
|
.scaffold_ide = filteredTestArtifact(b, scaffold_ide_mod, "ts-scaffold-ide-e2e-tests", &.{}),
|
|
3263
3380
|
.ai_chat = filteredTestArtifact(b, ai_chat_mod, "ts-ai-chat-e2e-tests", &.{}),
|
|
3381
|
+
.services = filteredTestArtifact(b, services_e2e_mod, "ts-services-e2e-tests", &.{}),
|
|
3382
|
+
.services_pool = if (services_pool_mod) |pool_mod| filteredTestArtifact(b, pool_mod, "ts-services-pool-e2e-tests", &.{}) else null,
|
|
3383
|
+
.service_host_bench = service_bench_exe,
|
|
3264
3384
|
.sidecar_conformance = filteredTestArtifact(b, conformance_mod, "sidecar-conformance-tests", &.{}),
|
|
3265
3385
|
.external_core_abi_laws = filteredTestArtifact(b, abi_laws_mod, "external-core-abi-tests", &.{}),
|
|
3266
3386
|
.core_contracts = core_contracts.toOwnedSlice(b.allocator) catch @panic("OOM"),
|
|
3267
3387
|
};
|
|
3268
3388
|
}
|
|
3269
3389
|
|
|
3390
|
+
/// System import libraries scriptc's compiled-archive runtime reaches on
|
|
3391
|
+
/// Windows targets — core and service archives alike (Winsock, adapter
|
|
3392
|
+
/// enumeration, and crypto-backed randomness). No-op elsewhere; the
|
|
3393
|
+
/// archives' other dependencies are libc's. The app lane's twin is the
|
|
3394
|
+
/// Windows platform block in build/app.zig.
|
|
3395
|
+
fn addScriptcArchiveSystemLibs(mod: *std.Build.Module, target: std.Build.ResolvedTarget) void {
|
|
3396
|
+
if (target.result.os.tag != .windows) return;
|
|
3397
|
+
mod.linkSystemLibrary("ws2_32", .{});
|
|
3398
|
+
mod.linkSystemLibrary("iphlpapi", .{});
|
|
3399
|
+
mod.linkSystemLibrary("advapi32", .{});
|
|
3400
|
+
}
|
|
3401
|
+
|
|
3402
|
+
/// Attach ScriptC's explicit-Linux-target glibc-floor teaching to an actual
|
|
3403
|
+
/// compile step. A target can match the host triple and still need the teaching
|
|
3404
|
+
/// because Zig's explicitly spelled `-gnu` target uses its default glibc floor.
|
|
3405
|
+
/// The root graph constructs fixture lanes even for unrelated selections such
|
|
3406
|
+
/// as the release pipeline's cross-compiled `zig build cli`; making the
|
|
3407
|
+
/// teaching a dependency preserves those CLI-only builds while still refusing
|
|
3408
|
+
/// the unsupported target before a selected ScriptC compile does any work.
|
|
3409
|
+
fn addScriptcGlibcFloorTeaching(b: *std.Build, target: std.Build.ResolvedTarget, step: *std.Build.Step) void {
|
|
3410
|
+
const app_build = @import("build/app.zig");
|
|
3411
|
+
if (!app_build.linuxGlibcSpellingHitsDefaultFloor(target)) return;
|
|
3412
|
+
step.dependOn(&b.addFail(app_build.scriptcLinuxGlibcSpellingTeaching(b, target)).step);
|
|
3413
|
+
}
|
|
3414
|
+
|
|
3415
|
+
const ExternalServiceFixture = struct {
|
|
3416
|
+
executable: std.Build.LazyPath,
|
|
3417
|
+
/// The in-process carrier's library archive (thread-instanced,
|
|
3418
|
+
/// runtime-localized), compiled from the same staged tree. Present
|
|
3419
|
+
/// wherever the pinned compiler's localized-archive matrix covers the
|
|
3420
|
+
/// pairing (native Linux, cross-Linux x86_64/aarch64, Windows x86_64,
|
|
3421
|
+
/// or macOS from a macOS host — see build/app.zig
|
|
3422
|
+
/// serviceArchiveSupported); null elsewhere, and for explicitly spelled
|
|
3423
|
+
/// linux-gnu targets below the glibc 2.36 runtime floor.
|
|
3424
|
+
archive: ?std.Build.LazyPath,
|
|
3425
|
+
registry: *std.Build.Module,
|
|
3426
|
+
};
|
|
3427
|
+
|
|
3428
|
+
/// Compile one fixture's service class through the production phase-1 lane:
|
|
3429
|
+
/// service sidecar -> corewire host/registry -> ordinary source stage (plus
|
|
3430
|
+
/// the pinned compiler's tagged-throw compatibility lowering) -> exact pinned
|
|
3431
|
+
/// scriptc outputs (the child executable, plus the in-process library archive
|
|
3432
|
+
/// wherever the compiler's localized-archive matrix covers the host/target
|
|
3433
|
+
/// pairing). No author source is re-read for dispatch facts after the sidecar
|
|
3434
|
+
/// emission.
|
|
3435
|
+
fn externalServiceFixture(
|
|
3436
|
+
b: *std.Build,
|
|
3437
|
+
target: std.Build.ResolvedTarget,
|
|
3438
|
+
optimize: std.builtin.OptimizeMode,
|
|
3439
|
+
node: []const u8,
|
|
3440
|
+
corewire_exe: *std.Build.Step.Compile,
|
|
3441
|
+
src_dir: std.Build.LazyPath,
|
|
3442
|
+
contract: std.Build.LazyPath,
|
|
3443
|
+
name: []const u8,
|
|
3444
|
+
) ExternalServiceFixture {
|
|
3445
|
+
const app_build = @import("build/app.zig");
|
|
3446
|
+
const emit_archive = app_build.serviceArchiveSupported(b.graph.host.result, target);
|
|
3447
|
+
const project = b.addRunArtifact(corewire_exe);
|
|
3448
|
+
project.addArg("--services-sidecar");
|
|
3449
|
+
project.addFileArg(contract);
|
|
3450
|
+
project.addArg("--service-host-main");
|
|
3451
|
+
const host_main = project.addOutputFileArg("service_host_main.ts");
|
|
3452
|
+
project.addArg("--service-registry");
|
|
3453
|
+
const registry_source = project.addOutputFileArg("services.zig");
|
|
3454
|
+
project.addArg("--service-inproc-main");
|
|
3455
|
+
const inproc_main = project.addOutputFileArg("service_inproc_main.ts");
|
|
3456
|
+
project.addArg("--service-inproc-profile");
|
|
3457
|
+
const inproc_profile = project.addOutputFileArg("service_profile.json");
|
|
3458
|
+
|
|
3459
|
+
const stage = b.addSystemCommand(&.{node});
|
|
3460
|
+
stage.addFileArg(b.path("packages/core/scripts/stage_external_services.mjs"));
|
|
3461
|
+
stage.addArg("--src");
|
|
3462
|
+
stage.addDirectoryArg(src_dir);
|
|
3463
|
+
stage.addArg("--host-main");
|
|
3464
|
+
stage.addFileArg(host_main);
|
|
3465
|
+
stage.addArg("--inproc-main");
|
|
3466
|
+
stage.addFileArg(inproc_main);
|
|
3467
|
+
stage.addArg("--inproc-profile");
|
|
3468
|
+
stage.addFileArg(inproc_profile);
|
|
3469
|
+
stage.addArg("--contract");
|
|
3470
|
+
stage.addFileArg(contract);
|
|
3471
|
+
stage.addArg("--out");
|
|
3472
|
+
const stage_dir = stage.addOutputDirectoryArg("services-stage");
|
|
3473
|
+
// A LazyPath directory records only its producer dependency; source-tree
|
|
3474
|
+
// content does not otherwise participate in Run's cache key. Service
|
|
3475
|
+
// files are discovered recursively by the staging script, so rerun this
|
|
3476
|
+
// cheap copy step whenever the lane is requested rather than risk a stale
|
|
3477
|
+
// compiled host after an author edits a nested service module.
|
|
3478
|
+
stage.has_side_effects = true;
|
|
3479
|
+
|
|
3480
|
+
const compile = b.addSystemCommand(&.{node});
|
|
3481
|
+
compile.addFileArg(b.path("packages/core/scripts/run_external_service_compiler.mjs"));
|
|
3482
|
+
compile.addArg("--stage");
|
|
3483
|
+
compile.addDirectoryArg(stage_dir);
|
|
3484
|
+
compile.addArg("--manifest");
|
|
3485
|
+
compile.addFileArg(b.path("packages/core/package.json"));
|
|
3486
|
+
compile.addArg("--contract");
|
|
3487
|
+
compile.addFileArg(contract);
|
|
3488
|
+
compile.addArg("--out-exe");
|
|
3489
|
+
const suffix = if (target.result.os.tag == .windows) ".exe" else "";
|
|
3490
|
+
const executable = compile.addOutputFileArg(b.fmt("{s}{s}", .{ name, suffix }));
|
|
3491
|
+
const archive: ?std.Build.LazyPath = if (emit_archive) archive: {
|
|
3492
|
+
compile.addArg("--out-archive");
|
|
3493
|
+
break :archive compile.addOutputFileArg(b.fmt("lib{s}.a", .{name}));
|
|
3494
|
+
} else null;
|
|
3495
|
+
const host_platform = b.fmt("{t}-{t}-{t}", .{ b.graph.host.result.cpu.arch, b.graph.host.result.os.tag, b.graph.host.result.abi });
|
|
3496
|
+
compile.addArgs(&.{ "--host-platform", host_platform, "--target-platform", app_build.scriptcPlatformTriple(b, target), "--zig-exe", b.graph.zig_exe });
|
|
3497
|
+
addScriptcGlibcFloorTeaching(b, target, &compile.step);
|
|
3498
|
+
if (b.graph.environ_map.get("NATIVE_SDK_CORE_COMPILER")) |override| {
|
|
3499
|
+
compile.addArgs(&.{ "--compiler", override });
|
|
3500
|
+
} else {
|
|
3501
|
+
compile.addArg("--compiler-js");
|
|
3502
|
+
compile.addFileArg(b.path("packages/core/node_modules/scriptc/dist/main.js"));
|
|
3503
|
+
}
|
|
3504
|
+
|
|
3505
|
+
return .{
|
|
3506
|
+
.executable = executable,
|
|
3507
|
+
.archive = archive,
|
|
3508
|
+
.registry = b.createModule(.{
|
|
3509
|
+
.root_source_file = registry_source,
|
|
3510
|
+
.target = target,
|
|
3511
|
+
.optimize = optimize,
|
|
3512
|
+
}),
|
|
3513
|
+
};
|
|
3514
|
+
}
|
|
3515
|
+
|
|
3270
3516
|
const FacadeProjections = struct {
|
|
3271
3517
|
sidecar: std.Build.LazyPath,
|
|
3272
3518
|
facade: std.Build.LazyPath,
|
|
@@ -3343,6 +3589,9 @@ const ExternalCoreFixture = struct {
|
|
|
3343
3589
|
/// The archive's OWN co-emitted contract sidecar — the document its
|
|
3344
3590
|
/// mirror must generate from (the boot identity fence pairs them).
|
|
3345
3591
|
sidecar: std.Build.LazyPath,
|
|
3592
|
+
/// Present only for a two-class fixture that asks the frontend to emit the
|
|
3593
|
+
/// service registry sidecar from the same checked program.
|
|
3594
|
+
services_contract: ?std.Build.LazyPath,
|
|
3346
3595
|
};
|
|
3347
3596
|
|
|
3348
3597
|
const ExternalCoreFixtureSpec = struct {
|
|
@@ -3354,11 +3603,22 @@ const ExternalCoreFixtureSpec = struct {
|
|
|
3354
3603
|
src_dir: std.Build.LazyPath,
|
|
3355
3604
|
/// The archive's symbol-safe stem (`lib<name>.a`).
|
|
3356
3605
|
name: []const u8,
|
|
3606
|
+
/// The fixture stands in for an app whose manifest declares Tier 1.
|
|
3607
|
+
persist_capability: bool = false,
|
|
3608
|
+
/// The fixture stands in for an app whose manifest declares Tier 2.
|
|
3609
|
+
store_capability: bool = false,
|
|
3610
|
+
/// The fixture stands in for an app whose manifest declares Tier 3.
|
|
3611
|
+
relational_capability: bool = false,
|
|
3612
|
+
/// The fixture stands in for an app whose manifest declares the Tier-4
|
|
3613
|
+
/// build capability and its matching core-effect permission.
|
|
3614
|
+
credentials_capability: bool = false,
|
|
3357
3615
|
/// Attested integer slots the compiled projection carries as f64
|
|
3358
3616
|
/// (values that reach the f64-exact boundary have no honest i64
|
|
3359
3617
|
/// declaration on that side) — corewire's --f64-slot demotions,
|
|
3360
3618
|
/// applied to the compile profile and every downstream projection.
|
|
3361
3619
|
f64_slots: []const []const u8 = &.{},
|
|
3620
|
+
emit_services: bool = false,
|
|
3621
|
+
service_packages: []const []const u8 = &.{},
|
|
3362
3622
|
};
|
|
3363
3623
|
|
|
3364
3624
|
/// Compile one TS fixture core through the external core compiler at
|
|
@@ -3374,6 +3634,7 @@ fn externalCoreFixtureModule(
|
|
|
3374
3634
|
corewire_exe: *std.Build.Step.Compile,
|
|
3375
3635
|
spec: ExternalCoreFixtureSpec,
|
|
3376
3636
|
) ExternalCoreFixture {
|
|
3637
|
+
const app_build = @import("build/app.zig");
|
|
3377
3638
|
// The frontend, in check-only mode: the subset checker gates the
|
|
3378
3639
|
// compile, and the contract sidecar states the build-root-relative
|
|
3379
3640
|
// entry spelling. The frontend reads its own sources, the SDK
|
|
@@ -3388,14 +3649,34 @@ fn externalCoreFixtureModule(
|
|
|
3388
3649
|
const contract = check.addOutputFileArg("core.contract.json");
|
|
3389
3650
|
check.addArg("--contract-entry");
|
|
3390
3651
|
check.addArg(spec.entry);
|
|
3652
|
+
const services_contract: ?std.Build.LazyPath = if (spec.emit_services) services: {
|
|
3653
|
+
check.addArg("--services-contract");
|
|
3654
|
+
break :services check.addOutputFileArg("services.contract.json");
|
|
3655
|
+
} else null;
|
|
3656
|
+
for (spec.service_packages) |package_entry| check.addArgs(&.{ "--service-package", package_entry });
|
|
3657
|
+
const services_client: ?std.Build.LazyPath = if (services_contract) |service_contract| client: {
|
|
3658
|
+
const service_project = b.addRunArtifact(corewire_exe);
|
|
3659
|
+
service_project.addArg("--services-sidecar");
|
|
3660
|
+
service_project.addFileArg(service_contract);
|
|
3661
|
+
service_project.addArg("--service-client");
|
|
3662
|
+
break :client service_project.addOutputFileArg("services.gen.ts");
|
|
3663
|
+
} else null;
|
|
3664
|
+
if (spec.persist_capability) check.addArgs(&.{ "--capability", "persist" });
|
|
3665
|
+
if (spec.store_capability) check.addArgs(&.{ "--capability", "store" });
|
|
3666
|
+
if (spec.relational_capability) check.addArgs(&.{ "--capability", "sqlite" });
|
|
3667
|
+
if (spec.credentials_capability) check.addArgs(&.{ "--capability", "credentials", "--permission", "credentials" });
|
|
3391
3668
|
tsCoreAddDirInputs(b, check, "packages/core/sdk");
|
|
3392
3669
|
tsCoreAddDirInputs(b, check, std.fs.path.dirname(spec.entry) orelse ".");
|
|
3393
3670
|
const frontend_sources = [_][]const u8{
|
|
3394
|
-
"checker.ts", "cli.ts", "contract.ts", "diagnostics.ts", "frontend.ts", "infer.ts", "modules.ts", "typed_ast.ts", "types.ts", "wyhash.ts",
|
|
3671
|
+
"checker.ts", "cli.ts", "contract.ts", "diagnostics.ts", "frontend.ts", "infer.ts", "modules.ts", "service_contract.ts", "sqlite_codegen.ts", "sqlite_cli.ts", "sqlite_runtime_policy.ts", "typed_ast.ts", "types.ts", "wyhash.ts",
|
|
3395
3672
|
};
|
|
3396
3673
|
for (frontend_sources) |source| {
|
|
3397
3674
|
check.addFileInput(b.path(b.fmt("packages/core/src/{s}", .{source})));
|
|
3398
3675
|
}
|
|
3676
|
+
// Service contracts echo the exact scriptc pin read from this manifest.
|
|
3677
|
+
// Declare that runtime read explicitly so a compiler bump invalidates a
|
|
3678
|
+
// warm build cache before the compile lane checks the echoed version.
|
|
3679
|
+
if (spec.emit_services) check.addFileInput(b.path("packages/core/package.json"));
|
|
3399
3680
|
|
|
3400
3681
|
// corewire projects the generated compile entry and its profile in
|
|
3401
3682
|
// one invocation, so the profile's entry spelling and the facade
|
|
@@ -3426,6 +3707,10 @@ fn externalCoreFixtureModule(
|
|
|
3426
3707
|
stage_run.addFileArg(facade);
|
|
3427
3708
|
stage_run.addArg("--profile");
|
|
3428
3709
|
stage_run.addFileArg(profile);
|
|
3710
|
+
if (services_client) |client| {
|
|
3711
|
+
stage_run.addArg("--services-client");
|
|
3712
|
+
stage_run.addFileArg(client);
|
|
3713
|
+
}
|
|
3429
3714
|
stage_run.addArg("--out");
|
|
3430
3715
|
const stage_dir = stage_run.addOutputDirectoryArg("stage");
|
|
3431
3716
|
|
|
@@ -3438,10 +3723,21 @@ fn externalCoreFixtureModule(
|
|
|
3438
3723
|
compile.addArgs(&.{ "--name", spec.name });
|
|
3439
3724
|
compile.addArg("--manifest");
|
|
3440
3725
|
compile.addFileArg(b.path("packages/core/package.json"));
|
|
3726
|
+
compile.addArg("--frontend-sidecar");
|
|
3727
|
+
compile.addFileArg(contract);
|
|
3441
3728
|
compile.addArg("--out-archive");
|
|
3442
3729
|
const archive = compile.addOutputFileArg(b.fmt("lib{s}.a", .{spec.name}));
|
|
3443
3730
|
compile.addArg("--out-sidecar");
|
|
3444
3731
|
const compiled_sidecar = compile.addOutputFileArg("core.contract.json");
|
|
3732
|
+
compile.addArgs(&.{
|
|
3733
|
+
"--host-platform",
|
|
3734
|
+
b.fmt("{t}-{t}-{t}", .{ b.graph.host.result.cpu.arch, b.graph.host.result.os.tag, b.graph.host.result.abi }),
|
|
3735
|
+
"--target-platform",
|
|
3736
|
+
app_build.scriptcPlatformTriple(b, target),
|
|
3737
|
+
"--zig-exe",
|
|
3738
|
+
b.graph.zig_exe,
|
|
3739
|
+
});
|
|
3740
|
+
addScriptcGlibcFloorTeaching(b, target, &compile.step);
|
|
3445
3741
|
if (b.graph.environ_map.get("NATIVE_SDK_CORE_COMPILER")) |override| {
|
|
3446
3742
|
// The development override: point at any toolchain command; the
|
|
3447
3743
|
// driver still refuses a release other than the SDK's pin.
|
|
@@ -3470,24 +3766,29 @@ fn externalCoreFixtureModule(
|
|
|
3470
3766
|
});
|
|
3471
3767
|
mod.link_libc = true;
|
|
3472
3768
|
mod.addObjectFile(archive);
|
|
3769
|
+
addScriptcArchiveSystemLibs(mod, target);
|
|
3473
3770
|
return .{
|
|
3474
3771
|
.module = mod,
|
|
3475
3772
|
.contract = contract,
|
|
3476
3773
|
.archive = archive,
|
|
3477
3774
|
.sidecar = compiled_sidecar,
|
|
3775
|
+
.services_contract = services_contract,
|
|
3478
3776
|
};
|
|
3479
3777
|
}
|
|
3480
3778
|
|
|
3481
|
-
/// Declare every .ts file
|
|
3482
|
-
/// file input of the transpile step — the multi-file staleness set.
|
|
3779
|
+
/// Declare every .ts file under `dir_path` (relative to the build root) as a
|
|
3780
|
+
/// file input of the transpile step — the recursive multi-file staleness set.
|
|
3781
|
+
/// Service modules live below src/services/, so a flat scan would let their
|
|
3782
|
+
/// generated contract stay stale in a warm fixture build.
|
|
3483
3783
|
fn tsCoreAddDirInputs(b: *std.Build, transpile: *std.Build.Step.Run, dir_path: []const u8) void {
|
|
3484
3784
|
var dir = b.build_root.handle.openDir(b.graph.io, dir_path, .{ .iterate = true }) catch return;
|
|
3485
3785
|
defer dir.close(b.graph.io);
|
|
3486
|
-
var
|
|
3487
|
-
|
|
3786
|
+
var walker = dir.walk(b.allocator) catch return;
|
|
3787
|
+
defer walker.deinit();
|
|
3788
|
+
while (walker.next(b.graph.io) catch null) |entry| {
|
|
3488
3789
|
if (entry.kind != .file) continue;
|
|
3489
|
-
if (!std.mem.endsWith(u8, entry.
|
|
3490
|
-
transpile.addFileInput(b.path(b.fmt("{s}/{s}", .{ dir_path, entry.
|
|
3790
|
+
if (!std.mem.endsWith(u8, entry.basename, ".ts")) continue;
|
|
3791
|
+
transpile.addFileInput(b.path(b.fmt("{s}/{s}", .{ dir_path, entry.path })));
|
|
3491
3792
|
}
|
|
3492
3793
|
}
|
|
3493
3794
|
|