fix: dogfood v2.4.0 — win32 native binary, embedder crashes, stdout pollution by carlos-alm · Pull Request #117 · optave/ops-codegraph-tool · GitHub
Skip to content

fix: dogfood v2.4.0 — win32 native binary, embedder crashes, stdout pollution#117

Merged
carlos-alm merged 2 commits into
mainfrom
fix/dogfood-v2.4.0-bugs
Feb 26, 2026
Merged

fix: dogfood v2.4.0 — win32 native binary, embedder crashes, stdout pollution#117
carlos-alm merged 2 commits into
mainfrom
fix/dogfood-v2.4.0-bugs

Conversation

@carlos-alm

Copy link
Copy Markdown
Contributor

Summary

Fixes 3 bugs found during dogfooding v2.4.0:

Not fixed: #116 (incremental rebuild drops edges) — requires deeper changes to the incremental rebuild algorithm.

Found during

Dogfooding v2.4.0 — see dogfood report in this PR.

Test plan

  • npm install @optave/codegraph on Windows should pull win32 native binary
  • codegraph embed --strategy structured on stale graph does not crash
  • codegraph search "query" --json 2>/dev/null outputs clean JSON
  • All 592 tests pass

…ashes

- Add @optave/codegraph-win32-x64-msvc to optionalDependencies (was missing,
  causing fallback to WASM on Windows)
- Pin all native binary packages to 2.4.0
- Add bounds check in extractLeadingComment to prevent crash on stale graph
  data where node line numbers exceed file length
- Route model loading messages through logger (stderr) instead of console.log
  (stdout) to fix pipe-clean JSON output for search --json

Closes #113
Closes #114
Closes #115

Impact: 2 functions changed, 9 affected
@claude

claude Bot commented Feb 26, 2026

Copy link
Copy Markdown

@greptile-apps

greptile-apps Bot commented Feb 26, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes three bugs discovered during v2.4.0 dogfooding, all with targeted, minimal changes:

#113 — Windows native binary fallback: Added missing @optave/codegraph-win32-x64-msvc to optionalDependencies and pinned all platform packages to 2.4.0. Without this, Windows users fell back to the slower WASM engine.

#114 — Crash on stale graph data: Added bounds checks in extractLeadingComment() at embedder.js:138,141 to prevent TypeError when node line numbers exceed file length due to stale graph data. The guards ensure we never access lines[i] when i >= lines.length.

#115 — JSON output pollution: Changed model loading messages from console.log to info() (embedder.js:303,326), which writes to stderr instead of stdout. This prevents "Loading embedding model..." messages from breaking codegraph search --json output.

All fixes are defensive and backward-compatible.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • All three fixes are targeted, minimal, and defensive. The package.json change is a simple dependency addition, and the embedder.js changes add safety guards and proper logging without altering core logic. No new functionality is introduced, only bug fixes.
  • No files require special attention

Important Files Changed

Filename Overview
package.json Added missing @optave/codegraph-win32-x64-msvc and pinned all platform packages to 2.4.0
src/embedder.js Fixed crash in extractLeadingComment with bounds checks, and redirected model loading logs to stderr via info()

Last reviewed commit: 4d13b0b

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@claude

claude Bot commented Feb 26, 2026

Copy link
Copy Markdown

@carlos-alm carlos-alm merged commit 9689a32 into main Feb 26, 2026
17 of 18 checks passed
@carlos-alm carlos-alm deleted the fix/dogfood-v2.4.0-bugs branch February 26, 2026 06:52
carlos-alm pushed a commit that referenced this pull request Feb 27, 2026
All 4 bugs now fixed (PR #117 merged, #116 closed via reverse-dep
cascade). 3 of 4 suggestions addressed. MCP tool counts updated
18→23 / 19→24. Rating upgraded 7/10 → 9/10 post-fix.
carlos-alm pushed a commit that referenced this pull request Feb 27, 2026
All 4 bugs now fixed (PR #117 merged, #116 closed via reverse-dep
cascade). 3 of 4 suggestions addressed. MCP tool counts updated
18→23 / 19→24. Rating upgraded 7/10 → 9/10 post-fix.
carlos-alm added a commit that referenced this pull request Feb 27, 2026
* fix: strict type validation for threshold values in complexity queries

