Skip to content

fix(parser): handle keyword+paren+block constructs in wrap_trailing_object - #44

Merged
TheUncharted merged 5 commits into
masterfrom
develop
Jun 20, 2026
Merged

fix(parser): handle keyword+paren+block constructs in wrap_trailing_object#44
TheUncharted merged 5 commits into
masterfrom
develop

Conversation

@TheUncharted

Copy link
Copy Markdown
Owner

No description provided.

…bject

Strip trailing parenthesized groups from `before` before extracting
last_word, so constructs like `if (cond) { fn({a:1}); }` are correctly
identified as block statements rather than being mangled as object
literals.

Fixes: parse errors for if/for/while/switch/catch blocks containing
function calls with object literal arguments at module scope.
…ailing_object

Prevent usize underflow when string is too short (< 2 bytes) and
incorrect slicing when parentheses are unbalanced (depth > 0 after
inner loop exhaustion). Addresses CodeRabbit review finding.
… RUSTSEC-2026-0177

- RUSTSEC-2026-0176: Out-of-bounds read in PyList/PyTuple iterator nth/nth_back
- RUSTSEC-2026-0177: Missing Sync bound on PyCFunction::new_closure

API changes:
- Replace deprecated downcast() with cast()
- Add PyObject type alias (Py<PyAny>) for compatibility
…t-literals

fix(parser): handle keyword+paren+block constructs in wrap_trailing_object
@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@TheUncharted, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 43 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 20610f78-f471-4d19-bb75-c603fabceaf5

📥 Commits

