Understand any codebase instantly. System intelligence for codebases, built for humans and AI.
TypeScript aiai-memoryclaude-codeclicode-analysiscode-mappingcode-memorycodebase-understandingcodexdeveloper-toolsllmopenclawpersistent-memoryprogram-analysissoftware-architecturesystem-intelligencesystem-mapping
fix(compass): stop shipping an empty compass/ and unblock the repair path (#335)
KageBinary8689968e03b7
diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex e2c9e883..41449402 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -65,17 +65,38 @@ jobs:with:node-version: "22.14"+ # No continue-on-error. It previously swallowed the clone's exit 128 *and*+ # the explicit ::error:: guard below, so an expired COMPASS_TOKEN produced+ # a fully green release that shipped an empty compass/ directory and a+ # broken `ix view` for every user. A compass failure must fail the release.- name: Build System Compass- continue-on-error: trueenv:COMPASS_TOKEN: ${{ secrets.COMPASS_TOKEN }}run: |mkdir -p compass-distif [ -z "$COMPASS_TOKEN" ]; then- echo "COMPASS_TOKEN not set — skipping compass build (tarballs ship without compass)"- exit 0+ echo "::error::COMPASS_TOKEN is not set. It is required to build System Compass from the private ix-infrastructure/system-compass repo. Add a fine-grained PAT with Contents:read on that repo as the COMPASS_TOKEN secret."+ exit 1fi- git clone https://x-access-token:${COMPASS_TOKEN}@github.com/ix-infrastructure/system-compass.git+ # Belt and braces. A `secrets.*` value is masked automatically, so this+ # is redundant today — but that guarantee is tied to where the value+ # came from. If COMPASS_TOKEN is ever re-sourced from `vars.*`, a step+ # output, or an App token minted in-job, the automatic mask silently+ # stops applying. This line does not care about the source.+ echo "::add-mask::$COMPASS_TOKEN"+ # Do not pipe this clone through a redaction filter. This job runs on+ # the runner's default `bash -e {0}`, which has no `pipefail`, so the+ # pipeline would exit with the filter's status (0) and the guard below+ # could never fire — the failure would surface as a confusing `cd:+ # system-compass: No such file or directory` two lines down instead of+ # the message telling you to rotate the token. Git withholds the+ # credential from its own error output regardless, and the mask above+ # covers the value if anything else ever echoes it.+ git clone "https://x-access-token:${COMPASS_TOKEN}@github.com/ix-infrastructure/system-compass.git" 2>&1 \+ || {+ echo "::error::Could not clone ix-infrastructure/system-compass. COMPASS_TOKEN is set but was rejected — it is most likely expired or lacks Contents:read on that repo. Rotate it and re-run."+ exit 1+ }cd system-compassnpm ci --legacy-peer-depsnpm run build@@ -84,6 +105,11 @@ jobs:exit 1ficp -r dist/* "$GITHUB_WORKSPACE/compass-dist/"+ # Prove the artifact is real before it is uploaded, so a silent+ # partial build cannot reach the packaging step.+ test -f "$GITHUB_WORKSPACE/compass-dist/index.html" \+ || { echo "::error::compass-dist/index.html missing after copy"; exit 1; }+ echo "compass bundle: $(find "$GITHUB_WORKSPACE/compass-dist" -type f | wc -l) files"- name: Upload compass bundleuses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1@@ -167,8 +193,9 @@ jobs:npm run buildnpm version "$VERSION" --no-git-tag-version --allow-same-version- # Compass is best-effort (only built when COMPASS_TOKEN is set); never let a- # missing/empty compass artifact block a platform build.+ # The compass job does not run on PR dry-runs, so the artifact is legitimately+ # absent there. continue-on-error covers only that case; a real release+ # asserts the bundle is present in the packaging step below.- name: Download compass bundlecontinue-on-error: trueuses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1@@ -181,6 +208,9 @@ jobs:VERSION: ${{ steps.version.outputs.version }}TARGET: ${{ matrix.target }}RUNNER_OS: ${{ runner.os }}+ # A PR dry-run skips the compass job, so an absent bundle is expected+ # there and only there.+ REQUIRE_COMPASS: ${{ github.event_name != 'pull_request' }}run: |STAGING="ix-${VERSION}-${TARGET}"# Compute the checksum with node (always present on every runner);@@ -193,6 +223,15 @@ jobs:cp -rL core-ingestion/dist core-ingestion/node_modules core-ingestion/package.json "$STAGING/core-ingestion/"if [ -f compass-dist/index.html ]; thencp -r compass-dist/* "$STAGING/compass/"+ echo "compass: $(find "$STAGING/compass" -type f | wc -l) files staged"+ elif [ "$REQUIRE_COMPASS" = "true" ]; then+ # v0.7.0 through v0.8.1 all shipped an empty compass/ because this+ # was a silent no-op. `ix view` then fails for every user with+ # "Compass UI not found". Refuse to publish that.+ echo "::error::compass bundle is missing — refusing to publish a release whose compass/ directory is empty, which breaks 'ix view' for every user. Check the compass job above."+ exit 1+ else+ echo "::notice::compass bundle absent (PR dry-run) — packaging without it"fiif [ "$RUNNER_OS" = "Windows" ]; thencat > "$STAGING/ix.cmd" <<'WRAPPER'diff --git a/ix-cli/src/cli/commands/upgrade.ts b/ix-cli/src/cli/commands/upgrade.tsindex a13b2ff6..5c30ef3c 100644--- a/ix-cli/src/cli/commands/upgrade.ts+++ b/ix-cli/src/cli/commands/upgrade.ts@@ -91,6 +91,21 @@ function isNewer(latest: string, current: string): boolean {return false;}+/**+ * The compass version actually on disk.+ *+ * A `.version` stamp is only meaningful if the bundle it describes is really+ * there. Installers used to write the stamp without installing anything, which+ * made every version comparison below report "already current" and skip the+ * download that would have fixed it — `ix view` then failed permanently. Treat+ * a stamp with no `index.html` beside it as "not installed" so the repair path+ * always runs.+ */+function getInstalledCompassVersion(): string {+ if (!existsSync(join(COMPASS_DIR, "index.html"))) return "0.0.0";+ return getTrackedVersion(COMPASS_VERSION_FILE);+}+function getTrackedVersion(versionFile: string): string {try {if (!existsSync(versionFile)) return "0.0.0";@@ -119,7 +134,7 @@ export async function checkForUpdate(): Promise<void> {if (cache && Date.now() - cache.checkedAt < 3600_000) {const hasCliUpdate = isNewer(cache.latest, current);- const compassCurrent = getTrackedVersion(COMPASS_VERSION_FILE);+ const compassCurrent = getInstalledCompassVersion();const hasCompassUpdate =cache.compassLatest && isNewer(cache.compassLatest, compassCurrent);const backendCurrent = getTrackedVersion(BACKEND_VERSION_FILE);@@ -139,7 +154,7 @@ export async function checkForUpdate(): Promise<void> {if (!latest) return;writeCache(latest, compassLatest ?? undefined, backendLatest ?? undefined);const hasCliUpdate = isNewer(latest, current);- const compassCurrent = getTrackedVersion(COMPASS_VERSION_FILE);+ const compassCurrent = getInstalledCompassVersion();const hasCompassUpdate =compassLatest && isNewer(compassLatest, compassCurrent);const backendCurrent = getTrackedVersion(BACKEND_VERSION_FILE);@@ -393,7 +408,7 @@ export function registerUpgradeCommand(program: Command): void {}// ── Compass upgrade ──────────────────────────────────────────────- const compassCurrent = getTrackedVersion(COMPASS_VERSION_FILE);+ const compassCurrent = getInstalledCompassVersion();if (compassLatest && isNewer(compassLatest, compassCurrent)) {console.log(`Compass update available: ${compassCurrent === "0.0.0" ? "none" : compassCurrent} → ${chalk.green(compassLatest)}`diff --git a/ix-cli/src/cli/commands/view.ts b/ix-cli/src/cli/commands/view.tsindex 749099bc..9b83e37a 100644--- a/ix-cli/src/cli/commands/view.ts+++ b/ix-cli/src/cli/commands/view.ts@@ -270,8 +270,14 @@ export function registerViewCommand(program: Command): void {console.error(" Expected at: $IX_HOME/cli/compass/ (installed)");console.error(" or: <repo>/compass/dist/ (development)");console.error("");- console.error(" The visualizer ships with the Ix release tarball.");- console.error(" Reinstall Ix or build system-compass locally.");+ // Releases v0.7.0-v0.8.1 shipped an empty compass/ directory, so for+ // most users the bundle is genuinely absent rather than misplaced.+ // `ix upgrade` fetches it from ix-compass-dist and repairs the install.+ console.error(" Fetch it with: ix upgrade");+ console.error("");+ console.error(" The visualizer normally ships inside the Ix release tarball.");+ console.error(" If 'ix upgrade' does not resolve it, please report the issue at");+ console.error(" https://github.com/ix-infrastructure/Ix/issues");process.exit(1);}diff --git a/scripts/install/install.ps1 b/scripts/install/install.ps1index 23548880..efefaeb4 100644--- a/scripts/install/install.ps1+++ b/scripts/install/install.ps1@@ -288,11 +288,26 @@ if ($BackendVer) {[System.IO.File]::WriteAllText((Join-Path $IxHome ".backend-version"), $BackendVer)}+# Only stamp compass if a compass was actually installed. Stamping unconditionally+# created a cli\compass directory containing nothing but a .version file, which made+# `ix upgrade` believe compass was already current (it compares against this stamp)+# and permanently skip the download that would have repaired it — so `ix view`+# stayed broken forever.+#+# This tests the path the CLI actually reads (COMPASS_DIR in upgrade.ts,+# findCompassDist in view.ts), not where the archive extracted. They differ here:+# Expand-Archive has no --strip-components, so a bundled compass lands in+# cli\ix-<version>-windows-amd64\compass\ and the CLI cannot see it. Do not+# "fix" this by pointing at that path — stamping a version for a bundle+# `ix view` will never find re-creates the poisoned stamp this change removes.+# Leaving it unstamped lets `ix upgrade` install a copy where the CLI looks.$CompassVer = Get-CompassLatestVersion-if ($CompassVer) {- $CompassDir = Join-Path $IxHome "cli\compass"- New-Item -ItemType Directory -Force -Path $CompassDir | Out-Null+$CompassDir = Join-Path $IxHome "cli\compass"+$CompassIndex = Join-Path $CompassDir "index.html"+if ($CompassVer -and (Test-Path $CompassIndex)) {[System.IO.File]::WriteAllText((Join-Path $CompassDir ".version"), $CompassVer)+} elseif (-not (Test-Path $CompassIndex)) {+ Write-Warn "System Compass is not installed at $CompassDir — 'ix view' is unavailable until you run 'ix upgrade', which will fetch it."}Write-Ok "CLI installed"diff --git a/scripts/install/install.sh b/scripts/install/install.shindex 3eb9705b..bbe68eab 100755--- a/scripts/install/install.sh+++ b/scripts/install/install.sh@@ -937,11 +937,27 @@ fi# -- Stamp installed versions so upgrade checker doesn't nag --BACKEND_VER=$(resolve_backend_version)-COMPASS_VER=$(resolve_compass_version)[ -n "$BACKEND_VER" ] && printf '%s' "$BACKEND_VER" > "$IX_HOME/.backend-version"-if [ -n "$COMPASS_VER" ]; then- mkdir -p "$IX_HOME/cli/compass"++# Only stamp compass if a compass was actually installed. Stamping unconditionally+# created $IX_HOME/cli/compass/ containing nothing but a .version file, which made+# `ix upgrade` believe compass was already current (it compares against this stamp)+# and permanently skip the download that would have repaired it — so `ix view`+# stayed broken forever. The bundle ships inside the release tarball; if it is+# absent, leaving the stamp off lets `ix upgrade` self-heal from ix-compass-dist.+# This tests the path the CLI actually reads (COMPASS_DIR in upgrade.ts,+# findCompassDist in view.ts), not wherever the archive happened to extract.+# Those differ on Windows: the zip is expanded without stripping its top-level+# directory, so a bundled compass lands in cli/ix-<version>-windows-amd64/ and+# the CLI cannot see it. Do not "fix" this by pointing at that path — stamping a+# version for a bundle `ix view` will never find re-creates the poisoned stamp+# this change exists to remove. Leaving it unstamped lets `ix upgrade` install a+# copy where the CLI does look.+COMPASS_VER=$(resolve_compass_version)+if [ -n "$COMPASS_VER" ] && [ -f "$IX_HOME/cli/compass/index.html" ]; thenprintf '%s' "$COMPASS_VER" > "$IX_HOME/cli/compass/.version"+elif [ ! -f "$IX_HOME/cli/compass/index.html" ]; then+ warn "System Compass is not installed at $IX_HOME/cli/compass — 'ix view' is unavailable until you run 'ix upgrade', which will fetch it."fi# -- Done --