From 1ca7a6d83cc08cf0ae1493c4e897f267fa8dfbcb Mon Sep 17 00:00:00 2001 From: SB Date: Sun, 19 Jul 2026 23:12:23 +0900 Subject: [PATCH 1/2] Preserve assistant newline counting semantics --- Scripts/Fixtures/test-suite-contract-ledger.tsv | 1 + .../AgentMode/Views/AgentMessageBubble.swift | 3 ++- .../AgentTranscriptAssistantPreviewTests.swift | 16 ++++++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Scripts/Fixtures/test-suite-contract-ledger.tsv b/Scripts/Fixtures/test-suite-contract-ledger.tsv index c2593acd0..415659ac1 100644 --- a/Scripts/Fixtures/test-suite-contract-ledger.tsv +++ b/Scripts/Fixtures/test-suite-contract-ledger.tsv @@ -474,6 +474,7 @@ root/RepoPromptTests.AgentToolTrackingControllerTests/testStopWaitsForCapturedOb root/RepoPromptTests.AgentToolTrackingControllerTests/testToolObserverCallbacksReturnBeforeFIFOTranscriptDeliveryCompletes root Tests/RepoPromptTests/AgentMode/AgentToolTrackingControllerTests.swift RepoPromptTests.AgentToolTrackingControllerTests testToolObserverCallbacksReturnBeforeFIFOTranscriptDeliveryCompletes AgentMode unreviewed unreviewed root_swiftpm routine 1 unreviewed unreviewed 0.001000 unreviewed retain_pending_review 0 initial census source line 8 root/RepoPromptTests.AgentTranscriptActivationRepaintRemountPolicyTests/testDuplicateRevisionExceededLimitDetachedOrIdleActivationSuppressesRemount root Tests/RepoPromptTests/AgentMode/Transcript/AgentTranscriptActivationRepaintRemountPolicyTests.swift RepoPromptTests.AgentTranscriptActivationRepaintRemountPolicyTests testDuplicateRevisionExceededLimitDetachedOrIdleActivationSuppressesRemount AgentMode unreviewed unreviewed root_swiftpm routine 1 unreviewed unreviewed 0.000000 unreviewed retain_pending_review 0 initial census source line 20 root/RepoPromptTests.AgentTranscriptActivationRepaintRemountPolicyTests/testEnteredHydratedLiveBottomActivationProducesRemountKey root Tests/RepoPromptTests/AgentMode/Transcript/AgentTranscriptActivationRepaintRemountPolicyTests.swift RepoPromptTests.AgentTranscriptActivationRepaintRemountPolicyTests testEnteredHydratedLiveBottomActivationProducesRemountKey AgentMode unreviewed unreviewed root_swiftpm routine 1 unreviewed unreviewed 0.000000 unreviewed retain_pending_review 0 initial census source line 5 +root/RepoPromptTests.AgentTranscriptAssistantPreviewTests/testCollapseLineCountMatchesPreviewSummaryForCRLFAtLimit root Tests/RepoPromptTests/AgentMode/Transcript/AgentTranscriptAssistantPreviewTests.swift RepoPromptTests.AgentTranscriptAssistantPreviewTests testCollapseLineCountMatchesPreviewSummaryForCRLFAtLimit AgentMode agent_mode.assistant_preview.newline_count_consistency assistant_collapse,crlf,newline_semantics deterministic_regression root_swiftpm fast 1 Bounded collapse counting and full preview derivation both report eleven lines and collapse at the ten-line CRLF boundary. CRLF could be counted as one Character in the bounded path but two Foundation newline separators in the preview path, suppressing required collapse. 0.000000 test_case retain 0 Follow-up to PR #584; protects behavior while retaining its performance improvement. root/RepoPromptTests.AgentTranscriptAssistantPreviewTests/testTerminalResponseDoesNotCrossTrailingNonAssistantBoundary root Tests/RepoPromptTests/AgentMode/Transcript/AgentTranscriptAssistantPreviewTests.swift RepoPromptTests.AgentTranscriptAssistantPreviewTests testTerminalResponseDoesNotCrossTrailingNonAssistantBoundary AgentMode agent_mode.transcript.terminal_assistant_preview assistant_tail,tool_boundary,response_span lifecycle_regression root_swiftpm routine 1 Terminal response preview joins only the asserted trailing assistant fragments and respects non-assistant/tool boundaries. Terminal conclusions could lose assistant tails or cross a tool boundary and misrepresent the final response. 0.000000 test_case retain 0 Authoritative test-list reconciliation for the current integration worktree. root/RepoPromptTests.AgentTranscriptAssistantPreviewTests/testTerminalResponseJoinsFragmentsAcrossResponseSpans root Tests/RepoPromptTests/AgentMode/Transcript/AgentTranscriptAssistantPreviewTests.swift RepoPromptTests.AgentTranscriptAssistantPreviewTests testTerminalResponseJoinsFragmentsAcrossResponseSpans AgentMode agent_mode.transcript.terminal_assistant_preview assistant_tail,tool_boundary,response_span lifecycle_regression root_swiftpm routine 1 Terminal response preview joins only the asserted trailing assistant fragments and respects non-assistant/tool boundaries. Terminal conclusions could lose assistant tails or cross a tool boundary and misrepresent the final response. 0.000000 test_case retain 0 Authoritative test-list reconciliation for the current integration worktree. root/RepoPromptTests.AgentTranscriptAssistantPreviewTests/testTerminalResponseJoinsTrailingFragmentsAndPreservesFullDetailRows root Tests/RepoPromptTests/AgentMode/Transcript/AgentTranscriptAssistantPreviewTests.swift RepoPromptTests.AgentTranscriptAssistantPreviewTests testTerminalResponseJoinsTrailingFragmentsAndPreservesFullDetailRows AgentMode agent_mode.transcript.terminal_assistant_preview assistant_tail,tool_boundary,response_span lifecycle_regression root_swiftpm routine 1 Terminal response preview joins only the asserted trailing assistant fragments and respects non-assistant/tool boundaries. Terminal conclusions could lose assistant tails or cross a tool boundary and misrepresent the final response. 0.000000 test_case retain 0 Authoritative test-list reconciliation for the current integration worktree. diff --git a/Sources/RepoPrompt/Features/AgentMode/Views/AgentMessageBubble.swift b/Sources/RepoPrompt/Features/AgentMode/Views/AgentMessageBubble.swift index f6e132e77..3ee9685dd 100644 --- a/Sources/RepoPrompt/Features/AgentMode/Views/AgentMessageBubble.swift +++ b/Sources/RepoPrompt/Features/AgentMode/Views/AgentMessageBubble.swift @@ -1408,7 +1408,8 @@ enum AgentAssistantLineDerivation { return (count, false) } - for char in text where char.isNewline { + let newlineScalars = CharacterSet.newlines + for scalar in text.unicodeScalars where newlineScalars.contains(scalar) { count += 1 if count > limit { return (count, false) diff --git a/Tests/RepoPromptTests/AgentMode/Transcript/AgentTranscriptAssistantPreviewTests.swift b/Tests/RepoPromptTests/AgentMode/Transcript/AgentTranscriptAssistantPreviewTests.swift index bb87e2694..9295dff77 100644 --- a/Tests/RepoPromptTests/AgentMode/Transcript/AgentTranscriptAssistantPreviewTests.swift +++ b/Tests/RepoPromptTests/AgentMode/Transcript/AgentTranscriptAssistantPreviewTests.swift @@ -3,6 +3,22 @@ import Foundation import XCTest final class AgentTranscriptAssistantPreviewTests: XCTestCase { + func testCollapseLineCountMatchesPreviewSummaryForCRLFAtLimit() { + let lineLimit = 10 + let text = String(repeating: "line\n", count: 8) + "line\r\nfinal" + + let boundedLineCount = AgentAssistantLineDerivation.lineCount(upTo: lineLimit, in: text) + let previewSummary = AgentAssistantLineDerivation.previewSummary( + for: text, + previewLineCount: lineLimit + ) + + XCTAssertEqual(boundedLineCount.count, 11) + XCTAssertFalse(boundedLineCount.isExact) + XCTAssertEqual(previewSummary.lineCount, boundedLineCount.count) + XCTAssertTrue(previewSummary.needsCollapse) + } + func testTerminalResponseJoinsTrailingFragmentsAndPreservesFullDetailRows() throws { let user = item(kind: .user, text: "question", sequenceIndex: 0) let answer = item(kind: .assistant, text: "answer", sequenceIndex: 1) From 4bf721f3fe60f8cfd30285b40ab66785d8378c8f Mon Sep 17 00:00:00 2001 From: SB Date: Mon, 20 Jul 2026 00:30:02 +0900 Subject: [PATCH 2/2] Expand assistant newline contract coverage --- .../Fixtures/test-suite-contract-ledger.tsv | 6 +- .../AgentAssistantLineDerivationTests.swift | 135 ++++++++++++++++++ ...AgentTranscriptAssistantPreviewTests.swift | 16 --- 3 files changed, 140 insertions(+), 17 deletions(-) create mode 100644 Tests/RepoPromptTests/AgentMode/AgentAssistantLineDerivationTests.swift diff --git a/Scripts/Fixtures/test-suite-contract-ledger.tsv b/Scripts/Fixtures/test-suite-contract-ledger.tsv index 415659ac1..287b88d12 100644 --- a/Scripts/Fixtures/test-suite-contract-ledger.tsv +++ b/Scripts/Fixtures/test-suite-contract-ledger.tsv @@ -474,7 +474,11 @@ root/RepoPromptTests.AgentToolTrackingControllerTests/testStopWaitsForCapturedOb root/RepoPromptTests.AgentToolTrackingControllerTests/testToolObserverCallbacksReturnBeforeFIFOTranscriptDeliveryCompletes root Tests/RepoPromptTests/AgentMode/AgentToolTrackingControllerTests.swift RepoPromptTests.AgentToolTrackingControllerTests testToolObserverCallbacksReturnBeforeFIFOTranscriptDeliveryCompletes AgentMode unreviewed unreviewed root_swiftpm routine 1 unreviewed unreviewed 0.001000 unreviewed retain_pending_review 0 initial census source line 8 root/RepoPromptTests.AgentTranscriptActivationRepaintRemountPolicyTests/testDuplicateRevisionExceededLimitDetachedOrIdleActivationSuppressesRemount root Tests/RepoPromptTests/AgentMode/Transcript/AgentTranscriptActivationRepaintRemountPolicyTests.swift RepoPromptTests.AgentTranscriptActivationRepaintRemountPolicyTests testDuplicateRevisionExceededLimitDetachedOrIdleActivationSuppressesRemount AgentMode unreviewed unreviewed root_swiftpm routine 1 unreviewed unreviewed 0.000000 unreviewed retain_pending_review 0 initial census source line 20 root/RepoPromptTests.AgentTranscriptActivationRepaintRemountPolicyTests/testEnteredHydratedLiveBottomActivationProducesRemountKey root Tests/RepoPromptTests/AgentMode/Transcript/AgentTranscriptActivationRepaintRemountPolicyTests.swift RepoPromptTests.AgentTranscriptActivationRepaintRemountPolicyTests testEnteredHydratedLiveBottomActivationProducesRemountKey AgentMode unreviewed unreviewed root_swiftpm routine 1 unreviewed unreviewed 0.000000 unreviewed retain_pending_review 0 initial census source line 5 -root/RepoPromptTests.AgentTranscriptAssistantPreviewTests/testCollapseLineCountMatchesPreviewSummaryForCRLFAtLimit root Tests/RepoPromptTests/AgentMode/Transcript/AgentTranscriptAssistantPreviewTests.swift RepoPromptTests.AgentTranscriptAssistantPreviewTests testCollapseLineCountMatchesPreviewSummaryForCRLFAtLimit AgentMode agent_mode.assistant_preview.newline_count_consistency assistant_collapse,crlf,newline_semantics deterministic_regression root_swiftpm fast 1 Bounded collapse counting and full preview derivation both report eleven lines and collapse at the ten-line CRLF boundary. CRLF could be counted as one Character in the bounded path but two Foundation newline separators in the preview path, suppressing required collapse. 0.000000 test_case retain 0 Follow-up to PR #584; protects behavior while retaining its performance improvement. +root/RepoPromptTests.AgentAssistantLineDerivationTests/testCRLFCountsAsTwoScalarSeparatorsAndMatchesPreview root Tests/RepoPromptTests/AgentMode/AgentAssistantLineDerivationTests.swift RepoPromptTests.AgentAssistantLineDerivationTests testCRLFCountsAsTwoScalarSeparatorsAndMatchesPreview AgentMode agent_mode.assistant_line_derivation.crlf_agreement assistant_collapse,crlf,newline_semantics,preview_agreement deterministic_regression root_swiftpm fast 2 CRLF increments the bounded scalar count twice, produces the same Foundation preview line count, and collapses consistently at the ten-line boundary. Character iteration could coalesce CRLF and make collapse eligibility disagree with preview and remaining-line counts. 0.000000 test_case retain 0 Corrective coverage for PR #584; explicitly preserves the established scalar-separator contract. +root/RepoPromptTests.AgentAssistantLineDerivationTests/testCombiningAndEmojiGraphemesDoNotCreateLines root Tests/RepoPromptTests/AgentMode/AgentAssistantLineDerivationTests.swift RepoPromptTests.AgentAssistantLineDerivationTests testCombiningAndEmojiGraphemesDoNotCreateLines AgentMode agent_mode.assistant_line_derivation.non_newline_graphemes combining_grapheme,emoji_zwj,newline_semantics deterministic_regression root_swiftpm fast 2 Combining and emoji ZWJ graphemes remain one exact line and pass through preview derivation unchanged. A grapheme-oriented optimization could misclassify complex non-newline text or change the owning scalar contract. 0.000000 test_case retain 0 Corrective coverage for PR #584 without a timing-sensitive CI benchmark. +root/RepoPromptTests.AgentAssistantLineDerivationTests/testEmptyAndTrailingSeparatorInputs root Tests/RepoPromptTests/AgentMode/AgentAssistantLineDerivationTests.swift RepoPromptTests.AgentAssistantLineDerivationTests testEmptyAndTrailingSeparatorInputs AgentMode agent_mode.assistant_line_derivation.empty_trailing_contract empty_input,trailing_separator,crlf,newline_semantics boundary_contract root_swiftpm fast 9 Empty text remains one line; every trailing Foundation newline scalar retains an empty final component, with CRLF contributing two components. An optimized scanner could drop trailing empty lines or change empty-input and CRLF preview behavior. 0.000000 test_case retain 0 Corrective coverage for PR #584 across the complete trailing-separator matrix. +root/RepoPromptTests.AgentAssistantLineDerivationTests/testLimitBoundariesReportExactnessAndMatchPreviewDecision root Tests/RepoPromptTests/AgentMode/AgentAssistantLineDerivationTests.swift RepoPromptTests.AgentAssistantLineDerivationTests testLimitBoundariesReportExactnessAndMatchPreviewDecision AgentMode agent_mode.assistant_line_derivation.limit_exactness limit_zero,limit_boundary,is_exact,preview_agreement boundary_contract root_swiftpm fast 6 Limits 0, 9, 10, and 11 return the exact bounded sentinel and isExact state while matching the preview collapse decision at and above each boundary. Early exit could return the wrong sentinel or exactness and suppress or spuriously trigger assistant collapse. 0.000000 test_case retain 0 Corrective boundary coverage for PR #584. +root/RepoPromptTests.AgentAssistantLineDerivationTests/testRecognizesEveryFoundationNewlineScalar root Tests/RepoPromptTests/AgentMode/AgentAssistantLineDerivationTests.swift RepoPromptTests.AgentAssistantLineDerivationTests testRecognizesEveryFoundationNewlineScalar AgentMode agent_mode.assistant_line_derivation.newline_scalar_membership lf,cr,vt,ff,nel,line_separator,paragraph_separator contract_matrix root_swiftpm fast 7 LF, CR, VT, FF, NEL, U+2028, and U+2029 each increment the exact bounded count once and normalize to LF in preview text. A native-property substitution could narrow or otherwise change the established Foundation newline scalar membership. 0.000000 test_case retain 0 Corrective membership coverage for PR #584. root/RepoPromptTests.AgentTranscriptAssistantPreviewTests/testTerminalResponseDoesNotCrossTrailingNonAssistantBoundary root Tests/RepoPromptTests/AgentMode/Transcript/AgentTranscriptAssistantPreviewTests.swift RepoPromptTests.AgentTranscriptAssistantPreviewTests testTerminalResponseDoesNotCrossTrailingNonAssistantBoundary AgentMode agent_mode.transcript.terminal_assistant_preview assistant_tail,tool_boundary,response_span lifecycle_regression root_swiftpm routine 1 Terminal response preview joins only the asserted trailing assistant fragments and respects non-assistant/tool boundaries. Terminal conclusions could lose assistant tails or cross a tool boundary and misrepresent the final response. 0.000000 test_case retain 0 Authoritative test-list reconciliation for the current integration worktree. root/RepoPromptTests.AgentTranscriptAssistantPreviewTests/testTerminalResponseJoinsFragmentsAcrossResponseSpans root Tests/RepoPromptTests/AgentMode/Transcript/AgentTranscriptAssistantPreviewTests.swift RepoPromptTests.AgentTranscriptAssistantPreviewTests testTerminalResponseJoinsFragmentsAcrossResponseSpans AgentMode agent_mode.transcript.terminal_assistant_preview assistant_tail,tool_boundary,response_span lifecycle_regression root_swiftpm routine 1 Terminal response preview joins only the asserted trailing assistant fragments and respects non-assistant/tool boundaries. Terminal conclusions could lose assistant tails or cross a tool boundary and misrepresent the final response. 0.000000 test_case retain 0 Authoritative test-list reconciliation for the current integration worktree. root/RepoPromptTests.AgentTranscriptAssistantPreviewTests/testTerminalResponseJoinsTrailingFragmentsAndPreservesFullDetailRows root Tests/RepoPromptTests/AgentMode/Transcript/AgentTranscriptAssistantPreviewTests.swift RepoPromptTests.AgentTranscriptAssistantPreviewTests testTerminalResponseJoinsTrailingFragmentsAndPreservesFullDetailRows AgentMode agent_mode.transcript.terminal_assistant_preview assistant_tail,tool_boundary,response_span lifecycle_regression root_swiftpm routine 1 Terminal response preview joins only the asserted trailing assistant fragments and respects non-assistant/tool boundaries. Terminal conclusions could lose assistant tails or cross a tool boundary and misrepresent the final response. 0.000000 test_case retain 0 Authoritative test-list reconciliation for the current integration worktree. diff --git a/Tests/RepoPromptTests/AgentMode/AgentAssistantLineDerivationTests.swift b/Tests/RepoPromptTests/AgentMode/AgentAssistantLineDerivationTests.swift new file mode 100644 index 000000000..223f81fea --- /dev/null +++ b/Tests/RepoPromptTests/AgentMode/AgentAssistantLineDerivationTests.swift @@ -0,0 +1,135 @@ +import Foundation +@testable import RepoPromptApp +import XCTest + +final class AgentAssistantLineDerivationTests: XCTestCase { + func testRecognizesEveryFoundationNewlineScalar() { + let separators: [(name: String, scalar: Unicode.Scalar)] = [ + ("LF", "\n"), + ("CR", "\r"), + ("VT", "\u{000B}"), + ("FF", "\u{000C}"), + ("NEL", "\u{0085}"), + ("line separator", "\u{2028}"), + ("paragraph separator", "\u{2029}") + ] + + for separator in separators { + let text = "before\(String(separator.scalar))after" + let bounded = AgentAssistantLineDerivation.lineCount(upTo: 10, in: text) + let preview = AgentAssistantLineDerivation.previewSummary( + for: text, + previewLineCount: 10 + ) + + XCTAssertEqual(bounded.count, 2, separator.name) + XCTAssertTrue(bounded.isExact, separator.name) + XCTAssertEqual(preview.lineCount, 2, separator.name) + XCTAssertEqual(preview.previewText, "before\nafter", separator.name) + XCTAssertFalse(preview.needsCollapse, separator.name) + } + } + + func testCRLFCountsAsTwoScalarSeparatorsAndMatchesPreview() { + let shortText = "before\r\nafter" + let shortCount = AgentAssistantLineDerivation.lineCount(upTo: 10, in: shortText) + let shortPreview = AgentAssistantLineDerivation.previewSummary( + for: shortText, + previewLineCount: 10 + ) + + XCTAssertEqual(shortCount.count, 3, "CRLF must increment once for CR and once for LF") + XCTAssertTrue(shortCount.isExact) + XCTAssertEqual(shortPreview.lineCount, shortCount.count) + XCTAssertEqual(shortPreview.previewText, "before\n\nafter") + XCTAssertFalse(shortPreview.needsCollapse) + + let lineLimit = 10 + let boundaryText = String(repeating: "line\n", count: 8) + "line\r\nfinal" + let boundaryCount = AgentAssistantLineDerivation.lineCount(upTo: lineLimit, in: boundaryText) + let boundaryPreview = AgentAssistantLineDerivation.previewSummary( + for: boundaryText, + previewLineCount: lineLimit + ) + + XCTAssertEqual(boundaryCount.count, 11) + XCTAssertFalse(boundaryCount.isExact) + XCTAssertEqual(boundaryPreview.lineCount, boundaryCount.count) + XCTAssertTrue(boundaryPreview.needsCollapse) + XCTAssertEqual(!boundaryCount.isExact || boundaryCount.count > lineLimit, boundaryPreview.needsCollapse) + } + + func testEmptyAndTrailingSeparatorInputs() { + let cases: [(name: String, text: String, count: Int, preview: String)] = [ + ("empty", "", 1, ""), + ("trailing LF", "value\n", 2, "value\n"), + ("trailing CR", "value\r", 2, "value\n"), + ("trailing VT", "value\u{000B}", 2, "value\n"), + ("trailing FF", "value\u{000C}", 2, "value\n"), + ("trailing NEL", "value\u{0085}", 2, "value\n"), + ("trailing line separator", "value\u{2028}", 2, "value\n"), + ("trailing paragraph separator", "value\u{2029}", 2, "value\n"), + ("trailing CRLF", "value\r\n", 3, "value\n\n") + ] + + for testCase in cases { + let bounded = AgentAssistantLineDerivation.lineCount(upTo: 10, in: testCase.text) + let preview = AgentAssistantLineDerivation.previewSummary( + for: testCase.text, + previewLineCount: 10 + ) + + XCTAssertEqual(bounded.count, testCase.count, testCase.name) + XCTAssertTrue(bounded.isExact, testCase.name) + XCTAssertEqual(preview.lineCount, testCase.count, testCase.name) + XCTAssertEqual(preview.previewText, testCase.preview, testCase.name) + XCTAssertFalse(preview.needsCollapse, testCase.name) + } + } + + func testCombiningAndEmojiGraphemesDoNotCreateLines() { + let cases: [(name: String, text: String)] = [ + ("combining grapheme", "e\u{0301}"), + ("emoji ZWJ grapheme", "👩🏽‍💻") + ] + + for testCase in cases { + let bounded = AgentAssistantLineDerivation.lineCount(upTo: 10, in: testCase.text) + let preview = AgentAssistantLineDerivation.previewSummary( + for: testCase.text, + previewLineCount: 10 + ) + + XCTAssertEqual(bounded.count, 1, testCase.name) + XCTAssertTrue(bounded.isExact, testCase.name) + XCTAssertEqual(preview.lineCount, 1, testCase.name) + XCTAssertEqual(preview.previewText, testCase.text, testCase.name) + XCTAssertFalse(preview.needsCollapse, testCase.name) + } + } + + func testLimitBoundariesReportExactnessAndMatchPreviewDecision() { + let cases: [(limit: Int, lineCount: Int, expectedCount: Int, isExact: Bool)] = [ + (0, 11, 1, false), + (9, 9, 9, true), + (9, 10, 10, false), + (10, 10, 10, true), + (10, 11, 11, false), + (11, 11, 11, true) + ] + + for testCase in cases { + let text = Array(repeating: "line", count: testCase.lineCount).joined(separator: "\n") + let bounded = AgentAssistantLineDerivation.lineCount(upTo: testCase.limit, in: text) + let preview = AgentAssistantLineDerivation.previewSummary( + for: text, + previewLineCount: testCase.limit + ) + let message = "limit=\(testCase.limit), lines=\(testCase.lineCount)" + + XCTAssertEqual(bounded.count, testCase.expectedCount, message) + XCTAssertEqual(bounded.isExact, testCase.isExact, message) + XCTAssertEqual(!bounded.isExact || bounded.count > testCase.limit, preview.needsCollapse, message) + } + } +} diff --git a/Tests/RepoPromptTests/AgentMode/Transcript/AgentTranscriptAssistantPreviewTests.swift b/Tests/RepoPromptTests/AgentMode/Transcript/AgentTranscriptAssistantPreviewTests.swift index 9295dff77..bb87e2694 100644 --- a/Tests/RepoPromptTests/AgentMode/Transcript/AgentTranscriptAssistantPreviewTests.swift +++ b/Tests/RepoPromptTests/AgentMode/Transcript/AgentTranscriptAssistantPreviewTests.swift @@ -3,22 +3,6 @@ import Foundation import XCTest final class AgentTranscriptAssistantPreviewTests: XCTestCase { - func testCollapseLineCountMatchesPreviewSummaryForCRLFAtLimit() { - let lineLimit = 10 - let text = String(repeating: "line\n", count: 8) + "line\r\nfinal" - - let boundedLineCount = AgentAssistantLineDerivation.lineCount(upTo: lineLimit, in: text) - let previewSummary = AgentAssistantLineDerivation.previewSummary( - for: text, - previewLineCount: lineLimit - ) - - XCTAssertEqual(boundedLineCount.count, 11) - XCTAssertFalse(boundedLineCount.isExact) - XCTAssertEqual(previewSummary.lineCount, boundedLineCount.count) - XCTAssertTrue(previewSummary.needsCollapse) - } - func testTerminalResponseJoinsTrailingFragmentsAndPreservesFullDetailRows() throws { let user = item(kind: .user, text: "question", sequenceIndex: 0) let answer = item(kind: .assistant, text: "answer", sequenceIndex: 1)