Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions .bca-baseline.toml
Original file line number Diff line number Diff line change
Expand Up @@ -845,13 +845,7 @@ value = 7.0
path = "big-code-analysis-py/src/node.rs"
qualified = "PyNode"
metric = "nom"
value = 52.0

[[entry]]
path = "big-code-analysis-py/src/node.rs"
qualified = "PyNode"
metric = "wmc"
value = 59.0
value = 47.0

[[entry]]
path = "big-code-analysis-py/src/node.rs"
Expand Down Expand Up @@ -923,7 +917,7 @@ value = 48620.735506493904
path = "big-code-analysis-web/src/web/server.rs"
qualified = "run_parse"
metric = "halstead.effort"
value = 84151.62410156948
value = 87801.57184376812

[[entry]]
path = "big-code-analysis-web/src/web/server.rs"
Expand Down
10 changes: 5 additions & 5 deletions .role-coverage-baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@
361 named visible 'statement_identifier'
362 named visible 'type_identifier'

[Ccomment tree-sitter-ccomment 2.5.2]
[Ccomment tree-sitter-ccomment 2.6.0]
1 named visible 'nothing'
2 named visible 'preproc_continuation_line'
3 named visible 'preproc_line'
Expand Down Expand Up @@ -2823,7 +2823,7 @@
141 anon hidden '_expression_list_repeat1'
142 anon hidden '_field_list_repeat1'

[Mozcpp tree-sitter-mozcpp 2.5.2]
[Mozcpp tree-sitter-mozcpp 2.6.0]
1 named visible 'identifier'
2 anon visible '#include'
3 anon hidden 'preproc_include_token2'
Expand Down Expand Up @@ -3325,7 +3325,7 @@
636 named visible 'statement_identifier'
637 named visible 'type_identifier'

[Mozjs tree-sitter-mozjs 2.5.2]
[Mozjs tree-sitter-mozjs 2.6.0]
1 named visible 'identifier'
2 named visible 'hash_bang_line'
3 anon visible 'export'
Expand Down Expand Up @@ -4628,7 +4628,7 @@
432 anon hidden 'nowdoc_body_repeat1'
433 named visible 'operation'

[Preproc tree-sitter-preproc 2.5.2]
[Preproc tree-sitter-preproc 2.6.0]
1 named visible 'identifier'
2 named visible 'nothing'
3 named visible 'preproc_continuation_line'
Expand Down Expand Up @@ -5414,7 +5414,7 @@
353 named visible 'shorthand_field_identifier'
354 named visible 'type_identifier'

[Tcl tree-sitter-tcl 2.5.2]
[Tcl tree-sitter-tcl 2.6.0]
1 named visible 'simple_word'
2 anon visible '\n'
3 anon visible ';'
Expand Down
12 changes: 6 additions & 6 deletions .role-coverage-observed.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# emitted, with provenance (#1692). Written by
# `check-role-coverage.py --observe`; informational for the ratchet.
# A kind absent here is "unobserved", never "unreachable".
observer bca 2.5.2
observer bca 2.6.0
corpus DeepSpeech aa1d28530d531d0d92289bf5f11a49fe516fdc86
corpus pdf.js 65c4a4b3fe81b20cd262193c55a6f4519362184c
corpus serde d6de911855d1cc0ad13f87503a79d40dc4490442
Expand Down Expand Up @@ -205,7 +205,7 @@ corpus big-code-analysis-output 5fbe03bf005b9b03a1928273faa477a9c1be5ed7
263
264

[Mozjs tree-sitter-mozjs 2.5.2 sampled attempted=388 parsed=388 failed=0]
[Mozjs tree-sitter-mozjs 2.6.0 sampled attempted=388 parsed=388 failed=0]
1
3
4
Expand Down Expand Up @@ -1005,7 +1005,7 @@ corpus big-code-analysis-output 5fbe03bf005b9b03a1928273faa477a9c1be5ed7
354
65535

[Tcl tree-sitter-tcl 2.5.2 sampled attempted=2 parsed=2 failed=0]
[Tcl tree-sitter-tcl 2.6.0 sampled attempted=2 parsed=2 failed=0]
1
3
6
Expand Down Expand Up @@ -1459,7 +1459,7 @@ corpus big-code-analysis-output 5fbe03bf005b9b03a1928273faa477a9c1be5ed7
542
65535

[Mozcpp tree-sitter-mozcpp 2.5.2 sampled attempted=1048 parsed=1048 failed=0]
[Mozcpp tree-sitter-mozcpp 2.6.0 sampled attempted=1048 parsed=1048 failed=0]
1
2
4
Expand Down Expand Up @@ -2645,9 +2645,9 @@ corpus big-code-analysis-output 5fbe03bf005b9b03a1928273faa477a9c1be5ed7
253
65535

