Add explicit unarchive; stop silently drafting archived posts on any update #72

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

Source: Audit section 2.3.

Spec: specs/post.allium transitions include archived→draft and archived→published; nothing says updates auto-demote archived posts.

bDS2: ../bDS2/lib/bds/posts.ex has unarchive_post/1 (~line 381): archived→draft with restore_content_for_unarchive (DB content if present, else read body from file, else ""). Plain updates to archived posts do NOT change status.

Current behaviour (RuDS): crates/bds-core/src/engine/post.rs update_post treats Archived like Published: any update flips Archived→Draft (with file-content reload). There is no explicit unarchive function or UI action (grep unarchive — no hits).

Task:

  1. Add unarchive_post to engine/post.rs mirroring bDS2 (status→draft, content restored, updated_at bumped, FTS+embedding sync, domain event).
  2. Stop auto-demoting archived posts in update_post (updates keep archived status, per bDS2).
  3. Wire unarchive into the UI (post editor / sidebar context where archive currently lives — functionality must be tied to UI per AGENTS.md) and the macOS native menu intercept if archive is exposed there; both localization areas (menus + UI) if a menu item is added.
  4. Update specs/post.allium if needed and validate with allium.

Acceptance: Tests for unarchive (content restored from file for previously-published posts) and for update-keeps-archived. UI action reachable.

**Source:** Audit section 2.3. **Spec:** `specs/post.allium` transitions include archived→draft and archived→published; nothing says updates auto-demote archived posts. **bDS2:** `../bDS2/lib/bds/posts.ex` has `unarchive_post/1` (~line 381): archived→draft with `restore_content_for_unarchive` (DB content if present, else read body from file, else ""). Plain updates to archived posts do NOT change status. **Current behaviour (RuDS):** `crates/bds-core/src/engine/post.rs` `update_post` treats Archived like Published: any update flips Archived→Draft (with file-content reload). There is no explicit unarchive function or UI action (grep `unarchive` — no hits). **Task:** 1. Add `unarchive_post` to engine/post.rs mirroring bDS2 (status→draft, content restored, updated_at bumped, FTS+embedding sync, domain event). 2. Stop auto-demoting archived posts in `update_post` (updates keep archived status, per bDS2). 3. Wire unarchive into the UI (post editor / sidebar context where archive currently lives — functionality must be tied to UI per AGENTS.md) and the macOS native menu intercept if archive is exposed there; both localization areas (menus + UI) if a menu item is added. 4. Update `specs/post.allium` if needed and validate with `allium`. **Acceptance:** Tests for unarchive (content restored from file for previously-published posts) and for update-keeps-archived. UI action reachable.
hugo added the bug label 2026-07-20 19:43:57 +00:00
Author
Owner

Implemented in 1c04087. Plain updates now keep archived posts archived in both the core update engine and the desktop preview/autosave path. Added bDS2-compatible unarchive_post: it accepts only Archived, restores existing database content or the published file body (empty fallback), moves to Draft, bumps updated_at, refreshes FTS and embeddings, and emits exactly one typed update event. Archive now also matches bDS2 by leaving a published body in the file instead of copying it into the database, while refreshing the same indexes/event state. Added a localized canonical-post Unarchive header action that saves pending archived edits first, reloads the restored body/status, and reports success; Archive is not exposed in the native macOS menu, so no menu intercept/catalog change was applicable. Localized the touched status badge in all five UI catalogs, updated post.allium and README, and added core, preview/autosave, desktop-action, and domain-event regression coverage. Allium check/analyse, formatting, cargo machete, cargo build --workspace, cargo test --workspace, cargo bundle-macos, and real inspection of the exact release app bundle all pass.

Implemented in 1c04087. Plain updates now keep archived posts archived in both the core update engine and the desktop preview/autosave path. Added bDS2-compatible unarchive_post: it accepts only Archived, restores existing database content or the published file body (empty fallback), moves to Draft, bumps updated_at, refreshes FTS and embeddings, and emits exactly one typed update event. Archive now also matches bDS2 by leaving a published body in the file instead of copying it into the database, while refreshing the same indexes/event state. Added a localized canonical-post Unarchive header action that saves pending archived edits first, reloads the restored body/status, and reports success; Archive is not exposed in the native macOS menu, so no menu intercept/catalog change was applicable. Localized the touched status badge in all five UI catalogs, updated post.allium and README, and added core, preview/autosave, desktop-action, and domain-event regression coverage. Allium check/analyse, formatting, cargo machete, cargo build --workspace, cargo test --workspace, cargo bundle-macos, and real inspection of the exact release app bundle all pass.
hugo closed this issue 2026-07-21 19:49:35 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: hugo/RuDS#72