Refactor Test Coverage and Remove Issue References · Entire
PR 1715 review: strip IDE tags from claude turn prompt
Verdict: approve. Fix correct, minimal, well-tested. No blockers.
Overview
- 3 files, +65/−2.
parseTurnStartnow passraw.Promptthrough existingtextutil.StripIDEContextTagsbefore storing on event. Unit test + full-flow integration test. - Root cause real: VS Code extension prepends
<ide_opened_file>block; raw prompt leaked into session title/LastPrompt.
Correctness — verified consumers
Traced event.Prompt downstream (lifecycle.go:555-618):
prompt.txtwrite — now clean. Good.InitializeSession→state.LastPrompt(title source) — the bug. Fixed.AppendPromptSlashCommandSkillEvent(lifecycle.go:612) — needs leading/. Before fix, IDE block prepended meant slash command never detected. Stripping fixes this too. Free bonus.
Ran both tests: unit TestParseHookEvent_TurnStart_StripsIDEContextTags pass, integration TestIssue1423 pass (3.5s). Helpers (SimulateUserPromptSubmitWithPrompt, GetSessionState) exist, real ones.
Consistency
- Same helper transcript path use (
transcript/parse.go:157,compact.go:641) and cursor/factory-droid agents use. Right pattern, right place. - Fix at parse layer, so every consumer sanitized once. Better than patching title rendering.
Minor observations (no action required)
- Side effect: whitespace trim on all prompts.
StripIDEContextTagsend withTrimSpace— every claude prompt now trimmed, even without tags. Benign; arguably improvement. Worth knowing it changed. - Side effect: broader than IDE tags. Helper also strips
<system-reminder>,<command-*>,<local-command-*>. Matches transcript-path behavior, so consistent — but "StripIDEContextTags" name undersells scope. Pre-existing naming, not this PR's problem. - Edge: all-tag prompt → empty string. Then
prompt.txtappend skipped,LastPromptempty. Claude Code UserPromptSubmit always carries user text, so theoretical. - Test style nit: new unit test mixes
require.NoErrorwitht.Errorfcomparison. Matches siblingTestParseHookEvent_TurnStartstyle, so fine here.
Tests / risk / security
- Coverage good: unit (parse layer) + integration (real hook binary → stored state). PR body says unit test fails without fix — believable, assertion targets exact stripped output.
- Integration test follows project rules:
t.Parallel(), isolatedTestEnvrepo. ✓ - No security concern. Regex per prompt = negligible cost. No API change.