diff --git a/configs/waybar/style.css b/configs/waybar/style.css index bc3338d..2685258 100644 --- a/configs/waybar/style.css +++ b/configs/waybar/style.css @@ -204,16 +204,14 @@ tooltip { /* custom/sy-syauth — compact phone-as-key pill rendered by * `sy syauth --waybar` (see crates/sy-auth/src/syauth.rs::render_pill). Text is - * always the 🔑 emoji (pair flow adds the 6-digit code beside it). + * always the key glyph (pair flow adds the 6-digit code beside it). * Color carries the state; full status goes to the tooltip. - * .ok — phone reachable / in-flight challenge → cyan - * .reconnecting — recent transport-error or timeout → yellow + * .ok — daemon ready / in-flight challenge → cyan * .degraded — daemon down OR permanent denied → red * .unpaired — no phone is bonded yet → red * .pending — LESC pair confirmation awaiting accept → green */ #custom-sy-syauth.ok { color: @aqua; } -#custom-sy-syauth.reconnecting { color: @yellow; } #custom-sy-syauth.degraded { color: @red; } #custom-sy-syauth.unpaired { color: @red; } #custom-sy-syauth.pending { color: @green; font-weight: bold; } diff --git a/crates/sy-auth/src/syauth.rs b/crates/sy-auth/src/syauth.rs index 42ab660..90ddd57 100644 --- a/crates/sy-auth/src/syauth.rs +++ b/crates/sy-auth/src/syauth.rs @@ -183,9 +183,7 @@ pub fn parse_doctor_json(src: &str) -> Result /// Rendered waybar slot output. The waybar `custom/` module consumes /// `{text, tooltip, class}`; we keep the struct narrow so the -/// emitter can decide whether to omit `class` (no class hook needed -/// when no bond is in play and the CSS table only carries the five -/// step-2 states). +/// emitter can describe daemon readiness separately from request history. #[derive(Debug, Clone, PartialEq, Eq)] pub struct WaybarPill { pub text: String, @@ -199,13 +197,10 @@ pub struct WaybarPill { /// the state-driven color never showed through. Requires /// `JetBrainsMono Nerd Font` (the bar's default — see /// `configs/waybar/style.css` font-family). -const PILL_GLYPH_KEY: char = '\u{F084}'; // +const PILL_GLYPH_KEY: char = '\u{F084}'; -/// "Recent" cutoff for last-audit-outcome → pill state. The window -/// must outlive a single sudo + biometric reaction (≈3 s) but be -/// short enough that an old denied row doesn't permanently stick -/// the pill red. 10 minutes mirrors the operator-facing -/// troubleshooting threshold in `docs/syauth-setup.md`. +/// Show confirmed authorization failures in red for ten minutes. +/// Unanswered requests and transport failures remain in history only. const PILL_RECENT_OUTCOME_MS: u64 = 10 * 60 * 1000; /// Render the pill from a parsed status + doctor pair + last audit @@ -214,9 +209,9 @@ const PILL_RECENT_OUTCOME_MS: u64 = 10 * 60 * 1000; /// `audit_log_tail` row (if any), and a wall-clock `now_ms` through. /// /// State precedence: -/// `degraded` > `unpaired` > `active` > `ok`. -/// Daemon-down / recent-denied is the operator's most actionable -/// signal, so it wins. Pair-pending pre-empts everything earlier in +/// `degraded` > `unpaired` > `ok`. +/// Daemon-down and confirmed authorization errors need attention. +/// Pair-pending pre-empts everything earlier in /// the call chain; this fn never sees a pending request — the caller /// branches on the request file first, mirroring the existing /// `waybar_out` path. @@ -235,7 +230,7 @@ pub fn render_pill( ) -> WaybarPill { let icon = PILL_GLYPH_KEY.to_string(); let recent_denied = last_outcome.and_then(|o| { - let denied = matches!(o.kind, OutcomeKind::Denied(_)); + let denied = matches!(&o.kind, OutcomeKind::Denied(r) if !denied_is_transient(r)); let age_ms = now_ms.saturating_sub(o.t_end_ms); if denied && age_ms <= PILL_RECENT_OUTCOME_MS { Some(o) @@ -248,25 +243,19 @@ pub fn render_pill( } else if !status.has_peer() { ("unpaired", "no phone bonded".to_string()) } else if let Some(o) = recent_denied { - let (class, label) = match &o.kind { - OutcomeKind::Denied(r) if denied_is_transient(r) => ("reconnecting", "reconnecting"), - OutcomeKind::Denied(_) => ("degraded", "phone away"), - OutcomeKind::Ok => ("ok", "phone reachable"), - }; let reason = match &o.kind { OutcomeKind::Denied(r) => denied_reason_text(r), OutcomeKind::Ok => "ok", }; - (class, format!("{label} · last {reason}")) + ("degraded", format!("last authentication failed · {reason}")) } else if in_flight > 0 { - // In-flight challenge is the "phone is being used right now" - // state — the operator's mental model is "cyan because sudo - // works". Surface the activity in the headline; keep the - // color cyan so a healthy sudo doesn't flash yellow every - // 2-3 s. + // A pending request does not establish whether the phone is nearby. ("ok", format!("authenticating · {in_flight} in flight")) } else { - ("ok", "phone reachable".to_string()) + ( + "ok", + "daemon ready · phone availability unknown".to_string(), + ) }; let tip = build_pill_tooltip(status, doctor, last_outcome, now_ms, host, &headline); WaybarPill { @@ -282,15 +271,15 @@ fn denied_reason_text(r: &DeniedReason) -> &'static str { DeniedReason::NoBond => "no bond", DeniedReason::AuthError => "auth error", DeniedReason::TransportError => "transport error", + DeniedReason::Other(reason) if reason == "response-timeout" => { + "approval timed out (phone may be away)" + } DeniedReason::Other(_) => "denied", } } -/// Whether a denied outcome looks transient (yellow / reconnecting) -/// or permanent (red / degraded). Transport-error and any unknown -/// reason are transient — the daemon will likely succeed on the -/// next attempt once the phone reconnects. Peer-revoked / no-bond / -/// auth-error are operator-actionable problems. +/// Unanswered requests, transport failures, and unknown outcomes do not +/// establish an ongoing fault. Known authorization errors need attention. fn denied_is_transient(r: &DeniedReason) -> bool { matches!(r, DeniedReason::TransportError | DeniedReason::Other(_)) } @@ -308,7 +297,7 @@ fn build_pill_tooltip( Some(pid) => { let head: String = pid.chars().take(8).collect(); let suffix = match status.last_connect_ms_ago { - Some(ms) => format!(" · last connect {} ago", humanize_ms_ago(ms)), + Some(ms) => format!(" · last request {} ago", humanize_ms_ago(ms)), None => String::new(), }; lines.push(format!("peer {head}\u{2026}{suffix}")); @@ -967,8 +956,8 @@ fn waybar_out() -> Result<()> { println!("{}", emit_pill_json(&text, "pending", &tip)); return Ok(()); } - // No pending pair request: render the live four-class pill - // (red / aqua / yellow + pending-green). Failures of either + // No pending pair request: render daemon readiness and request history. + // Failures of either // upstream probe fall through to `degraded` (red) so the bar // never goes blank. let outcomes = live_audit_outcomes(); @@ -1704,7 +1693,9 @@ mod tests { pill.tooltip.contains("fedora"), "tooltip carries host: {pill:?}" ); - assert!(pill.tooltip.contains("phone reachable"), "got: {pill:?}"); + assert!(pill.tooltip.contains("daemon ready"), "got: {pill:?}"); + assert!(!pill.tooltip.contains("phone reachable"), "got: {pill:?}"); + assert!(!pill.tooltip.contains("last connect"), "got: {pill:?}"); } #[test] @@ -1772,9 +1763,7 @@ mod tests { } #[test] - fn waybar_renders_reconnecting_on_recent_transient_denied() { - // response-timeout (parsed as DeniedReason::Other) and - // transport-error are both transient → yellow, not red. + fn waybar_stays_ok_after_an_unanswered_approval() { let s = parse_status_json(FIXTURE_BONDED).expect("fixture parses"); let now: u64 = 1_779_200_000_000; let timeout = UnlockOutcome { @@ -1785,8 +1774,11 @@ mod tests { kind: OutcomeKind::Denied(DeniedReason::Other("response-timeout".to_string())), }; let pill = render_pill(&s, 0, &doctor_unknown(), Some(&timeout), now, "fedora"); - assert_eq!(pill.class, "reconnecting", "got: {pill:?}"); - assert!(pill.tooltip.contains("reconnecting"), "got: {pill:?}"); + assert_eq!(pill.class, "ok", "got: {pill:?}"); + assert!(!pill.tooltip.contains("reconnecting"), "got: {pill:?}"); + assert!(pill.tooltip.contains("approval timed out"), "got: {pill:?}"); + let next = render_pill(&s, 1, &doctor_unknown(), Some(&timeout), now, "fedora"); + assert!(next.tooltip.contains("authenticating · 1 in flight")); } #[test] @@ -1804,16 +1796,15 @@ mod tests { }; let pill = render_pill(&s, 0, &doctor_unknown(), Some(&revoked), now, "fedora"); assert_eq!(pill.class, "degraded", "got: {pill:?}"); - assert!(pill.tooltip.contains("phone away"), "got: {pill:?}"); + assert!( + pill.tooltip.contains("last authentication failed"), + "got: {pill:?}" + ); assert!(pill.tooltip.contains("peer revoked"), "got: {pill:?}"); } #[test] - fn waybar_renders_reconnecting_when_recent_unlock_was_transport_error() { - // The operator-facing "trying to reach phone" signal is a - // recent transport-error in the audit log. Inside the 10-min - // window the pill goes yellow (reconnecting); outside, it - // stays cyan. + fn waybar_keeps_transport_failure_in_history_without_claiming_reconnection() { let s = parse_status_json(FIXTURE_BONDED).expect("fixture parses"); let now: u64 = 1_779_200_000_000; let recent = UnlockOutcome { @@ -1824,7 +1815,8 @@ mod tests { kind: OutcomeKind::Denied(DeniedReason::TransportError), }; let pill = render_pill(&s, 0, &doctor_unknown(), Some(&recent), now, "fedora"); - assert_eq!(pill.class, "reconnecting", "got: {pill:?}"); + assert_eq!(pill.class, "ok", "got: {pill:?}"); + assert!(!pill.tooltip.contains("reconnecting"), "got: {pill:?}"); assert!(pill.tooltip.contains("transport error"), "got: {pill:?}"); } diff --git a/crates/sy-auth/tests/standalone.rs b/crates/sy-auth/tests/standalone.rs index a9fd622..7a108a6 100644 --- a/crates/sy-auth/tests/standalone.rs +++ b/crates/sy-auth/tests/standalone.rs @@ -29,3 +29,44 @@ fn auth_accepts_launcher_global_paths() { String::from_utf8_lossy(&output.stderr) ); } + +#[test] +fn unanswered_phone_approval_keeps_the_applet_ready() { + use std::{fs, os::unix::fs::PermissionsExt, time::SystemTime}; + + let root = tempfile::tempdir().unwrap(); + let upstream = root.path().join("syauth"); + fs::write( + &upstream, + "#!/bin/sh\nprintf '%s\\n' '{\"daemon\":{\"state\":\"up\",\"peers\":[{\"peer_id\":\"phone\",\"in_flight_challenges\":0}]},\"bluez_adapter\":\"unknown\"}'\n", + ) + .unwrap(); + fs::set_permissions(&upstream, fs::Permissions::from_mode(0o700)).unwrap(); + let now_ms = SystemTime::now() + .duration_since(SystemTime::UNIX_EPOCH) + .unwrap() + .as_millis(); + let audit = root.path().join("audit.log"); + fs::write( + &audit, + format!("phone,nonce,{now_ms},{now_ms},response-timeout,response-timeout\n"), + ) + .unwrap(); + let output = Command::new(env!("CARGO_BIN_EXE_sy-system-auth")) + .args(["syauth", "--waybar"]) + .env("SY_SYAUTH_BIN", &upstream) + .env("SY_SYAUTH_AUDIT_LOG", &audit) + .env("XDG_RUNTIME_DIR", root.path()) + .env("XDG_STATE_HOME", root.path()) + .env("DBUS_SESSION_BUS_ADDRESS", "unix:path=/nonexistent") + .output() + .unwrap(); + assert!(output.status.success()); + let pill: serde_json::Value = serde_json::from_slice(&output.stdout).unwrap(); + assert_eq!(pill["class"], "ok"); + let tooltip = pill["tooltip"].as_str().unwrap(); + assert!(tooltip.contains("daemon ready")); + assert!(tooltip.contains("approval timed out (phone may be away)")); + assert!(!tooltip.contains("reconnecting")); + assert!(!tooltip.contains("phone reachable")); +} diff --git a/docs/how-to/troubleshoot-syauth.md b/docs/how-to/troubleshoot-syauth.md index 996ef68..6f28f07 100644 --- a/docs/how-to/troubleshoot-syauth.md +++ b/docs/how-to/troubleshoot-syauth.md @@ -22,6 +22,42 @@ working state. ## Steps +### A request times out while the phone is away + +An unanswered approval records a timeout for that request. The key stays cyan +while the daemon runs and has a phone bond. Hover over the key to see +`approval timed out (phone may be away)` in the request history. Transport errors +also appear in that history. + +The `daemon ready` message describes the local service. That status doesn't confirm +the phone's availability. A successful approval confirms the connection for +that request. Red marks a stopped daemon, a missing bond, or an authorization +error. A new request shows `authenticating` even after an earlier timeout. +Keep the existing pairing and service running when an approval expires. + +### Bluetooth is on but the phone can't discover the desktop + +Check both the desktop advertisement and the daemon process: + +```bash +bluetoothctl show +journalctl --user -u syauth-presenced.service -n 25 --no-pager +``` + +Zero `ActiveInstances` together with repeated `rotation failed` and +`target object was either not present or removed` indicates a missing desktop +advertisement. The controller can be renumbered from `hci0` to `hci1` after +reinitialization. Older daemons hardcode `hci0`, so restarting the same build +can leave only its RPC socket running with `orchestrator not started` in the +journal. A daemon status of `up` alone does not establish Bluetooth readiness. + +The adapter-selection repair uses BlueZ's available default controller at +startup. After installing that repair, restart `syauth-presenced.service` and +verify advertising and a fresh phone subscription. Keep the existing bond; +pairing again does not repair an absent desktop adapter. See the +[adapter investigation](../../specs/bugs/BUG-20261031-1221.md) for validation +and deployment status. + ### Desktop apps skip phone and FIDO authentication PolicyKit authenticates through `polkit-1`, while sudo uses `sudo`. diff --git a/llms-full.txt b/llms-full.txt index 1580a9f..62a922b 100644 --- a/llms-full.txt +++ b/llms-full.txt @@ -1876,6 +1876,42 @@ working state. ### Steps +#### A request times out while the phone is away + +An unanswered approval records a timeout for that request. The key stays cyan +while the daemon runs and has a phone bond. Hover over the key to see +`approval timed out (phone may be away)` in the request history. Transport errors +also appear in that history. + +The `daemon ready` message describes the local service. That status doesn't confirm +the phone's availability. A successful approval confirms the connection for +that request. Red marks a stopped daemon, a missing bond, or an authorization +error. A new request shows `authenticating` even after an earlier timeout. +Keep the existing pairing and service running when an approval expires. + +#### Bluetooth is on but the phone can't discover the desktop + +Check both the desktop advertisement and the daemon process: + +```bash +bluetoothctl show +journalctl --user -u syauth-presenced.service -n 25 --no-pager +``` + +Zero `ActiveInstances` together with repeated `rotation failed` and +`target object was either not present or removed` indicates a missing desktop +advertisement. The controller can be renumbered from `hci0` to `hci1` after +reinitialization. Older daemons hardcode `hci0`, so restarting the same build +can leave only its RPC socket running with `orchestrator not started` in the +journal. A daemon status of `up` alone does not establish Bluetooth readiness. + +The adapter-selection repair uses BlueZ's available default controller at +startup. After installing that repair, restart `syauth-presenced.service` and +verify advertising and a fresh phone subscription. Keep the existing bond; +pairing again does not repair an absent desktop adapter. See the +[adapter investigation](../../specs/bugs/BUG-20261031-1221.md) for validation +and deployment status. + #### Desktop apps skip phone and FIDO authentication PolicyKit authenticates through `polkit-1`, while sudo uses `sudo`. diff --git a/packaging/sy.spec b/packaging/sy.spec index a2bd11e..5543488 100644 --- a/packaging/sy.spec +++ b/packaging/sy.spec @@ -1,4 +1,6 @@ %global debug_package %{nil} +# Release packages strip symbols; omit unused DWARF during compilation too. +%global rustflags_debuginfo 0 Name: sy Version: 0.1.0 @@ -8,6 +10,8 @@ License: MIT URL: https://github.com/dmytrogajewski/sy Source0: %{name}-%{version}.tar.gz BuildRequires: cargo +BuildRequires: binutils +BuildRequires: python3 BuildRequires: rust BuildRequires: gcc BuildRequires: gcc-c++ @@ -121,6 +125,7 @@ cargo build --release --locked --workspace --bins cp target/release/sy target/release/sy-all %check +python3 tests/rpm_build_flags.py SY_FEATURE_BIN_DIR=/nonexistent target/release/sy-launcher --help | grep -q 'Optional packages' SY_FEATURE_BIN_DIR=target/release target/release/sy-launcher --help | grep -q 'apply' SY_FEATURE_BIN_DIR=target/release target/release/sy-launcher --help | grep -q '^Usage: sy ' diff --git a/scripts/build-rpms.sh b/scripts/build-rpms.sh index a1afed5..018e36a 100755 --- a/scripts/build-rpms.sh +++ b/scripts/build-rpms.sh @@ -59,7 +59,7 @@ for fedora in "${releases[@]}"; do cp "$repo_root/packaging/sy.spec" "$work/sy.spec" tar -C "$repo_root" --transform="s,^,sy-$version/," \ -czf "$work/SOURCES/sy-$version.tar.gz" \ - Cargo.toml Cargo.lock LICENSE README.md src crates configs themes scripts packaging/sy.1 packaging/default-sy.toml + Cargo.toml Cargo.lock LICENSE README.md src crates configs themes scripts tests/rpm_build_flags.py packaging/sy.1 packaging/default-sy.toml if [[ $native == true ]]; then rpmbuild -ba "$work/sy.spec" --define "_topdir $work" \ --define "_rpmdir $work/RPMS" --define "_srcrpmdir $work/SRPMS" @@ -88,7 +88,7 @@ for fedora in "${releases[@]}"; do --setopt=keepcache=True \ --setopt=max_parallel_downloads=8 \ --setopt=timeout=120 --setopt=minrate=1 --setopt=retries=20 \ - "${repo_args[@]}" install -y rpm-build cargo rust gcc gcc-c++ cmake pkgconf-pkg-config \ + "${repo_args[@]}" install -y rpm-build cargo rust gcc gcc-c++ cmake pkgconf-pkg-config python3 \ alsa-lib-devel openssl-devel systemd-devel libxkbcommon-devel rpmbuild -ba /build/sy.spec --define "_topdir /build" \ --define "_rpmdir /build/RPMS" --define "_srcrpmdir /build/SRPMS" diff --git a/specs/bugs/BUG-20261031-1221.md b/specs/bugs/BUG-20261031-1221.md new file mode 100644 index 0000000..6aed40f --- /dev/null +++ b/specs/bugs/BUG-20261031-1221.md @@ -0,0 +1,76 @@ +# BUG-20261031-1221: Phone discovery fails after Bluetooth adapter renumbering + +## Summary + +The phone cannot discover the desktop because syauth retains an absent `hci0` +while BlueZ exposes the working controller as `hci1`. + +## Reproduction + +- Method: live host and radio regression in sibling syauth. +- Commands: `bluetoothctl list`, `bluetoothctl show`, + `journalctl --user -u syauth-presenced.service -n 25 --no-pager`. +- Evidence: powered controller `50:BB:B5:B9:93:AB`, zero active advertisements; + repeated `rotation failed ... advertise: the target object was either not + present or removed`. BlueZ audio logs use `hci0` on October 27 and `hci1` on + October 29–30. +- An approved daemon restart at 12:21:07 produced `orchestrator not started; + daemon will serve socket only ... adapter set_powered: the target object was + either not present or removed`. The status RPC still reported `state: up`. + +## Expected + +The daemon selects an adapter present in BlueZ and advertises the existing +bond's rotating UUID so the phone reconnects without pairing again. + +## Actual + +The process and RPC socket remain available with no usable Bluetooth transport. +Enabling Bluetooth on the phone cannot recreate the desktop advertisement. + +## Root Cause + +Sibling syauth's `crates/syauth-presenced/src/runtime.rs` initializes +`PersistentPeripheral::new(DEFAULT_ADAPTER_NAME)` with the constant `hci0`. +The named bluer adapter handle does not check object existence until a property +operation. Controller renumbering invalidates the retained handle, and even a +restart repeats the absent adapter selection. + +## Fix + +Select BlueZ's available default adapter for daemon startup. Preserve explicit +adapter selection for callers that request a particular controller. Runtime +recovery after another controller removal remains a separate acceptance concern. + +## Traceability + +- Radio regression: sibling `crates/syauth-transport/src/peripheral.rs`: + `persistent_peripheral_opens_default_bluez_adapter` (explicitly gated). +- Implementation: sibling transport constructor and presenced runtime. +- Before the change, the live regression failed with `adapter set_powered: the + target object was either not present or removed`. After selecting the BlueZ + default, the same regression passed against the current controller. +- The release binary was exercised for 15 seconds on an isolated socket and + pidfile with the existing bond store. At 12:26:41 it registered GATT and + advertised the rotating UUID; `bluetoothctl show` reported one active + advertisement. At 12:26:53 it logged `phone subscribed via standard + notifications`. The probe drained cleanly on SIGTERM. +- syauth workspace: 474 passing test results, zero failures, 10 ignored; + real-radio regression also passed explicitly. Native package source tests: + 14 passed. Clippy and formatting pass. The complete lint target fails at + dependency advisories for `basic-toml`, `ctutils`, and Tokio. +- Native RPM `syauth-0.1.0-5.fc44.x86_64` was built from bounded working-tree + source and installed with DNF. The managed service restarted at 12:29:06, + advertised at 12:29:08, and logged a fresh phone subscription at 12:29:10. + `rpm -V syauth` passes; the saved bond-file SHA-256 remains unchanged and + the bond directory retains its user ownership and private modes. +- `timeout 25 sudo -k /usr/bin/true` returned zero. The daemon logged + `outcome=ok` for the 12:29:27.913–12:29:30.386 challenge, and PAM logged + `unlock success reason=granted`. End-to-end phone approval took 2.473 seconds. + A preliminary `sudo -k -n` check refused authentication without invoking the + phone; the actual verification used a PTY and fresh authentication. +- sy workspace: 1,740 passing test results, zero failures, 12 ignored. + `make lint`, `make lint-spark`, and `make test-spark` pass; the bridge has + 18 passing tests. The syauth dependency-audit failures above remain open. +- This repair selects an available controller on startup; it does not add + automatic transport reconstruction after a later controller removal. diff --git a/specs/bugs/BUG-20261101-0319.md b/specs/bugs/BUG-20261101-0319.md new file mode 100644 index 0000000..5dc4afd --- /dev/null +++ b/specs/bugs/BUG-20261101-0319.md @@ -0,0 +1,99 @@ +# BUG-20261101-0319: Yellow syauth key reports an old timeout as reconnection + +## Summary + +The applet displays a yellow “reconnecting” key for ten minutes after an +unanswered authentication request, which can be mistaken for a lost phone. + +## Reproduction + +- Method: live desktop logs, applet output, and renderer inspection. +- Commands: `sy syauth --waybar`, `bluetoothctl show`, + `bluetoothctl devices Connected`, and + `journalctl --user -u syauth-presenced.service -b --no-pager`. +- At 03:07:35 the daemon sent a challenge; it timed out at 03:07:43. + The user confirmed the phone was away and they did not approve it. +- At investigation start, 03:17:19, the outcome was still inside the applet's + ten-minute failure window. At 03:18:44, the same unchanged daemon and bond + produced `class: ok`, with the old denied outcome still in its tooltip. +- The adapter was powered, had one active advertisement, and continued rotating + session UUIDs. BlueZ reported the bonded phone connected. A subscription was + recorded at 03:00:29, and a phone response write at 03:18:47. +- A fresh diagnostic challenge at 03:19:07 also timed out at 03:19:15, changing + the applet back to `class: reconnecting`. The sudo command subsequently + completed after presenting FIDO authentication; this is not evidence of + successful phone authentication. The user reported that it looked working. + +## Expected + +An unanswered or late approval is shown as the outcome of that request. +Current connection health and historical authentication outcomes are distinct. + +## Actual + +An unanswered request produces a connection-recovery headline for ten minutes. +Expiry alone changes it to “phone reachable,” without a new connection probe +or successful authentication. + +## Root Cause + +`crates/sy-auth/src/syauth.rs::render_pill` selects recent denied outcomes ahead +of other activity. `response-timeout` parses as `DeniedReason::Other` and +`denied_is_transient` maps it to `reconnecting`. The class remains until +`PILL_RECENT_OUTCOME_MS` (ten minutes) expires or a newer outcome supersedes it. +`denied_reason_text` also reduces that timeout to the generic text “denied.” +Waybar refreshes the command every second, so this is the renderer's policy, +not an unrefreshed bar. The upstream `last_connect_ms_ago` field is stamped when +a challenge is issued; it cannot independently prove a current phone link. +BlueZ's overall connected flag also does not prove application-level readiness. + +## Investigation Result + +The yellow key does not establish a recurrence of the missing-adapter bug. +Advertising and UUID rotation worked throughout this investigation, without +restarting the service, changing Bluetooth state, or altering the bond. +There is no phone-side log capture because USB debugging was unavailable. +Successful phone approval was not verified during this investigation. + +## Fix + +Timed-out approvals and transient transport failures remain in the tooltip's +request history and do not change the key's normal class. Timeouts are labelled +“approval timed out (phone may be away).” The idle headline describes daemon +readiness and states that phone availability is unknown. The legacy timestamp +is labelled “last request” because the upstream daemon stamps it on challenges. +Confirmed authorization errors, daemon-down, and unpaired states still retain +their warnings. Old unanswered requests cannot mask an in-flight request. + +## Traceability + +- Renderer: `crates/sy-auth/src/syauth.rs::render_pill`, + `denied_is_transient`, and `denied_reason_text`. +- Regression `waybar_stays_ok_after_an_unanswered_approval` first failed with + `class: reconnecting`, then passed after the filter change. It also preserves + the specific timeout reason and checks visibility of a subsequent request. +- Other renderer tests cover normal readiness, permanent authorization errors, + transport failure history, daemon-down, and unpaired states. +- `crates/sy-auth/tests/standalone.rs` runs the real applet executable with a + temporary audit log and upstream CLI fixture. A fresh unanswered approval + emits `class: ok`, readiness text, and the precise timeout history. +- `configs/waybar/style.css` removes the unused yellow reconnection class. +- Full verification: `make lint` passes; `make test` reports 1,741 passing + tests, zero failures, and 12 ignored. Spark lint passes and the bridge's + 18 tests pass. The changed documents pass spelling and Markdown lint; + generated LLM documentation passes its freshness check. +- The release executable was exercised against the live audit log with a + 19-second-old timeout: it emitted `class: ok`, daemon readiness, and + “approval timed out (phone may be away).” No new approval was requested for + that probe. +- The first native RPM build staged under `/tmp` failed two deployment checks + requiring filesystem reflinks (`FICLONE` returned `EOPNOTSUPP` on `tmpfs`). + Rebuild with `TMPDIR` set to `target/applet-rpm-work` on the repository's + `btrfs` filesystem, preserving all package checks. +- Native package checks pass on the supported staging filesystem. The repaired + `sy-system-auth-0.1.0-23.fc44` RPM was reinstalled through DNF; package + verification with `rpm -V sy-system-auth` passes. +- The installed `/usr/bin/sy syauth --waybar` emitted `class: ok` with a + nine-second-old real timeout, the readiness headline, and the precise + unanswered-approval history. The running presence daemon remained active + with PID 4334 throughout deployment; no Bluetooth or bond changes were made. diff --git a/specs/bugs/BUG-20261101-0421.md b/specs/bugs/BUG-20261101-0421.md new file mode 100644 index 0000000..4756b29 --- /dev/null +++ b/specs/bugs/BUG-20261101-0421.md @@ -0,0 +1,50 @@ +# BUG-20261101-0421: Fedora RPM build exhausts disk quota during release linking + +## Summary + +Fedora 45 RPM CI failed while producing release binaries because the runner +exhausted its disk quota during compilation and linking. + +## Reproduction + +- Run: https://github.com/dmytrogajewski/sy/actions/runs/41258424128 +- Failed job: Fedora 45 package build, commit `2af4d98`. +- Evidence: `rustc-LLVM ERROR: IO failure on output stream: Disk quota exceeded` + followed by failures building file manager, monitoring, and desktop binaries. +- The compiler command included `-Cdebuginfo=2` and `-Cstrip=none`, overriding + Cargo's stripped release profile. Fedora 43 and 44 passed in the same matrix. +- The object-file regression failed under the original RPM defaults because + `readelf` found `.debug_info` in a compiled Rust fixture. + +## Expected + +Release builds omit debug data that the RPM never distributes and preserve +the existing optimization and hardening settings. + +## Actual + +The spec disables debug packages and strips shipped binaries, but RPM's +compiler flags still generate full DWARF data throughout the build. That data +increases intermediate object sizes and disk demand during release linking. + +## Root Cause + +`debug_package` controls debug RPM generation separately from the +`rustflags_debuginfo` macro used by Fedora's `build_rustflags`. Disabling debug +packages alone leaves the default debug-information level at two. + +## Fix + +Set `rustflags_debuginfo` to zero in `packaging/sy.spec`. Keep Fedora's other +compiler flags and all package checks. Include `tests/rpm_build_flags.py` in +the source archive and run it during the RPM check phase. The test compiles a +retained Rust function-pointer object with the actual build environment's +flags, confirms the symbol exists, and rejects unused DWARF sections. + +## Traceability + +- Regression: `tests/rpm_build_flags.py::ReleaseFlags`. +- Configuration: `packaging/sy.spec` and `scripts/build-rpms.sh`. +- Local regression: fails with the original flags and passes after RPM expands + the repaired spec to `-Cdebuginfo=0`. +- Fedora matrix verification is pending. diff --git a/tests/rpm_build_flags.py b/tests/rpm_build_flags.py new file mode 100644 index 0000000..0a88240 --- /dev/null +++ b/tests/rpm_build_flags.py @@ -0,0 +1,29 @@ +"""Check release object output using the RPM build's actual compiler flags.""" + +import os +import shlex +import subprocess +import tempfile +import unittest +from pathlib import Path + + +class ReleaseFlags(unittest.TestCase): + def test_release_objects_omit_unused_debug_info(self): + with tempfile.TemporaryDirectory() as temporary: + source = Path(temporary) / "probe.rs" + object_file = source.with_suffix(".o") + source.write_text("#[used] static PROBE: fn(u64) -> u64 = |x| x.wrapping_add(1);\n") + flags = shlex.split(os.environ["RUSTFLAGS"]) + subprocess.run( + ["rustc", "--crate-type=lib", "--emit=obj", *flags, str(source)], + cwd=temporary, check=True, + ) + sections = subprocess.check_output(["readelf", "-SW", str(object_file)], text=True) + symbols = subprocess.check_output(["nm", str(object_file)], text=True) + self.assertIn("PROBE", symbols) + self.assertNotIn(".debug_info", sections) + + +if __name__ == "__main__": + unittest.main()