Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

requirements.configuration.documentation

Requirements index · View definition

evidence Valid

Requirement

Habeas MUST document the user and project configuration locations, the common file structure and schema version, and how to create and edit the files by hand. Each configurable feature MUST document its fields, defaults, resolution rules, and credential-source references, with complete, copyable examples identifying all placeholders and the file to edit. Documentation MUST explain how to change or remove optional settings and selections.

Configuration MUST NOT require a configuration-management command or generated state beyond the documented files. Primary examples MUST use credential-source references; examples explaining explicit credential fields MUST use clearly identified placeholders, never real secrets.

Rationale

The reviewed tests cover every obligation in requirements.configuration.documentation. Documentation obligations are checked by tests that read the book’s Markdown. The “no management command or generated state” obligation is also checked by behavioural tests.

Locations, structure, schema version, and hand editing

  • tests/configuration.rs#fn[configuration_documentation_covers_locations_structure_editing_and_removal] asserts that md/reference.md contains these phrases:
    • the user file locations for XDG, HOME, and Windows APPDATA;
    • the nearest enclosing habeas.toml;
    • “Each must start with the schema version version = 1”;
    • “the top level may contain only feature tables”;
    • hand creation and editing with no management command.

Per-feature fields, defaults, and resolution rules

  • The same test asserts phrases for selection order, omitted-setting defaults, relative-path bases, and evidence allow/disallow semantics.
  • It also asserts the coverage reauthorings default and the usage and GitHub state paths.
  • tests/configuration.rs#fn[authoring_documentation_shows_each_configuration_task] checks the authoring chapter for these items:
    • backend defaults for concurrency, policy, model, and endpoint;
    • backend-specific options;
    • credential-source references, namely api_key_env and aws_profile.

Complete, copyable examples

  • tests/configuration.rs#fn[documented_configuration_examples_are_complete_valid_files] parses every ```toml block in md/reference.md, md/requirements/configuration.md, and md/requirements/authoring.md. Each block is parsed as a UserConfig or WorkspaceConfig and must begin with version = 1.
  • tests/configuration.rs#fn[documented_configuration_examples_name_the_file_to_edit] requires each example’s introducing paragraph to name the user config.toml or the workspace habeas.toml. It also re-parses the example for the file it names.
  • tests/configuration.rs#fn[documented_configuration_examples_identify_their_placeholders] requires every placeholder to be named in the surrounding prose. This covers MODEL_ID, research, us-east-1, workstation, the project path, and any all-uppercase value.
  • authoring_documentation_shows_each_configuration_task repeats the file-target and placeholder checks for the authoring chapter, including the OpenAI example.

Changing and removing optional settings and selections

  • configuration_documentation_covers_locations_structure_editing_and_removal asserts these phrases:
    • “To remove an optional setting or selection, delete its key or table”;
    • “Remove the project table or default field to remove a selection”;
    • “Delete a configuration’s table to remove it”;
    • “delete concurrency to restore the default”;
    • “Delete endpoint to return to the local default”;
    • deleting the [evidence] table.
  • authoring_documentation_shows_each_configuration_task asserts the authoring-specific edit and removal phrases.
  • The [coverage] removal sentence is not asserted verbatim. The general “delete its key or table” statement is asserted, so I do not count this as a gap.

No management command or generated state

  • The doc phrases “there is no configuration-management command” and “Habeas never creates, repairs, or rewrites them” are asserted.
  • Behavioural tests back these up. tests/authoring_cli.rs#fn[authoring_uses_nearest_workspace_configuration_without_a_user_file] runs authoring with only hand-written files. It asserts that the files are unchanged and that no user config is created.
  • tests/configuration.rs#fn[absent_and_minimal_configuration_are_distinct_and_read_only] and tests/configuration.rs#fn[workspace_discovery_uses_nearest_file_without_merging_or_rewriting_it] show that absent and minimal files are valid, and that loading never rewrites a file.

Credential examples

  • documented_configuration_examples_are_complete_valid_files asserts that literal-credential examples appear only in the authoring chapter and that there is exactly one. Every literal secret value in it must be uppercase placeholder text.
  • All other examples therefore use credential-source references. The OpenAI example is separately checked for api_key_env = "OPENAI_API_KEY".

