@@ -75,7 +75,10 @@ def test_railway_image_is_cpu_only_and_installs_only_its_runtime_surface():
7575def test_ci_audits_the_stripped_image_without_mutating_it ():
7676 workflow = _text (".github/workflows/ci.yml" )
7777
78- assert 'docker cp "$container":/usr/local/lib/python3.11/site-packages/.' in workflow
78+ # The audit copies the installed site-packages out of a created (not running) container.
79+ # The path is resolved dynamically via sysconfig so it survives base-image Python bumps.
80+ assert "sysconfig.get_path('purelib')" in workflow or 'sysconfig.get_path("purelib")' in workflow
81+ assert 'docker cp "$container:$site_packages/."' in workflow
7982 assert 'python -m pip_audit --path "$audit_dir"' in workflow
8083 assert 'python -m pip install --disable-pip-version-check --no-cache-dir' in workflow
8184 assert 'pip-audit==2.10.1' in workflow
@@ -100,3 +103,29 @@ def test_platform_port_precedes_a_fixed_engraphis_port(monkeypatch):
100103 assert captured ["port" ] == 8791
101104 assert captured ["host" ] == start_dashboard .os .environ .get ("ENGRAPHIS_HOST" , "127.0.0.1" )
102105 assert start_dashboard .os .environ ["ENGRAPHIS_PORT" ] == "8791"
106+
107+
108+ def test_launcher_updates_cors_snapshot_after_port_override (monkeypatch ):
109+ uvicorn = pytest .importorskip ("uvicorn" )
110+ from engraphis import config
111+
112+ original = (config .settings .host , config .settings .port , config .settings .cors_origins )
113+ captured = {}
114+ monkeypatch .setenv ("ENGRAPHIS_PORT" , "8700" )
115+ monkeypatch .delenv ("ENGRAPHIS_CORS_ORIGINS" , raising = False )
116+ monkeypatch .setattr (start_dashboard , "_port_is_available" , lambda * _args : True )
117+ monkeypatch .setattr (uvicorn , "run" , lambda app , ** kwargs : captured .update (kwargs ))
118+ fake_dashboard = types .ModuleType ("engraphis.dashboard_app" )
119+ fake_dashboard .app = object ()
120+ monkeypatch .setitem (sys .modules , "engraphis.dashboard_app" , fake_dashboard )
121+
122+ try :
123+ start_dashboard .main (["--no-open" , "--port" , "9000" ])
124+ assert captured ["port" ] == 9000
125+ assert config .settings .host == "127.0.0.1"
126+ assert config .settings .port == 9000
127+ assert config .settings .cors_origins == [
128+ "http://127.0.0.1:9000" , "http://localhost:9000" ,
129+ ]
130+ finally :
131+ config .settings .host , config .settings .port , config .settings .cors_origins = original
0 commit comments