Skip to content

feat(data): add unarchive() primitive to ConversationRepository + Fake impl #96

@ilmoniemi

Description

@ilmoniemi

User Story

As an app developer wiring the Archived Discussions UI restore action, I want the repository to expose an unarchive(conversationId) primitive that clears the archived flag, so the UI layer can restore an archived discussion and have it reappear in the active Discussions list.

Context

The Archived Discussions view (split from #77) needs a restore action. The foundation slice #93 introduced the archived: Boolean flag on Conversation, retains conversations on archive(), and exposes ConversationFilter.Archived for observing the archived stream. This ticket adds the trivial inverse: a primitive that clears the flag.

It is its own slice rather than bundled into #93 because pairing the inverse with the foundation would push the combined ticket over the AC limit; splitting also let the foundation land independently so the UI restore work (#94) can start as soon as this primitive lands.

Acceptance Criteria

  • ConversationRepository interface exposes suspend fun unarchive(conversationId: String), mirroring the existing archive operation
  • FakeConversationRepository.unarchive(conversationId) clears the archived flag on the named conversation (inverse of the flag-based archive semantics)
  • Unit test: starting from a seeded archived discussion, unarchive(id) removes it from the ConversationFilter.Archived stream and adds it to the ConversationFilter.Discussions (active) stream

Technical Notes

  • Stay consistent with the existing interface: raw String for conversationId, no ConversationId value type.
  • For unknown IDs: mirror archive()'s behavior, which throws IllegalArgumentException("Unknown conversation: <id>") via the existing unknown() helper in FakeConversationRepository.
  • Calling unarchive on a conversation that isn't currently archived is a no-op-equivalent (the flag is already false); the architect picks whether this is a silent success or an explicit precondition check.

Size Estimate

XS

Depends on

#93 (landed) — introduced the archived flag and the archived-observable stream. Linked via GitHub blocked-by.

Split from

#77

Metadata

Metadata

Assignees

No one assigned

    Labels

    size:xs<30 lines production code; trivial change

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions