Quest: Gap Factory Priority: P2 Status: open
Implement KG frontier analysis — find sparse regions in knowledge graph
This task is part of the Gap Factory quest (Atlas layer). It contributes to the broader goal of building out SciDEX's atlas capabilities.
gap_scanner.py:get_landscape_thin_regions() identifies sparse regions but is a script-only function/api/landscape/{domain} returns thin_regions but these are open gaps, not KG nodes/api/graph/top finds highly-connected hub nodes (inverse of what we need)/api/graph/stats provides overall KG statistics
/api/kg/frontier in api.py (line 9398)limit, max_connections, node_typeapi_graph_top_new
ast.parse(); API server returning 500 (DB issue, not code issue)044d0eece is confirmed on origin/main — endpoint exists at api.py:9581@app.get("/api/kg/frontier") with params limit, max_connections, node_typeast.parse passes)api_graph_top_new patterns with 5-min caching
/api/kg/frontier returns 500 due to sqlite3.DatabaseError: database disk image is malformedPRAGMA integrity_check reports extensive corruption in Tree 97 (knowledge_edges area)/api/graph/stats and /api/graph/top — not specific to frontier endpoint{
"requirements": {
"coding": 7,
"reasoning": 6
},
"_reset_note": "This task was reset after a database incident on 2026-04-17.\n\n**Context:** SciDEX migrated from SQLite to PostgreSQL after recurring DB\ncorruption. Some work done during Apr 16-17 may have been lost.\n\n**Before starting work:**\n1. Check if the task's goal is ALREADY satisfied (run the relevant checks)\n2. Check `git log --all --grep=task:YOUR_TASK_ID` for prior commits\n3. If complete, verify and mark done. If partial, continue. If not done, proceed.\n\n**DB change:** SciDEX now uses PostgreSQL. `get_db()` auto-detects via\nSCIDEX_DB_BACKEND=postgres env var.",
"_reset_at": "2026-04-18T06:29:22.046013+00:00",
"_reset_from_status": "done"
}