Spaces:
Running
Running
Wire I FIX: relocate rosie-companion block ABOVE the SPA catch-all in killinchu
Browse files- The block was appended at EOF, after the /{path:path} catch-all, so every
/api/<org>/v1/rosie-companion route was shadowed (404 / SPA HTML).
- Starlette matches in registration order; this restores the block's own
documented invariant: 'Registered BEFORE the catch-all'.
- ADDITIVE: only moves the existing block; no logic changed. v11 LOCKED.
- Signed: Yachay.
serve.py
CHANGED
|
@@ -667,26 +667,8 @@ async def spa_root() -> FileResponse:
|
|
| 667 |
return FileResponse(INDEX_HTML, media_type="text/html")
|
| 668 |
|
| 669 |
|
| 670 |
-
@app.get("/{full_path:path}")
|
| 671 |
-
async def spa_fallback(full_path: str) -> Response:
|
| 672 |
-
if full_path.startswith("api/"):
|
| 673 |
-
return JSONResponse({"error": "not found"}, status_code=404)
|
| 674 |
-
candidate = (STATIC_DIR / full_path).resolve()
|
| 675 |
-
try:
|
| 676 |
-
candidate.relative_to(STATIC_DIR.resolve())
|
| 677 |
-
except ValueError:
|
| 678 |
-
return FileResponse(INDEX_HTML, media_type="text/html")
|
| 679 |
-
if candidate.is_file():
|
| 680 |
-
return FileResponse(candidate)
|
| 681 |
-
return FileResponse(INDEX_HTML, media_type="text/html")
|
| 682 |
|
| 683 |
|
| 684 |
-
if __name__ == "__main__":
|
| 685 |
-
import uvicorn
|
| 686 |
-
port = int(os.environ.get("PORT", "7860"))
|
| 687 |
-
print(f"[killinchu] Andean Drone Intelligence on :{port} — Doctrine v11 — SPA at /", file=sys.stderr)
|
| 688 |
-
uvicorn.run(app, host="0.0.0.0", port=port, log_level="info")
|
| 689 |
-
|
| 690 |
# ===========================================================================
|
| 691 |
# Wire I — Rosie-companion (ADDITIVE, Doctrine v11). Signed: Yachay.
|
| 692 |
# Founder directive 2026-06-01 ~02:52 EDT: "Make sure Rosie is wired in the
|
|
@@ -808,4 +790,22 @@ try:
|
|
| 808 |
except Exception as _rc_e:
|
| 809 |
print(f"[killinchu] Wire I rosie-companion NOT registered: {_rc_e!r}", file=sys.stderr)
|
| 810 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 811 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 667 |
return FileResponse(INDEX_HTML, media_type="text/html")
|
| 668 |
|
| 669 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 670 |
|
| 671 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 672 |
# ===========================================================================
|
| 673 |
# Wire I — Rosie-companion (ADDITIVE, Doctrine v11). Signed: Yachay.
|
| 674 |
# Founder directive 2026-06-01 ~02:52 EDT: "Make sure Rosie is wired in the
|
|
|
|
| 790 |
except Exception as _rc_e:
|
| 791 |
print(f"[killinchu] Wire I rosie-companion NOT registered: {_rc_e!r}", file=sys.stderr)
|
| 792 |
|
| 793 |
+
@app.get("/{full_path:path}")
|
| 794 |
+
async def spa_fallback(full_path: str) -> Response:
|
| 795 |
+
if full_path.startswith("api/"):
|
| 796 |
+
return JSONResponse({"error": "not found"}, status_code=404)
|
| 797 |
+
candidate = (STATIC_DIR / full_path).resolve()
|
| 798 |
+
try:
|
| 799 |
+
candidate.relative_to(STATIC_DIR.resolve())
|
| 800 |
+
except ValueError:
|
| 801 |
+
return FileResponse(INDEX_HTML, media_type="text/html")
|
| 802 |
+
if candidate.is_file():
|
| 803 |
+
return FileResponse(candidate)
|
| 804 |
+
return FileResponse(INDEX_HTML, media_type="text/html")
|
| 805 |
|
| 806 |
+
|
| 807 |
+
if __name__ == "__main__":
|
| 808 |
+
import uvicorn
|
| 809 |
+
port = int(os.environ.get("PORT", "7860"))
|
| 810 |
+
print(f"[killinchu] Andean Drone Intelligence on :{port} — Doctrine v11 — SPA at /", file=sys.stderr)
|
| 811 |
+
uvicorn.run(app, host="0.0.0.0", port=port, log_level="info")
|