Commit graph

76 commits

Author SHA1 Message Date
Breadway
94be831a21 Merge feature/ipc-connection-auth (Workstream A) 2026-08-04 22:33:23 +08:00
Breadway
7bb6fbb20f ipc: close unauthenticated event-spoofing gap in emit's no-source path
The IPC "emit" method's no-source path took a bare event+data and sent it
straight to emit_tx tagged AdapterSource::System with zero validation of
the event name. Any same-UID process on the socket could send e.g.
{"event":"bread.power.ac.connected",...} and have it delivered to every
Lua subscriber indistinguishable from a real adapter event, since System
is the same tag the daemon uses for its own trusted, Rust-originated
sends (bread.system.startup, bread.profile.activated).

Fix, scoped to the actual threat model (same-UID Unix socket trust means
there's no way to cryptographically distinguish "the real bread-cli
binary" from any other local process, so a generic connection-identity
handshake would be theater):

- New AdapterSource::Manual tag for the no-source emit path. System is
  now reserved for daemon-internal, Rust-code-originated sends only and
  can never again be produced from data that arrived over the wire.
- The event name is rejected if its top-level dotted segment is one of
  the reserved, adapter-owned domains (RESERVED_DOMAINS in
  bread-shared/src/apps.rs) -- extended with bluetooth/workspace/window/
  monitor, event families the Hyprland and Bluetooth adapters already
  publish under but that were missing from that list. Freely-named
  custom/test event names are untouched, so `bread emit <name>` and
  bread-emit's fire-and-forget single-line-write design keep working
  exactly as documented.

Bumped API_VERSION to 1.5.0 and updated Documentation.md's IPC emit
section and Namespaces reserved-domains list accordingly.

