MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / bootstrap_worker_argv_exact

Function bootstrap_worker_argv_exact

src/daemon/bootstrap.c:101–133  ·  view source on GitHub ↗

Keep the bootstrap role boundary exact and fail closed before any client or * worker state is initialized. index_supervisor owns the matching builder and * performs the captured-build comparison after this syntax-only classification. */

Source from the content-addressed store, hash-verified

99 * worker state is initialized. index_supervisor owns the matching builder and
100 * performs the captured-build comparison after this syntax-only classification. */
101static bool bootstrap_worker_argv_exact(int argc, char *const argv[]) {
102 if (argc < 9 || !argv || !bootstrap_arg_is(argv[1], "cli") ||
103 !bootstrap_arg_is(argv[2], "--index-worker") ||
104 !bootstrap_arg_is(argv[3], "--index-worker-build") ||
105 !bootstrap_worker_fingerprint_valid(argv[4]) ||
106 !bootstrap_arg_is(argv[5], "index_repository") || !argv[6] || !argv[6][0] ||
107 !bootstrap_arg_is(argv[7], "--response-out") || !argv[8] || !argv[8][0]) {
108 return false;
109 }
110 int next = 9;
111 if (next < argc && bootstrap_arg_is(argv[next], "--index-worker-memory-budget-bytes")) {
112 if (next + 1 >= argc || !bootstrap_worker_budget_valid(argv[next + 1])) {
113 return false;
114 }
115 next += 2;
116 }
117 if (next < argc && bootstrap_arg_is(argv[next], "--index-worker-single-thread")) {
118 next++;
119 }
120 if (next < argc && bootstrap_arg_is(argv[next], "--index-worker-marker")) {
121 if (next + 1 >= argc || !argv[next + 1] || !argv[next + 1][0]) {
122 return false;
123 }
124 next += 2;
125 }
126 if (next < argc && bootstrap_arg_is(argv[next], "--index-worker-quarantine")) {
127 if (next + 1 >= argc || !argv[next + 1] || !argv[next + 1][0]) {
128 return false;
129 }
130 next += 2;
131 }
132 return next == argc;
133}
134
135cbm_daemon_process_role_t cbm_daemon_process_role(int argc, char *const argv[]) {
136 if (argc <= 0 || !argv || !argv[0] || argv[0][0] == '\0') {

Callers 1

cbm_daemon_process_roleFunction · 0.85

Calls 3

bootstrap_arg_isFunction · 0.85

Tested by

no test coverage detected