Skip to content

Commit 2d8721a

Browse files
committed
style(mcp): clang-format the query-only resolve and error builder changes
The CI lint gate flagged 18 clang-format violations in the lines the previous commit touched (the read-only verdict branch inside resolve_store_internal, the REQUIRE_STORE macro, and the two call sites that switched to build_no_store_error_checked). No semantic change: whitespace and line wrapping only; the mcp suite still passes 202/0/7. Signed-off-by: 周文瑄 <zhouwx1997@126.com>
1 parent 93d2ee5 commit 2d8721a

1 file changed

Lines changed: 20 additions & 20 deletions

File tree

‎src/mcp/mcp.c‎

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2285,19 +2285,19 @@ static cbm_store_t *resolve_store_internal(cbm_mcp_server_t *srv, const char *pr
22852285
cbm_store_close(srv->store);
22862286
srv->store = NULL;
22872287
srv->store = cbm_store_open_path_query(path);
2288-
cbm_integrity_verdict_t verdict =
2289-
srv->store ? cbm_store_check_integrity_verdict(srv->store)
2290-
: CBM_INTEGRITY_TRANSIENT;
2288+
cbm_integrity_verdict_t verdict = srv->store
2289+
? cbm_store_check_integrity_verdict(srv->store)
2290+
: CBM_INTEGRITY_TRANSIENT;
22912291
if (srv->store) {
22922292
cbm_store_close(srv->store);
22932293
srv->store = NULL;
22942294
}
22952295
if (verdict == CBM_INTEGRITY_CORRUPT) {
22962296
srv->readonly_resolve_hit_corrupt = true;
2297-
snprintf(srv->readonly_corrupt_project,
2298-
sizeof(srv->readonly_corrupt_project), "%s", project);
2299-
cbm_log_warn("store.corrupt_readonly", "project", project, "path", path,
2300-
"action", "left in place for a write-side rebuild");
2297+
snprintf(srv->readonly_corrupt_project, sizeof(srv->readonly_corrupt_project), "%s",
2298+
project);
2299+
cbm_log_warn("store.corrupt_readonly", "project", project, "path", path, "action",
2300+
"left in place for a write-side rebuild");
23012301
if (recovery_status) {
23022302
*recovery_status = STORE_RECOVERY_CORRUPT;
23032303
}
@@ -2555,15 +2555,15 @@ static char *build_no_store_error_checked(cbm_mcp_server_t *srv, const char *pro
25552555
}
25562556

25572557
/* Bail with the right error when no store is available. */
2558-
#define REQUIRE_STORE(store, project) \
2559-
do { \
2560-
if (!(store)) { \
2561-
char *_err = build_no_store_error_checked(srv, project); \
2562-
char *_res = cbm_mcp_text_result(_err, true); \
2563-
free(_err); \
2564-
free(project); \
2565-
return _res; \
2566-
} \
2558+
#define REQUIRE_STORE(store, project) \
2559+
do { \
2560+
if (!(store)) { \
2561+
char *_err = build_no_store_error_checked(srv, project); \
2562+
char *_res = cbm_mcp_text_result(_err, true); \
2563+
free(_err); \
2564+
free(project); \
2565+
return _res; \
2566+
} \
25672567
} while (0)
25682568

25692569
static bool project_has_adr(cbm_store_t *store, const char *project, const char *root_path) {
@@ -12034,7 +12034,7 @@ static char *handle_detect_changes(cbm_mcp_server_t *srv, const char *args) {
1203412034
/* module rollup: a quotient view of the blast radius */
1203512035
if (impact.visited_count > 0) {
1203612036
cbm_sb_append(&sb, "impacted_modules: (rows: module count)\n");
12037-
char (*mods)[CBM_SZ_128] = malloc(DETECT_MODCAP * CBM_SZ_128);
12037+
char(*mods)[CBM_SZ_128] = malloc(DETECT_MODCAP * CBM_SZ_128);
1203812038
int *mcnt = malloc(DETECT_MODCAP * sizeof(int));
1203912039
if (mods && mcnt) {
1204012040
int overflow = 0;
@@ -12097,7 +12097,7 @@ static char *handle_detect_changes(cbm_mcp_server_t *srv, const char *args) {
1209712097
yyjson_mut_obj_add_val(doc, root_obj, "impacted", imp);
1209812098
/* Model parity with the tree encoding: the complete module rollup. */
1209912099
if (impact.visited_count > 0) {
12100-
char (*mods)[CBM_SZ_128] = malloc(DETECT_MODCAP * CBM_SZ_128);
12100+
char(*mods)[CBM_SZ_128] = malloc(DETECT_MODCAP * CBM_SZ_128);
1210112101
int *mcnt = malloc(DETECT_MODCAP * sizeof(int));
1210212102
if (mods && mcnt) {
1210312103
int overflow = 0;
@@ -12461,8 +12461,8 @@ static char *handle_manage_adr(cbm_mcp_server_t *srv, const char *args) {
1246112461
* backend the UI /api/adr endpoints use — so writes via the MCP tool and
1246212462
* the UI are visible to each other (#256). */
1246312463
store_recovery_status_t recovery_status = STORE_RECOVERY_NONE;
12464-
cbm_store_t *resolved = resolve_store_internal(srv, project, mutation_held, !write_request,
12465-
&recovery_status, true);
12464+
cbm_store_t *resolved =
12465+
resolve_store_internal(srv, project, mutation_held, !write_request, &recovery_status, true);
1246612466
if (!resolved) {
1246712467
char *res = NULL;
1246812468
if (recovery_status == STORE_RECOVERY_BUSY) {

0 commit comments

Comments
 (0)