(7f772a7) Repair a Status field that lags its directory on mv, and bump to 0.32.6
This commit is contained in:
+34
-1
@@ -651,8 +651,41 @@ pub fn cmd_mv(
|
||||
}
|
||||
|
||||
if current_status == target_status {
|
||||
// `current_status` is read off the directory, so this comparison is the field's
|
||||
// only chance to be seen. A ticket whose file sits here and whose Status field
|
||||
// says something else is a hand-moved file or a partial restore, and refusing it
|
||||
// as a no-op left a repair nobody could reach without moving the file away and
|
||||
// back; the mirror case, where the field leads the directory after a crash in
|
||||
// move_ticket_file, is what the next real mv corrects.
|
||||
let recorded = parse_ticket_field(&resolved, "Status");
|
||||
|
||||
if recorded == target_status {
|
||||
println!(
|
||||
"Ticket is already in '{}' status.",
|
||||
color_text(target_status, Color::Orange)
|
||||
);
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
// The repair is not a move, so none of what gates one applies: not `-f`, which
|
||||
// overrides transitions, and not the dependency guards behind it. Only the field
|
||||
// is rewritten — no stamp, because the work arrived nowhere new, and no history
|
||||
// entry, because an entry shaped like a transition would record a journey the
|
||||
// ticket never took.
|
||||
let corrected = set_status_field(&resolved, target_status, &title)?;
|
||||
save_ticket(
|
||||
&worklane_dir,
|
||||
¤t_status,
|
||||
&parse_ticket_field(&resolved, "ID"),
|
||||
&title,
|
||||
None,
|
||||
&corrected,
|
||||
)?;
|
||||
|
||||
println!(
|
||||
"Ticket is already in '{}' status.",
|
||||
"Corrected Status field on '{}': said {}, but the file sits in {}.",
|
||||
color_text(&title, Color::Green),
|
||||
color_text(&recorded, Color::Orange),
|
||||
color_text(target_status, Color::Orange)
|
||||
);
|
||||
return Ok(());
|
||||
|
||||
+6
-5
@@ -489,10 +489,10 @@ mod tests {
|
||||
///
|
||||
/// The domain examples are the first thing an edit would quietly drop, since every
|
||||
/// other skill here is written around this repo, and dropping them leaves a document
|
||||
/// that teaches a household board to file `cli` tickets. The two-step repair is the
|
||||
/// second: it looks like a typo until you have watched `mv` refuse the one-step
|
||||
/// version, which is why the ticket for this skill demanded every repair be run rather
|
||||
/// than reasoned about.
|
||||
/// that teaches a household board to file `cli` tickets. The one-move correction is
|
||||
/// the second: it is the repair `mv` actually performs since it learned to fix a
|
||||
/// Status field that lags its directory, and an edit back to the old two-step recipe
|
||||
/// would be teaching a workaround for a bug that no longer exists.
|
||||
#[test]
|
||||
fn the_admin_skill_stays_domain_neutral_and_keeps_its_verified_repairs() {
|
||||
for required in [
|
||||
@@ -500,7 +500,8 @@ mod tests {
|
||||
"product strategy", //
|
||||
"worklane tags add", // the vocabulary is declared through the CLI
|
||||
"--tags` replaces the whole field", // the destructive one, restated where it bites
|
||||
"two moves, not one", // the repair `mv` cannot do in one step
|
||||
"reporting the correction instead of refusing as a no-op", // the repair `mv` does in one step
|
||||
"no stamp is written and no history entry", // because the work went nowhere
|
||||
"do not edit a ticket file",
|
||||
"File exception", // and the three places that rule does not reach
|
||||
"worklane-plan", // the boundary against the sweep document
|
||||
|
||||
Reference in New Issue
Block a user