Skip to content

fix(pipeline): decode persisted LSP arrays linearly - #4

Merged
ngallodev merged 1 commit into
mainfrom
impl/cbm-upstream-lsp-decode-20260929
Sep 30, 2026
Merged

ngallodev merged 1 commit into
mainfrom
impl/cbm-upstream-lsp-decode-20260929

Conversation

@ngallodev

Copy link
Copy Markdown
Owner

Summary

  • Decode persisted LSP definition and string arrays with yyjson_arr_iter to avoid repeated scans of non-flat arrays.
  • Add a regression check for definition order, null values, and empty parameter arrays.
  • Adapt upstream codebase-memory-mcp commit d7eba5a7 for the CLI fork.

Review and validation

  • Source review found no actionable correctness issues.
  • CBM_NO_CCACHE=1 scripts/build-dev.sh passed.
  • ASAN_OPTIONS=detect_leaks=0 CBM_NO_CCACHE=1 scripts/test.sh --suites pipeline passed: 274 tests. This validation ran before the request to stop running tests; no tests were run after that instruction.
  • git diff origin/main...HEAD --check passed.
  • CodeRabbit review could not start because browser authentication is unavailable in this environment.

This PR does not claim Agent-Workflow evaluation, acceptance, or merge approval.

@ngallodev ngallodev left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Reviewed, no issues found.

Checked by reading the PR head of src/pipeline/lsp_surface.c:

  • yyjson_arr_iter yields the same elements in the same order as yyjson_arr_get(i) for i in [0, size). Duplicates and nulls are preserved, and the iterator count matches yyjson_arr_size, so the i index never passes the allocated count. It cannot overrun the items/defs allocations.
  • Empty and missing arrays behave as before: an empty lsp array returns 0 early, and an empty spt array gives count 0.
  • Non-string items still map to "?". Null-terminator placement (items[count]) is unchanged.
  • Error paths are unchanged. The arena owns the allocations, and the doc is freed on every early return. Allocation-failure handling (NULL from cbm_arena_strdup) is the same as the old code.
  • The test covers order, null receiver, null param item and the empty array. It checks behavior only and cannot detect a regression back to O(n^2). Fine for a perf-only fix; a large-input timing check would be the only way to cover that.

Tests and builds not run by me.

@ngallodev ngallodev self-assigned this Sep 29, 2026
@ngallodev
ngallodev merged commit fcc51bc into main Sep 30, 2026
25 of 34 checks passed
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