Store.Project.Conversation.TaskListStatusMigration (fnord v0.9.29)
View SourceHelpers to best-effort heal and migrate conversation task-list statuses and shapes.
These functions are intentionally minimal and safe: they only alter the
tasks map of the decoded conversation JSON if legacy shapes are detected
(for example the value is a bare list instead of a map), or if a status
field is missing or non-canonical. Repairs are applied in-memory, and the
module attempts an atomic write of the repaired JSON back to disk, but if
persistence fails, processing continues without raising. The timestamp prefix
used by the Store.Project.Conversation format is preserved.
Summary
Functions
Inspect the decoded JSON map original_json_map for legacy task-list
shapes and/or non-canonical status values. If repairs are needed, apply them
in-memory and attempt to atomically persist the repaired JSON to disk using
the provided conversation and the original timestamp_str (the unix
timestamp string prefix).
Functions
@spec heal_and_maybe_write(map(), Store.Project.Conversation.t(), String.t()) :: :ok
Inspect the decoded JSON map original_json_map for legacy task-list
shapes and/or non-canonical status values. If repairs are needed, apply them
in-memory and attempt to atomically persist the repaired JSON to disk using
the provided conversation and the original timestamp_str (the unix
timestamp string prefix).
Persistence is best-effort: if the write fails (for example due to concurrent access or filesystem issues), this function will warn and continue without raising so callers can keep reading the conversation.
This function is safe to call from Store.Project.Conversation.read/1; it is conservative and only writes when it detects a change.