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:
2026-07-18 22:55:08 -07:00
parent 25d7a522cc
commit 05b28cb584
190 changed files with 2428 additions and 3337 deletions

View File

@@ -5,8 +5,8 @@ from __future__ import annotations
from pathlib import Path
import yaml
from castle_core.config import load_config
from castle_core.registry import (
from wildpc_core.config import load_config
from wildpc_core.registry import (
NodeConfig,
NodeRegistry,
load_registry,
@@ -18,7 +18,7 @@ def _write_min_config(root: Path, role: str | None) -> None:
data: dict = {"gateway": {"port": 18000}}
if role is not None:
data["role"] = role
(root / "castle.yaml").write_text(yaml.safe_dump(data))
(root / "wildpc.yaml").write_text(yaml.safe_dump(data))
def test_role_defaults_to_follower(tmp_path: Path) -> None:
@@ -32,12 +32,12 @@ def test_role_loaded_from_yaml(tmp_path: Path) -> None:
def test_save_config_round_trips_role_and_secrets(tmp_path: Path) -> None:
"""save_config rewrites castle.yaml from scratch — it must re-emit `role` and
"""save_config rewrites wildpc.yaml from scratch — it must re-emit `role` and
preserve the `secrets:` block, or a save reverts the node to a file-backend
follower (the regression this guards)."""
from castle_core.config import load_config, save_config
from wildpc_core.config import load_config, save_config
(tmp_path / "castle.yaml").write_text(
(tmp_path / "wildpc.yaml").write_text(
yaml.safe_dump(
{
"gateway": {"port": 18000},
@@ -47,57 +47,57 @@ def test_save_config_round_trips_role_and_secrets(tmp_path: Path) -> None:
)
)
save_config(load_config(tmp_path))
reloaded = yaml.safe_load((tmp_path / "castle.yaml").read_text())
reloaded = yaml.safe_load((tmp_path / "wildpc.yaml").read_text())
assert reloaded.get("role") == "authority"
assert reloaded.get("secrets", {}).get("backend") == "openbao"
def test_save_config_preserves_arbitrary_unmanaged_global(tmp_path: Path) -> None:
"""Any top-level key save_config doesn't model must survive a rewrite."""
from castle_core.config import load_config, save_config
from wildpc_core.config import load_config, save_config
(tmp_path / "castle.yaml").write_text(
(tmp_path / "wildpc.yaml").write_text(
yaml.safe_dump(
{"gateway": {"port": 18000}, "role": "authority", "future_thing": {"x": 1}}
)
)
save_config(load_config(tmp_path))
reloaded = yaml.safe_load((tmp_path / "castle.yaml").read_text())
reloaded = yaml.safe_load((tmp_path / "wildpc.yaml").read_text())
assert reloaded.get("future_thing") == {"x": 1}
assert reloaded.get("role") == "authority"
def test_write_deployment_file_leaves_globals_untouched(castle_root: Path) -> None:
"""A scoped deployment write must not rewrite castle.yaml globals (the PATCH
def test_write_deployment_file_leaves_globals_untouched(wildpc_root: Path) -> None:
"""A scoped deployment write must not rewrite wildpc.yaml globals (the PATCH
guarantee that stops a deployment edit from dropping role/secrets)."""
from castle_core.config import load_config, write_deployment_file
from wildpc_core.config import load_config, write_deployment_file
cy = castle_root / "castle.yaml"
cy = wildpc_root / "wildpc.yaml"
data = yaml.safe_load(cy.read_text())
data["role"] = "authority"
data["secrets"] = {"backend": "openbao"}
cy.write_text(yaml.safe_dump(data))
before = cy.read_text()
config = load_config(castle_root)
config = load_config(wildpc_root)
kind, name, _dep = next(iter(config.all_deployments()))
write_deployment_file(config, kind, name)
assert cy.read_text() == before # globals byte-identical — nothing touched them
def test_write_program_file_leaves_globals_untouched(castle_root: Path) -> None:
"""Scoped program write must not rewrite castle.yaml globals either."""
from castle_core.config import load_config, write_program_file
def test_write_program_file_leaves_globals_untouched(wildpc_root: Path) -> None:
"""Scoped program write must not rewrite wildpc.yaml globals either."""
from wildpc_core.config import load_config, write_program_file
cy = castle_root / "castle.yaml"
cy = wildpc_root / "wildpc.yaml"
data = yaml.safe_load(cy.read_text())
data["role"] = "authority"
data["secrets"] = {"backend": "openbao"}
cy.write_text(yaml.safe_dump(data))
before = cy.read_text()
config = load_config(castle_root)
config = load_config(wildpc_root)
name = next(iter(config.programs))
write_program_file(config, name)