You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(clojure): extract calls whose list head carries metadata (#548) - #715
Clojure extraction was missing valid function calls when metadata appeared before the function name inside a list.
For example:
^{:doc"tagged"} (square4)
^String (square5)
The issue was that tree-sitter-clojure represents metadata as a meta_lit node. The existing query did not account for this node before the function name, so these calls were skipped.
This PR fixes the issue by allowing metadata before the list head, just like comments and discard expressions.
The C++ list-head check is also updated to ensure special forms such as if remain excluded correctly.
Updated queries/clojure/tags.scm to allow comment, dis_expr, and meta_lit before the function name.
Updated clojureListHead in src/ingest_clojure.h to skip metadata when identifying the actual list head. This prevents metadata from being mistaken for the function name and keeps special-form filtering working correctly.
Added regression cases in test/clojurefix/core.clj covering normal calls, metadata calls, quoted expressions, special forms, and metadata attached to symbols.
Updated test/clojurecheck.sh with assertions for these cases, including an explicit --callers=square check.
Also updated parser versions:
kParserVer: 309 → 311
Rich file tag: 312
kIngestParserVerMirror: 309 → 311
Updated test/qschemetrip.hash and added a dated justification entry to test/qschemetripcheck.sh.
A Clojure list with metadata before its head (`^{:doc "tagged"} (square 4)`,
`^String (square 5)`) parses with a named meta_lit child in front of the head,
so the call pattern's `.` anchor never reached the sym_lit and the call was
dropped. Accept meta_lit in the same leading slot as comments and discards.
The C++ head filter must skip meta_lit too: otherwise a metadata-prefixed
special form would read as head "meta_lit" and bypass the special-form gate.
Metadata on non-call forms and inside quoted code stays inert.
Bump kParserVer 309 -> 311 (rich file tag 312) with quality.h's mirror and
re-pin test/qschemetrip.hash. Add fixture and gate arms for tagged, plain,
quoted, special-form, and non-call metadata, including an explicit
--callers=square assertion. Arm 1 of redhat-et#548 only; anon_fn_lit is untouched.
Auto incremental reviews are disabled on this repository.
Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Walkthrough
Clojure direct-call extraction now accepts metadata literals between a list head and the captured symbol. The C++ list-head filter also skips metadata literals. Tests cover metadata-prefixed calls, excluded forms, and caller filtering. Parser-version markers and the re-pin log are updated; cache versions remain unchanged.
The direct-call query and C++ list-head filter now skip metadata literals. Tests cover metadata-prefixed calls, quoted metadata, special forms, non-calls, and caller filtering. Parser-version markers change from 309 to 311; the rich-file tag is 312. The cache version and cache scheme remain unchanged.
This change makes Clojure calls with metadata before the function name, such as ^String (square 5), appear in extracted call data. Special forms and metadata on non-call forms remain excluded. No merge-blocking risk was found.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title names the main change: Clojure call extraction now handles list heads that carry metadata. The PR objectives confirm the query and clojureListHead changes that do this. The title follows con…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main change: Clojure call extraction now handles list heads that carry metadata. The PR objectives confirm the query and clojureListHead changes that do this. The title follows conventional commit form and cites issue #548. It is specific and accurate.
Reviewing files that changed from the base of the PR and between f79a94e and 63a7aaf.
Files ignored due to path filters: 2
test/clojurefix/core.clj is excluded by !test/*fix/**
test/qschemetrip.hash is excluded by !test/*.hash
Files selected for processing: 6
queries/clojure/tags.scm
src/ingest_cache.h
src/ingest_clojure.h
src/quality.h
test/clojurecheck.sh
test/qschemetripcheck.sh
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Clojure extraction was missing valid function calls when metadata appeared before the function name inside a list.
For example:
^{:doc "tagged"} (square 4) ^String (square 5)The issue was that
tree-sitter-clojurerepresents metadata as ameta_litnode. The existing query did not account for this node before the function name, so these calls were skipped.This PR fixes the issue by allowing metadata before the list head, just like comments and discard expressions.
The C++ list-head check is also updated to ensure special forms such as
ifremain excluded correctly.This PR covers only Arm 1 of #548.
Implementation Details
Updated
queries/clojure/tags.scmto allowcomment,dis_expr, andmeta_litbefore the function name.Updated
clojureListHeadinsrc/ingest_clojure.hto skip metadata when identifying the actual list head. This prevents metadata from being mistaken for the function name and keeps special-form filtering working correctly.Added regression cases in
test/clojurefix/core.cljcovering normal calls, metadata calls, quoted expressions, special forms, and metadata attached to symbols.Updated
test/clojurecheck.shwith assertions for these cases, including an explicit--callers=squarecheck.Also updated parser versions:
kParserVer: 309 → 311kIngestParserVerMirror: 309 → 311Updated
test/qschemetrip.hashand added a dated justification entry totest/qschemetripcheck.sh.Testing
The following checks passed locally:
clojurecheck.sh: ALL PASSqschemetripcheck.sh: ALL PASSqextractionkeycheck.sh: PASS, mirror 311 == 311langidentitycheck.sh: 371 SAME / 9 DIFF / 0 EMPTY / 0 ERRORThe 9 differences are expected and limited to the Clojure changes.
Two full-repository runs produced byte-identical output, and XML validation passed.
Build and test commands
cmake -S . -B build cmake --build build -j bash test/clojurecheck.sh ./build/ripwire bash test/qschemetripcheck.sh bash test/qextractionkeycheck.sh ./build/ripwireManual verification
Metadata calls are now detected correctly, while quoted expressions, special forms, and metadata attached to symbols remain excluded.
ASan and the full
pargates.pysuite were not run because the development environment was Windows.Scope
This PR fixes only Arm 1 of #548.
The following are intentionally out of scope:
anon_fn_lit(Arm 2)Closes Arm 1 of #548.
Summary by CodeRabbit