Clear a released project notice on the next composer send
Co-Authored-By: Codex GPT-6-Astra <noreply@openai.com>
4 files changed,
+36
−2
native/PROJECTS-REPORT.md+6 −0native/apple/Sources/EquipoKit/Projects/ProjectCatalog.swift+8 −0native/apple/Sources/EquipoKit/Session/EquipoSession.swift+1 −2native/apple/Tests/EquipoKitTests/ProjectsFinalReviewTests.swift+21 −0
diff --git a/native/PROJECTS-REPORT.md b/native/PROJECTS-REPORT.md| index 8f1ab775..e37859b6 100644 |
| --- a/native/PROJECTS-REPORT.md |
| +++ b/native/PROJECTS-REPORT.md |
| @@ -285,3 +285,9 @@ The three conflicted files were resolved as follows: |
| The merge's copy-release regression and size gate pass. Main's stop-reason |
| implementation, tests and CI lane changes were retained by the automatic merge. |
| + |
| +P3 selection notice: the next composer send consumes the selection and its |
| +notice together, including an ordinary send that goes offline. The regression |
| +`nextComposerSendClearsReleasedSelectionNotice` failed before the fix, passed |
| +after it, and failed again when notice clearing was deliberately removed. |
| +Both existing platform composer tests also pass. |
diff --git a/native/apple/Sources/EquipoKit/Projects/ProjectCatalog.swift b/native/apple/Sources/EquipoKit/Projects/ProjectCatalog.swift| index ec63992b..b683be5f 100644 |
| --- a/native/apple/Sources/EquipoKit/Projects/ProjectCatalog.swift |
| +++ b/native/apple/Sources/EquipoKit/Projects/ProjectCatalog.swift |
| @@ -32,6 +32,14 @@ import Observation |
| reachable.filter { repo in connections.contains { $0.id == repo.connectionId && $0.canAdd } } |
| } |
| + /// The next composer send consumes both its project and any released-selection notice. |
| + func takeSelection() -> String? { |
| + let id = selection?.id |
| + selection = nil |
| + selectionNotice = nil |
| + return id |
| + } |
| + |
| public func refresh() async { |
| guard lifetime.isActive else { return } |
| if reading { readAgain = true; return } |
diff --git a/native/apple/Sources/EquipoKit/Session/EquipoSession.swift b/native/apple/Sources/EquipoKit/Session/EquipoSession.swift| index 1efd3c47..fc36b733 100644 |
| --- a/native/apple/Sources/EquipoKit/Session/EquipoSession.swift |
| +++ b/native/apple/Sources/EquipoKit/Session/EquipoSession.swift |
| @@ -304,8 +304,7 @@ public final class EquipoSession { |
| // MARK: Sending |
| public func sendFromComposer(_ text: String) -> Task<Void, Never> { |
| - let projectID = projectCatalog.selection?.id |
| - projectCatalog.selection = nil |
| + let projectID = projectCatalog.takeSelection() |
| return Task { await send(text, projectID: projectID) } |
| } |
diff --git a/native/apple/Tests/EquipoKitTests/ProjectsFinalReviewTests.swift b/native/apple/Tests/EquipoKitTests/ProjectsFinalReviewTests.swift| new file mode 100644 |
| index 00000000..7ed09fef |
| --- /dev/null |
| +++ b/native/apple/Tests/EquipoKitTests/ProjectsFinalReviewTests.swift |
| @@ -0,0 +1,21 @@ |
| +import Foundation |
| +import Testing |
| +@testable import EquipoKit |
| +#if os(macOS) |
| +import AppKit |
| +import SwiftUI |
| +@testable import EquipoMac |
| +#endif |
| + |
| +extension ProjectsReviewTests { |
| + @Test func nextComposerSendClearsReleasedSelectionNotice() async throws { |
| + let t = ScriptedTransport(); let s = try session(t) |
| + t.on("POST /messages", .failure(.offline)) |
| + s.projectCatalog.releaseSelection("gone") |
| + #expect(s.projectCatalog.selectionNotice != nil) |
| + await s.sendFromComposer("An ordinary request").value |
| + #expect(s.projectCatalog.selectionNotice == nil) |
| + #expect(try body(#require(t.sent("POST /messages").first))["project_id"] == nil) |
| + #expect(s.outgoing.first?.state == .waiting) |
| + } |
| +} |