fix: refuse the Docker-only options in native mode instead of ignoring them

`up --native` took --expose, --domain and --docling and did nothing with them.
Asking for network exposure and silently getting a loopback-only install, or
asking for docling and getting an install without it, is worse than being told.
Each now says what to do instead: a reverse proxy or the Docker stack for
exposure, and the docling extra for the parser engine. --expose local and
--no-docling already describe native mode, so they stay silent.
This commit is contained in:
Alex committed 2026-09-16 23:03:03 +01:00
1 parent 501baf8aae
commit 6cfd0948bc
2 files changed
+33

No files matched your search

+16
View File
@@ -164,6 +164,22 @@ class TestNativeUp:
assert _run(["uninstall", "--yes", "--dir", str(tmp_path)], _native_context(services)) == 0
assert sorted(services.removed) == ["docsgpt-api", "docsgpt-worker"]
def test_docker_only_options_are_refused_rather_than_ignored(self, tmp_path):
"""Asking for network exposure and silently getting loopback is the worst of both."""
base = ["up", "--native", "--dir", str(tmp_path), "--yes", "--postgres-uri", "postgresql://localhost/d"]
with pytest.raises(DeployError, match="127.0.0.1 only"):
_run([*base, "--expose", "network"], _native_context())
with pytest.raises(DeployError, match="127.0.0.1 only"):
_run([*base, "--domain", "docs.example.com"], _native_context())
with pytest.raises(DeployError, match=r"docsgpt\[docling\]"):
_run([*base, "--docling"], _native_context())
assert not (tmp_path / ".env").exists(), "it refuses before writing anything"
def test_the_options_that_describe_what_native_already_does_are_kept(self, tmp_path):
argv = ["up", "--native", "--dir", str(tmp_path), "--yes", "--postgres-uri", "postgresql://localhost/d",
"--expose", "local", "--no-docling"]
assert _run(argv, _native_context()) == 0
def test_a_database_url_is_required(self, tmp_path):
with pytest.raises(DeployError, match="--postgres-uri"):
_run(["up", "--native", "--dir", str(tmp_path), "--yes"], _native_context())