diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-19 21:16:22 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-20 00:01:23 -0300 |
| commit | 6ca2655317e7a576dd74ab23c1bb69bba020641b (patch) | |
| tree | 669e392120658987e5b82acf7bb5a5c316e5eae5 /core/dump.zig | |
| parent | 26acd94bc20b70fe924ad76dee9c2ddaa1f4011f (diff) | |
| download | pardes-6ca2655317e7a576dd74ab23c1bb69bba020641b.tar.gz pardes-6ca2655317e7a576dd74ab23c1bb69bba020641b.zip | |
far client: a text's declarations a worker parsed are a dump's (its revision dumped and digested, the declarations parsed again from the text at the load), and a query's rows read no others, so a client joined from a dump makes a `/` query's rows as its session does: a `/` (or Symbols) in a file groups its rows under the declarations they are in once a parse of the text exists (Query.ownerDecls), the pane's `context` (sticky headers', a worker's answer, sync's) or the locations cache's (a Diff's); both were kept out of the dump as made again from the text, which a worker's answer is not (an input a client joined since never saw), so a client joined after the session's worker parsed a file found none, and its replay of the session's next row in that query asked for a parse the session never asked: `diverged: the core called search where the tape has a host` (a real session's: tty and window run parses on workers; a user with a far client who had typed a `/` in a file before it joined, then any key in that query, saw the client join again); now `File.State.context` leaves File.State's `.derived`: `ContextCache.revision` is dumped and digested, its `declarations` derived and its `allocator` local (root.zig's kept_out says why), and a load (dump.zig's loadKnowing and loadImage) parses the declarations again from the text, with the syntax allocator, where the dumped revision is the text's (`ContextCache.reload`): never loaded with the core's allocator (dump.zig's test of that, which pinned that the context was not restored at all, now pins it parsed again; a first try that dumped the declarations themselves crashed a Restore's rollback in `owned cwd restore ...`), and `ownerDecls` takes the pane's context alone (the cache's loop and the never-used `small` parse here deleted: a Diff's parse no longer groups a query's rows, the worker's does); the test `a client joined from a dump makes a `/` query's rows as the session does, though only the session has the owner's declarations from a worker's parse` (end of core/replica.zig, a host whose parses run on a worker as a tty's, their batches the session's inputs) failed on the base with that divergence and passes; Places' rail ticks: by reading `gen` moves wherever the hits do (clear, feed, shift, restart, a search's new hits, the current one), and the test `a client joined from a dump lands a click on a rail's tick as the session does, the session's ticks drawn before the places changed` (the session draws its ticks, the client changes the places and clicks every row of the rail) passes on the base; it shows a fair misprediction of the key that changed the places, 3 runs in 4: a step's places are a frame's time of search (`tape.over`), and the session's drawn caches find more in it than a cold client; gates on the seven together (the stack's top, load 18 to 50 beside them): tui core-test 855/999 (144 skipped), shell-test 1035/1038, pane-test 183/184, term-test 15/15, kitty-test 45/45, behaviour-test 275/275 and --replay 20 seeds 0 failures, process-test 3 of 144 (lspcomplete and lspcompletemoved, the base's, and headersweep-restored, which passes alone), gui unit-test 1633/1637 with the base's BaselineHarnessMismatch; replicas --clients 5 and --seeds 8: diverged 0, unequal 0, deltas wrong 0, quiet checks differed 0, unlisted stops 0, corpus 22 of 22, no leak report; the walk over every word and key passes; frame and perf gate against tree1 (farfaults): frames 77/77 byte-identical in Debug, unit-test 1633/1637, perfab corpus2x -0.087% (noise 0.092%, bar 0.4%, pictures identical), perfops 97 counts within 0.1% (largest +0.0329%)
Co-Authored-By: Claude Opus <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core/dump.zig')
| -rw-r--r-- | core/dump.zig | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/core/dump.zig b/core/dump.zig index 1616f557..3b2b22e2 100644 --- a/core/dump.zig +++ b/core/dump.zig @@ -406,6 +406,7 @@ fn loadKnowing(gpa: std.mem.Allocator, opts: Options, bytes: []const u8, notes: for (others) |o| gpa.free(o.panes); gpa.free(others); l.shared.shrinkRetainingCapacity(at); + for (p.panes) |slot| if (slot) |pane| if (pane.file) |*f| f.context.reload(p.tree_sitter_gpa, f.path, f.content, f.revision); p.readSessionFacts(); return p; } @@ -491,6 +492,7 @@ fn loadImage(gpa: std.mem.Allocator, opts: Options, bytes: []const u8, notes: ?* try views.undumpedOld(p, others, gpa); } l.made.shrinkRetainingCapacity(at); + for (p.panes) |slot| if (slot) |pane| if (pane.file) |*f| f.context.reload(p.tree_sitter_gpa, f.path, f.content, f.revision); p.readSessionFacts(); return p; } @@ -1200,7 +1202,7 @@ test "an old dump's file, a byte dump, is read by -l and by a Restore of its pat try std.testing.expectEqualSlices(u8, bytes, again); } -test "restored syntax context caches are rebuilt rather than loaded with the core allocator" { +test "restored syntax context caches are rebuilt from the text rather than loaded with the core allocator" { const gpa = std.testing.allocator; var syntax_gpa: std.heap.DebugAllocator(.{}) = .init; defer std.testing.expect(syntax_gpa.deinit() == .ok) catch @panic("syntax allocator leaked"); @@ -1237,9 +1239,13 @@ test "restored syntax context caches are rebuilt rather than loaded with the cor defer gpa.free(bytes); const q = try load(gpa, opts, bytes, null); defer q.deinit(); + // This build's: the revision kept, the declarations parsed again from + // the text, with the syntax allocator. + const want = try pardes.syntax.contextDeclarations(syntax_gpa.allocator(), f.path, f.content); + defer syntax_gpa.allocator().free(want); for (q.panes) |slot| if (slot) |restored| if (restored.file) |file| { - try std.testing.expectEqual(@as(usize, 0), file.context.declarations.len); - try std.testing.expectEqual(@as(?u32, null), file.context.revision); + try std.testing.expectEqual(f.context.revision, file.context.revision); + try std.testing.expectEqualSlices(pardes.syntax.ContextDeclaration, want, file.context.declarations); }; } |