[Ccomment tree-sitter-ccomment 2.5.2 not-sampled attempted=0 parsed=0 failed=0]
[Ccomment tree-sitter-ccomment 2.6.0 not-sampled attempted=0 parsed=0 failed=0]

[Preproc tree-sitter-preproc 2.5.2 not-sampled attempted=0 parsed=0 failed=0]
[Preproc tree-sitter-preproc 2.6.0 not-sampled attempted=0 parsed=0 failed=0]

[Perl tree-sitter-perl 1.1.2 sampled attempted=1 parsed=1 failed=0]
1
Expand Down
121 changes: 113 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ for historical reference.

## [Unreleased]

### Changed

- **(breaking), deferred to the next major (3.0):** the MI of a space
with no code will serialize as `null` (an omitted key in TOML)
instead of `0.0`. Throughout `2.x` the serialized value stays `0.0`;
use `mi::Stats::is_empty()` to tell it apart. The change retires the
dict-side copy of that predicate in the Python bindings
(`big-code-analysis-py/src/sarif.rs`, `mi_is_empty`), which exists
only because the wire cannot yet say "empty". (#1621)

## [2.6.0] - 2026-11-17

### Added

- **`Node::is_extra()`** (#1871): whether tree-sitter marks a node as
Expand Down Expand Up @@ -223,13 +235,6 @@ for historical reference.

The `.deb` control fields and file lists and the RPM file lists and
file flags are unchanged.
- **(breaking), deferred to the next major (3.0):** the MI of a space
with no code will serialize as `null` (an omitted key in TOML)
instead of `0.0`. Throughout `2.x` the serialized value stays `0.0`;
use `mi::Stats::is_empty()` to tell it apart. The change retires the
dict-side copy of that predicate in the Python bindings
(`big-code-analysis-py/src/sarif.rs`, `mi_is_empty`), which exists
only because the wire cannot yet say "empty". (#1621)
- **Bumped the `dekobon-tree-sitter-groovy` grammar pin to `=0.5.0`.**
Releases 0.4.0 and 0.5.0 close a set of parse gaps
([tree-sitter-groovy#49](https://github.com/dekobon/tree-sitter-groovy/issues/49),
Expand Down Expand Up @@ -551,6 +556,27 @@ for historical reference.
reached the same recursion and aborted where the 0.5.0 pin answered.
The three checks step through the assignments in a loop.

- **CSV output no longer overflows the stack on deeply nested
functions** (#1936). The writer called itself once per nested space,
so `bca metrics -O csv` on a few tens of thousands of nested closures,
such as JavaScript's `x = ()=>()=>…1;`, aborted the process (from
about 43,000 levels on an x86_64 release build, 32,000 on aarch64).
The public `write_csv` and `write_csv_aggregate` aborted the same way.
`bca-web` never emits CSV. The rows now come from an explicit stack,
in the same depth-first order.

- **The Python `Node.parent`, sibling and `field_name` getters no
longer kill the interpreter on a deep zero-width node** (#1937). A
`MISSING` node is zero-width, and tree-sitter's parent lookup calls
itself once per tree level above one, so asking for the parent, a
sibling or the field name of one some 15,000 levels deep was a
segmentation fault, in 2.5.1 too. The
bindings now find a zero-width node's parent by walking down from the
root with a cursor, entering only the nodes that hold its position,
and read its siblings off that parent; a node with width keeps
tree-sitter's own lookup. The Rust `Node::parent` cannot reach the
root that way and still makes the call (#1941).

- **`npm` and `npa` read the visibility of interface members** (#1880).
An interface member used to count as public whatever it declared;
only a C# interface field already read `private` and `protected`.
Expand Down Expand Up @@ -583,6 +609,22 @@ for historical reference.
climb checked, so it is no longer asked. At 16,000 levels a release
build goes from 0.92 s to 0.10 s. Values are unchanged.

- **The AST export is linear in a Tcl `expr`'s nested parentheses**
(#1938). `Ast::dump`, `POST /v1/ast` and the Python `Ast.dump` read
each child's grammar field through a cursor, which climbs every hidden
grammar level between the child and its visible parent. Tcl and
iRules fold each parenthesis of `expr {((…(1)…))}` into one more
hidden level under a single flat node, so the export took time
quadratic in the nesting: 0.6 s at 16,000 levels, and about 40 s for a
200 KB request. A node 32 or more children wide is now first asked
whether any child has a field, which its grammar answers without
visiting the children. At 16,000 levels the export goes from 623 ms
to 10 ms. The exported tree is unchanged, which a comparison of 46,215
exports over the test corpora confirms. An `ERROR` node has no
production to answer from, so every child's field is still read
there, and the same `expr` with its closing brace missing still
exports in quadratic time (#1942).

- **`cognitive::Stats` and `nexits::Stats` print a well-formed
`Display` line** (#1736). The cognitive line printed the space's own
score under `sum`, where the JSON `sum` field and every sibling
Expand Down Expand Up @@ -948,6 +990,68 @@ for historical reference.
deliberate #709 accessor split); and `Comments` said "lines that are
entirely comment" while `cloc()` counts trailing comments too.

### Security

- Closed two remotely-triggerable process aborts in `npa` (#1934).
A Python class-level chained assignment `a = a = … = 1` a few
thousand links long, or an Elixir `defstruct` list nested about ten
thousand brackets deep, overflowed the thread stack: the Python reader
recursed once per link, and the Elixir field count once per bracket.
The depth that aborts varies with the build and with the stack of the
thread running the analysis. Release builds of the code just before
the fix aborted from about 5,600 links and 9,900 levels on x86_64
Linux, and from about 6,400 and 9,200 on aarch64 Linux.

Every interface that computes `npa` was affected: the Rust API
(`analyze`, or `Ast::metrics` with `npa` selected), the Python
bindings, `bca metrics`, `bca check` with an `npa` threshold,
`bca report`, and `POST /v1/metrics`. A stack overflow is not a
catchable panic: the Rust binaries abort with `SIGABRT`, and the
Python interpreter dies of a segmentation fault. So one
`POST /v1/metrics` under 30 KB, far inside the 4 MiB body cap, took
`bca-web` down with every request in flight. The Elixir count has
recursed since 1.0.0, the Python reader since 2.0.0. The Python reader
now steps along the chain in a loop and the Elixir count keeps its
own stack; a test runs each at 20,000 levels on a 512 KiB stack.

- **A timed-out `bca-web` request no longer holds a server thread
until its parse finishes** (#1939). A request past its deadline got
`504`, but its analysis ran on in the background, and once
`max(threads × 2, 4)` of those were running, every new request got
`503`. A grammar that parses some input in superlinear time made that
a denial of service: the pinned Perl grammar takes minutes over a few
tens of KB of `-and =>` pairs (#1940), so a handful of small requests
kept the server out of service for that long. A flag is now set at
the deadline, or earlier if actix drops the request's handler, as it
does when the connection is reset before the client has closed its
sending side; the parse checks it every hundred parse operations and
stops. An ordinary close (FIN) does not drop the handler: HTTP/1 lets
a client half-close and still read its response, so actix reads
nothing more from the connection, not even a reset that follows, and
that request's work runs on until it answers or its deadline, if any.
A release server with one orphan slot and a 2 s deadline, sent 8,000
such pairs, answered `503` to every later request for as long as it
was asked (14 s); it now answers `200` half a second after the `504`.
The AST export checks the flag once per node: an unclosed nested Tcl
`expr` parses at once but exports in quadratic time (#1942), and a
debug build's export of 100,000 parentheses ran for 24 s past a 0.5 s
deadline. It now stops at the deadline. The other walks after the
parse are not interrupted: they are linear, which `make bench-scaling`
gates.

- Cleared RUSTSEC-2026-0552, -0553 and -0554 (`actix-http` 3.21.0: a
bare LF in chunked trailers could consume pipelined requests or stall
body decoding; malformed quoted chunk extensions could end an HTTP/1.1
request body early; partial requests on a keep-alive connection could
bypass the request header timeout) by moving `actix-http` 3.21.0 →
3.22.0. All three reach `bca-web` only. No other package version or
checksum moved; five entries (`errno`, `rustix`,
`rustls-platform-verifier`, `tempfile`, `winapi-util`) had a
dependency edge re-pointed between
two `windows-sys` / `getrandom` versions the lockfile already
carried. `utils/check-deny-manifests.sh` passes all four checks on all
eight lockfiles.

## [2.5.1] - 2026-11-06

2.5.0 reached PyPI only: its release run failed a Windows smoke test
Expand Down Expand Up @@ -13842,7 +13946,8 @@ Halstead scores, and MI stay `f64`. No value changes — only the type.
[Unreleased] link to `vX.Y.Z...HEAD` and add a `[X.Y.Z]:` line
pointing at `<prev-tag>...vX.Y.Z`. -->

[Unreleased]: https://github.com/dekobon/big-code-analysis/compare/v2.5.1...HEAD
[Unreleased]: https://github.com/dekobon/big-code-analysis/compare/v2.6.0...HEAD
[2.6.0]: https://github.com/dekobon/big-code-analysis/compare/v2.5.1...v2.6.0
[2.5.1]: https://github.com/dekobon/big-code-analysis/compare/v2.5.0...v2.5.1
[2.5.0]: https://github.com/dekobon/big-code-analysis/compare/v2.4.0...v2.5.0
[2.4.0]: https://github.com/dekobon/big-code-analysis/compare/v2.3.1...v2.4.0
Expand Down
Loading
Loading