Skip to content

fix(install): dispatch Windows postInstall to cross-platform setup.py + exercise real install path in CI - #117

Merged
cdeust merged 2 commits into
mainfrom
fix/plugin-postinstall-windows
Jul 14, 2026
Merged

fix(install): dispatch Windows postInstall to cross-platform setup.py + exercise real install path in CI#117
cdeust merged 2 commits into
mainfrom
fix/plugin-postinstall-windows

Conversation

@cdeust

@cdeust cdeust commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Fixes #113.

Cause racine : le dispatch OS vivait uniquement dans setup.sh (intrinsèquement macOS/Linux — brew/apt) ; sous Git Bash Windows, uname -s = MINGW64_NT-*/MSYS_NT-*/CYGWIN_NT-*, non matché → « Unsupported OS » sec malgré manifest.json déclarant win32. Et le job CI test-windows n'exerçait jamais le vrai chemin postInstall (pip install -e direct), rendant le trou invisible.

Fix au point de dispatch unique (install-plugin.sh, seule entrée du postInstall) : case "$(uname -s)" — Darwin/Linux inchangés ; motifs Git Bash Windows → délégation à scripts/setup.py (déjà cross-platform) ; OS réellement non supporté → message actionnable nommant la commande manuelle. CI : le job test-windows exécute désormais bash scripts/install-plugin.sh réel (mode CORTEX_MEMORY_STORE_BACKEND=sqlite pour éviter de dépendre d'un PostgreSQL runner non vérifiable).

Vérifications : bash -n sur les scripts ; harnais prouvant le routage des 6 valeurs uname -s documentées ; 9 nouveaux tests pytest (dérivation SKIP_POSTGRES + branchement verify()) ; suites tests_py/scripts + test_platform.py : 115 passed, 0 régression ; ruff check + format clean. verify() splittée en _sqlite_checks/_postgres_checks/_model_checks (≤35 lignes chacune) au passage (§4.2/§4.5).

Preuve finale : le step test-windows de CETTE PR est le test réel du chemin d'install — à surveiller sur ce run.

🤖 Generated with Claude Code

https://claude.ai/code/session_01R5Z1wfiBpADgENq6pB6E2i

cdeust and others added 2 commits July 14, 2026 21:05
install-plugin.sh's Phase 1 unconditionally ran scripts/setup.sh, whose
detect_os() only matches Darwin/Linux. On native Windows, plugin.json's
postInstall runs under Git Bash, whose uname -s reports
MINGW64_NT-*/MSYS_NT-*/CYGWIN_NT-* — none of which setup.sh recognized,
so it failed with a bare "Unsupported OS" even though manifest.json
declares win32 compatible.

install-plugin.sh now dispatches by uname -s at its single upstream
entry point: Darwin/Linux keep the existing setup.sh path; the Git Bash
Windows patterns delegate to the already cross-platform scripts/setup.py
with an actionable failure message; any other OS fails with a message
naming the manual fallback instead of a dead end.

scripts/setup.py gains a CORTEX_MEMORY_STORE_BACKEND=sqlite CI/testing
mode that skips PostgreSQL provisioning/verification so this path can be
exercised without a provisioned server. The CI test-windows job (which
already sets that env var) now runs the real
install-plugin.sh -> setup.py path instead of only `pip install -e`,
so this contract cannot silently regress again.

Fixes #113

Co-Authored-By: Claude <noreply@anthropic.com>
…ke verify() tests hermetic

CI run 29360566538 on the new test-windows postInstall step failed with
OSError: [Errno 22] Invalid argument: 'D:\x07\Cortex\Cortex/.claude-plugin/plugin.json'.

Root cause: install-plugin.sh read the plugin version by splicing
$PLUGIN_JSON directly into a `python -c "...open('$PLUGIN_JSON')..."`
source string. GitHub Actions' github.workspace on Windows is
D:\a\Cortex\Cortex; once spliced into a Python single-quoted string
literal, "\a" is parsed as the ASCII BEL escape (0x07), corrupting the
path exactly as observed. Fixed by passing the path through an
environment variable instead (CORTEX_PLUGIN_JSON_PATH), read via
os.environ in the -c script — env vars are raw bytes, never
escape-reinterpreted, so this is safe for any path content on any OS,
not a Windows-only patch. Also normalize PLUGIN_ROOT once via `cygpath -m`
(Git Bash/MSYS2, no-op elsewhere) so every downstream forward-slash
concatenation no longer produces the mixed D:\a\Cortex\Cortex/... form
visible in the same error.

Separately: the two new verify()-branch tests asserted a real
SystemExit, which depends on whether sentence-transformers/flashrank/
psycopg happen to be importable and a PostgreSQL server is reachable in
whatever environment runs the suite — non-deterministic across the
Linux 3.10-3.13 matrix, hence "DID NOT RAISE SystemExit" there while
passing locally. _sqlite_checks/_postgres_checks/_model_checks are
documented as never-raising, so verify() itself is only responsible for
selecting the right check function and exiting when a check reports
False. Rewrote the tests to mock those three helpers directly and
assert on call/no-call and on exit given a mocked failing check —
hermetic: no import availability, no network, no real database.

Verified: bash -n on both modified shell scripts; a standalone
repro proving the old interpolation produces \x07 and the new env-var
passing preserves the path byte-for-byte; ruff check + ruff format
--check clean; tests_py/scripts + tests_py/shared/test_platform.py
green (117 passed, 5 skipped, no regressions).

Fixes #113

Co-Authored-By: Claude <noreply@anthropic.com>
@cdeust
cdeust merged commit 39b9c2e into main Jul 14, 2026
14 checks passed
@cdeust
cdeust deleted the fix/plugin-postinstall-windows branch July 14, 2026 20:19
pull Bot pushed a commit to asleekgeek/Cortex that referenced this pull request Jul 15, 2026
Cuts 13 commits ahead of v4.14.1: core→infrastructure layer-violation
cleanup via reverse-DI ports-and-adapters (cdeust#135), check_setup MCP tool +
/preflight command (cdeust#115, cdeust#119, cdeust#133), XDG-aware embedding cache_folder
(cdeust#132), project settings catalogue + headless CI regimes (cdeust#131), devcontainer
with prewarmed models (cdeust#129), optional OTLP telemetry (cdeust#128), stale docs/
module-count fixes (cdeust#130, cdeust#121), CLAUDE.md refactor (cdeust#125), Windows
postInstall dispatch fix (cdeust#117). No retrieval-path code touched.

Pre-tag guard on the exact release tree (git_sha 018c76d, isolated
ephemeral pgvector container via benchmarks/reproduce.sh --no-ablation):
LongMemEval MRR 0.9166/R@10 0.9820 (matches v4.14.1, no regression); LoCoMo
3-run mean MRR 0.8009/R@10 0.9146 (vs v4.14.1's 3-run mean 0.7984/0.9142,
an improvement within noise); BEAM MRR 0.5437/R@10 0.7139 (within v4.14.1's
established intra-day variance band). All 4 gated floors PASS (tolerance
0.005) — unlike v4.14.1 where LoCoMo MRR failed the absolute floor on its
3-run mean, 4.14.2's mean clears it by -0.0041. Evidence:
benchmarks/results/repro/20260715-v4.14.2-pretag/.

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

postInstall du plugin cassé sur Windows natif : setup.sh échoue sur tout OS ≠ Darwin/Linux, et la CI ne teste pas le vrai chemin d'install

1 participant