refactor(test): drop issue-number refs and redundant integration test (review) · Entire

refactor(test): drop issue-number refs and redundant integration test (review)

d6855b6→main·

gtrrz-victor·2d ago·3 files·+4 added/-46 removed

The unit test in lifecycle_test.go already pins the stripped prompt end-to-end through ParseHookEvent, so the integration file duplicated coverage. Issue references removed from code comments per review.

Co-Authored-By: Claude Fable 5 noreply@anthropic.com

Sessions

01KXJNYKYC9AK1B7PC6ZAW6AZPView transcript

Changes

3

139 unmodified lines

140
141
142
143
143
144
145
146

139 unmodified lines

SessionRef: raw.TranscriptPath,
    // Strip IDE-injected context (e.g. <ide_opened_file> from the VS Code
    // extension) so the session/checkpoint title and prompt show what the
    // user actually typed, not the injected block (#1423).
    // user actually typed, not the injected block.
    Prompt:    textutil.StripIDEContextTags(raw.Prompt),
    Timestamp: time.Now(),
    }, nil

Mcmd/entire/cli/agent/claudecode/lifecycle.go+1/-1

98 unmodified lines

99
100
101
102
103
104
102
103
104
105
106
107

98 unmodified lines

}
}

// Regression for #1423: the VS Code extension prepends an <ide_opened_file>
// context block to the prompt; it must be stripped so the session/checkpoint
title and prompt show only what the user typed.
// The VS Code extension prepends an <ide_opened_file> context block to the
// prompt; it must be stripped so the session/checkpoint title and prompt show
// only what the user typed.
func TestParseHookEvent_TurnStart_StripsIDEContextTags(t *testing.T) {

t.Parallel()

Mcmd/entire/cli/agent/claudecode/lifecycle_test.go+3/-3

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42

//go:build integration

package integration

import (
    "testing"
)

// TestIssue1423_IDEContextTagStrippedFromSessionPrompt is a full-flow
// reproduction of #1423: Claude Code inside the VS Code extension prepends an
// <ide_opened_file> context block to the prompt, which leaked verbatim into the
// session/checkpoint title and prompt display.
//
// It drives the real user-prompt-submit hook binary with such a prompt and then
// reads the stored session state's LastPrompt (the value used for the session
// title / prompt display) — it must contain only what the user typed.
func TestIssue1423_IDEContextTagStrippedFromSessionPrompt(t *testing.T) {
    
t.Parallel()
    env := NewTestEnv(t)

env.InitRepo()
    env.WriteFile("README.md", "# Test")
    env.GitAdd("README.md")
    env.GitCommit("Initial commit")
    env.GitCheckoutNewBranch("feature/ide-tag")
    env.InitEntire()

session := env.NewSession()
    prompt := "<ide_opened_file>The user opened /a/b.md in the IDE. This may or may not be related.</ide_opened_file>\n\nrewrite these docs as one plan"
    if err := env.SimulateUserPromptSubmitWithPrompt(session.ID, prompt); err != nil {
        t.Fatalf("user-prompt-submit: %v", err)
    }

state, err := env.GetSessionState(session.ID)
    if err != nil {
        t.Fatalf("get session state: %v", err)
    }
    const want = "rewrite these docs as one plan"
    if state.LastPrompt != want {
        t.Fatalf("session prompt/title not fully sanitized: got %q, want %q (#1423)", state.LastPrompt, want)
    }
}

Dcmd/entire/cli/integration_test/issue_1423_ide_tag_e2e_test.go-42