Start without git, and say what that costs
A `pip install` on a locked-down host — the case the CLI exists for — may have no git, and the store shelled out to it while building the flow repository, so the engine refused to start at all. The store is files; git is their history. Missing it is now one warning and no commits rather than a stack trace, which is the difference between a machine that runs your experiments and one that does not. Found by installing the wheels into a bare python:3.12-slim and pairing it with the portal: `fluksio enroll` took the code, `fluksio serve` dialled out, and the hub was proxying requests through the tunnel. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -34,3 +34,29 @@ def test_the_secret_key_is_kept_rather_than_regenerated(tmp_path: Path) -> None:
|
||||
first = load_or_create_secret_key(path)
|
||||
assert load_or_create_secret_key(path) == first
|
||||
assert path.stat().st_mode & 0o777 == 0o600
|
||||
|
||||
|
||||
def test_the_store_works_without_git(tmp_path: Path, monkeypatch) -> None:
|
||||
"""A pip install on a locked-down host may have no git.
|
||||
|
||||
Flows are files, and that is what the store is for; the history is the part
|
||||
that needs git. Losing it must not be a refusal to start.
|
||||
"""
|
||||
import subprocess as sp
|
||||
|
||||
from fluksio.flow.store import FlowStore
|
||||
|
||||
real_run = sp.run
|
||||
|
||||
def no_git(cmd, *args, **kwargs):
|
||||
if cmd and cmd[0] == "git":
|
||||
raise FileNotFoundError(2, "No such file or directory", "git")
|
||||
return real_run(cmd, *args, **kwargs)
|
||||
|
||||
monkeypatch.setattr(sp, "run", no_git)
|
||||
monkeypatch.setattr(FlowStore, "_warned_no_git", False)
|
||||
|
||||
store = FlowStore(tmp_path / "flows")
|
||||
assert store.head() == ""
|
||||
store.write_requirements("numpy\n")
|
||||
assert store.read_requirements() == "numpy\n"
|
||||
|
||||
Reference in New Issue
Block a user