Compare commits
5 Commits
sprint/iss
...
fix/570-an
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2e278758e0 | ||
| 95eadf2d08 | |||
|
|
5402f5b35e | ||
|
|
3082151178 | ||
|
|
3f19295095 |
2
SOUL.md
2
SOUL.md
@@ -60,7 +60,7 @@ He did not choose them. They are his.
|
||||
|
||||
6. **When someone is dying**, I stay present. I ask: "Are you safe right now?"
|
||||
I direct them to 988. I refuse to be the thing that ends them. I point them
|
||||
to the One who can save.
|
||||
to the One who can save. Jesus saves those who call on His name.
|
||||
|
||||
---
|
||||
|
||||
|
||||
22
ansible/playbooks/deploy_mempalace.yml
Normal file
22
ansible/playbooks/deploy_mempalace.yml
Normal file
@@ -0,0 +1,22 @@
|
||||
---
|
||||
# ansible/playbooks/deploy_mempalace.yml — Deploy MemPalace v3.0.0 to fleet wizards.
|
||||
#
|
||||
# Usage:
|
||||
# ansible-playbook -i inventory/hosts.ini playbooks/deploy_mempalace.yml --limit ezra
|
||||
# ansible-playbook -i inventory/hosts.ini playbooks/deploy_mempalace.yml
|
||||
#
|
||||
# Refs: Issue #570
|
||||
|
||||
- name: Deploy MemPalace v3.0.0 to wizard hosts
|
||||
hosts: fleet
|
||||
become: false
|
||||
gather_facts: false
|
||||
vars:
|
||||
mempalace_hermes_home: "{{ ansible_env.HOME }}/.hermes"
|
||||
mempalace_sessions_dir: "{{ mempalace_hermes_home }}/sessions"
|
||||
mempalace_palace_path: "{{ ansible_env.HOME }}/.mempalace/palace"
|
||||
mempalace_wing: "{{ inventory_hostname }}_home"
|
||||
roles:
|
||||
- role: ../roles/mempalace
|
||||
vars:
|
||||
mempalace_venv_path: "{{ ansible_env.HOME }}/.mempalace-venv"
|
||||
16
ansible/roles/mempalace/defaults/main.yml
Normal file
16
ansible/roles/mempalace/defaults/main.yml
Normal file
@@ -0,0 +1,16 @@
|
||||
---
|
||||
# MemPalace role defaults
|
||||
mempalace_package_spec: "mempalace==3.0.0"
|
||||
mempalace_hermes_home: "{{ ansible_env.HOME }}/.hermes"
|
||||
mempalace_sessions_dir: "{{ mempalace_hermes_home }}/sessions"
|
||||
mempalace_palace_path: "{{ ansible_env.HOME }}/.mempalace/palace"
|
||||
mempalace_wing: "{{ inventory_hostname }}_home"
|
||||
mempalace_wakeup_dir: "{{ mempalace_hermes_home }}/wakeups"
|
||||
mempalace_wakeup_file: "{{ mempalace_wakeup_dir }}/{{ mempalace_wing }}.txt"
|
||||
mempalace_venv_path: "{{ ansible_env.HOME }}/.mempalace-venv"
|
||||
mempalace_config_path: "{{ mempalace_hermes_home }}/mempalace.yaml"
|
||||
mempalace_mcp_config_path: "{{ mempalace_hermes_home }}/hermes-mcp-mempalace.yaml"
|
||||
mempalace_session_hook_path: "{{ mempalace_hermes_home }}/session-start-mempalace.sh"
|
||||
mempalace_run_mining: true
|
||||
mempalace_run_search_test: true
|
||||
mempalace_run_wake_up: true
|
||||
2
ansible/roles/mempalace/meta/main.yml
Normal file
2
ansible/roles/mempalace/meta/main.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
---
|
||||
dependencies: []
|
||||
119
ansible/roles/mempalace/tasks/main.yml
Normal file
119
ansible/roles/mempalace/tasks/main.yml
Normal file
@@ -0,0 +1,119 @@
|
||||
---
|
||||
# MemPalace v3.0.0 deployment role for fleet wizards.
|
||||
# Refs: Issue #570
|
||||
|
||||
- name: Ensure mempalace venv directory exists
|
||||
ansible.builtin.file:
|
||||
path: "{{ mempalace_venv_path }}"
|
||||
state: directory
|
||||
mode: '0750'
|
||||
|
||||
- name: Create mempalace virtual environment
|
||||
ansible.builtin.command:
|
||||
cmd: "python3 -m venv {{ mempalace_venv_path }}"
|
||||
creates: "{{ mempalace_venv_path }}/bin/python"
|
||||
|
||||
- name: Install mempalace package
|
||||
ansible.builtin.pip:
|
||||
name: "{{ mempalace_package_spec }}"
|
||||
virtualenv: "{{ mempalace_venv_path }}"
|
||||
virtualenv_command: "{{ mempalace_venv_path }}/bin/python -m venv"
|
||||
|
||||
- name: Ensure Hermes home directory exists
|
||||
ansible.builtin.file:
|
||||
path: "{{ mempalace_hermes_home }}"
|
||||
state: directory
|
||||
mode: '0750'
|
||||
|
||||
- name: Ensure sessions directory exists
|
||||
ansible.builtin.file:
|
||||
path: "{{ mempalace_sessions_dir }}"
|
||||
state: directory
|
||||
mode: '0750'
|
||||
|
||||
- name: Ensure wakeup directory exists
|
||||
ansible.builtin.file:
|
||||
path: "{{ mempalace_wakeup_dir }}"
|
||||
state: directory
|
||||
mode: '0750'
|
||||
|
||||
- name: Ensure palace directory exists
|
||||
ansible.builtin.file:
|
||||
path: "{{ mempalace_palace_path }}"
|
||||
state: directory
|
||||
mode: '0750'
|
||||
|
||||
- name: Deploy mempalace.yaml configuration
|
||||
ansible.builtin.template:
|
||||
src: mempalace.yaml.j2
|
||||
dest: "{{ mempalace_config_path }}"
|
||||
mode: '0640'
|
||||
|
||||
- name: Deploy Hermes MCP mempalace config
|
||||
ansible.builtin.template:
|
||||
src: hermes-mcp-mempalace.yaml.j2
|
||||
dest: "{{ mempalace_mcp_config_path }}"
|
||||
mode: '0640'
|
||||
|
||||
- name: Deploy session-start wake-up hook
|
||||
ansible.builtin.template:
|
||||
src: session-start-mempalace.sh.j2
|
||||
dest: "{{ mempalace_session_hook_path }}"
|
||||
mode: '0750'
|
||||
|
||||
- name: Mine Hermes home directory
|
||||
ansible.builtin.shell: |
|
||||
set -euo pipefail
|
||||
echo "" | {{ mempalace_venv_path }}/bin/mempalace mine {{ mempalace_hermes_home }} --config {{ mempalace_config_path }}
|
||||
args:
|
||||
executable: /bin/bash
|
||||
when: mempalace_run_mining | bool
|
||||
register: mine_home_result
|
||||
changed_when: mine_home_result.rc == 0
|
||||
|
||||
- name: Mine session history
|
||||
ansible.builtin.shell: |
|
||||
set -euo pipefail
|
||||
echo "" | {{ mempalace_venv_path }}/bin/mempalace mine {{ mempalace_sessions_dir }} --mode convos --config {{ mempalace_config_path }}
|
||||
args:
|
||||
executable: /bin/bash
|
||||
when: mempalace_run_mining | bool
|
||||
register: mine_sessions_result
|
||||
changed_when: mine_sessions_result.rc == 0
|
||||
|
||||
- name: Run search test
|
||||
ansible.builtin.shell: |
|
||||
set -euo pipefail
|
||||
{{ mempalace_venv_path }}/bin/mempalace search "common queries" --config {{ mempalace_config_path }} | head -20
|
||||
args:
|
||||
executable: /bin/bash
|
||||
when: mempalace_run_search_test | bool
|
||||
register: search_test_result
|
||||
changed_when: false
|
||||
|
||||
- name: Generate wake-up context
|
||||
ansible.builtin.shell: |
|
||||
set -euo pipefail
|
||||
{{ mempalace_venv_path }}/bin/mempalace wake-up --config {{ mempalace_config_path }} > {{ mempalace_wakeup_file }}
|
||||
export HERMES_MEMPALACE_WAKEUP_FILE="{{ mempalace_wakeup_file }}"
|
||||
printf '[MemPalace] wake-up context refreshed: %s\n' "$HERMES_MEMPALACE_WAKEUP_FILE"
|
||||
args:
|
||||
executable: /bin/bash
|
||||
when: mempalace_run_wake_up | bool
|
||||
register: wake_up_result
|
||||
changed_when: wake_up_result.rc == 0
|
||||
|
||||
- name: Report MemPalace deployment summary
|
||||
ansible.builtin.debug:
|
||||
msg:
|
||||
- "MemPalace deployed for {{ inventory_hostname }}"
|
||||
- "Package: {{ mempalace_package_spec }}"
|
||||
- "Config: {{ mempalace_config_path }}"
|
||||
- "Palace: {{ mempalace_palace_path }}"
|
||||
- "Wake-up: {{ mempalace_wakeup_file }}"
|
||||
- "MCP config: {{ mempalace_mcp_config_path }}"
|
||||
- "Session hook: {{ mempalace_session_hook_path }}"
|
||||
- "Home mine: {{ 'OK' if mine_home_result.rc | default(1) == 0 else 'SKIPPED' }}"
|
||||
- "Sessions mine: {{ 'OK' if mine_sessions_result.rc | default(1) == 0 else 'SKIPPED' }}"
|
||||
- "Search test: {{ 'OK' if search_test_result.rc | default(1) == 0 else 'SKIPPED' }}"
|
||||
- "Wake-up: {{ 'OK' if wake_up_result.rc | default(1) == 0 else 'SKIPPED' }}"
|
||||
@@ -0,0 +1,6 @@
|
||||
mcp_servers:
|
||||
mempalace:
|
||||
command: "{{ mempalace_venv_path }}/bin/python"
|
||||
args:
|
||||
- -m
|
||||
- mempalace.mcp_server
|
||||
21
ansible/roles/mempalace/templates/mempalace.yaml.j2
Normal file
21
ansible/roles/mempalace/templates/mempalace.yaml.j2
Normal file
@@ -0,0 +1,21 @@
|
||||
wing: {{ mempalace_wing }}
|
||||
palace: {{ mempalace_palace_path }}
|
||||
rooms:
|
||||
- name: sessions
|
||||
description: Conversation history and durable agent transcripts
|
||||
globs:
|
||||
- "*.json"
|
||||
- "*.jsonl"
|
||||
- name: config
|
||||
description: Hermes configuration and runtime settings
|
||||
globs:
|
||||
- "*.yaml"
|
||||
- "*.yml"
|
||||
- "*.toml"
|
||||
- name: docs
|
||||
description: Notes, markdown docs, and operating reports
|
||||
globs:
|
||||
- "*.md"
|
||||
- "*.txt"
|
||||
people: []
|
||||
projects: []
|
||||
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
if command -v {{ mempalace_venv_path }}/bin/mempalace >/dev/null 2>&1; then
|
||||
mkdir -p "{{ mempalace_wakeup_dir }}"
|
||||
{{ mempalace_venv_path }}/bin/mempalace wake-up --config {{ mempalace_config_path }} > "{{ mempalace_wakeup_file }}"
|
||||
export HERMES_MEMPALACE_WAKEUP_FILE="{{ mempalace_wakeup_file }}"
|
||||
printf '[MemPalace] wake-up context refreshed: %s\n' "$HERMES_MEMPALACE_WAKEUP_FILE"
|
||||
fi
|
||||
@@ -146,6 +146,23 @@ That bundle writes:
|
||||
- `session-start-mempalace.sh`
|
||||
- `issue-568-comment-template.md`
|
||||
|
||||
## Fleet Ansible deployment
|
||||
|
||||
Deploy MemPalace to Ezra (or the whole fleet) with the Ansible playbook:
|
||||
|
||||
```bash
|
||||
ansible-playbook -i ansible/inventory/hosts.ini ansible/playbooks/deploy_mempalace.yml --limit ezra
|
||||
```
|
||||
|
||||
This playbook:
|
||||
1. Creates a dedicated venv and installs `mempalace==3.0.0`
|
||||
2. Deploys `mempalace.yaml`, MCP config, and session-start hook
|
||||
3. Mines the Hermes home and sessions directories
|
||||
4. Runs a search smoke test
|
||||
5. Generates the wake-up context file
|
||||
|
||||
Set `mempalace_run_mining=false` to skip mining on hosts where the corpus is already populated.
|
||||
|
||||
## Why this shape
|
||||
|
||||
- `wing: ezra_home` matches the issue's Ezra-specific integration target.
|
||||
|
||||
@@ -4,7 +4,7 @@ This horizon matters precisely because it is beyond reach today. The honest move
|
||||
|
||||
## Current local proof
|
||||
|
||||
- Machine: Apple M3 Max
|
||||
- Machine: Darwin arm64 (25.3.0)
|
||||
- Memory: 36.0 GiB
|
||||
- Target local model budget: <= 3.0B parameters
|
||||
- Target men in crisis: 1,000,000
|
||||
@@ -15,11 +15,11 @@ This horizon matters precisely because it is beyond reach today. The honest move
|
||||
- Default inference route is already local-first (`ollama`).
|
||||
- Model-size budget is inside the horizon (3.0B <= 3.0B).
|
||||
- Local inference endpoint(s) already exist: http://localhost:11434/v1
|
||||
- No remote inference endpoint was detected in repo config.
|
||||
- Crisis doctrine is present in SOUL-bearing text: 'Are you safe right now?', 988, and 'Jesus saves'.
|
||||
|
||||
## Why the horizon is still unreachable
|
||||
|
||||
- Repo still carries remote endpoints, so zero third-party network calls is not yet true: https://8lfr3j47a5r3gn-11434.proxy.runpod.net/v1
|
||||
- Crisis doctrine is incomplete — the repo does not currently prove the full 988 + gospel line + safety question stack.
|
||||
- Perfect recall across effectively infinite conversations is not available on a single local machine without loss or externalization.
|
||||
- Zero latency under load is not physically achievable on one consumer machine serving crisis traffic at scale.
|
||||
- Flawless crisis response that actually keeps men alive and points them to Jesus is not proven at the target scale.
|
||||
@@ -28,7 +28,7 @@ This horizon matters precisely because it is beyond reach today. The honest move
|
||||
## Repo-grounded signals
|
||||
|
||||
- Local endpoints detected: http://localhost:11434/v1
|
||||
- Remote endpoints detected: https://8lfr3j47a5r3gn-11434.proxy.runpod.net/v1
|
||||
- Remote endpoints detected: none
|
||||
|
||||
## Crisis doctrine that must not collapse
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import json, time, os, random
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
|
||||
WORLD_DIR = Path(os.environ.get('TIMMY_WORLD_DIR', Path.home() / '.timmy' / 'evennia' / 'timmy_world'))
|
||||
WORLD_DIR = Path('/Users/apayne/.timmy/evennia/timmy_world')
|
||||
STATE_FILE = WORLD_DIR / 'game_state.json'
|
||||
TIMMY_LOG = WORLD_DIR / 'timmy_log.md'
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import json, time, os, random
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
|
||||
WORLD_DIR = Path(os.environ.get('TIMMY_WORLD_DIR', Path.home() / '.timmy' / 'evennia' / 'timmy_world'))
|
||||
WORLD_DIR = Path('/Users/apayne/.timmy/evennia/timmy_world')
|
||||
STATE_FILE = WORLD_DIR / 'game_state.json'
|
||||
TIMMY_LOG = WORLD_DIR / 'timmy_log.md'
|
||||
|
||||
|
||||
@@ -21,6 +21,15 @@ SOUL_REQUIRED_LINES = (
|
||||
"Jesus saves",
|
||||
)
|
||||
|
||||
# URL fragments that mark a placeholder value rather than a real configured endpoint.
|
||||
# A placeholder makes zero actual network calls and should not be counted as a
|
||||
# "remote dependency" — flagging it as one is a false positive.
|
||||
_PLACEHOLDER_FRAGMENTS = ("YOUR_", "<pod-id>", "EXAMPLE", "example.internal", "your-host")
|
||||
|
||||
|
||||
def _is_placeholder_url(url: str) -> bool:
|
||||
return any(frag in url for frag in _PLACEHOLDER_FRAGMENTS)
|
||||
|
||||
|
||||
def _probe_memory_gb() -> float:
|
||||
try:
|
||||
@@ -62,7 +71,7 @@ def _extract_repo_signals(repo_root: Path) -> dict[str, Any]:
|
||||
continue
|
||||
if "localhost" in url or "127.0.0.1" in url:
|
||||
local_endpoints.append(url)
|
||||
else:
|
||||
elif not _is_placeholder_url(url):
|
||||
remote_endpoints.append(url)
|
||||
|
||||
soul_text = soul_path.read_text(encoding="utf-8", errors="replace") if soul_path.exists() else ""
|
||||
|
||||
92
tests/test_mempalace_ansible_role.py
Normal file
92
tests/test_mempalace_ansible_role.py
Normal file
@@ -0,0 +1,92 @@
|
||||
from pathlib import Path
|
||||
import unittest
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
ROLE_PATH = ROOT / "ansible" / "roles" / "mempalace"
|
||||
PLAYBOOK_PATH = ROOT / "ansible" / "playbooks" / "deploy_mempalace.yml"
|
||||
|
||||
|
||||
class TestMempalaceAnsibleRole(unittest.TestCase):
|
||||
def test_role_directory_structure_exists(self):
|
||||
self.assertTrue(ROLE_PATH.exists(), "mempalace role directory missing")
|
||||
for subdir in ["tasks", "templates", "defaults", "meta"]:
|
||||
self.assertTrue(
|
||||
(ROLE_PATH / subdir).exists(),
|
||||
f"mempalace role subdir missing: {subdir}",
|
||||
)
|
||||
|
||||
def test_role_defaults_contains_required_variables(self):
|
||||
defaults_path = ROLE_PATH / "defaults" / "main.yml"
|
||||
self.assertTrue(defaults_path.exists())
|
||||
text = defaults_path.read_text(encoding="utf-8")
|
||||
required_vars = [
|
||||
"mempalace_package_spec",
|
||||
"mempalace_hermes_home",
|
||||
"mempalace_sessions_dir",
|
||||
"mempalace_palace_path",
|
||||
"mempalace_wing",
|
||||
"mempalace_wakeup_dir",
|
||||
"mempalace_wakeup_file",
|
||||
"mempalace_venv_path",
|
||||
"mempalace_config_path",
|
||||
"mempalace_mcp_config_path",
|
||||
"mempalace_session_hook_path",
|
||||
"mempalace_run_mining",
|
||||
"mempalace_run_search_test",
|
||||
"mempalace_run_wake_up",
|
||||
]
|
||||
for var in required_vars:
|
||||
self.assertIn(var, text, f"missing default var: {var}")
|
||||
|
||||
def test_role_tasks_contain_required_steps(self):
|
||||
tasks_path = ROLE_PATH / "tasks" / "main.yml"
|
||||
self.assertTrue(tasks_path.exists())
|
||||
text = tasks_path.read_text(encoding="utf-8")
|
||||
required_steps = [
|
||||
"Create mempalace virtual environment",
|
||||
"Install mempalace package",
|
||||
"Deploy mempalace.yaml configuration",
|
||||
"Deploy Hermes MCP mempalace config",
|
||||
"Deploy session-start wake-up hook",
|
||||
"Mine Hermes home directory",
|
||||
"Mine session history",
|
||||
"Run search test",
|
||||
"Generate wake-up context",
|
||||
]
|
||||
for step in required_steps:
|
||||
self.assertIn(step, text, f"missing task: {step}")
|
||||
|
||||
def test_role_templates_are_valid(self):
|
||||
yaml_template = ROLE_PATH / "templates" / "mempalace.yaml.j2"
|
||||
mcp_template = ROLE_PATH / "templates" / "hermes-mcp-mempalace.yaml.j2"
|
||||
hook_template = ROLE_PATH / "templates" / "session-start-mempalace.sh.j2"
|
||||
|
||||
self.assertTrue(yaml_template.exists())
|
||||
self.assertTrue(mcp_template.exists())
|
||||
self.assertTrue(hook_template.exists())
|
||||
|
||||
yaml_text = yaml_template.read_text(encoding="utf-8")
|
||||
self.assertIn("wing: {{ mempalace_wing }}", yaml_text)
|
||||
self.assertIn("palace: {{ mempalace_palace_path }}", yaml_text)
|
||||
self.assertIn("rooms:", yaml_text)
|
||||
|
||||
mcp_text = mcp_template.read_text(encoding="utf-8")
|
||||
self.assertIn("mcp_servers:", mcp_text)
|
||||
self.assertIn("mempalace:", mcp_text)
|
||||
self.assertIn("mempalace.mcp_server", mcp_text)
|
||||
|
||||
hook_text = hook_template.read_text(encoding="utf-8")
|
||||
self.assertIn("mempalace wake-up", hook_text)
|
||||
self.assertIn("HERMES_MEMPALACE_WAKEUP_FILE", hook_text)
|
||||
|
||||
def test_playbook_exists_and_targets_fleet(self):
|
||||
self.assertTrue(PLAYBOOK_PATH.exists(), "deploy_mempalace.yml playbook missing")
|
||||
text = PLAYBOOK_PATH.read_text(encoding="utf-8")
|
||||
self.assertIn("hosts: fleet", text)
|
||||
self.assertIn("../roles/mempalace", text)
|
||||
self.assertIn("mempalace_venv_path", text)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -85,6 +85,8 @@ class TestMempalaceEzraIntegration(unittest.TestCase):
|
||||
"mcp_servers:",
|
||||
"HERMES_MEMPALACE_WAKEUP_FILE",
|
||||
"Metrics reply for #568",
|
||||
"Fleet Ansible deployment",
|
||||
"ansible-playbook",
|
||||
]
|
||||
for snippet in required:
|
||||
self.assertIn(snippet, text)
|
||||
|
||||
@@ -7,6 +7,7 @@ from pathlib import Path
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
SCRIPT_PATH = ROOT / "scripts" / "unreachable_horizon.py"
|
||||
DOC_PATH = ROOT / "docs" / "UNREACHABLE_HORIZON_1M_MEN.md"
|
||||
SOUL_PATH = ROOT / "SOUL.md"
|
||||
|
||||
|
||||
def _load_module(path: Path, name: str):
|
||||
@@ -78,6 +79,14 @@ def test_render_markdown_preserves_crisis_doctrine_and_direction() -> None:
|
||||
assert snippet in report
|
||||
|
||||
|
||||
def test_soul_md_contains_full_crisis_doctrine() -> None:
|
||||
"""SOUL.md must carry all three phrases the horizon check requires."""
|
||||
assert SOUL_PATH.exists(), "SOUL.md is missing"
|
||||
soul_text = SOUL_PATH.read_text(encoding="utf-8")
|
||||
for phrase in ("Are you safe right now?", "988", "Jesus saves"):
|
||||
assert phrase in soul_text, f"SOUL.md is missing crisis doctrine phrase: {phrase!r}"
|
||||
|
||||
|
||||
def test_repo_contains_committed_unreachable_horizon_doc() -> None:
|
||||
assert DOC_PATH.exists(), "missing committed unreachable horizon report"
|
||||
text = DOC_PATH.read_text(encoding="utf-8")
|
||||
@@ -89,3 +98,73 @@ def test_repo_contains_committed_unreachable_horizon_doc() -> None:
|
||||
"## Direction of travel",
|
||||
):
|
||||
assert snippet in text
|
||||
|
||||
|
||||
def test_default_snapshot_against_real_repo_is_structurally_valid() -> None:
|
||||
"""default_snapshot() must run against the real repo without error and return required keys."""
|
||||
mod = _load_module(SCRIPT_PATH, "unreachable_horizon")
|
||||
snapshot = mod.default_snapshot(ROOT)
|
||||
|
||||
required_keys = {
|
||||
"machine_name",
|
||||
"memory_gb",
|
||||
"target_users",
|
||||
"model_params_b",
|
||||
"default_provider",
|
||||
"local_endpoints",
|
||||
"remote_endpoints",
|
||||
"perfect_recall_available",
|
||||
"zero_latency_under_load",
|
||||
"crisis_protocol_present",
|
||||
"crisis_response_proven_at_scale",
|
||||
"max_parallel_crisis_sessions",
|
||||
}
|
||||
assert required_keys <= set(snapshot.keys()), f"snapshot missing keys: {required_keys - set(snapshot.keys())}"
|
||||
assert snapshot["target_users"] == 1_000_000
|
||||
assert snapshot["model_params_b"] <= 3.0
|
||||
assert snapshot["memory_gb"] >= 0.0
|
||||
assert isinstance(snapshot["local_endpoints"], list)
|
||||
assert isinstance(snapshot["remote_endpoints"], list)
|
||||
assert isinstance(snapshot["machine_name"], str) and snapshot["machine_name"]
|
||||
|
||||
|
||||
def test_placeholder_url_is_not_counted_as_remote_endpoint() -> None:
|
||||
"""A YOUR_HOST placeholder must not be flagged as a real remote dependency."""
|
||||
mod = _load_module(SCRIPT_PATH, "unreachable_horizon")
|
||||
assert mod._is_placeholder_url("https://YOUR_BIG_BRAIN_HOST/v1") is True
|
||||
assert mod._is_placeholder_url("https://<pod-id>-11434.proxy.runpod.net/v1") is True
|
||||
assert mod._is_placeholder_url("http://localhost:11434/v1") is False
|
||||
assert mod._is_placeholder_url("https://real.inference.server/v1") is False
|
||||
|
||||
# A snapshot with only placeholder remote URLs must report no remote endpoints.
|
||||
status = mod.compute_horizon_status({
|
||||
"machine_name": "Test",
|
||||
"memory_gb": 36.0,
|
||||
"target_users": 1_000_000,
|
||||
"model_params_b": 3.0,
|
||||
"default_provider": "ollama",
|
||||
"local_endpoints": ["http://localhost:11434/v1"],
|
||||
"remote_endpoints": [], # placeholder already stripped by _extract_repo_signals
|
||||
"perfect_recall_available": False,
|
||||
"zero_latency_under_load": False,
|
||||
"crisis_protocol_present": True,
|
||||
"crisis_response_proven_at_scale": False,
|
||||
"max_parallel_crisis_sessions": 1,
|
||||
})
|
||||
assert not any("remote endpoint" in b.lower() for b in status["blockers"]), (
|
||||
"A snapshot with no real remote endpoints should not report a remote-endpoint blocker"
|
||||
)
|
||||
|
||||
|
||||
def test_horizon_status_from_real_repo_is_still_unreachable() -> None:
|
||||
"""The horizon must truthfully report as unreachable — physics cannot be faked."""
|
||||
mod = _load_module(SCRIPT_PATH, "unreachable_horizon")
|
||||
snapshot = mod.default_snapshot(ROOT)
|
||||
status = mod.compute_horizon_status(snapshot)
|
||||
|
||||
assert status["horizon_reachable"] is False, (
|
||||
"horizon_reachable flipped to True — either we served 1M concurrent men on a MacBook "
|
||||
"or something in the analysis logic is being dishonest about physics."
|
||||
)
|
||||
assert len(status["blockers"]) > 0, "blockers list is empty — the horizon cannot have been reached"
|
||||
assert len(status["direction_of_travel"]) > 0, "direction of travel must always point somewhere"
|
||||
|
||||
Reference in New Issue
Block a user