Skip to content

Conversation

@ryoppippi
Copy link
Member

@ryoppippi ryoppippi commented Nov 10, 2025

enrich tf-idf test

Copilot AI review requested due to automatic review settings November 10, 2025 09:46
@ryoppippi ryoppippi requested a review from a team as a code owner November 10, 2025 09:46
@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 10, 2025

Open in StackBlitz

npm i https://pkg.pr.new/StackOneHQ/stackone-ai-node/@stackone/ai@135

commit: 2cbe5ec

Expand TF-IDF test coverage from 3 to 16 tests, organized into
logical test suites:

1. Core Functionality (3 tests - existing):
   - TF-IDF ranking with cosine similarity
   - Stopword and punctuation removal
   - No matches for non-overlapping queries

2. Score Validation (2 tests - new):
   - Scores within [0, 1] range
   - Results sorted by score descending

3. Edge Cases (4 tests - new):
   - Empty query handling
   - Empty corpus handling
   - Single document corpus
   - Query with only stopwords

4. Case Sensitivity (1 test - new):
   - Case-insensitive search across different cases

5. Tool Name Scenarios (3 tests - new):
   - Tool names with underscores
   - Multiple query terms
   - Action type ranking (create, list, etc)

6. Search Limits (2 tests - new):
   - Respects k parameter
   - Handles k > corpus size

7. IDF Calculation (1 test - new):
   - Rare terms get higher IDF scores

These tests ensure the TF-IDF implementation is robust and handles
real-world scenarios, especially tool discovery use cases.

Matches test coverage added to Python SDK for feature parity.
@ryoppippi ryoppippi force-pushed the feat/improve-tfidf-tests branch from ec954d5 to 2cbe5ec Compare November 10, 2025 09:46
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR significantly expands the test coverage for the TF-IDF index implementation by reorganizing existing tests into logical groups and adding comprehensive test cases for edge cases, score validation, case sensitivity, tool name scenarios, search limits, and IDF calculation behavior.

  • Reorganized tests into structured describe blocks for better organization
  • Added extensive test coverage for edge cases (empty queries/corpus, single document, stopword-only queries)
  • Added tests for score validation, sorting, and range checking
  • Added tests for case-insensitive search behavior
  • Added practical tool name scenarios testing (relevant for the SDK's use case)
  • Refactored CLAUDE.md to reference skill-based documentation
  • Removed Orama docs MCP server configuration
  • Added comprehensive skill documentation for testing, TypeScript patterns, file operations, and architecture

Reviewed Changes

Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/utils/tfidf-index.spec.ts Expanded test suite with 11 new test cases organized into 7 describe blocks covering edge cases, score validation, case sensitivity, tool name scenarios, search limits, and IDF calculation
CLAUDE.md Refactored to delegate to skill-based documentation files for better organization and maintainability
.mcp.json Removed Orama docs MCP server configuration
.claude/skills/typescript-testing/SKILL.md Added comprehensive testing skill documentation covering Bun test runner, MSW patterns, and file system testing
.claude/skills/typescript-patterns/SKILL.md Added TypeScript best practices skill covering exhaustiveness checking, avoiding any, and other patterns
.claude/skills/orama-integration/SKILL.md Added Orama integration reference skill pointing to official documentation
.claude/skills/openapi-architecture/SKILL.md Added architecture skill documenting core components and design patterns
.claude/skills/file-operations/SKILL.md Added file operations skill documenting utility functions and HTTP standards
.claude/skills/development-workflow/SKILL.md Added development workflow skill covering build commands, testing, and code quality

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

@willleeney willleeney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ryoppippi ryoppippi merged commit 20b362c into main Nov 10, 2025
9 checks passed
@ryoppippi ryoppippi deleted the feat/improve-tfidf-tests branch November 10, 2025 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants