refactor(types): simplify pass on P1 batch

Follow-up to 15ac253b per /simplify review:

- gateway/platforms/discord.py:3638 - move self.resolved = True *after*
  the `if interaction.data is None: return` guard. Previously the view
  was marked resolved before the None-guard, so a None data payload
  silently rejected the user's next click.
- agent/display.py:732 - replace `if self.start_time is None: continue`
  with `assert self.start_time is not None`. start() sets start_time
  before the animate thread starts, so the None branch was dead; the
  `continue` form would have busy-looped (skipping the 0.12s sleep).
- tests/hermes_cli/test_config_shapes.py - drop __total__ dunder
  restatement test (it just echoes the class declaration); trim commit
  narration from module docstring.
- tests/agent/test_credential_pool.py, tests/tools/test_rl_training_tool.py -
  drop "added in commit ..." banners (narrates the change per CLAUDE.md).
This commit is contained in:
alt-glitch 2026-04-21 20:40:12 +05:30
parent 527ca7d238
commit 79a5f03f92
5 changed files with 5 additions and 29 deletions

View file

@ -729,8 +729,7 @@ class KawaiiSpinner:
time.sleep(0.1)
continue
frame = self.spinner_frames[self.frame_idx % len(self.spinner_frames)]
if self.start_time is None:
continue
assert self.start_time is not None # start() sets it before thread starts
elapsed = time.time() - self.start_time
if wings:
left, right = wings[self.frame_idx % len(wings)]

View file

@ -3670,9 +3670,9 @@ if DISCORD_AVAILABLE:
)
return
self.resolved = True
if interaction.data is None:
return
self.resolved = True
model_id = interaction.data["values"][0] # ty: ignore[invalid-key]
try:

View file

@ -1164,10 +1164,6 @@ def test_load_pool_does_not_seed_qwen_oauth_when_no_token(tmp_path, monkeypatch)
assert pool.entries() == []
# ---------------------------------------------------------------------------
# Tests for CredentialPool.remove_entry (added in commit fc00f699)
# ---------------------------------------------------------------------------
def _build_pool_with_entries(tmp_path, monkeypatch, provider="openrouter", entries=None):
"""Helper: build a CredentialPool directly without seeding side-effects."""
monkeypatch.setenv("HERMES_HOME", str(tmp_path / "hermes"))

View file

@ -1,17 +1,11 @@
"""Tests for TypedDict shape definitions added in commit fc00f699.
Verifies that _CamofoxConfig is importable, honours total=False
(all fields optional), and nests correctly inside _BrowserConfig.
"""
"""Runtime smoke tests for `_CamofoxConfig` / `_BrowserConfig` TypedDict shapes."""
from __future__ import annotations
def test_camofox_config_is_partial_typeddict():
"""_CamofoxConfig should accept zero or more keys (total=False)."""
from hermes_cli.config import _CamofoxConfig, _BrowserConfig
from hermes_cli.config import _CamofoxConfig
# total=False: constructing with no keys must succeed at runtime
cfg_empty: _CamofoxConfig = {}
cfg_with_field: _CamofoxConfig = {"managed_persistence": True}
@ -20,8 +14,7 @@ def test_camofox_config_is_partial_typeddict():
def test_camofox_config_nested_in_browser_config():
"""_CamofoxConfig should be accepted in the camofox slot of _BrowserConfig."""
from hermes_cli.config import _CamofoxConfig, _BrowserConfig
from hermes_cli.config import _BrowserConfig
browser: _BrowserConfig = {
"inactivity_timeout": 60,
@ -33,10 +26,3 @@ def test_camofox_config_nested_in_browser_config():
}
assert browser["camofox"].get("managed_persistence") is False
def test_camofox_config_total_false_flag():
"""_CamofoxConfig.__total__ must be False (all fields optional)."""
from hermes_cli.config import _CamofoxConfig
assert _CamofoxConfig.__total__ is False

View file

@ -120,12 +120,7 @@ class TestStopTrainingRunProcesses:
trainer.terminate.assert_not_called()
# ---------------------------------------------------------------------------
# Tests for RunState log_file fields (added in commit fc00f699)
# ---------------------------------------------------------------------------
class TestRunStateLogFileFields:
"""Verify api_log_file, trainer_log_file, env_log_file exist with None defaults."""
def test_log_file_fields_default_none(self):
"""All three log_file fields should default to None."""