Resolve app/package running state from metadata-backed process matchers #7

Open
opened 2026-06-17 15:11:36 +02:00 by yorunikakeru · 0 comments
Owner

Goal

Toad should hide OS process-table details behind app/package metadata so users can write conditions like appRunning "steam" without knowing executable names, wrappers, helper processes, argv patterns, Flatpak/Nix details, or /proc invariants.

Required actions

  • Define the runtime metadata input needed to resolve an app/package identity to process matchers.
  • Model concrete process matchers explicitly, for example:
    • executable or /proc/<pid>/comm names;
    • command line predicates from /proc/<pid>/cmdline;
    • optional exe path/package provenance where available;
    • helper process inclusion/exclusion rules.
  • Extend the current ProcessProbe, which currently returns only HashSet<String> from /proc/*/comm, so it can support structured matching without leaking that structure into user DSL.
  • Decide snapshot output for Planner:
    • resolved active app/package identities; or
    • structured process observations plus match result state.
  • Treat disappearing PID directories and unreadable process files as normal transient races, preserving the current probe behavior.
  • Add tests with fake /proc data for:
    • simple executable match;
    • wrapper/name mismatch case;
    • argv/cmdline match;
    • helper process counted as app running;
    • false positive avoided for shared runtimes like python, java, electron, or wine.
  • Update README/API docs and public Rust docs.

Boundaries

  • Toad observes and resolves runtime state; it does not make policy or action decisions.
  • Planner remains pure and should consume already-resolved snapshot data.
  • DSL remains user-facing and should not expose process-table invariants for the common case.

Dependencies

  • Needs IR/DSL agreement on app/package identity names and condition shape.
  • Needs Planner agreement on the snapshot field or contract it will evaluate.

Acceptance criteria

  • A package/app name can be resolved to one or more concrete process matchers.
  • Toad can publish enough state for Planner to evaluate app/package running conditions deterministically.
  • The old raw process-name probe behavior remains available internally or is migrated with tests.
  • Required Rust checks pass: cargo fmt --check, cargo check --all-targets --all-features, cargo clippy --all-targets --all-features -- -D warnings, and cargo test --all-targets --all-features.
## Goal Toad should hide OS process-table details behind app/package metadata so users can write conditions like `appRunning "steam"` without knowing executable names, wrappers, helper processes, argv patterns, Flatpak/Nix details, or `/proc` invariants. ## Required actions - Define the runtime metadata input needed to resolve an app/package identity to process matchers. - Model concrete process matchers explicitly, for example: - executable or `/proc/<pid>/comm` names; - command line predicates from `/proc/<pid>/cmdline`; - optional exe path/package provenance where available; - helper process inclusion/exclusion rules. - Extend the current `ProcessProbe`, which currently returns only `HashSet<String>` from `/proc/*/comm`, so it can support structured matching without leaking that structure into user DSL. - Decide snapshot output for Planner: - resolved active app/package identities; or - structured process observations plus match result state. - Treat disappearing PID directories and unreadable process files as normal transient races, preserving the current probe behavior. - Add tests with fake `/proc` data for: - simple executable match; - wrapper/name mismatch case; - argv/cmdline match; - helper process counted as app running; - false positive avoided for shared runtimes like `python`, `java`, `electron`, or `wine`. - Update README/API docs and public Rust docs. ## Boundaries - Toad observes and resolves runtime state; it does not make policy or action decisions. - Planner remains pure and should consume already-resolved snapshot data. - DSL remains user-facing and should not expose process-table invariants for the common case. ## Dependencies - Needs IR/DSL agreement on app/package identity names and condition shape. - Needs Planner agreement on the snapshot field or contract it will evaluate. ## Acceptance criteria - A package/app name can be resolved to one or more concrete process matchers. - Toad can publish enough state for Planner to evaluate app/package running conditions deterministically. - The old raw process-name probe behavior remains available internally or is migrated with tests. - Required Rust checks pass: `cargo fmt --check`, `cargo check --all-targets --all-features`, `cargo clippy --all-targets --all-features -- -D warnings`, and `cargo test --all-targets --all-features`.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
FrogOS/Toad#7
No description provided.