Thor contract, part 1: [gandalf] title tag and a read-only API key for Thor
Lint / JS (eslint) (push) Successful in 14s
Lint / Python (flake8) (push) Successful in 1m47s
Lint / Notify on failure (push) Skipped
Lint / Deploy (push) Skipped
Security / Python Security (bandit) (push) Successful in 1m48s
Lint / JS (eslint) (pull_request) Successful in 12s
Lint / Python (flake8) (pull_request) Successful in 1m0s
Lint / Notify on failure (pull_request) Skipped
Lint / Deploy (pull_request) Skipped
Security / Python Security (bandit) (pull_request) Successful in 1m21s
Test / Python Tests (pytest) (pull_request) Successful in 1m43s
Test / Python Tests (pytest) (push) Successful in 1m6s

Titles move to the shared standard [source][auto][gandalf][network]
Summary [scope][production][issue], built in one place
(ticket_text.title). Checked by running Tinker's TicketHash.php: every
Gandalf title shape hashes the same as before, so open tickets keep
matching.

Thor can read /api/status, /api/events, /api/attention and
/api/suppressions with a machine key (Authorization: Bearer, only its
SHA-256 in config, read-only, optional source CIDRs; a wrong key is a
401 and never falls back to identity headers). /api/suppressions
?include_ended=1&hours=N returns every suppression in force in the
window with start, planned end, actual end and who ended it: new
ended_at/ended_by columns, added automatically.

Refs #66 (items 1 and 2)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jaredandClaude Opus 5.5 committed 2026-11-25 19:51:46 -05:00
1 parent bf5d36ed1e
commit f924ce42c3
9 files changed
+391 -25

No files matched your search

+3 -3
View File
@@ -1096,7 +1096,7 @@ class TestTicketContext:
mon.unifi_fail_thresh = 3
self._mon(mon)._ticket_unifi(1, {'name': 'ap1', 'type': 'uap', 'model': 'U6', 'ip': '1.2.3.4'})
assert mon.tickets.create.call_args.args[0] == \
'[ap1][auto][production][issue][network][single-node] UniFi device offline'
'[ap1][auto][gandalf][network] UniFi device offline [single-node][production][issue]'
def test_remember_uplinks_saves_only_on_change(self, mon, db):
self._mon(mon)
@@ -1487,7 +1487,7 @@ class TestFinishModemRestart:
def test_back_ends_kuma_and_the_silence(self, mon, db):
out, km = self._run(mon, db, self._restart(300), {'reachable': True, 'wan_problems': [], 'uptime_s': 200})
km.assert_called_once_with({'url': 'http://kuma.test'}, False)
db.deactivate_suppression.assert_called_once_with(9)
db.deactivate_suppression.assert_called_once_with(9, ended_by='gandalf')
assert out['back'] and out['rebooted'] and out['back_after_s'] == 300 and out['finished_at'] == self.NOW
def test_waits_while_the_modem_is_down(self, mon, db):
@@ -1505,7 +1505,7 @@ class TestFinishModemRestart:
def test_gives_up_after_half_an_hour(self, mon, db):
out, km = self._run(mon, db, self._restart(1900), {'reachable': False})
assert out['back'] is False and out['back_after_s'] is None and km.called
db.deactivate_suppression.assert_called_once_with(9)
db.deactivate_suppression.assert_called_once_with(9, ended_by='gandalf')
def test_kuma_failure_retries_next_cycle(self, mon, db):
out, _ = self._run(mon, db, self._restart(300), {'reachable': True, 'wan_problems': [], 'uptime_s': 200},