Add visible v1 diagnostics guardrails

This commit is contained in:
slhx agent
2026-06-21 05:38:52 +02:00
parent a1600e511a
commit 8658f7cc95
7 changed files with 180 additions and 7 deletions
+5
View File
@@ -1,4 +1,5 @@
const std = @import("std");
const diagnostics = @import("diagnostics.zig");
// Minimal LSP process lifecycle + document sync transport.
// req: coding/003, repo/002, testing/001, testing/002, testing/003, testing/004
@@ -313,6 +314,7 @@ pub fn runDocumentSyncRowsAlloc(
.stderr = .ignore,
}) catch |err| {
try rows.append(allocator, try std.fmt.allocPrint(allocator, "lsp:status:spawn_error_{s}", .{@errorName(err)}));
try rows.append(allocator, try diagnostics.processLimitRowAlloc(allocator, "lsp", diagnostics.process_stdout_limit, diagnostics.process_stderr_limit));
return rows.toOwnedSlice(allocator);
};
defer child.kill(io);
@@ -320,6 +322,7 @@ pub fn runDocumentSyncRowsAlloc(
child.stdin.?.writeStreamingAll(io, transcript) catch |err| {
child.stdin.?.close(io);
try rows.append(allocator, try std.fmt.allocPrint(allocator, "lsp:status:write_error_{s}", .{@errorName(err)}));
try rows.append(allocator, try diagnostics.processLimitRowAlloc(allocator, "lsp", diagnostics.process_stdout_limit, diagnostics.process_stderr_limit));
_ = child.wait(io) catch {};
return rows.toOwnedSlice(allocator);
};
@@ -333,10 +336,12 @@ pub fn runDocumentSyncRowsAlloc(
const term = child.wait(io) catch |err| {
try rows.append(allocator, try std.fmt.allocPrint(allocator, "lsp:status:wait_error_{s}", .{@errorName(err)}));
try rows.append(allocator, try diagnostics.processLimitRowAlloc(allocator, "lsp", diagnostics.process_stdout_limit, diagnostics.process_stderr_limit));
return rows.toOwnedSlice(allocator);
};
child.id = null;
try appendTermRow(allocator, &rows, term);
try rows.append(allocator, try diagnostics.processLimitRowAlloc(allocator, "lsp", diagnostics.process_stdout_limit, diagnostics.process_stderr_limit));
return rows.toOwnedSlice(allocator);
}