Reopen published templates/scripts only when content actually changes #82
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Source: Audit section 2.13.
Spec:
specs/template.alliumReopenPublishedTemplate requirestemplate_changes_affect_rendered_output(changes);specs/script.alliumReopenPublishedScript requiresscript_changes_affect_published_output(changes).bDS2: templates:
content_changed?/2compares supplied content againsteffective_template_content(DB content or file body) andresolve_next_statusdemotes 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.rsupdate_template/save_templateandengine/script.rsupdate_script/save_scriptflip 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.
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.