Attach the missed-graph skeleton (#963) to the primary layout doc as * "missed_graph": {"nodes":[...], "edges":[...], "offset":{x,y,z}} * — the file structure of files the indexer could not fully cover, laid out * as a satellite cluster beside the code galaxy (the UI renders it as a white * skeleton; clicking it re-centers the camera there). The offset sits on the * -Y side: linked-project
| 2024 | * this slot collides last. Returns true when a non-empty skeleton was |
| 2025 | * attached; no-op when the project has no missed files. */ |
| 2026 | static bool attach_missed_graph(yyjson_mut_doc *mdoc, yyjson_mut_val *mroot, cbm_store_t *store, |
| 2027 | const char *project, double primary_radius) { |
| 2028 | char covproj[512]; |
| 2029 | cbm_store_coverage_shadow_project(covproj, sizeof(covproj), project); |
| 2030 | cbm_layout_result_t *ml = cbm_layout_compute(store, covproj, CBM_LAYOUT_OVERVIEW, NULL, 0, 0); |
| 2031 | if (!ml) { |
| 2032 | return false; |
| 2033 | } |
| 2034 | if (ml->node_count == 0) { |
| 2035 | cbm_layout_free(ml); |
| 2036 | return false; |
| 2037 | } |
| 2038 | double miss_radius = layout_radius(ml); |
| 2039 | char *mjson = cbm_layout_to_json(ml); |
| 2040 | cbm_layout_free(ml); |
| 2041 | if (!mjson) { |
| 2042 | return false; |
| 2043 | } |
| 2044 | yyjson_doc *mldoc = yyjson_read(mjson, strlen(mjson), 0); |
| 2045 | free(mjson); |
| 2046 | if (!mldoc) { |
| 2047 | return false; |
| 2048 | } |
| 2049 | yyjson_mut_val *entry = yyjson_mut_obj(mdoc); |
| 2050 | yyjson_val *mlroot = yyjson_doc_get_root(mldoc); |
| 2051 | yyjson_val *mn = yyjson_obj_get(mlroot, "nodes"); |
| 2052 | yyjson_val *me = yyjson_obj_get(mlroot, "edges"); |
| 2053 | if (mn) { |
| 2054 | yyjson_mut_obj_add_val(mdoc, entry, "nodes", yyjson_val_mut_copy(mdoc, mn)); |
| 2055 | } |
| 2056 | if (me) { |
| 2057 | yyjson_mut_obj_add_val(mdoc, entry, "edges", yyjson_val_mut_copy(mdoc, me)); |
| 2058 | } |
| 2059 | yyjson_doc_free(mldoc); |
| 2060 | |
| 2061 | double dist = primary_radius + miss_radius + LAYOUT_GALAXY_PAD; |
| 2062 | if (dist < LAYOUT_GALAXY_SPACING) { |
| 2063 | dist = LAYOUT_GALAXY_SPACING; |
| 2064 | } |
| 2065 | yyjson_mut_val *offset = yyjson_mut_obj(mdoc); |
| 2066 | yyjson_mut_obj_add_real(mdoc, offset, "x", 0.0); |
| 2067 | yyjson_mut_obj_add_real(mdoc, offset, "y", -dist); |
| 2068 | yyjson_mut_obj_add_real(mdoc, offset, "z", 0.0); |
| 2069 | yyjson_mut_obj_add_val(mdoc, entry, "offset", offset); |
| 2070 | |
| 2071 | yyjson_mut_obj_add_val(mdoc, mroot, "missed_graph", entry); |
| 2072 | return true; |
| 2073 | } |
| 2074 | |
| 2075 | static void handle_layout(cbm_http_conn_t *c, const cbm_http_req_t *req) { |
| 2076 | char project[256] = {0}; |
no test coverage detected