Commit abd3662
Martin Vogel
fix(mcp,ci): harden get_architecture serialization + CodeQL gate
Follow-up to DeusData#281 (handle_get_architecture) plus a CodeQL workflow
upgrade developed in parallel; bundling into one commit because the
test suite had to land alongside both.
mcp.c — handle_get_architecture
- NULL-coerce every const-char* field in the architecture sections
via `x ? x : ""`, matching the rest of mcp.c (search_graph, etc.).
Without this, a NULL field becomes a missing JSON key instead of
an empty string; yyjson_mut_obj_add_str returns false on NULL and
silently no-ops, so an inconsistent omission could surprise callers.
- Serialize two more architecture aspects that DeusData#281 left on the
floor: services (cbm_service_link_t: from/to/type/count) and
clusters (cbm_cluster_info_t: id/label/members/cohesion plus the
top_nodes / packages / edge_types string arrays). The store-side
computation populates these for aspects=["all"] / explicit names,
so dropping them in the serializer was data loss.
tests/test_mcp.c
- New tool_get_architecture_emits_populated_sections regression test.
Uses a minimal inline fixture (single Function node tagged with
"is_entry_point": true) since arch_entry_points reads that flag
out of properties_json. Asserts the response contains both an
"entry_points" array and the function name — neither would appear
before DeusData#281 because handle_get_architecture never called
cbm_store_get_architecture.
- extract_text_content drilled too shallow: it pulled "content" only
from the JSON root, so it worked for cbm_mcp_handle_tool but
silently fell through to the raw response for cbm_mcp_server_handle
(where content lives under .result.content). Added a fallback that
checks .result.content; both unwrappers tested by existing fixtures.
ci(codeql)
- Run on pull_request to main, not just push; surfaces findings on
the PR instead of after merge.
- Pull custom queries from ./codeql via `queries: +./codeql`.
- Capture SARIF output and fail the job on any error-level finding,
using jq to enumerate rule id, file:line, and message text in the
GitHub Actions error annotation. Warnings are still reported as
before; only errors block.
Full suite: 2842 passed, 0 failed.1 parent 073ee68 commit abd3662
3 files changed
Lines changed: 164 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| 31 | + | |
30 | 32 | | |
31 | 33 | | |
32 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1860 | 1860 | | |
1861 | 1861 | | |
1862 | 1862 | | |
1863 | | - | |
| 1863 | + | |
| 1864 | + | |
1864 | 1865 | | |
1865 | 1866 | | |
1866 | 1867 | | |
| |||
1872 | 1873 | | |
1873 | 1874 | | |
1874 | 1875 | | |
1875 | | - | |
| 1876 | + | |
| 1877 | + | |
1876 | 1878 | | |
1877 | 1879 | | |
1878 | 1880 | | |
| |||
1886 | 1888 | | |
1887 | 1889 | | |
1888 | 1890 | | |
1889 | | - | |
| 1891 | + | |
| 1892 | + | |
1890 | 1893 | | |
1891 | | - | |
1892 | | - | |
| 1894 | + | |
| 1895 | + | |
| 1896 | + | |
| 1897 | + | |
| 1898 | + | |
1893 | 1899 | | |
1894 | 1900 | | |
1895 | 1901 | | |
| |||
1900 | 1906 | | |
1901 | 1907 | | |
1902 | 1908 | | |
1903 | | - | |
1904 | | - | |
1905 | | - | |
| 1909 | + | |
| 1910 | + | |
| 1911 | + | |
| 1912 | + | |
| 1913 | + | |
| 1914 | + | |
1906 | 1915 | | |
1907 | 1916 | | |
1908 | 1917 | | |
| |||
1913 | 1922 | | |
1914 | 1923 | | |
1915 | 1924 | | |
1916 | | - | |
| 1925 | + | |
| 1926 | + | |
1917 | 1927 | | |
1918 | | - | |
| 1928 | + | |
| 1929 | + | |
| 1930 | + | |
1919 | 1931 | | |
1920 | 1932 | | |
1921 | 1933 | | |
| |||
1927 | 1939 | | |
1928 | 1940 | | |
1929 | 1941 | | |
1930 | | - | |
1931 | | - | |
| 1942 | + | |
| 1943 | + | |
| 1944 | + | |
| 1945 | + | |
1932 | 1946 | | |
1933 | 1947 | | |
1934 | 1948 | | |
1935 | 1949 | | |
1936 | 1950 | | |
1937 | 1951 | | |
| 1952 | + | |
| 1953 | + | |
| 1954 | + | |
| 1955 | + | |
| 1956 | + | |
| 1957 | + | |
| 1958 | + | |
| 1959 | + | |
| 1960 | + | |
| 1961 | + | |
| 1962 | + | |
| 1963 | + | |
| 1964 | + | |
| 1965 | + | |
| 1966 | + | |
| 1967 | + | |
| 1968 | + | |
1938 | 1969 | | |
1939 | 1970 | | |
1940 | 1971 | | |
1941 | 1972 | | |
1942 | 1973 | | |
1943 | | - | |
1944 | | - | |
1945 | | - | |
| 1974 | + | |
| 1975 | + | |
| 1976 | + | |
| 1977 | + | |
| 1978 | + | |
| 1979 | + | |
1946 | 1980 | | |
1947 | 1981 | | |
1948 | 1982 | | |
1949 | 1983 | | |
1950 | 1984 | | |
| 1985 | + | |
| 1986 | + | |
| 1987 | + | |
| 1988 | + | |
| 1989 | + | |
| 1990 | + | |
| 1991 | + | |
| 1992 | + | |
| 1993 | + | |
| 1994 | + | |
| 1995 | + | |
| 1996 | + | |
| 1997 | + | |
| 1998 | + | |
| 1999 | + | |
| 2000 | + | |
| 2001 | + | |
| 2002 | + | |
| 2003 | + | |
| 2004 | + | |
| 2005 | + | |
| 2006 | + | |
| 2007 | + | |
| 2008 | + | |
| 2009 | + | |
| 2010 | + | |
| 2011 | + | |
| 2012 | + | |
| 2013 | + | |
| 2014 | + | |
1951 | 2015 | | |
1952 | 2016 | | |
1953 | 2017 | | |
1954 | 2018 | | |
1955 | 2019 | | |
1956 | | - | |
1957 | | - | |
| 2020 | + | |
| 2021 | + | |
| 2022 | + | |
| 2023 | + | |
1958 | 2024 | | |
1959 | 2025 | | |
1960 | 2026 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
525 | 525 | | |
526 | 526 | | |
527 | 527 | | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
528 | 578 | | |
529 | 579 | | |
530 | 580 | | |
| |||
1001 | 1051 | | |
1002 | 1052 | | |
1003 | 1053 | | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
1004 | 1061 | | |
1005 | 1062 | | |
1006 | 1063 | | |
| |||
1739 | 1796 | | |
1740 | 1797 | | |
1741 | 1798 | | |
| 1799 | + | |
1742 | 1800 | | |
1743 | 1801 | | |
1744 | 1802 | | |
| |||
0 commit comments