Skip to main content

Module persistent_issues

Module persistent_issues 

Source
Expand description

Persistent issue storage — reads and writes .oo/issues.yaml.

This module is the only place in the IDE that performs disk I/O on behalf of the issue system. The crate::issue_registry::IssueRegistry itself is purely in-memory; this module bridges the gap between disk and registry by:

  • Loading at IDE startup: reading .oo/issues.yaml, converting each record to a NewIssue with marker: None (persistent), and sending crate::operation::Operation::AddIssue operations via op_tx.

  • Saving after mutations: whenever a persistent issue changes, the caller (in apply_operation) calls save_atomic with a snapshot of all current persistent issues. The write is fire-and-forget inside a tokio::task::spawn_blocking closure.

§File format

format_version: 1
issues:
  - source: "user"
    severity: "warning"
    message: "TODO: improve error handling"
    dismissed: false
    resolved: false
    created_at_secs: 1706745600
    # optional fields:
    path: "src/main.rs"
    range_start_line: 42
    range_start_col: 0
    range_end_line: 42
    range_end_col: 10

§Error handling

  • Missing file → Ok(vec![]) (first-run friendly).
  • Unreadable or corrupt YAML → log::warn! then Ok(vec![]) (no crash).
  • Save failures → the caller logs a warning; the registry state is never rolled back.

Structs§

IssueFile
Top-level container written to issues.yaml.
IssueRecord
A single serialisable issue record. All fields that reference internal types use plain primitives so no extra serde derives are needed on Position or Severity.
PersistentNewIssue
Input data for creating a new persistent issue via crate::operation::PersistentIssueOp::Add.

Functions§

load
Load persistent issues from path.
save_atomic
Atomically write issues to path.