GitNexus/gitnexus/test/unit/group
Christian C. Berclaz 7cce07b419
feat(group): workspace extractors for Node, Python, Go, Java, Elixir (#1260)
* feat(group): auto-discover Node/TS workspace cross-package contracts

Scan package.json dependencies and ES/CJS imports to find PascalCase
type exports crossing workspace package boundaries. Same pipeline as
Rust workspace extractor — emits GroupManifestLink[] with type:custom.

Supports: ES named imports, default imports, CommonJS destructured
require, scoped packages (@org/pkg), subpath imports, aliased imports.
Filters to PascalCase names only (types/classes, not functions).

* feat(group): auto-discover Python workspace cross-package contracts

Scan pyproject.toml/setup.py dependencies and `from <pkg> import`
statements to find PascalCase type exports crossing workspace package
boundaries. Handles hyphenated names (PEP 503 normalization),
submodule imports, aliased imports, and optional-dependencies.

* feat(group): auto-discover Go workspace cross-module contracts

Scan go.mod require/replace directives and Go source files for
exported PascalCase type usage (pkg.TypeName) crossing module
boundaries within a group. Handles block syntax, subpackage
imports, and local replace directives.

* refactor(group): extract workspace discovery orchestrator from sync

Move per-ecosystem workspace extractor calls into a single
discoverWorkspaceLinks() orchestrator. Reduces sync.ts from 295
to 264 lines and gives a clean extension point for adding
more ecosystem extractors.

* feat(group): auto-discover Java/Kotlin workspace cross-project contracts

Scan Maven pom.xml and Gradle build files for inter-project deps,
then match Java/Kotlin import statements against known group-internal
base packages. Supports Maven dependency blocks, Gradle coordinate
and project() dependencies, static imports, and Kotlin files.

* feat(group): auto-discover Elixir workspace cross-app contracts

Scan mix.exs deps and Elixir source files for alias directives and
direct module references crossing OTP app boundaries. Handles
umbrella deps (in_umbrella), git/path deps, grouped aliases
(alias MyApp.{ModA, ModB}), underscore-to-PascalCase app name
mapping, and collapses nested submodules to top-level contracts.

* fix(group): apply PR review fixes to all workspace extractors

Address review findings from PR #1256 across Node, Python, Go, Java,
and Elixir extractors:
- Replace hardcoded IGNORE sets with shared IgnoreService
  (shouldIgnorePath + loadIgnoreRules) to honor .gitnexusignore
- Qualify contract names with provider identifier to prevent
  contractId collisions across providers
- Warn and skip duplicate project/module/app names
- Update all test assertions for qualified contract format

* fix(workspace): address review findings and fix CI

- Fix prettier formatting on Rust workspace extractor files
- Fix double readRegistry() call in syncGroup (hoist to function scope)
- Fix console.warn spy leak in duplicate crate test (try/finally)
- Add sync-level integration tests: workspace_deps true/false gating,
  Rust and Node link discovery through syncGroup orchestrator (3 tests)

* style(workspace): fix Prettier formatting on all workspace extractors

* fix(workspace): strip qualified prefix in custom contract resolution, default workspace_deps to false

resolveSymbol for custom contracts now strips the "provider::" prefix
before querying graph nodes, so workspace-generated contracts like
"mathlex::Expression" correctly resolve to the "Expression" symbol.

Change workspace_deps default from true to false for safe rollout —
existing groups won't silently gain 6-ecosystem scans on upgrade.

* fix(workspace): address medium review findings from PR #1260

- Elixir: strip comment lines before direct module reference scan to
  prevent false positives from commented-out module references
- Go: use full module path for contract naming to avoid basename
  collisions between repos with identical last path segments
- Sync tests: replace toBeGreaterThanOrEqual with exact toHaveLength
  assertions per DoD §2.7
- Add workspace_deps: false to makeConfig helper for type correctness
- Add Elixir test proving comment-only references do not emit links

* fix(workspace): address second-round medium review findings

- Go: add test asserting aliased imports produce 0 links, guarding the
  V1 false-negative boundary at the assertion level
- Elixir: add code comment documenting that contracts use full module
  names without appName:: prefix and that resolveSymbol resolution
  depends on Elixir indexer storing fully-qualified names

* fix(workspace): eliminate regex backtracking in pyproject.toml parser

CodeQL flagged exponential backtracking in the [project] name regex.
Replace [^\[]*?\n (ambiguous lazy quantifier) with [^\n\[]*\n (atomic
per-line match that still stops at section boundaries).

* fix(test): use mkdtempSync for secure temp dir creation

CodeQL flagged insecure temporary file creation (High) in sync.test.ts.
Replace path.join(os.tmpdir(), predictable-name) + mkdirSync with
fs.mkdtempSync which creates temp dirs atomically with random suffix,
preventing symlink race conditions.
2026-05-04 09:43:21 +01:00
..
bridge-db-edge.test.ts fix(deps): upgrade @ladybugdb/core to 0.16.0 to resolve native segfaults (#1235) 2026-04-30 17:40:39 +01:00
bridge-db.test.ts fix(deps): upgrade @ladybugdb/core to 0.16.0 to resolve native segfaults (#1235) 2026-04-30 17:40:39 +01:00
config-parser.test.ts fix(group): add configurable cross-link path exclusions to reduce false positives (#1093) 2026-04-28 08:22:14 +01:00
cross-impact.test.ts fix(group): bubble local-impact phase errors in groupImpact (#1004) (#1007) 2026-04-21 11:44:16 +01:00
elixir-workspace-extractor.test.ts feat(group): workspace extractors for Node, Python, Go, Java, Elixir (#1260) 2026-05-04 09:43:21 +01:00
fixtures.ts feat(group): bridge.lbug storage + contract matching expansion (1/4 of #606 split) (#795) 2026-04-11 19:46:12 +01:00
go-workspace-extractor.test.ts feat(group): workspace extractors for Node, Python, Go, Java, Elixir (#1260) 2026-05-04 09:43:21 +01:00
group-path-utils.test.ts feat: cross-repo impact analysis (#794) — @repo MCP routing + group resources (#984) 2026-04-20 11:55:07 +01:00
group-service-group-mode.test.ts feat: cross-repo impact analysis (#794) — @repo MCP routing + group resources (#984) 2026-04-20 11:55:07 +01:00
group-tools.test.ts feat: cross-repo impact analysis (#794) — @repo MCP routing + group resources (#984) 2026-04-20 11:55:07 +01:00
grpc-extractor.test.ts fix(group): contract extractors honour .gitnexusignore via shared IgnoreService (#1185) (#1247) 2026-05-01 16:42:21 +01:00
http-route-extractor.test.ts fix(group): contract extractors honour .gitnexusignore via shared IgnoreService (#1185) (#1247) 2026-05-01 16:42:21 +01:00
http-route-multi-verb.test.ts fix(extractors): resolve 3 silent contract mis-resolution bugs (#793) (#817) 2026-04-14 08:03:02 +01:00
impact-by-uid.test.ts feat(group): add sync pipeline, CLI, MCP tools, and monorepo fixture 2026-04-02 00:40:31 +03:00
java-workspace-extractor.test.ts feat(group): workspace extractors for Node, Python, Go, Java, Elixir (#1260) 2026-05-04 09:43:21 +01:00
manifest-extractor.test.ts feat(group): workspace extractors for Node, Python, Go, Java, Elixir (#1260) 2026-05-04 09:43:21 +01:00
matching.test.ts fix(group): add configurable cross-link path exclusions to reduce false positives (#1093) 2026-04-28 08:22:14 +01:00
node-workspace-extractor.test.ts feat(group): workspace extractors for Node, Python, Go, Java, Elixir (#1260) 2026-05-04 09:43:21 +01:00
python-workspace-extractor.test.ts feat(group): workspace extractors for Node, Python, Go, Java, Elixir (#1260) 2026-05-04 09:43:21 +01:00
rust-workspace-extractor.test.ts feat(group): auto-discover Rust workspace cross-crate contracts (#1256) 2026-05-03 01:43:22 +01:00
service-boundary-detector.test.ts fix(group): address 4 HIGH-priority issues from PR #626 review 2026-04-02 12:55:33 +03:00
service.test.ts feat: cross-repo impact analysis (#794) — @repo MCP routing + group resources (#984) 2026-04-20 11:55:07 +01:00
storage.test.ts fix(group): address 4 HIGH-priority issues from PR #626 review 2026-04-02 12:55:33 +03:00
sync.test.ts feat(group): workspace extractors for Node, Python, Go, Java, Elixir (#1260) 2026-05-04 09:43:21 +01:00
topic-extractor.test.ts fix(group): contract extractors honour .gitnexusignore via shared IgnoreService (#1185) (#1247) 2026-05-01 16:42:21 +01:00
types.test.ts feat(group): add group infrastructure and contract matching 2026-04-02 00:39:43 +03:00