fix(explorer): resolve blank dashboard UI and ship frontend bundle in wheel (#638)

* fix(explorer): resolve blank dashboard UI and ship frontend bundle in wheel

Fixes #631 — the Explorer server started successfully but the browser showed
a blank page because semantica/static/ was gitignored and never present after
a fresh install or clone.

Changes:
- ci.yml / release.yml: add Node 20 setup + npm ci && npm run build before
  python -m build so every wheel contains a CI-built frontend bundle
- pyproject.toml: add package-data patterns (static/*, static/assets/*) so
  setuptools includes the bundle in the wheel; add MANIFEST.in for sdist coverage
- app.py: replace silent empty-HTML fallback with a 200 page that clearly
  explains the missing bundle and links to /docs; fix CORS allow_credentials
  to default false, gated behind EXPLORER_CORS_CREDENTIALS env var to prevent
  credentialed cross-origin requests on unauthenticated endpoints
- __init__.py: warn at startup when --host is non-loopback (unauthenticated
  network exposure)
- explorer/README.md: full rewrite covering pip-install mode (primary path,
  no Node required) and dev-server mode (contributors), CLI flags, env vars,
  workspace table, troubleshooting for the blank-page symptom
- README.md: update Knowledge Explorer section with correct command and link
  to the new setup guide

* fix(explorer): set build.target esnext to fix esbuild CI failure

esbuild >=0.28 (forced via npm overrides) conflicts with Vite 6 defaults on
Linux CI — it tries to lower destructuring syntax for the implicit browser
target list but errors out. Explicit target: 'esnext' tells esbuild to emit
native syntax unchanged, bypassing the transpilation error entirely. Safe for
a developer tool that runs in modern browsers.

* test(explorer): verify packaged frontend bundle

---------

Co-authored-by: Zohaib Hassnain <109234410+ZohaibHassan16@users.noreply.github.com>
This commit is contained in:
Mohd Kaif
2026-06-16 14:38:24 +05:30
committed by GitHub
co-authored by Zohaib Hassnain
parent dfd96784a2
commit 46447d1f3f
10 changed files with 323 additions and 100 deletions
+27
View File
@@ -22,5 +22,32 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: explorer/package-lock.json
- name: Build Explorer frontend
working-directory: explorer
run: |
npm ci
npm run build
- run: pip install build
- run: python -m build
- name: Verify Explorer frontend is packaged
run: |
python - <<'PY'
import zipfile
from pathlib import Path
wheels = list(Path("dist").glob("*.whl"))
assert wheels, "No wheel was built"
with zipfile.ZipFile(wheels[0]) as wheel:
names = set(wheel.namelist())
assert "semantica/static/index.html" in names, "Explorer index.html missing from wheel"
assert any(name.startswith("semantica/static/assets/") for name in names), "Explorer assets missing from wheel"
print("Explorer frontend is packaged")
PY
+27
View File
@@ -17,8 +17,35 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: explorer/package-lock.json
- name: Build Explorer frontend
working-directory: explorer
run: |
npm ci
npm run build
- run: pip install build
- run: python -m build
- name: Verify Explorer frontend is packaged
run: |
python - <<'PY'
import zipfile
from pathlib import Path
wheels = list(Path("dist").glob("*.whl"))
assert wheels, "No wheel was built"
with zipfile.ZipFile(wheels[0]) as wheel:
names = set(wheel.namelist())
assert "semantica/static/index.html" in names, "Explorer index.html missing from wheel"
assert any(name.startswith("semantica/static/assets/") for name in names), "Explorer assets missing from wheel"
print("Explorer frontend is packaged")
PY
- uses: softprops/action-gh-release@v3
with:
files: dist/*