Reopen published templates/scripts only when content actually changes #82

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

Source: Audit section 2.13.

Spec: specs/template.allium ReopenPublishedTemplate requires template_changes_affect_rendered_output(changes); specs/script.allium ReopenPublishedScript requires script_changes_affect_published_output(changes).

bDS2: templates: content_changed?/2 compares supplied content against effective_template_content (DB content or file body) and resolve_next_status demotes only then (../bDS2/lib/bds/templates.ex ~lines 208-215). Scripts: same pattern (../bDS2/lib/bds/scripts.ex ~line 160-177).

Current behaviour (RuDS): engine/template.rs update_template/save_template and engine/script.rs update_script/save_script flip Published→Draft on ANY update (title, enabled, kind, entrypoint…), even a no-op content save.

Task: Demote only when supplied content differs from effective content (read file body when DB content is NULL — unpublish already shows how). Title/enabled/kind/entrypoint changes keep published status; consider whether they require a published-file frontmatter rewrite (bDS2: file_path/attrs go through update side-effect sync — mirror it; enabled/version/title live in frontmatter, so a published row's metadata change should rewrite the file in place).

Acceptance: Tests per entity: metadata-only update keeps published (+ file frontmatter updated), content change demotes, identical content save keeps published.

**Source:** Audit section 2.13. **Spec:** `specs/template.allium` ReopenPublishedTemplate requires `template_changes_affect_rendered_output(changes)`; `specs/script.allium` ReopenPublishedScript requires `script_changes_affect_published_output(changes)`. **bDS2:** templates: `content_changed?/2` compares supplied content against `effective_template_content` (DB content or file body) and `resolve_next_status` demotes only then (`../bDS2/lib/bds/templates.ex` ~lines 208-215). Scripts: same pattern (`../bDS2/lib/bds/scripts.ex` ~line 160-177). **Current behaviour (RuDS):** `engine/template.rs` `update_template`/`save_template` and `engine/script.rs` `update_script`/`save_script` flip Published→Draft on ANY update (title, enabled, kind, entrypoint…), even a no-op content save. **Task:** Demote only when supplied content differs from effective content (read file body when DB content is NULL — unpublish already shows how). Title/enabled/kind/entrypoint changes keep published status; consider whether they require a published-file frontmatter rewrite (bDS2: file_path/attrs go through update side-effect sync — mirror it; enabled/version/title live in frontmatter, so a published row's metadata change should rewrite the file in place). **Acceptance:** Tests per entity: metadata-only update keeps published (+ file frontmatter updated), content change demotes, identical content save keeps published.
hugo added the bug label 2026-07-20 19:44:00 +00:00
Author
Owner

Implemented in 1410b97. Template and script update/save paths now compare supplied content with effective content, falling back to the published file body when DB content is absent. Metadata-only and identical-content updates remain published and atomically refresh file frontmatter/version while preserving the body; actual content changes reopen drafts and leave the previous published file intact. Allium now makes the effective-content transition and published metadata synchronization explicit, and README lifecycle documentation was updated. Verified neutrally against issue #82, bDS2, metadata diff/rebuild behavior, and Allium with per-entity metadata/content/no-op tests, allium check/analyse, formatting, cargo check, cargo machete, cargo build, and cargo test --workspace.

Implemented in 1410b97. Template and script update/save paths now compare supplied content with effective content, falling back to the published file body when DB content is absent. Metadata-only and identical-content updates remain published and atomically refresh file frontmatter/version while preserving the body; actual content changes reopen drafts and leave the previous published file intact. Allium now makes the effective-content transition and published metadata synchronization explicit, and README lifecycle documentation was updated. Verified neutrally against issue #82, bDS2, metadata diff/rebuild behavior, and Allium with per-entity metadata/content/no-op tests, allium check/analyse, formatting, cargo check, cargo machete, cargo build, and cargo test --workspace.
hugo closed this issue 2026-07-21 21:25:34 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: hugo/RuDS#82