Spec:specs/engine_side_effects.allium UpdatePostSideEffects: "If templateSlug changed on published post: rewrite .md frontmatter". Post stays published.
bDS2:../bDS2/lib/bds/posts.ex — in update_post, when the post was and remains published and template_slug changed, it calls rewrite_published_post/1 (~line 544): reads the published body from the file, rewrites the file with updated frontmatter via atomic write, preserving published_at.
Current behaviour (RuDS): no post-level rewrite function exists; a template_slug change (like any update) demotes the post to draft and the file is only rewritten on the next publish.
Task: After the reopen-condition fix (see issue "Reopen published posts to draft only when published content actually changes"), add a rewrite_published_post equivalent in crates/bds-core/src/engine/post.rs: when a published post's update does not affect published content but changes frontmatter-visible metadata (template_slug), rewrite posts/YYYY/MM/{slug}.md in place (atomic write, keep body from file, refresh checksum). Note metadata_diff.rs already has rewrite_post_from_database for the repair path — reuse/share.
Acceptance: Test: publish post → update template_slug only → post still published, file frontmatter contains new templateSlug, checksum updated, body unchanged.
**Source:** Audit section 2.2.
**Spec:** `specs/engine_side_effects.allium` UpdatePostSideEffects: "If templateSlug changed on published post: rewrite .md frontmatter". Post stays published.
**bDS2:** `../bDS2/lib/bds/posts.ex` — in `update_post`, when the post was and remains published and template_slug changed, it calls `rewrite_published_post/1` (~line 544): reads the published body from the file, rewrites the file with updated frontmatter via atomic write, preserving published_at.
**Current behaviour (RuDS):** no post-level rewrite function exists; a template_slug change (like any update) demotes the post to draft and the file is only rewritten on the next publish.
**Task:** After the reopen-condition fix (see issue "Reopen published posts to draft only when published content actually changes"), add a `rewrite_published_post` equivalent in `crates/bds-core/src/engine/post.rs`: when a published post's update does not affect published content but changes frontmatter-visible metadata (template_slug), rewrite `posts/YYYY/MM/{slug}.md` in place (atomic write, keep body from file, refresh checksum). Note `metadata_diff.rs` already has `rewrite_post_from_database` for the repair path — reuse/share.
**Acceptance:** Test: publish post → update template_slug only → post still published, file frontmatter contains new templateSlug, checksum updated, body unchanged.
hugo
added the bug label 2026-07-20 19:43:57 +00:00
Implemented in 1e32c7e. A real template_slug change on a still-published post now atomically rewrites the existing Markdown file in place through a shared post serializer used by both live updates and metadata-diff database-to-file repair. The rewrite preserves Published status, body bytes, publishedAt, file path, and the caller-supplied post checksum while updating templateSlug and current frontmatter. Preserving the database checksum follows the bDS2 golden master and the explicit checksum decision in #69; the issue acceptance wording about refreshing a generated checksum was stale. Expanded the acceptance test to verify changed file bytes, parsed templateSlug, unchanged body and publishedAt, NULL database body, and preserved caller checksum. Updated the Allium side-effect rule and README. Allium check/analyse, formatting, diff hygiene, cargo machete, cargo build --workspace, focused post/metadata-diff tests, and cargo test --workspace all pass.
Implemented in 1e32c7e. A real template_slug change on a still-published post now atomically rewrites the existing Markdown file in place through a shared post serializer used by both live updates and metadata-diff database-to-file repair. The rewrite preserves Published status, body bytes, publishedAt, file path, and the caller-supplied post checksum while updating templateSlug and current frontmatter. Preserving the database checksum follows the bDS2 golden master and the explicit checksum decision in #69; the issue acceptance wording about refreshing a generated checksum was stale. Expanded the acceptance test to verify changed file bytes, parsed templateSlug, unchanged body and publishedAt, NULL database body, and preserved caller checksum. Updated the Allium side-effect rule and README. Allium check/analyse, formatting, diff hygiene, cargo machete, cargo build --workspace, focused post/metadata-diff tests, and cargo test --workspace all pass.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Source: Audit section 2.2.
Spec:
specs/engine_side_effects.alliumUpdatePostSideEffects: "If templateSlug changed on published post: rewrite .md frontmatter". Post stays published.bDS2:
../bDS2/lib/bds/posts.ex— inupdate_post, when the post was and remains published and template_slug changed, it callsrewrite_published_post/1(~line 544): reads the published body from the file, rewrites the file with updated frontmatter via atomic write, preserving published_at.Current behaviour (RuDS): no post-level rewrite function exists; a template_slug change (like any update) demotes the post to draft and the file is only rewritten on the next publish.
Task: After the reopen-condition fix (see issue "Reopen published posts to draft only when published content actually changes"), add a
rewrite_published_postequivalent incrates/bds-core/src/engine/post.rs: when a published post's update does not affect published content but changes frontmatter-visible metadata (template_slug), rewriteposts/YYYY/MM/{slug}.mdin place (atomic write, keep body from file, refresh checksum). Notemetadata_diff.rsalready hasrewrite_post_from_databasefor the repair path — reuse/share.Acceptance: Test: publish post → update template_slug only → post still published, file frontmatter contains new templateSlug, checksum updated, body unchanged.
Implemented in
1e32c7e. A real template_slug change on a still-published post now atomically rewrites the existing Markdown file in place through a shared post serializer used by both live updates and metadata-diff database-to-file repair. The rewrite preserves Published status, body bytes, publishedAt, file path, and the caller-supplied post checksum while updating templateSlug and current frontmatter. Preserving the database checksum follows the bDS2 golden master and the explicit checksum decision in #69; the issue acceptance wording about refreshing a generated checksum was stale. Expanded the acceptance test to verify changed file bytes, parsed templateSlug, unchanged body and publishedAt, NULL database body, and preserved caller checksum. Updated the Allium side-effect rule and README. Allium check/analyse, formatting, diff hygiene, cargo machete, cargo build --workspace, focused post/metadata-diff tests, and cargo test --workspace all pass.