Skip to content

Commit 7313a0a

Browse files
authored
ci+docs(perf-gate): enrich memory regression gate + OOM-fix evidence (Phase D) (#148)
1 parent 51efda7 commit 7313a0a

2 files changed

Lines changed: 65 additions & 0 deletions

File tree

.github/workflows/perf-gate.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ jobs:
3838
MAX_INDEX_SECONDS: '8'
3939
MIN_NODES: '40'
4040
MAX_PHANTOM_DROP_RATIO: '50'
41+
# Memory ceiling for `codeiq enrich` on fixture-multi-lang. Local
42+
# baseline post-Phase-A+B+C of the 2026-05-13 OOM-fix plan: ~108 MB
43+
# peak RSS. 300 MB ceiling gives ~2.7x headroom — tight enough to
44+
# surface real regressions, loose enough to absorb GC / scheduler
45+
# variance on CI runners. Bump only if a deliberate enrich-mem
46+
# regression is documented in a PR.
47+
MAX_ENRICH_RSS_KB: '307200'
4148
steps:
4249
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4350
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
@@ -108,3 +115,33 @@ jobs:
108115
fi
109116
fi
110117
exit $fail
118+
# Enrich memory regression gate. Locks in the gains from the
119+
# 2026-05-13 OOM-fix plan (Phases A-C). Pre-Phase-A on the same
120+
# fixture peaked at ~600 MB; current main lives at ~108 MB peak.
121+
# If a refactor pushes peak past MAX_ENRICH_RSS_KB, fail the PR.
122+
- name: Enrich memory gate
123+
run: |
124+
set -euo pipefail
125+
# Run enrich against the already-indexed fixture; /usr/bin/time
126+
# -v reports peak RSS.
127+
/usr/bin/time -v /tmp/codeiq enrich /tmp/fm-perf \
128+
> /tmp/perf-enrich.log 2> /tmp/perf-enrich.time
129+
RSS=$(awk -F': ' '/Maximum resident set size/ {print $2}' /tmp/perf-enrich.time)
130+
RSS=${RSS:-0}
131+
ELAPSED=$(awk -F': ' '/Elapsed \(wall clock\)/ {print $2}' /tmp/perf-enrich.time)
132+
133+
{
134+
echo ""
135+
echo "## codeiq enrich memory gate"
136+
echo ""
137+
echo "| metric | value | budget |"
138+
echo "|---|---:|---:|"
139+
echo "| peak RSS (KB) | $RSS | <= $MAX_ENRICH_RSS_KB |"
140+
echo "| wall-clock | $ELAPSED | — |"
141+
} >> "$GITHUB_STEP_SUMMARY"
142+
cat /tmp/perf-enrich.log >> "$GITHUB_STEP_SUMMARY"
143+
144+
if [ "$RSS" -gt "$MAX_ENRICH_RSS_KB" ]; then
145+
echo "::error::enrich peak RSS ${RSS} KB exceeds budget ${MAX_ENRICH_RSS_KB} KB"
146+
exit 1
147+
fi

CLAUDE.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,34 @@ Release pipeline:
429429
System.Security.Cryptography.X509Certificates;`. Use a STRICT
430430
keyword list (high-signal markers only — not path extensions) in
431431
any cross-language regex pre-screen.
432+
- **Enrich memory ceiling (Phase A+B+C OOM-fix plan, 2026-05-13).**
433+
Pre-fix `codeiq enrich` peaked at 3.8 GB on the airflow polyglot
434+
target (9k Python files) and OOM-killed at exit 137 on ~/projects/-
435+
scale (49k files). Three landed fixes brought peak RSS down to:
436+
- **fixture-multi-lang (22 files): ~108 MB** (CI-gated via
437+
perf-gate workflow at 300 MB ceiling)
438+
- **airflow (9,151 files): 1.27 GB** (1× /usr/bin/time -v on
439+
16 GB CI host)
440+
- **~/projects/ (49,076 files): 3.12 GB** (well under the 4 GiB
441+
acceptance bar from the plan)
442+
443+
The three fixes:
444+
1. `intelligence/extractor/enricher.go` parses tree-sitter trees
445+
once per file (was per-node, ~13× over-parse on Python).
446+
2. `intelligence/extractor/enricher.go` bounds the per-file
447+
goroutine pool to `2 * GOMAXPROCS` (was unbounded — 7k+ goroutines
448+
held live trees + file content strings).
449+
3. `graph.Open()` caps Kuzu `BufferPoolSize` to 2 GiB by default
450+
(was 80% of system RAM via `kuzu.DefaultSystemConfig()`).
451+
452+
Tunable knobs on `codeiq enrich`:
453+
- `--memprofile=<path>` writes a Go heap profile (analyze with
454+
`go tool pprof -top -inuse_space ...`).
455+
- `--max-buffer-pool=N` overrides the 2 GiB Kuzu cap.
456+
- `--copy-threads=N` overrides `MaxNumThreads` (default `min(4,
457+
GOMAXPROCS)`).
458+
459+
Plan + research history: `docs/superpowers/plans/2026-05-13-enrich-oom-fix.md`.
432460

433461
### Release / signing
434462

0 commit comments

Comments
 (0)