Repository navigation
logs: flag fallback log files, add LaunchAgent log candidate - #3862
Merged
Merged
Conversation
mstomar125
commented
Oct 20, 2026
mstomar125
left a comment
Contributor
Author
There was a problem hiding this comment.
Verdict: REQUEST CHANGES
Independent review of #3862 (Closes #3832). I ran cargo test -p nodespace-cli --lib commands::logs. All pass in UTC, but one test fails in a negative-offset timezone (finding 1).
Findings
- (BLOCKING)
logs.rs:407(fallback_notice_names_path_mtime_and_foreign_install): the test is timezone-dependent.fallback_noticeformats inchrono::Local, and the test usesUNIX_EPOCH + 365 daysand assertscontains("1971"). That instant is 1971-01-01 00:00 UTC, so in any zone west of UTC it renders as 1970-12-31. I reproduced it:TZ=America/New_York cargo test -p nodespace-cli --lib commands::logsfails withassertion failed: n.contains("1971"). CI is UTC, so it will be green there while failing on US developer Macs (a flaky-by-machine gate). Fix: pick an instant mid-year, such as epoch + 86_400365 + 630*86_400, and assert on"1971", or format the expected string with the sameLocalconversion, or assert only that aYYYY-MM-DD HH:MM:SSpattern is present. - (non-blocking, but please decide before merge)
logs.rs:97-106,logs.rs:121-145: the author's question. For a.pkginstall the LaunchAgent log is exactly the daemon's log (scripts/pkg-resources/app.nodespace.daemon.plist:41-45sets StandardOut/ErrorPath to~/Library/Logs/com.nodespace/nodespaced.log). The issue's AC says the Library log is "a last candidate", and it puts the note on the Homebrew fallback. Todayfallback_noticetreats anything but~/.nodespace/logsas a fallback, so a.pkguser is told their own daemon's log "may belong to another install, not the running daemon". That is misleading and trains users to ignore the note. Suggest a separate wording for the LaunchAgent path, for example "using the LaunchAgent log ... (last modified ...)", with the "another install" warning kept for the Homebrew prefixes only, or no note at all for it. Also consider that on a.pkginstall a stale~/.nodespace/logs/nodespaced.logfrom a former app run would win with no note, even though the LaunchAgent log is the live one. Out of scope here, but worth a follow-up issue. - (non-blocking)
logs.rs:338-341vslogs.rs:315-327:noticeis added only to the main--jsonobject. The--path-only --jsonoutput has nonoticekey (the stderr note is still printed). Be consistent: add"notice"there too, or document that it is absent. Adding the key is additive and safe forjq-style consumers that read named fields (.path,.lines). A consumer that deserializes withdeny_unknown_fieldswould break, but none exists in the repo.nullis emitted when there is no fallback, which is the right stable-shape choice. Stderr for the human note is also the right channel, since stdout stays clean for$(nodespace logs --path-only). - (non-blocking) Ordering is correct for each install type. NODESPACE_HOME gives the redirected home as the only candidate and no note (primary equals chosen). Dev and dmg use
~/.nodespace/logsfirst. Homebrew falls back to/opt/homebrewthen/usr/local..pkgreaches the LaunchAgent log last. The "no candidate exists" message already lists paths, and it will now include the Library path. AC met. - (non-blocking nit)
logs.rs:73-76: the home for~/Library/Logsis derived asstate_dir.parent(). That is only right because the redirected case returns earlier. A directdirs::home_dir()(or the daemon crate's home helper) would be more robust than coupling to the state-dir layout. - (non-blocking nit) mtime format
%Y-%m-%d %H:%M:%S %zin local time with a numeric offset is unambiguous. Fine. - (non-blocking, test strength) Mutations: flipping
primary == Some(chosen)or changing the Library candidate order is killed by the two new tests. The wiring inrun(eprintln,noticein JSON, path-only) and themodified: Nonebranch ("unknown") have no test. The integration tests inpackages/cli/tests/it/home_isolation.rsare a good place for one--jsonassertion thatnoticeis null for the primary log.
Once finding 1 is fixed (and 2 is decided), I would approve.
… as last candidate fallback_notice reports the chosen path, its last-modified time and that it may belong to another install, on stderr (and as "notice" in --json output). candidate_paths_for appends ~/Library/Logs/com.nodespace/nodespaced.log, the path the pkg LaunchAgent plist names, after the Homebrew locations. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…pkg install's log, carry notice in --path-only --json Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
mstomar125
force-pushed
the
fix/3832-logs-fallback
branch
from
October 20, 2026 14:32
642e86f to
3d76a21
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3832
Changes
noticein--json).~/Library/Logs/com.nodespace/nodespaced.log(named byscripts/pkg-resources/app.nodespace.daemon.plist) is the last candidate; not used whenNODESPACE_HOMEredirects.Testing
cargo test -p nodespace-cli --lib commands::logs: 10 passed (new: launch-agent candidate, fallback notice).cargo clippy -p nodespace-cli --all-targets -- -D warningsandcargo fmt --checkclean.🤖 Generated with Claude Code