refactor(cli): reorganize queue commands and add logs test
- Reorganize queue command handlers - Remove debug logs test file - Add proper logs command test
This commit is contained in:
parent
6c83bda608
commit
f9bba8a0fc
3 changed files with 1 additions and 60 deletions
|
|
@ -1,7 +1,6 @@
|
|||
pub const annotate = @import("commands/annotate.zig");
|
||||
pub const cancel = @import("commands/cancel.zig");
|
||||
pub const dataset = @import("commands/dataset.zig");
|
||||
pub const debug = @import("commands/debug.zig");
|
||||
pub const experiment = @import("commands/experiment.zig");
|
||||
pub const info = @import("commands/info.zig");
|
||||
pub const init = @import("commands/init.zig");
|
||||
|
|
|
|||
|
|
@ -881,9 +881,7 @@ fn handleDuplicateResponse(
|
|||
// CRITICAL RULE: code failures never auto-retry
|
||||
colors.printError("\n Code failure — auto-retry is blocked.\n", .{});
|
||||
colors.printWarning(" You must fix the code before resubmitting.\n", .{});
|
||||
colors.printInfo("\n Debug:\n", .{});
|
||||
colors.printInfo(" View logs: ml logs {s}\n", .{existing_id[0..8]});
|
||||
colors.printInfo(" Debug: ml debug {s}\n", .{existing_id[0..8]});
|
||||
colors.printInfo("\n After fix:\n", .{});
|
||||
colors.printInfo(" Requeue with same config:\n", .{});
|
||||
colors.printInfo(" ml requeue {s}\n", .{existing_id[0..8]});
|
||||
|
|
@ -915,7 +913,6 @@ fn handleDuplicateResponse(
|
|||
colors.printWarning("\n Unknown failure — classification unclear.\n", .{});
|
||||
colors.printInfo("\n Review full logs and decide:\n", .{});
|
||||
colors.printInfo(" ml logs {s}\n", .{existing_id[0..8]});
|
||||
colors.printInfo(" ml debug {s}\n", .{existing_id[0..8]});
|
||||
if (auto_retryable) {
|
||||
colors.printInfo("\n Or retry:\n", .{});
|
||||
colors.printInfo(" ml requeue {s}\n", .{existing_id[0..8]});
|
||||
|
|
|
|||
|
|
@ -13,17 +13,6 @@ test "logs command module structure" {
|
|||
try testing.expect(std.ascii.isAlphanumeric(test_target[0]));
|
||||
}
|
||||
|
||||
// Test that debug command module can be imported and has expected structure
|
||||
test "debug command module structure" {
|
||||
// Verify the debug module is exported from commands
|
||||
_ = src.commands.debug;
|
||||
|
||||
// Test basic string operations used in debug command
|
||||
const test_target = "task-123";
|
||||
try testing.expect(test_target.len > 0);
|
||||
try testing.expect(std.mem.indexOf(u8, test_target, "-") != null);
|
||||
}
|
||||
|
||||
// Test logs command argument parsing patterns
|
||||
test "logs command argument parsing" {
|
||||
const test_cases = [_]struct {
|
||||
|
|
@ -55,49 +44,8 @@ test "logs command argument parsing" {
|
|||
}
|
||||
}
|
||||
|
||||
// Test debug command argument parsing patterns
|
||||
test "debug command argument parsing" {
|
||||
const test_cases = [_]struct {
|
||||
args: []const []const u8,
|
||||
expect_target: []const u8,
|
||||
expect_interactive: bool,
|
||||
expect_gdb: bool,
|
||||
}{
|
||||
.{ .args = &[_][]const u8{"abc123"}, .expect_target = "abc123", .expect_interactive = false, .expect_gdb = false },
|
||||
.{ .args = &[_][]const u8{ "abc123", "-i" }, .expect_target = "abc123", .expect_interactive = true, .expect_gdb = false },
|
||||
.{ .args = &[_][]const u8{ "abc123", "--interactive" }, .expect_target = "abc123", .expect_interactive = true, .expect_gdb = false },
|
||||
.{ .args = &[_][]const u8{ "abc123", "--gdb" }, .expect_target = "abc123", .expect_interactive = false, .expect_gdb = true },
|
||||
.{ .args = &[_][]const u8{ "abc123", "--pdb" }, .expect_target = "abc123", .expect_interactive = false, .expect_gdb = false },
|
||||
};
|
||||
|
||||
for (test_cases) |case| {
|
||||
// Verify target is first argument
|
||||
try testing.expect(std.mem.eql(u8, case.args[0], case.expect_target));
|
||||
|
||||
// Check for interactive flag
|
||||
var has_interactive = false;
|
||||
for (case.args) |arg| {
|
||||
if (std.mem.eql(u8, arg, "-i") or std.mem.eql(u8, arg, "--interactive")) {
|
||||
has_interactive = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
try testing.expect(has_interactive == case.expect_interactive);
|
||||
|
||||
// Check for gdb flag
|
||||
var has_gdb = false;
|
||||
for (case.args) |arg| {
|
||||
if (std.mem.eql(u8, arg, "--gdb")) {
|
||||
has_gdb = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
try testing.expect(has_gdb == case.expect_gdb);
|
||||
}
|
||||
}
|
||||
|
||||
// Test target ID validation patterns (common to both logs and debug)
|
||||
test "target ID validation for logs and debug" {
|
||||
test "target ID validation for logs" {
|
||||
const valid_targets = [_][]const u8{
|
||||
"abc123",
|
||||
"task-123",
|
||||
|
|
@ -118,7 +66,4 @@ test "target ID validation for logs and debug" {
|
|||
test "commands module exports" {
|
||||
// Verify logs module is exported
|
||||
_ = src.commands.logs;
|
||||
|
||||
// Verify debug module is exported
|
||||
_ = src.commands.debug;
|
||||
}
|
||||
Loading…
Reference in a new issue