Spec:specs/post.allium rule DiscardPostChanges requires post.file_path != "" ("a never-published draft has no file version to restore"); errors if the file is missing.
bDS2:../bDS2/lib/bds/posts.exdiscard_post_changes (~line 223): not_found when file_path empty OR file missing; otherwise upserts the record from the file via RebuildFromFiles.upsert_post_from_file and resyncs links.
Current behaviour (RuDS):crates/bds-core/src/engine/post.rsdiscard_post_draft (~line 356) gates on published_at.is_some() instead, and when the file is missing silently falls back to the published_* snapshot columns. Differences: (a) a rebuilt draft that has a file but no published_at is discardable in bDS2 but rejected by RuDS; (b) missing file errors in bDS2 but "succeeds" from snapshot in RuDS; (c) RuDS does not resync post links on discard.
Task: Match bDS2: guard on file_path non-empty + file exists (error otherwise), restore full record from the file (status from frontmatter), resync post links, keep the savepoint + FTS handling. Remove the snapshot fallback (see companion issue on published_* snapshot semantics). Update tests discard_post_draft_restores_published_state etc.
**Source:** Audit section 2.9.
**Spec:** `specs/post.allium` rule DiscardPostChanges requires `post.file_path != ""` ("a never-published draft has no file version to restore"); errors if the file is missing.
**bDS2:** `../bDS2/lib/bds/posts.ex` `discard_post_changes` (~line 223): not_found when file_path empty OR file missing; otherwise upserts the record from the file via `RebuildFromFiles.upsert_post_from_file` and resyncs links.
**Current behaviour (RuDS):** `crates/bds-core/src/engine/post.rs` `discard_post_draft` (~line 356) gates on `published_at.is_some()` instead, and when the file is missing silently falls back to the `published_*` snapshot columns. Differences: (a) a rebuilt draft that has a file but no published_at is discardable in bDS2 but rejected by RuDS; (b) missing file errors in bDS2 but "succeeds" from snapshot in RuDS; (c) RuDS does not resync post links on discard.
**Task:** Match bDS2: guard on file_path non-empty + file exists (error otherwise), restore full record from the file (status from frontmatter), resync post links, keep the savepoint + FTS handling. Remove the snapshot fallback (see companion issue on published_* snapshot semantics). Update tests `discard_post_draft_restores_published_state` etc.
**Acceptance:** Behaviour matches bDS2 for: normal discard, file-missing error, draft-with-file-no-published_at discard.
hugo
added the bug label 2026-07-20 19:43:59 +00:00
Implemented in 535303e. Discard now follows bDS2's canonical-file guard: an empty or missing file path returns not-found, and database published_at no longer controls eligibility. The post is restored from parsed frontmatter (including status and timestamps), content/checksum are cleared, links are rebuilt from the file body, and FTS/database updates remain savepoint-protected; snapshot policy is deliberately left to companion issue #79. Added regressions for normal restoration/link resync, missing-file immutability, a draft with no database published_at, frontmatter status, and FTS rollback. Updated README. Verified with Allium check/analyse, cargo fmt --check, cargo check --workspace, cargo machete --with-metadata, cargo build --workspace, focused discard tests, and cargo test --workspace (all passed; one intentional model-download test ignored).
Implemented in 535303e. Discard now follows bDS2's canonical-file guard: an empty or missing file path returns not-found, and database published_at no longer controls eligibility. The post is restored from parsed frontmatter (including status and timestamps), content/checksum are cleared, links are rebuilt from the file body, and FTS/database updates remain savepoint-protected; snapshot policy is deliberately left to companion issue #79. Added regressions for normal restoration/link resync, missing-file immutability, a draft with no database published_at, frontmatter status, and FTS rollback. Updated README. Verified with Allium check/analyse, cargo fmt --check, cargo check --workspace, cargo machete --with-metadata, cargo build --workspace, focused discard tests, and cargo test --workspace (all passed; one intentional model-download test ignored).
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.9.
Spec:
specs/post.alliumrule DiscardPostChanges requirespost.file_path != ""("a never-published draft has no file version to restore"); errors if the file is missing.bDS2:
../bDS2/lib/bds/posts.exdiscard_post_changes(~line 223): not_found when file_path empty OR file missing; otherwise upserts the record from the file viaRebuildFromFiles.upsert_post_from_fileand resyncs links.Current behaviour (RuDS):
crates/bds-core/src/engine/post.rsdiscard_post_draft(~line 356) gates onpublished_at.is_some()instead, and when the file is missing silently falls back to thepublished_*snapshot columns. Differences: (a) a rebuilt draft that has a file but no published_at is discardable in bDS2 but rejected by RuDS; (b) missing file errors in bDS2 but "succeeds" from snapshot in RuDS; (c) RuDS does not resync post links on discard.Task: Match bDS2: guard on file_path non-empty + file exists (error otherwise), restore full record from the file (status from frontmatter), resync post links, keep the savepoint + FTS handling. Remove the snapshot fallback (see companion issue on published_* snapshot semantics). Update tests
discard_post_draft_restores_published_stateetc.Acceptance: Behaviour matches bDS2 for: normal discard, file-missing error, draft-with-file-no-published_at discard.
Implemented in
535303e. Discard now follows bDS2's canonical-file guard: an empty or missing file path returns not-found, and database published_at no longer controls eligibility. The post is restored from parsed frontmatter (including status and timestamps), content/checksum are cleared, links are rebuilt from the file body, and FTS/database updates remain savepoint-protected; snapshot policy is deliberately left to companion issue #79. Added regressions for normal restoration/link resync, missing-file immutability, a draft with no database published_at, frontmatter status, and FTS rollback. Updated README. Verified with Allium check/analyse, cargo fmt --check, cargo check --workspace, cargo machete --with-metadata, cargo build --workspace, focused discard tests, and cargo test --workspace (all passed; one intentional model-download test ignored).