summaryrefslogtreecommitdiff
path: root/core/fuzz.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-25 14:10:34 -0300
committerGabriel Schneider <[email protected]>2026-11-25 14:32:10 -0300
commit5b6552d1ddfdb966318dd1c5af5ea9d5c353a8a6 (patch)
tree1a34cedb0600f32777c45c4829ff9f4d1ed1d4fc /core/fuzz.zig
parente6c384833912598d65c509f0d3a7b713fab0a8eb (diff)
downloadpardes-5b6552d1ddfdb966318dd1c5af5ea9d5c353a8a6.tar.gz
pardes-5b6552d1ddfdb966318dd1c5af5ea9d5c353a8a6.zip
TagState.loaded: a view's tag state a dump gives is held to what its own state reads, and only that, so a damaged dump in describe-key's, Help's or a level's state is at rest instead of killing the session at its first layout, frame or key, and a session's own state loads as it is (R's optional robustness item, the pre-install diff read): describe-key found has its root, not the register's, its keys a leaf of the tree or an addon's SPC word, not found and missed at once, and with no root nothing typed or the one key struck; Help's and describe-key's keys and a struck key are cells keyName names; Help's scope is what `?` was struck under (SPC's keys to a group, no more than SPC's path holds; else none); a picker's cursor is in its own rows (All's are found again at each read); the view's SPC keys (`current`'s path for every level) are cells to a group, else the view is out of SPC too; THE CAUSE: loaded() checked describe-key only for `found` with no keys, so a dump left in its state reached `s.scope_root.?` (Band.zig:119, :172; keys.zig:598), `level[at]` on an empty level (Band.zig:182, and :216 for a level unrolled on SPC keys to nothing), bindings.keyName past its table (bindings.zig:428, from TagState.zig :653 `s.scope[0]`, :725 and :768 `s.miss`, chord and keyCells) and keys.helpBack's copy of Help's scope into SPC's 4-key path; and A2's checks ran on every state's fields whatever the state: a picker's cursor was held to Help's hit count, and describe-key's `found` (left as it was under Help and at rest) to its keys, so a session where a picker's cursor had moved with Help never run, or where describe-key had found a leaf before Help or rest, loaded at rest: the loaded core's digest was not the session's, the digest a join's client checks its load against (replica.zig `r.loaded(j.digest)`), and a Restore or an Upgrade dropped the picker; each state's fields are read only under it now, and the tree a load holds keys to is every builtin's (bindings.nodeAt and the registry's words, not bindings.level, which drops the live view's frontend's others), so every process holds every view alike; RUN (TEST FIRST): TagState.zig "a dump holding describe-key's state, or Help's, or a level's, damaged where a draw or a key indexes it, loads to rest and draws and takes keys" (14 damages through byteDump and dump.load, each drawn and given Backspace, Down, Enter, Backspace): fails on the base at TagState.zig:1496 (the state not at rest), and with that check taken out 10 of the 12 cases run panic on the base: `attempt to use null value` (found, no root), `index out of bounds: index 0, len 0` (found on `SPC z z`; Help's scope `z z` and Backspace; SPC unrolled on `z z`), `integer overflow` (a struck key 0x01 with no root; Help's scope key 0x01; a struck `miss` 0x05; SPC's key 0x01), `index out of bounds: index 95, len 95` (a struck key 0x7f under `g`), `index out of bounds: index 6, len 4` (Help's scope six keys, Backspace); the two that do not panic (found on `SPC t`, a group; on `g z`, nothing) draw another child's doc; and "a tag state a session made loads as it was, its digest the session's: ..." fails on the base at TagState.zig:1525 (`expected .pick, found .rest`); both pass now; the dump fuzz seeds describe-key's state too (core/fuzz.zig: a second join dump, SPC h k `g d` found, 2048 seeds by default, the test 38 s with it); a user could have hit the panics only through a damaged dump (a join or a restore: the user's rule, a session never dies of an input), and the digest's difference on any load of a session where a view's picker cursor had moved with Help never opened, or where describe-key had found a leaf before Help or rest; core-test 1099/1270 (171 skipped: the base's 1097 + these two), shell-test 1318/1321 (3 skipped), process-test 0 of 147 failed (3 skipped), the dump fuzz at 40,000 join seeds on each of the two dumps (Help's, describe-key's) and 1,779 image seeds clean (81,785 loads, the three pinned seeds among them); load 3 to 7
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBFhdevVu48bvL9kCE
Diffstat (limited to 'core/fuzz.zig')
-rw-r--r--core/fuzz.zig10
1 files changed, 9 insertions, 1 deletions
diff --git a/core/fuzz.zig b/core/fuzz.zig
index 091eca63..56ded66b 100644
--- a/core/fuzz.zig
+++ b/core/fuzz.zig
@@ -803,6 +803,14 @@ test "a dump and an image cut, flipped and grown: refused or loaded, never a pan
defer gpa.free(bytes);
const image = try pardes.dump.dumpBytes(p);
defer gpa.free(image);
+ // And one with describe-key's state (SPC h k, `g d` found: a root, its
+ // keys, the leaf whose level the band replays), Help's fields as Help
+ // left them.
+ p.update(.{ .key = .{ .cp = pardes.Key.escape } });
+ for (" hkgd") |c| p.update(.{ .key = .{ .cp = c, .text = &[_]u8{c} } });
+ try testing.expect(p.view().tag_state.kind == .describe and p.view().tag_state.found);
+ const described = try pardes.dump.byteDump(p);
+ defer gpa.free(described);
// Seconds a road, each core used (`use`). The image's past 1779 seeds
// reach xitdb's own reader (a slot's tag past its kinds: a `switch` on
// it), a dependency's.
@@ -816,7 +824,7 @@ test "a dump and an image cut, flipped and grown: refused or loaded, never a pan
// `live` (the core read in place, its own `live` undefined), a live
// message's `src` length 0xAAAA when the digest walked it.
try loadSeed(bytes, .join, 6356);
- for ([_][]const u8{ bytes, image }, [_]Road{ .join, .restore }, [_]u64{ 2048, 1024 }) |whole, road, n| {
+ for ([_][]const u8{ bytes, described, image }, [_]Road{ .join, .join, .restore }, [_]u64{ 2048, 2048, 1024 }) |whole, road, n| {
try loadSeed(whole, road, 0);
for (1..n + 1) |seed| try loadSeed(whole, road, seed);
}