Skip to content

fix: four board bugs — cockpit config, hardcoded runtime, Spotlight noindex, registry test isolation - #126

Merged
unfoundbox merged 1 commit into
mainfrom
fix/board-bugs-cockpit-runtime-noindex-registry-test
Sep 24, 2026
Merged

unfoundbox merged 1 commit into
mainfrom
fix/board-bugs-cockpit-runtime-noindex-registry-test

Conversation

@unfoundbox

@unfoundbox unfoundbox commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Four small, already-diagnosed bugs from the project board. Each is fixed and verified independently (see NOT CONFIRMED below for the one caveat).

  1. spacepilot/api/routes/gpu.py — /api/cockpit/status read cfg.get("region", ...), but the config (spacepilot/cli.py's DEFAULT_CONFIG) only ever has aws_region. instance_type already matched. Fixed the key name (and the stale g6e.xlarge fallback, which should be g6e.2xlarge per the repo's actual quota). Verified by calling get_cockpit_status() directly with a fake config: it now reports the real configured region instead of always falling back to the default.

  2. spacepilot/api/routes/inference.py — _extensions() hardcoded "runtime": "mlx-lm" in every /v1/chat/completions and /v1/embeddings success response. The real routed runtime is already computed once per request in _resolve() via routes.route_for() (the same lookup /v1/models reports as x_spacepilot.runtime) — it was just being thrown away after the "is there a route at all" check. Now _resolve() returns it and every call site threads it through instead of hardcoding. Verified: full test suite green (including the existing assertion that today's single wired runtime still reports as "mlx-lm"), plus a direct unit check that _extensions() reports whatever runtime it's given rather than a fixed string.

  3. native/SpaceBar/tools/make_app.sh — the suggested fix (touch .build/.metadata_never_index) turned out to be based on a mechanism that (a) only ever applied at a volume root, not an arbitrary subfolder, and (b) is confirmed broken on current macOS by multiple independent sources. The mechanism that still works, documented since macOS 10.6 and used by Xcode's own ModuleCache.noindex: a directory whose name ends in .noindex is skipped by Spotlight entirely. The assembled debug SpaceBar.app now lives at .build/app.noindex/SpaceBar.app. Updated the two other places that referenced the old path (SelfTest.swift, docs/LOCAL-TEST.md).

  4. Registry export test fragility — test_exported_json_matches_the_registry regenerates web/registry.json from the real shipped corpus merged with whatever a test session wrote to the default (env-redirected) measurement/system store. A test that writes there under a real/shipped system id (e.g. apple-m1-max-32gb) would silently poison that comparison, possibly on a run far away from the one that caused it. tests/conftest.py now has an autouse fixture that fails the offending test immediately if this happens, plus a fake_system/FAKE_SYSTEM_ID fixture tests can reach for. Fixed the one real-looking hardcoded id already in the suite (test_inference_surface.py, previously harmless only because it happened to also pass an explicit root=tmp_path). Added a regression test that deliberately records under a shipped id and confirms the guard catches it, then confirms the store is clean again after cleanup.

Verification

  • Full suite: 806 passed, 2 skipped, 11 deselected (packaging), 0 failed via local-ml-py311 interpreter (python -m pytest tests/ -q).
  • Items 1 and 2 verified with direct, real function calls (not just existing tests) — see commit body / PR description above.
  • Item 3 (make_app.sh): bash -n syntax-checked, and the nested-directory logic verified by reproducing it standalone. Did not run the actual swift build — Swift toolchain compute is exactly the kind of load the fan rule exists to keep off this laptop, and it isn't necessary to prove the Spotlight mechanism is correct. Did not do a live Spotlight (mdfind) round-trip either — that's timing-dependent and unreliable to assert against in this environment.

NOT CONFIRMED

  • make_app.sh: the full build-and-sign flow was not executed end-to-end (no swift build, no codesign, no live Spotlight query against a real built app). The path/variable logic was verified in isolation; the .noindex mechanism itself is corroborated by several independent current sources but not by a live mdfind test on this exact machine.

Test plan

  • python -m pytest tests/ -q — 806 passed, 2 skipped, 0 failed
  • Direct verification of the cockpit status region/instance_type fix
  • Direct verification that _extensions() no longer hardcodes the runtime
  • New regression test for the registry-export pollution guard passes
  • Manual make_app.sh build + Spotlight check (not run — see NOT CONFIRMED)

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith with what you need. Autofix is disabled.

…otlight noindex, registry test isolation)

- gpu.py's /api/cockpit/status read "region" but the config dict only ever
  had "aws_region" (instance_type already matched), so it silently always
  fell back to the default instead of the real configured value.
- inference.py's chat/embeddings responses hardcoded x_spacepilot.runtime
  to "mlx-lm". _resolve() already computes the real routed runtime via
  routes.route_for() to check a route exists; thread that value through
  instead of discarding it, so a second WIRED_RUNTIMES entry reports
  correctly instead of lying.
- make_app.sh's suggested .metadata_never_index no longer works on modern
  macOS (verified against current sources) and only ever applied at a
  volume root anyway. The mechanism that still works is a directory name
  ending in .noindex; the assembled debug SpaceBar.app now lives under
  .build/app.noindex/ so Spotlight never surfaces it next to the real app.
- conftest.py adds an autouse guard plus a fake_system fixture so a test
  that records a Measurement/System through the default store under a
  real/shipped system id fails immediately, instead of silently poisoning
  test_exported_json_matches_the_registry on some unrelated later run.
  Fixed the one real-looking id already in the suite and added a
  regression test proving the guard actually catches a collision.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@unfoundbox
unfoundbox force-pushed the fix/board-bugs-cockpit-runtime-noindex-registry-test branch from e17e9f9 to e5b9037 Compare September 24, 2026 16:50
@vercel

vercel Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
spacepilot Error Error Sep 24, 2026 4:51pm UTC
spacepilot.dev Ready Ready Preview Sep 24, 2026 4:51pm UTC

@unfoundbox
unfoundbox merged commit 401952a into main Sep 24, 2026
6 of 7 checks passed

This branch had an error being deployed

1 failed and 1 active deployments
Preview – spacepilot — e5b9037e Deployed Sep 24, 2026 by vercel[bot]
Preview – spacepilot.dev — e5b9037e Deployed Sep 24, 2026 by vercel[bot]
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.

1 participant