Replace loose `!= null` checks with `typeof === 'number' && Number.isFinite()`
to prevent `Number("")`, `Number(null)`, and `Number(true)` from silently
coercing into valid SQL values. Add integration test verifying exceeds
arrays and summary.aboveWarn are correctly computed.

Addresses Greptile review feedback on #136.

Impact: 2 functions changed, 3 affected

* docs: add complexity, communities, and manifesto to all docs

Update README, CLAUDE.md, BACKLOG, titan-paradigm, recommended-practices,
and CLI/MCP examples to reflect today's merged PRs: complexity metrics
(#130/#139), Louvain community detection (#133/#134), and manifesto rule
engine (#138). Updates MCP tool count from 21 to 24 (25 in multi-repo),
marks backlog items 6/11/21/22 as done, and adds real CLI output examples.

* fix: remove redundant condition in paginate guard clauses

When limit === undefined, limit !== 0 is always true — the && check
was dead code. Simplified to just check limit === undefined.

Impact: 2 functions changed, 18 affected

* docs: update dogfood report with fix statuses

All 4 bugs now fixed (PR #117 merged, #116 closed via reverse-dep
cascade). 3 of 4 suggestions addressed. MCP tool counts updated
18→23 / 19→24. Rating upgraded 7/10 → 9/10 post-fix.

* fix: rename misleading test to match actual behavior

Test was named "handles non-numeric thresholds gracefully" but only
validated baseline exceeds/aboveWarn with valid thresholds. Actual
non-numeric threshold tests exist separately. Renamed to "produces
correct exceeds and aboveWarn with valid thresholds".

* fix: update stale MCP tool count in dogfood skill (21→24)

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
carlos-alm added a commit that referenced this pull request Feb 27, 2026
* fix: strict type validation for threshold values in complexity queries

Replace loose `!= null` checks with `typeof === 'number' && Number.isFinite()`
to prevent `Number("")`, `Number(null)`, and `Number(true)` from silently
coercing into valid SQL values. Add integration test verifying exceeds
arrays and summary.aboveWarn are correctly computed.

Addresses Greptile review feedback on #136.

Impact: 2 functions changed, 3 affected

* docs: add complexity, communities, and manifesto to all docs

Update README, CLAUDE.md, BACKLOG, titan-paradigm, recommended-practices,
and CLI/MCP examples to reflect today's merged PRs: complexity metrics
(#130/#139), Louvain community detection (#133/#134), and manifesto rule
engine (#138). Updates MCP tool count from 21 to 24 (25 in multi-repo),
marks backlog items 6/11/21/22 as done, and adds real CLI output examples.

* fix: remove redundant condition in paginate guard clauses

When limit === undefined, limit !== 0 is always true — the && check
was dead code. Simplified to just check limit === undefined.

Impact: 2 functions changed, 18 affected

* docs: update dogfood report with fix statuses

All 4 bugs now fixed (PR #117 merged, #116 closed via reverse-dep
cascade). 3 of 4 suggestions addressed. MCP tool counts updated
18→23 / 19→24. Rating upgraded 7/10 → 9/10 post-fix.

* fix: rename misleading test to match actual behavior

Test was named "handles non-numeric thresholds gracefully" but only
validated baseline exceeds/aboveWarn with valid thresholds. Actual
non-numeric threshold tests exist separately. Renamed to "produces
correct exceeds and aboveWarn with valid thresholds".

* fix: update stale MCP tool count in dogfood skill (21→24)

* feat: add complexity analysis for Python, Go, Rust, Java, C#, Ruby, PHP

Parameterize the complexity algorithm to support all 10 languages instead
of just JS/TS/TSX. Add per-language COMPLEXITY_RULES, HALSTEAD_RULES, and
COMMENT_PREFIXES with three else-if detection patterns (else-wraps-if,
explicit elif, alternative field). Guard against tree-sitter keyword leaf
tokens that share node type names with their parent constructs.

Impact: 4 functions changed, 4 affected

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Zeeeepa pushed a commit to Zeeeepa/codegraph that referenced this pull request Jun 22, 2026
fix: dogfood v2.4.0 — win32 native binary, embedder crashes, stdout pollution
Zeeeepa pushed a commit to Zeeeepa/codegraph that referenced this pull request Jun 22, 2026
* fix: strict type validation for threshold values in complexity queries

Replace loose `!= null` checks with `typeof === 'number' && Number.isFinite()`
to prevent `Number("")`, `Number(null)`, and `Number(true)` from silently
coercing into valid SQL values. Add integration test verifying exceeds
arrays and summary.aboveWarn are correctly computed.

Addresses Greptile review feedback on optave#136.

Impact: 2 functions changed, 3 affected

* docs: add complexity, communities, and manifesto to all docs

Update README, CLAUDE.md, BACKLOG, titan-paradigm, recommended-practices,
and CLI/MCP examples to reflect today's merged PRs: complexity metrics
(optave#130/optave#139), Louvain community detection (optave#133/optave#134), and manifesto rule
engine (optave#138). Updates MCP tool count from 21 to 24 (25 in multi-repo),
marks backlog items 6/11/21/22 as done, and adds real CLI output examples.

* fix: remove redundant condition in paginate guard clauses

When limit === undefined, limit !== 0 is always true — the && check
was dead code. Simplified to just check limit === undefined.

Impact: 2 functions changed, 18 affected

* docs: update dogfood report with fix statuses

All 4 bugs now fixed (PR optave#117 merged, optave#116 closed via reverse-dep
cascade). 3 of 4 suggestions addressed. MCP tool counts updated
18→23 / 19→24. Rating upgraded 7/10 → 9/10 post-fix.

* fix: rename misleading test to match actual behavior

Test was named "handles non-numeric thresholds gracefully" but only
validated baseline exceeds/aboveWarn with valid thresholds. Actual
non-numeric threshold tests exist separately. Renamed to "produces
correct exceeds and aboveWarn with valid thresholds".

* fix: update stale MCP tool count in dogfood skill (21→24)

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Zeeeepa pushed a commit to Zeeeepa/codegraph that referenced this pull request Jun 22, 2026
* fix: strict type validation for threshold values in complexity queries

Replace loose `!= null` checks with `typeof === 'number' && Number.isFinite()`
to prevent `Number("")`, `Number(null)`, and `Number(true)` from silently
coercing into valid SQL values. Add integration test verifying exceeds
arrays and summary.aboveWarn are correctly computed.

Addresses Greptile review feedback on optave#136.

Impact: 2 functions changed, 3 affected

* docs: add complexity, communities, and manifesto to all docs

Update README, CLAUDE.md, BACKLOG, titan-paradigm, recommended-practices,
and CLI/MCP examples to reflect today's merged PRs: complexity metrics
(optave#130/optave#139), Louvain community detection (optave#133/optave#134), and manifesto rule
engine (optave#138). Updates MCP tool count from 21 to 24 (25 in multi-repo),
marks backlog items 6/11/21/22 as done, and adds real CLI output examples.

* fix: remove redundant condition in paginate guard clauses

When limit === undefined, limit !== 0 is always true — the && check
was dead code. Simplified to just check limit === undefined.

Impact: 2 functions changed, 18 affected

* docs: update dogfood report with fix statuses

All 4 bugs now fixed (PR optave#117 merged, optave#116 closed via reverse-dep
cascade). 3 of 4 suggestions addressed. MCP tool counts updated
18→23 / 19→24. Rating upgraded 7/10 → 9/10 post-fix.

* fix: rename misleading test to match actual behavior

Test was named "handles non-numeric thresholds gracefully" but only
validated baseline exceeds/aboveWarn with valid thresholds. Actual
non-numeric threshold tests exist separately. Renamed to "produces
correct exceeds and aboveWarn with valid thresholds".

* fix: update stale MCP tool count in dogfood skill (21→24)

* feat: add complexity analysis for Python, Go, Rust, Java, C#, Ruby, PHP

Parameterize the complexity algorithm to support all 10 languages instead
of just JS/TS/TSX. Add per-language COMPLEXITY_RULES, HALSTEAD_RULES, and
COMMENT_PREFIXES with three else-if detection patterns (else-wraps-if,
explicit elif, alternative field). Guard against tree-sitter keyword leaf
tokens that share node type names with their parent constructs.

Impact: 4 functions changed, 4 affected

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant