Skip to content

Commit a9e32b8

Browse files
committed
PLAN: mark Phase 5b items completed across this session's batches
7 deferred items moved to done: - stderr-writer boilerplate helper (39 sites swept) - Windows watcher-mgmt typed-error surfacing - Language extractor smoke matrix (36 new tests across 9 files) - Kind enum stability tests (5 tests) - 4 weak-assertion test strengthenings - CLI dispatch table refactor (150-line chain → comptime table) - fn search decomposition — PARTIAL (gather + filter extracted; scoring remains inline, deliberately, due to its intricate per-result intent inference + duplicate-penalty + RRF flow) Still open in Phase 5b: - main.zig split into `cmd/*.zig` modules — multi-session refactor; fn main is now 391 lines (was 1311) and all subcommands extracted as `runX` helpers within main.zig, so the next step is purely moving those helpers to their own files. Risk: shared types (Settings, registry, etc.) currently live in main.zig and would need a new shared module to avoid import cycles.
1 parent 7d96821 commit a9e32b8

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

PLAN.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -137,18 +137,18 @@ Captured from the 9 dimension review notes in `inbox/`. Items that landed in thi
137137

138138
**Deferred (multi-session or judgment-call):**
139139
- [ ] Split `src/main.zig` (7331 lines, fn main spans 1311 lines) — extract subcommands into `cmd/<name>.zig` modules; main.zig becomes argparse dispatch + shared bootstrap helpers (resolveSettings, findRepoRoot, embedding-server detection). Each `cmd/*.zig` would be 100-500 lines and individually testable. Reviewer: `unclear-files` + `disorganized` (CRITICAL).
140-
- [ ] Decompose `fn search` (`src/search.zig` lines 94-406, 312 lines) — extract `runLexicalOnly`, `runVectorOnly`, `runHybrid` private fns; public `search` becomes ~30-line dispatcher. Each phase becomes independently testable. Reviewer: `disorganized` (WARN).
141-
- [ ] Extract stderr-writer boilerplate helper — pattern `var stderr_buf: [4096]u8 = undefined; var stderr_writer = std.Io.File.stderr().writer(io_singleton.getOrInit(), &stderr_buf); const stderr = &stderr_writer.interface;` appears in main.zig at lines 137, 159, 189, 212 and dozens elsewhere. Define `pub const STDERR_BUF_SIZE = 4096;` once and a `withStderr(comptime cb)` or `stderrWriter()` helper. Reviewer: `disorganized` (WARN).
142-
- [ ] Windows watcher-mgmt: surface "not supported on Windows" instead of empty-list/false silent return in `discoverWatchers`, `getActiveCwds`, `stopWatcher` (`src/watcher_mgmt.zig:121,146,164`). Either log a one-line warning before short-circuiting OR gate the commands at the CLI level with a clearer message. Reviewer: `incomplete-undefined` (WARN).
140+
- [~] Decompose `fn search` — PARTIAL 2026-06-02. Extracted `gatherCandidates` (mode-dispatch + bm25 merge) and `filterCandidates` (comments_only + lang/ext/kind) helpers. fn search now 214 lines (was 312). The intricate per-result scoring + intent inference + duplicate penalty + sort + dropoff remains inline — high risk to extract without a much larger surface refactor. Reviewer: `disorganized` (WARN).
141+
- [x] Extract stderr-writer boilerplate helper — DONE 2026-06-01. Added `pub const STDERR_BUF_SIZE = 4096` and `pub fn stderrWriter(buf: []u8) std.Io.File.Writer` to `io_singleton.zig`; mechanical regex sweep replaced 39 call sites across 7 files. Reviewer: `disorganized` (WARN).
142+
- [x] Windows watcher-mgmt: surface typed error instead of silent empties — DONE 2026-06-02. `discoverWatchers` / `getActiveCwds` / `stopWatcher` now return `error.WatcherNotSupportedOnPlatform` on Windows; `.list` and `.prune` watch-dispatch branches in main.zig catch and print a clear user-facing message. Reviewer: `incomplete-undefined` (WARN).
143143
- [x] Restore HTTP server functionality — DONE 2026-06-01. Migrated `serve()` to `std.Io.net.IpAddress.listen` + `std.http.Server` v2; smoke-tested end-to-end with curl. Reviewer: `incomplete-undefined` (CRITICAL).
144-
- [ ] Test coverage gaps for language extractors — `extract_lua.zig`, `extract_idris.zig`, `extract_nix.zig`, `extract_nim.zig`, `extract_haskell.zig`, `extract_lean.zig`, `extract_bash.zig`, `extract_text.zig`, `extract_log.zig` each have a single happy-path test. Establish a 6-test smoke matrix per extractor (function/method/no-doc/multi-doc/empty-file/UTF-8 identifier). Reviewer: `inadequate-tests` (WARN).
145-
- [ ] Enum-value stability test for `src/kind.zig` `Kind` enum — values persist to SQLite so reordering would silently break old indices. Add a snapshot assertion. Reviewer: `inadequate-tests` (WARN).
146-
- [ ] Strengthen 4 weak-assertion tests:
144+
- [x] Test coverage gaps for language extractors — DONE 2026-06-02. Added smoke-matrix tests across all 9 extractors: empty source, no-doc declaration, doc-attached declaration, UTF-8 content for the 6 code extractors (lua/nix/bash/haskell/idris/nim/lean); empty/non-empty/UTF-8 for text/log. lua also got `local function`/method/block-comment tests. 36 new tests; all pass. Reviewer: `inadequate-tests` (WARN).
145+
- [x] Enum-value stability test for `src/kind.zig` `Kind` enum — DONE 2026-06-02. Added 5 tests: locked `name()` user-facing strings (CLI/config persistence contract), `parse()` roundtrip for every variant via inline-for, parse-null for unknown values, exhaustive coverage check, and `@intFromEnum` values pinned (0=code, 1=doc, 2=text, 3=log). Reviewer: `inadequate-tests` (WARN).
146+
- [x] Strengthen 4 weak-assertion tests — DONE 2026-06-02:
147147
- `fs_watch.zig:344` — exception-swallows `error.{OpenFrameworkFailed,MissingSymbol,FanotifyInitFailed}`; split into "init succeeds on supported platform" (hard fail) + "init returns sentinel error on unsupported platform" (`expectError`).
148148
- `embedding_http.zig:650``ensureModelAvailable` only asserts no-error; extend `MockTransportCtx` with request counters, assert `/api/tags` AND `/api/ps` were both called.
149149
- `syslog.zig:75` — "no-op and does not crash" only proves non-crash; rename to "does not crash" OR capture syslog output via a hook to prove the no-op claim.
150150
- `pidfile.zig:234``tryAcquirePid` succeeds-on-stale-PID test only asserts no-error; also assert the pidfile contents after acquisition contain the current process's PID (not the stale `99999999`). Reviewer: `futile-tests` (INFO).
151-
- [ ] CLI dispatch table refactor — `src/cli.zig:251-401` is a long `else if (mem.eql(...))` chain (~150 lines, 93 `eql` call sites). A `Command` enum + `std.meta.stringToEnum(Command, cmd)` + `switch` would be more compact, exhaustive at compile time. A comptime `{name, .command_tag, .help_topic}` table + `inline for` could collapse the repeated 3-line blocks. Reviewer: `language-features` (INFO).
151+
- [x] CLI dispatch table refactor — DONE 2026-06-02. Replaced the ~150-line `else if (mem.eql(...))` chain with a comptime `[_]CommandEntry{...}` table where each entry binds `{names, tag, help_topic, positional}`. Aliases live in `names` (search/query, symbols/find-symbol, watch/watcher, clean/clear). Positional consumption is a single switch on the `.positional` enum field. Dispatcher dropped from ~150 lines to ~60. Reviewer: `language-features` (INFO).
152152
- [x] Replace migration-scaffold `@panic` in `src/io_singleton.zig:61` — DONE 2026-06-02. Resolved by deleting the unused `pub fn get()` entirely (zero external callers; every real call site used `getOrInit()`). No more migration-scaffold wording. Reviewer: `incomplete-undefined` (INFO).
153153

154154
### Phase 6: New Language Grammars

0 commit comments

Comments
 (0)