sibyl-dev 1.3.1__tar.gz → 1.3.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/PKG-INFO +2 -2
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/pyproject.toml +2 -2
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/client.py +9 -5
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/client_transport.py +15 -4
- sibyl_dev-1.3.2/tests/conftest.py +9 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/tests/test_auth_login.py +70 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/tests/test_client_auth_refresh.py +1 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/tests/test_client_errors.py +1 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/.gitignore +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/README.md +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/__init__.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/archive.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/auth.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/auth_store.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/capture.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/capture_support.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/client_admin.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/client_auth.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/client_graph.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/client_memory.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/client_sources.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/client_work.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/command_support.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/common.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/config_cmd.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/config_store.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/context.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/context_quick.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/crawl.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/crawl_shared.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/data/hooks/session-start.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/data/skill-packs/contract.md +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/data/skill-packs/core.md +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/data/skill-packs/examples.md +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/data/skill-packs/migration.md +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/data/skill-packs/quick.md +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/data/skill-packs/workflows.md +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/data/skills/sibyl/SKILL.md +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/debug.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/dev.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/docker.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/doctor.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/document.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/entity.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/entrypoint.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/epic.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/explore.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/export.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/host.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/id_resolution.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/ingest.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/local.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/logs.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/main.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/memory.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/memory_admin.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/memory_display.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/memory_review.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/memory_space.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/memory_views.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/migrate.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/onboarding.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/org.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/pending.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/pending_writes.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/project.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/project_refs.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/recall.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/root_commands.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/session.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/setup.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/skill.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/state.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/synthesis.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/task.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/team.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/update.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/version_drift.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/src/sibyl_cli/view_shared.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/tests/__init__.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/tests/test_archive.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/tests/test_auth_store.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/tests/test_client_contract.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/tests/test_common.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/tests/test_config_store.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/tests/test_context_pack.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/tests/test_debug.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/tests/test_docker_runtime.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/tests/test_docs.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/tests/test_doctor.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/tests/test_entity.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/tests/test_entrypoint.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/tests/test_epic.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/tests/test_exit_codes.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/tests/test_export_memory.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/tests/test_host_runtime.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/tests/test_id_resolution.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/tests/test_ingest.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/tests/test_init.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/tests/test_local_surreal.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/tests/test_logs.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/tests/test_main_capture.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/tests/test_main_search.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/tests/test_onboarding.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/tests/test_org.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/tests/test_packaged_data.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/tests/test_pending_cli.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/tests/test_pending_visibility.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/tests/test_pending_writes.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/tests/test_project.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/tests/test_resolver_is_single.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/tests/test_session.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/tests/test_skill.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/tests/test_source.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/tests/test_task.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/tests/test_task_notes.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/tests/test_update.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/tests/test_update_server_axis.py +0 -0
- {sibyl_dev-1.3.1 → sibyl_dev-1.3.2}/tests/test_version_drift.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: sibyl-dev
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.2
|
|
4
4
|
Summary: CLI for Sibyl knowledge graph and task workflow
|
|
5
5
|
Project-URL: Homepage, https://github.com/hyperb1iss/sibyl
|
|
6
6
|
Project-URL: Repository, https://github.com/hyperb1iss/sibyl
|
|
@@ -19,7 +19,7 @@ Requires-Dist: httpx>=0.27
|
|
|
19
19
|
Requires-Dist: packaging>=26.0
|
|
20
20
|
Requires-Dist: pyyaml>=6.0
|
|
21
21
|
Requires-Dist: rich>=13.0
|
|
22
|
-
Requires-Dist: sibyl-core==1.3.
|
|
22
|
+
Requires-Dist: sibyl-core==1.3.2
|
|
23
23
|
Requires-Dist: tomli-w>=1.2.0
|
|
24
24
|
Requires-Dist: typer>=0.27.1
|
|
25
25
|
Requires-Dist: websockets>=16.1.1
|
|
@@ -42,7 +42,7 @@ dependencies = [
|
|
|
42
42
|
# WebSocket (logs --follow)
|
|
43
43
|
"websockets>=16.1.1",
|
|
44
44
|
# Shared library
|
|
45
|
-
"sibyl-core==1.3.
|
|
45
|
+
"sibyl-core==1.3.2",
|
|
46
46
|
]
|
|
47
47
|
|
|
48
48
|
# =============================================================================
|
|
@@ -55,7 +55,7 @@ dev = [
|
|
|
55
55
|
"pytest-asyncio",
|
|
56
56
|
"pytest-cov>=7.0.0",
|
|
57
57
|
"ruff",
|
|
58
|
-
"ty>=0.0.
|
|
58
|
+
"ty>=0.0.75",
|
|
59
59
|
]
|
|
60
60
|
|
|
61
61
|
[project.scripts]
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"""Public HTTP client contract for the Sibyl CLI."""
|
|
2
2
|
|
|
3
|
-
import os
|
|
4
|
-
|
|
5
3
|
import httpx
|
|
6
4
|
|
|
7
5
|
from sibyl_cli.auth_store import normalize_api_url
|
|
@@ -25,6 +23,7 @@ from sibyl_cli.client_transport import (
|
|
|
25
23
|
SibylClientError,
|
|
26
24
|
_auth_credential_scope,
|
|
27
25
|
_auth_replay_scope,
|
|
26
|
+
_environment_auth_token,
|
|
28
27
|
_is_read_like_post,
|
|
29
28
|
_is_refresh_revoked,
|
|
30
29
|
_load_default_auth_token,
|
|
@@ -93,7 +92,7 @@ class SibylClient(
|
|
|
93
92
|
)
|
|
94
93
|
self.timeout = timeout
|
|
95
94
|
self._uses_stored_auth = (
|
|
96
|
-
auth_token is None and
|
|
95
|
+
auth_token is None and _environment_auth_token(self.base_url) is None
|
|
97
96
|
)
|
|
98
97
|
self.auth_token = (
|
|
99
98
|
auth_token
|
|
@@ -140,10 +139,15 @@ def get_client(context_name: str | None = None) -> SibylClient:
|
|
|
140
139
|
global _clients
|
|
141
140
|
|
|
142
141
|
# Resolve the effective context when one isn't explicitly provided.
|
|
143
|
-
if context_name is None
|
|
142
|
+
if context_name is None:
|
|
144
143
|
from sibyl_cli import config_store
|
|
144
|
+
from sibyl_cli.state import get_context_override
|
|
145
145
|
|
|
146
|
-
context_name =
|
|
146
|
+
context_name = (
|
|
147
|
+
get_context_override()
|
|
148
|
+
if _paired_automation_api_url()
|
|
149
|
+
else config_store.resolve_context_name()
|
|
150
|
+
)
|
|
147
151
|
|
|
148
152
|
cache_key = context_name
|
|
149
153
|
|
|
@@ -16,6 +16,7 @@ from sibyl_cli.auth_store import (
|
|
|
16
16
|
credential_scope,
|
|
17
17
|
get_access_token,
|
|
18
18
|
is_access_token_expired,
|
|
19
|
+
normalize_api_url,
|
|
19
20
|
read_server_credentials,
|
|
20
21
|
)
|
|
21
22
|
from sibyl_cli.pending_writes import (
|
|
@@ -128,6 +129,17 @@ def _auth_credential_scope(context_name: str | None = None) -> str | None:
|
|
|
128
129
|
return credential_scope(ctx.name, ctx.org_slug)
|
|
129
130
|
|
|
130
131
|
|
|
132
|
+
def _environment_auth_token(api_base_url: str) -> str | None:
|
|
133
|
+
"""Keep a paired automation credential bound to its selected API URL."""
|
|
134
|
+
token = os.environ.get("SIBYL_AUTH_TOKEN", "").strip()
|
|
135
|
+
if not token:
|
|
136
|
+
return None
|
|
137
|
+
paired_url = _paired_automation_api_url()
|
|
138
|
+
if paired_url and normalize_api_url(paired_url) != normalize_api_url(api_base_url):
|
|
139
|
+
return None
|
|
140
|
+
return token
|
|
141
|
+
|
|
142
|
+
|
|
131
143
|
def _load_default_auth_token(
|
|
132
144
|
api_base_url: str,
|
|
133
145
|
credential_scope_name: str | None = None,
|
|
@@ -135,11 +147,10 @@ def _load_default_auth_token(
|
|
|
135
147
|
"""Load auth token for the given API URL.
|
|
136
148
|
|
|
137
149
|
Priority:
|
|
138
|
-
1. SIBYL_AUTH_TOKEN
|
|
150
|
+
1. SIBYL_AUTH_TOKEN when its paired URL matches (or no URL is provided)
|
|
139
151
|
2. Stored access token for the specific server
|
|
140
152
|
"""
|
|
141
|
-
env_token
|
|
142
|
-
if env_token:
|
|
153
|
+
if env_token := _environment_auth_token(api_base_url):
|
|
143
154
|
return env_token
|
|
144
155
|
|
|
145
156
|
return get_access_token(api_base_url, credential_scope=credential_scope_name)
|
|
@@ -241,7 +252,7 @@ def _load_default_replay_scope(
|
|
|
241
252
|
credential_scope_name: str | None,
|
|
242
253
|
auth_token: str | None,
|
|
243
254
|
) -> str | None:
|
|
244
|
-
if
|
|
255
|
+
if _environment_auth_token(api_base_url):
|
|
245
256
|
return _auth_replay_scope(None, auth_token)
|
|
246
257
|
stored_credentials = read_server_credentials(
|
|
247
258
|
api_base_url,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"""Keep CLI tests independent of the invoking shell's server credentials."""
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@pytest.fixture(autouse=True)
|
|
7
|
+
def isolated_cli_environment(monkeypatch: pytest.MonkeyPatch) -> None:
|
|
8
|
+
for variable in ("SIBYL_API_URL", "SIBYL_AUTH_TOKEN", "SIBYL_CONTEXT"):
|
|
9
|
+
monkeypatch.delenv(variable, raising=False)
|
|
@@ -466,6 +466,76 @@ def test_paired_automation_url_and_token_override_the_interactive_context(
|
|
|
466
466
|
clear_client_cache()
|
|
467
467
|
|
|
468
468
|
|
|
469
|
+
@pytest.mark.parametrize("selection", ["context", "base_url", "environment", "flag"])
|
|
470
|
+
@pytest.mark.parametrize("stored", [True, False])
|
|
471
|
+
def test_foreign_automation_credentials_do_not_follow_an_explicit_target(
|
|
472
|
+
tmp_path: Path,
|
|
473
|
+
monkeypatch: pytest.MonkeyPatch,
|
|
474
|
+
selection: str,
|
|
475
|
+
stored: bool,
|
|
476
|
+
) -> None:
|
|
477
|
+
from sibyl_cli import state
|
|
478
|
+
|
|
479
|
+
monkeypatch.setattr(config_store.Path, "home", lambda: tmp_path)
|
|
480
|
+
monkeypatch.setattr(state, "_context_override", None)
|
|
481
|
+
monkeypatch.setattr(state, "_ignore_selection", False)
|
|
482
|
+
monkeypatch.delenv("SIBYL_CONTEXT", raising=False)
|
|
483
|
+
config_store.create_context("prod", "https://sibyl.example.com", org_slug="acme")
|
|
484
|
+
monkeypatch.setenv("SIBYL_API_URL", "http://localhost:3344/api")
|
|
485
|
+
monkeypatch.setenv("SIBYL_AUTH_TOKEN", "automation-token")
|
|
486
|
+
scope = None if selection == "base_url" else "context:prod:org:acme"
|
|
487
|
+
if stored:
|
|
488
|
+
auth_store.set_tokens(
|
|
489
|
+
"https://sibyl.example.com/api",
|
|
490
|
+
"prod-token",
|
|
491
|
+
refresh_token="prod-refresh",
|
|
492
|
+
expires_in=3600,
|
|
493
|
+
credential_scope=scope,
|
|
494
|
+
pending_replay_scope="credential:prod",
|
|
495
|
+
)
|
|
496
|
+
|
|
497
|
+
clear_client_cache()
|
|
498
|
+
try:
|
|
499
|
+
if selection == "context":
|
|
500
|
+
client = SibylClient(context_name="prod")
|
|
501
|
+
elif selection == "base_url":
|
|
502
|
+
client = SibylClient(base_url="https://sibyl.example.com/api")
|
|
503
|
+
else:
|
|
504
|
+
if selection == "environment":
|
|
505
|
+
monkeypatch.setenv("SIBYL_CONTEXT", "prod")
|
|
506
|
+
else:
|
|
507
|
+
monkeypatch.setattr(state, "_context_override", "prod")
|
|
508
|
+
client = get_client()
|
|
509
|
+
assert client.base_url == "https://sibyl.example.com/api"
|
|
510
|
+
assert client._default_headers().get("Authorization") == (
|
|
511
|
+
"Bearer prod-token" if stored else None
|
|
512
|
+
)
|
|
513
|
+
assert client._uses_stored_auth is True
|
|
514
|
+
assert client._replay_scope == ("credential:prod" if stored else None)
|
|
515
|
+
finally:
|
|
516
|
+
clear_client_cache()
|
|
517
|
+
|
|
518
|
+
|
|
519
|
+
@pytest.mark.parametrize("paired_url", [None, "https://sibyl.example.com/api/"])
|
|
520
|
+
def test_matching_or_unpaired_environment_token_remains_explicit_auth(
|
|
521
|
+
tmp_path: Path,
|
|
522
|
+
monkeypatch: pytest.MonkeyPatch,
|
|
523
|
+
paired_url: str | None,
|
|
524
|
+
) -> None:
|
|
525
|
+
monkeypatch.setattr(config_store.Path, "home", lambda: tmp_path)
|
|
526
|
+
config_store.create_context("prod", "https://sibyl.example.com", org_slug="acme")
|
|
527
|
+
monkeypatch.setenv("SIBYL_AUTH_TOKEN", "automation-token")
|
|
528
|
+
if paired_url:
|
|
529
|
+
monkeypatch.setenv("SIBYL_API_URL", paired_url)
|
|
530
|
+
else:
|
|
531
|
+
monkeypatch.delenv("SIBYL_API_URL", raising=False)
|
|
532
|
+
|
|
533
|
+
client = SibylClient(context_name="prod")
|
|
534
|
+
|
|
535
|
+
assert client._default_headers()["Authorization"] == "Bearer automation-token"
|
|
536
|
+
assert client._uses_stored_auth is False
|
|
537
|
+
|
|
538
|
+
|
|
469
539
|
def test_auth_commands_follow_the_context_override_like_the_client(
|
|
470
540
|
tmp_path: Path,
|
|
471
541
|
monkeypatch: pytest.MonkeyPatch,
|
|
@@ -163,6 +163,7 @@ async def test_silent_local_relogin_refuses_an_unscoped_organization(
|
|
|
163
163
|
async def test_environment_token_ignores_expired_stored_credential(
|
|
164
164
|
monkeypatch: pytest.MonkeyPatch,
|
|
165
165
|
) -> None:
|
|
166
|
+
monkeypatch.delenv("SIBYL_API_URL", raising=False)
|
|
166
167
|
monkeypatch.setenv("SIBYL_AUTH_TOKEN", "automation-token")
|
|
167
168
|
|
|
168
169
|
def unexpected_stored_expiry_check(*_args: object, **_kwargs: object) -> bool:
|
|
@@ -387,6 +387,7 @@ async def test_environment_token_scope_overrides_active_context_scope(
|
|
|
387
387
|
) -> None:
|
|
388
388
|
monkeypatch.setattr(pending_writes.Path, "home", lambda: tmp_path)
|
|
389
389
|
monkeypatch.setattr(client_transport_module, "AUTO_REPLAY_GRACE_SECONDS", 0.0)
|
|
390
|
+
monkeypatch.delenv("SIBYL_API_URL", raising=False)
|
|
390
391
|
monkeypatch.setenv("SIBYL_AUTH_TOKEN", "automation-token")
|
|
391
392
|
monkeypatch.setattr(
|
|
392
393
|
client_module,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|