Skip to content

Commit 928191b

Browse files
committed
fix: resolve PR #18 CodeRabbit minor and nitpick comments
CodeRabbit's PR #18 review bodies listed 17 minor and 4 nitpick comments. Each was checked against the current code. 20 are fixed and 1 is skipped. Behaviour fixes: - cypher.c: selective-end pattern planning no longer reorders patterns under RETURN *, so star projection keeps the order the query wrote. Covered by an extended cypher_single_hop_seeds_from_selective_far_node. - cli.c: the BUSY activation state now returns ACTIVE and goes through the normal coordinated reservation path. - changes.c: after budget trimming, the changed, module and impacted sections each report the right higher-budget continuation hint. The impacted-row prefix is found by binary search, not one row at a time. - pass_pkgmap.c: local_name is JSON-escaped before it is matched against serialized import properties. - watcher.c: the retry backoff deadline comes from a fresh monotonic timestamp taken at failure time and saturates at INT64_MAX. - cbm.c: cbm_line_is_inert treats only '#' as a first-character comment/directive marker, not '*'. - helpers.c: capacity growth starts at 16 from zero and switches to the requested size before integer doubling could overflow. - pass_parallel.c: the system-pressure query runs only when spilling is available. Naming and docs (fork binary is codebase-memory-cli): - docs/CONFIGURATION.md default cache path - daemon conflict hint in runtime.c, with MCP config wording replaced - memwaste.sh and memwaste-scaling.py driver binary name - CONTRIBUTING.md names this fork's maintainer Scripts and test harnesses: - soak-test.sh exits when runtime init fails. - memlab-report.py diffs profile sites by resolved symbol. - test_git_env_isolation_contract.sh tolerates a log with no passed line under pipefail. - test_shell_line_endings.sh keeps its source-archive fallback reachable. - test_daemon_application.c gates the host session on prior setup. - test_mem_events.c clears the forced-tracking flag after the suite. - test_helpers.h reuses the production cbm_git_repo_env_vars list. Skipped: "do not raise memory-core baseline limits". The cited counts are already in the base commit, match current measurements, and the ratchet passes. Validated: - -Werror build and test-runner - lint --ci - cypher, daemon_application, integration, parse_coverage, mem_events and parallel suites - both shell contract scripts run directly
1 parent 8758668 commit 928191b

21 files changed

Lines changed: 117 additions & 62 deletions

‎CONTRIBUTING.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ Two practical notes:
164164

165165
### Who speaks for the project
166166

