This commit is contained in:
alex wiesner
2026-03-13 13:28:20 +00:00
parent 95974224f8
commit cb208a73c4
62 changed files with 1105 additions and 3490 deletions

View File

@@ -0,0 +1,87 @@
---
title: gate-waybar-pomodoro-visibility-fix
type: gate
permalink: dotfiles/gates/gate-waybar-pomodoro-visibility-fix
tags:
- waybar
- pomodoro
- gate
- pass
---
# Gate: Waybar Pomodoro Visibility Fix
**Status:** PASS
**Date:** 2026-03-12
**Plan ref:** [[waybar-pomodoro-not-showing]]
**Scope:** `.config/waybar/config`, `.config/waybar/scripts/pomodoro-preset.sh`
## Verdict Summary
The implementation correctly addresses the root cause (PATH mismatch between Hyprland/Waybar environment and interactive shell). All four invocation points for `waybar-module-pomodoro` are now explicit, and no residual bare-binary references remain. Both standard and adversarial checks pass.
## Standard Pass
### Acceptance Criteria Verification
| Criterion | Result |
|---|---|
| `custom/pomodoro` exec uses explicit path | ✅ Line 136: `$HOME/.local/bin/waybar-module-pomodoro --no-work-icons` |
| on-click uses explicit path | ✅ Line 137: `$HOME/.local/bin/waybar-module-pomodoro toggle` |
| on-click-middle uses explicit path | ✅ Line 139: `$HOME/.local/bin/waybar-module-pomodoro reset` |
| on-click-right still delegates to preset script | ✅ Line 138 unchanged |
| Preset script no longer uses PATH-dependent guard | ✅ `[[ ! -x "$POMODORO_BIN" ]]` replaces `command -v` |
| Preset script routes all set-* calls through `$POMODORO_BIN` | ✅ Lines 3032 |
| Change is pomodoro-scoped only | ✅ No other modules touched |
| Binary syntax check (`bash -n`) passes | ✅ (Lead evidence, exit 0) |
| Binary exists and responds to `--help` | ✅ (Lead evidence, exit 0 with usage) |
### Pre-mortem Risk Tracking
| Risk | Status |
|---|---|
| Middle-click reset still using bare name | Resolved — line 139 uses explicit path |
| Only one entry point updated | Resolved — all four updated |
| Preset helper using `command -v` | Resolved — replaced with `[[ ! -x ... ]]` |
| Binary path unstable across sessions | Not triggered — binary confirmed at path |
## Adversarial Pass
### Hypotheses
| # | Hypothesis | Design | Expected failure | Observed |
|---|---|---|---|---|
| H1 | Empty/corrupt STATE_FILE causes crash | State file exists but empty | `current` reads as `""`, falls to else-branch | Safe: defaults to B-preset (short cycle), no crash |
| H2 | Binary missing/non-executable | Guard `[[ ! -x ]]` fires | Exit 1 with stderr | Guard correctly triggers, script exits cleanly |
| H3 | `$HOME` unset in Waybar env | `$HOME/.local/bin/...` fails to expand | Module fails silently | Same risk applies to all other modules using `$HOME` (line 94: `custom/uptime`); no regression introduced |
| H4 | `set -e` aborts mid-preset (daemon down) | First `set-work` fails → remaining calls skipped | Partial preset applied | Pre-existing behavior; not a regression from this change |
| H5 | STATE_FILE lost on reboot (`/tmp`) | Preset reverts to A-cycle | Unexpected preset on first right-click post-reboot | Intentional design, not a regression |
| H6 | No bare `pomodoro` left anywhere in config | Grep scan | Old reference found | Zero old references found — clean |
### Mutation Checks
| Mutation | Would current tests detect? |
|---|---|
| One of exec/on-click/on-click-middle reverted to bare name | Yes — structural grep confirms all three use explicit path |
| `POMODORO_BIN` guard inverted (`-x` instead of `! -x`) | Yes — guard would skip missing-binary error |
| `read -r current` without fallback | Caught — `|| current="A"` handles failure |
| `set-work` but not `set-short`/`set-long` through `$POMODORO_BIN` | Yes — all three lines verified |
**MUTATION_ESCAPES: 0/4**
## Unverified Aspects (Residual Risk)
1. **Live Waybar rendering** — Cannot verify the module actually appears on the bar without a running Waybar session. The Lead noted this is impractical in the task context.
2. **Binary behavior correctness**`--help` confirms the binary exists and accepts the right subcommands, but actual timer JSON output format was not sampled. The `return-type: json` config assumes the binary outputs conforming JSON.
3. **`$HOME` behavior under Waybar systemd unit** — Low risk (all other `$HOME`-using modules work), but not runtime-confirmed.
These residual risks are infrastructure-gated (no running Wayland/Waybar session available in this context), not implementation defects.
## Lesson Checks
- [confirmed] PATH mismatch is the failure mode for Waybar custom modules — explicit paths are the correct fix pattern.
- [confirmed] `[[ ! -x path ]]` guard is the right check for script-invoked binary dependencies.
- [not observed] Any silent failures from the old `command -v` approach (fix is in place, no regression).
## Relations
- resolves [[waybar-pomodoro-not-showing]]