(d4ce964) Record status, owner and tag changes in a history log, and bump to 0.29.0
The comments directory was already an append-only log with one event kind. It is now .worklane/history/<uuid>/, with the kind in the entry and in the filename after the stamp, so a ticket says how it got where it is and not only what was said about it. mv, chown and set --tags each write an entry after their own save and behind their own no-change return, so a refused or no-op edit records nothing. --actor is on all four writers now. An old comments directory is adopted on first access and a file with no marker reads as the comment it is, so nothing is migrated or rewritten. The log moves to src/history.rs, out of util.rs and handlers.rs, and the card's counter counts comments only: a ticket that has moved three times has not been talked about. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
a1bdb5df49
commit
f454d212a4
+20
-20
@@ -43,7 +43,7 @@ fn create_ticket(worklane_dir: &Path, status: &str, title: &str) -> String {
|
||||
|
||||
/// The one comment on a ticket, which every author test writes exactly one of.
|
||||
fn only_comment(worklane_dir: &Path, uuid: &str) -> String {
|
||||
let files: Vec<_> = fs::read_dir(worklane_dir.join("comments").join(uuid))
|
||||
let files: Vec<_> = fs::read_dir(worklane_dir.join("history").join(uuid))
|
||||
.unwrap()
|
||||
.filter_map(|e| e.ok())
|
||||
.collect();
|
||||
@@ -73,9 +73,9 @@ fn comment_creates_file_with_valid_ticket_uuid() {
|
||||
.assert()
|
||||
.success();
|
||||
|
||||
let comments_dir = worklane.join("comments").join(&uuid);
|
||||
assert!(comments_dir.exists());
|
||||
let files: Vec<_> = fs::read_dir(&comments_dir)
|
||||
let history_dir = worklane.join("history").join(&uuid);
|
||||
assert!(history_dir.exists());
|
||||
let files: Vec<_> = fs::read_dir(&history_dir)
|
||||
.unwrap()
|
||||
.filter_map(|e| e.ok())
|
||||
.collect();
|
||||
@@ -125,8 +125,8 @@ fn comment_includes_git_user_and_body() {
|
||||
.assert()
|
||||
.success();
|
||||
|
||||
let comments_dir = worklane.join("comments").join(&uuid);
|
||||
let files: Vec<_> = fs::read_dir(&comments_dir)
|
||||
let history_dir = worklane.join("history").join(&uuid);
|
||||
let files: Vec<_> = fs::read_dir(&history_dir)
|
||||
.unwrap()
|
||||
.filter_map(|e| e.ok())
|
||||
.collect();
|
||||
@@ -149,8 +149,8 @@ fn comment_stored_in_timestamped_file() {
|
||||
.assert()
|
||||
.success();
|
||||
|
||||
let comments_dir = worklane.join("comments").join(&uuid);
|
||||
let files: Vec<_> = fs::read_dir(&comments_dir)
|
||||
let history_dir = worklane.join("history").join(&uuid);
|
||||
let files: Vec<_> = fs::read_dir(&history_dir)
|
||||
.unwrap()
|
||||
.filter_map(|e| e.ok())
|
||||
.collect();
|
||||
@@ -160,14 +160,14 @@ fn comment_stored_in_timestamped_file() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn comment_creates_comments_directory() {
|
||||
fn comment_creates_the_history_directory() {
|
||||
let temp = TempDir::new().unwrap();
|
||||
let worklane = setup_worklane(&temp);
|
||||
|
||||
let uuid = create_ticket(&worklane, "reviewing", "Dir Test");
|
||||
|
||||
let comments_dir = worklane.join("comments").join(&uuid);
|
||||
assert!(!comments_dir.exists());
|
||||
let history_dir = worklane.join("history").join(&uuid);
|
||||
assert!(!history_dir.exists());
|
||||
|
||||
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
|
||||
cmd.current_dir(temp.path())
|
||||
@@ -176,7 +176,7 @@ fn comment_creates_comments_directory() {
|
||||
.assert()
|
||||
.success();
|
||||
|
||||
assert!(comments_dir.exists());
|
||||
assert!(history_dir.exists());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -218,7 +218,7 @@ fn the_owner_flag_is_gone() {
|
||||
}
|
||||
|
||||
assert!(
|
||||
!worklane.join("comments").join(&uuid).exists(),
|
||||
!worklane.join("history").join(&uuid).exists(),
|
||||
"a comment was written despite the usage error"
|
||||
);
|
||||
}
|
||||
@@ -320,8 +320,8 @@ fn comment_falls_back_to_git_user_when_actor_omitted() {
|
||||
.assert()
|
||||
.success();
|
||||
|
||||
let comments_dir = worklane.join("comments").join(&uuid);
|
||||
let files: Vec<_> = fs::read_dir(&comments_dir)
|
||||
let history_dir = worklane.join("history").join(&uuid);
|
||||
let files: Vec<_> = fs::read_dir(&history_dir)
|
||||
.unwrap()
|
||||
.filter_map(|e| e.ok())
|
||||
.collect();
|
||||
@@ -348,8 +348,8 @@ fn comments_added_back_to_back_are_both_kept() {
|
||||
.success();
|
||||
}
|
||||
|
||||
let comments_dir = worklane.join("comments").join(&uuid);
|
||||
let files: Vec<_> = fs::read_dir(&comments_dir)
|
||||
let history_dir = worklane.join("history").join(&uuid);
|
||||
let files: Vec<_> = fs::read_dir(&history_dir)
|
||||
.unwrap()
|
||||
.filter_map(|e| e.ok())
|
||||
.collect();
|
||||
@@ -383,7 +383,7 @@ fn comment_accepts_a_body_that_begins_with_a_hyphen() {
|
||||
.success();
|
||||
}
|
||||
|
||||
let bodies: String = fs::read_dir(worklane.join("comments").join(&uuid))
|
||||
let bodies: String = fs::read_dir(worklane.join("history").join(&uuid))
|
||||
.unwrap()
|
||||
.filter_map(|e| e.ok())
|
||||
.map(|e| fs::read_to_string(e.path()).unwrap())
|
||||
@@ -438,7 +438,7 @@ fn a_bare_double_hyphen_body_needs_a_separator() {
|
||||
let stderr = String::from_utf8(assert.get_output().stderr.clone()).unwrap();
|
||||
assert!(stderr.contains("<BODY>"), "unclear error: {stderr}");
|
||||
assert!(
|
||||
!worklane.join("comments").join(&uuid).exists(),
|
||||
!worklane.join("history").join(&uuid).exists(),
|
||||
"a comment was written despite the error"
|
||||
);
|
||||
|
||||
@@ -448,7 +448,7 @@ fn a_bare_double_hyphen_body_needs_a_separator() {
|
||||
.assert()
|
||||
.success();
|
||||
|
||||
let stored: String = fs::read_dir(worklane.join("comments").join(&uuid))
|
||||
let stored: String = fs::read_dir(worklane.join("history").join(&uuid))
|
||||
.unwrap()
|
||||
.filter_map(|e| e.ok())
|
||||
.map(|e| fs::read_to_string(e.path()).unwrap())
|
||||
|
||||
Reference in New Issue
Block a user