167-
Only the maintainer account ([@DeusData](https://github.com/DeusData)) speaks for this project. A review, an approval, a "this will be merged" or a "this is a duplicate" from any other account is that person's opinion, however official it sounds — helpful reviews from the community are very welcome, and that is what they are.
167+
For this repository, the maintainer account ([@ngallodev](https://github.com/ngallodev)) speaks for the project. Upstream governance belongs to [@DeusData](https://github.com/DeusData). A review, an approval, a "this will be merged" or a "this is a duplicate" from any other account is that person's opinion, however official it sounds — helpful reviews from the community are very welcome, and that is what they are.
168168

169169
**Impersonating a maintainer is not acceptable**, by a person or by an agent: presenting yourself as part of the maintainer team, posting approvals or change requests styled as maintainer decisions, or telling other contributors what the project has decided. We dismiss such reviews, hide the comments, say publicly in the affected threads that they were not ours, and report and block the account. If you are unsure whether a response you received is from the project, check the account name — and ask.
170170

‎docs/CONFIGURATION.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ permission metadata in `/etc/wsl.conf`, then run `wsl --shutdown` and reopen WSL
193193
options = "metadata,umask=22,fmask=11"
194194
```
195195

196-
or keep the cache on the Linux filesystem (the default `~/.cache/codebase-memory-mcp`),
196+
or keep the cache on the Linux filesystem (the default `~/.cache/codebase-memory-cli`),
197197
which is also much faster than a 9p-mounted Windows drive.
198198

199199
Environment used by retained runtime-owned components—such as diagnostics, logging, and process-wide indexing resource limits—is captured when that runtime starts. Later participants cannot replace those values. `CBM_ALLOWED_ROOT` remains caller-specific, a conflicting `CBM_CACHE_DIR` is rejected, and one-shot CLI commands use their own current environment.

‎internal/cbm/cbm.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1490,7 +1490,7 @@ static bool cbm_line_is_inert(const char *src, const uint32_t *offs, uint32_t nl
14901490
if (p[0] == '/' && p + 1 < end && (p[1] == '/' || p[1] == '*')) {
14911491
return true;
14921492
}
1493-
return p[0] == '*' || p[0] == '#';
1493+
return p[0] == '#';
14941494
}
14951495

14961496
static void cbm_regions_emit_gap(cbm_error_regions_t *out, uint32_t gs, uint32_t ge,

‎internal/cbm/helpers.c‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,8 +645,12 @@ bool cbm_walk_stack_reserve(void **items, int *cap, int need, size_t elem_size,
645645
if (need <= *cap) {
646646
return true;
647647
}
648-
size_t new_cap = (size_t)*cap;
648+
size_t new_cap = *cap > 0 ? (size_t)*cap : 16U;
649649
while (new_cap < (size_t)need) {
650+
if (new_cap > (size_t)INT_MAX / 2U) {
651+
new_cap = (size_t)need;
652+
break;
653+
}
650654
new_cap *= 2;
651655
}
652656
void *grown = NULL;

‎scripts/memlab-report.py‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,17 +152,24 @@ def diff(path_a, path_b, top, binary=None):
152152
summaries_a, series_a = load_profile(path_a)
153153
_, series_b = load_profile(path_b)
154154
names = load_symbols(binary, summaries_a, set(series_a) | set(series_b))
155-
rows = []
155+
by_name_a = {}
156+
by_name_b = {}
156157
for site, samples in series_a.items():
157-
a_live = samples[-1]["live_bytes"]
158-
b_live = series_b[site][-1]["live_bytes"] if site in series_b else 0
158+
key = names.get(site, site)
159+
by_name_a[key] = by_name_a.get(key, 0) + samples[-1]["live_bytes"]
160+
for site, samples in series_b.items():
161+
key = names.get(site, site)
162+
by_name_b[key] = by_name_b.get(key, 0) + samples[-1]["live_bytes"]
163+
rows = []
164+
for site, a_live in by_name_a.items():
165+
b_live = by_name_b.get(site, 0)
159166
if a_live - b_live > 0:
160167
rows.append((a_live - b_live, a_live, b_live, site))
161168
rows.sort(key=lambda row: row[0], reverse=True)
162169
print(f"=== {path_a} minus {path_b} (top {top}) ===")
163170
for delta, a_live, b_live, site in rows[:top]:
164171
print(f" +{delta/1048576:7.2f} MB A={a_live/1048576:.2f} MB B={b_live/1048576:.2f} MB")
165-
print(f" {names.get(site, site)}")
172+
print(f" {site}")
166173

167174

168175
def main():

‎scripts/memwaste-scaling.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def main() -> int:
182182
corpus = os.path.abspath(os.path.expanduser(args.corpus))
183183
if not os.path.isdir(corpus):
184184
sys.exit(f"memwaste-scaling: {corpus} is not a directory")
185-
binary = os.path.join(ROOT, BUILD_DIR, "codebase-memory-mcp")
185+
binary = os.path.join(ROOT, BUILD_DIR, "codebase-memory-cli")
186186
if not args.no_build:
187187
cxx = "clang++" if args.cc == "clang" else args.cc.replace("clang", "clang++")
188188
subprocess.run([os.path.join(ROOT, "scripts", "build.sh"), f"BUILD_DIR={BUILD_DIR}",

‎scripts/memwaste.sh‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ fi
6161

6262
case "$LANE" in
6363
event) BUILD_ARGS=(BUILD_DIR=build/memwaste MEMWASTE=1 ${CC:+CC=$CC} ${CXX:+CXX=$CXX})
64-
BIN="$ROOT/build/memwaste/codebase-memory-mcp" ;;
64+
BIN="$ROOT/build/memwaste/codebase-memory-cli" ;;
6565
access) BUILD_ARGS=(BUILD_DIR=build/memwaste-access MEMWASTE_ACCESS=1 CC=clang CXX=clang++)
66-
BIN="$ROOT/build/memwaste-access/codebase-memory-mcp" ;;
66+
BIN="$ROOT/build/memwaste-access/codebase-memory-cli" ;;
6767
*) echo "memwaste.sh: --lane must be event or access" >&2; exit 2 ;;
6868
esac
6969
if [ "$BUILD" -eq 1 ]; then

‎scripts/soak-test.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ mkdir -p "$RESULTS_DIR"
7070
# still shares the operator's account daemon (#1691, #1696).
7171
# shellcheck source=test-runtime.sh
7272
source "$(dirname "${BASH_SOURCE[0]}")/test-runtime.sh"
73-
cbm_test_runtime_init
73+
cbm_test_runtime_init || exit 1
7474
trap 'cbm_test_runtime_cleanup "$BINARY"' EXIT
7575

7676
# Give this run a deterministic host-side daemon log. Wine needs a Windows-form

‎src/cli/cli.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -629,8 +629,7 @@ static cli_activation_scope_t cli_activation_resolve_scope(
629629
case CBM_VERSION_COHORT_OK:
630630
return CLI_ACTIVATION_SCOPE_ACTIVE;
631631
case CBM_VERSION_COHORT_BUSY:
632-
return cli_activation_scope_unconfirmed(
633-
context, scope, "the session group was busy, so its cache identity could not be read");
632+
return CLI_ACTIVATION_SCOPE_ACTIVE;
634633
case CBM_VERSION_COHORT_CONFLICT:
635634
break;
636635
default:

‎src/cypher/cypher.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5205,7 +5205,8 @@ static int cypher_node_selectivity(const cbm_node_pattern_t *n, const cbm_where_
52055205
}
52065206

52075207
static void cypher_plan_seed_from_selective_end(cbm_query_t *q) {
5208-
if (!q || q->pattern_count != 1 || !q->ret || (q->pattern_optional && q->pattern_optional[0])) {
5208+
if (!q || q->pattern_count != 1 || !q->ret || q->ret->star ||
5209+
(q->pattern_optional && q->pattern_optional[0])) {
52095210
return;
52105211
}
52115212
cbm_pattern_t *p = &q->patterns[0];

0 commit comments

Comments
 (0)