Store.Project.Conversation.TaskListStatusMigration (fnord v0.9.40)

View Source

Helpers 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.

Pure: heal/1 returns {repaired_map, changed?} and does no I/O. Persistence is the caller's concern - Format.parse_v0/2 composes this pass with heal_tool_call_arguments/1 and writes once at the end via Format.persist_heal_as_v1/3 so the two heals can't clobber each other on disk.

Summary

Functions

Inspect the decoded JSON map for legacy task-list shapes and/or non-canonical status values. Returns {repaired_map, changed?} - the caller decides whether to persist.

Functions

heal(original_json_map)

@spec heal(map()) :: {map(), boolean()}

Inspect the decoded JSON map for legacy task-list shapes and/or non-canonical status values. Returns {repaired_map, changed?} - the caller decides whether to persist.

changed? is true only if at least one list in the tasks map actually needed repair. Already-canonical task lists pass through untouched and do not flip the flag, so a clean read does not trigger an atomic write.