Teknium
92d0bd0d73
simplify(compat): gateway — drop 30 re-exports/aliases + 2 shim modules, re-remove 3 shim-only names, repoint 24 callers + 34 test files
...
Per COMPAT_REMOVAL.md (internal import paths are not a stable API):
Re-exports removed
- gateway/run.py: atomic_json_write, load_dotenv, resolve_delivery_transport,
TurnRunner, merge_pending_message_event, _arm_loop_floor_timer,
start_loop_liveness_watchdog, DEFAULT_GATEWAY_POST_INTERRUPT_GRACE_TIMEOUT,
_UNSET (9) — run_* mixins and tests now import from the defining module
(gateway.delivery / gateway.run_turn_runner / gateway.platforms.base /
gateway.shutdown_watchdog / gateway.restart / utils).
- gateway/session.py: SessionResetPolicy, normalize_whatsapp_identifier,
TranscriptReadError, auto_continue_freshness_window (+ "_now & co." noqa
facade) — gateway/__init__ takes SessionResetPolicy from .config; callers
take TranscriptReadError from gateway.session_transcript.
- gateway/kanban_watchers.py: _wake_scope_id + "tests import via origin" noqa
facade; tests import from kanban_watchers_common / _notifier.
- gateway/slash_commands.py: _model_switch_skew_guard, HISTORY_UNREADABLE.
- gateway/stream_consumer.py: escape_code_fences_for_display.
- gateway/platforms/api_server.py: "re-exported" RunIdempotencyStore comment;
tui_gateway + tests import gateway.platforms.api_server_run_idempotency.
- gateway/platforms/__init__.py: PEP 562 __getattr__/__dir__ lazy QQAdapter /
YuanbaoAdapter facade (no in-tree importer).
- gateway/startup_watchdog.py: whole re-export shim module deleted; the three
in-tree callers import hermes_startup_watchdog directly.
Aliases removed
- gateway/platforms/signal.py: SignalAdapter._markdown_to_signal.
- gateway/shutdown_forensics.py: _parse_systemd_duration_to_us.
- gateway/platforms/yuanbao.py: OutboundManager.start_slow_notifier /
cancel_slow_notifier / get_chat_lock / _chat_locks / CHAT_DICT_MAX_SIZE
delegates; module-level get_active_adapter / send_yuanbao_direct;
MarkdownProcessor has_unclosed_fence / ends_with_table_row /
split_at_paragraph_boundary static pass-throughs (chunk_markdown_text stays —
it carries yuanbao's chunking policy). tools/send_message_senders +
tools/yuanbao_tools call YuanbaoAdapter.get_active() / sender.send_direct().
Shim-only names re-removed (earlier review-fix round 96c104c903 )
- CapabilityDescriptor.from_platform_entry (+ tests/gateway/relay/test_descriptor_from_entry.py)
- SessionTurnLeaseRegistry.__len__ (+ its test)
- is_relay_media_url KEPT: download() uses it, real internal helper.
Tests that pinned a shim (startup_watchdog re-export identity, api_server
RunIdempotencyStore identity, signal wrapper parity) are dropped; tests that
pinned live behavior are repointed at the implementation.
Note: the gateway/run.py hunk of this change was swept into 00a3cfe5c9 by a
concurrent commit on the shared worktree; this commit carries the rest.
Verified in an isolated worktree (HEAD + this change only): ruff clean,
import-smoke of all 33 touched modules under a fresh HERMES_HOME,
605 passed / 1 skipped across the 39 covering test files.
2026-09-03 13:10:49 -07:00
Teknium
6b81590c55
test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions
...
Systematic prune per AGENTS.md test policy, one pass over every major
test tree (gateway, hermes_cli, tools, agent, run_agent, plugins, cli,
cron, tui_gateway, honcho/openviking, root-level):
- DELETE: source-reading tests (read_text/getsource on prod files),
change-detector tests (exact catalog counts, model-name snapshots,
config version literals), mock-echo tests (assert a mock returns what
it was told), assertion-free/trivial tests, near-duplicate
parametrizations (boundaries + one representative kept), async/sync
twin duplicates, cosmetic within-file variations.
- KEEP (mandatory): security/redaction/approval guards, message-role
alternation invariants, prompt-caching/deterministic-call-id
invariants, issue-number regression tests (deduped), E2E tests.
- 6 test files deleted outright (script-style/no-assert or fully
redundant); conftest.py, fakes/, fixtures/ untouched.
- tests/acp/conftest.py added: autouse fixture stubs the live
models.dev/GitHub/Copilot/Anthropic inventory fetches that ACP server
tests performed on every session create — test_server.py 147s → 3.4s,
and the tests are now genuinely hermetic.
- Sleep-based slowness shrunk where safe (codex_ttfb_watchdog,
compression_concurrent_fork, etc.); no wall-clock assertion tightened.
Verification: full hermetic suite via scripts/run_tests.sh —
2439 files, 31,130 tests passed, 0 failed, 0 flaky retries, 315s wall
(baseline: 583s wall, 13,564s subprocess CPU).
2026-07-29 13:10:23 -07:00