Repository navigation
Bound nodespace logs memory and reuse cross-harness skill removal in uninstall - #3226
Conversation
|
Review Type: Initial Review — no prior reviews or comments exist on this PR ( Requirements Check: core#2963 ("
core#2964 ("
Code Review Findings: 🟡 Important:
|
mstomar125
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review: APPROVE (posted as a comment — GitHub blocks self-approval). Full findings in the review comment above.
fc0d190 to
984f6a5
Compare
Address-review summaryFollowing up on the pragmatic-code-review above (APPROVE, no Critical findings). ✅ Addressed (2):
⏭️ Skipped (2), with reasoning:
Verification after these fixes:
Re-Review DecisionDecision: NO RE-REVIEW NEEDED Rationale: Both addressed items are small, mechanical, low-risk changes that align existing code with an already-established pattern elsewhere in the same crate (matching PR remains unmerged, pending the user's decision to merge. |
…uninstall logs.rs: replace the whole-file read_to_string with a reverse-chunk tail scan (tail_matching_lines) plus a forward streaming line count (count_matching_lines), so a headless daemon's unrotated log no longer has to be loaded in full to serve --lines/--filter. Output shape (matched/shown counts, line order) is unchanged. uninstall.rs: drop the hardcoded remove_claude_skill (~/.claude/skills/nodespace only) and reuse commands::skill's cross-harness installer (resolve_installer + run_installer_subcommand) via the new report_skill_removal, so Codex/Antigravity/OpenCode/Pi skills are removed too and each agent's outcome is reported. A missing or failing installer prints an explicit warning instead of a silent partial uninstall. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
count_matching_lines used BufRead::lines(), which hard-errors the whole command on the first invalid UTF-8 byte anywhere in the log -- exactly the kind of file a long-lived, never-rotated headless log (this fix's own target case) can end up containing. Switch it to a byte-oriented read_until + from_utf8_lossy loop, matching tail_matching_lines_with_chunk's existing lossy decoding, and add a regression test covering both passes against a log with an embedded invalid byte. report_skill_removal's success line said "skill removed"; commands::skill's own uninstall() says "removed" for the identical underlying outcome. Align the wording so nodespace uninstall and nodespace skill uninstall read identically for the same result. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
83d89c1 to
7b38245
Compare
Summary
Two small, independent fixes in
packages/cli:nodespace logs(packages/cli/src/commands/logs.rs) no longer loads the whole daemon log into memory. It usedstd::fs::read_to_stringunconditionally, then filtered/tailed in memory — fine for a desktop-app install where the log is rotated, but a headless (Homebrew/systemd) install has no active log rotation, so its log can grow unbounded for the life of the service.run()now calls:tail_matching_lines— scans backward from EOF in fixed-size chunks, stopping as soon as--linesmatches are found, instead of reading the whole filecount_matching_lines— streams forward one line at a time (BufReader::lines) to report the total match countOutput shape is unchanged: same
matched/shownJSON fields, same "(N of M matching lines shown …)" message, same line ordering (oldest-first).Log rotation for headless installs itself is a separate, bigger design question (who rotates — the daemon or the OS service manager — given the log files are the daemon's inherited stdio, not something it opens itself) and is filed as a follow-up: #3225.
nodespace uninstall(packages/cli/src/commands/uninstall.rs) previously only removed~/.claude/skills/nodespacevia a hardcodedremove_claude_skill, leaving Codex/Antigravity/OpenCode/Pi skill files behind on a full uninstall. It now callsreport_skill_removal, which reusescommands::skill's existing cross-harness installer (resolve_installer+run_installer_subcommand(&installer, "uninstall")) — the same pathnodespace skill uninstallalready uses — and reports each detected agent's outcome. A missing or failing installer prints an explicit warning instead of silently leaving skill files behind.remove_claude_skillis deleted.Test plan
cargo test -p nodespace-cli— 130 tests pass, including:logs::tests(6 tests): line reconstruction across tiny/adversarial chunk boundaries, limit+filter correctness against a naive whole-file reference across multiple chunk sizes, and an end-to-end correctness check against a real ~48MB generated log fileuninstall::tests(4 tests): missing installer, failing installer, cross-harness multi-agent uninstall (via a fake installer script asserting it's invoked with theuninstallsubcommand), and the "nothing installed" casebun run test:changed— full pyramid ran (bun.lock changed), all tiers passed includingrust:test(nextest)checked_in_skill_md_is_up_to_date(part of the existing skill_md_generation suite) passed unchanged — no clap doc comments were touched, sopackages/skill/references/cli.mdneeded no regenerationCloses #2964
Part of #2963
🤖 Generated with Claude Code