(451fb83) Add a discarded status for work that will not be done, and bump to 0.31.0
The flow ended at done, so a ticket that turned out to be a duplicate or obsolete had nowhere to go: it sat in the backlog or was deleted by hand, which destroyed the record and left every relation to it dangling. Discarded is a fifth status with its own directory, keeping the invariant that the filename, the Status field and the directory agree, and keeping done meaning the work landed. Entering it is allowed from any status without -f, because discarding is not a stage of work. Discarded sits last in Status::ALL, which is what makes the rest fall out rather than needing cases: nothing follows it, so a discard clears no stamp and a ticket abandoned from reviewing keeps the journey it made, and every move out is a backward move, so un-discarding needs -f. The two dependency guards now look opposite ways. check_blockers asks what a ticket waits on and gates work moves; check_dependents asks who waits on it and gates the discard, because those plans depended on work about to be declared never-happening. Both skip targets that are themselves terminal. Status::FLOW is the four stages the board draws, so a discarded column on screen stays a136d13's ticket and done stays the last drawn column. Every tree walker keeps using Status::ALL, or a discarded ticket would be unaddressable. util::is_open replaces three spellings of "not done and not discarded", across mv, ls and the campaign standing. The board's blocked mark goes through it as well: that path was only accidentally correct, since a discarded blocker is absent from the FLOW columns, and drawing the column later would have diverged it from what mv allows. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
c03f47c52d
commit
5bf0fd1bfe
+39
-11
@@ -2013,9 +2013,11 @@ fn columns_of(worklane_dir: &Path) -> (Vec<Column>, CampaignIndex, TagIndex) {
|
||||
// `unwrap_or_default` on the campaigns index already avoids.
|
||||
let tags = TagIndex::load(worklane_dir).unwrap_or_default();
|
||||
|
||||
// Over `Status::ALL` rather than the names: each column is ordered by its own entry
|
||||
// stamp, so the build needs the status itself and not just the directory to read.
|
||||
let mut columns: Vec<Column> = Status::ALL
|
||||
// Over `Status::FLOW`, not `Status::ALL`: the board draws the stages work moves
|
||||
// through, and a discarded column on screen is a136d13's ticket, not a side effect
|
||||
// of the status existing. Each column is ordered by its own entry stamp, so the
|
||||
// build needs the status itself and not just the directory to read.
|
||||
let mut columns: Vec<Column> = Status::FLOW
|
||||
.into_iter()
|
||||
.map(|status| {
|
||||
// An absent or unreadable directory is an empty column, not a missing one:
|
||||
@@ -2245,7 +2247,7 @@ fn mark_blocked(columns: &mut [Column]) {
|
||||
for column in columns.iter_mut() {
|
||||
for card in column.cards.iter_mut() {
|
||||
card.blocked = card.ticket.blockers.iter().any(|blocker| {
|
||||
matches!(status_of.get(blocker.as_str()), Some(status) if *status != DONE)
|
||||
matches!(status_of.get(blocker.as_str()), Some(status) if is_open(status))
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -2258,8 +2260,9 @@ fn mark_blocked(columns: &mut [Column]) {
|
||||
/// left as one project's column after another's: an overview whose order depended on
|
||||
/// the argument order would bury a p1 under another project's p5.
|
||||
fn merge(per_project: &[Vec<Column>], projects: &[Project]) -> Vec<Column> {
|
||||
status_dirs()
|
||||
Status::FLOW
|
||||
.into_iter()
|
||||
.map(Status::as_str)
|
||||
.enumerate()
|
||||
.map(|(index, status)| {
|
||||
let mut cards: Vec<Card> = Vec::new();
|
||||
@@ -3999,11 +4002,15 @@ mod tests {
|
||||
assert!(shown.ends_with('┐'), "{shown}");
|
||||
}
|
||||
|
||||
/// Hiding is a prefix of the columns, which only holds while done is last. The
|
||||
/// board leans on that, so the assumption is pinned rather than assumed.
|
||||
/// Hiding is a prefix of the columns, which only holds while done is last of what
|
||||
/// the board draws. The board leans on that, so the assumption is pinned rather
|
||||
/// than assumed. Discarded being last overall is the other decided order: the stamp
|
||||
/// arrival rule truncates by `Status::ALL`, so discarded after done is what lets a
|
||||
/// discard keep the journey the ticket made.
|
||||
#[test]
|
||||
fn the_done_column_is_last() {
|
||||
assert_eq!(status_dirs().last(), Some(&DONE));
|
||||
assert_eq!(Status::FLOW.last().map(|status| status.as_str()), Some(DONE));
|
||||
assert_eq!(status_dirs().last(), Some(&DISCARDED));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -4574,8 +4581,8 @@ mod tests {
|
||||
|
||||
board.toggle_done(SCREEN);
|
||||
let row = headings(&board, 120, 20);
|
||||
for status in status_dirs() {
|
||||
assert!(row.contains(&format!("{status} (0)")), "{row}");
|
||||
for status in Status::FLOW {
|
||||
assert!(row.contains(&format!("{} (0)", status.as_str())), "{row}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6360,6 +6367,27 @@ mod tests {
|
||||
assert!(marked_blocked(&one_board(&dir), "The waiter"));
|
||||
}
|
||||
|
||||
/// A discarded blocker holds nothing up, the answer `mv` gives it: there is nothing
|
||||
/// left to wait for.
|
||||
///
|
||||
/// The board reaches it through `is_open` rather than through the blocker being
|
||||
/// absent from the columns, which is what it would be today, since `columns_of`
|
||||
/// builds `Status::FLOW` and discarded is not in it. That distinction is the point of
|
||||
/// this test: when a136d13 draws the discarded column the blocker arrives in the map,
|
||||
/// and a rule written as `!= DONE` would start marking these cards while `mv` kept
|
||||
/// letting them move. The fixture writes the directory directly for that reason.
|
||||
#[test]
|
||||
fn a_discarded_blocker_marks_nothing() {
|
||||
let dir = board_dir();
|
||||
std::fs::create_dir_all(dir.join(DISCARDED)).unwrap();
|
||||
write_ticket(&dir, DISCARDED, BLOCKER, "The blocker", "");
|
||||
write_ticket(&dir, "backlog", WAITER, "The waiter", &blocked_by(BLOCKER));
|
||||
|
||||
assert!(!marked_blocked(&one_board(&dir), "The waiter"));
|
||||
assert!(!is_open(DISCARDED), "the rule the board and mv share");
|
||||
assert!(is_open("backlog") && is_open("committed") && is_open("reviewing"));
|
||||
}
|
||||
|
||||
/// The answer `mv` gives a dangling uuid: a bookkeeping fault, not a dependency.
|
||||
#[test]
|
||||
fn a_blocker_the_board_does_not_hold_marks_nothing() {
|
||||
@@ -7985,7 +8013,7 @@ mod tests {
|
||||
.collect();
|
||||
assert_eq!(titles, vec!["In v1".to_string(), "Also in v1".to_string()], "{titles:?}");
|
||||
// Every column is kept, empty ones included: a campaign's shape is the flow.
|
||||
assert_eq!(board.current().columns.len(), status_dirs().len());
|
||||
assert_eq!(board.current().columns.len(), Status::FLOW.len());
|
||||
}
|
||||
|
||||
/// The frame says which campaign the columns belong to, and how far it has got, from
|
||||
|
||||
Reference in New Issue
Block a user