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

Function bootstrap_worker_argv_exact

src/daemon/bootstrap.c:113–145  ·  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

111 * worker state is initialized. index_supervisor owns the matching builder and
112 * performs the captured-build comparison after this syntax-only classification. */
113static bool bootstrap_worker_argv_exact(int argc, char *const argv[]) {
114 if (argc < 9 || !argv || !bootstrap_arg_is(argv[1], "cli") ||
115 !bootstrap_arg_is(argv[2], "--index-worker") ||
116 !bootstrap_arg_is(argv[3], "--index-worker-build") ||
117 !bootstrap_worker_fingerprint_valid(argv[4]) ||
118 !bootstrap_arg_is(argv[5], "index_repository") || !argv[6] || !argv[6][0] ||
119 !bootstrap_arg_is(argv[7], "--response-out") || !argv[8] || !argv[8][0]) {
120 return false;
121 }
122 int next = 9;
123 if (next < argc && bootstrap_arg_is(argv[next], "--index-worker-memory-budget-bytes")) {
124 if (next + 1 >= argc || !bootstrap_worker_budget_valid(argv[next + 1])) {
125 return false;
126 }
127 next += 2;
128 }
129 if (next < argc && bootstrap_arg_is(argv[next], "--index-worker-single-thread")) {
130 next++;
131 }
132 if (next < argc && bootstrap_arg_is(argv[next], "--index-worker-marker")) {
133 if (next + 1 >= argc || !argv[next + 1] || !argv[next + 1][0]) {
134 return false;
135 }
136 next += 2;
137 }
138 if (next < argc && bootstrap_arg_is(argv[next], "--index-worker-quarantine")) {
139 if (next + 1 >= argc || !argv[next + 1] || !argv[next + 1][0]) {
140 return false;
141 }
142 next += 2;
143 }
144 return next == argc;
145}
146
147cbm_daemon_process_role_t cbm_daemon_process_role(int argc, char *const argv[]) {
148 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