fix(ui): finish-audit fixes — blank search glyph, quadratic truncation, scope-rail refusal leak
CI / ci (push) Canceled after 0s
CI / ci (pull_request) Canceled after 0s
CI / ci (push) Canceled after 0s
CI / ci (pull_request) Canceled after 0s
Three-reviewer audit of the polish overhaul: - magnifyinglass -> magnifyingglass (blank SF Symbol, all 3 seats) - WordBoundaryTruncation.fit measures each word once (O(n^2) -> O(n) on pathological imported titles; live-title pins unchanged) - scopeHostedSession defers behind an in-flight replay instead of refusing (automatic actions never leak a 'Resume refused' row); replay completion re-fires the pending scope — pinned over the real client path with loadReplayHold, flip-verified - transcript ForEach on stable row ids, not indices - delete dead softBorder param; fold caretPastLeadingBlanks onto firstContentLocation; native TextField prompt for the search field - ElidedPathText.candidates/elide nonisolated (off-actor first(where:) trapped the host); new pins: degenerate truncation shapes, firstContentLocation, elide ladder
This commit is contained in:
1 parent
3a7d495b4b
commit
efad422e03
13 files changed
+163
-65
No files matched your search
@@ -38,4 +38,55 @@ struct SessionScopeTests {
|
||||
// A title with no roster behind it hosts nothing.
|
||||
#expect(SessionRoster.hostedSessionId(forOpenPieceTitle: "Essay X", in: []) == nil)
|
||||
}
|
||||
|
||||
/// Finish-audit: the scope rail is an AUTOMATIC action — when the one
|
||||
/// replay slot is busy (another session's session/load in flight), the
|
||||
/// switch DEFERS like a stream (old behavior: resumeSession refused and
|
||||
/// appended a user-visible "Resume refused" row for an action the writer
|
||||
/// never took). Pinned over the real client path with the fake's
|
||||
/// `loadReplayHold` mode parking the replay; teardown kills the parked
|
||||
/// child, so the resume task is deliberately never awaited.
|
||||
@MainActor
|
||||
@Test func `scope switch defers behind an in-flight replay without refusing`() async throws {
|
||||
let dir = acpTempDir("scope-defer")
|
||||
let fake = makeFakeACP(at: dir, mode: "loadReplayHold")
|
||||
let model = MentorSessionModel(binaryPath: fake, rosterDirectory: dir)
|
||||
defer { model.shutdown() }
|
||||
await model.openSession() // empty roster — creates the default session, completes
|
||||
guard case .ready = model.phase else {
|
||||
Issue.record("expected ready, got \(model.phase)")
|
||||
return
|
||||
}
|
||||
// Two rostered pieces through the real flow; B's session is active.
|
||||
guard await model.newSession(name: "On A", pieceTitle: "Piece A") != nil,
|
||||
await model.newSession(name: "On B", pieceTitle: "Piece B") != nil
|
||||
else {
|
||||
Issue.record("session creation refused")
|
||||
return
|
||||
}
|
||||
let entryA = try #require(model.roster.first { $0.pieceTitle == "Piece A" })
|
||||
let activeBefore = model.activeEntry?.sessionId
|
||||
// Park A's replay behind the hold — the load sits in flight, the
|
||||
// slot stays taken, and B remains the pane's surface.
|
||||
_ = Task { await model.resumeSession(entryA) }
|
||||
var held = false
|
||||
for _ in 0 ..< 250 where !held {
|
||||
held = model.stderrTail.contains { $0.contains("hold-load") }
|
||||
if !held {
|
||||
try await Task.sleep(nanoseconds: 20_000_000)
|
||||
}
|
||||
}
|
||||
#expect(held)
|
||||
await model.scopeHostedSession(toOpenPieceTitle: "Piece A")
|
||||
let refused = model.rows.contains { row in
|
||||
if case let .text(text) = row.content {
|
||||
return text.contains("Resume refused")
|
||||
}
|
||||
return false
|
||||
}
|
||||
#expect(!refused)
|
||||
// The switch applied nowhere yet — deferred, not refused and not
|
||||
// swapped behind the replay.
|
||||
#expect(model.activeEntry?.sessionId == activeBefore)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user