Skip to content

features managed attachments

factory-droid[bot] edited this page Jul 5, 2026 · 1 revision

Managed attachments

Active contributors: Douwe de Vries, vriesd

Purpose

Managed attachments import screenshots and files into app-data storage, store metadata in SQLite, and keep rich editor image references stable. They support paste/upload, preview hydration, clipboard copy, and cleanup when Sessions are deleted.

Key source files

File Purpose
crates/qa-scribe-core/src/attachments/mod.rs File import, path sanitization, hashing, previews, reconciliation, deletion.
crates/qa-scribe-core/src/domain/attachment.rs Attachment DTOs.
crates/qa-scribe-core/src/services/session_service/attachments.rs Attachment persistence operations.
src-tauri/src/commands/files.rs File and clipboard command handlers.
frontend/src/app/attachmentActions.ts Paste/upload and materialization workflow.
frontend/src/editor/editorHtml.ts Managed attachment image HTML and preview hydration.
frontend/src/editor/clipboardExport.ts Finds screenshot references for clipboard export.

How it works

graph TD
    Paste[Paste or upload image] --> Frontend[attachmentActions]
    Frontend --> Files[src-tauri files command]
    Files --> Core[attachments module]
    Core --> Disk[attachments/session-id]
    Core --> DB[attachments table]
    DB --> Preview[getAttachmentPreviewDataUrl]
    Preview --> Editor[hydrated rich editor image]
Loading

The core stores files under attachments/<session-id>/ using sanitized relative paths and SHA-256 hashes. Preview reads verify integrity before returning data URLs. Session deletion removes managed attachment files after database rows are cascaded.

Integration points

Managed attachments appear inside Rich record editing, support Session capture, and are referenced by generation prompt material in AI-assisted Testware.

Entry points for modification

Change storage behavior in crates/qa-scribe-core/src/attachments/mod.rs, command behavior in src-tauri/src/commands/files.rs, and editor/paste behavior in frontend/src/app/attachmentActions.ts.

Clone this wiki locally