notes

Globbing: what the tests prove, and from where

Name: provisional, minted 2026-10-11 (UTC) by lane/fourth-ten-longest-notes.

An appendix to notes/glob-grant.md, which states the conclusion.

On the host, in milliseconds

cargo test -p grant_plan -p fs_proto proves these:

The batching is proved on the host too, by cargo test -p grant_plan -p swish -p fs_proto (milestone 109 (xargs)):

At a real prompt, both ISAs

script/swish-check runs three lines. Unbatched, the pattern is refused. Batched, its second batch is m-08.txt m-09.txt m-10.txt, which pins the resume rule from one line. An off-by-one, a batch that restarted, and a batch that took the first eight the directory yielded all print something else. And xargs caps rm shows the second batch's grant naming those three names and nothing more.

In the guest, both ISAs

glob_grant_tests is one #[test_case], because the two phases are one argument and their order is load-bearing:

  1. A real shell in a real fs_subtree_caretaker expands one pattern two ways and reports agreement, plus the three refusals that stop the agreement being vacuous.
  2. rm is the attacker. Told to remove gl-three.log through the set capability: the file exists, sits one directory entry away from the two names in the set, and the caretaker one hop up holds a capability that could remove it. ENOENT. Nothing in rm decided not to try.
  3. And the grant works: rm in namespace mode removes exactly the two names, which is what stops claim 2 being equally true of a capability that reaches nothing.

From outside the guest entirely

xtask::redoxfs_glob_grant_took_exactly_the_match is a different process, on the host, with the pinned engine, reading the image the run left behind. The two matched names are gone, the two unmatched ones are still there, and the unmatched directory still holds its file. What the guest displayed is what disappeared.

The two code paths, as examples

Moved verbatim from the parent's EXAMPLES on 2026-10-13 (UTC) under ยง212 (a prose budget).

Expand once and grant what was shown, from the shell's side:

// components/src/swish/: one expander, two callers
let shown = nav.expand(b"gl-*.txt")?;              // what `echo` prints
let e = program_table::plan(&spec, holdings(&nav), Expansion::at(0, shown))?;
assert_eq!(e.dir.unwrap().names, shown);           // and what `rm` would hold

Wire a set grant and attack it:

// system_tests/src/user/glob_grant_tests.rs
let report = fs_service::start_granted_set(
    blk_server_image(),
    program("redoxfs_server").unwrap(),
    program("fs_nameset_caretaker").unwrap(),
    program("rm").unwrap(),
    fs_service::SetGrant {
        dir: tree::GLOBSET,
        names: &[(b"gl-one.txt", false), (b"gl-two.txt", false)],
        rights: dir::REMOVE,                       // take names out, and nothing else
        role: file_system_contract::grant::spec(0, 0),         // no name: the operand is the namespace
        arg: 0,
        arg2: 0,
        stack_pages: 4,
    },
)?;