Do not copy file body into DB content when archiving a published post #73

Closed
opened 2026-07-20 19:43:58 +00:00 by hugo · 1 comment
Owner

Source: Audit section 2.4.

bDS2: ../bDS2/lib/bds/posts.ex archive_post (~line 353) only sets status/updated_at. Content stays NULL for published→archived posts; the body is restored from file only on unarchive (restore_content_for_unarchive).

Current behaviour (RuDS): crates/bds-core/src/engine/post.rs archive_post (~line 328) reads the .md body back into post.content and persists it when archiving a published post. The archived row then has body in the DB AND on disk — a DB state bDS2 never produces. This skews metadata_diff (content field comparisons) and rebuild expectations, and violates the project rule that body-in-DB is for drafts.

Task: Remove the content-restore from archive_post (keep it in the unarchive path — see companion issue "Add explicit unarchive"). Verify metadata_diff and generation treat archived-with-file posts identically to bDS2 afterwards.

Acceptance: Test: publish → archive → DB content is NULL, file untouched; unarchive restores content. Depends on the unarchive issue landing first or together.

**Source:** Audit section 2.4. **bDS2:** `../bDS2/lib/bds/posts.ex` `archive_post` (~line 353) only sets status/updated_at. Content stays NULL for published→archived posts; the body is restored from file only on unarchive (`restore_content_for_unarchive`). **Current behaviour (RuDS):** `crates/bds-core/src/engine/post.rs` `archive_post` (~line 328) reads the .md body back into `post.content` and persists it when archiving a published post. The archived row then has body in the DB AND on disk — a DB state bDS2 never produces. This skews metadata_diff (content field comparisons) and rebuild expectations, and violates the project rule that body-in-DB is for drafts. **Task:** Remove the content-restore from `archive_post` (keep it in the unarchive path — see companion issue "Add explicit unarchive"). Verify metadata_diff and generation treat archived-with-file posts identically to bDS2 afterwards. **Acceptance:** Test: publish → archive → DB content is NULL, file untouched; unarchive restores content. Depends on the unarchive issue landing first or together.
hugo added the bug label 2026-07-20 19:43:58 +00:00
Author
Owner

Implemented and pushed in 89a07c8. Archiving now changes only status/updated_at, preserves published file bytes exactly, and keeps published body content NULL in SQLite. Dedicated coverage verifies publish→archive persistence, metadata-diff status/timestamp drift, exclusion from generation sources, and unarchive restoration. Added Archive/Unarchive to the editor Quick Actions in the bDS2 location with complete localization and safe pending-editor persistence; updated the Allium rule and README. Neutral review compared the issue, bDS2 archive/unarchive flow, and Allium obligations. Verification: allium check/analyse, cargo fmt/check/build/machete, focused archive/metadata/generation/UI/i18n tests, cargo test --workspace (green; 1 intentional model-download ignore), cargo bundle-macos, and real German release-bundle inspection. Also made the server task-snapshot test assert its named invariant so unrelated concurrent domain events cannot make the full suite flaky.

Implemented and pushed in 89a07c8. Archiving now changes only status/updated_at, preserves published file bytes exactly, and keeps published body content NULL in SQLite. Dedicated coverage verifies publish→archive persistence, metadata-diff status/timestamp drift, exclusion from generation sources, and unarchive restoration. Added Archive/Unarchive to the editor Quick Actions in the bDS2 location with complete localization and safe pending-editor persistence; updated the Allium rule and README. Neutral review compared the issue, bDS2 archive/unarchive flow, and Allium obligations. Verification: allium check/analyse, cargo fmt/check/build/machete, focused archive/metadata/generation/UI/i18n tests, cargo test --workspace (green; 1 intentional model-download ignore), cargo bundle-macos, and real German release-bundle inspection. Also made the server task-snapshot test assert its named invariant so unrelated concurrent domain events cannot make the full suite flaky.
hugo closed this issue 2026-07-21 20:04:40 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: hugo/RuDS#73