activeloopai / activeloopai/hivemind

test: move shared-module tests out of tests/claude-code/ into tests/shared/

Đang mở
#186 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
TypeScript
Star
1.6k
Fork
107
Merge trung bình
17 giờ 30 phút
Pull request đã merge (30 ngày)
6

Mô tả

## Context

`tests/claude-code/` is currently the de-facto catch-all for tests of non-agent-specific `src/` modules. The directory name is historical and misleading: a contributor looking for, say, `deeplake-api` coverage shouldn't have to guess that "claude-code" means "default bucket for everything shared."

PR #183 introduced `tests/shared/` as the correct destination for new shared-module tests and moved `standalone-embed-client.test.ts` there as a first step. This issue tracks moving the rest.

## Why now

- The naming actively misleads new contributors.
- Code-coverage reports group test files by directory; everything currently looks "claude-code coverage" when half of it is shared infra.
- Per-agent test dirs (`tests/codex/`, `tests/cursor/`, `tests/hermes/`, `tests/openclaw/`, `tests/pi/`) already work the way the convention implies.

## Out of scope for PR #183

This is a large mechanical rename touching ~30 files plus CI/IDE/coverage config. It deserves its own PR, not a drive-by inside an embeddings PR.

## Files to move (snapshot at `feat/openclaw-embed-producer-178`)

Tests of `src/` modules that have no claude-code specificity:

**auth / api / config:**
- `auth-creds.test.ts`
- `auth-login-dispatch.test.ts`
- `auth.test.ts`
- `config.test.ts`
- `debug.test.ts`
- `deeplake-api-balance-exhausted.test.ts`
- `deeplake-api-retry.test.ts`
- `deeplake-api.test.ts`

**embeddings (all of `src/embeddings/*`):**
- `embedding-sql.test.ts`
- `embeddings-bundle-scan.test.ts`
- `embeddings-client.test.ts`
- `embeddings-daemon.test.ts`
- `embeddings-disable.test.ts`
- `embeddings-nomic.test.ts`
- `embeddings-schema.test.ts`
- `embeddings-self-heal.test.ts`

**grep / search:**
- `grep-core.test.ts`
- `grep-direct.test.ts`
- `grep-interceptor.test.ts`

**mine-local / skillify:**
- `mine-local-helpers.test.ts`
- `mine-local-orchestrator.test.ts`
- `local-manifest.test.ts`
- `local-source.test.ts`

**notifications:**
- `notifications-coverage.test.ts`
- `notifications-org-stats-source.test.ts`
- `notifications-primary-banner.test.ts`
- `notifications-queue-lock.test.ts`
- `notifications-transcript-parser.test.ts`
- `notifications-usage-tracker.test.ts`
- `notifications.test.ts`

**other shared:**
- `bash-command-compiler.test.ts`
- `deeplake-fs.test.ts`
- `index-marker-store.test.ts`
- `mcp-server.test.ts`
- `output-cap.test.ts`
- `plugin-cache.test.ts`
- `plugin-cache-gc.test.ts`
- `plugin-version-resolution.test.ts`
- `query-cache.test.ts`
- `user-config.test.ts`

Roughly 30+ files.

## Files to KEEP in `tests/claude-code/`

Tests of claude-code-specific hooks / bundles:
- `capture.test.ts`, `capture-hook.test.ts` (claude-code SessionStart capture)
- `pre-tool-use*.test.ts` (claude-code PreToolUse hook)
- `session-start*.test.ts`, `session-end*.test.ts`
- `*-bundle*.test.ts` (claude-code/bundle artifacts)
- `autoupdate.test.ts` (claude-code-specific autoupdate path)
- `periodic-summary-bundles.test.ts` (claude-code wiki-worker bundle)
- `plugin-cache-bundles.test.ts`, `plugin-cache-gc-bundle.integration.test.ts`
- `wiki-worker-*.test.ts`
- `skillify-*.test.ts` (claude-code-specific skillify wiring)

The exact partition needs a careful pass — some files at the boundary (e.g. `index-marker-store.test.ts`) may need `git log` inspection to decide.

## Suggested approach

1. One PR, no behavior change.
2. Use `git mv` so blame survives.
3. Update `vitest.config.ts` include glob (remove `tests/claude-code/**` or keep both? — decide after the move shows what's actually left in `tests/claude-code/`).
4. Update any path refs in docs / source comments (e.g. PR #183 had one in `pi/extension-source/hivemind.ts`).
5. Verify `npm test` count matches before/after exactly.
6. Update `vitest.config.ts` per-file coverage thresholds — paths in the `thresholds:` block are `src/...` so they don't move, but double-check nothing references test paths.

## Related

- PR #183 introduced `tests/shared/` and moved `standalone-embed-client.test.ts` (one file). This issue tracks the rest.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.