1010
1111import re
1212from pathlib import Path
13+ from typing import Any
1314
1415import yaml
1516
2223_UPDATE = _ROOT / "scripts" / "fa-update.sh"
2324
2425
25- def _compose () -> dict :
26+ def _compose () -> dict [ str , Any ] :
2627 return yaml .safe_load (_COMPOSE .read_text (encoding = "utf-8" ))
2728
2829
@@ -128,9 +129,9 @@ def test_no_duplicate_pythonpath_on_agent() -> None:
128129 """B7: PYTHONPATH is owned by the entrypoint; setting it in compose too
129130 produces /workspace/src:/workspace/src."""
130131 agent = _compose ()["services" ]["first-agent" ]
131- assert not any (
132- str ( e ). startswith ( " PYTHONPATH=" ) for e in agent . get ( "environment" , [])
133- ), "drop PYTHONPATH from compose; the entrypoint sets it"
132+ assert not any (str ( e ). startswith ( "PYTHONPATH=" ) for e in agent . get ( "environment" , [])), (
133+ "drop PYTHONPATH from compose; the entrypoint sets it"
134+ )
134135
135136
136137# --- setup script ---------------------------------------------------------
@@ -141,7 +142,7 @@ def test_setup_seeds_provider_secrets_from_fa_env_template() -> None:
141142 text = _SETUP .read_text (encoding = "utf-8" )
142143 assert "secrets/fa.env.template" in text
143144 assert not re .search (
144- r' ^\s*TEMPLATE=\"\$FA_DIR/repo/First-Agent-dev/\.env\.fa\.template\"' ,
145+ r" ^\s*TEMPLATE=\"\$FA_DIR/repo/First-Agent-dev/\.env\.fa\.template\"" ,
145146 text ,
146147 re .MULTILINE ,
147148 )
@@ -154,6 +155,8 @@ def test_post_setup_checks_changeme_only_on_active_secret_lines() -> None:
154155 assert "grep -qiE" in text
155156 assert "^[[:space:]]*[A-Z0-9_]+(API_KEY|_TOKEN|_SECRET)" in text
156157 assert "grep -qi 'CHANGEME'" not in text
158+
159+
157160def test_setup_chowns_state_to_container_uid () -> None :
158161 """B3: bind-mounted state/secrets must be owned by the container's uid (1000),
159162 not the host username (which may be a different uid)."""
@@ -212,15 +215,15 @@ def test_clean_rebuild_brings_up_via_compose_not_systemd_start() -> None:
212215 """fa-clean-rebuild must bring the stack up with `docker compose up -d`
213216 (authoritative), not `systemctl --user start` which can silently no-op."""
214217 text = _CLEAN_REBUILD .read_text (encoding = "utf-8" )
215- assert " docker compose -f \ " ${COMPOSE_FILE}\ " up -d" in text
218+ assert ' docker compose -f "${COMPOSE_FILE}" up -d' in text
216219 # It may still `enable` for reboot, but must not depend on `start` to run.
217- assert " systemctl --user start \ " ${SERVICE}\" " not in text , (
220+ assert ' systemctl --user start "${SERVICE}"' not in text , (
218221 "clean-rebuild must not rely on systemctl start to run the stack"
219222 )
220223
221224
222225# --- unified routing file (ADR-12 Option C / R2-2) ----------------------------
223- def _volume_by_target (service : dict , target : str ) -> dict :
226+ def _volume_by_target (service : dict [ str , Any ], target : str ) -> dict [ str , Any ] :
224227 return next (
225228 vol
226229 for vol in service .get ("volumes" , [])
@@ -288,7 +291,6 @@ def test_deploy_scripts_do_not_sync_proxy_models_copy() -> None:
288291 assert "Syncing proxy routing config" not in text
289292
290293
291-
292294def test_fa_update_reexecs_after_git_pull_to_use_new_deploy_logic () -> None :
293295 """Updating deploy code and compose in one pull must run the updated script.
294296
@@ -308,12 +310,13 @@ def test_clean_rebuild_wipe_state_ignores_legacy_models_when_recreating_routing(
308310 assert 'LEGACY_STATE_MODELS=""' in text
309311 assert 'LEGACY_PROXY_MODELS=""' in text
310312
313+
311314def test_clean_rebuild_no_cache_and_progress_are_configurable () -> None :
312315 text = _CLEAN_REBUILD .read_text (encoding = "utf-8" )
313316 assert 'NO_CACHE="${NO_CACHE:-1}"' in text
314317 assert 'COMPOSE_BUILD_PULL="${COMPOSE_BUILD_PULL:-1}"' in text
315318 assert 'BUILD_PROGRESS="${BUILD_PROGRESS:-auto}"' in text
316- assert ' build_cmd+=(--no-cache)' in text
319+ assert " build_cmd+=(--no-cache)" in text
317320 assert 'build_cmd+=(--progress "${BUILD_PROGRESS}")' in text
318321
319322
0 commit comments