Skip to content

Test the dashboard's own profile in an unnamed pairing's gateway name - #855

Merged
kaishi00 merged 2 commits into
mainfrom
claude/project-thread-99b5oc
Nov 17, 2026
Merged

kaishi00 merged 2 commits into
mainfrom
claude/project-thread-99b5oc

Conversation

@kaishi00

Copy link
Copy Markdown
Owner

Summary

A test-only follow-up to #854, which both reviewers approved while noting this gap. Part of issue kaishi00/hermes-conduit#2540.

The new test covers a dashboard scoped to profiles/work whose bot has no name. It pairs with the profile missing, empty, or current, and checks that the gateway gets <host> Hermes (work) from Conduit's Pair and from client.default_gateway_name. With no Hermes home it falls back to <host> Hermes.

No version bump, because the plugin's shipped code doesn't change.

Siblings

No mapped feature: tests only.

Testing

tests/test_pairing.py: 39 pass.


Generated by Claude Code

@kaishi00
kaishi00 marked this pull request as ready for review November 17, 2026 00:01
@github-actions

Copy link
Copy Markdown

Summary

A test-only PR adding one test to tests/test_pairing.py: it verifies that a dashboard scoped to a profile home (profiles/work) with an unnamed bot names the gateway box Hermes (work) — through pair_profile (Conduit's Pair) and client.default_gateway_name — for the profile missing, empty, or current, falling back to box Hermes with no Hermes home. I traced the test against _pair_gateway_name (dashboard/api/pairing.py:545-560), client.default_gateway_name (client.py:222-247), and session_titles._profile_of (session_titles.py:159-167); every assertion matches the implementation, including the main-profile fallback and the strip().lower() in ("", "current") resolution. The "no version bump" and "No mapped feature: tests only" claims hold per CONTRIBUTING.md — a test-only diff changes no shipped code and no tool, route, or push the app uses.

Findings

[severity: minor] sys.modules lookup KeyErrors when the test runs without an earlier lazy import in the same process

File: tests/test_pairing.py:114
Issue: sys.modules[f"{client.__package__}.session_titles"] only works if something already imported conduit_push_dashboard_package.session_titles. Nothing imports it eagerly: client.py imports it lazily inside default_gateway_name (client.py:231), and no dashboard/api module imports it at load. In a whole-file single-process run, earlier tests (test_pairing_claims_the_code_and_saves_the_credential, test_a_named_profile_is_in_the_gateway_name) trigger that lazy import first, so it passes; but in a fresh interpreter running just this test (pytest tests/test_pairing.py -k unnamed_profile) the lookup raises KeyError before any assertion, and under -n auto --dist worksteal a worker that receives this test without one of the name-defaulting tests can hit the same race. The identical pattern at line 87 (test #854 added) has the same latent fragility — the new line copies it.
Suggestion: Replace the lookup with importlib.import_module(f"{client.__package__}.session_titles"), which works regardless of prior test order (and ideally fix line 87 the same way).

Verdict

APPROVE

New%20session%20-%202026-11-17T00%3A03%3A09.441Z
opencode session  |  github run

@github-actions

Copy link
Copy Markdown

Review by DeepSeek V4.1 Flash.

Summary

A test-only PR adding one test to tests/test_pairing.py: it covers a dashboard scoped to profiles/work with an unnamed bot, checking that pair_profile and client.default_gateway_name name the gateway box Hermes (work) for a missing, empty, or current profile, and box Hermes with no Hermes home.

Findings

[severity: minor] The new test raises KeyError when run without an earlier lazy import

File: tests/test_pairing.py:114
Issue: sys.modules[f"{client.__package__}.session_titles"] only works if something already imported conduit_push_dashboard_package.session_titles. Nothing does at module load; client.default_gateway_name imports it lazily (client.py:231). Running pytest tests/test_pairing.py::test_an_unnamed_profile_comes_from_the_dashboards_home, or starting a worksteal worker with this test, raises KeyError before any assertion. The earlier review raised this for the new line; it is unchanged. The copy at line 87 has the same pre-existing fragility.
Suggestion: Use importlib.import_module(f"{client.__package__}.session_titles") (importing importlib) so the test does not depend on test order; ideally fix line 87 the same way.

Verdict

APPROVE

New%20session%20-%202026-11-17T00%3A08%3A03.570Z
opencode session  |  github run

@github-actions

Copy link
Copy Markdown

Review by GLM-5.3-Flash.

Summary

Test-only PR covering a dashboard scoped to profiles/work with an unnamed bot: it checks pair_profile and client.default_gateway_name both name the gateway box Hermes (work) for a missing, empty, or current profile, falling back to box Hermes with no Hermes home. The change since the last review replaces both sys.modules[...] lookups with importlib.import_module(...) and imports importlib (tests/test_pairing.py:2,88,115).

Findings

The previously raised minor finding (sys.modules KeyError when the test runs without an earlier lazy import) is fixed: importlib.import_module works regardless of test order, and it also repairs the pre-existing copy at line 88 as suggested. I verified the fix is behaviorally safe: _plugin_client registers the conduit_push_dashboard_package parent (dashboard/api/self_update.py:1216-1222) before returning, so import_module on the submodule resolves via the package's __path__; the registered module is the same object client.default_gateway_name's lazy from . import session_titles (client.py:231) picks up from sys.modules, so the monkeypatching still takes effect; bot_name and _home exist at module level (session_titles.py:71,170); and the hermes_constants stub (tests/test_pairing.py:17-20) covers a fresh import. sys remains used at lines 17 and 20, so its import is still needed. No new issues.

Verdict

APPROVE

New%20session%20-%202026-11-17T00%3A11%3A51.640Z
opencode session  |  github run

@github-actions

Copy link
Copy Markdown

Review by DeepSeek V4.1 Flash.

Summary

A test-only PR adding one test to tests/test_pairing.py, covering a dashboard scoped to profiles/work with an unnamed bot: it checks pair_profile and client.default_gateway_name name the gateway box Hermes (work) for a missing, empty, or current profile, falling back to box Hermes with no Hermes home. The change since the last review replaces both sys.modules[...] lookups with importlib.import_module(...) and imports importlib.

Findings

The previously raised minor finding (the sys.modules KeyError when the test ran without an earlier lazy import) is fixed. importlib.import_module(f"{client.__package__}.session_titles") resolves the submodule through the conduit_push_dashboard_package parent's __path__ (set to the plugin root at self_update.py:1220, where session_titles.py lives), works regardless of test order, and repairs the pre-existing copy at line 88 as well. The imported module lands in sys.modules under the same package-qualified name that client.default_gateway_name's lazy from . import session_titles (client.py:231) resolves, so the bot_name/_home monkeypatches still take effect. session_titles imports hermes_constants lazily (session_titles.py:172), covered by the stub at tests/test_pairing.py:17-20. sys remains used at lines 17 and 20. No new issues.

Verdict

APPROVE

New%20session%20-%202026-11-17T00%3A13%3A22.868Z
opencode session  |  github run

@kaishi00
kaishi00 merged commit 4ac6e38 into main Nov 17, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants