summaryrefslogtreecommitdiff
path: root/internal/processor/processor_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-04-27 08:49:13 +0300
committerPaul Buetow <paul@buetow.org>2026-04-27 08:49:13 +0300
commitdee27d8f2805c9e409853462d35f9103e1a8c53e (patch)
tree3b7f7593b7481e012801dbf44961883407833d9e /internal/processor/processor_test.go
parentad0cc92e16aa98ee10bead846c0ff4c74c5244d6 (diff)
processor: refactor to two-phase commit for inbox processing
Introduce postPlan to capture everything validated in Phase 1 before any filesystem mutation occurs. Phase 1 scans the inbox, validates all source files (parses text, markdown, image, audio), checks markdown image claims for conflicts, and collects a plan per item. Phase 2 commits mutations only after every plan is validated: creates post directories, writes assets, persists post.json, and removes sources. If Phase 1 fails (e.g. unsupported file, missing markdown image, claim conflict), no mutations occur and the inbox is left untouched. Roll back the partial post directory if a mutation fails during commit. Also refactor image and audio sub-processors into validation-only and write-only parts (validateImage/writeImageAsset, validateAudio/copyFile) so that Phase 1 is strictly read-only. All existing tests pass.
Diffstat (limited to 'internal/processor/processor_test.go')
0 files changed, 0 insertions, 0 deletions