Skip to content

Let an app built on core supply its DaemonProfile via AppExtensions::daemon_profile #3347

Closed as not planned

Description

@mstomar125

Summary

Add AppExtensions::daemon_profile(self, profile: DaemonProfile) -> Self (ADR-082 §3.2 and §3.6, proposed).

  • An app built on core can supply its profile. That app is the Pro app crate in nodespace-sync. The profile sets its daemon binary, the daemon's service environment and its product.
  • run installs the supplied profile before it creates the Tauri builder.
  • AppExtensions::none() supplies no profile. Core's own main.rs passes it, so the app keeps its built-in default and the free app does not change.
  • DaemonProfile has to live in the crate that extensions depend on.

Context

Scope

  • daemon_profile.rs:
    • Add pub(crate) fn install(profile: DaemonProfile), which sets ACTIVE.
    • If ACTIVE was already set because something read the profile first, panic with a message that names the ordering bug.
    • Put the set-once logic in fn install_into(cell: &OnceLock<DaemonProfile>, profile: DaemonProfile) -> Result<(), DaemonProfile>, so the unit tests can use a local cell.
  • AppExtensions:
    • Add a private field daemon_profile: Option<DaemonProfile>.
    • Add the builder method pub fn daemon_profile(self, profile: DaemonProfile) -> Self.
    • Its rustdoc says what each field controls:
      • binary_name: the binary that is installed, registered, started, and killed by image name;
      • service_env: the environment in the launchd registration;
      • product: the product the running daemon is expected to belong to.
    • The rustdoc also says two things. The label, socket, UI pid file and marker are core's shared identity (ADR-084 decision 2(a)) and cannot be configured. And the named daemon must honour ADR-084's registration contract.
  • run:
    • Before creating the builder, call daemon_profile::install(<the supplied profile>.unwrap_or_else(daemon_setup::profile_for_this_build)).
    • assemble does not install. Tests drive it with MockRuntime, and must not touch the process-global cell.
  • The library root: add pub use daemon_profile::DaemonProfile;, or the re-export from the API crate.
  • EXTENSION_API_VERSION: if it exists and Split the desktop Tauri crate and add ADR-082's Tauri extension points #3322 did not already declare this method, bump its minor version. ADR-082 §6 counts a new AppExtensions method as additive.

Out of scope

Steps

  1. Run the CLAUDE.md startup sequence, and assign the issue at pickup.
  2. Add install and install_into.
  3. Add the field and the method, and call the install from run.
  4. Add the re-export and the docs. Code comments must not cite GitHub issue numbers.
  5. Add the tests.
  6. Run bun run scripts/check-pro-boundary.ts and paste the printed BASELINES.
  7. Run bun run test:changed and bun run quality:fix, push, and open the PR.

Acceptance criteria

  • A crate outside the library can construct DaemonProfile { binary_name: "custom-daemon", service_env: vec![], product: "custom" } and pass it with AppExtensions::none().daemon_profile(..). Show this with core's fixture extension (ADR-082 §7) or a tests/ integration crate.
  • With AppExtensions::none(), active() equals profile_for_this_build().
  • A supplied profile is the one that daemon_binary_name(), the Windows image name and the plist env use.
  • Installing a profile after it was read fails loudly. It is never silently ignored.
  • Free app behaviour is unchanged.
  • bun run scripts/check-pro-boundary.ts passes, and BASELINES is pasted. No change is expected.

Tests and verification

  • Unit tests for install_into:
    • it stores a supplied profile;
    • it falls back to the build default when nothing is supplied;
    • it returns Err when the cell is already set.
  • Fixture test: if Split the desktop Tauri crate and add ADR-082's Tauri extension points #3322 ships the ADR-082 §7 fixture extension, add a case showing that it can name and pass a custom DaemonProfile.
  • Default test: if assemble exposes the extension parts, check that AppExtensions::none() carries no profile.
  • Commands:
    • bun run test:changed
    • cargo clippy -p <the library crate> --all-targets -- -D warnings -D clippy::unused-async

Dependencies

Risks and rollback


Plan key: C8.2 (pro-boundary DAG).

🤖 Generated with Claude Code

Activity

  1. self-assigned this
    on Sep 30, 2026
  2. added
    pro-boundary
    on Sep 30, 2026
  3. mstomar125 commented on Sep 30, 2026

    @mstomar125
    ContributorAuthor

    Acceptance criterion added (from #3346's review): where an external DaemonProfile is accepted via AppExtensions, reject service_env keys that collide with core's reserved launch-agent variables (NODESPACED_SOCKET, NODESPACE_UI_BINARY) — a duplicate plist key is accepted by plutil and silently overrides core's value. Take the reserved names from one shared list that write_plist also uses.

  4. mstomar125 commented on Oct 1, 2026

    @mstomar125
    ContributorAuthor

    Superseded by #3414 (umbrella against the final ADR-081–085)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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