summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-26 03:03:28 -0300
committerGabriel Schneider <[email protected]>2026-11-26 03:49:30 -0300
commit89f51118eb241fdb5673e91eb09e5abe5c6a0bcb (patch)
treec4fdb85b72690567fbe9875f7033c42f602321b7 /test
parent280306ed779368d7e20e9678eca45e4b81e0ccbf (diff)
downloadpardes-89f51118eb241fdb5673e91eb09e5abe5c6a0bcb.tar.gz
pardes-89f51118eb241fdb5673e91eb09e5abe5c6a0bcb.zip
Pick, Query, Stream: Find and Grep search the work tree, the nearest directory at or above the asking pane's that holds a `.jj` or a `.git`, or the pane's directory outside one, and a leading directory narrows a Grep (the comparison video's finding, VIDEO2/STORY.md §3.1 and §9: from src/torque in V8 `SPC f f` listed its 67 files where Helix, LazyVim and Doom list 18,441, and `SPC f g` found 11 hits in src/torque alone; SPEC §5.1's "scoped to a directory if the query starts with one" found nothing; the coordinator's W8, the user asked, the default yes); THE CAUSE: Pick.open set every source's directory to the asking pane's (Pardes.paneDir), and Pick.filter sent a Grep's whole query to the disk engine as its pattern; THE FIX: Pick.workTree (Find and Grep only: Recent, Panes and Symbols as they were), a stat of `.jj` and `.git` per directory up from the pane's through the tape's kind site, once per picker opened; the rows' paths are from the root (Find's `src/torque/torque-parser.cc`), so Names' subsequence match over the whole path makes `torque/pars` narrow Find with no more code; Pick.grepScope: a query whose first word, then a blank, is a directory under the root (or absolute) searches that directory for the rest (`src/torque "UpperCamelCase"`); its rows' paths stay from the root (Query.take's `under`, the narrowed directory before each path; the query pane passes none), and the preview lights the pattern alone; no directory added to the head (the coordinator's rule: none was shown); RUN (TEST FIRST): Pick.zig "Find and Grep search the work tree (W8) ..." makes a tree with `.git` at its root and opens Find from src/deep/x.txt: its directory the root (on W7's tree src/deep), three rows, `sub/name` one, `sub/name.txt`; Grep `needle` two hits, `sub needle` one, `sub/name.txt:1 needle one`, its place the root's sub/name.txt; from `/held.txt` (no repository above /) the directory `/`; the tests whose Find or Grep pickers list a temporary directory make it a work tree of its own (Pick.testFile, and four tests in behaviour/addons.zig, addons_pdf.zig and other_files.zig): under the repository's .zig-cache it is in the pardes tree; MEASURED on a reflink copy of VIDEO2's V8 (18,441 files) with this change's Debug gui at 26 px, from src/torque/torque.cc, after the last key (V4's probe in brackets, the installed build): SPC f f 18,414 rows, the first at 0.10-0.11 s and all at 0.14-0.16 s [0.02 s, 67 files: src/torque alone]; `torque/pars` 7 rows at 0.09 s, torque-parser.cc among them [0 rows]; Grep `"UpperCamelCase"` 11 hits from the root at 0.26 s, its typing pause included [0.11 s, 11 hits, src/torque alone]; `src/torque "UpperCamelCase"` the same 11 at 0.15 s [nothing]; this harness on the installed build: 67 files at 0.05 s, the grep 0.11-0.13 s; keys typed through the frontend (the S kit's pty): a key written to 9P's kbdin runs the listing and the search on the loop for its write's answer (Pick.start and filter's `p.fs.serving` step), so a script's `SPC f g` over V8 holds the session for seconds (seen: the 9P client timed out), as before this change over a smaller directory; the find golden (test/snapshots/find.golden) re-recorded: from sub/ZQMARK-beta.txt `SPC f f` lists the root's five files, a band row more; replica.zig's may_wait lists `Find *` and `Grep *` stopping at `kind` (the root asked of the session's disk, as their listing and search are); gates: core-test 1129/1302 (173 skipped: +1), shell-test 1350/1353 (3 skipped: +1), pane-test 183/184, behaviour-test 285/285 and --replay 285/285, process-test 0 of 147 failed (3 skipped; find re-recorded), term-test 17/17, kitty-test 45/45, the gui unit-test 1958/1962 (4 skipped; its perf check's BaselineHarnessMismatch, every base's) on this change, W7 under it; no dump change; shots .scratch/walkui/W78/png v1-v3; no frame or perf gate (the user's rule of 2026-11-26); load 3.7 to 15.9
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBFhdevVu48bvL9kCE
Diffstat (limited to 'test')
-rw-r--r--test/behaviour/addons.zig8
-rw-r--r--test/behaviour/addons_pdf.zig2
-rw-r--r--test/behaviour/other_files.zig2
-rw-r--r--test/snapshots/find.golden3
4 files changed, 15 insertions, 0 deletions
diff --git a/test/behaviour/addons.zig b/test/behaviour/addons.zig
index 25b1e523..90f4e383 100644
--- a/test/behaviour/addons.zig
+++ b/test/behaviour/addons.zig
@@ -381,6 +381,8 @@ fn dirOf(s: *Session, tmp: *std.testing.TmpDir) ![]const u8 {
test "addons: a picker shows a file of an addon's kind through its kind in the pane it lands in, Esc puts that pane back as it was, and Enter lands as a Look does" {
var tmp = std.testing.tmpDir(.{});
defer tmp.cleanup();
+ // A work tree of its own: Find searches it, not the one the test runs in.
+ try tmp.dir.createDir(std.testing.io, ".git", .default_dir);
try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "notes.txt", .data = "the notes\n" });
try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "seven.fake", .data = "1234567" });
var s = try Session.initFile(std.testing.allocator, "x\n");
@@ -421,6 +423,8 @@ test "addons: a picker shows a file of an addon's kind through its kind in the p
test "addons: a picker's row of a file no kind takes and not text shows one line naming it, and the row before's file never stays in the body" {
var tmp = std.testing.tmpDir(.{});
defer tmp.cleanup();
+ // A work tree of its own: Find searches it, not the one the test runs in.
+ try tmp.dir.createDir(std.testing.io, ".git", .default_dir);
try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "notes.txt", .data = "the notes\n" });
try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "other.txt", .data = "other text\n" });
try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "seven.fake", .data = "1234567" });
@@ -462,6 +466,8 @@ test "addons: a picker's row of a file no kind takes and not text shows one line
test "addons: moving the cursor over pictures in a picker draws only the one it rests on, and a draw of one passed by is dropped whenever it comes back" {
var tmp = std.testing.tmpDir(.{});
defer tmp.cleanup();
+ // A work tree of its own: Find searches it, not the one the test runs in.
+ try tmp.dir.createDir(std.testing.io, ".git", .default_dir);
const png = "\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x01\x00\x00\x00\x01\x08\x02\x00\x00\x00\x90wS\xde\x00\x00\x00\x0cIDATx\x9cc\xf8\xcf\xc0\x00\x00\x03\x01\x01\x00\xc9\xfe\x92\xef\x00\x00\x00\x00IEND\xaeB`\x82";
try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "notes.txt", .data = "the notes\n" });
try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "pic1.png", .data = png });
@@ -499,6 +505,8 @@ test "addons: moving the cursor over pictures in a picker draws only the one it
test "addons: Enter on a picture in a picker opens its kind's pane, never its bytes as text in the reading pane (the user's report)" {
var tmp = std.testing.tmpDir(.{});
defer tmp.cleanup();
+ // A work tree of its own: Find searches it, not the one the test runs in.
+ try tmp.dir.createDir(std.testing.io, ".git", .default_dir);
try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "notes.txt", .data = "the notes\n" });
try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "pic.ppm", .data = "P6\n2 1\n255\n\x0d\x4d\xe7\x0d\x4d\xe7" });
var s = try Session.initFile(std.testing.allocator, "x\n");
diff --git a/test/behaviour/addons_pdf.zig b/test/behaviour/addons_pdf.zig
index d773f4e2..eca39012 100644
--- a/test/behaviour/addons_pdf.zig
+++ b/test/behaviour/addons_pdf.zig
@@ -307,6 +307,8 @@ test "addons: a PDF under a picker's cursor shows through the pdf addon in the p
try s.loadPdf();
var tmp = std.testing.tmpDir(.{});
defer tmp.cleanup();
+ // A work tree of its own: Find searches it, not the one the test runs in.
+ try tmp.dir.createDir(std.testing.io, ".git", .default_dir);
const pdf = try std.Io.Dir.cwd().readFileAlloc(std.testing.io, "docs/design.pdf", s.arena.allocator(), .limited(4 << 20));
try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "paper.pdf", .data = pdf });
try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "notes.txt", .data = "the notes\n" });
diff --git a/test/behaviour/other_files.zig b/test/behaviour/other_files.zig
index e6c104c3..8a9016bc 100644
--- a/test/behaviour/other_files.zig
+++ b/test/behaviour/other_files.zig
@@ -25,6 +25,8 @@ test "other-files: kbdin types at the pane with the keyboard and mousein clicks,
test "other-files: kbdin's keys are the user's: SPC f f opens Find's picker in the pane's tag where jumps walk, not the +Search a script's Find opens" {
var tmp = std.testing.tmpDir(.{});
defer tmp.cleanup();
+ // A work tree of its own: Find searches it, not the one the test runs in.
+ try tmp.dir.createDir(std.testing.io, ".git", .default_dir);
try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "a.txt", .data = "a\n" });
try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "b.txt", .data = "b\n" });
var s = try Session.initFile(std.testing.allocator, "x\n");
diff --git a/test/snapshots/find.golden b/test/snapshots/find.golden
index 34333048..905c35e8 100644
--- a/test/snapshots/find.golden
+++ b/test/snapshots/find.golden
@@ -80,6 +80,7 @@
|5: │ │
|6: │ │
|7: │ │
+|8: │ │
|40: ⏎ lands here · its text is the preview · S-⏎ a new pane 1 message · SPC h m
== snap cancel grid=120x41 cursor=7,3
|2: here.txt:1 › Find zqm 2/3 › /tmp/pardes-snap/find/cwd/sub/ZQMARK-beta.txt Keep Save Term Collapse Follow Del
@@ -88,6 +89,7 @@
|5:
|6:
|7:
+|8:
|40: ✓ /tmp/pardes-snap/find/cwd/sub/ZQMARK-beta.txt Find 1 message · SPC h m
== snap topbar grid=120x41 cursor=29,2
|2: ^ Find zqm 2/3 › ␣ f Find bod 0
@@ -96,4 +98,5 @@
|5: │ │
|6: │ │
|7: │ │
+|8: │ │
|40: ⏎ lands here · its text is the preview · S-⏎ a new pane 1 message · SPC h m