Files
hermes-agent/tests/gateway/test_operator_cross_surface.py
Teknium 8b1040feb6 test: the Webapp login is the machine owner in the main tests that pinned it as a stranger
Teknium's ruling: Hermes is single-user, a signed-in Webapp/dashboard login IS the machine owner.
Eight origin/main tests asserted the dashboard login (session token, stub login or a second IdP
account) acted as a separate identity. Only that assertion changes in each; idempotent retries,
restart survival, atomic binding, FIFO, stop and approval checks stay.

- test_session_mutation_import_owner: the login's edit is the owner's (200, same receipt as the
  native exact retry), not a 403 steal.
- test_session_mutation_cold: the login's stale-revision edit after restart is a revision_conflict,
  not an ownership 403.
- test_session_mutation_retirement / test_used_delete_restart: the login's exact delete retry after
  restart replays the owner's receipt.
- test_operator_cross_surface[native|dashboard]: both admissions carry the owner's uid subject and
  no operator hand-off payload.
- test_hosted_room_auth_daemon (renamed test_every_signed_in_tab_shares_the_owners_hosted_rooms):
  a second IdP account cannot sign in; two owner tabs share one Group Chat list and either may stop
  or approve.
- test_sessions_adopt: the browser login opens an old chat itself (owner claim), adopt takes the rest.
2026-10-27 17:32:49 -07:00

32 lines
1.4 KiB
Python

"""Real native bootstrap and dashboard login share one canonical worker as one owner identity."""
import json
import os
from pathlib import Path
import subprocess
import sys
import pytest
@pytest.mark.platforms("linux")
@pytest.mark.parametrize('creator', ['native', 'dashboard'])
def test_operator_cross_surface_real_auth_fifo_and_attribution(tmp_path, creator):
root = Path(__file__).resolve().parents[2]
home, user = tmp_path / 'state', tmp_path / 'user'
home.mkdir(mode=0o700)
user.mkdir()
# Do not inherit credentials, plugins, provider configuration, or user state.
env = {key: os.environ[key] for key in ('PATH', 'LANG', 'TZ') if key in os.environ}
env.update(HOME=str(user), USERPROFILE=str(user), HERMES_HOME=str(home),
PYTHONPATH=str(root), PYTHONUNBUFFERED='1')
result = subprocess.run(
[sys.executable, str(root / 'tests/gateway/fixtures/operator_cross_surface_peer.py'), creator],
cwd=root, env=env, capture_output=True, text=True, timeout=150, check=False)
assert result.returncode == 0, result.stdout + result.stderr
receipt = json.loads((home / 'operator-receipt.json').read_text())
assert receipt['creator'] == creator
assert receipt['model_requests'] == 2
assert receipt['owner_attribution'] is True
assert receipt['disconnect_survived'] is True
assert receipt['negative_boundaries'] is True