GitNexus/gitnexus/test/unit
Gergő Magyar c72890d59d
feat(csharp): C# MethodExtractor config (#582)
* feat(csharp): add C# MethodExtractor config (#573)

Add C# method extraction config mirroring the JVM pattern from PR #576.
Wire csharpMethodConfig into the C# language provider and add 18 tests
covering classes, interfaces, abstract classes, structs, records,
constructors, params/out/ref/optional parameters, sealed methods,
attributes, and visibility modifiers.

* fix(csharp): add destructor, operator, conversion operator, and in-param support

- Add destructor_declaration, operator_declaration, and
  conversion_operator_declaration to methodNodeTypes
- Custom extractName for operators (e.g., "operator +", "implicit operator double")
- Fix extractReturnType for operator declarations (use type field, not returns)
- Add in modifier to parameter extraction (alongside out/ref)
- Add 4 new tests: destructor, operator+, implicit conversion, in parameter

* fix(csharp): add ref param test and document compound visibility limitation

- Add test for ref parameter modifier (was only testing out)
- Document that protected internal / private protected resolve to first modifier

* feat(csharp): support compound visibilities (protected internal, private protected)

- Add 'protected internal' and 'private protected' to FieldVisibility union
- Detect compound modifiers in both C# method and field extractors via
  collectModifierTexts helper scanning adjacent modifier nodes
- Add 2 tests for compound visibility detection

* feat(csharp): primary constructors, virtual/override/async, primary fields

Address all known limitations from review:

- Primary constructor support (C# 12): add extractPrimaryConstructor to
  MethodExtractionConfig and extractPrimaryFields to FieldExtractionConfig.
  Record params become public readonly properties; class params become
  private captured fields.
- Add isVirtual, isOverride, isAsync optional fields to MethodInfo,
  MethodExtractionConfig, NodeProperties, and parse-worker propagation.
- Detect virtual/override/async modifiers in C# method config.
- Move collectModifierTexts to shared helpers.ts (deduplicate).
- Fix destructor name to ~ClassName (disambiguates from constructor).
- Add expression-bodied method test.
- 118 tests total across method + field extraction suites, all passing.

* fix(csharp): review round 2 — annotations, record_struct, grammar pin

- Fix primary constructor annotations: use [] instead of extracting
  class-level attributes (C# has no syntax for ctor-specific attributes)
- Add record_struct_declaration to typeDeclarationNodes in both method
  and field extractors, CLASS_CONTAINER_TYPES, and isRecord visibility check
- Pin tree-sitter-c-sharp version (^0.23.1) in params comment

* fix(csharp): complete record_struct query + label mapping, sealed override test

- Add record_struct_declaration capture patterns to tree-sitter-queries.ts
  (type definition + primary constructor)
- Add record_struct_declaration → 'Struct' in CONTAINER_TYPE_TO_LABEL
- Assert isOverride: true alongside isFinal in sealed override test

* fix(csharp): record_struct label mismatch, add record struct + documented limitation tests

- Fix record_struct_declaration query tag: @definition.struct (not @definition.record)
  to match CONTAINER_TYPE_TO_LABEL and prevent broken HAS_METHOD edges
- Add 3 record struct tests: isTypeDeclaration, method extraction, primary constructor
- Add documented limitation tests: partial method (isAbstract: false), generic type
  parameter stripping (name excludes <T>)

* fix(csharp): remove record_struct_declaration — not a real tree-sitter node type

tree-sitter-c-sharp 0.23.1 parses 'record struct' as record_declaration
(absorbs the 'struct' keyword as an unnamed child token). The non-existent
record_struct_declaration in queries caused TSQueryErrorNodeType, breaking
ALL C# file processing.

Remove from: tree-sitter-queries.ts, typeDeclarationNodes in both
extractors, CLASS_CONTAINER_TYPES, and CONTAINER_TYPE_TO_LABEL.
Record struct types are already handled via record_declaration.

* feat(csharp): add isPartial support, filter targeted attributes, static ctor test

- Add isPartial optional field to MethodInfo, MethodExtractionConfig,
  NodeProperties, and parse-worker propagation pipeline
- Detect partial modifier in C# config — marks both declaration-only
  and implemented partial methods
- Filter targeted attribute lists (e.g. [return: MarshalAs(...)]) in
  extractCSharpAnnotations — only untargeted attributes collected
- Add static constructor test (isStatic: true, same name as class)
- Add 3 partial method tests: declaration-only, with body, coexisting pair
- Document record_struct/record_class as defensive dead code in
  export-detection.ts (grammar absorbs keywords into record_declaration)

* fix(csharp): this param for extension methods, dedup visibility, test fixes

- Handle this modifier on extension method parameters (type prefixed
  as 'this string', consistent with out/ref/in handling)
- Deduplicate visibility logic in extractPrimaryConstructor — reuse
  csharpMethodConfig.extractVisibility instead of inline compound check
- Fix record struct test title to reflect actual grammar behavior
- Add conversion operator returnType assertion
- Add extension method this parameter test

* fix(csharp): primary constructor line points to param list, empty name guard

- Use paramList.startPosition instead of ownerNode.startPosition for
  primary constructor line number (avoids methodInfoCache key collision)
- Guard against empty param names from tree-sitter error recovery nodes
2026-03-30 08:41:17 +01:00
..
call-routing feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
import-resolution feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
named-bindings refactor: SICP-informed LanguageProvider architecture (#488) 2026-03-24 13:42:39 +00:00
ai-context.test.ts feat: added skip-agents-md cli flag (#517) 2026-03-28 21:23:59 +00:00
analyze-api.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
analyze-job.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
ast-cache.test.ts fix: guard createASTCache against zero maxSize to prevent LRU cache crash 2026-03-02 08:47:20 +00:00
bm25-search.test.ts refactor: migrate from KuzuDB to LadybugDB v0.15 (#275) 2026-03-15 15:53:01 +00:00
call-form.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
call-processor.test.ts feat(java): method references, worker overload disambiguation, interface dispatch (#540) 2026-03-28 16:59:28 +00:00
calltool-dispatch.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
cli-commands.test.ts feat: configure eslint with unused import removal (#564) 2026-03-28 15:28:09 +00:00
cli-index-help.test.ts fix: address PR review — remove redundancies and add wiki help test 2026-03-25 11:39:37 +05:30
cobol-copy-expander.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
cobol-preprocessor.test.ts feat: configure eslint with unused import removal (#564) 2026-03-28 15:28:09 +00:00
cohesion-consistency.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
community-processor.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
compatible-stdio-transport.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
cors.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
csv-escaping.test.ts refactor: migrate from KuzuDB to LadybugDB v0.15 (#275) 2026-03-15 15:53:01 +00:00
dart-import-resolver.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
dart-type-extractor.test.ts feat: configure eslint with unused import removal (#564) 2026-03-28 15:28:09 +00:00
embedder.test.ts test: add test suite with vitest (unit + integration + fixtures) 2026-03-01 20:07:02 +05:30
entry-point-scoring.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
eval-formatters.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
expo-routes.test.ts feat: add Expo Router file-based route detection (#503) 2026-03-25 11:05:55 +00:00
extract-element-type-from-string.test.ts feat: Phase 6 type resolution — for-loop Tier 1c, pattern matching, container descriptors, 10-language coverage (#318) 2026-03-17 17:10:22 +00:00
extract-generic-type-args.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
fetch-reason-parsing.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
field-extraction.test.ts feat(csharp): C# MethodExtractor config (#582) 2026-03-30 08:41:17 +01:00
framework-detection.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
git-clone.test.ts feat: unify web and cli ingestion pipeline (#536) 2026-03-28 14:07:11 +00:00
git-utils.test.ts feat: configure eslint with unused import removal (#564) 2026-03-28 15:28:09 +00:00
git.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
graph.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
has-method.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
heritage-processor.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
hooks.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
http-embedder.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
hybrid-search.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
ignore-service.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
impact-batching-grouping.test.ts feat: configure eslint with unused import removal (#564) 2026-03-28 15:28:09 +00:00
impact-confidence.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
import-processor.test.ts refactor: SICP-informed LanguageProvider architecture (#488) 2026-03-24 13:42:39 +00:00
index-repo-command.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
ingestion-utils.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
isWriteQuery.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
jcl-parser.test.ts feat: configure eslint with unused import removal (#564) 2026-03-28 15:28:09 +00:00
language-skip.test.ts feat(ingestion): respect .gitignore and .gitnexusignore during file discovery (#231) 2026-03-16 13:26:20 +00:00
lazy-action.test.ts Improve MCP startup compatibility and lazy-load CLI commands (#207) 2026-03-07 07:47:09 +00:00
method-extraction.test.ts feat(csharp): C# MethodExtractor config (#582) 2026-03-30 08:41:17 +01:00
method-signature.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
mro-processor.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
noise-filter.test.ts refactor: split global BUILT_IN_NAMES into per-language provider fields (#523) 2026-03-26 12:15:29 +00:00
parser-loader.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
pipeline-exports.test.ts test: add test suite with vitest (unit + integration + fixtures) 2026-03-01 20:07:02 +05:30
process-processor.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
repo-manager.test.ts feat: configure eslint with unused import removal (#564) 2026-03-28 15:28:09 +00:00
resources.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
route-tool-detection.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
run-analyze.test.ts feat: unify web and cli ingestion pipeline (#536) 2026-03-28 14:07:11 +00:00
schema.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
security.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
sequential-language-availability.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
server.test.ts feat: configure eslint with unused import removal (#564) 2026-03-28 15:28:09 +00:00
setup-codex.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
setup.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
shape-check.test.ts fix: shape_check false positives — quoted keys, DOM leaks, errorKeys (#501) 2026-03-26 05:43:37 +00:00
shared-type-extractors.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
skill-gen.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
skip-git-cli.test.ts feat: added skip-agents-md cli flag (#517) 2026-03-28 21:23:59 +00:00
staleness.test.ts feat: configure eslint with unused import removal (#564) 2026-03-28 15:28:09 +00:00
structure-processor.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
suffix-index-ambiguity.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
symbol-resolver.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
symbol-table.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
tools.test.ts feat: configure eslint with unused import removal (#564) 2026-03-28 15:28:09 +00:00
topological-sort.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
tree-sitter-queries.test.ts refactor: SICP-informed LanguageProvider architecture (#488) 2026-03-24 13:42:39 +00:00
type-env.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
utils.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
wiki-flags.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
wiki-llm-client.test.ts feat(wiki): Azure OpenAI support for wiki command (#562) 2026-03-29 00:23:41 +05:30