Repository navigation
Remove the pro feature and --edition from nodespaced; reject unknown arguments - #3375
Conversation
Pragmatic Code ReviewReview Type: Initial Review (commit SummaryNet positive and correct. The dead Requirements Check (issue #3348)
Launcher audit (independent, not taken from the PR body)I grepped
Findings🟡 Important: SKILL.md now tells agents it is "safe" to probe the binary, and points at the wrong file📁 The new text says
Recommendation: keep the "do not probe with 🟢 Suggestion (Nit): supported-argument list is written in two places📁 The stderr message hard-codes 🟢 Suggestion (Nit): main() comment slightly conflates two mechanisms📁 "a probe such as the Homebrew formula's 🟢 Suggestion (Nit):
|
mstomar125
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review: APPROVE (posted as a comment — GitHub blocks self-approval). No blockers; one 🟡 doc-accuracy fix recommended before merge (SKILL.md 'safe to probe' wording and the lib.rs pointer) plus optional nits. Full findings in the review comment above: #3375 (comment)
Address-review summary (commit e97e0c0)Reviewer verdict on 16e749b: APPROVE with one Important and three Nits. Each claim was re-verified against the code before acting. Addressed (3):
Skipped (1):
Checks after the fix: comment and documentation changes only, no logic touched. Re-Review DecisionDecision: NO RE-REVIEW NEEDED Rationale: the follow-up commit changes one skill document paragraph and two comments; no code, test, or behaviour changed, and the reviewer's APPROVE stands for the code as reviewed. Rebase note: 🤖 Generated with Claude Code |
…nknown arguments The `pro` cargo feature was never enabled by any build, so `is_pro_build()` was always false and `--edition` always printed `community`. Delete the feature, `is_pro_build`, `edition()` and the `--edition` early exit, and pass `false` where the Pro discriminator was read (the incompatible-database marker, the fallback socket path, the UI pid-file path). `main` now refuses any argument other than `--tray` and `--version` before tracing or the runtime start: one line on stderr naming the argument and the supported ones, exit status 2, nothing on stdout, no socket bound. Without this, a caller that runs `nodespaced <flag>` inside `$(...)` would start a full daemon and never return. `first_unrecognized_arg` is a pure function over the argv slice; a non-UTF-8 argument is converted lossily so it takes the same path instead of panicking. Tests: unit tests for `first_unrecognized_arg` beside `tray_mode_tests`, and an integration test that spawns the real binary with the retired flag, `--help` and an arbitrary flag, and with `--version`. The retired flag is built from fragments in both so the boundary ratchet does not count the test that guards against it. The run-app skill no longer warns that `nodespaced --help` starts a daemon against the real database. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…hten two comments The run-app skill said probing the daemon with --help is safe and pointed at lib.rs for its flags. Both were wrong for the worst-case reader: step 1 reuses any existing binary, and an installed or stale daemon still ignores unknown flags and starts serving. Say so, and point at main.rs for the flags and lib.rs for the environment variables. The main() comment now names --version (which the Homebrew formula's test runs) and the reject path separately instead of implying the reject path covers the formula. The ui_pid_path doc no longer claims both sides derive the path from the same flag set; this side's only flag is debug or release. Comment and documentation changes only. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
e97e0c0 to
893391c
Compare
Closes #3348
What changed
packages/daemon/Cargo.toml: delete the[features]table (prowas its only entry and nothing enables it).packages/daemon/src/main.rs:is_pro_build(),edition()and the--editionearly exit; passfalsetomarker_pathanddefault_socket_path_for.main()keeps--version, then calls a new purefirst_unrecognized_arg(&[String]) -> Option<&str>(accepts onlyACCEPTED_ARGS = [TRAY_FLAG], skips argv[0]). OnSome, before tracing or the runtime start: one stderr line naming the argument and the supported ones (--tray,--version), thenexit(2). Nothing on stdout, no socket bound.packages/daemon/src/tray.rs:ui_pid_pathpassesfalseinstead ofcfg!(feature = "pro"); doc now says the variant is the build flavour (debug or release)..claude/skills/run-app/SKILL.md: the "nodespaced --helpstarts a daemon on the real database" warning is no longer true, so it now says the flag is refused with status 2.Out of scope, as the issue says:
marker_path(is_pro),default_socket_path_for(_, is_pro),proto::socketand the Pro rows of the variant tests (#3355), the postinstall guard (#3349),LAUNCHER_ARGS(#3352).Deviations from the issue text
std::env::args_os()with lossy conversion instead ofstd::env::args().args()panics (exit 101) on a non-UTF-8 argument, which would break "any other unknown argument exits 2". A lossy string is unrecognized, so it takes the same path. One line.VERSION_FLAG/UNRECOGNIZED_ARG_EXIT_CODEconstants added so the stderr message and the check share one spelling.--versionis answered beforefirst_unrecognized_arg, so it is not inACCEPTED_ARGS(as specified);nodespaced --bogus --versiontherefore still prints the version, as before..claude/skills/run-app/SKILL.mdedit was not in the issue's scope list; it documented the exact hazard this PR removes.tray_mode_tests::argv(madepub(super)) rather than duplicating it.Launcher audit (the issue's "Risks" step)
Re-checked every place that spawns
nodespaced. Arguments passed: only--tray(app plist indaemon_setup.rs, systemdExecStart, Windows spawn and HKCU autorun,scripts/pkg-resources/app.nodespace.daemon.plist) or none (Homebrew formulaservice,test-support,daemon-harness.ts,packages/daemon/tests/it), plus--version(formulatest). The only remaining--editioncaller isscripts/pkg-resources/postinstall:34, which falls back tounknownvia|| echoand is removed by #3349; sync's Pro postinstall does the same. No launcher missed.Ratchet
scripts/check-pro-boundary.ts(#3299) is not onorigin/mainyet, so there is noBASELINESto lower in this PR. Measured with the checker from the #3299 branch, run overorigin/mainand over this branch:editionBranchingis_pro_buildx5 incl. its doc,feature = "pro"x2,--edition, tray line)proWordingcloudWordingThis PR adds no marker: the retired flag is built with
concat!("--", "edition")in both test files. Whichever of #3299 and this PR lands second must lowerBASELINESby 9 / 4 / 1 (editionBranching,proWording,cloudWording).Verification
git grep -nw is_pro_build -- packages/daemonandgit grep -n -F -e --edition -e 'feature = "pro"' -e 'fn edition' -- packages/daemonboth print nothing.--edition,--help,--no-such-flagexit 2 with empty stdout, the stderr line, and no socket;--versionprints0.3.2, exit 0.cargo clippy -p nodespace-daemon --all-targets -- -D warnings -D clippy::unused-async: clean.cargo fmt -p nodespace-daemon -- --check: clean.bun run test:changed(rust workspace nextest + scripts tiers): passed.unrecognized_arg_tests) and 4 integration tests (unrecognized_flag::).Mutation checks (each reverted afterwards)
exit(2)line--versiontest passes--versionhandling--versionintegration test fails.skip(1)ACCEPTED_ARGS.last()instead of firstthe_first_of_several_unknown_arguments_is_reportedfailsNot verified here
nodespaced --traywas not launched (needs a display and an NSApplication run loop); it is covered by thetray_mode/first_unrecognized_argunit tests and by the audit above. The Windows and Linux builds were not compiled; the change touches only cfg-independent code and the unix-only integration test is#![cfg(unix)].🤖 Generated with Claude Code