@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/tools/corewire/main.zig
CHANGED
|
@@ -22,6 +22,8 @@ const sidecar_mod = @import("sidecar.zig");
|
|
|
22
22
|
const emit_mod = @import("emit.zig");
|
|
23
23
|
const emit_facade_mod = @import("emit_facade.zig");
|
|
24
24
|
const emit_profile_mod = @import("emit_profile.zig");
|
|
25
|
+
const service_contract_mod = @import("service_contract.zig");
|
|
26
|
+
const emit_service_mod = @import("emit_service.zig");
|
|
25
27
|
|
|
26
28
|
const usage =
|
|
27
29
|
\\usage: corewire --sidecar <core.contract.json> (--out <core_shim.zig> | --facade <core_facade.ts> | --profile <core_profile.json> | --effective-sidecar <effective.contract.json> | --check) [--f64-slot <path>]...
|
|
@@ -49,6 +51,8 @@ pub fn main(init: std.process.Init) !void {
|
|
|
49
51
|
var stderr_writer = std.Io.File.stderr().writerStreaming(init.io, &stderr_buffer);
|
|
50
52
|
const stderr = &stderr_writer.interface;
|
|
51
53
|
|
|
54
|
+
if (try serviceProjection(init, args, stderr)) return;
|
|
55
|
+
|
|
52
56
|
var sidecar_path: ?[]const u8 = null;
|
|
53
57
|
var out_path: ?[]const u8 = null;
|
|
54
58
|
var facade_path: ?[]const u8 = null;
|
|
@@ -358,6 +362,124 @@ pub fn main(init: std.process.Init) !void {
|
|
|
358
362
|
}
|
|
359
363
|
}
|
|
360
364
|
|
|
365
|
+
/// The service contract is a distinct schema from core.contract.json. Keep
|
|
366
|
+
/// its projection mode explicit so neither reader can accidentally accept a
|
|
367
|
+
/// document from the other class.
|
|
368
|
+
fn serviceProjection(init: std.process.Init, args: []const []const u8, stderr: *std.Io.Writer) !bool {
|
|
369
|
+
var input: ?[]const u8 = null;
|
|
370
|
+
var host_out: ?[]const u8 = null;
|
|
371
|
+
var registry_out: ?[]const u8 = null;
|
|
372
|
+
var client_out: ?[]const u8 = null;
|
|
373
|
+
var inproc_main_out: ?[]const u8 = null;
|
|
374
|
+
var inproc_profile_out: ?[]const u8 = null;
|
|
375
|
+
var saw_service_flag = false;
|
|
376
|
+
var index: usize = 1;
|
|
377
|
+
while (index < args.len) : (index += 1) {
|
|
378
|
+
const arg = args[index];
|
|
379
|
+
if (std.mem.eql(u8, arg, "--services-sidecar") and index + 1 < args.len) {
|
|
380
|
+
saw_service_flag = true;
|
|
381
|
+
index += 1;
|
|
382
|
+
input = args[index];
|
|
383
|
+
} else if (std.mem.eql(u8, arg, "--service-host-main") and index + 1 < args.len) {
|
|
384
|
+
saw_service_flag = true;
|
|
385
|
+
index += 1;
|
|
386
|
+
host_out = args[index];
|
|
387
|
+
} else if (std.mem.eql(u8, arg, "--service-registry") and index + 1 < args.len) {
|
|
388
|
+
saw_service_flag = true;
|
|
389
|
+
index += 1;
|
|
390
|
+
registry_out = args[index];
|
|
391
|
+
} else if (std.mem.eql(u8, arg, "--service-client") and index + 1 < args.len) {
|
|
392
|
+
saw_service_flag = true;
|
|
393
|
+
index += 1;
|
|
394
|
+
client_out = args[index];
|
|
395
|
+
} else if (std.mem.eql(u8, arg, "--service-inproc-main") and index + 1 < args.len) {
|
|
396
|
+
saw_service_flag = true;
|
|
397
|
+
index += 1;
|
|
398
|
+
inproc_main_out = args[index];
|
|
399
|
+
} else if (std.mem.eql(u8, arg, "--service-inproc-profile") and index + 1 < args.len) {
|
|
400
|
+
saw_service_flag = true;
|
|
401
|
+
index += 1;
|
|
402
|
+
inproc_profile_out = args[index];
|
|
403
|
+
} else if (saw_service_flag) {
|
|
404
|
+
try stderr.print("corewire: unknown service projection argument \"{s}\"\n", .{arg});
|
|
405
|
+
try stderr.flush();
|
|
406
|
+
std.process.exit(2);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
if (!saw_service_flag) return false;
|
|
410
|
+
const sidecar_path = input orelse {
|
|
411
|
+
try stderr.print("usage: corewire --services-sidecar <services.contract.json> [--service-host-main <service_host_main.ts>] [--service-registry <services.zig>] [--service-client <services.gen.ts>] [--service-inproc-main <service_inproc_main.ts>] [--service-inproc-profile <service_profile.json>]\n", .{});
|
|
412
|
+
try stderr.flush();
|
|
413
|
+
std.process.exit(2);
|
|
414
|
+
};
|
|
415
|
+
if (host_out == null and registry_out == null and client_out == null and inproc_main_out == null and inproc_profile_out == null) {
|
|
416
|
+
try stderr.print("corewire: the service projection needs at least one output\n", .{});
|
|
417
|
+
try stderr.flush();
|
|
418
|
+
std.process.exit(2);
|
|
419
|
+
}
|
|
420
|
+
if (host_out != null and registry_out != null and std.ascii.eqlIgnoreCase(host_out.?, registry_out.?)) {
|
|
421
|
+
try stderr.print("corewire: the service host and registry outputs name one file\n", .{});
|
|
422
|
+
try stderr.flush();
|
|
423
|
+
std.process.exit(2);
|
|
424
|
+
}
|
|
425
|
+
const arena = init.arena.allocator();
|
|
426
|
+
const source = std.Io.Dir.cwd().readFileAlloc(init.io, sidecar_path, arena, .limited(service_contract_mod.max_bytes)) catch |err| {
|
|
427
|
+
try stderr.print("corewire: cannot read {s}: {t}\n", .{ sidecar_path, err });
|
|
428
|
+
try stderr.flush();
|
|
429
|
+
std.process.exit(1);
|
|
430
|
+
};
|
|
431
|
+
const contract = service_contract_mod.read(arena, source, stderr) catch |err| switch (err) {
|
|
432
|
+
error.InvalidContract => {
|
|
433
|
+
try stderr.flush();
|
|
434
|
+
std.process.exit(1);
|
|
435
|
+
},
|
|
436
|
+
error.OutOfMemory => return error.OutOfMemory,
|
|
437
|
+
error.WriteFailed => return error.WriteFailed,
|
|
438
|
+
};
|
|
439
|
+
if (host_out) |path| {
|
|
440
|
+
const generated = try emit_service_mod.emitHost(arena, contract);
|
|
441
|
+
std.Io.Dir.cwd().writeFile(init.io, .{ .sub_path = path, .data = generated }) catch |err| {
|
|
442
|
+
try stderr.print("corewire: cannot write {s}: {t}\n", .{ path, err });
|
|
443
|
+
try stderr.flush();
|
|
444
|
+
std.process.exit(1);
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
if (registry_out) |path| {
|
|
448
|
+
const generated = try emit_service_mod.emitRegistry(arena, contract);
|
|
449
|
+
std.Io.Dir.cwd().writeFile(init.io, .{ .sub_path = path, .data = generated }) catch |err| {
|
|
450
|
+
try stderr.print("corewire: cannot write {s}: {t}\n", .{ path, err });
|
|
451
|
+
try stderr.flush();
|
|
452
|
+
std.process.exit(1);
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
if (client_out) |path| {
|
|
456
|
+
const generated = try emit_service_mod.emitClient(arena, contract);
|
|
457
|
+
std.Io.Dir.cwd().writeFile(init.io, .{ .sub_path = path, .data = generated }) catch |err| {
|
|
458
|
+
try stderr.print("corewire: cannot write {s}: {t}\n", .{ path, err });
|
|
459
|
+
try stderr.flush();
|
|
460
|
+
std.process.exit(1);
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
if (inproc_main_out) |path| {
|
|
464
|
+
const generated = try emit_service_mod.emitInprocMain(arena, contract);
|
|
465
|
+
std.Io.Dir.cwd().writeFile(init.io, .{ .sub_path = path, .data = generated }) catch |err| {
|
|
466
|
+
try stderr.print("corewire: cannot write {s}: {t}\n", .{ path, err });
|
|
467
|
+
try stderr.flush();
|
|
468
|
+
std.process.exit(1);
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
if (inproc_profile_out) |path| {
|
|
472
|
+
const generated = try emit_service_mod.emitInprocProfile(arena);
|
|
473
|
+
std.Io.Dir.cwd().writeFile(init.io, .{ .sub_path = path, .data = generated }) catch |err| {
|
|
474
|
+
try stderr.print("corewire: cannot write {s}: {t}\n", .{ path, err });
|
|
475
|
+
try stderr.flush();
|
|
476
|
+
std.process.exit(1);
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
try stderr.flush();
|
|
480
|
+
return true;
|
|
481
|
+
}
|
|
482
|
+
|
|
361
483
|
/// Rewrite one record-field slot's type-table spelling from i64 to f64
|
|
362
484
|
/// (through one optional wrapper). Returns false when the path is not a
|
|
363
485
|
/// `Container.field` record slot whose field spells i64.
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
//! Reader/validator for services.contract.json (typed service seam).
|
|
2
|
+
|
|
3
|
+
const std = @import("std");
|
|
4
|
+
|
|
5
|
+
pub const max_bytes: usize = 4 * 1024 * 1024;
|
|
6
|
+
pub const supported_format: i64 = 3;
|
|
7
|
+
pub const supported_protocol: i64 = 3;
|
|
8
|
+
|
|
9
|
+
pub const TypeKind = enum { none, bool, f64, i64, bytes, optional, slice, record, @"enum", @"union" };
|
|
10
|
+
|
|
11
|
+
pub const TypeRef = struct {
|
|
12
|
+
kind: TypeKind,
|
|
13
|
+
inner: ?*const TypeRef = null,
|
|
14
|
+
elem: ?*const TypeRef = null,
|
|
15
|
+
name: ?[]const u8 = null,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
pub const Field = struct { name: []const u8, type: TypeRef };
|
|
19
|
+
pub const RecordType = struct { name: []const u8, origin: []const u8, fields: []const Field };
|
|
20
|
+
pub const EnumType = struct { name: []const u8, origin: []const u8, members: []const []const u8 };
|
|
21
|
+
pub const UnionArm = struct { name: []const u8, fields: []const Field };
|
|
22
|
+
pub const UnionType = struct { name: []const u8, origin: []const u8, arms: []const UnionArm };
|
|
23
|
+
pub const Types = struct {
|
|
24
|
+
records: []const RecordType,
|
|
25
|
+
enums: []const EnumType,
|
|
26
|
+
unions: []const UnionType,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
pub const Package = struct {
|
|
30
|
+
name: []const u8,
|
|
31
|
+
version: []const u8,
|
|
32
|
+
content_hash: []const u8,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
pub const Operation = struct {
|
|
36
|
+
name: []const u8,
|
|
37
|
+
client: []const u8,
|
|
38
|
+
module: []const u8,
|
|
39
|
+
@"export": []const u8,
|
|
40
|
+
request: TypeRef,
|
|
41
|
+
result: TypeRef,
|
|
42
|
+
deadline_ms: ?i64,
|
|
43
|
+
cancellable: bool,
|
|
44
|
+
stream: ?struct { chunk: TypeRef, in_flight: i64 },
|
|
45
|
+
source_hash: []const u8,
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
pub const Contract = struct {
|
|
49
|
+
format: i64,
|
|
50
|
+
protocol_version: i64,
|
|
51
|
+
compiler_version: []const u8,
|
|
52
|
+
deterministic: bool,
|
|
53
|
+
packages: []const Package,
|
|
54
|
+
types: Types,
|
|
55
|
+
operations: []const Operation,
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
pub const Error = error{ InvalidContract, OutOfMemory, WriteFailed };
|
|
59
|
+
|
|
60
|
+
pub fn read(arena: std.mem.Allocator, source: []const u8, writer: *std.Io.Writer) Error!Contract {
|
|
61
|
+
const parsed = std.json.parseFromSliceLeaky(Contract, arena, source, .{ .ignore_unknown_fields = false }) catch |err| {
|
|
62
|
+
try writer.print("corewire: services contract is not valid schema-2 JSON: {t}\n", .{err});
|
|
63
|
+
return error.InvalidContract;
|
|
64
|
+
};
|
|
65
|
+
var failed = false;
|
|
66
|
+
if (parsed.format != supported_format) {
|
|
67
|
+
try writer.print("corewire: services contract format is {d}, expected {d}\n", .{ parsed.format, supported_format });
|
|
68
|
+
failed = true;
|
|
69
|
+
}
|
|
70
|
+
if (parsed.protocol_version != supported_protocol) {
|
|
71
|
+
try writer.print("corewire: service protocol is {d}, expected {d}\n", .{ parsed.protocol_version, supported_protocol });
|
|
72
|
+
failed = true;
|
|
73
|
+
}
|
|
74
|
+
if (parsed.deterministic) {
|
|
75
|
+
try writer.print("corewire: a service contract may not attest deterministic=true — ambient authority is the service class's visible distinction\n", .{});
|
|
76
|
+
failed = true;
|
|
77
|
+
}
|
|
78
|
+
if (!exactVersion(parsed.compiler_version)) {
|
|
79
|
+
try writer.print("corewire: services contract compiler_version \"{s}\" is not an exact X.Y.Z pin\n", .{parsed.compiler_version});
|
|
80
|
+
failed = true;
|
|
81
|
+
}
|
|
82
|
+
if (parsed.operations.len == 0) {
|
|
83
|
+
try writer.print("corewire: services contract contains no operations\n", .{});
|
|
84
|
+
failed = true;
|
|
85
|
+
}
|
|
86
|
+
for (parsed.operations, 0..) |op, index| {
|
|
87
|
+
if (!operationName(op.name)) {
|
|
88
|
+
try writer.print("corewire: operations[{d}].name \"{s}\" is not <module>.<export>\n", .{ index, op.name });
|
|
89
|
+
failed = true;
|
|
90
|
+
}
|
|
91
|
+
if (!identifier(op.client)) {
|
|
92
|
+
try writer.print("corewire: operations[{d}].client \"{s}\" is not a TypeScript identifier\n", .{ index, op.client });
|
|
93
|
+
failed = true;
|
|
94
|
+
}
|
|
95
|
+
if (!std.mem.startsWith(u8, op.module, "src/services/") or !std.mem.endsWith(u8, op.module, ".ts") or std.mem.indexOf(u8, op.module, "..") != null) {
|
|
96
|
+
try writer.print("corewire: operations[{d}].module \"{s}\" is not a safe src/services/*.ts path\n", .{ index, op.module });
|
|
97
|
+
failed = true;
|
|
98
|
+
}
|
|
99
|
+
if (!identifier(op.@"export")) {
|
|
100
|
+
try writer.print("corewire: operations[{d}].export \"{s}\" is not a TypeScript identifier\n", .{ index, op.@"export" });
|
|
101
|
+
failed = true;
|
|
102
|
+
}
|
|
103
|
+
if (!nameMatchesDeclaration(op)) {
|
|
104
|
+
try writer.print("corewire: operations[{d}].name \"{s}\" does not match module basename \"{s}\" and export \"{s}\"\n", .{ index, op.name, std.fs.path.basename(op.module), op.@"export" });
|
|
105
|
+
failed = true;
|
|
106
|
+
}
|
|
107
|
+
if (op.source_hash.len != 64 or !allHex(op.source_hash)) {
|
|
108
|
+
try writer.print("corewire: operations[{d}].source_hash is not a lowercase SHA-256 hex digest\n", .{index});
|
|
109
|
+
failed = true;
|
|
110
|
+
}
|
|
111
|
+
if (op.result.kind == .none) {
|
|
112
|
+
try writer.print("corewire: operations[{d}].result may not be void\n", .{index});
|
|
113
|
+
failed = true;
|
|
114
|
+
}
|
|
115
|
+
if (!validTypeRef(op.request) or !validTypeRef(op.result)) {
|
|
116
|
+
try writer.print("corewire: operations[{d}] carries an invalid type reference\n", .{index});
|
|
117
|
+
failed = true;
|
|
118
|
+
}
|
|
119
|
+
if (op.deadline_ms) |deadline| {
|
|
120
|
+
if (deadline < 1 or deadline > 86_400_000) {
|
|
121
|
+
try writer.print("corewire: operations[{d}].deadline_ms is outside 1..86400000\n", .{index});
|
|
122
|
+
failed = true;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
if (op.stream) |stream| {
|
|
126
|
+
if (!validTypeRef(stream.chunk) or stream.chunk.kind == .none or stream.in_flight < 1 or stream.in_flight > 64) {
|
|
127
|
+
try writer.print("corewire: operations[{d}].stream must carry an encodable chunk and a 1..64 in_flight cap\n", .{index});
|
|
128
|
+
failed = true;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
for (parsed.operations[0..index]) |earlier| {
|
|
132
|
+
if (std.mem.eql(u8, earlier.name, op.name)) {
|
|
133
|
+
try writer.print("corewire: duplicate service operation name \"{s}\"\n", .{op.name});
|
|
134
|
+
failed = true;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
for (parsed.packages, 0..) |package_entry, index| {
|
|
139
|
+
if (!npmPackageName(package_entry.name) or !exactVersion(package_entry.version) or package_entry.content_hash.len != 64 or !allHex(package_entry.content_hash)) {
|
|
140
|
+
try writer.print("corewire: packages[{d}] must carry name, exact version, and a lowercase SHA-256 content_hash\n", .{index});
|
|
141
|
+
failed = true;
|
|
142
|
+
}
|
|
143
|
+
for (parsed.packages[0..index]) |earlier| if (std.mem.eql(u8, earlier.name, package_entry.name)) {
|
|
144
|
+
try writer.print("corewire: duplicate service package \"{s}\"\n", .{package_entry.name});
|
|
145
|
+
failed = true;
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
if (failed) return error.InvalidContract;
|
|
149
|
+
return parsed;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
fn validTypeRef(ref: TypeRef) bool {
|
|
153
|
+
return switch (ref.kind) {
|
|
154
|
+
.none, .bool, .f64, .i64, .bytes => ref.inner == null and ref.elem == null and ref.name == null,
|
|
155
|
+
.optional => ref.inner != null and ref.elem == null and ref.name == null and validTypeRef(ref.inner.?.*),
|
|
156
|
+
.slice => ref.elem != null and ref.inner == null and ref.name == null and validTypeRef(ref.elem.?.*),
|
|
157
|
+
.record, .@"enum", .@"union" => ref.name != null and ref.name.?.len > 0 and ref.inner == null and ref.elem == null,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
fn exactVersion(value: []const u8) bool {
|
|
162
|
+
var parts = std.mem.splitScalar(u8, value, '.');
|
|
163
|
+
var count: usize = 0;
|
|
164
|
+
while (parts.next()) |part| {
|
|
165
|
+
if (part.len == 0) return false;
|
|
166
|
+
for (part) |byte| if (!std.ascii.isDigit(byte)) return false;
|
|
167
|
+
count += 1;
|
|
168
|
+
}
|
|
169
|
+
return count == 3;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
fn npmPackageName(value: []const u8) bool {
|
|
173
|
+
if (value.len == 0) return false;
|
|
174
|
+
const plain = struct {
|
|
175
|
+
fn valid(name: []const u8) bool {
|
|
176
|
+
if (name.len == 0) return false;
|
|
177
|
+
for (name) |byte| if (!(std.ascii.isAlphanumeric(byte) or byte == '.' or byte == '_' or byte == '-')) return false;
|
|
178
|
+
return true;
|
|
179
|
+
}
|
|
180
|
+
}.valid;
|
|
181
|
+
if (value[0] != '@') return plain(value);
|
|
182
|
+
const slash = std.mem.indexOfScalar(u8, value, '/') orelse return false;
|
|
183
|
+
return slash > 1 and slash + 1 < value.len and
|
|
184
|
+
std.mem.indexOfScalar(u8, value[slash + 1 ..], '/') == null and
|
|
185
|
+
plain(value[1..slash]) and plain(value[slash + 1 ..]);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
fn operationName(value: []const u8) bool {
|
|
189
|
+
const dot = std.mem.lastIndexOfScalar(u8, value, '.') orelse return false;
|
|
190
|
+
return dot > 0 and identifier(value[dot + 1 ..]);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
fn nameMatchesDeclaration(op: Operation) bool {
|
|
194
|
+
const basename = std.fs.path.basename(op.module);
|
|
195
|
+
if (!std.mem.endsWith(u8, basename, ".ts")) return false;
|
|
196
|
+
const module_name = basename[0 .. basename.len - ".ts".len];
|
|
197
|
+
if (op.name.len != module_name.len + 1 + op.@"export".len) return false;
|
|
198
|
+
return std.mem.eql(u8, op.name[0..module_name.len], module_name) and
|
|
199
|
+
op.name[module_name.len] == '.' and
|
|
200
|
+
std.mem.eql(u8, op.name[module_name.len + 1 ..], op.@"export");
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
fn identifier(value: []const u8) bool {
|
|
204
|
+
if (value.len == 0 or !(std.ascii.isAlphabetic(value[0]) or value[0] == '_' or value[0] == '$')) return false;
|
|
205
|
+
for (value[1..]) |byte| if (!(std.ascii.isAlphanumeric(byte) or byte == '_' or byte == '$')) return false;
|
|
206
|
+
return true;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
fn allHex(value: []const u8) bool {
|
|
210
|
+
for (value) |byte| if (!(std.ascii.isDigit(byte) or (byte >= 'a' and byte <= 'f'))) return false;
|
|
211
|
+
return true;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
test "service contract validates typed operations and authority attestation" {
|
|
215
|
+
var arena_state = std.heap.ArenaAllocator.init(std.testing.allocator);
|
|
216
|
+
defer arena_state.deinit();
|
|
217
|
+
const arena = arena_state.allocator();
|
|
218
|
+
const good =
|
|
219
|
+
\\{"format":3,"protocol_version":3,"compiler_version":"0.0.28","deterministic":false,"packages":[],"types":{"records":[],"enums":[],"unions":[]},"operations":[{"name":"feeds.parse","client":"feedsParse","module":"src/services/feeds.ts","export":"parse","request":{"kind":"bytes"},"result":{"kind":"bytes"},"deadline_ms":null,"cancellable":false,"stream":null,"source_hash":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}]}
|
|
220
|
+
;
|
|
221
|
+
var diagnostics: [512]u8 = undefined;
|
|
222
|
+
var writer = std.Io.Writer.fixed(&diagnostics);
|
|
223
|
+
const contract = try read(arena, good, &writer);
|
|
224
|
+
try std.testing.expectEqual(@as(usize, 1), contract.operations.len);
|
|
225
|
+
try std.testing.expectEqualStrings("feeds.parse", contract.operations[0].name);
|
|
226
|
+
|
|
227
|
+
const dollar =
|
|
228
|
+
\\{"format":3,"protocol_version":3,"compiler_version":"0.0.28","deterministic":false,"packages":[],"types":{"records":[],"enums":[],"unions":[]},"operations":[{"name":"feeds.$parse","client":"feeds$parse","module":"src/services/feeds.ts","export":"$parse","request":{"kind":"bytes"},"result":{"kind":"bytes"},"deadline_ms":null,"cancellable":true,"stream":null,"source_hash":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}]}
|
|
229
|
+
;
|
|
230
|
+
var dollar_diagnostics: [512]u8 = undefined;
|
|
231
|
+
var dollar_writer = std.Io.Writer.fixed(&dollar_diagnostics);
|
|
232
|
+
const dollar_contract = try read(arena, dollar, &dollar_writer);
|
|
233
|
+
try std.testing.expectEqualStrings("$parse", dollar_contract.operations[0].@"export");
|
|
234
|
+
|
|
235
|
+
const bad =
|
|
236
|
+
\\{"format":3,"protocol_version":3,"compiler_version":"0.0.28","deterministic":true,"packages":[],"types":{"records":[],"enums":[],"unions":[]},"operations":[{"name":"feeds.parse","client":"feedsParse","module":"src/services/feeds.ts","export":"parse","request":{"kind":"bytes"},"result":{"kind":"bytes"},"deadline_ms":null,"cancellable":false,"stream":null,"source_hash":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}]}
|
|
237
|
+
;
|
|
238
|
+
var bad_diagnostics: [512]u8 = undefined;
|
|
239
|
+
var bad_writer = std.Io.Writer.fixed(&bad_diagnostics);
|
|
240
|
+
try std.testing.expectError(error.InvalidContract, read(arena, bad, &bad_writer));
|
|
241
|
+
try std.testing.expect(std.mem.indexOf(u8, bad_writer.buffered(), "deterministic=true") != null);
|
|
242
|
+
|
|
243
|
+
const skewed =
|
|
244
|
+
\\{"format":3,"protocol_version":3,"compiler_version":"0.0.28","deterministic":false,"packages":[],"types":{"records":[],"enums":[],"unions":[]},"operations":[{"name":"other.parse","client":"otherParse","module":"src/services/feeds.ts","export":"parse","request":{"kind":"bytes"},"result":{"kind":"bytes"},"deadline_ms":null,"cancellable":false,"stream":null,"source_hash":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}]}
|
|
245
|
+
;
|
|
246
|
+
var skewed_diagnostics: [512]u8 = undefined;
|
|
247
|
+
var skewed_writer = std.Io.Writer.fixed(&skewed_diagnostics);
|
|
248
|
+
try std.testing.expectError(error.InvalidContract, read(arena, skewed, &skewed_writer));
|
|
249
|
+
try std.testing.expect(std.mem.indexOf(u8, skewed_writer.buffered(), "does not match module basename") != null);
|
|
250
|
+
}
|
|
@@ -34,11 +34,11 @@ pub const supported_format: i64 = 1;
|
|
|
34
34
|
/// The command-wire vocabulary generation the SDK's bridge speaks
|
|
35
35
|
/// (rt.zig `cmd_format_version`). A sidecar declaring a different
|
|
36
36
|
/// generation is refused at generate time.
|
|
37
|
-
pub const supported_wire_version: i64 =
|
|
37
|
+
pub const supported_wire_version: i64 = 4;
|
|
38
38
|
|
|
39
39
|
/// The C-ABI generation of the core entry points this generator binds
|
|
40
40
|
/// (core_abi.zig `abi_version`).
|
|
41
|
-
pub const supported_abi_version: i64 =
|
|
41
|
+
pub const supported_abi_version: i64 = 2;
|
|
42
42
|
|
|
43
43
|
/// The snapshot-encoding generation the generated decoder implements.
|
|
44
44
|
pub const supported_snapshot_format: i64 = 1;
|
|
@@ -190,6 +190,9 @@ pub const Sidecar = struct {
|
|
|
190
190
|
entry: []const u8,
|
|
191
191
|
source_hash: u64,
|
|
192
192
|
build_id: u64,
|
|
193
|
+
/// Hash of the Model-reachable type graph only. Unlike build_id, Msg,
|
|
194
|
+
/// channel, and helper-only edits do not move this persistence fence.
|
|
195
|
+
model_fingerprint: u64,
|
|
193
196
|
types: Types,
|
|
194
197
|
model: []const u8,
|
|
195
198
|
model_helpers: []const Helper,
|
|
@@ -205,6 +208,7 @@ pub const Sidecar = struct {
|
|
|
205
208
|
init_returns_bare: bool = false,
|
|
206
209
|
update_returns_bare: bool = false,
|
|
207
210
|
has_subscriptions: bool,
|
|
211
|
+
has_migrate: bool,
|
|
208
212
|
channels: Channels,
|
|
209
213
|
abi: Abi,
|
|
210
214
|
integer_slots: []const IntegerSlot,
|
|
@@ -214,7 +218,7 @@ pub const Sidecar = struct {
|
|
|
214
218
|
|
|
215
219
|
// ----------------------------------------------------- ABI vocabulary
|
|
216
220
|
|
|
217
|
-
/// The unconditional export suffixes of ABI version
|
|
221
|
+
/// The unconditional export suffixes of ABI version 2, in the NORMATIVE
|
|
218
222
|
/// canonical order the sidecar's `abi.exports` must list them: the two
|
|
219
223
|
/// identity getters, then the mode-provided entries (sink registration,
|
|
220
224
|
/// init, collect, result reset), then the program's entry-point map
|
|
@@ -240,6 +244,9 @@ pub const unconditional_exports = [_][]const u8{
|
|
|
240
244
|
"dispatch_scroll_state",
|
|
241
245
|
"subscriptions",
|
|
242
246
|
"model_snapshot",
|
|
247
|
+
"persist_snapshot",
|
|
248
|
+
"restore_model",
|
|
249
|
+
"migrate_model",
|
|
243
250
|
"helper_call",
|
|
244
251
|
};
|
|
245
252
|
|
|
@@ -476,11 +483,11 @@ const Mapper = struct {
|
|
|
476
483
|
|
|
477
484
|
fn mapRoot(self: *Mapper, value: std.json.Value) error{ Refused, OutOfMemory }!Sidecar {
|
|
478
485
|
const top = try self.members(value, "", &.{
|
|
479
|
-
"format",
|
|
480
|
-
"source_hash",
|
|
481
|
-
"model_unbound", "msg", "init_returns_cmd", "update_returns_cmd",
|
|
482
|
-
"
|
|
483
|
-
"
|
|
486
|
+
"format", "wire_version", "abi_version", "compiler_version", "entry",
|
|
487
|
+
"source_hash", "build_id", "model_fingerprint", "types", "model",
|
|
488
|
+
"model_helpers", "model_unbound", "msg", "init_returns_cmd", "update_returns_cmd",
|
|
489
|
+
"init_returns_bare", "update_returns_bare", "has_subscriptions", "has_migrate", "channels",
|
|
490
|
+
"abi", "integer_slots", "deterministic", "async_free",
|
|
484
491
|
});
|
|
485
492
|
top.warnUnknown();
|
|
486
493
|
|
|
@@ -501,6 +508,7 @@ const Mapper = struct {
|
|
|
501
508
|
.entry = try self.nonEmptyString(try top.get("entry"), "entry"),
|
|
502
509
|
.source_hash = try self.hash64(try top.get("source_hash"), "source_hash"),
|
|
503
510
|
.build_id = try self.hash64(try top.get("build_id"), "build_id"),
|
|
511
|
+
.model_fingerprint = try self.hash64(try top.get("model_fingerprint"), "model_fingerprint"),
|
|
504
512
|
.types = try self.mapTypes(try top.get("types")),
|
|
505
513
|
.model = try self.nonEmptyString(try top.get("model"), "model"),
|
|
506
514
|
.model_helpers = try self.mapHelpers(try top.get("model_helpers")),
|
|
@@ -511,6 +519,7 @@ const Mapper = struct {
|
|
|
511
519
|
.init_returns_bare = try self.optionalBoolean(top.map, "init_returns_bare", "", false),
|
|
512
520
|
.update_returns_bare = try self.optionalBoolean(top.map, "update_returns_bare", "", false),
|
|
513
521
|
.has_subscriptions = try self.boolean(try top.get("has_subscriptions"), "has_subscriptions"),
|
|
522
|
+
.has_migrate = try self.boolean(try top.get("has_migrate"), "has_migrate"),
|
|
514
523
|
.channels = channels,
|
|
515
524
|
.abi = abi,
|
|
516
525
|
.integer_slots = try self.mapIntegerSlots(try top.get("integer_slots")),
|
|
@@ -1823,12 +1832,13 @@ const testing = std.testing;
|
|
|
1823
1832
|
pub const minimal_valid_json =
|
|
1824
1833
|
\\{
|
|
1825
1834
|
\\ "format": 1,
|
|
1826
|
-
\\ "wire_version":
|
|
1827
|
-
\\ "abi_version":
|
|
1835
|
+
\\ "wire_version": 4,
|
|
1836
|
+
\\ "abi_version": 2,
|
|
1828
1837
|
\\ "compiler_version": "0.0.1",
|
|
1829
1838
|
\\ "entry": "src/core.ts",
|
|
1830
1839
|
\\ "source_hash": "00000000c0ffee00",
|
|
1831
1840
|
\\ "build_id": "00000000b01dface",
|
|
1841
|
+
\\ "model_fingerprint": "00000000a11ce001",
|
|
1832
1842
|
\\ "types": {
|
|
1833
1843
|
\\ "structs": [
|
|
1834
1844
|
\\ {"name": "Model", "fields": [
|
|
@@ -1853,6 +1863,7 @@ pub const minimal_valid_json =
|
|
|
1853
1863
|
\\ "init_returns_cmd": false,
|
|
1854
1864
|
\\ "update_returns_cmd": true,
|
|
1855
1865
|
\\ "has_subscriptions": false,
|
|
1866
|
+
\\ "has_migrate": false,
|
|
1856
1867
|
\\ "channels": {
|
|
1857
1868
|
\\ "command_msg": false,
|
|
1858
1869
|
\\ "frame_msg": false,
|
|
@@ -1869,7 +1880,7 @@ pub const minimal_valid_json =
|
|
|
1869
1880
|
\\ "frame_reset", "boot_cmd", "dispatch_void", "dispatch_bytes", "dispatch_number",
|
|
1870
1881
|
\\ "dispatch_number_bytes", "dispatch_bool", "dispatch_enum", "dispatch_record",
|
|
1871
1882
|
\\ "dispatch_text_input", "dispatch_scroll_state", "subscriptions", "model_snapshot",
|
|
1872
|
-
\\ "helper_call"],
|
|
1883
|
+
\\ "persist_snapshot", "restore_model", "migrate_model", "helper_call"],
|
|
1873
1884
|
\\ "snapshot_format": 1
|
|
1874
1885
|
\\ },
|
|
1875
1886
|
\\ "integer_slots": [
|
|
@@ -1888,7 +1899,7 @@ test "drop_msg infers from the ABI export for older format-1 emitters" {
|
|
|
1888
1899
|
// The pinned external compiler predates the additive channel flag but
|
|
1889
1900
|
// preserves profile-declared exports in the authoritative ABI list.
|
|
1890
1901
|
var source = try std.mem.replaceOwned(u8, arena, minimal_valid_json, " \"drop_msg\": false,\n", "");
|
|
1891
|
-
source = try std.mem.replaceOwned(u8, arena, source, "
|
|
1902
|
+
source = try std.mem.replaceOwned(u8, arena, source, "\"helper_call\"]", "\"helper_call\", \"drop_msg\"]");
|
|
1892
1903
|
var diags = Diagnostics{ .arena = arena };
|
|
1893
1904
|
const parsed = try read(arena, source, &diags);
|
|
1894
1905
|
try std.testing.expect(parsed.channels.drop_msg);
|
|
@@ -2385,7 +2396,7 @@ test "V11: an unknown export suffix refuses" {
|
|
|
2385
2396
|
var arena_state = std.heap.ArenaAllocator.init(testing.allocator);
|
|
2386
2397
|
defer arena_state.deinit();
|
|
2387
2398
|
const source = try replaced(arena_state.allocator(), minimal_valid_json, "\"helper_call\"]", "\"helper_call\", \"mystery_entry\"]");
|
|
2388
|
-
try expectRefusal(source, "abi.exports[
|
|
2399
|
+
try expectRefusal(source, "abi.exports[22]", "not an export suffix of ABI version 2");
|
|
2389
2400
|
}
|
|
2390
2401
|
|
|
2391
2402
|
test "V11: a missing unconditional export refuses with the expected suffix" {
|
|
@@ -2417,8 +2428,8 @@ test "unknown payload descriptor kinds refuse as reader-too-old" {
|
|
|
2417
2428
|
test "wire and abi version mismatches refuse with both values named" {
|
|
2418
2429
|
var arena_state = std.heap.ArenaAllocator.init(testing.allocator);
|
|
2419
2430
|
defer arena_state.deinit();
|
|
2420
|
-
const source = try replaced(arena_state.allocator(), minimal_valid_json, "\"wire_version\":
|
|
2421
|
-
try expectRefusal(source, "wire_version", "generation
|
|
2431
|
+
const source = try replaced(arena_state.allocator(), minimal_valid_json, "\"wire_version\": 4", "\"wire_version\": 5");
|
|
2432
|
+
try expectRefusal(source, "wire_version", "generation 4, the sidecar declares 5");
|
|
2422
2433
|
}
|
|
2423
2434
|
|
|
2424
2435
|
test "unknown fields warn and are ignored" {
|