Files
openclaw-openclaw/apps/ios/Tests/ChatSessionsCodingTests.swift
Peter Steinberger 88f1ec38d4 feat(sessions): grouping, unread state, and full session controls on web, iOS, and Android (#100814)
Gateway (additive, no protocol version bump): SessionEntry gains
lastReadAt/markedUnreadAt/lastActivityAt; session rows expose a derived
unread flag (explicit mark, or last read before latest activity; never-read
sessions stay read so upgrades do not light up). lastActivityAt is stamped
in the canonical post-run store update - user, channel, and cron runs count
as activity; heartbeat, internal-event, and preserved-state runs do not.
sessions.patch gains unread; sessions.create gains fork (transcript fork
from parentSessionKey under the parent lifecycle lock, refusing active,
concurrently-changed, and oversized parents, cross-agent aware).

Web sidebar: Pinned/custom-group/Ungrouped sections, unread dots, kebab and
right-click context menu (pin, mark unread/read, rename, fork, move to group,
archive, delete guarded for agent main sessions and active runs), mark-read
on view with loop-safe re-acknowledgement and failure retry; sessions page
gets unread + fork actions and shared custom-group helpers.

iOS Command Center: grouped sections, unread/pin indicators, Show Archived
gated on per-entry state, full context menu with rename/new-group alerts and
delete confirmation, current-session preview guarantee, read-episode
re-acknowledgement; new patch/delete/fork transport calls; Swift protocol
models regenerated.

Android SessionsScreen: grouped headers, unread/pin indicators, Archived
filter gated on per-entry state, long-press menu with the full control set,
agent-scoped forks, explicit label/category clears from session events,
main-session fallback when archiving/deleting the open chat, read-episode
re-acknowledgement with failure retry.

Closes #100739
2026-07-06 14:30:55 +01:00

31 lines
949 B
Swift

import Foundation
import OpenClawChatUI
import Testing
struct ChatSessionsCodingTests {
@Test func `decodes session organization and read state fields`() throws {
let data = Data(#"""
{
"key":"agent:main:telegram:group:1",
"label":"Release room",
"category":"Operations",
"pinned":true,
"archived":false,
"unread":true,
"lastReadAt":1720000000000,
"lastActivityAt":1720000005000
}
"""#.utf8)
let entry = try JSONDecoder().decode(OpenClawChatSessionEntry.self, from: data)
#expect(entry.label == "Release room")
#expect(entry.category == "Operations")
#expect(entry.pinned == true)
#expect(entry.archived == false)
#expect(entry.unread == true)
#expect(entry.lastReadAt == 1_720_000_000_000)
#expect(entry.lastActivityAt == 1_720_000_005_000)
}
}