EvidenceStore

interface EvidenceStore

Durable, per-session QA evidence tray: the flagged items a bug report is built from, plus its typed draft. This is the server-side precedent io.devconsole.timeline.TimelineAnnotations already set for durable, per-subject annotations -- evidence is a second, richer instance of the same idea, not a new pattern.

Implementations enforce the caps a usable bug report needs: a bounded snapshot size (truncated with an explicit marker rather than silently dropped), a bounded item count per session, and bounded text field lengths on the report draft. Callers at the route boundary should validate the same limits up front so a rejection is reported precisely, but the store enforces them unconditionally -- it never trusts a caller to have done so.

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
abstract suspend fun clear(sessionId: String)

Removes every flagged item for sessionId. The report draft is untouched.

Link copied to clipboard
abstract suspend fun deleteSession(sessionId: String)

Removes every evidence item and the report draft for sessionId.

Link copied to clipboard
abstract suspend fun flag(item: StoredEvidenceItem): EvidenceWriteResult

Flags item; returns EvidenceWriteResult.AlreadyFlagged if its subject is already flagged.

Link copied to clipboard
abstract suspend fun items(sessionId: String): List<StoredEvidenceItem>

All items flagged for sessionId, oldest first.

Link copied to clipboard
abstract suspend fun report(sessionId: String): StoredEvidenceReport

The report draft for sessionId, or a fresh default one if nothing has been saved yet.

Link copied to clipboard
abstract suspend fun saveReport(report: StoredEvidenceReport)

Replaces the report draft for report's session.

Link copied to clipboard
abstract suspend fun unflag(sessionId: String, kind: EvidenceKind, subjectId: String)

Removes one flagged item by its (session, kind, subject) identity. A no-op if it is not flagged.