Merge pull request #88 from living-ip/codex/gcp-iap-hermes-python-20260712
Some checks are pending
CI / lint-and-test (push) Waiting to run
Some checks are pending
CI / lint-and-test (push) Waiting to run
Run GCP Cory replay with Hermes Python
This commit is contained in:
commit
6e632f20be
2 changed files with 26 additions and 0 deletions
|
|
@ -19,6 +19,19 @@ from pathlib import Path
|
||||||
from types import SimpleNamespace
|
from types import SimpleNamespace
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
GCP_HERMES_PYTHON = Path("/home/teleo/.hermes/hermes-agent/venv/bin/python")
|
||||||
|
|
||||||
|
|
||||||
|
def should_reexec_in_hermes(current_python: Path, target_python: Path = GCP_HERMES_PYTHON) -> bool:
|
||||||
|
return target_python.is_file() and current_python.resolve() != target_python.resolve()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__" and should_reexec_in_hermes(Path(sys.executable)):
|
||||||
|
os.execv(
|
||||||
|
str(GCP_HERMES_PYTHON),
|
||||||
|
[str(GCP_HERMES_PYTHON), str(Path(__file__).resolve()), *sys.argv[1:]],
|
||||||
|
)
|
||||||
|
|
||||||
HERE = Path(__file__).resolve().parent
|
HERE = Path(__file__).resolve().parent
|
||||||
sys.path.insert(0, str(HERE))
|
sys.path.insert(0, str(HERE))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ from pathlib import Path
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from scripts.run_gcp_generated_db_direct_claim_suite import (
|
from scripts.run_gcp_generated_db_direct_claim_suite import (
|
||||||
|
GCP_HERMES_PYTHON,
|
||||||
REVIEWED_CLOUDSQL_TOOL_SHA256,
|
REVIEWED_CLOUDSQL_TOOL_SHA256,
|
||||||
REVIEWED_MANIFEST_SQL_SHA256,
|
REVIEWED_MANIFEST_SQL_SHA256,
|
||||||
audit_structured_count_readbacks,
|
audit_structured_count_readbacks,
|
||||||
|
|
@ -16,6 +17,7 @@ from scripts.run_gcp_generated_db_direct_claim_suite import (
|
||||||
direct_prompts,
|
direct_prompts,
|
||||||
normalize_database_manifest_rows,
|
normalize_database_manifest_rows,
|
||||||
run_suite,
|
run_suite,
|
||||||
|
should_reexec_in_hermes,
|
||||||
validate_database_identity,
|
validate_database_identity,
|
||||||
validate_parity_receipt,
|
validate_parity_receipt,
|
||||||
)
|
)
|
||||||
|
|
@ -36,6 +38,17 @@ def test_direct_prompt_catalog_is_the_exact_six_case_suite() -> None:
|
||||||
validate_read_only_bridge_argv(["list-proposals", "--status", "rejected"])
|
validate_read_only_bridge_argv(["list-proposals", "--status", "rejected"])
|
||||||
|
|
||||||
|
|
||||||
|
def test_gcp_runner_reexecs_from_system_python_into_hermes_venv(tmp_path: Path) -> None:
|
||||||
|
system_python = tmp_path / "system-python"
|
||||||
|
hermes_python = tmp_path / "hermes-python"
|
||||||
|
system_python.touch()
|
||||||
|
hermes_python.touch()
|
||||||
|
|
||||||
|
assert should_reexec_in_hermes(system_python, hermes_python) is True
|
||||||
|
assert should_reexec_in_hermes(hermes_python, hermes_python) is False
|
||||||
|
assert str(GCP_HERMES_PYTHON) == "/home/teleo/.hermes/hermes-agent/venv/bin/python"
|
||||||
|
|
||||||
|
|
||||||
def test_structured_count_readback_audit_rejects_plausible_but_false_counts() -> None:
|
def test_structured_count_readback_audit_rejects_plausible_but_false_counts() -> None:
|
||||||
status = {
|
status = {
|
||||||
"high_signal_rows": {
|
"high_signal_rows": {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue