(bdddc09) Read only the underscore markers as unset, and bump to 0.18.1
`is_unknown_value` accepted `-None-` and `-Not set-` alongside the real
`_None_` and `_Not set_`. The ticket had them down as corrupted output handled
downstream instead of at the source, but the source never existed: `git log -S`
finds both spellings in exactly one commit, 2a96abd, the one that added them to
the check. They were written by analogy with the `**-Status**` field name the mv
splicing bug really did produce, c230d2c, and they have been dead since the day
the function was written.
So this is a deletion with nothing behind it. All five boards on this machine
hold no hyphenated marker in any metadata field, and the only files in this
repo that contain the spellings at all are the two tickets that describe the
bugs, in prose, which `parse_ticket_field` does not read.
A field that somehow holds one now reads as the text it is rather than passing
for unset, which is the right way round for corruption nothing can produce.
`a_hyphenated_marker_is_not_unset` pins that, because the risk here is not the
old code coming back but the analogy being drawn a second time. The
`**-Status**` repair in `is_status_line` is the opposite case and stays: that
corruption was real, and AGENTS.md now says why the two are not alike.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
4ae7ef03ff
commit
6a800fb385
+25
-1
@@ -939,9 +939,18 @@ pub const NOT_SET: &str = "_Not set_";
|
||||
/// distinction `add` already makes and clearing has to keep.
|
||||
pub const NONE: &str = "_None_";
|
||||
|
||||
/// Whether a field holds one of the two markers that mean it holds nothing.
|
||||
///
|
||||
/// The two constants and nothing else. `-None-` and `-Not set-` were accepted here from
|
||||
/// the day the function was written, by analogy with the `**-Status**` field name the
|
||||
/// `mv` splicing bug really did produce, c230d2c. But no version of this tool ever wrote
|
||||
/// a hyphenated *value*: `git log -S` finds the two spellings in exactly one commit, the
|
||||
/// one that added them to this line. They were dead from birth, and a ticket that somehow
|
||||
/// holds one now reads as the text it is rather than being quietly taken for unset, which
|
||||
/// is the right way round for corruption nobody can produce.
|
||||
pub fn is_unknown_value(value: &str) -> bool {
|
||||
let trimmed = value.trim();
|
||||
trimmed == NONE || trimmed == NOT_SET || trimmed == "-None-" || trimmed == "-Not set-"
|
||||
trimmed == NONE || trimmed == NOT_SET
|
||||
}
|
||||
|
||||
/// Replace `**bold**` with colour, or leave the line exactly as it is.
|
||||
@@ -2764,6 +2773,21 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
/// The hyphenated spellings are values like any other, and this is what says so.
|
||||
///
|
||||
/// They were accepted as unset for months without any version of the tool ever
|
||||
/// writing one, so the risk this pins is somebody re-adding them by analogy with the
|
||||
/// `**-Status**` repair in `is_status_line`, which guards a corruption that was real.
|
||||
#[test]
|
||||
fn a_hyphenated_marker_is_not_unset() {
|
||||
for legacy in ["-None-", "-Not set-", "-Nothing-"] {
|
||||
assert!(
|
||||
!is_unknown_value(legacy),
|
||||
"{legacy} is read as unset, so a corrupted field would pass for an empty one"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
fn ticket_with_priority(raw: &str) -> String {
|
||||
format!("# T\n\n## Metadata\n\n- **Priority**: {}\n", raw)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user