From 36b908c482a21dfe7ff2c6eefa200da61b659769 Mon Sep 17 00:00:00 2001 From: ysyneu Date: Tue, 14 Jul 2026 21:10:15 -0700 Subject: [PATCH 1/2] fix: reject victorialogs raw rows query missing start/end args monit-query rows dispatched --ds-type victorialogs with --args victorialogs.type=raw straight to the backend without checking for victorialogs.start/victorialogs.end. The backend silently returns null (HTTP 200, exit 0) instead of an error, which caused an agent session to retry the same broken call ~10+ times before finding the doc that explains the raw-mode contract. Validate this known-bad combination client-side before dispatch, mirroring the existing required-flags check in the same RunE. --- internal/cli/monit_query.go | 4 ++++ internal/cli/monit_query_test.go | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/internal/cli/monit_query.go b/internal/cli/monit_query.go index e12769b..a95d5d9 100644 --- a/internal/cli/monit_query.go +++ b/internal/cli/monit_query.go @@ -102,6 +102,10 @@ func newMonitQueryRowsCmd() *cobra.Command { if err != nil { return fmt.Errorf("invalid --args: %w", err) } + if dsType == "victorialogs" && argsMap["victorialogs.type"] == "raw" && + (argsMap["victorialogs.start"] == "" || argsMap["victorialogs.end"] == "") { + return fmt.Errorf("victorialogs raw mode requires --args victorialogs.start= --args victorialogs.end=; see skills/flashduty/reference/monit-query.md") + } return runCommand(cmd, args, func(ctx *RunContext) error { input := &flashduty.QueryRowsRequest{ diff --git a/internal/cli/monit_query_test.go b/internal/cli/monit_query_test.go index 70c56c2..0fd6ce5 100644 --- a/internal/cli/monit_query_test.go +++ b/internal/cli/monit_query_test.go @@ -259,3 +259,25 @@ func TestMonitQueryRowsInvalidArgs(t *testing.T) { t.Errorf("rows should not have been called: %d request(s)", stub.requests) } } + +func TestMonitQueryRowsVictorialogsRawRequiresTimeRange(t *testing.T) { + saveAndResetGlobals(t) + stub := newGFStub(t) + + _, err := execCommand( + "monit-query", "rows", + "--ds-type", "victorialogs", + "--ds-name", "vl-prod", + "--expr", "* | limit 2", + "--args", "victorialogs.type=raw", + ) + if err == nil { + t.Fatal("expected error for victorialogs raw mode missing start/end, got nil") + } + if !strings.Contains(err.Error(), "victorialogs.start") || !strings.Contains(err.Error(), "victorialogs.end") { + t.Errorf("expected error to mention victorialogs.start/end, got %q", err.Error()) + } + if stub.requests != 0 { + t.Errorf("rows should not have been called: %d request(s)", stub.requests) + } +} From 0dcc519b1329007ed35f9a207a38c650a0d971e7 Mon Sep 17 00:00:00 2001 From: ysyneu Date: Tue, 14 Jul 2026 21:27:16 -0700 Subject: [PATCH 2/2] fix: drop misleading doc pointer from victorialogs raw-mode error The referenced skills/flashduty/reference/monit-query.md doesn't document victorialogs.start/end and its Gotchas section says the opposite for rows in general, so the pointer misled readers. The error text alone already states the fix. --- internal/cli/monit_query.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/cli/monit_query.go b/internal/cli/monit_query.go index a95d5d9..adcbfb4 100644 --- a/internal/cli/monit_query.go +++ b/internal/cli/monit_query.go @@ -104,7 +104,7 @@ func newMonitQueryRowsCmd() *cobra.Command { } if dsType == "victorialogs" && argsMap["victorialogs.type"] == "raw" && (argsMap["victorialogs.start"] == "" || argsMap["victorialogs.end"] == "") { - return fmt.Errorf("victorialogs raw mode requires --args victorialogs.start= --args victorialogs.end=; see skills/flashduty/reference/monit-query.md") + return fmt.Errorf("victorialogs raw mode requires --args victorialogs.start= --args victorialogs.end=") } return runCommand(cmd, args, func(ctx *RunContext) error {