| 1 | using CascadeIDE.Features.Chat; |
| 2 | using CascadeIDE.Models.AgentChat; |
| 3 | using Xunit; |
| 4 | |
| 5 | namespace CascadeIDE.Tests; |
| 6 | |
| 7 | public sealed class ChatSedmScopeStripTests |
| 8 | { |
| 9 | [Fact] |
| 10 | public void BuildAgentContextPrefix_IncludesContextIntentDecision() |
| 11 | { |
| 12 | var strip = new ChatSedmScopeStrip( |
| 13 | "Foo.cs · 0172 — habitat", |
| 14 | "strip shows worklines → meta projection", |
| 15 | "S1 events → append-only", |
| 16 | "active", |
| 17 | OpenWorklineCount: 2, |
| 18 | IntentIncomplete: false); |
| 19 | |
| 20 | var prefix = strip.BuildAgentContextPrefix(); |
| 21 | Assert.NotNull(prefix); |
| 22 | Assert.Contains("Here: Foo.cs", prefix, StringComparison.Ordinal); |
| 23 | Assert.Contains("Intent:", prefix, StringComparison.Ordinal); |
| 24 | Assert.Contains("Decision:", prefix, StringComparison.Ordinal); |
| 25 | Assert.Contains("Other open worklines: 1", prefix, StringComparison.Ordinal); |
| 26 | } |
| 27 | |
| 28 | [Fact] |
| 29 | public void FromProjection_FlagsIncompleteIntent() |
| 30 | { |
| 31 | var workline = new SedmEventProjector.WorklineProjection( |
| 32 | "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 33 | null, |
| 34 | new SedmIntentCardRecordedPayload( |
| 35 | 1, |
| 36 | "operator", |
| 37 | "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 38 | new SedmIntentCardBodyPayload("outcome only", ChosenApproach: "x")), |
| 39 | null, |
| 40 | []); |
| 41 | |
| 42 | var strip = ChatSedmScopeStrip.FromProjection(workline, 1); |
| 43 | Assert.True(strip.IntentIncomplete); |
| 44 | Assert.Contains("(incomplete)", strip.FormatStripText(), StringComparison.Ordinal); |
| 45 | } |
| 46 | |
| 47 | [Fact] |
| 48 | public void FormatStripText_ShowsStaleDecision() |
| 49 | { |
| 50 | var strip = new ChatSedmScopeStrip( |
| 51 | null, |
| 52 | null, |
| 53 | "old basis → retry", |
| 54 | "stale", |
| 55 | 1, |
| 56 | false); |
| 57 | |
| 58 | Assert.Contains("[stale]", strip.FormatStripText(), StringComparison.Ordinal); |
| 59 | } |
| 60 | } |
| 61 | |