forge
Explore
Log in

Don't you dare go Hollow

The window guard's walk skipped no dot-directory, so a scratch clone spoke for the tree

Browse files at this commit

308fc77328d755b15c5dce5bb69c265888e017b9Ahmet Kaan GümüşParent: 2c809fd
  • fix
    • the window guard's walk skipped no dot-directory, so a scratch clone spoke for the tree
Show full message
🐛 fix(test): the window guard's walk skipped no dot-directory, so a scratch clone spoke for the tree

`every_window_write_outside_set_window_is_named` walks the workspace root and
skipped only `target`, `.git` and `vendor`. This root also holds `.delta/` -- a
gitignored scratch area of clones and worktrees left by delta/A-B tooling -- and
the walk descended into it, so the guard was RED on main for ten window writes
inside a checkout nobody edits, with every reported path under
`.delta/worktrees/rfykqt93k1f7/`.

The noise was the smaller half. The same stale clone was also being counted
toward the coverage floor, so a foreign tree was propping up the assertion that
exists to prove the walk reaches real source -- the guard could read a file or
two of ours and still pass on the strength of a stranger's lines.

Skipping every dot-directory rather than naming `.delta`: a dot-dir is by
convention not part of the tree we make claims about, and the next scratch dir a
tool drops here is then skipped by the same rule.

Red before, green after, with `.delta` still on disk. Non-vacuity checked both
ways: a real `s.out_us` write injected into `crates/engine/src/sweep.rs` turns
the guard red on that path, and the file was restored byte-identically
(sha256 36d00f17d595dedfaa0d087ab924e7117698e0527d48ac22fdd904cfffc1af91). The
walk still reaches `crates/app` and now reads 86 files / 79,129 lines, which is
what the floor's own comment already claimed.
crates/engine/src/project.rsmodified+21 -4
@@ -11158,7 +11158,8 @@ mod tests {
1115811158 /// are cut. A test cannot produce a file a user loses, so the line is
1115911159 /// drawn there deliberately, not by omission.
1116011160 /// 4. **A file the walk does not reach**: a path outside `crates/`, or one
11161- /// under a directory named `target`, `.git` or `vendor`.
11161+ /// under a directory named `target`, `.git`, `vendor`, or any
11162+ /// dot-directory (`.delta/` holds scratch clones of other checkouts).
1116211163 ///
1116311164 /// What the matcher DOES now cover, after four rounds of it not doing so:
1116411165 /// every assignment operator; struct-literal fields and the shorthand form,
@@ -11370,9 +11371,25 @@ mod tests {
1137011371 let path = entry.path();
1137111372 if path.is_dir() {
1137211373 // `target` is not source and `vendor` is not ours to rule on.
11373- let skip = path
11374- .file_name()
11375- .is_some_and(|n| n == "target" || n == ".git" || n == "vendor");
11374+ //
11375+ // Every DOT-directory, for the same reason and one more: a
11376+ // dot-dir is by convention not part of the tree we are
11377+ // making claims about. This workspace root holds `.delta/`,
11378+ // a scratch area of clones and worktrees left by delta/A-B
11379+ // tooling, and the walk used to descend into it and report
11380+ // the ten window writes inside a checkout that is not this
11381+ // one -- so the guard was RED here for a file nobody edits,
11382+ // and, worse, VACUOUS about its own tree: the same stale
11383+ // clone that produced the noise could have hidden a real
11384+ // offender behind it, and the floor below was being met in
11385+ // part by lines this guard has no business reading. Skipping
11386+ // the whole class rather than naming `.delta` is the point:
11387+ // the next scratch dir a tool drops here is skipped too.
11388+ let name = path.file_name().unwrap_or_default().to_string_lossy();
11389+ let skip = name == "target"
11390+ || name == ".git"
11391+ || name == "vendor"
11392+ || name.starts_with('.');
1137611393 if !skip {
1137711394 stack.push(path);
1137811395 }