Files
NexusOS/bin/check.sh
T
Athena 26b471d259 Merge origin/main (v1.2.0: Projects, modules, in-app updates)
Reconciles 17 commits of this session's work (self-alteration tools,
vendored Curry, slash-command dispatch, Windows toolchain/gate fixes)
against origin/main's v1.2.0 sync (Projects/RAG scoping, a new modules/
system for mail and network, in-app updates, the standalone memory
microservice folded into an in-process curator, KDE desktop theme
overhaul). Nine real conflicts, each resolved by hand after reading both
sides' actual diffs rather than picking one side wholesale:

- synapse/tools.py, tests/test_tools.py: origin/main's diff here was
  small and clean (read_file/list_files, two new tests) despite git's
  diff3 flagging the whole file as one conflict blob -- reset to this
  branch's version and hand-spliced their addition in at the same
  points they used, rather than trying to reconcile a false 800-line
  conflict. Found and fixed a real bug while verifying: _list_files
  returned backslash-separated paths on Windows, which don't match the
  forward-slash glob patterns the tool's own schema documents.
- synapse/main.py: kept this branch's cue-based standing advertisement
  of render_preview/run_snippet (independent of any playbook granting
  them) AND adopted origin/main's fix for routed reference playbooks
  not bringing their own tools along -- dropping either would have been
  a real regression, not just a style difference. Also: the standalone
  memory service (port 8001) is gone upstream, so its dead CORS/kill-
  target entries were removed; NEXUS_BACKEND_PORT parameterization and
  the manage_ollama-conditional kill logic (this branch's remote-Ollama
  support) were kept over origin/main's hardcoded equivalents.
- synapse/memory/store.py: kept this branch's _delete_message_vectors
  helper (already reused elsewhere, batches to stay under SQLite's
  variable limit) over origin/main's inline duplicate of the same fix.
- synapse/nexus_config.py, nexusos_cli/ncp.py: dropped the now-dead
  memory-service port/service entries; kept NEXUS_BACKEND_PORT env
  override and the manage_ollama-conditional kill-target list.
- CLAUDE.md, README.md: merged both sides' additions, no real conflict.

Found and fixed three more issues while independently verifying the
merged tree, none of them mine or origin/main's alone -- only visible
once both sides actually ran together:

- modules/ (the new mail+network package) was never added to
  pyproject.toml's wheel `packages` list OR the sdist's `include`
  allowlist, so `from modules.registry import ROUTERS` in main.py would
  ImportError on any wheel install. Fixed both; bin/check.sh's
  packaging gate now asserts modules/ actually ships. tests/
  test_packaging_deps.py's FIRST_PARTY/SHIPPED_PACKAGES sets were
  updated to recognize the new package.
- tests/test_mail_creds.py's 0600-mode assertions are POSIX-only --
  NTFS has no equivalent permission bits, so os.open(path, 0o600) on
  Windows just creates a normal file and stat.S_IMODE reports 0o666
  regardless. Made the assertions platform-aware rather than skip real
  coverage (the temp-file-cleanup and password round-trip checks in the
  same test still run on Windows) or paper over a genuine OS
  limitation with a fake pass.
- tests/test_kde_theme.py used bare Path.read_text() in fifteen places;
  Windows' default locale encoding (cp1252, not UTF-8) can't decode a
  real UTF-8 byte in the QML it reads, and did fail on one of the
  fifteen. Fixed all fifteen, not just the one that happened to trip
  today, since the other fourteen were equally fragile.

Verified: full bin/check.sh reports OK end-to-end on this Windows
checkout -- pytest (tests + management): 295 passed, 0 failed, 9
skipped; eslint clean; frontend node:test 57/57; PowerShell/shell
parse clean; wheel + sdist pass twine check and now correctly carry
modules/ (60 files, up from 52 pre-merge). synapse.main:app builds
with 74 routes (up from 54 pre-merge, matching the new Projects/mail/
network endpoints).
2026-08-26 02:09:23 -05:00

98 lines
3.8 KiB
Bash

