milestone 18: collapse duplicated infrastructure into shared listener core, crud list helper, resource shells, transport race, name and line helpers, ui modules
CI / test (push) Successful in 1m22s
CI / test-aarch64 (push) Successful in 5m6s
CI / frontend (push) Successful in 45s
CI / cross (push) Successful in 7m53s
CI / docker (push) Failing after 1h10m57s

This commit is contained in:
2026-08-07 18:20:30 +02:00
parent c50c6d285a
commit 6f67940995
82 changed files with 3167 additions and 3114 deletions
+30 -1
View File
@@ -164,7 +164,11 @@ pub fn importSource(
/// `std.zon.parse.Diagnostics` renders one "line:column: error: text" line per
/// problem, plus a "note:" line each, so each rendered line becomes one
/// `Problem` and the list keeps the parser's order.
fn reportParseFailure(
///
/// `pub` because `nxdns check` parses the same file and owes the operator the
/// same one-line-per-problem output; rendering the ZON diagnostics inline would
/// put newlines inside a single `FAIL` record.
pub fn reportParseFailure(
diags: *validate.Diagnostics,
zon_diag: *const std.zon.parse.Diagnostics,
) error{OutOfMemory}!void {
@@ -910,6 +914,31 @@ test "importSource reports a ZON syntax error and writes nothing" {
try testing.expect(std.mem.indexOf(u8, text, "1:14: error: ") != null);
}
test "importSource splits a multi-line ZON failure into one problem per message" {
var threaded: std.Io.Threaded = .init(testing.allocator, .{});
defer threaded.deinit();
const io = threaded.io();
var database = try openMigrated();
defer database.close();
var diags: validate.Diagnostics = .init(testing.allocator);
defer diags.deinit();
// An unexpected field renders as an "error:" line plus a "note:" line, so
// the rendering the CLI prints has to be split rather than embedded whole.
try testing.expectError(
error.ParseZon,
importSource(io, testing.allocator, &database, ".{ .grops = .{} }", .{}, &diags),
);
try testing.expectEqual(@as(usize, 2), diags.problems.items.len);
for (diags.problems.items) |problem| {
try testing.expectEqual(@as(?usize, null), std.mem.findScalar(u8, problem.message, '\n'));
}
try testing.expect(std.mem.indexOf(u8, diags.problems.items[0].message, "error: ") != null);
try testing.expect(std.mem.indexOf(u8, diags.problems.items[1].message, "note: ") != null);
}
test "a config omitting every optional field parses into an arena and leaks nothing" {
// The S5.1 rule as a test: `std.zon.parse.free` is never called, the arena
// is the only release, and `std.testing.allocator` fails the test if a