a73x

e9cb06e5

refactor: twenty decls referenced only in their own file stop being pub

a73x   2026-09-02 09:17

Commit message
refactor: twenty decls referenced only in their own file stop being pub

tools/deadcode.sh listed them; every one is used inside its file and by
nothing outside it, so the pub was surface with no caller. The compiler
would have said so if any test elsewhere named one.

src/server/upgrade.zig
Old New
@@ -60,7 +60,7 @@ pub const QuicState = struct {
60 idle_ms: u64 = 0, 60 idle_ms: u64 = 0,
61 key: [key_len]u8 = @splat(0), 61 key: [key_len]u8 = @splat(0),
62 62
63 pub const addr_cap = 128; // sockaddr_storage 63 const addr_cap = 128; // sockaddr_storage
64 pub const key_len = 32; 64 pub const key_len = 32;
65 }; 65 };
66 66
@@ -110,7 +110,7 @@ pub const Daemon = struct {
110 counters: Counters, 110 counters: Counters,
111 }; 111 };
112 112
113 pub const CmdRec = struct { 113 const CmdRec = struct {
114 phase: u8, 114 phase: u8,
115 marks_seen: bool, 115 marks_seen: bool,
116 start_row: u32, 116 start_row: u32,
src/tui/interact.zig
Old New
@@ -928,7 +928,7 @@ fn formatPredictStats(buf: []u8, c: predict.Counters) ![]const u8 {
928 ); 928 );
929 } 929 }
930 930
931 pub const predict_stats_len = 192; 931 const predict_stats_len = 192;
932 932
933 /// The prediction counters, re-exported. A driver that has to carry them 933 /// The prediction counters, re-exported. A driver that has to carry them
934 /// across a thread boundary (wallview's wall, whose tile Cores never reach 934 /// across a thread boundary (wallview's wall, whose tile Cores never reach
@@ -1020,7 +1020,7 @@ pub const Copy = union(enum) {
1020 /// What one frame turned out to be, once the Core has done its half. The 1020 /// What one frame turned out to be, once the Core has done its half. The
1021 /// exhaustive switch over `proto.MsgType` lives in `Core.frame` and nowhere 1021 /// exhaustive switch over `proto.MsgType` lives in `Core.frame` and nowhere
1022 /// else; this is the narrow set a driver still has to act on. 1022 /// else; this is the narrow set a driver still has to act on.
1023 pub const Routed = enum { 1023 const Routed = enum {
1024 /// Done here; the driver's pass carries on. 1024 /// Done here; the driver's pass carries on.
1025 handled, 1025 handled,
1026 /// Done here, and it changed nothing — the driver's `continue`. 1026 /// Done here, and it changed nothing — the driver's `continue`.
@@ -1250,7 +1250,7 @@ pub const Core = struct {
1250 /// writes the release on the thread that moves the focus. An argument 1250 /// writes the release on the thread that moves the focus. An argument
1251 /// rather than a second method, so every call site has to say which — 1251 /// rather than a second method, so every call site has to say which —
1252 /// the wrong one is a terminal left reporting clicks. 1252 /// the wrong one is a terminal left reporting clicks.
1253 pub const Undo = enum { write, already_written }; 1253 const Undo = enum { write, already_written };
1254 1254
1255 /// Give the terminal back: the release, and every other way out. Nothing 1255 /// Give the terminal back: the release, and every other way out. Nothing
1256 /// goes on the WIRE, but plenty comes off the terminal — a wall left 1256 /// goes on the WIRE, but plenty comes off the terminal — a wall left
src/tui/predict.zig
Old New
@@ -18,7 +18,7 @@ const proto = @import("term").protocol;
18 /// outlive what it was copied from. 18 /// outlive what it was copied from.
19 pub const Cell = struct { row: u16, col: u16, ch: u8 }; 19 pub const Cell = struct { row: u16, col: u16, ch: u8 };
20 20
21 pub const Pred = struct { 21 const Pred = struct {
22 cell: Cell, 22 cell: Cell,
23 /// What the cell showed when the prediction was made. The load-bearing 23 /// What the cell showed when the prediction was made. The load-bearing
24 /// field of reconcile v2: a cell that STILL shows this is a cell the 24 /// field of reconcile v2: a cell that STILL shows this is a cell the
@@ -89,19 +89,19 @@ pub const Counters = struct {
89 /// .never — icanon && !echo: a password prompt. 89 /// .never — icanon && !echo: a password prompt.
90 /// .adaptive — !icanon: raw mode, where the application decides what a 90 /// .adaptive — !icanon: raw mode, where the application decides what a
91 /// keystroke looks like and the guess must be earned. 91 /// keystroke looks like and the guess must be earned.
92 pub const Context = enum { always, never, adaptive }; 92 const Context = enum { always, never, adaptive };
93 93
94 /// Consecutive confirmations that earn display in `.adaptive`. 94 /// Consecutive confirmations that earn display in `.adaptive`.
95 pub const promote_after: u8 = 2; 95 const promote_after: u8 = 2;
96 96
97 /// How many judging frames a prediction may go unanswered before it is given up 97 /// How many judging frames a prediction may go unanswered before it is given up
98 /// on — the phantom-glyph guard. An application that consumes a keystroke and 98 /// on — the phantom-glyph guard. An application that consumes a keystroke and
99 /// repaints some OTHER row leaves the predicted cell untouched forever. 99 /// repaints some OTHER row leaves the predicted cell untouched forever.
100 pub const expire_after_frames: u8 = 8; 100 const expire_after_frames: u8 = 8;
101 101
102 /// The same guard in wall time, for the case the frame bound cannot catch: 102 /// The same guard in wall time, for the case the frame bound cannot catch:
103 /// the application answers by going quiet. Milliseconds. 103 /// the application answers by going quiet. Milliseconds.
104 pub const expire_after_ms: i64 = 1000; 104 const expire_after_ms: i64 = 1000;
105 105
106 /// The round trip below which a prediction is never worth SHOWING. On a local 106 /// The round trip below which a prediction is never worth SHOWING. On a local
107 /// socket a confirm lands inside the frame the keystroke was painted in, so a 107 /// socket a confirm lands inside the frame the keystroke was painted in, so a
@@ -111,8 +111,8 @@ pub const expire_after_ms: i64 = 1000;
111 /// Two triggers rather than one, with the smoothed estimate moving between 111 /// Two triggers rather than one, with the smoothed estimate moving between
112 /// them, so jitter around the line does not flap the overlay per keystroke. The 112 /// them, so jitter around the line does not flap the overlay per keystroke. The
113 /// 20/30 pair is mosh's; the smoothing is TCP's 1/8. 113 /// 20/30 pair is mosh's; the smoothing is TCP's 1/8.
114 pub const local_below_ms: i64 = 20; 114 const local_below_ms: i64 = 20;
115 pub const local_above_ms: i64 = 30; 115 const local_above_ms: i64 = 30;
116 116
117 /// Engine-free mirror of the engine's cursor position. 117 /// Engine-free mirror of the engine's cursor position.
118 pub const CursorPos = struct { x: u16 = 0, y: u16 = 0 }; 118 pub const CursorPos = struct { x: u16 = 0, y: u16 = 0 };
@@ -120,7 +120,7 @@ pub const CursorPos = struct { x: u16 = 0, y: u16 = 0 };
120 /// A struct, not four positional arguments: `ch` and `prev_ch` are 120 /// A struct, not four positional arguments: `ch` and `prev_ch` are
121 /// adjacent bytes, so transposing them compiles silently and turns every 121 /// adjacent bytes, so transposing them compiles silently and turns every
122 /// prediction into a no-op or a wrong guess. 122 /// prediction into a no-op or a wrong guess.
123 pub const Keystroke = struct { 123 const Keystroke = struct {
124 cursor: CursorPos, 124 cursor: CursorPos,
125 /// The byte the user typed. 125 /// The byte the user typed.
126 ch: u8, 126 ch: u8,
src/tui/wall_picker.zig
Old New
@@ -104,7 +104,7 @@ pub fn hostState(buf: []u8, h: *Host) []const u8 {
104 } 104 }
105 105
106 /// The row's fixed left column: ` N` or ` NN`, plus the marker. 106 /// The row's fixed left column: ` N` or ` NN`, plus the marker.
107 pub fn rowHeadLen(wide: bool) usize { 107 fn rowHeadLen(wide: bool) usize {
108 return 1 + @as(usize, if (wide) 2 else 1) + 2; 108 return 1 + @as(usize, if (wide) 2 else 1) + 2;
109 } 109 }
110 110
src/tui/wall_test_harness.zig
Old New
@@ -35,7 +35,7 @@ var standing_live: usize = 0;
35 35
36 /// A wall of `live` slots over arrays a test declared, with no hosts: what 36 /// A wall of `live` slots over arrays a test declared, with no hosts: what
37 /// the layout and focus calls take, none of which grows the wall. 37 /// the layout and focus calls take, none of which grows the wall.
38 pub fn wallLive(alloc: std.mem.Allocator, tiles: []Tile, present: []bool, live: usize, shared: *Shared) wv.Wall { 38 fn wallLive(alloc: std.mem.Allocator, tiles: []Tile, present: []bool, live: usize, shared: *Shared) wv.Wall {
39 standing_live = live; 39 standing_live = live;
40 return wallOf(alloc, tiles, present, &standing_live, shared, &.{}); 40 return wallOf(alloc, tiles, present, &standing_live, shared, &.{});
41 } 41 }
src/tui/wallview.zig
Old New
@@ -223,7 +223,7 @@ pub fn closeAsk(
223 /// loop's own mirror of `prefix.picking`, cleared here so the two cannot 223 /// loop's own mirror of `prefix.picking`, cleared here so the two cannot
224 /// disagree about whose screen it is. `birth_at` is the tile a picker Enter 224 /// disagree about whose screen it is. `birth_at` is the tile a picker Enter
225 /// just made: the focus goes there, re-cutting on the way. 225 /// just made: the focus goes there, re-cutting on the way.
226 pub fn closePicker( 226 fn closePicker(
227 w: Wall, 227 w: Wall,
228 prefix: *interact.PrefixFilter, 228 prefix: *interact.PrefixFilter,
229 shown: *bool, 229 shown: *bool,
@@ -1051,7 +1051,7 @@ const Birth = struct {
1051 /// stops being a drawing and becomes a session a pump is dialling. `creates` 1051 /// stops being a drawing and becomes a session a pump is dialling. `creates`
1052 /// asks the daemon to MAKE the session (a revive); false attaches to one the 1052 /// asks the daemon to MAKE the session (a revive); false attaches to one the
1053 /// host already listed (a bind). The caller spawns the pump after. 1053 /// host already listed (a bind). The caller spawns the pump after.
1054 pub fn wakePending(t: *Tile, creates: bool) void { 1054 fn wakePending(t: *Tile, creates: bool) void {
1055 t.shared.paint_mu.lock(); 1055 t.shared.paint_mu.lock();
1056 t.pending = false; 1056 t.pending = false;
1057 if (creates) t.creates = true; 1057 if (creates) t.creates = true;
@@ -1077,7 +1077,7 @@ pub fn wakePending(t: *Tile, creates: bool) void {
1077 /// pane — a poll bind, a gone-pane Enter, an unreachable-pane Enter — is one 1077 /// pane — a poll bind, a gone-pane Enter, an unreachable-pane Enter — is one
1078 /// of these three combos, so they share one primitive and diverge only in 1078 /// of these three combos, so they share one primitive and diverge only in
1079 /// the struct. 1079 /// the struct.
1080 pub const ReviveOpts = struct { creates: bool, asked: bool }; 1080 const ReviveOpts = struct { creates: bool, asked: bool };
1081 1081
1082 /// Set the dial's start-the-daemon flag where the target can carry one. A 1082 /// Set the dial's start-the-daemon flag where the target can carry one. A
1083 /// `.sock`/`.quic`/`.via` target has no daemon to start over ssh, so the 1083 /// `.sock`/`.quic`/`.via` target has no daemon to start over ssh, so the
@@ -1099,7 +1099,7 @@ pub fn armPane(t: *Tile, opts: ReviveOpts) void {
1099 /// re-creates on a live host ({true,false}), an unreachable-pane Enter starts 1099 /// re-creates on a live host ({true,false}), an unreachable-pane Enter starts
1100 /// the daemon first and then re-creates ({true,true}). No tree edit and no 1100 /// the daemon first and then re-creates ({true,true}). No tree edit and no
1101 /// flatten: waking re-cuts nothing, which is the promise a seeded rect keeps. 1101 /// flatten: waking re-cuts nothing, which is the promise a seeded rect keeps.
1102 pub fn revivePane(t: *Tile, opts: ReviveOpts) void { 1102 fn revivePane(t: *Tile, opts: ReviveOpts) void {
1103 armPane(t, opts); 1103 armPane(t, opts);
1104 spawnPump(t); 1104 spawnPump(t);
1105 } 1105 }
@@ -1561,7 +1561,7 @@ pub fn runAttach(
1561 /// How a wall is ENTERED. One program, two doors: `mux` opens on the wall 1561 /// How a wall is ENTERED. One program, two doors: `mux` opens on the wall
1562 /// itself, `mux TARGET` opens focused on the tile it just attached to. 1562 /// itself, `mux TARGET` opens focused on the tile it just attached to.
1563 /// Everything after the first paint is the same machinery. 1563 /// Everything after the first paint is the same machinery.
1564 pub const Entry = struct { 1564 const Entry = struct {
1565 /// Start focused on tile 0 rather than on the wall. `mux [TARGET]` 1565 /// Start focused on tile 0 rather than on the wall. `mux [TARGET]`
1566 /// opens here. 1566 /// opens here.
1567 focus0: bool = false, 1567 focus0: bool = false,