#!/usr/bin/env bash
# One command that answers "is this shippable" - Python tests + frontend lint.
#
# ponytail: this IS the CI. The remote is self-hosted Gitea with no act_runner,
# so a .github/workflows file would never execute. Run this before tagging a
# release; wire it to a runner the day one exists.
set -uo pipefail
cd "$(dirname "$0")/.."
fail=0
if [ -x Promethean/bin/python ]; then
NEXUS_CHECK_PY=Promethean/bin/python
elif [ -x Promethean/Scripts/python.exe ]; then
NEXUS_CHECK_PY=Promethean/Scripts/python.exe
else
echo "!! no Promethean venv - run ./install.sh first" >&2
exit 1
fi
echo "== pytest =="
# Explicit dirs: a bare `pytest` would walk Promethean/ and node_modules too.
"$NEXUS_CHECK_PY" -m pytest -q tests management || fail=1
echo "== eslint =="
if [ -d interface/web/node_modules ]; then
(cd interface/web && npm run lint) || fail=1
else
echo "-- skipped: interface/web/node_modules missing (npm install)"
fi
echo "== frontend unit tests =="
# The JSX/TSX transform behind the preview window is a pure module with a
# node --test suite. Nothing else in the frontend has tests, so this is cheap;
# without it the transform's silent-wrong cases go unguarded.
if [ -d interface/web/node_modules ]; then
(cd interface/web && npm test) || fail=1
else
echo "-- skipped: interface/web/node_modules missing (npm install)"
fi
echo "== powershell parse =="
# The Windows installer has died at parse twice. Cheap to catch here if pwsh
# happens to be installed on the Linux box; the ASCII guard in tests/ is the
# portable half of the same check.
if command -v pwsh >/dev/null; then
for f in install-windows.ps1 launch_nexus.ps1; do
pwsh -NoProfile -Command "\$e=\$null
[System.Management.Automation.Language.Parser]::ParseFile('$f',[ref]\$null,[ref]\$e) | Out-Null
if (\$e) { \$e | ForEach-Object { Write-Host '$f:' \$_.Message }; exit 1 }" || fail=1
done
else
echo "-- skipped: pwsh not installed"
fi
echo "== shell parse =="
for f in scripts/install-termux.sh install-macos.sh launch_nexus.sh management/nexus-cli.sh; do
[ -f "$f" ] && { bash -n "$f" || fail=1; }
done
echo "== packaging =="
# The wheel is the other shippable artifact, so it belongs in the same gate:
# a broken pyproject or a missing web build only shows up at build time.
if "$NEXUS_CHECK_PY" -c "import build, twine" 2>/dev/null; then
rm -rf .build-check
if "$NEXUS_CHECK_PY" -m build --outdir .build-check >/dev/null 2>&1; then
"$NEXUS_CHECK_PY" -m twine check .build-check/* || fail=1
# The compiled UI has to actually be inside the wheel - a wheel that
# builds but ships no dist/ serves a blank page.
"$NEXUS_CHECK_PY" - <<'PY' || fail=1
import glob, sys, zipfile
wheels = glob.glob(".build-check/*.whl")
if not wheels:
sys.exit("no wheel produced")
names = zipfile.ZipFile(wheels[0]).namelist()
if not any(n.startswith("synapse/_resources/web/") for n in names):
sys.exit("wheel is missing the compiled web UI (cd interface/web && npm run build)")
if not any(n.startswith("synapse/_resources/playbooks/") for n in names):
sys.exit("wheel is missing the seed playbooks")
if "synapse/curry_core.py" not in names or "synapse/curry_store.py" not in names:
sys.exit("wheel is missing vendored Curry (synapse/curry_core.py / curry_store.py)")
if "synapse/slash_commands.py" not in names:
sys.exit("wheel is missing synapse/slash_commands.py")
if not any(n.startswith("modules/") for n in names):
sys.exit("wheel is missing the modules/ package (mail, network) - check pyproject.toml packages=[...]")
print(f"wheel OK: {len(names)} files")
PY
else
echo "!! wheel build failed"; fail=1
fi
rm -rf .build-check
else
echo "-- skipped: build/twine missing (pip install -e '.[dev]')"
fi
[ "$fail" -eq 0 ] && echo "OK" || echo "FAILED"
exit "$fail"