fix: apply ruff auto-fixes and add hk git hooks

- Fix pre-existing lint errors in engine/ modules using ruff --unsafe-fixes
- Add hk.pkl with pre-commit and pre-push hooks using ruff builtin
- Configure hooks to use 'uv run' prefix for tool execution
- Update mise.toml to include hk and pkl tools
- All 73 tests pass

fix: apply ruff auto-fixes and add hk git hooks

- Fix pre-existing lint errors in engine/ modules using ruff --unsafe-fixes
- Add hk.pkl with pre-commit and pre-push hooks using ruff builtin
- Configure hooks to use 'uv run' prefix for tool execution
- Update mise.toml to include hk and pkl tools
- Use 'hk install --mise' for proper mise integration
- All 73 tests pass
This commit is contained in:
2026-03-15 14:43:39 -07:00
parent 4844a64203
commit 757c854584
16 changed files with 286 additions and 185 deletions

View File

@@ -26,7 +26,7 @@ class NtfyPoller:
self.topic_url = topic_url
self.reconnect_delay = reconnect_delay
self.display_secs = display_secs
self._message = None # (title, body, monotonic_timestamp) or None
self._message = None # (title, body, monotonic_timestamp) or None
self._lock = threading.Lock()
def start(self):
@@ -55,7 +55,7 @@ class NtfyPoller:
"""Build the stream URL, substituting since= to avoid message replays on reconnect."""
parsed = urlparse(self.topic_url)
params = parse_qs(parsed.query, keep_blank_values=True)
params['since'] = [last_id if last_id else '20s']
params["since"] = [last_id if last_id else "20s"]
new_query = urlencode({k: v[0] for k, v in params.items()})
return urlunparse(parsed._replace(query=new_query))
@@ -65,7 +65,8 @@ class NtfyPoller:
try:
url = self._build_url(last_id)
req = urllib.request.Request(
url, headers={"User-Agent": "mainline/0.1"})
url, headers={"User-Agent": "mainline/0.1"}
)
# timeout=90 keeps the socket alive through ntfy.sh keepalive heartbeats
resp = urllib.request.urlopen(req, timeout=90)
while True:
@@ -73,7 +74,7 @@ class NtfyPoller:
if not line:
break # server closed connection — reconnect
try:
data = json.loads(line.decode('utf-8', errors='replace'))
data = json.loads(line.decode("utf-8", errors="replace"))
except json.JSONDecodeError:
continue
# Advance cursor on every event (message + keepalive) to