From b17618eee4cf29d5e3cf14f0afbc09023242c221 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 24 Dec 2025 01:33:41 +0000 Subject: [PATCH 1/2] Initial plan From 53cdc340ae66ca2c29d0a4d1795506410cdfb477 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 24 Dec 2025 01:40:20 +0000 Subject: [PATCH 2/2] Add task parsing test with selectors and custom fields Co-authored-by: alexec <1142830+alexec@users.noreply.github.com> --- .../markdown/frontmatter_task_test.go | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/pkg/codingcontext/markdown/frontmatter_task_test.go b/pkg/codingcontext/markdown/frontmatter_task_test.go index c84d874..cc1074f 100644 --- a/pkg/codingcontext/markdown/frontmatter_task_test.go +++ b/pkg/codingcontext/markdown/frontmatter_task_test.go @@ -1,6 +1,7 @@ package markdown import ( + "fmt" "testing" "github.com/goccy/go-yaml" @@ -147,6 +148,31 @@ selectors: }, }, }, + { + name: "task with selectors and custom fields", + yaml: `--- +single_shot: true +collect_and_push: false +selectors: + tool: [""] +--- + +Say hello. +`, + want: TaskFrontMatter{ + BaseFrontMatter: BaseFrontMatter{ + Content: map[string]any{ + "single_shot": true, + "collect_and_push": false, + "selectors": map[string]any{"tool": []any{""}}, + }, + }, + SingleShot: true, + Selectors: map[string]any{ + "tool": []any{""}, + }, + }, + }, } for _, tt := range tests { @@ -178,6 +204,34 @@ selectors: if got.Timeout != tt.want.Timeout { t.Errorf("Timeout = %q, want %q", got.Timeout, tt.want.Timeout) } + + // Check custom Content fields if present in want + for key, wantVal := range tt.want.Content { + if key == "task_name" { + continue // Already checked above + } + gotVal, exists := got.Content[key] + if !exists { + t.Errorf("Content[%q] missing, want %v", key, wantVal) + } else if fmt.Sprintf("%v", gotVal) != fmt.Sprintf("%v", wantVal) { + t.Errorf("Content[%q] = %v, want %v", key, gotVal, wantVal) + } + } + + // Check Selectors if present in want + if len(tt.want.Selectors) > 0 { + if len(got.Selectors) != len(tt.want.Selectors) { + t.Errorf("Selectors length = %d, want %d", len(got.Selectors), len(tt.want.Selectors)) + } + for key, wantVal := range tt.want.Selectors { + gotVal, exists := got.Selectors[key] + if !exists { + t.Errorf("Selectors[%q] missing, want %v", key, wantVal) + } else if fmt.Sprintf("%v", gotVal) != fmt.Sprintf("%v", wantVal) { + t.Errorf("Selectors[%q] = %v, want %v", key, gotVal, wantVal) + } + } + } }) } }