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
2 changes: 1 addition & 1 deletion queries/clojure/tags.scm
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
; Only symbolic list heads can be direct calls. Special forms and declaration
; heads are excluded by the Clojure capture filter.
(list_lit
[(comment) (dis_expr)]* .
[(comment) (dis_expr) (meta_lit)]* .
value: (sym_lit name: (sym_name) @name)) @reference.call
6 changes: 5 additions & 1 deletion src/ingest_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,11 @@ constexpr std::uint32_t kCacheVersion = 54; // 54: lane qd-tangle —
// (Py `pkg.mod`, TS `./x`, Rust `crate::a::b`/`mod:x`) —
// a target FORMAT change → old caches must be rejected.
// 4: Include gained a `bool isAngle` (quote/angle) field
constexpr std::uint32_t kParserVer = 335; // bump on any grammar/.scm/extraction change
constexpr std::uint32_t kParserVer = 337; // bump on any grammar/.scm/extraction change
// 337 = 2026-11-21 (#548 arm 1, @himanchalkaushale, PR #715, landed as lane land-715; was 311 on the PR, above train
// 1118a's 335/336): a Clojure call whose list head carries metadata (`^{:doc "tagged"} (square 4)`, `^String (square 5)`)
// is captured, and the C++ head filter (ingest_clojure.h clojureListHead) skips meta_lit before reading the head.
// Rich file tag 338. kCacheVersion unchanged.
// 335 = 2026-11-20 (train 1118a, lane qual-ns-call-bind; above train 1117d2's 333/334, rich 336): C++ / ObjC
// using-declarations and namespace aliases are recorded while the call-result family is off
// (ingest_binds.h kCppCallScopeFacts), read by receiverevidence.h CallResultTypes::cppScopeNamedAt.
Expand Down
22 changes: 11 additions & 11 deletions src/ingest_clojure.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@ std::string_view clojureListHead( TSNode list, std::string_view src ) noexcept
{
return {};
}
// The head is the first named child that is not a comment, a `#_` discard or reader metadata (`^:tag`, `^{…}`):
// the same leading slot queries/clojure/tags.scm's call pattern skips.
const std::uint32_t childCount = ts_node_named_child_count( list );
std::uint32_t headIndex = 0;
while( headIndex < childCount
&& ( kindIs( ts_node_type( ts_node_named_child( list, headIndex ) ), "comment" )
|| kindIs( ts_node_type( ts_node_named_child( list, headIndex ) ), "dis_expr" ) ) )
for( std::uint32_t childIndex = 0; childIndex < childCount; ++childIndex )
{
++headIndex;
}
if( headIndex == childCount )
{
return {};
const TSNode child = ts_node_named_child( list, childIndex );
const char* kind = ts_node_type( child );
if( kindIs( kind, "comment" ) || kindIs( kind, "dis_expr" ) || kindIs( kind, "meta_lit" ) )
{
continue;
}
return kindIs( kind, "sym_lit" ) ? nodeTextOf( child, src ) : std::string_view{};
Comment thread
joyful-ii-V-I marked this conversation as resolved.
Resolved
}
const TSNode head = ts_node_named_child( list, headIndex );
return kindIs( ts_node_type( head ), "sym_lit" ) ? nodeTextOf( head, src ) : std::string_view{};
return {};
}

