Repository navigation
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
a0d0b15 to
b45491b
Compare
58f5d36 to
0210429
Compare
There was a problem hiding this comment.
All reported issues were addressed across 43 files
Reply to a comment to ask cubic a question or push back. It learns from your replies.
View guided diff | Re-trigger cubic
There was a problem hiding this comment.
Thanks for this, @kido5217, and sorry for the long wait. It's a careful implementation, and the corpus numbers and size measurement in the description were really helpful.
Dependency review: done, and clean. The published tree-sitter-nix 0.3.0 crate matches the v0.3.0 tag (ea1d87f) file for file, apart from Cargo's normalised Cargo.toml. parser.c, node-types.json, grammar.json and parser.h regenerate byte for byte with tree-sitter CLI 0.20.9 (the version the upstream flake pins) at --abi 13. build.rs and scanner.c only compile the grammar.
Tests at your head: we ran the Nix unit and integration tests, config parity, the catalog golden test and the census label test on an offline build machine at 1cd5360, and all pass. Our release-binary delta matches yours: +119,072 bytes (+0.09%).
We'd like to merge it. main moved a lot since you opened this, so a few things are needed first:
-
Rebase onto current
main. Eight files now conflict. In most of themmainadded Luau to the same match arms where you add Nix, so keep both.crates/aft/src/views/lazy_read_benchmark.rswas deleted along with the old views storage, so drop your edit there rather than restoring the file. Regenerate both catalog goldens andsubc_tool_schemas.json(bun run --cwd packages/opencode-plugin build:tool-schemas) instead of picking either side's hashes. -
Two auto-merge traps.
grammar_fornow returnsResult<Language, AftError>, so thenix_symbolstest helper needs to unwrap it.LangId::Luaunow sits after TOML, so append Nix after Luau, and update the census label insemantic_chunk_census.rsto Nix's new slot. -
Stack-safe walks (now required). Since you opened this, every syntax-tree walk on the indexing path keeps its depth on the heap. A crafted deep file used to overflow a 2 MiB scan thread and take down the whole
aftprocess. Two Nix helpers still recurse without a bound:nix_collect_entry, once per wrapper (parentheses,let,with,assert, lambda bodies, applications);nix_comment_ranges, through nested default expressions in function formals.
Please turn both into loops or explicit worklists, keeping the current output. Then add Nix cases to
deeply_nested_files_extract_on_a_small_stackincrates/aft/src/data_layer/content.rs: deep outer wrappers, and deeply nested defaults with comments in a function's formals. Have them assert the extracted names, so a run that silently drops Nix doesn't pass.nix_emit_bindingis bounded by the one-level outline limit and can stay as it is. -
The new index store. Outlines and symbols are now stored as content records (
crates/aft/src/data_layer/content.rs), and the old views test no longer covers the path that serves them. Please replacenix_views_callgraph_payload_accepts_nix_labelwith a test that a.nixfile produces a record with languagenix, the expected outline and TODO markers, and empty import and call facts. No extractor-version bump is needed for a new language, because record keys already include the language name.
Optional, not blocking: when a pattern holds several bindings, the error is the generic "Fails to parse the pattern query". A hint that Nix patterns may contain one binding or inherit clause would help agents recover.
We're fine with the _UPPER metavariable trade-off as documented. Pascal makes the same one, and Nix's identifier grammar leaves no better sentinel. On our side, the parser and semantic-index changes go through our search-quality check when we merge, and nothing is needed from you there.
|
Hi @kido5217, checking in on this one. Since our review, the parser code moved into its own crate ( |
|
Thanks for the detailed review — I'm picking this up. Plan: rebase onto current |
1cd5360 to
6289dc2
Compare
Registers Nix as a linked tree-sitter grammar (tree-sitter-nix 0.3.0 via aft-parse) with structural outline extraction: attrsets and dotted attrpaths become one-level symbols, lambda RHS bindings become Function symbols with one-line signatures, inherit and dynamic imports are exempted, and `_` is the ast-grep expando (Nix identifiers reject `$`). Maintainer review items (cortexkit#1370): - Rebase: ported onto the crates/aft-parse / crates/aft-base split; all implementation edits live in their new homes, zero forwarding-shim edits. grammar_for now returns Result; LangId::Nix is discriminant 34 after Luau and the census decode map carries 34 => "Nix". - Heap-bound recursion: nix_collect_entry entry-unwrap chain converted to an iterative walk and nix_comment_ranges to an explicit Vec worklist; both covered by deep_nesting_tests! cases (10k nesting on a 2 MiB stack) that additionally assert the extracted binding names. - Content-record test: replaces the retired views-plane payload test — nix_indexing_yields_a_content_record pins the outline symbols (dotted paths), TODO markers, and empty import/call edges for the Nix fixtures. - Pattern-error hint: multi-binding Nix pattern queries now fail with `nix pattern must contain one binding or one inherit clause` via the PatternError composition; four tests pin the wording and behavior. Also: nixfmt as an explicit-only formatter, docs/README/schema entries, plugin language/format enums, store-diet smoke fixture, and regenerated tool-schema goldens. Approved issue: cortexkit#492
6289dc2 to
3bdb54e
Compare
|
Rebased and hardened — squashed to one commit on current main (
Plus the optional item you allowed: the multi-binding contextual-pattern rejection now appends Gate evidence at the new head: |
Registers Nix as a linked tree-sitter grammar (tree-sitter-nix 0.3.0 via aft-parse) with structural outline extraction: attrsets and dotted attrpaths become one-level symbols, lambda RHS bindings become Function symbols with one-line signatures, inherit and dynamic imports are exempted, and `_` is the ast-grep expando (Nix identifiers reject `$`). Maintainer review items (cortexkit#1370): - Rebase: ported onto the crates/aft-parse / crates/aft-base split; all implementation edits live in their new homes, zero forwarding-shim edits. grammar_for now returns Result; LangId::Nix is discriminant 34 after Luau and the census decode map carries 34 => "Nix". - Heap-bound recursion: nix_collect_entry entry-unwrap chain converted to an iterative walk and nix_comment_ranges to an explicit Vec worklist; both covered by deep_nesting_tests! cases (10k nesting on a 2 MiB stack) that additionally assert the extracted binding names. - Content-record test: replaces the retired views-plane payload test — nix_indexing_yields_a_content_record pins the outline symbols (dotted paths), TODO markers, and empty import/call edges for the Nix fixtures. - Pattern-error hint: multi-binding Nix pattern queries now fail with `nix pattern must contain one binding or one inherit clause` via the PatternError composition; four tests pin the wording and behavior. Also: nixfmt as an explicit-only formatter, docs/README/schema entries, plugin language/format enums, store-diet smoke fixture, and regenerated tool-schema goldens. Approved issue: cortexkit#492
3bdb54e to
7f76161
Compare
Registers Nix as a linked tree-sitter grammar (tree-sitter-nix 0.3.0 via aft-parse) with structural outline extraction: attrsets and dotted attrpaths become one-level symbols, lambda RHS bindings become Function symbols with one-line signatures, inherit and dynamic imports are exempted, and `_` is the ast-grep expando (Nix identifiers reject `$`). Maintainer review items (cortexkit#1370): - Rebase: ported onto the crates/aft-parse / crates/aft-base split; all implementation edits live in their new homes, zero forwarding-shim edits. grammar_for now returns Result; LangId::Nix is discriminant 34 after Luau and the census decode map carries 34 => "Nix". - Heap-bound recursion: nix_collect_entry entry-unwrap chain converted to an iterative walk and nix_comment_ranges to an explicit Vec worklist; both covered by deep_nesting_tests! cases (10k nesting on a 2 MiB stack) that additionally assert the extracted binding names. - Content-record test: replaces the retired views-plane payload test — nix_indexing_yields_a_content_record pins the outline symbols (dotted paths), TODO markers, and empty import/call edges for the Nix fixtures. - Pattern-error hint: multi-binding Nix pattern queries now fail with `nix pattern must contain one binding or one inherit clause` via the PatternError composition; four tests pin the wording and behavior. Also: nixfmt as an explicit-only formatter, docs/README/schema entries, plugin language/format enums, store-diet smoke fixture, and regenerated tool-schema goldens. Approved issue: cortexkit#492
7f76161 to
acfbe5c
Compare
Registers Nix as a linked tree-sitter grammar (tree-sitter-nix 0.3.0 via aft-parse) with structural outline extraction: attrsets and dotted attrpaths become one-level symbols, lambda RHS bindings become Function symbols with one-line signatures, inherit and dynamic imports are exempted, and `_` is the ast-grep expando (Nix identifiers reject `$`). Maintainer review items (cortexkit#1370): - Rebase: ported onto the crates/aft-parse / crates/aft-base split; all implementation edits live in their new homes, zero forwarding-shim edits. grammar_for now returns Result; LangId::Nix is discriminant 34 after Luau and the census decode map carries 34 => "Nix". - Heap-bound recursion: nix_collect_entry entry-unwrap chain converted to an iterative walk and nix_comment_ranges to an explicit Vec worklist; both covered by deep_nesting_tests! cases (10k nesting on a 2 MiB stack) that additionally assert the extracted binding names. - Content-record test: replaces the retired views-plane payload test — nix_indexing_yields_a_content_record pins the outline symbols (dotted paths), TODO markers, and empty import/call edges for the Nix fixtures. - Pattern-error hint: multi-binding Nix pattern queries now fail with `nix pattern must contain one binding or one inherit clause` via the PatternError composition; four tests pin the wording and behavior. Also: nixfmt as an explicit-only formatter, docs/README/schema entries, plugin language/format enums, store-diet smoke fixture, and regenerated tool-schema goldens. Approved issue: cortexkit#492
acfbe5c to
b54c2fd
Compare
Registers Nix as a linked tree-sitter grammar (tree-sitter-nix 0.3.0 via aft-parse) with structural outline extraction: attrsets and dotted attrpaths become one-level symbols, lambda RHS bindings become Function symbols with one-line signatures, inherit and dynamic imports are exempted, and `_` is the ast-grep expando (Nix identifiers reject `$`). Maintainer review items (cortexkit#1370): - Rebase: ported onto the crates/aft-parse / crates/aft-base split; all implementation edits live in their new homes, zero forwarding-shim edits. grammar_for now returns Result; LangId::Nix is discriminant 34 after Luau and the census decode map carries 34 => "Nix". - Heap-bound recursion: nix_collect_entry entry-unwrap chain converted to an iterative walk and nix_comment_ranges to an explicit Vec worklist; both covered by deep_nesting_tests! cases (10k nesting on a 2 MiB stack) that additionally assert the extracted binding names. - Content-record test: replaces the retired views-plane payload test — nix_indexing_yields_a_content_record pins the outline symbols (dotted paths), TODO markers, and empty import/call edges for the Nix fixtures. - Pattern-error hint: multi-binding Nix pattern queries now fail with `nix pattern must contain one binding or one inherit clause` via the PatternError composition; four tests pin the wording and behavior. Also: nixfmt as an explicit-only formatter, docs/README/schema entries, plugin language/format enums, store-diet smoke fixture, and regenerated tool-schema goldens. Approved issue: cortexkit#492
b54c2fd to
41541ca
Compare
Registers Nix as a linked tree-sitter grammar (tree-sitter-nix 0.3.0 via aft-parse) with structural outline extraction: attrsets and dotted attrpaths become one-level symbols, lambda RHS bindings become Function symbols with one-line signatures, inherit and dynamic imports are exempted, and `_` is the ast-grep expando (Nix identifiers reject `$`). Maintainer review items (cortexkit#1370): - Rebase: ported onto the crates/aft-parse / crates/aft-base split; all implementation edits live in their new homes, zero forwarding-shim edits. grammar_for now returns Result; LangId::Nix is discriminant 34 after Luau and the census decode map carries 34 => "Nix". - Heap-bound recursion: nix_collect_entry entry-unwrap chain converted to an iterative walk and nix_comment_ranges to an explicit Vec worklist; both covered by deep_nesting_tests! cases (10k nesting on a 2 MiB stack) that additionally assert the extracted binding names. - Content-record test: replaces the retired views-plane payload test — nix_indexing_yields_a_content_record pins the outline symbols (dotted paths), TODO markers, and empty import/call edges for the Nix fixtures. - Pattern-error hint: multi-binding Nix pattern queries now fail with `nix pattern must contain one binding or one inherit clause` via the PatternError composition; four tests pin the wording and behavior. Also: nixfmt as an explicit-only formatter, docs/README/schema entries, plugin language/format enums, store-diet smoke fixture, and regenerated tool-schema goldens. Approved issue: cortexkit#492
41541ca to
e4c1b94
Compare
Registers Nix as a linked tree-sitter grammar (tree-sitter-nix 0.3.0 via aft-parse) with structural outline extraction: attrsets and dotted attrpaths become one-level symbols, lambda RHS bindings become Function symbols with one-line signatures, inherit and dynamic imports are exempted, and `_` is the ast-grep expando (Nix identifiers reject `$`). Maintainer review items (cortexkit#1370): - Rebase: ported onto the crates/aft-parse / crates/aft-base split; all implementation edits live in their new homes, zero forwarding-shim edits. grammar_for now returns Result; LangId::Nix is discriminant 34 after Luau and the census decode map carries 34 => "Nix". - Heap-bound recursion: nix_collect_entry entry-unwrap chain converted to an iterative walk and nix_comment_ranges to an explicit Vec worklist; both covered by deep_nesting_tests! cases (10k nesting on a 2 MiB stack) that additionally assert the extracted binding names. - Content-record test: replaces the retired views-plane payload test — nix_indexing_yields_a_content_record pins the outline symbols (dotted paths), TODO markers, and empty import/call edges for the Nix fixtures. - Pattern-error hint: multi-binding Nix pattern queries now fail with `nix pattern must contain one binding or one inherit clause` via the PatternError composition; four tests pin the wording and behavior. Also: nixfmt as an explicit-only formatter, docs/README/schema entries, plugin language/format enums, store-diet smoke fixture, and regenerated tool-schema goldens. Approved issue: cortexkit#492
e4c1b94 to
25d1fd9
Compare
| if let Some(&c) = bytes.get(j) { | ||
| if c.is_ascii_alphabetic() || c == b'_' || c == b'$' || c == b'"' || c == b'\'' | ||
| { | ||
| return true; |
There was a problem hiding this comment.
Valid searches get wrong advice
A valid pattern such as let a = 1; in a triggers this hint because the scanner treats in after the semicolon as another binding. When the search finds no matches, ast_search incorrectly says the expression cannot parse and should be split apart. Users or agents following that advice may abandon the intended search.
Check that the pattern is an attrset-body fragment before giving this advice.
Registers Nix as a linked tree-sitter grammar (tree-sitter-nix 0.3.0 via aft-parse) with structural outline extraction: attrsets and dotted attrpaths become one-level symbols, lambda RHS bindings become Function symbols with one-line signatures, inherit and dynamic imports are exempted, and `_` is the ast-grep expando (Nix identifiers reject `$`). Maintainer review items (cortexkit#1370): - Rebase: ported onto the crates/aft-parse / crates/aft-base split; all implementation edits live in their new homes, zero forwarding-shim edits. grammar_for now returns Result; LangId::Nix is discriminant 34 after Luau and the census decode map carries 34 => "Nix". - Heap-bound recursion: nix_collect_entry entry-unwrap chain converted to an iterative walk and nix_comment_ranges to an explicit Vec worklist; both covered by deep_nesting_tests! cases (10k nesting on a 2 MiB stack) that additionally assert the extracted binding names. - Content-record test: replaces the retired views-plane payload test — nix_indexing_yields_a_content_record pins the outline symbols (dotted paths), TODO markers, and empty import/call edges for the Nix fixtures. - Pattern-error hint: multi-binding Nix pattern queries now fail with `nix pattern must contain one binding or one inherit clause` via the PatternError composition; four tests pin the wording and behavior. Also: nixfmt as an explicit-only formatter, docs/README/schema entries, plugin language/format enums, store-diet smoke fixture, and regenerated tool-schema goldens. Approved issue: cortexkit#492
25d1fd9 to
98bde65
Compare
Registers Nix as a linked tree-sitter grammar (tree-sitter-nix 0.3.0 via aft-parse) with structural outline extraction: attrsets and dotted attrpaths become one-level symbols, lambda RHS bindings become Function symbols with one-line signatures, inherit and dynamic imports are exempted, and `_` is the ast-grep expando (Nix identifiers reject `$`). Maintainer review items (cortexkit#1370): - Rebase: ported onto the crates/aft-parse / crates/aft-base split; all implementation edits live in their new homes, zero forwarding-shim edits. grammar_for now returns Result; LangId::Nix is discriminant 34 after Luau and the census decode map carries 34 => "Nix". - Heap-bound recursion: nix_collect_entry entry-unwrap chain converted to an iterative walk and nix_comment_ranges to an explicit Vec worklist; both covered by deep_nesting_tests! cases (10k nesting on a 2 MiB stack) that additionally assert the extracted binding names. - Content-record test: replaces the retired views-plane payload test — nix_indexing_yields_a_content_record pins the outline symbols (dotted paths), TODO markers, and empty import/call edges for the Nix fixtures. - Pattern-error hint: multi-binding Nix pattern queries now fail with `nix pattern must contain one binding or one inherit clause` via the PatternError composition; four tests pin the wording and behavior. Also: nixfmt as an explicit-only formatter, docs/README/schema entries, plugin language/format enums, store-diet smoke fixture, and regenerated tool-schema goldens. Approved issue: cortexkit#492
98bde65 to
6f52429
Compare
Registers Nix as a linked tree-sitter grammar (tree-sitter-nix 0.3.0 via aft-parse) with structural outline extraction: attrsets and dotted attrpaths become one-level symbols, lambda RHS bindings become Function symbols with one-line signatures, inherit and dynamic imports are exempted, and `_` is the ast-grep expando (Nix identifiers reject `$`). Maintainer review items (cortexkit#1370): - Rebase: ported onto the crates/aft-parse / crates/aft-base split; all implementation edits live in their new homes, zero forwarding-shim edits. grammar_for now returns Result; LangId::Nix is discriminant 34 after Luau and the census decode map carries 34 => "Nix". - Heap-bound recursion: nix_collect_entry entry-unwrap chain converted to an iterative walk and nix_comment_ranges to an explicit Vec worklist; both covered by deep_nesting_tests! cases (10k nesting on a 2 MiB stack) that additionally assert the extracted binding names. - Content-record test: replaces the retired views-plane payload test — nix_indexing_yields_a_content_record pins the outline symbols (dotted paths), TODO markers, and empty import/call edges for the Nix fixtures. - Pattern-error hint: multi-binding Nix pattern queries now fail with `nix pattern must contain one binding or one inherit clause` via the PatternError composition; four tests pin the wording and behavior. Also: nixfmt as an explicit-only formatter, docs/README/schema entries, plugin language/format enums, store-diet smoke fixture, and regenerated tool-schema goldens. Approved issue: cortexkit#492
6f52429 to
c35c651
Compare
|
Want your agent to iterate on Greptile's feedback? Try greploops. |
Registers Nix as a linked tree-sitter grammar (tree-sitter-nix 0.3.0 via aft-parse) with structural outline extraction: attrsets and dotted attrpaths become one-level symbols, lambda RHS bindings become Function symbols with one-line signatures, inherit and dynamic imports are exempted, and `_` is the ast-grep expando (Nix identifiers reject `$`). Maintainer review items (cortexkit#1370): - Rebase: ported onto the crates/aft-parse / crates/aft-base split; all implementation edits live in their new homes, zero forwarding-shim edits. grammar_for now returns Result; LangId::Nix is discriminant 34 after Luau and the census decode map carries 34 => "Nix". - Heap-bound recursion: nix_collect_entry entry-unwrap chain converted to an iterative walk and nix_comment_ranges to an explicit Vec worklist; both covered by deep_nesting_tests! cases (10k nesting on a 2 MiB stack) that additionally assert the extracted binding names. - Content-record test: replaces the retired views-plane payload test — nix_indexing_yields_a_content_record pins the outline symbols (dotted paths), TODO markers, and empty import/call edges for the Nix fixtures. - Pattern-error hint: multi-binding Nix pattern queries now fail with `nix pattern must contain one binding or one inherit clause` via the PatternError composition; four tests pin the wording and behavior. Also: nixfmt as an explicit-only formatter, docs/README/schema entries, plugin language/format enums, store-diet smoke fixture, and regenerated tool-schema goldens. Approved issue: cortexkit#492
c35c651 to
3c2d7c7
Compare
Registers Nix as a linked tree-sitter grammar (tree-sitter-nix 0.3.0 via aft-parse) with structural outline extraction: attrsets and dotted attrpaths become one-level symbols, lambda RHS bindings become Function symbols with one-line signatures, inherit and dynamic imports are exempted, and `_` is the ast-grep expando (Nix identifiers reject `$`). Maintainer review items (cortexkit#1370): - Rebase: ported onto the crates/aft-parse / crates/aft-base split; all implementation edits live in their new homes, zero forwarding-shim edits. grammar_for now returns Result; LangId::Nix is discriminant 34 after Luau and the census decode map carries 34 => "Nix". - Heap-bound recursion: nix_collect_entry entry-unwrap chain converted to an iterative walk and nix_comment_ranges to an explicit Vec worklist; both covered by deep_nesting_tests! cases (10k nesting on a 2 MiB stack) that additionally assert the extracted binding names. - Content-record test: replaces the retired views-plane payload test — nix_indexing_yields_a_content_record pins the outline symbols (dotted paths), TODO markers, and empty import/call edges for the Nix fixtures. - Pattern-error hint: multi-binding Nix pattern queries now fail with `nix pattern must contain one binding or one inherit clause` via the PatternError composition; four tests pin the wording and behavior. Also: nixfmt as an explicit-only formatter, docs/README/schema entries, plugin language/format enums, store-diet smoke fixture, and regenerated tool-schema goldens. Approved issue: cortexkit#492
3c2d7c7 to
1915cd0
Compare
| if b == b'#' { | ||
| while i < bytes.len() && bytes[i] != b'\n' { | ||
| i += 1; | ||
| } | ||
| continue; |
There was a problem hiding this comment.
Block comments break binding searches
The comment scanner rejects valid binding patterns containing # inside a Nix block comment. For example, a = /* # note */ true; reaches the contextual fallback, which removes everything from # onward. This leaves an unfinished block comment, so nix_wrapper_selector rejects the pattern. Users must remove the comment before searching or replacing.
Preserve block comments while stripping line comments, or use parsed comment ranges instead.
Registers Nix as a linked tree-sitter grammar (tree-sitter-nix 0.3.0 via aft-parse) with structural outline extraction: attrsets and dotted attrpaths become one-level symbols, lambda RHS bindings become Function symbols with one-line signatures, inherit and dynamic imports are exempted, and `_` is the ast-grep expando (Nix identifiers reject `$`). Maintainer review items (cortexkit#1370): - Rebase: ported onto the crates/aft-parse / crates/aft-base split; all implementation edits live in their new homes, zero forwarding-shim edits. grammar_for now returns Result; LangId::Nix is discriminant 34 after Luau and the census decode map carries 34 => "Nix". - Heap-bound recursion: nix_collect_entry entry-unwrap chain converted to an iterative walk and nix_comment_ranges to an explicit Vec worklist; both covered by deep_nesting_tests! cases (10k nesting on a 2 MiB stack) that additionally assert the extracted binding names. - Content-record test: replaces the retired views-plane payload test — nix_indexing_yields_a_content_record pins the outline symbols (dotted paths), TODO markers, and empty import/call edges for the Nix fixtures. - Pattern-error hint: multi-binding Nix pattern queries now fail with `nix pattern must contain one binding or one inherit clause` via the PatternError composition; four tests pin the wording and behavior. Also: nixfmt as an explicit-only formatter, docs/README/schema entries, plugin language/format enums, store-diet smoke fixture, and regenerated tool-schema goldens. Approved issue: cortexkit#492
1915cd0 to
cd44e0a
Compare
Registers Nix as a linked tree-sitter grammar (tree-sitter-nix 0.3.0 via aft-parse) with structural outline extraction: attrsets and dotted attrpaths become one-level symbols, lambda RHS bindings become Function symbols with one-line signatures, inherit and dynamic imports are exempted, and `_` is the ast-grep expando (Nix identifiers reject `$`). Maintainer review items (cortexkit#1370): - Rebase: ported onto the crates/aft-parse / crates/aft-base split; all implementation edits live in their new homes, zero forwarding-shim edits. grammar_for now returns Result; LangId::Nix is discriminant 34 after Luau and the census decode map carries 34 => "Nix". - Heap-bound recursion: nix_collect_entry entry-unwrap chain converted to an iterative walk and nix_comment_ranges to an explicit Vec worklist; both covered by deep_nesting_tests! cases (10k nesting on a 2 MiB stack) that additionally assert the extracted binding names. - Content-record test: replaces the retired views-plane payload test — nix_indexing_yields_a_content_record pins the outline symbols (dotted paths), TODO markers, and empty import/call edges for the Nix fixtures. - Pattern-error hint: multi-binding Nix pattern queries now fail with `nix pattern must contain one binding or one inherit clause` via the PatternError composition; four tests pin the wording and behavior. Also: nixfmt as an explicit-only formatter, docs/README/schema entries, plugin language/format enums, store-diet smoke fixture, and regenerated tool-schema goldens. Approved issue: cortexkit#492
cd44e0a to
6e7f596
Compare
Approved issue
Approved issue: #492 (
design-approved)What changed
Rebased onto current
main(thecrates/aft-parse/crates/aft-basesplit): all implementation now lives in those crates — the forwarding shims undercrates/aft/src/are untouched. Adds Nix as a supported language for:let … inbody (itsletbindings are listed at file level too), an attrset reached throughwith/assert/parentheses, or an attrset reached by applying a function to an attrset (each unwrap step is an iterative walk, not recursion — see Checks). Only an application's final argument is traversed; earlier arguments and list/if///expressions contribute nothing. The same rule applies to nested values, soconfig = lib.mkIf cond { … }nests its children. The outline lists the entry bindings, then exactly one level of nested attrsets or lambda bodies returning attrsets. Bindings are named by their dotted attrpath (config.services.demo.enable); function bindings carry a one-line header as the signature;inheritclauses are skipped; two top-level bindings with identical full names are both kept without expanding their children.AstGrepLang::Nixontree-sitter-nix0.3.0. Patterns are written with$NAME, which the_expando rewrites to_NAMEbecause the grammar rejects$andµas identifier characters. ast-grep's own registry makes the same choice for Nix (crates/language/src/registry.rs). Complete Nix expressions match through the normal path; a standalone binding orinheritclause is not an expression, socompile_patternfalls back to a contextual pattern that selects the sole binding-set member's own kind (binding,inherit,inherit_from). This keeps sibling bindings intact on replace (a whole-attrset pattern would delete them), and a wrapper mixing members — two bindings, or a binding plus aninherit— is rejected with a hint naming the language:nix pattern must contain one binding or one inherit clause. Because_is also a legal Nix identifier start, a key written_plus an all-uppercase name (_FOO) is read as a metavariable;_Foo,__functor, and_module.argsstay literal..nixis in the extension policy and the chunk census label map (34 => "Nix", behind Luau's 33).nixfmtis the only formatter Nix resolves, and only through an explicitformatter.nixkey (no auto-detection;formatter.nix = "none"still disables formatting).nixfmtis accepted by the Rust config resolver, both plugin config schemas, and the generated JSON schema. Checker validation stays unsupported.nixadded to both harness plugin AST enums and the regeneratedsubc_tool_schemas.json+ tool-provider catalog goldens (and the refreshed direct-registration digest fixture, following the precedent of8204e6731).join::language_id, even though Nix has no call edges).formatter.nixkey indocs/config.md, theConfig::formatterdoc comment, and accepted-language lists plus error messages in the AST tools now naming every canonical language.Unsupported for now (approved scope): imports, refactor, call graph. The call graph reports no Nix edges.
Dependency
tree-sitter-nix = "0.3.0"(nix-community, MIT, ~45 KB, ABI 13, externalscanner.c), linked intoaft-parselike TOML/JSON/YAML — no download manifest or wasm distribution involved. numtide has no crates.io release yet, so this is the published pin the issue approved; switch when a numtide crate publishes. 0.3.0 predates the|>pipe operator and bareinherit;, so a file using them parses withERRORnodes and may outline partially. The workspace'stree-sitter0.26.7 has a minimum compatible ABI of 13, so the grammar loads at the floor.Checks
On the rebased head
6e7f59628(rustc via the repo's Nix toolchain):cargo test -p aft-parse nix_— green: outline/signature/depth/inherit/applied-entry/nested-application/collision unit tests, ast-grep contextual patterns (bindings, inherit clauses, multi-binding rejection), and the four pattern-hint tests pinning the wording above.deep_nesting_tests!Nix cases —nix_deeply_nested_parens_extracts_binding_on_a_small_stackandnix_deeply_nested_formal_default_extracts_binding_on_a_small_stack: 10,000-deep nesting on the harness's 2 MiB stack thread, asserting the extracted binding names (not justis_ok). RED first on the recursive code (stack overflow, coredump-confirmed), green after convertingnix_collect_entry's entry-unwrap chain to an iterative walk andnix_comment_rangesto an explicitVecworklist.cargo test -p agent-file-tools --features test-hooks --test integration nix_test— 8 passed: the content-record test (nix_indexing_yields_a_content_record, replacing the retired views-plane payload test) pins outline symbols, TODO markers, and empty import/call edges; plus outline/zoom/language label, ast search/replace sibling preservation, unsupported import/refactor, empty call-graph annotations, validation skip, dotted provider symbols, and the semantic-extension policy test.cargo test -p agent-file-tools --lib -- store_diet— green with the newsmoke-nixcorpus entry (fixture + manifest).grammar_tests(frozen builtin list now namesnix),created_file_syntax,language_label_covers_nix(census decode),nix_is_excluded_from_duplicate_scanning, format nixfmt integration — all green.cargo fmt --all -- --checkandcargo clippy --workspace --all-targets --features agent-file-tools/test-hooks— clean.cargo check -p agent-file-tools --features "wasm-grammars test-hooks" --all-targets— clean (Nix appears in no wasm/download path)../scripts/rust-test-gate.shon a NixOS dev host: the port introduces zero new test failures — the full nextest-phase failure set on this head is a strict subset of the same-host failure set on cleanmainatb0f2b509f(411 pre-existing host-environmental failures: FHS-path fixtures like the/bin/catdeploy helper, nested-userns sandbox checks, daemon-timing watchers; all Nix tests pass under an FHS overlay). On stock Linux CI these classes do not arise.assets/aft.schema.json(bun run schema), the five tool-schema goldens (bun run build:tool-schemas, drift-checked with--check), the catalog goldens (ignored regen test), andfull_catalog_goldens_and_digest_only_have_exact_identitygreen.bun testtool-surface suites green under the overlay; residual plugin failures reproduce identically on pristinemain(host state: absent/usr/bin/id,subc-coresibling checkout, production storage present).Corpus validation
Against a local NixOS configuration corpus (121
.nixfiles, 494,563 bytes, 13,929 lines), re-measured on the rebased head with the same committed harness used pre-rebase:ERROR/MISSINGnodesnix.gitignore)validate: "full"validate_skipped_reason=unsupported_languageOnly aggregate counts and size are reported. Corpus paths, file names, and content stay on the machine it was found on.
Release binary size
target/release/aft,cargo build --release -p agent-file-tools, same toolchain both sides:target/release/aftbytesmainatb0f2b509f6e7f59628(The previous table measured against the stale
7ca30b526base; ~2,700 merged main commits moved the absolute number, which is why both sides are rebuilt here.)Notes
pr-1370-pre-rebase(1cd536049) if review wants the old commits./bin/cat, which is absent on NixOS hosts; local verification ran it under a mount-namespace overlay. CI on stock Linux is unaffected.

Confidence Score: 5/5
The PR appears safe to merge, with two non-blocking pattern-search issues remaining from the previous review.Findings
Summary
Adds Nix support for outline, zoom, AST search and replace, and semantic indexing.
nixfmtwhen explicitly configured.Reviews (15) · Last reviewed commit: "feat(lang): add Nix language support" · Reviewed by Greptile