Reviewing files that changed from the base of the PR and between 7a757c5 and 0cf2f01.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (4)
  • Cargo.toml
  • crates/zapcode-core/src/parser/mod.rs
  • crates/zapcode-core/tests/objects_arrays.rs
  • crates/zapcode-py/src/lib.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch develop

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@TheUncharted
TheUncharted merged commit b4926cb into master Jun 20, 2026
11 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Benchmark Results

    Updating crates.io index
 Downloading crates ...
  Downloaded divan-macros v0.1.21
  Downloaded castaway v0.2.4
  Downloaded cow-utils v0.1.3
  Downloaded errno v0.3.14
  Downloaded fastrand v2.3.0
  Downloaded embedded-io v0.6.1
  Downloaded nonmax v0.5.5
  Downloaded percent-encoding v2.3.2
  Downloaded rustc_version v0.4.1
  Downloaded lock_api v0.4.14
  Downloaded dragonbox_ecma v0.1.12
  Downloaded oxc_syntax v0.117.0
  Downloaded siphasher v1.0.2
  Downloaded rustc-hash v2.1.1
  Downloaded oxc_ecmascript v0.117.0
  Downloaded unicode-linebreak v0.1.5
  Downloaded phf_generator v0.13.1
  Downloaded smawk v0.3.2
  Downloaded thiserror-impl v2.0.18
  Downloaded itoa v1.0.17
  Downloaded thiserror v2.0.18
  Downloaded stable_deref_trait v1.2.1
  Downloaded scopeguard v1.2.0
  Downloaded oxc_str v0.117.0
  Downloaded serde_core v1.0.228
  Downloaded heapless v0.7.17
  Downloaded terminal_size v0.4.3
  Downloaded oxc_span v0.117.0
  Downloaded rustversion v1.0.22
  Downloaded unicode-ident v1.0.24
  Downloaded quote v1.0.45
  Downloaded unicode-id-start v1.4.0
  Downloaded textwrap v0.16.2
  Downloaded compact_str v0.9.0
  Downloaded tempfile v3.27.0
  Downloaded similar v2.7.0
  Downloaded serde v1.0.228
  Downloaded num-bigint v0.4.6
  Downloaded unicode-segmentation v1.12.0
  Downloaded insta v1.46.3
  Downloaded divan v0.1.21
  Downloaded regex-lite v0.1.9
  Downloaded oxc_parser v0.117.0
  Downloaded hashbrown v0.16.1
  Downloaded oxc_ast v0.117.0
  Downloaded indexmap v2.13.0
  Downloaded oxc-miette v2.7.0
  Downloaded serde_derive v1.0.228
  Downloaded unicode-width v0.2.2
  Downloaded syn v2.0.117
  Downloaded num-traits v0.2.19
  Downloaded rustix v1.1.4
  Downloaded memchr v2.8.0
  Downloaded oxc_regular_expression v0.117.0
  Downloaded num-integer v0.1.46
  Downloaded spin v0.9.8
  Downloaded proc-macro2 v1.0.106
  Downloaded getrandom v0.4.2
  Downloaded console v0.15.11
  Downloaded ryu v1.0.23
  Downloaded postcard v1.1.3
  Downloaded oxc_estree v0.117.0
  Downloaded oxc_data_structures v0.117.0
  Downloaded oxc_allocator v0.117.0
  Downloaded phf_macros v0.13.1
  Downloaded phf v0.13.1
  Downloaded cobs v0.3.0
  Downloaded oxc_index v4.1.0
  Downloaded oxc-miette-derive v2.7.0
  Downloaded static_assertions v1.1.0
  Downloaded seq-macro v0.3.6
  Downloaded semver v1.0.27
  Downloaded condtype v1.3.0
  Downloaded hash32 v0.2.1
  Downloaded libc v0.2.183
  Downloaded phf_shared v0.13.1
  Downloaded oxc_diagnostics v0.117.0
  Downloaded oxc_ast_macros v0.117.0
  Downloaded once_cell v1.21.3
  Downloaded owo-colors v4.3.0
  Downloaded clap_builder v4.5.60
  Downloaded embedded-io v0.4.0
  Downloaded cfg-if v1.0.4
  Downloaded bitflags v2.11.0
  Downloaded equivalent v1.0.2
  Downloaded clap v4.5.60
  Downloaded anstyle v1.0.13
  Downloaded allocator-api2 v0.2.21
  Downloaded byteorder v1.5.0
  Downloaded autocfg v1.5.0
  Downloaded clap_lex v1.0.0
  Downloaded linux-raw-sys v0.12.1
   Compiling proc-macro2 v1.0.106
   Compiling unicode-ident v1.0.24
   Compiling quote v1.0.45
   Compiling cfg-if v1.0.4
   Compiling siphasher v1.0.2
   Compiling serde_core v1.0.228
   Compiling thiserror v2.0.18
   Compiling bitflags v2.11.0
   Compiling phf_shared v0.13.1
   Compiling rustversion v1.0.22
   Compiling allocator-api2 v0.2.21
   Compiling owo-colors v4.3.0
   Compiling serde v1.0.228
   Compiling hashbrown v0.16.1
   Compiling syn v2.0.117
   Compiling unicode-linebreak v0.1.5
   Compiling unicode-width v0.2.2
   Compiling smawk v0.3.2
   Compiling castaway v0.2.4
   Compiling textwrap v0.16.2
   Compiling static_assertions v1.1.0
   Compiling itoa v1.0.17
   Compiling ryu v1.0.23
   Compiling fastrand v2.3.0
   Compiling oxc_data_structures v0.117.0
   Compiling unicode-segmentation v1.12.0
   Compiling rustc-hash v2.1.1
   Compiling oxc_allocator v0.117.0
   Compiling phf_generator v0.13.1
   Compiling compact_str v0.9.0
   Compiling phf v0.13.1
   Compiling autocfg v1.5.0
   Compiling rustix v1.1.4
   Compiling oxc_estree v0.117.0
   Compiling num-traits v0.2.19
   Compiling thiserror-impl v2.0.18
   Compiling serde_derive v1.0.228
   Compiling oxc-miette-derive v2.7.0
   Compiling phf_macros v0.13.1
   Compiling oxc_ast_macros v0.117.0
   Compiling oxc-miette v2.7.0
   Compiling oxc_str v0.117.0
   Compiling linux-raw-sys v0.12.1
   Compiling libc v0.2.183
   Compiling cow-utils v0.1.3
   Compiling dragonbox_ecma v0.1.12
   Compiling oxc_span v0.117.0
   Compiling percent-encoding v2.3.2
   Compiling semver v1.0.27
   Compiling unicode-id-start v1.4.0
   Compiling nonmax v0.5.5
   Compiling rustc_version v0.4.1
   Compiling oxc_diagnostics v0.117.0
   Compiling oxc_index v4.1.0
   Compiling scopeguard v1.2.0
   Compiling oxc_syntax v0.117.0
   Compiling lock_api v0.4.14
   Compiling num-integer v0.1.46
   Compiling oxc_regular_expression v0.117.0
   Compiling heapless v0.7.17
   Compiling getrandom v0.4.2
   Compiling byteorder v1.5.0
   Compiling num-bigint v0.4.6
   Compiling hash32 v0.2.1
   Compiling spin v0.9.8
   Compiling oxc_ast v0.117.0
   Compiling terminal_size v0.4.3
   Compiling once_cell v1.21.3
   Compiling clap_lex v1.0.0
   Compiling stable_deref_trait v1.2.1
   Compiling anstyle v1.0.13
   Compiling clap_builder v4.5.60
   Compiling cobs v0.3.0
   Compiling equivalent v1.0.2
   Compiling seq-macro v0.3.6
   Compiling memchr v2.8.0
   Compiling tempfile v3.27.0
   Compiling oxc_ecmascript v0.117.0
   Compiling indexmap v2.13.0
   Compiling oxc_parser v0.117.0
   Compiling postcard v1.1.3
   Compiling clap v4.5.60
   Compiling console v0.15.11
   Compiling divan-macros v0.1.21
   Compiling condtype v1.3.0
   Compiling regex-lite v0.1.9
   Compiling similar v2.7.0
   Compiling divan v0.1.21
   Compiling zapcode-core v1.5.1 (/home/runner/work/zapcode/zapcode/crates/zapcode-core)
   Compiling insta v1.46.3
    Finished `bench` profile [optimized] target(s) in 42.88s
     Running unittests src/lib.rs (target/release/deps/zapcode_core-1dcad53d8865f1d6)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running benches/execution.rs (target/release/deps/execution-62e230867de64883)
