feat(sessions): session lifecycle UI (S2.3) (#28)
CI / ci (push) Canceled after 0s
CI / ci (push) Canceled after 0s
Each Session is a conversation Museion UIs, never owns. The mentor bridge hosts multiple engine-owned sessions: per-session transcripts keyed by wire sessionId behind same-named proxies (every existing caller compiles unchanged), a names-only roster at Application Support/sessions.json (0600; id/name/pieceTitle/date — the words stay engine-owned per ADR-0007), and the standard affordances over the wire: session/new, session/load, session/fork, compact as the /compress slash prompt, session/cancel as the Stop rail. The Sessions pane replaces its placeholder: roster list (piece- associated by name when Posts has an open piece), row-click resume with the engine's full-history replay (user turns included), Fork · Compact, live streaming with Stop; every pass auto-creates its rostered session and streams into it; the transcript renderer is shared with the mentor pane. Notification hops ride the main queue (FIFO with the continuation resume) so the adapter's replay-before- response contract is guaranteed, not probabilistic. Resume refusals are honest and entry-attributed (an engine-unknown session never fabricates history); concurrent replays refuse instead of interleaving; restart replays from the engine rather than trusting a diverging local copy. Finish-audit (three reviewers) surfaced the concurrent-resume race, the dead restart branch, the runPass guard window, the 15 s session/load default, and the missing createSession backstop — all fixed and pinned (12 lifecycle pins; 359 tests green). Closes #28
This commit is contained in:
1 parent
78c8844184
commit
9895614b7e
15 files changed
+1523
-245
No files matched your search
@@ -238,3 +238,24 @@ private func textRows(of model: MentorSessionModel) -> [String] {
|
||||
)
|
||||
#expect(onDisk.contains("pass_state: Pass-2 Done"))
|
||||
}
|
||||
|
||||
/// #28 (S2.3): every pass auto-creates its session — the roster grows by
|
||||
/// 'Pass N · <title>' and that entry is the active transcript's owner.
|
||||
@Test @MainActor func `running a pass grows the roster with its pass session active`() async throws {
|
||||
let (model, home, mentor) = try makePassRig()
|
||||
defer { mentor.shutdown() }
|
||||
await mentor.openSession()
|
||||
let before = mentor.roster.count
|
||||
let post = try PostStore.writeNew(body: "# Rostered Pass\n\nOne session per pass.", home: home)
|
||||
model.select(post.id, home: home)
|
||||
for _ in 0 ..< 250 where !model.posts.contains(where: { $0.id == post.id }) {
|
||||
try await Task.sleep(nanoseconds: 20_000_000)
|
||||
}
|
||||
|
||||
await model.runPass(.pass1, home: home, mentor: mentor)
|
||||
|
||||
#expect(mentor.roster.count == before + 1)
|
||||
#expect(mentor.roster.first?.name == "Pass 1 · \(post.title)")
|
||||
#expect(mentor.activeEntry == mentor.roster.first)
|
||||
#expect(model.lastError == nil)
|
||||
}
|
||||
Reference in new issue
Block a user