Also fixed a subscribe/emit race that surfaced while adding regression
tests for this: events.subscribe's ack is written to the client before
the server task actually registers on the broadcast channel, so a test
that emits immediately after reading the ack can race the registration.
Added a settle delay plus an explicit timeout (instead of an unbounded
read loop) so a future regression fails the test instead of hanging the
whole binary.
2026-08-04 17:41:18 +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
b9e2530743 CONTRIBUTING.md: document single-trunk + RC-tag release model
All checks were successful
dev release / build (push) Successful in 3m59s
2026-07-31 11:08:41 +08:00
Breadway
b00e145a93 CI: single-trunk model — dev triggers on main, beta becomes RC-tag-triggered
Replaces the dev/beta branch split with one trunk (main): dev-track
builds still publish on every push, but the beta track now publishes
from a vX.Y.Z-rc.N prerelease tag instead of a separately-maintained
beta branch. Removes the branch nobody reliably kept in sync.
2026-07-31 11:05:29 +08:00
Breadway
34854f1471 update deps
All checks were successful
dev release / build (push) Successful in 55s
2026-07-23 11:46:35 +08:00
Breadway
8a794c03bf Will change this commit message to mean something later
All checks were successful
dev release / build (push) Successful in 56s
2026-07-23 11:16:33 +08:00
Breadway
f9a8c4f915 Drop pacman packaging, bakery-only distribution
All checks were successful
dev release / build (push) Successful in 1m17s
bakery already fully covers what the PKGBUILD provided (binary, systemd
--user service where applicable, dependency declarations) except a LICENSE
copy, which bakery.toml's new license_file field now closes. Removes
packaging/arch/ and .forgejo/workflows/package.yml; adds the LICENSE
artifact to each release/dev-release/beta-release workflow's prepare
step. Not pacman-installed inside BOS today (BOS already consumes these
apps exclusively via build-local.sh's skel-staging), so this only removes
the option to `pacman -S` outside of BOS/bakery.
2026-07-23 10:25:12 +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
f3905d8114 docs: add CONTRIBUTING.md
Some checks failed
dev release / build (push) Failing after 0s
Documents the dev/beta/main branch and release-track workflow shared
across the bread ecosystem. See bread-ecosystem's docs/release-channels.md
for the full policy this implements.
2026-07-22 19:40:26 +08:00
Breadway
ef035dc687 ci: make beta a branch-triggered freeze track, not a one-off tag
All checks were successful
dev release / build (push) Successful in 1m22s
beta release / build (push) Successful in 1m17s
Beta is now a real stabilization branch: publishes on every push to
`beta` (mirroring dev's model, auto-versioned X.Y.Z-beta.<ts>+<sha>,
base version from the latest published tag) instead of a manual
beta-v* tag. Fixes made during the freeze land via fix/<issue> branches
merged into `beta` directly. The gen-index.sh clone for beta pulls
bread-ecosystem's default branch (main) rather than pinning to dev,
since beta is the more stable track and main now carries the
TRACK-aware script.
2026-07-22 18:37:11 +08:00
Breadway
e28b5cedee ci: base dev version on the latest published tag, not Cargo.toml
All checks were successful
dev release / build (push) Successful in 1m12s
Cargo.toml can drift stale relative to the actual last release (observed
on breadbox/breadpad/breadcrumbs/breadpaper), which made the auto-bumped
dev version sort as OLDER than what's already installed — bakery's semver
check correctly refused those "updates". Deriving the base version from
git ls-remote --tags instead is self-healing regardless of Cargo.toml
drift, with a Cargo.toml fallback only for a repo with no tags yet.
2026-07-22 13:51:32 +08:00
Breadway
21131672ab ci: use a unique temp dir for the bread-ecosystem clone in dev/beta CI
All checks were successful
dev release / build (push) Successful in 1m24s
The fixed /tmp/bread-ecosystem-ci path races when multiple repos' dev/beta
workflows run close together on the same self-hosted runner — one job's
rm -rf/clone can stomp another's in-progress checkout, causing the
regenerate-index step to fail intermittently. Switch to mktemp -d.
2026-07-22 10:24:08 +08:00
Breadway
d480209ec2 ci: pin gen-index.sh clone to bread-ecosystem's dev branch
All checks were successful
dev release / build (push) Successful in 1m2s
The TRACK-aware gen-index.sh only exists on bread-ecosystem's dev branch
so far (not yet merged to main). Without --branch dev, the remote clone
defaulted to main and silently ran the old track-blind script, which is
why dl.breadway.dev/dev/index.json never actually picked up bread's dev
builds despite the workflow reporting success.
2026-07-22 09:49:43 +08:00
Breadway
00ba49bfe9 ci: fail fast on missing signing key when regenerating index.json
All checks were successful
dev release / build (push) Successful in 55s
The remote gen-index.sh call never had MINISIGN_SEC_KEY wired through, so a
missing/misconfigured secret silently produced an unsigned index.json that
overwrote the previously-signed one instead of failing the job — this is
why bread's dev track never appeared in dl.breadway.dev/dev/index.json
after the first dev-release.yml run despite it reporting success.
2026-07-22 09:44:44 +08:00
Breadway
edb37a28e0 ci: add dev/beta build track workflows
All checks were successful
dev release / build (push) Successful in 1m7s
Mirrors the new stable/beta/dev track feature landing in bread-ecosystem's
bakery. dev-release.yml publishes on every push to dev; beta-release.yml
publishes on a beta-v* tag. Both skip the GitHub Release upload step and
publish to dl.breadway.dev/{dev,beta}/bread/ via gen-index.sh's new TRACK
env var. See bread-ecosystem/docs/release-channels.md for the full policy.
2026-07-22 09:25:24 +08:00
Breadway
d0f9c6c578 ci: remove GitHub push-mirror workflow 2026-07-21 19:16:45 +08:00
Breadway
d563461d7d Remove leftover GitHub Actions CI workflow (Forgejo is now canonical CI; GitHub is a pure mirror target)
All checks were successful
Mirror to GitHub / mirror (push) Successful in 3s
2026-07-19 03:10:41 +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
1fda781b4c CI: migrate release workflow from GitHub Actions to Forgejo Actions
All checks were successful
Mirror to GitHub / mirror (push) Successful in 2s
release / build (push) Successful in 1m17s
Build and publish package / package (push) Successful in 1m42s
GitHub Actions self-hosted runners need per-repo registration on a
personal account; Forgejo Actions' runner already serves every repo
with zero setup. Moves release publishing there (dl.breadway.dev stays
the primary bakery target; GitHub release upload is kept as the
fallback via an explicit token, since Forgejo Actions has no ambient
GITHUB_TOKEN) and adds a mirror workflow to keep GitHub in sync
automatically.
2026-07-03 14:09:59 +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
0f3136ca8d CI: watch main branch alongside master/dev
All checks were successful
Mirror to GitHub / mirror (push) Successful in 2s
2026-06-19 08:38:37 +08:00
Breadway
954b7f381e Add ready-to-use example modules
Some checks failed
Mirror to GitHub / mirror (push) Successful in 2s
Build and publish package / package (push) Failing after 2m6s
examples/modules/ ships complete, drop-in bread modules for common desktop
automations (low-battery warning, pause-media-on-headphone-unplug,
dock-monitors) plus a README on installing them. Complements Examples.md,
which teaches the porting patterns.
2026-06-16 17:06:44 +08:00
Breadway
152915198b Disable debug package so the main package publishes correctly
Some checks failed
Mirror to GitHub / mirror (push) Successful in 2s
Build and publish package / package (push) Failing after 2m39s
makepkg's debug split produced a -debug pkg; the upload's head -1 could
grab it instead of the main package. !debug yields a single package.
2026-06-13 23:00:46 +08:00
Breadway
623560cea6 Use REGISTRY_TOKEN (scoped write:package) for registry publish
Some checks failed
Mirror to GitHub / mirror (push) Successful in 3s
Build and publish package / package (push) Failing after 2m42s
2026-06-13 22:55:39 +08:00
Breadway
64e756f6eb Disable LTO in PKGBUILD to fix vendored Lua static link
Some checks failed
Mirror to GitHub / mirror (push) Successful in 15s
Build and publish package / package (push) Failing after 3m19s
makepkg's default -flto=auto made mlua's vendored liblua5.4.a contain GCC
LTO bitcode that the Rust (lld) link couldn't read, leaving all lua_*
symbols undefined. options=(!lto) produces a clean static link.
Verified building in a clean archlinux container.
2026-06-13 16:52:54 +08:00
Breadway
d454e832d9 Clone from public URL, not GITHUB_SERVER_URL (resolves to localhost in runner)
Some checks failed
Mirror to GitHub / mirror (push) Successful in 19s
Build and publish package / package (push) Failing after 3m12s
The Forgejo runner injects GITHUB_SERVER_URL as http://localhost:3002, which
is unreachable from inside the job container. Use the public URL instead.
2026-06-13 16:14:13 +08:00
Breadway
73f01e97b4 Rename mirror secret to MIRROR_TOKEN (GITHUB_ prefix is reserved)
Forgejo/gitea rejects user secret names starting with GITHUB_.
2026-06-13 16:10:49 +08:00
Breadway
c70c9a7278 Fix Forgejo workflows for the actual server capabilities
- package.yml: correct Arch registry upload (octet-stream + binary body),
  drop --privileged, manual shell clone (archlinux image has no Node),
  built-in Actions token, --nocheck
- mirror.yml: clone --mirror + explicit refs push with --prune

Requires only the GITHUB_MIRROR_TOKEN secret for the mirror job.
2026-06-13 16:01:58 +08:00
Breadway
4446b5e98b Add Forgejo Actions workflows for mirroring and package publishing
- .forgejo/workflows/mirror.yml: mirrors every push/tag to GitHub
- .forgejo/workflows/package.yml: builds PKGBUILD on tag and publishes
  the bread package to the Forgejo Arch registry (distrib=breadway)

Requires two Forgejo secrets:
  GITHUB_MIRROR_TOKEN — GitHub PAT with repo push scope
  FORGEJO_TOKEN       — Forgejo token with package:write scope
2026-06-13 11:42:06 +08:00
Breadway
3ccb041778 chore: update Cargo.lock for v0.6.1
Some checks failed
release / build (push) Failing after 10s
2026-06-11 14:27:53 +08:00
Breadway
32982b96de chore: bump version to 0.6.1 2026-06-11 14:21:13 +08:00
Breadway
9bbadc5221 fix: update system_deps to accurate Arch package names
Required: systemd-libs (libudev.so.1), openssl, zlib (bread CLI via git2)
Optional: bluez (Bluetooth, graceful degradation), hyprland (IPC features)
Removes empty system_deps placeholder.
2026-06-11 13:37:30 +08:00
Breadway
db4d82f219 fix: use relative symlink for latest to work inside Docker containers 2026-06-07 09:00:23 +08:00
Breadway
3025c485d1 fix: add contents: write permission for GitHub Release creation
Some checks failed
release / build (push) Failing after 19s
2026-06-07 00:00:45 +08:00
Breadway
a9b1992598 fix: create GitHub Release before uploading artifacts 2026-06-06 23:52:34 +08:00
Breadway
109b11c77f fix: skip integration tests in CI (require live daemon) 2026-06-06 23:43:08 +08:00
Breadway
0f430e873d fix: add missing build deps for hestia (Ubuntu) runner 2026-06-06 23:19:48 +08:00
Breadway
76e503b837 Add bakery.toml and release workflow
Wires bread into the bakery ecosystem: prebuilt binaries are published to
dl.breadway.dev and GitHub Releases on every v* tag via the self-hosted
hestia runner. bakery install bread downloads, verifies, and wires the
systemd unit automatically.
2026-06-06 22:31:01 +08:00
Breadway
e57f085e37 Fix CI tar path 2026-05-17 08:40: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
3be8eec065 docs: document sync export/import and updated snapshot layout 2026-05-16 22:17:26 +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
d44ece3649 feat: enhance device normalization and classification
- Introduced a new mechanism in EventNormalizer to suppress duplicate events from child nodes of the same physical device.
- Removed the device classification logic from the normalizer and replaced it with a rule-based system using Lua scripts.
- Added support for user-defined device rules in Lua, allowing for flexible device naming based on various conditions.
- Updated the state engine to handle device rules and resolve device names before dispatching events.
- Modified the installation script to set up default configuration files for the daemon and Lua modules.
- Improved the handling of systemd user services to dynamically set the ExecStart path based on the installation directory.
2026-05-12 21:27:07 +08:00
Breadway
acbf8e1b1b revert 2026-05-12 00:35:09 +08:00