Timer precision: 20 ns
execution                  fastest       │ slowest       │ median        │ mean          │ samples │ iters
├─ array_creation          3.977 µs      │ 70.96 µs      │ 4.127 µs      │ 5.105 µs      │ 100     │ 100
├─ async_map_3             14.41 µs      │ 72.19 µs      │ 14.97 µs      │ 16.2 µs       │ 100     │ 100
├─ fibonacci_10            184 µs        │ 221.2 µs      │ 185.9 µs      │ 189.3 µs      │ 100     │ 100
├─ function_call           7.012 µs      │ 20.66 µs      │ 7.252 µs      │ 7.442 µs      │ 100     │ 100
├─ loop_100                103.7 µs      │ 120.4 µs      │ 104.8 µs      │ 106.1 µs      │ 100     │ 100
├─ object_creation         7.734 µs      │ 21.06 µs      │ 7.919 µs      │ 8.205 µs      │ 100     │ 100
├─ promise_all_3           10.53 µs      │ 25.51 µs      │ 10.95 µs      │ 11.34 µs      │ 100     │ 100
├─ promise_catch_resolved  6.872 µs      │ 20.47 µs      │ 7.062 µs      │ 7.283 µs      │ 100     │ 100
├─ promise_resolve_await   4.808 µs      │ 6.581 µs      │ 5.008 µs      │ 5.032 µs      │ 100     │ 100
├─ promise_then_chain_3    14.05 µs      │ 30.73 µs      │ 14.76 µs      │ 15.3 µs       │ 100     │ 100
├─ promise_then_single     8.285 µs      │ 22.55 µs      │ 8.581 µs      │ 8.767 µs      │ 100     │ 100
├─ simple_expression       3.606 µs      │ 6.241 µs      │ 3.752 µs      │ 3.797 µs      │ 100     │ 100
├─ string_concat           4.307 µs      │ 18.68 µs      │ 4.457 µs      │ 4.653 µs      │ 100     │ 100
├─ template_literal        4.707 µs      │ 11.37 µs      │ 4.878 µs      │ 4.972 µs      │ 100     │ 100
╰─ variable_arithmetic     4.828 µs      │ 17.88 µs      │ 5.019 µs      │ 5.18 µs       │ 100     │ 100


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