Skip to content

feat(sdk,launcher): add permission-gated environment.getPaths() - #1089

Merged
Xoshbin merged 1 commit into
mainfrom
feat/environment-get-paths
Nov 19, 2026
Merged

Xoshbin merged 1 commit into
mainfrom
feat/environment-get-paths

Conversation

@Xoshbin

@Xoshbin Xoshbin commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner

Add cross-platform OS user directory resolution (home, appData,
localAppData, config) via environment.getPaths(), gated behind the
files:read permission so unprivileged extensions cannot fingerprint
OS usernames or filesystem layouts.

  • Rust: add environment_get_paths command using Tauri PathResolver
    OS directories (not app_data_dir), normalized with dunce, and gate
    asyar:api:environment:getPaths under files:read in permissions.rs
  • Launcher IPC: wire environment:getPaths in ExtensionIpcRouter and
    buildServiceRegistry with unit tests
  • SDK: add EnvironmentPaths and getPaths() to IEnvironmentService,
    EnvironmentServiceProxy, and environment facade (worker & view)
  • Docs: document environment.getPaths(), files:read requirement, and
    OS directory mappings in environment.md and permissions.md

What changed

  • Before (issue / current behavior):
  • After (fix / new behavior):

Affected areas

  • Launcher UI / UX (visuals, interactions, keyboard shortcuts, settings)
  • SDK / Extensions (asyar-sdk, extension runtime, IPC contracts, manifest)
  • Rust Backend / Platform (Tauri commands, search, storage, OS integration)
  • Docs / Tooling / Other (docs, CI, build scripts, locales)

Manual smoke test & Validation

  • I manually smoke-tested this in the running app (pnpm dev) and visually verified the fix/feature works.

AI usage

  • AI tools helped produce this change.
  • I ran the asyar-contribution skill (.agents/skills/asyar-contribution/SKILL.md), followed it, and reviewed every generated line.

Boundaries

  • Zero-hardcoded-strings i18n policy respected (if UI strings were added/changed).
  • Third-party extension compatibility preserved (no breaking changes to published extension contracts without deprecation/boundary adapter).
  • Hot paths remain fast and unblocked (window reveal, keystroke search, and 120 FPS UI responsiveness).
  • pnpm check:ci (or the relevant inner-loop checks) passes locally.

Summary by CodeRabbit

  • New Features
    • Added an SDK method for retrieving the host’s home, application data, local application data, and configuration directory paths. Extension access requires the files:read permission.
  • Documentation
    • Documented the new method, its permission requirement, and platform-specific directory locations.

Add cross-platform OS user directory resolution (home, appData,
localAppData, config) via environment.getPaths(), gated behind the
files:read permission so unprivileged extensions cannot fingerprint
OS usernames or filesystem layouts.

- Rust: add environment_get_paths command using Tauri PathResolver
  OS directories (not app_data_dir), normalized with dunce, and gate
  asyar:api:environment:getPaths under files:read in permissions.rs
- Launcher IPC: wire environment:getPaths in ExtensionIpcRouter and
  buildServiceRegistry with unit tests
- SDK: add EnvironmentPaths and getPaths() to IEnvironmentService,
  EnvironmentServiceProxy, and environment facade (worker & view)
- Docs: document environment.getPaths(), files:read requirement, and
  OS directory mappings in environment.md and permissions.md
@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change adds a Tauri command that returns four host directory paths. Extension calls require files:read. The launcher routes the request through extension IPC, and the SDK exposes it as environment.getPaths().

Changes

Environment paths

Layer / File(s) Summary
Resolve and authorize directory paths
asyar-launcher/src-tauri/src/commands/environment.rs, asyar-launcher/src-tauri/src/commands/{handlers.rs,mod.rs}, asyar-launcher/src-tauri/src/permissions.rs
The Tauri command resolves and normalizes the home, appData, localAppData, and config paths. Extension calls require files:read; host calls without an extension ID bypass that check. The command is registered, and tests cover authorization, serialization, and path normalization.
Route environment path requests
asyar-launcher/src/lib/ipc/systemMiscCommands.ts, asyar-launcher/src/services/extension/{ExtensionIpcRouter.ts,ExtensionIpcRouter.files.test.ts,buildServiceRegistry.ts,buildServiceRegistry.test.ts}
The extension IPC schema adds environment:getPaths with no parameters. The service registry forwards the caller’s extension ID to the Tauri command, and tests verify routing and returned paths.
Expose paths through the SDK
asyar-sdk/src/types/EnvironmentType.ts, asyar-sdk/src/services/EnvironmentServiceProxy.ts, asyar-sdk/src/environment.ts, asyar-sdk/src/{contracts.ts,worker.ts}, asyar-sdk/src/services/index.ts, asyar-sdk/src/{environment.test.ts,view.test.ts}, asyar-sdk/src/services/EnvironmentServiceProxy.test.ts, docs/reference/{permissions.md,sdk/environment.md}
The SDK adds and exports the EnvironmentPaths type and getPaths() method. Tests cover the proxy call and public API. The reference docs describe the returned paths, platform conventions, and permission requirement.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Merge Risk: Minimal · up to f82c2

This adds a permission-gated environment.getPaths() API. Access requires files:read, and the host, IPC and SDK layers are consistent. No merge-blocking issues were found.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the two main parts of the change: a new environment.getPaths() API in the SDK and launcher, and its permission gate. It matches the PR objectives and the changeset, which adds the Rust…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the two main parts of the change: a new environment.getPaths() API in the SDK and launcher, and its permission gate. It matches the PR objectives and the changeset, which adds the Rust command, the IPC wiring, the SDK types and methods, the permissions mapping, and the docs. It does not list every detail, which the title does not need to do.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 607c253 and f82c268.

Files selected for processing: 20

  • asyar-launcher/src-tauri/src/commands/environment.rs
  • asyar-launcher/src-tauri/src/commands/handlers.rs
  • asyar-launcher/src-tauri/src/commands/mod.rs
  • asyar-launcher/src-tauri/src/permissions.rs
  • asyar-launcher/src/lib/ipc/systemMiscCommands.ts
  • asyar-launcher/src/services/extension/ExtensionIpcRouter.files.test.ts
  • asyar-launcher/src/services/extension/ExtensionIpcRouter.ts
  • asyar-launcher/src/services/extension/buildServiceRegistry.test.ts
  • asyar-launcher/src/services/extension/buildServiceRegistry.ts
  • asyar-sdk/src/contracts.ts
  • asyar-sdk/src/environment.test.ts
  • asyar-sdk/src/environment.ts
  • asyar-sdk/src/services/EnvironmentServiceProxy.test.ts
  • asyar-sdk/src/services/EnvironmentServiceProxy.ts
  • asyar-sdk/src/services/index.ts
  • asyar-sdk/src/types/EnvironmentType.ts
  • asyar-sdk/src/view.test.ts
  • asyar-sdk/src/worker.ts
  • docs/reference/permissions.md
  • docs/reference/sdk/environment.md

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.

@Xoshbin
Xoshbin merged commit 6919696 into main Nov 19, 2026
12 checks passed
@Xoshbin
Xoshbin deleted the feat/environment-get-paths branch November 19, 2026 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant