feat: ADR-0006 §8 step 6 — .snapshots/ gitignore + export + cleanup
The undo ring is local working state, handled at all three project-file seams (R13): - .gitignore template ignores /.snapshots/ - export excludes .snapshots/ (like playground.db / history.log) - safely_delete_temp_project allowlists .snapshots/ so a temp that was modified then undone back to empty stays auto-deletable - undo::SNAPSHOTS_DIR is now a pub const referenced by all three - tests: gitignore content, export exclusion, cleanup allowlist 1693 passed / 0 failed / 1 ignored; clippy clean.
This commit is contained in:
+10
-3
@@ -416,10 +416,12 @@ impl Project {
|
||||
write_if_missing(&path.join(PROJECT_YAML), &yaml)?;
|
||||
|
||||
// .gitignore template (ADR-0015 §11). Excludes the
|
||||
// derived `.db`, the per-process lock, and migration
|
||||
// backups. `history.log` is intentionally NOT ignored
|
||||
// derived `.db`, the per-process lock, migration backups,
|
||||
// and the undo snapshot ring (ADR-0006 Amendment 1 — local
|
||||
// working state). `history.log` is intentionally NOT ignored
|
||||
// (ADR-0007 amendment 1: per-user choice).
|
||||
let gitignore = "/playground.db\n/.rdbms-playground.lock\n/project.yaml.v*.bak\n";
|
||||
let gitignore =
|
||||
"/playground.db\n/.rdbms-playground.lock\n/project.yaml.v*.bak\n/.snapshots/\n";
|
||||
write_if_missing(&path.join(GITIGNORE), gitignore)?;
|
||||
|
||||
Ok(())
|
||||
@@ -502,6 +504,10 @@ const ALLOWED_PROJECT_ENTRIES: &[&str] = &[
|
||||
PLAYGROUND_DB,
|
||||
GITIGNORE,
|
||||
".rdbms-playground.lock",
|
||||
// Undo snapshot ring (ADR-0006 Amendment 1): a temp that was
|
||||
// modified then undone back to empty can still carry this, and
|
||||
// must remain auto-deletable.
|
||||
crate::undo::SNAPSHOTS_DIR,
|
||||
];
|
||||
|
||||
/// Reasons `safely_delete_temp_project` refuses to delete a
|
||||
@@ -841,6 +847,7 @@ mod tests {
|
||||
let gi = fs::read_to_string(path.join(GITIGNORE)).unwrap();
|
||||
assert!(gi.contains("/playground.db"));
|
||||
assert!(gi.contains("/.rdbms-playground.lock"));
|
||||
assert!(gi.contains("/.snapshots/"), "undo ring should be ignored");
|
||||
assert!(!gi.contains("history.log"), "history.log should NOT be ignored");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user