fix(install): dispatch Windows postInstall to cross-platform setup.py + exercise real install path in CI - #117
Merged
Merged
Conversation
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>
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>
Closed
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.jsondéclarant win32. Et le job CItest-windowsn'exerçait jamais le vrai chemin postInstall (pip install -edirect), 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 jobtest-windowsexécute désormaisbash scripts/install-plugin.shréel (modeCORTEX_MEMORY_STORE_BACKEND=sqlitepour éviter de dépendre d'un PostgreSQL runner non vérifiable).Vérifications :
bash -nsur les scripts ; harnais prouvant le routage des 6 valeursuname -sdocumentées ; 9 nouveaux tests pytest (dérivation SKIP_POSTGRES + branchementverify()) ; suitestests_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-windowsde 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