The checks are phrase- and structure-based, which is the natural way to test documentation. I found no plausible requirement-violating documentation change that all of these tests would accept.

Inputs

Tests

Input 2: outline tests/authoring_cli.rs fn[authoring_uses_nearest_workspace_configuration_without_a_user_file]
// {test}`requirements.configuration.workspace_location`
// {test}`requirements.authoring.configuration`
// {test}`requirements.configuration.workspace_structure`
// {test}`requirements.authoring.configuration_precedence`
// {test}`requirements.authoring.credentials`
// {test}`requirements.authoring.provider`
// {test}`requirements.authoring.rig_configuration_mapping`
// {test}`requirements.authoring.invocation`
// {test}`requirements.authoring.usage_storage`
// {test}`requirements.configuration.serialization`
#[test]
// {test}`requirements.configuration.documentation`
fn authoring_uses_nearest_workspace_configuration_without_a_user_file() {
    let server = Server::start(vec![reply(vec![call(
        "submit",
        "submit_judgment",
        json!({"determination":true,"rationale":"The supplied sources support the subject."}),
    )])]);
    let fixture = Fixture::new(&server.endpoint);
    fs::remove_file(fixture.config.join("habeas/config.toml")).unwrap();
    fs::write(
        fixture.project.join("habeas.toml"),
        "version = 1\n[authoring]\ndefault = 'missing-parent-choice'\n",
    )
    .unwrap();
    let nested = fixture.project.join("src/nested");
    fs::create_dir(&nested).unwrap();
    let workspace = nested.join("habeas.toml");
    fs::write(
        &workspace,
        format!(
            "version = 1\n[authoring]\ndefault = 'workspace'\n[authoring.configs.workspace]\npolicy = 'once'\nbackend = 'ollama'\nmodel = 'workspace-model'\nendpoint = '{}'\napi_key = 'WORKSPACE_LITERAL_KEY'\n",
            server.endpoint
        ),
    )
    .unwrap();
    let configurations = [fixture.project.join("habeas.toml"), workspace.clone()];
    let before = configurations
        .iter()
        .map(|path| fs::read(path).unwrap())
        .collect::<Vec<_>>();
    let output = fixture
        .command()
        .current_dir(&nested)
        .args(["author", SUBJECT])
        .output()
        .unwrap();
    assert!(output.status.success(), "{output:?}");
    // Running the configured feature rewrites neither configuration file,
    // and creates no user configuration.
    for (path, before) in configurations.iter().zip(&before) {
        assert_eq!(&fs::read(path).unwrap(), before, "{}", path.display());
    }
    assert!(!fixture.config.join("habeas/config.toml").exists());
    let requests = server.finish();
    assert_eq!(requests.len(), 1);
    assert_eq!(requests[0].body["model"], "workspace-model");
    assert!(requests[0].headers.contains("WORKSPACE_LITERAL_KEY"));
    assert!(
        !requests[0]
            .body
            .to_string()
            .contains("WORKSPACE_LITERAL_KEY")
    );
    let usage = fixture.usage();
    assert_eq!(usage["model"], "workspace-model");
    for text in [
        usage.to_string(),
        String::from_utf8_lossy(&output.stdout).into_owned(),
        String::from_utf8_lossy(&output.stderr).into_owned(),
    ] {
        assert!(!text.contains("WORKSPACE_LITERAL_KEY"), "{text}");
    }
}
Input 3: outline tests/configuration.rs fn[absent_and_minimal_configuration_are_distinct_and_read_only]
// {test}`requirements.configuration.structure`
// {test}`requirements.configuration.loading`
// {test}`requirements.configuration.serialization`
// {test}`requirements.configuration.workspace_structure`
#[test]
// {test}`requirements.configuration.documentation`
fn absent_and_minimal_configuration_are_distinct_and_read_only() {
    let dir = tempfile::tempdir().unwrap();
    let path = dir.path().join("user.toml");
    assert!(load_user_config(&path).unwrap().is_none());
    assert!(!path.exists());
    let original = "# keep this comment\nversion = 1\n";
    fs::write(&path, original).unwrap();
    let config = load_user_config(&path).unwrap().unwrap();
    assert!(config.authoring.is_none());
    assert_eq!(fs::read_to_string(&path).unwrap(), original);
    assert_eq!(
        UserConfig::parse(&config.to_toml().unwrap(), &path).unwrap(),
        config
    );
    let book = "[book]\nsrc = 'docs'\n";
    assert!(
        ProjectConfig::from_book_toml(book, &path)
            .unwrap()
            .is_none()
    );
    assert_eq!(
        ProjectConfig::from_book_toml(&format!("{book}\n[habeas]\n"), &path).unwrap(),
        Some(ProjectConfig {})
    );
    assert!(ProjectConfig::from_book_toml("[habeas]\nversion = 1\n", &path).is_err());
    let malformed = "version = [\n";
    fs::write(&path, malformed).unwrap();
    let error = load_user_config(&path).unwrap_err().to_string();
    assert!(error.contains("invalid TOML syntax"), "{error}");
    assert!(error.contains(path.to_str().unwrap()), "{error}");
    assert_eq!(fs::read_to_string(&path).unwrap(), malformed);
}
Input 4: outline tests/configuration.rs fn[workspace_discovery_uses_nearest_file_without_merging_or_rewriting_it]
// {test}`requirements.configuration.workspace_location`
// {test}`requirements.authoring.configuration_serialization`
// {test}`requirements.authoring.configuration_structure`
// {test}`requirements.configuration.workspace_structure`
// {test}`requirements.configuration.loading`
// {test}`requirements.configuration.serialization`
#[test]
// {test}`requirements.configuration.evidence_paths`
// {test}`requirements.configuration.documentation`
fn workspace_discovery_uses_nearest_file_without_merging_or_rewriting_it() {
    let temp = tempfile::tempdir().unwrap();
    let project = temp.path().join("project");
    let nested = project.join("nested/deep");
    fs::create_dir_all(&nested).unwrap();
    let outer = temp.path().join("habeas.toml");
    fs::write(&outer, "version = 1\n[evidence]\nallow = ['outer']\n").unwrap();
    let inherited = load_workspace_config(&project).unwrap().unwrap();
    assert_eq!(inherited.path, outer);
    assert_eq!(inherited.root, temp.path().canonicalize().unwrap());
    let path = project.join("nested/habeas.toml");
    let text = "# preserved\nversion = 1\n[authoring]\ndefault = 'cloud'\n[evidence]\ndisallow = ['private']\n";
    fs::write(&path, text).unwrap();
    let closest = load_workspace_config(&nested).unwrap().unwrap();
    assert_eq!(closest.path, path);
    assert_eq!(closest.root, path.parent().unwrap());
    assert!(
        closest
            .config
            .authoring
            .as_ref()
            .unwrap()
            .configs
            .is_empty()
    );
    assert!(closest.config.evidence.as_ref().unwrap().allow.is_empty());
    assert_eq!(
        closest.config.evidence.as_ref().unwrap().disallow,
        vec![Path::new("private")]
    );
    assert_eq!(fs::read_to_string(&path).unwrap(), text);
    let serialized = closest.config.to_toml().unwrap();
    assert!(!serialized.contains("configs"));
    assert_eq!(
        WorkspaceConfig::parse(&serialized, &path).unwrap(),
        closest.config
    );

    fs::write(&path, "version = 1\n[evidence\n").unwrap();
    let error = load_workspace_config(&nested).unwrap_err().to_string();
    assert!(error.contains(path.to_str().unwrap()), "{error}");
    assert!(error.contains("invalid TOML"), "{error}");
    assert_eq!(
        fs::read_to_string(&path).unwrap(),
        "version = 1\n[evidence\n"
    );
    fs::remove_file(path).unwrap();
    fs::remove_file(outer).unwrap();
    assert!(load_workspace_config(&nested).unwrap().is_none());
}
Input 5: outline tests/configuration.rs fn[configuration_documentation_covers_locations_structure_editing_and_removal]
// {test}`requirements.configuration.documentation`
// {test}`requirements.configuration.state_location`
#[test]
fn configuration_documentation_covers_locations_structure_editing_and_removal() {
    let root = Path::new(env!("CARGO_MANIFEST_DIR"));
    let reference = fs::read_to_string(root.join("md/reference.md")).unwrap();
    // Collapse line breaks so phrases may wrap.
    let reference = reference.split_whitespace().collect::<Vec<_>>().join(" ");
    for phrase in [
        // Locations of the user and project files.
        "Create and edit `$XDG_CONFIG_HOME/habeas/config.toml`, or `$HOME/.config/habeas/config.toml`",
        "On Windows, use `%APPDATA%/habeas/config.toml`",
        "The nearest enclosing `habeas.toml` supplies workspace settings",
        // Structure and schema version.
        "Each must start with the schema version `version = 1`",
        "the top level may contain only feature tables",
        // Editing by hand, without a management command or generated state.
        "you create and edit both by hand with a text editor; there is no configuration-management command",
        "Habeas never creates, repairs, or rewrites them",
        // Resolution rules and defaults.
        "Selection order is `--config`, the user's per-project selection, workspace default, then user default",
        "omitted settings use their documented defaults",
        "Relative paths in this file use its directory as their base",
        "An allow overrides all defaults; disallow wins if both match",
        "Paths name literal files or directory subtrees, not globs",
        "An omitted `allow` or `disallow` means an empty list",
        "delete the whole `[evidence]` table to restore the default source-access rules",
        "`reauthorings` must be a positive integer; without it, the last 3 commits",
        "$XDG_STATE_HOME/habeas/authoring/usage",
        "$HOME/.local/state/habeas/authoring/usage",
        "%LOCALAPPDATA%/habeas/state/authoring/usage",
        "$XDG_STATE_HOME/habeas/github",
        "`<owner>+<repo>+<number>.json`, recording the `issue`",
        "Unix time it was `fetched` in seconds",
        // Credential-source references.
        "add `api_key_env = \"OLLAMA_API_KEY\"`",
        "aws_profile = \"research\"",
        // Changing and removing settings and selections.
        "To remove an optional setting or selection, delete its key or table",
        "Remove the project table or default field to remove a selection",
        "Delete a configuration's table to remove it",
        "delete `concurrency` to restore the default",
        "Delete `endpoint` to return to the local default",
    ] {
        assert!(
            reference.contains(phrase),
            "md/reference.md lacks {phrase:?}"
        );
    }
}
Input 6: outline tests/configuration.rs fn[documented_configuration_examples_are_complete_valid_files]
// {test}`requirements.configuration.documentation`
// {test}`requirements.authoring.configuration_documentation`
#[test]
fn documented_configuration_examples_are_complete_valid_files() {
    let root = Path::new(env!("CARGO_MANIFEST_DIR"));
    let mut checked = 0;
    let mut literal_credential_examples = 0;
    for document in [
        "md/reference.md",
        "md/requirements/configuration.md",
        "md/requirements/authoring.md",
    ] {
        let text = fs::read_to_string(root.join(document)).unwrap();
        let blocks = text.split("```toml\n").skip(1);
        for block in blocks {
            let source = block.split("\n```").next().unwrap();
            let path = Path::new(document);
            // Workspace files are the only ones with `[evidence]` or
            // `[coverage]` tables.
            let parsed = if source.contains("[evidence]") || source.contains("[coverage]") {
                WorkspaceConfig::parse(source, path).map(|_| ())
            } else {
                UserConfig::parse(source, path).map(|_| ())
            };
            parsed.unwrap_or_else(|error| panic!("{document}: {error}\n{source}"));
            assert_eq!(source.lines().next(), Some("version = 1"), "{document}");
            // Literal-credential examples in the authoring chapter use only
            // uppercase placeholders.
            let secrets: Vec<_> = source
                .lines()
                .filter(|line| {
                    [
                        "api_key =",
                        "access_key_id =",
                        "secret_access_key =",
                        "session_token =",
                    ]
                    .iter()
                    .any(|key| line.starts_with(key))
                })
                .collect();
            let literal = source.contains(".credentials]")
                || source.lines().any(|line| line.starts_with("credentials"));
            if literal || !secrets.is_empty() {
                assert_eq!(document, "md/requirements/authoring.md", "{source}");
                literal_credential_examples += 1;
            }
            for line in secrets {
                let value = line.split_once('=').unwrap().1.trim().trim_matches('"');
                assert!(
                    !value.is_empty()
                        && value
                            .chars()
                            .all(|c| c.is_ascii_uppercase() || c.is_ascii_digit() || c == '_'),
                    "{document}: {line}"
                );
            }
            checked += 1;
        }
    }
    assert_eq!(literal_credential_examples, 1);
    assert!(checked >= 14, "{checked}");
}
Input 7: outline tests/configuration.rs fn[authoring_documentation_shows_each_configuration_task]
// {test}`requirements.authoring.configuration_documentation`
// {test}`requirements.configuration.state_location`
// {test}`requirements.configuration.documentation`
#[test]
fn authoring_documentation_shows_each_configuration_task() {
    let root = Path::new(env!("CARGO_MANIFEST_DIR"));
    let section = |document: &str, start: &str, end: &str| {
        let text = fs::read_to_string(root.join(document)).unwrap();
        let (_, rest) = text.split_once(start).unwrap();
        rest.split_once(end).unwrap().0.to_owned()
    };
    let chapter = section(
        "md/requirements/authoring.md",
        ":::{req} configuration_documentation",
        "## Recording results",
    );
    let reference = section(
        "md/reference.md",
        "## Authoring evidence with a model",
        "### Assessment policy",
    );

    // Each example is a complete user or workspace file, and every placeholder
    // it uses is identified in the prose that introduces it.
    let mut pieces = chapter.split("```toml\n");
    let mut before = pieces.next().unwrap().to_owned();
    let mut blocks = Vec::new();
    for block in pieces {
        let (source, after) = block.split_once("\n```").unwrap();
        let path = Path::new("md/requirements/authoring.md");
        if source.contains("[evidence]") {
            WorkspaceConfig::parse(source, path).unwrap();
        } else {
            UserConfig::parse(source, path).unwrap();
        }
        // The prose before the example, or the paragraph right after it.
        let intro = format!(
            "{}{}",
            before.rsplit("```").next().unwrap(),
            after.trim_start().split("\n\n").next().unwrap()
        );
        let intro = intro.split_whitespace().collect::<Vec<_>>().join(" ");
        let target = if source.contains("[evidence]") || source.contains(".credentials]") {
            "`habeas.toml`"
        } else {
            "user `config.toml`"
        };
        assert!(
            intro.contains(target),
            "missing target file: {intro}\n{source}"
        );
        if source.contains("[authoring.projects.") {
            assert!(
                intro.contains("valid only in the user file, never in a workspace file"),
                "{intro}"
            );
        }
        let every_uppercase = intro.contains("replace every uppercase placeholder");
        for placeholder in ["MODEL_ID", "MODEL_TAG", "OPENAI_API_KEY_VALUE"] {
            if source.contains(placeholder) {
                assert!(
                    every_uppercase || intro.contains(&format!("`{placeholder}`")),
                    "{placeholder} is not identified:\n{intro}\n{source}"
                );
            }
        }
        if source.contains(".credentials]") {
            assert!(every_uppercase, "{intro}");
        }
        for (placeholder, instruction) in [
            ("research", "`research` with your AWS profile name"),
            ("us-east-1", "`us-east-1` with your region"),
            (
                "workstation:11434",
                "`workstation` in the URL with your server",
            ),
            (
                "/absolute/path/to/project",
                "`/absolute/path/to/project` with the canonical path to your checkout",
            ),
            (
                "generated",
                "Replace `generated` and `generated/private` with your own paths",
            ),
        ] {
            if source.contains(placeholder) {
                assert!(intro.contains(instruction), "{placeholder}: {intro}");
            }
        }
        blocks.push(source.to_owned());
        before = after.to_owned();
    }
    let any_block = |needle: &str| blocks.iter().any(|block| block.contains(needle));
    assert!(chapter.contains("Create the user file at the [shared configuration location]"));
    assert!(chapter.contains("For workspace settings, create `habeas.toml`"));
    // Each backend's example, a default, a remote Ollama server, and a
    // project selection.
    assert!(any_block("backend = \"bedrock\""));
    assert!(any_block("backend = \"ollama\""));
    let openai = blocks
        .iter()
        .find(|block| block.contains("backend = \"openai\""))
        .expect("authoring documentation must include a complete OpenAI example");
    assert!(openai.contains("api_key_env = \"OPENAI_API_KEY\""));
    assert!(any_block("[authoring]\ndefault = "));
    assert!(any_block("endpoint = \"http://workstation:11434\""));
    assert!(any_block("[authoring.projects."));
    for placeholder in [
        "`research`",
        "`us-east-1`",
        "`workstation`",
        "`/absolute/path/to/project`",
        "`OPENAI_API_KEY_VALUE`",
    ] {
        assert!(chapter.contains(placeholder), "{placeholder}");
    }
    // Invocation selection and editing or removing selections by hand.
    for phrase in [
        "Add `--config local`",
        "Edit `authoring.default` to change the user default",
        "Delete the corresponding field or\nproject table to remove a selection",
        "To remove a named configuration, delete its\ntable and update any selections naming it",
    ] {
        assert!(chapter.contains(phrase), "{phrase}");
    }
    let records = fs::read_to_string(root.join("md/requirements/authoring.md")).unwrap();
    assert!(records.contains("Each assessment MUST have a separate JSON usage record"));
    assert!(
        records.contains("identify its format version, run, project root, subject kind and full")
    );
    // Backend-specific options and credential-source references.
    for phrase in [
        "`[authoring.configs.<name>.options]`",
        "`api_key_env = \"OLLAMA_API_KEY\"`",
        "Omit `aws_profile` or `region` to use AWS SDK defaults",
        "`reasoning = ",
        "`max_output_tokens = ",
    ] {
        assert!(chapter.contains(phrase), "{phrase}");
    }
    assert!(reference.contains("[authoring.configs.cloud.options]"));
    assert!(reference.contains("`num_ctx`"));
    let chapter = chapter.split_whitespace().collect::<Vec<_>>().join(" ");
    for phrase in [
        "Bedrock and OpenAI default to the available logical CPU count; Ollama defaults to one",
        "OpenAI defaults to `policy = \"once\"`",
        "Other backends continue to default to `confirm`",
        "The default model is `gpt-6.1-sol`, with low reasoning effort and an output-token limit of 16,384",
        "OpenAI uses the Responses API at `https://api.openai.com/v1`; `endpoint` overrides that base URL",
        "You may omit `api_key_env` to use `OPENAI_API_KEY` implicitly",
        "set `OPENAI_API_KEY` to your API key outside the file",
        "Do not combine `credentials` with `aws_profile`, or `api_key` with `api_key_env`",
    ] {
        assert!(chapter.contains(phrase), "{phrase}");
    }
    let reference = fs::read_to_string(root.join("md/reference.md"))
        .unwrap()
        .split_whitespace()
        .collect::<Vec<_>>()
        .join(" ");
    for phrase in [
        "Ollama defaults to `http://localhost:11434`",
        "except `maxTokens`: without it, each Bedrock request asks for at most 16,384 output tokens",
    ] {
        assert!(reference.contains(phrase), "{phrase}");
    }
}
Input 8: outline tests/configuration.rs fn[documented_configuration_examples_name_the_file_to_edit]
// {test}`requirements.configuration.documentation`
// {test}`requirements.authoring.configuration_documentation`
#[test]
fn documented_configuration_examples_name_the_file_to_edit() {
    let root = Path::new(env!("CARGO_MANIFEST_DIR"));
    let mut checked = 0;
    for document in [
        "md/reference.md",
        "md/requirements/configuration.md",
        "md/requirements/authoring.md",
    ] {
        let text = fs::read_to_string(root.join(document)).unwrap();
        let mut pieces = text.split("```toml\n");
        let mut before = pieces.next().unwrap();
        for block in pieces {
            let (source, after) = block.split_once("\n```").unwrap();
            // The prose paragraph introducing the example, ignoring reference
            // role lines between it and the fence.
            let intro = before
                .trim_end()
                .rsplit("\n\n")
                .find(|paragraph| {
                    !paragraph
                        .lines()
                        .all(|line| line.starts_with('{') || line.trim().is_empty())
                })
                .unwrap_or_default();
            let user = intro.contains("config.toml`");
            let workspace = intro.contains("habeas.toml`");
            assert!(
                user || workspace,
                "{document}: example does not name its file:\n{intro}\n{source}"
            );
            let path = Path::new(document);
            if user {
                UserConfig::parse(source, path)
                    .unwrap_or_else(|error| panic!("{document}: user file: {error}\n{source}"));
            }
            if workspace {
                WorkspaceConfig::parse(source, path).unwrap_or_else(|error| {
                    panic!("{document}: workspace file: {error}\n{source}")
                });
            }
            checked += 1;
            before = after;
        }
    }
    assert!(checked >= 8, "{checked}");
}
Input 9: outline tests/configuration.rs fn[documented_configuration_examples_identify_their_placeholders]
// {test}`requirements.configuration.documentation`
// {test}`requirements.authoring.configuration_documentation`
#[test]
fn documented_configuration_examples_identify_their_placeholders() {
    let root = Path::new(env!("CARGO_MANIFEST_DIR"));
    // Values the examples use that a reader must replace, as they appear in
    // TOML, with the name the prose gives them.
    let named = [
        ("MODEL_ID", "MODEL_ID"),
        ("MODEL_TAG", "MODEL_TAG"),
        ("\"research\"", "research"),
        ("\"us-east-1\"", "us-east-1"),
        ("//workstation:", "workstation"),
        ("/absolute/path/to/project", "/absolute/path/to/project"),
        ("\"generated\"", "generated"),
        ("\"generated/private\"", "generated/private"),
    ];
    let mut checked = 0;
    for document in [
        "md/reference.md",
        "md/requirements/configuration.md",
        "md/requirements/authoring.md",
    ] {
        let text = fs::read_to_string(root.join(document)).unwrap();
        let mut pieces = text.split("```toml\n");
        let mut before = pieces.next().unwrap();
        for block in pieces {
            let (source, after) = block.split_once("\n```").unwrap();
            // The paragraph introducing the example and the one after it.
            let context = format!(
                "{}\n{}",
                before.trim_end().rsplit("\n\n").next().unwrap_or_default(),
                after.trim_start().split("\n\n").next().unwrap_or_default()
            );
            let every_uppercase = context.contains("replace every uppercase placeholder");
            let mut placeholders: Vec<(&str, bool)> = named
                .iter()
                .filter(|(found, _)| source.contains(found))
                .map(|(_, name)| (*name, name.chars().all(|c| !c.is_ascii_lowercase())))
                .collect();
            // Every all-uppercase string value is a placeholder.
            for line in source.lines() {
                if let Some((_, value)) = line.split_once(" = \"") {
                    let value = value.trim_end_matches('"');
                    if !value.is_empty()
                        && value
                            .chars()
                            .all(|c| c.is_ascii_uppercase() || c.is_ascii_digit() || c == '_')
                        && !placeholders.iter().any(|(name, _)| *name == value)
                    {
                        placeholders.push((value, true));
                    }
                }
            }
            for (placeholder, uppercase) in placeholders {
                assert!(
                    (uppercase && every_uppercase) || context.contains(&format!("`{placeholder}`")),
                    "{document}: {placeholder} is not identified:\n{context}\n{source}"
                );
            }
            checked += 1;
            before = after;
        }
    }
    assert!(checked >= 15, "{checked}");
}

Other sources

Input 1: requirements selection requirements.configuration.documentation
:::{req} documentation
Habeas MUST document the user and project configuration locations, the common
file structure and schema version, and how to create and edit the files by hand.
Each configurable feature MUST document its fields, defaults, resolution rules,
and credential-source references, with complete, copyable examples identifying
all placeholders and the file to edit. Documentation MUST explain how to change
or remove optional settings and selections.

Configuration MUST NOT require a configuration-management command or generated
state beyond the documented files. Primary examples MUST use credential-source
references; examples explaining explicit credential fields MUST use clearly
identified placeholders, never real secrets.
:::