docs(fermata): the failure list moves out of the READMEs into docs/known-failures.md

One list, merged from both READMEs and security-model.md "Known limits", each entry with
its test. Entries fixed on this branch are gone. Both READMEs keep the warning and point at
the page. tests/docs_known_failures.rs keeps the page and known_limits.rs in step, and
test_crate_export.py checks that the public README's links resolve in the exported tree.
This commit is contained in:
2026-11-07 09:07:19 +01:00
parent 2425fa74fc
commit 709f0cf1bc
9 changed files with 224 additions and 116 deletions
+51
View File
@@ -0,0 +1,51 @@
//! `docs/known-failures.md` and `tests/known_limits.rs` stay in step, and the list stays out
//! of the README, as a person reading it asked.
use std::collections::BTreeSet;
use std::fs;
use std::path::Path;
fn file(name: &str) -> String {
fs::read_to_string(Path::new(env!("CARGO_MANIFEST_DIR")).join(name)).unwrap()
}
/// The names of the `#[test]` functions in a test file's text.
fn tests_in(text: &str) -> BTreeSet<String> {
let lines: Vec<&str> = text.lines().collect();
let after_attribute = lines.windows(2).filter(|pair| pair[0].trim() == "#[test]");
after_attribute.filter_map(|pair| pair[1].trim().strip_prefix("fn ")?.split('(').next().map(str::to_string)).collect()
}
/// `a_snake_case_name` words in backticks.
fn named_tests(page: &str) -> BTreeSet<String> {
let is_name = |word: &&str| word.matches('_').count() >= 3 && word.chars().all(|c| c.is_ascii_lowercase() || c.is_ascii_digit() || c == '_');
page.split('`').skip(1).step_by(2).filter(is_name).map(str::to_string).collect()
}
#[test]
fn each_limit_test_is_on_the_page_and_each_test_on_the_page_exists() {
// Pins that an unclosed quote is handled: no failure to list.
let not_a_failure = "a_value_after_an_unclosed_quote_is_masked_in_every_spelling_tried";
let page = file("docs/known-failures.md");
let on_page = named_tests(&page);
let limits = tests_in(&file("tests/known_limits.rs"));
for test in limits.iter().filter(|test| *test != not_a_failure) {
assert!(on_page.contains(test), "{test} is not named in docs/known-failures.md");
}
for test in &on_page {
assert!(limits.contains(test), "docs/known-failures.md names {test}, which tests/known_limits.rs does not have");
}
}
#[test]
fn the_page_has_no_em_dash_and_the_readme_points_at_it() {
assert!(!file("docs/known-failures.md").contains('\u{2014}'));
let readme = file("README.md");
assert!(readme.contains("**Do not use this software.**"));
assert!(readme.contains("](docs/known-failures.md)"));
assert!(!readme.contains("Known to fail"));
// A failure spelled out in the README is what the page is for.
assert!(!readme.contains("cat .env; false"));
assert!(file("docs/security-model.md").contains("](known-failures.md)"));
assert!(!file("docs/security-model.md").contains("#known-limits"));
}
+32 -4
View File
@@ -1,7 +1,8 @@
//! What fermata is known to fail at, shown through the binary. Every test here asserts that
//! the failure HAPPENS: a value stays visible, or a call passes. When one of them starts to
//! fail, a limit was fixed, and the README's "Known to fail" and `docs/security-model.md`
//! must change with it. All values are fake, and each run has a home of its own.
//! fail, a limit was fixed, and `docs/known-failures.md` must change with it
//! (`tests/docs_known_failures.rs` checks that each test here is named there). All values
//! are fake, and each run has a home of its own.
//!
//! What the binary cannot show has no test: Claude Code's own routes (a failed tool's
//! output, Monitor, attachments) are claims from its documentation and bundle.
@@ -154,8 +155,8 @@ fn a_shell_quoted_value_is_not_masked_when_a_program_prints_it_decoded() {
}
}
/// README claims an unclosed quote swallows the next assignment. Each spelling here is
/// masked by the binary, so the claim is not true of it: this pins what is true.
/// Not a failure: an unclosed quote does not swallow the next assignment. Each spelling here
/// is masked by the binary, and this pins that.
#[test]
fn a_value_after_an_unclosed_quote_is_masked_in_every_spelling_tried() {
for text in [
@@ -441,6 +442,33 @@ fn a_flag_value_as_verb_and_a_glob_over_directories_pass_the_read_gate() {
}
}
/// A file run as the program is not read by this check: the verb word is no path, unless a
/// wrapper given by an absolute path comes before it.
#[test]
fn a_ruled_file_run_as_the_program_passes() {
let p = project(&[(".botignore", b".env\nvendor/\n"), (".env", b"x"), ("vendor/bin/x", b"x")]);
for command in ["./.env", ".env", "vendor/bin/x", "sudo vendor/bin/x", "time ./.env"] {
assert!(passes(&p.bash(command)), "{command}");
}
}
/// The over-denials that stay. Each errs towards stopping a command.
#[test]
fn a_harmless_command_a_rule_still_stops() {
let p = project(&[(".botignore", b".env\nvendor/\n"), (".env", b"x"), ("vendor/a", b"x"), ("a.txt", b"x")]);
for command in [
"/bin/ls .env",
"git -c core.pager=x status .env",
"git log vendor/$BRANCH",
"curl example.invalid/vendor/$ID",
"composer require vendor/*",
"tool --name=.env",
"grep --color always .env a.txt",
] {
assert!(denied(&p.bash(command)), "{command}");
}
}
/// Writing verbs are a list. A new file named to any other program is not there to check,
/// and a flag's value is one word among others.
#[test]