Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 24, 2025

The codebase combines task prompts and user prompts with a --- delimiter before parsing, but lacked a test verifying this combined content parses correctly through taskparser.ParseTask.

Changes

  • Added test case "both task prompt and user prompt parse correctly" in TestUserPrompt
    • Verifies text blocks, slash commands, and parameter substitution work in both prompts
    • Validates delimiter preservation and content ordering
    • Includes proper error handling for string index validation

Example

createTask(t, dir, "parse-test", "", "Task prompt with text\n/task-command arg1\nMore task text\n")
createCommand(t, dir, "task-command", "", "Task command output ${param1}")
createCommand(t, dir, "user-command", "", "User command output ${param2}")

opts: []Option{
    WithUserPrompt("User prompt with text\n/user-command arg2\nMore user text"),
    WithParams(taskparser.Params{
        "param1": []string{"value1"},
        "param2": []string{"value2"},
    }),
}

// Verifies both commands expand correctly and content maintains order
Original prompt

Write a test here we have both task prompt and user prompt. Verify that is parses.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits December 24, 2025 01:56
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
Copilot AI changed the title [WIP] Add verification test for parsing functionality Add test for combined task and user prompt parsing Dec 24, 2025
Copilot AI requested a review from alexec December 24, 2025 02:00
@alexec alexec marked this pull request as ready for review December 24, 2025 02:14
Copilot AI review requested due to automatic review settings December 24, 2025 02:14
@alexec alexec enabled auto-merge (squash) December 24, 2025 02:14
@alexec alexec merged commit baf499c into main Dec 24, 2025
5 checks passed
@alexec alexec deleted the copilot/add-test-verification-function branch December 24, 2025 02:16
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a comprehensive test case to verify that the system correctly combines and parses both task prompts and user prompts when both are present. The test ensures that the --- delimiter is preserved, slash commands are expanded in both prompts, parameter substitution works correctly, and content ordering is maintained.

Key Changes

  • Added test case "both task prompt and user prompt parse correctly" to the TestUserPrompt table-driven test
  • Validates slash command expansion with parameter substitution in both task and user prompts
  • Verifies delimiter presence and correct ordering of combined content

Comment on lines +1708 to +1710
if taskIdx == -1 || userIdx == -1 {
t.Error("expected both task and user prompt text to be found in result")
} else if taskIdx >= userIdx {
Copy link

Copilot AI Dec 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check is redundant because the previous assertions on lines 1682-1693 already verify that both strings are present using strings.Contains. If those checks pass, then taskIdx and userIdx cannot be -1. Consider removing this check since it's already covered by earlier assertions.

Suggested change
if taskIdx == -1 || userIdx == -1 {
t.Error("expected both task and user prompt text to be found in result")
} else if taskIdx >= userIdx {
if taskIdx >= userIdx {

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants