Commit graph

14 commits

Author SHA1 Message Date
Breadway
6ff1ee910b Add event causality tracking (id + caused_by chains)
Every BreadEvent now gets a unique id at construction (via
BreadEvent::new/with_timestamp, and the normalizer's struct-literal call
sites, which all now assign one explicitly). A new caused_by field is
populated only when a Lua bread.emit() call runs synchronously inside a
bread.on subscriber's handler: LuaEngine tracks the currently-dispatching
event's id (set/restored around each handle_event invocation, single-
threaded so a plain Mutex-guarded slot suffices) and bread.emit()'s Rust
binding reads it when constructing the outgoing event. This lets chains of
Lua modules that react to each other's events be reconstructed instead of
timestamp-guessed from a live `bread events` log.

Also:
- bread events --tree renders the caused_by chain as an indented,
  live-streaming-friendly tree instead of a flat line-per-event stream.
- API_VERSION bumped 1.4.0 -> 1.5.0 (additive-only change).
- Documentation.md's event envelope, bread.emit, and debugging-tips
  sections updated with Since: v1.5 markers.
- New end-to-end regression test spawning the real daemon with 3 chained
  Lua handlers (A emits X on trigger, B emits Y on X, C emits Z on Y) and
  asserting caused_by threads correctly through all three hops.
2026-08-04 17:55:31 +08:00
Breadway
96639516b1 can't be bothered writing a commit message
All checks were successful
dev release / build (push) Successful in 1m33s
2026-08-03 09:37:15 +08:00
Breadway
8d3f55b607 Will change this commit message to mean something later
Some checks failed
dev release / build (push) Failing after 0s
2026-07-22 19:52:16 +08:00
Breadway
22e34e2cf2 Bump version to 0.7.0
All checks were successful
Mirror to GitHub / mirror (push) Successful in 2s
release / build (push) Successful in 1m45s
Build and publish package / package (push) Successful in 2m8s
2026-07-19 03:06:24 +08:00
Breadway
1208c5d1b7 Add filesystem/git/podman/systemd adapters, git/shell hooks, bread-emit CLI, app-detection helpers 2026-07-19 03:05:57 +08:00
Breadway
89c5849539 Fix audit findings: path traversal, exec shell, glob dup, dead bread-sync, version drift
- modules_mgmt.rs: reject module names containing path separators, `..`,
  or absolute paths before joining onto modules_dir (install_from_local,
  remove_module, read_module_manifest); adds canonicalized containment
  check as defense in depth. Manifest-supplied names and CLI args were
  previously joined unsanitized, allowing path traversal on install/remove.
- breadd/src/lua/mod.rs: bread.exec now runs via `sh -c` instead of
  `sh -lc`; no documented reason was found for login-shell semantics.
- Unify the two independently hand-written glob matchers (subscription
  dispatch in breadd/src/core/subscriptions.rs vs. the CLI --filter path
  in breadd/src/ipc/mod.rs) into one implementation in
  bread-shared/src/glob.rs, used by both call sites.
- Remove the dead bread-sync/ tree (already excluded from the workspace
  and fully unreferenced) and its stale PKGBUILD deps (libgit2, git
  optdepend) and packaging docs mention.
- Correct the version-number transposition bug ("6.2.0" instead of
  "0.6.2"/"0.6.6") across bread-shared, breadd, and bread-cli Cargo.toml,
  and fix PKGBUILD's stale pkgver, so Cargo.toml/doctor/PKGBUILD all agree
  with the latest git tag (v0.6.6).
2026-07-17 03:20:14 +08:00
Breadway
680c1f0cec Bump version to 6.2.0
All checks were successful
Mirror to GitHub / mirror (push) Successful in 2s
2026-06-23 12:48:35 +08:00
Breadway
3115a4230b Fix 18 issues flagged in audit + bump to v0.6.2
P1-A: normalizer derives `online` from rtnetlink event kind (link.up/down,
      route.default.changed, address.added/removed) so bread.network.connected
      fires correctly on all systems using rtnetlink.

P1-B: stream_events consumes the subscribe ack before the event loop so the
      first line is not printed as garbage.

P1-C: UPowerAdapter::probe() validates D-Bus synchronously before committing;
      the sysfs fallback now actually triggers when D-Bus is unavailable.

P2-A: profile.list returns the full profile state (active + history) instead
      of the always-empty profiles map.

P2-B: profile history capped at 50 entries in both StateCommand and
      apply_event_to_state to prevent unbounded growth.

P2-C: RtnetlinkAdapter::new() no longer spawns an orphaned tokio task;
      it validates availability by constructing and immediately dropping the
      connection tuple.

P2-D: Lua-side hyprland_request_socket() logs a warn when multiple
      Hyprland instances are found, matching the adapter-side behaviour.

P2-E: Malformed JSON from an IPC client returns an error response and
      continues rather than closing the entire connection.

P3-A: Remove the `ends_with(".*")` prefix-match shortcut from both the
      subscription table and the IPC event filter. `bread.*` now means
      one segment (matching documented API semantics: `* = one segment`).
      Tests updated accordingly.

P4-A: Remove unused `git2` and `glob` workspace dependencies (left over
      from bread-sync extraction).

P4-B: breadd dev-dependency `tempfile` declared via workspace = true.

P4-C: Remove unreachable XDG_CONFIG_HOME branch in modules_dir(); dirs
      already reads that var internally before returning None.

P4-D: Delete duplicate send_request_with_stream(); print_doctor() now
      uses socket.exists() + send_request() directly.

P5-A: release.yml drops `--lib` from cargo test so integration tests run
      in the release gate.

P6-A: bluetooth_spawn / bluetooth_query replace expect() on tokio runtime
      construction with error logging / error propagation.

P6-B: Spin loops in lua/mod.rs add std:🧵:yield_now() after the
      PAUSE hint to reduce CPU burn under sustained RwLock contention.

P6-C: All Mutex::lock().expect("... poisoned") in lua/mod.rs replaced with
      unwrap_or_else(|e| e.into_inner()) for poison recovery.

P7-B: bread.system.startup event moved from main.rs into ipc::Server::serve()
      so it fires after the socket is bound (smaller race window for early
      subscribers).
2026-06-23 12:45:56 +08:00
Breadway
32982b96de chore: bump version to 0.6.1 2026-06-11 14:21:13 +08:00
Breadway
114c9e2bcc Revert to v0.6 2026-05-17 08:33:00 +08:00
Breadway
cc456b78fe refactor: remove remote module install, extract bread-sync, make CI real
Security:
- Remove `bread modules install github:…`. Remote fetch pulled unreviewed
  third-party Lua and ran it with full bread.exec() privileges in an
  unsandboxed runtime. Module install is now local-only; parse_source
  rejects github:/git: with an explicit message.

bread-sync extracted from the workspace (parked for its own project):
- Removed from workspace members (now excluded); see bread-sync/EXTRACTION.md
- Removed the entire `bread sync` CLI surface and now-unused deps
  (bread-sync, reqwest, tar, flate2; tempfile demoted to dev-dependency)
- Removed the sync.status IPC method from breadd plus its integration tests
- Moved the generic `expand_path` helper into bread-shared (with unit tests)

CI now actually runs and gates quality:
- Trigger on master/dev (was `main` — CI had never run, not once)
- Added `cargo fmt --check` and `clippy -D warnings`; fixed 4 clippy warnings
- Dropped the macOS matrix entry (breadd is Linux-only: udev/rtnetlink);
  added the libudev-dev system dependency the Linux build needs

Hardening / honesty:
- New ipc test: daemon survives repeated reloads and the event pipeline
  resumes (the prior suite only had a single happy-path reload check)
- Docs scrubbed of sync across README/Documentation/Overview/DAEMON
- "production-ready" and "compositor-agnostic" claims reworded to match
  reality rather than aspiration

Note: bread-sync/src/export.rs held pre-existing local WIP authored outside
this change set and is intentionally excluded from this commit.
2026-05-17 00:22:21 +08:00
Breadway
fc27916a5d Commiting for bread sync 2026-05-16 19:44:19 +08:00
Breadway
9a471f3158 Final Release of Version 1.0 2026-05-13 22:01:42 +08:00
Breadway
730a8b61d7 Release 1.0 2026-05-11 11:56:03 +08:00