Skip to content

Remove the pro feature and --edition from nodespaced and reject unknown arguments #3348

Closed

Description

@mstomar125

Summary

Remove the community daemon's dead edition code:

  • the unused pro cargo feature;
  • is_pro_build() and edition();
  • the --edition flag;
  • the tray's cfg!(feature = "pro").

In the same PR, make nodespaced exit with status 2 on any argument it does not recognise. Otherwise the installers that still run nodespaced --edition as root would start a full daemon inside $(...) and hang.

Context

  • The feature is dead. packages/daemon/Cargo.toml (65-69) declares pro = [], and nothing enables it: sync's nodespaced-pro depends on nodespace-daemon without features. So is_pro_build() (src/main.rs 117-122) is always false, and --edition always prints community. ADR-082 §4 (proposed) removes the feature, edition() and the tray's cfg! choice.
  • The hazard. main() (438-449) handles --edition, --version and --tray, and sends any other argument to serve_headless(). Three places run nodespaced --edition as root inside $(...), and all three fall back with || echo "unknown":
  • Audited launchers. Rejecting every other argument breaks none of these:
    • --tray: the app plist, the systemd unit, the Windows spawn, the HKCU autorun, and scripts/pkg-resources/app.nodespace.daemon.plist;
    • no arguments: the Homebrew formula's service (scripts/update-homebrew-formula.ts 330-340), src-tauri/test-support, src/tests/e2e/daemon-harness.ts and packages/daemon/tests/it;
    • --version: the formula's test.
  • The tray must change in the same PR. src/tray.rs:57 reads cfg!(feature = "pro"). Once the feature is undeclared, check-cfg warns, and clippy -D warnings fails.
  • Guardrail: stop new Pro code from landing in core #3302's absence-test convention. A test that passes the retired flag builds it from fragments, so the Pro-boundary ratchet stays at zero for --edition.

Scope

packages/daemon/Cargo.toml

  • Delete the [features] table (65-69). pro is its only entry.

packages/daemon/src/main.rs

packages/daemon/src/tray.rs

  • ui_pid_path (46-59): pass false instead of cfg!(feature = "pro").
  • Reword its doc (46-52) to say the variant is this daemon's build flavour, debug or release.

packages/daemon/tests/it

  • Add unrecognized_flag.rs, and register it as mod unrecognized_flag; in tests/it/main.rs.

Out of scope

Steps

  1. Run the CLAUDE.md startup sequence, and assign the issue at pickup.
  2. Make the Cargo.toml, main.rs and tray.rs edits.
  3. Add the argv check. Put its unit tests in a module next to tray_mode_tests (~1160).
  4. Add the integration test.
  5. Run bun run scripts/check-pro-boundary.ts and paste BASELINES.
  6. Run bun run test:changed and bun run quality:fix, push, and open the PR. Code comments must not cite GitHub issue numbers.

Acceptance criteria

  • Both of these print nothing:
    • git grep -nw is_pro_build -- packages/daemon
    • git grep -n -F -e --edition -e 'feature = "pro"' -e 'fn edition' -- packages/daemon
  • The retired flag, --help and any other unknown argument each exit with status 2 within a second. Nothing is printed on stdout, and no socket is bound.
  • nodespaced, nodespaced --tray and nodespaced --version behave as before.
  • bun run scripts/check-pro-boundary.ts passes, with BASELINES lowered to the printed counts:
    • editionBranching falls: the is_pro_build, --edition and edition lines in main.rs, and the one line in tray.rs;
    • proWording falls: the comment in Cargo.toml and the edition docs in main.rs.

Tests and verification

  • Unit tests for first_unrecognized_arg:
    • None for [nodespaced] and [nodespaced, --tray].
    • Some for --help, --no-such-flag, [--tray, <retired>] and the retired flag on its own.
    • Build the retired flag as const RETIRED_EDITION_FLAG: &str = concat!("--", "edition");. Its comment says it is built from fragments so the Pro-boundary ratchet stays at zero.
  • Integration test (tests/it/unrecognized_flag.rs):
    • Spawn env!("CARGO_BIN_EXE_nodespaced") with RETIRED_EDITION_FLAG. Point HOME, NODESPACE_HOME, NODESPACED_SOCKET and NODESPACED_DB_PATH into a tempdir.
    • Assert exit status 2 within 10 s, empty stdout, and no socket file.
    • Also assert that --version prints CARGO_PKG_VERSION and exits 0.
    • Kill the child on timeout, so a regression fails the test instead of hanging it. sigterm_during_model_load.rs shows the pattern.
  • Mutation check: delete the exit(2) line, and the integration test must fail.
  • Commands:
    • bun run test:changed
    • cargo clippy -p nodespace-daemon --all-targets -- -D warnings -D clippy::unused-async
    • .tools/bin/cargo-nextest nextest run -p nodespace-daemon --bins
    • .tools/bin/cargo-nextest nextest run -p nodespace-daemon --test it unrecognized_flag::

Dependencies

Risks and rollback

  • A launcher the audit missed. If one passes another argument, the daemon now exits 2, and launchd or systemd restarts it in a loop. Before merging, re-run git grep -n nodespaced -- scripts .github packages and check every spawn.
  • Rollback: revert the PR. The removed code never ran in a shipped build.

Plan key: C8.3a (pro-boundary DAG).

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

Labels

pro-boundary

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions