feat(fermata): a Write or Edit that adds a mask is stopped; masked output says so
count_masks counts runs of exactly five stars, or <REDACTED: marks under typed and named; absent counts 0. write_pairs gives each change's text before and after. The guard denies when a change holds more marks than what it replaces, and a Write's "before" is the file on disk, read only if the new text holds a mark. Both projects of a path call decide. on_mask_write = "allow" turns it off. The refusal says "ask the user", names the setting and quotes nothing. Each PostToolUse that masked adds a note beside the output. cli_hook_fail_closed: a masked Write's only note is now the masks note, asserted exactly, in place of "no note".
This commit is contained in:
@@ -278,11 +278,12 @@ fn a_typo_in_botsecrets_keeps_the_other_layers_and_the_default_list() {
|
||||
assert!(!note.contains("polcy"), "{tool}: {note}");
|
||||
}
|
||||
|
||||
// A Write costs the session no line for it, masked or not.
|
||||
// A Write costs the session no line for it, masked or not: a masked one says only
|
||||
// that it was masked.
|
||||
assert_eq!(tool_output(&p, "Write", "clean"), json!({}));
|
||||
let out = tool_output(&p, "Write", VALUE);
|
||||
assert!(!out.to_string().contains(VALUE), "{out}");
|
||||
assert!(out["hookSpecificOutput"].get("additionalContext").is_none(), "{out}");
|
||||
assert_eq!(out["hookSpecificOutput"]["additionalContext"], "[fermata] Values in this output are masked. Do not write them back into a file.", "{out}");
|
||||
}
|
||||
|
||||
/// A broken user-global layer: the project's own rules stand.
|
||||
|
||||
Reference in New Issue
Block a user