// Temporary keyword-head table: CONTRIBUTING slice 5a moves these decisions into tags-pass predicates.
Expand Down
3 changes: 2 additions & 1 deletion src/quality.h
Original file line number Diff line number Diff line change
Expand Up @@ -3210,7 +3210,8 @@ inline std::string cacheRootKeyHex( const std::string& root )
// not include this header; it relies on ingest.cpp including quality.h (line 13) before ingest_cache.h, and a reorder
// that broke that fails the build on the undeclared name rather than passing.
constexpr std::uint32_t kIngestCacheVersionMirror = 54; // MUST equal ingest.cpp's kCacheVersion (gated); 54 = lane qd-tangle (def record steering-locals byte), 53 = lane rust-self-chain (LocalBindKind RecvCall), 52 = lane failure-default (construct-hit failure-default tag), 51 = lane qd-constructs (FILE record construct-hit family), 50 = lane clones-persist (Function/Method def record clone key), 49 = lane warm-direct (FILE record head family counts), 48 = train 42b (alias-import LocalBindKind ReExport; its placeholder 47), 46 = train 40 (js-def-naming JsObjectLiteral; its placeholder 45), 44 = train 37b (rust-degraded FileHealth::useBoundsBlanked; its placeholder 42), 43 = train 36 (#155 trailingLambda ref byte; above main 40, #438's placeholder 41, rust-degraded's 42), 40 = train 34 (fc3-js-rebind JsRebind; above main 39), 39 = train 33 (above main 36 and l6-iface 38), 38 = train 32 lane l6-iface fix round 1: LocalBindKind ImplBlock (train renumbers), 37 = train 32 lane l6-iface: LocalBindKind DispatchType (train renumbers), 36 = train 30 (above call-result-typing's and fcall-forward's 33, name-template-dispatch's 35, main's 34), 34 = train 29 (above lane arity-min's and call-result-typing's 33), 33 = train 29 lane arity-min: def record paramsMin (the train renumbers), 33 = lane call-result-typing: RawBind resultIndex + unwrapDepth, 33 = lane fcall-forward: ref `forwarded` byte, 35 = lane name-template-dispatch: RefRole Pattern 11, 32 = train 28: RefRole Subscript 9 + Inert 10, 31 = train 27: lego-transitive's inherit-ref baseBind (the lane's 30), 29 = FE-B ref memberPath/memberCtor + 4 bind kinds, 28 = FE-A ref memberCall/memberRoot, 27 = corrected fnScope values, 26 = function-local def scope span (25 = #157 + #150)
constexpr std::uint32_t kIngestParserVerMirror = 335; // MUST equal ingest.cpp's kParserVer (gated)
constexpr std::uint32_t kIngestParserVerMirror = 337; // MUST equal ingest.cpp's kParserVer (gated)
// 337 = 2026-11-21 (#548 arm 1, @himanchalkaushale, PR #715 (its 311): Clojure calls under list-head metadata; rich 338)
// 335 = 2026-11-20 (train 1118a, lane qual-ns-call-bind, rich 336): C++ using-declarations + namespace aliases recorded
// 333 = 2026-11-18 (train 1117d2 on train 1117d1, rich 334; members below, each was a placeholder)
// std-namesake (placeholder 317): a Rust binding written as a standard type keeps its spine on the tombstone
Expand Down
26 changes: 24 additions & 2 deletions test/clojurecheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ assert files == {'core.clj', 'browser.cljs', 'shared.cljc', 'tasks.bb'}, files
rows = list(t.iter('s'))
names = {s.get('n').split('/')[0] for s in rows}
expected = {'sample.core', 'sample.browser', 'sample.shared', 'sample.tasks', 'answer', 'cached',
'square', 'secret', 'unless', 'area', 'Greeter', 'Person', 'Counter', 'quoted', 'interop',
'square', 'cube', 'doto', 'secret', 'unless', 'area', 'Greeter', 'Person', 'Counter', 'quoted', 'interop',
'run', 'render', 'shared', 'task', 'quoted-holder', 'route', 'spaced', 'commented',
'gap-call', 'comment-call', 'comment-holder', 'join', 'qualified-join', 'documented',
'nested-quote', 'nested-discard', 'nested-comment', 'comment-not-head', 'comment-x',
'comment-x-holder', 'before-discard', 'after-discard', 'quoted-macro', 'a', 'b',
'syntax-quote-hole', 'live-hole-control'}
'syntax-quote-hole', 'live-hole-control', 'plain-call', 'meta-call', 'tag-call', 'stacked-meta-call',
'quoted-meta', 'special-form-metadata', 'metadata-not-call'}
assert names == expected, (names, expected)
by = {s.get('n').split('/')[0]: s for s in rows}
for name, kind in {'answer':'var', 'cached':'var', 'square':'fn', 'unless':'macro',
Expand All @@ -47,6 +48,16 @@ for name in ('spaced', 'commented', 'gap-call', 'comment-call'):
assert 'square' in calls(name), (name, calls(name))
assert 'square' not in calls('quoted-holder'), calls('quoted-holder')
assert 'square' not in calls('comment-holder'), calls('comment-holder')
# Arm 1 (#548): metadata before a list head does not hide the call; a quoted metadata call stays
# inert, metadata on a non-call records nothing, and a metadata-prefixed special form stays excluded.
# `doto` has an in-tree def (core.clj), so a special form leaking past the gate would resolve and fail here;
# mutant check 2026-11-21 (lane land-715): with the specialForms test removed this arm goes red on ('doto').
for name in ('plain-call', 'meta-call', 'tag-call', 'stacked-meta-call'):
assert calls(name) == {'square'}, (name, calls(name))
assert calls('quoted-meta') == set(), calls('quoted-meta')
assert calls('special-form-metadata') == set(), calls('special-form-metadata')
assert calls('metadata-not-call') == set(), calls('metadata-not-call')
print('PASS metadata-prefixed calls extracted; quoted metadata and special forms stay inert')
# Slice 8a: nested inert forms drop their calls; a live sibling proves the holder is still captured.
for name in ('nested-quote', 'nested-discard', 'nested-comment', 'quoted-macro'):
assert calls(name) == {'secret'}, (name, calls(name))
Expand Down Expand Up @@ -74,6 +85,17 @@ print('PASS known shared resolver gap: str/join currently binds the in-tree join
print('PASS Clojure definitions, kinds, calls, quote/discard negatives, and four extensions')
PY

"$BIN" "$TMP/fix" --callers=square --no-cache >"$TMP/callers-square.xml"
python3 - "$TMP/callers-square.xml" <<'PY'
import sys, xml.etree.ElementTree as ET
names = {s.get('n').split('/')[0] for s in ET.parse(sys.argv[1]).iter('s')}
for name in ('plain-call', 'meta-call', 'tag-call', 'stacked-meta-call'):
assert name in names, (name, names)
for name in ('quoted-meta', 'special-form-metadata'):
assert name not in names, (name, names)
print('PASS --callers=square names the metadata-prefixed callers and not the inert forms')
PY

"$BIN" "$TMP/fix" --metrics --no-cache >"$TMP/metrics.xml"
python3 - "$TMP/metrics.xml" <<'PY'
import sys, xml.etree.ElementTree as ET
Expand Down
26 changes: 26 additions & 0 deletions test/clojurefix/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
(def answer 42)
(defonce cached 1)
(defn square [x] (* x x))
(defn cube [x] (* x x x))
; Shadows a special-form name so a metadata-prefixed `(doto …)` that leaked past the special-form gate
; would resolve here and show as a call (an unresolved `if` never shows, so it alone cannot fail).
(defn doto [x] x)
(defn join [xs] xs)
(defn qualified-join [] (str/join "," ["a" "b"]))
(defn- secret [x] (square x))
Expand Down Expand Up @@ -35,6 +39,28 @@

(defn run [x] (secret x))

(defn plain-call []
(square 3))

(defn meta-call []
^{:doc "tagged"} (square 4))

(defn tag-call []
^String (square 5))

(defn stacked-meta-call []
^:a ^{:b 1} (square 6))

(defn quoted-meta []
'(^{:doc "inert"} (cube 6)))

(defn special-form-metadata []
^{:doc "special"} (if true 1 2)
^{:doc "special"} (doto 1))

(defn metadata-not-call []
^:private square)

(defn nested-quote [] ''(square 1) (secret 1))
(defn nested-discard [] #_(do #_(square 1) (square 2)) (secret 1))
(defn nested-comment [] (comment (comment (square 1)) (square 2)) (secret 1))
Expand Down
2 changes: 1 addition & 1 deletion test/qschemetrip.hash
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ffa77d0632bf0902173aa7908075bceff612ac665c8714573acec8f3ae8d5cc3
a57b75c512a18d0769a1034b24104c85ae9102a6c43c9e89a7cdee5350ee08a9
5 changes: 5 additions & 0 deletions test/qschemetripcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ SRC="$ROOT/src/quality.h"
ING="$ROOT/src/ingest_cache.h" # extraction-identity constants moved here (2026-08-29 ingest.cpp section split); the hashed CONCAT label keeps its historical spelling so the pin holds
PIN="$ROOT/test/qschemetrip.hash"
# RE-PIN LOG (the pin is a bare hash, so its justification has to live here).
# 2026-11-21, lane land-715 (#715 by @himanchalkaushale, #548 arm 1: Clojure calls whose list head carries metadata; stacked on
# train 1118a 4b1f4516e): RE-PINNED with UPDATE_GOLDEN=1 (hash a57b75c512…5350ee08a9). Watched text: kParserVer 335 -> 337
# (rich file tag 338; the PR's 311/312 renumbered above the train's 335/336): queries/clojure/tags.scm accepts a meta_lit before a
# list head and src/ingest_clojure.h clojureListHead skips it. quality.h's kIngestParserVerMirror moves with it. kCacheVersion 54
# and kQSnapCacheScheme 38 stay: no record changes shape and no watched quality.h function moved.
# 2026-11-21, train 1118a (import-proved-splits, qual-ns-call-bind, cr705-edges, #711 ts paths alias; rebased onto main 5df5a26be,
# #714 = train ge2): RE-PINNED ONCE with UPDATE_GOLDEN=1 from the rebased build (hash ffa77d0632…ae8d5cc3). kParserVer 335
# (rich 336) is the train's number for qual-ns-call-bind, above main's 333/334; the other members change no extraction.
Expand Down
Loading