Repository navigation
fix(native): handle empty symbol batches in swift-demangle parser - #2875
vishalsatle wants to merge 6 commits into
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 778016fd36
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 00d76e976b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Source fixes and publication evidence for the review findings below. Tests and executable checks were skipped at the maintainer's request. Findings that still require a decision or execution evidence remain open. The no-Git discovery test now covers nested forbidden imports; the shared Swift-symbol contract accepts empty batches, and the parser rejects unexpected output for empty input while preserving empty and one-newline zero-record outputs. Changes are live at 00d76e9. Pinned formatting and git diff --check passed; tests were not run. |
|
Source fixes and publication evidence for the review findings below. Tests and executable checks were skipped at the maintainer's request. Findings that still require a decision or execution evidence remain open.
|
973e8ea to
f1d4d2b
Compare
29d5601 to
3198660
Compare
…o inputs
When demangle_swift is called with an empty symbol list, parseDemangledSymbols
split empty stdout ("") into [""], failing the input count equality check
and throwing an unhandled TypeError.
Add a zero-length guard for inputs and add comprehensive unit test coverage.
Also add fallback directory traversal in verify-module-boundaries when git is unavailable.
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
3198660 to
d5f2af8
Compare
Preserve XML and Interface Builder identity at their parsing boundary, retain usable Objective-C slots with precise coverage, and keep native trace failures distinct from absence. Add caller-selected Interface Builder summaries backed by complete retained Evidence, and preserve comparison limitations. Reviewed fixes: #1969, #2088, #2108, #2513, #2639, #2684, #2731, #2759, #2875, #2888, #2889, #2970, #2971, #3002. Validation: relevant native/domain focused lane passed 142 tests; earlier Interface Builder/MCP checks passed 24 tests. Real native UI and Ghidra producer coverage was not repeated.
|
Hi @morluto, thanks for reviewing this PR and updating the tests! I noticed #2875 was listed under Reviewed fixes in commit 55dd21a on main. Will this PR still be merged directly, or were the changes already folded into that commit? If possible, merging the PR branch (or including a Co-authored-by: trailer) so GitHub records the contributor credit would be greatly appreciated! |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Heads up: main already has this change in 55dd21a. The code is in 🤖 Generated with Claude Code (Sonnet 5.5, verified by Opus 5.5) 🦊 |
|
Thanks @vishalsatle. Closing this PR as superseded by 55dd21a5e on The empty Swift-demangle batch behavior and its regression already exist on main; the current branch adds no new behavior. This is an unmerged closure: it does not label this PR as merged or remove contributor history/credit. The decision uses the current source diff and existing validation record; no new local test or provider run is claimed. |
Summary
This PR resolves an edge-case crash in
parseDemangledSymbolswhen called with an empty symbol batch, and improvesverify-module-boundaries.mjsresilience in non-git source environments.Problem & Root Cause
parseDemangledSymbolscrash on empty input:When
parameters.symbolsis empty ([]),swift-demangle --compact --outputs an empty string (""). In JavaScript,"".replace(/\n$/u, "").split("\n")produces[""](array of length 1). The length checklines.length !== inputs.length(1 !== 0) fails and throws an unhandledTypeError: swift-demangle output count does not match input, causing tool call failures when processing empty symbol lists.verify-module-boundaries.mjsnon-git failure:When running
npm run lintorverify-module-boundariesfrom release archives or environments without.git,git ls-filesunconditionally fails withfatal: not a git repository.Proposed Solution
src/native/parsers/demangle.ts: Added an early returnif (inputs.length === 0) return [];to safely return an empty array without running line-split operations. ExportedDemangledSymboltype alias for consumer clarity.src/native/parsers/demangle.test.ts: Added a dedicated Vitest test suite covering empty inputs ([],"","\n"), standard demangled symbols, unchanged non-Swift symbols, invalid symbols, ordering preservation, and mismatched count validations.scripts/verify-module-boundaries.mjs: Wrappedgit ls-filesin a fallback that usesreaddir(..., { recursive: true })when git is unavailable.Test Plan
parseDemangledSymbols([], "")returns[]parseDemangledSymbols([], "\n")returns[]{ input, output, status: "demangled" }status: "unchanged"status: "invalid"TypeErrornode scripts/verify-module-boundaries.mjspasses in non-git environments