fix(media-home): repair scrutiny round-1 doc-vs-reality findings

jellyfin: send the access token over exactly ONE channel per request (drop
the simultaneous X-Emby-Token header; the MediaBrowser Token= parameter is
the sole transport, legacy fallback remains documented as substitute-never-
stack and is request-capture tested); remove the dead no-op conditional in
JellyfinClient.__init__; make the login error-path test exception-safe with
patch.object; document the test-pinned dry-run plan keys and the actual
0/1/2 exit-code mapping in worked-recipes and SKILL.md.

peertube: replace the stale dry-run shape prose ('url'/'form') with the
test-pinned {dry_run, method, path, params} / form_fields keys; harden
cmd_me against a non-dict role (no AttributeError) with regression tests;
remove the dead client facade, the unused cmd_channels variable, and the
unused List/Tuple imports (ruff F401/F841 clean).

ghost: fold the 5 nested with-statements (ruff SIM117) in test_ghost.py
into single with-statements.

All three skills double-runner + proxy-trap green (25/56/37 tests);
validate-evals, paired smoke, quality validator, core gates, and catalog
check modes green.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
This commit is contained in:
Magnus Hedemark
2026-08-29 20:32:06 -04:00
co-authored by factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
parent a20b66e6c1
commit 08689dfd8f
10 changed files with 164 additions and 95 deletions
+11 -16
View File
@@ -238,17 +238,15 @@ class JwtSigningTests(unittest.TestCase):
def test_malformed_secret_half_is_graceful_error_not_traceback(self):
client = self.cli.GhostClient(url="https://example.com", key="5f9d4b1c8e2a43d7b6c0a1e9:not-hex!")
stderr = io.StringIO()
with self.assertRaises(SystemExit):
with contextlib.redirect_stderr(stderr):
client._jwt_token()
with self.assertRaises(SystemExit), contextlib.redirect_stderr(stderr):
client._jwt_token()
self.assertIn("hexadecimal", stderr.getvalue())
def test_key_without_colon_names_required_format(self):
client = self.cli.GhostClient(url="https://example.com", key="justonepart")
stderr = io.StringIO()
with self.assertRaises(SystemExit):
with contextlib.redirect_stderr(stderr):
client._jwt_token()
with self.assertRaises(SystemExit), contextlib.redirect_stderr(stderr):
client._jwt_token()
self.assertIn("id:secret", stderr.getvalue())
@@ -431,10 +429,9 @@ class MockedClientTests(unittest.TestCase):
cli.requests.put = Mock(return_value=collision)
client = cli.GhostClient(url="https://example.com", key=FIXED_KEY)
stderr = io.StringIO()
with self.assertRaises(SystemExit):
with contextlib.redirect_stderr(stderr):
client.update_post("abc123", status="published",
updated_at="2026-01-01T00:00:00.000Z")
with self.assertRaises(SystemExit), contextlib.redirect_stderr(stderr):
client.update_post("abc123", status="published",
updated_at="2026-01-01T00:00:00.000Z")
message = stderr.getvalue()
self.assertIn("409", message)
self.assertIn("Someone else is editing this post", message)
@@ -449,9 +446,8 @@ class MockedClientTests(unittest.TestCase):
cli.requests.get = Mock(return_value=missing)
client = cli.GhostClient(url="https://example.com", key=FIXED_KEY)
stderr = io.StringIO()
with self.assertRaises(SystemExit):
with contextlib.redirect_stderr(stderr):
client._get("/posts/does-not-exist")
with self.assertRaises(SystemExit), contextlib.redirect_stderr(stderr):
client._get("/posts/does-not-exist")
message = stderr.getvalue()
self.assertIn("404", message)
self.assertIn("Admin API", message)
@@ -468,9 +464,8 @@ class MockedClientTests(unittest.TestCase):
cli.requests.get = Mock(return_value=bad_scheme)
client = cli.GhostClient(url="https://example.com", key=FIXED_KEY)
stderr = io.StringIO()
with self.assertRaises(SystemExit):
with contextlib.redirect_stderr(stderr):
client._get("/posts")
with self.assertRaises(SystemExit), contextlib.redirect_stderr(stderr):
client._get("/posts")
self.assertIn("Ghost [token]", stderr.getvalue())
def test_authorization_header_uses_ghost_scheme_and_version_headers(self):