Rename Castle -> Wild PC across the repo
Repo-side rename only (Phases 1-3 of the migration plan); the live box (~/.castle, systemd units, /data/castle, domains) is a separate cutover. - Slug `castle` -> `wildpc`: CLI command, module names (wildpc_core/cli/api), dist names, entry point `wildpc = wildpc_cli.main:main`. - Identifiers: CastleConfig/NATSClient/DirError/MDNS -> Wildpc*. - Env/constants: CASTLE_* -> WILDPC_*; ~/.castle -> ~/.wildpc, castle.yaml -> wildpc.yaml, /data/castle -> /data/wildpc. - Systemd UNIT_PREFIX castle- -> wildpc-; own programs castle-api/gateway/etc. - Display prose "Castle" -> "Wild PC" in docs, agent-guide files, README, frontend. - Package dirs and bootstrap yaml renamed via git mv; lockfiles regenerated; redundant nested uv.lock files dropped (workspace root lock is authoritative). Tests: core 273, cli 47, wildpc-api 120 all pass. Frontend type-checks + builds. Fixed a stale test fixture (secret_env_path kind arg) broken pre-rename.
This commit is contained in:
@@ -4,23 +4,23 @@ from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from castle_core.generators.systemd import (
|
||||
from wildpc_core.generators.systemd import (
|
||||
generate_timer,
|
||||
generate_unit_from_deployed,
|
||||
secret_env_path,
|
||||
unit_env_file,
|
||||
unit_name,
|
||||
)
|
||||
from castle_core.registry import Deployment
|
||||
from wildpc_core.registry import Deployment
|
||||
|
||||
|
||||
class TestUnitName:
|
||||
"""Tests for systemd unit naming."""
|
||||
|
||||
def test_unit_name_format(self) -> None:
|
||||
"""Unit names follow castle-<name>.service pattern."""
|
||||
assert unit_name("central-context") == "castle-central-context.service"
|
||||
assert unit_name("my-svc") == "castle-my-svc.service"
|
||||
"""Unit names follow wildpc-<name>.service pattern."""
|
||||
assert unit_name("central-context") == "wildpc-central-context.service"
|
||||
assert unit_name("my-svc") == "wildpc-my-svc.service"
|
||||
|
||||
|
||||
class TestUnitFromDeployed:
|
||||
@@ -35,7 +35,7 @@ class TestUnitFromDeployed:
|
||||
description="Test service",
|
||||
)
|
||||
unit = generate_unit_from_deployed("test-svc", deployed)
|
||||
assert "Description=Castle: Test service" in unit
|
||||
assert "Description=Wild PC: Test service" in unit
|
||||
|
||||
def test_no_working_directory(self) -> None:
|
||||
"""Unit file has no WorkingDirectory (source/runtime separation)."""
|
||||
@@ -53,14 +53,14 @@ class TestUnitFromDeployed:
|
||||
deployed = Deployment(
|
||||
manager="systemd", launcher="python",
|
||||
run_cmd=["/home/user/.local/bin/uv", "run", "test-svc"],
|
||||
env={"TEST_SVC_DATA_DIR": "/home/user/.castle/data/test-svc"},
|
||||
env={"TEST_SVC_DATA_DIR": "/home/user/.wildpc/data/test-svc"},
|
||||
description="Test service",
|
||||
)
|
||||
unit = generate_unit_from_deployed("test-svc", deployed)
|
||||
assert "Environment=TEST_SVC_DATA_DIR=/home/user/.castle/data/test-svc" in unit
|
||||
assert "Environment=TEST_SVC_DATA_DIR=/home/user/.wildpc/data/test-svc" in unit
|
||||
|
||||
def test_default_path_emitted_when_absent(self) -> None:
|
||||
"""Castle supplies a default PATH when the service doesn't pin one."""
|
||||
"""Wild PC supplies a default PATH when the service doesn't pin one."""
|
||||
deployed = Deployment(
|
||||
manager="systemd", launcher="python",
|
||||
run_cmd=["/home/user/.local/bin/uv", "run", "test-svc"],
|
||||
@@ -99,7 +99,7 @@ class TestUnitFromDeployed:
|
||||
assert unit.count("PATH=") == 1
|
||||
|
||||
def test_explicit_path_overrides_default(self) -> None:
|
||||
"""A PATH pinned in defaults.env wins — Castle does not append its own,
|
||||
"""A PATH pinned in defaults.env wins — Wild PC does not append its own,
|
||||
which would clobber it under systemd's last-assignment-wins rule."""
|
||||
deployed = Deployment(
|
||||
manager="systemd", launcher="python",
|
||||
@@ -140,15 +140,15 @@ class TestUnitFromDeployed:
|
||||
run_cmd=["/home/user/.local/bin/uv", "run", "my-svc"],
|
||||
env={
|
||||
"MY_SVC_PORT": "9001",
|
||||
"MY_SVC_DATA_DIR": "/home/user/.castle/data/my-svc",
|
||||
"MY_SVC_DATA_DIR": "/home/user/.wildpc/data/my-svc",
|
||||
},
|
||||
description="My service",
|
||||
)
|
||||
unit = generate_unit_from_deployed("my-svc", deployed)
|
||||
assert "Description=Castle: My service" in unit
|
||||
assert "Description=Wild PC: My service" in unit
|
||||
assert "ExecStart=/home/user/.local/bin/uv run my-svc" in unit
|
||||
assert "Environment=MY_SVC_PORT=9001" in unit
|
||||
assert "Environment=MY_SVC_DATA_DIR=/home/user/.castle/data/my-svc" in unit
|
||||
assert "Environment=MY_SVC_DATA_DIR=/home/user/.wildpc/data/my-svc" in unit
|
||||
assert "WorkingDirectory" not in unit
|
||||
assert "Restart=on-failure" in unit
|
||||
|
||||
@@ -170,7 +170,7 @@ class TestUnitFromDeployed:
|
||||
deployed = Deployment(
|
||||
manager="systemd", launcher="python",
|
||||
run_cmd=["/home/user/.local/bin/uv", "run", "my-svc"],
|
||||
env={"DATA_DIR": "/home/user/.castle/data/my-svc"},
|
||||
env={"DATA_DIR": "/home/user/.wildpc/data/my-svc"},
|
||||
description="Test",
|
||||
)
|
||||
unit = generate_unit_from_deployed("my-svc", deployed)
|
||||
@@ -180,12 +180,12 @@ class TestUnitFromDeployed:
|
||||
"""A compose deployment's stop_cmd becomes ExecStop= (clean teardown)."""
|
||||
deployed = Deployment(
|
||||
manager="systemd", launcher="compose",
|
||||
run_cmd=["/usr/bin/docker", "compose", "-p", "castle-x", "-f", "c.yml", "up"],
|
||||
stop_cmd=["/usr/bin/docker", "compose", "-p", "castle-x", "-f", "c.yml", "down"],
|
||||
run_cmd=["/usr/bin/docker", "compose", "-p", "wildpc-x", "-f", "c.yml", "up"],
|
||||
stop_cmd=["/usr/bin/docker", "compose", "-p", "wildpc-x", "-f", "c.yml", "down"],
|
||||
description="Stack",
|
||||
)
|
||||
unit = generate_unit_from_deployed("x", deployed)
|
||||
assert "ExecStop=/usr/bin/docker compose -p castle-x -f c.yml down" in unit
|
||||
assert "ExecStop=/usr/bin/docker compose -p wildpc-x -f c.yml down" in unit
|
||||
|
||||
def test_no_exec_stop_without_stop_cmd(self) -> None:
|
||||
"""Runners without a stop_cmd rely on SIGTERM — no ExecStop line."""
|
||||
@@ -206,7 +206,7 @@ class TestSecretEnvFile:
|
||||
env={"PORT": "9001"},
|
||||
secret_env_keys=["API_KEY"],
|
||||
)
|
||||
path = Path("/home/u/.castle/secrets/env/castle-my-svc.service.env")
|
||||
path = Path("/home/u/.wildpc/secrets/env/wildpc-my-svc.service.env")
|
||||
unit = generate_unit_from_deployed("my-svc", deployed, env_file=path)
|
||||
assert f"EnvironmentFile={path}" in unit
|
||||
# fail-loud: no '-' prefix
|
||||
@@ -220,7 +220,7 @@ class TestSecretEnvFile:
|
||||
schedule="0 2 * * *",
|
||||
secret_env_keys=["TOKEN"],
|
||||
)
|
||||
path = Path("/home/u/.castle/secrets/env/castle-my-job.service.env")
|
||||
path = Path("/home/u/.wildpc/secrets/env/wildpc-my-job.service.env")
|
||||
unit = generate_unit_from_deployed("my-job", deployed, env_file=path)
|
||||
assert "Type=oneshot" in unit
|
||||
assert f"EnvironmentFile={path}" in unit
|
||||
@@ -266,7 +266,7 @@ class TestGenerateTimer:
|
||||
def test_daily_timer(self) -> None:
|
||||
"""Daily cron produces OnCalendar timer."""
|
||||
timer = generate_timer("my-job", schedule="0 2 * * *", description="Nightly")
|
||||
assert "Description=Castle timer: Nightly" in timer
|
||||
assert "Description=Wild PC timer: Nightly" in timer
|
||||
assert "OnCalendar=*-*-* 02:00:00" in timer
|
||||
assert "WantedBy=timers.target" in timer
|
||||
|
||||
@@ -279,4 +279,4 @@ class TestGenerateTimer:
|
||||
def test_fallback_description(self) -> None:
|
||||
"""Timer uses name when no description given."""
|
||||
timer = generate_timer("my-job", schedule="0 0 * * *")
|
||||
assert "Description=Castle timer: my-job" in timer
|
||||
assert "Description=Wild PC timer: my-job" in timer
|
||||
|
||||
Reference in New Issue
Block a user