-
Notifications
You must be signed in to change notification settings - Fork 4
feat: Add coverage reporting for unit and E2E tests with merging coverage #171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
📝 WalkthroughWalkthroughAdds centralized coverage tooling and CI reporting (nyc, Jest presets, merge script, GitHub Actions job), wires a CLI coverage flag, updates many Jest configs and Nx targets to emit per-package/e2e coverage, adds extensive unit/e2e tests, introduces a transport-recreation e2e app, and removes the entire MCP Apps module and its exports. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
rect rgb(240,248,255)
participant CI as GitHub Actions
participant Unit as Unit Tests (nx / Jest)
participant E2E as E2E Tests (Jest)
participant Art as Artifact Storage
end
rect rgb(245,255,240)
participant Merge as scripts/merge-coverage.mjs
participant NYC as nyc CLI
participant Codecov as Codecov
end
CI->>Unit: run test:unit:coverage (produces coverage/unit/*/coverage-final.json)
Unit-->>Art: upload unit coverage artifact
CI->>E2E: run test:e2e:coverage (produces coverage/e2e/*/coverage-final.json)
E2E-->>Art: upload e2e coverage artifact
CI->>Art: download coverage artifacts
CI->>Merge: run scripts/merge-coverage.mjs (collect into .nyc_output)
Merge->>NYC: nyc merge -> coverage/merged/coverage-final.json
Merge->>NYC: nyc report -> generate lcov/html/json in coverage/merged
Merge-->>CI: merged reports ready
CI->>Codecov: upload merged coverage JSON
Codecov-->>CI: processing complete
Estimated code review effort🎯 4 (Complex) | ⏱️ ~75 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (5)
🚧 Files skipped from review as they are similar to previous changes (4)
🧰 Additional context used📓 Path-based instructions (1)**/*.ts📄 CodeRabbit inference engine (CLAUDE.md)
Files:
🧠 Learnings (1)📓 Common learnings🧬 Code graph analysis (1)apps/e2e/demo-e2e-transport-recreation/src/apps/transport-test/tools/increment-counter.tool.ts (2)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
🔇 Additional comments (1)
Comment |
|
| Status | Scanner | Total (0) | ||||
|---|---|---|---|---|---|---|
| Open Source Security | 0 | 0 | 0 | 0 | See details |
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 7
♻️ Duplicate comments (4)
apps/e2e/demo-e2e-transparent/jest.e2e.config.ts (1)
36-45: Duplicate coverage configuration pattern.This file has the same coverage configuration and DRY concerns already flagged in
apps/e2e/demo-e2e-ui/jest.e2e.config.ts. Refer to that review comment for the recommended shared preset approach.apps/e2e/demo-e2e-errors/jest.e2e.config.ts (1)
36-45: Duplicate coverage configuration pattern.This file has the same coverage configuration and DRY concerns already flagged in
apps/e2e/demo-e2e-ui/jest.e2e.config.ts. Refer to that review comment for the recommended shared preset approach.apps/e2e/demo-e2e-notifications/jest.e2e.config.ts (1)
36-45: Duplicate coverage configuration pattern.This file has the same coverage configuration and DRY concerns already flagged in
apps/e2e/demo-e2e-ui/jest.e2e.config.ts. Refer to that review comment for the recommended shared preset approach.apps/e2e/demo-e2e-public/jest.e2e.config.ts (1)
36-45: Duplicate coverage configuration pattern.This file has the same coverage configuration and DRY concerns already flagged in
apps/e2e/demo-e2e-ui/jest.e2e.config.ts. Refer to that review comment for the recommended shared preset approach.
🧹 Nitpick comments (11)
libs/plugins/src/codecall/__tests__/audit-logger.service.test.ts (1)
107-324: Replaceanytype with proper typing.Throughout the log method tests, event data is cast to
any(lines 121, 149, 167, 191, 215, 227, 240, 249, 261, 274, 287, 299, 312, 321, 341, 350). This violates the strict TypeScript guideline requiring noanytypes without strong justification.As per coding guidelines: Use strict TypeScript mode with no
anytypes without strong justification - useunknowninstead for generic type defaults.🔎 Proposed refactor to use proper typing
Since
AuditEvent.datais typed asRecord<string, unknown>, replace all instances of:-const data = receivedEvents[0].data as any; +const data = receivedEvents[0].data as Record<string, unknown>;Alternatively, define specific event data interfaces for each event type to achieve full type safety:
interface ExecutionStartData { scriptHash: string; scriptLength: number; } interface ExecutionSuccessData { scriptHash: string; scriptLength: number; toolCallCount: number; } // ... etc for other event typesThen use:
const data = receivedEvents[0].data as ExecutionStartData; expect(data.scriptHash).toMatch(/^sh_[0-9a-f]{8}$/); expect(data.scriptLength).toBe(12);This provides compile-time type checking and better IDE support.
apps/e2e/demo-e2e-ui/jest.e2e.config.ts (1)
36-45: Consider including index.ts files in coverage and extracting shared patterns.Two observations:
Index file exclusion: Line 44 excludes
**/index.tsfrom coverage. While index files typically contain re-exports, they can include important logic like conditional exports, runtime checks, or initialization code. Consider whether this exclusion is intentional.Pattern duplication: The
collectCoverageFromconfiguration is identical across all E2E test configs (demo-e2e-ui, demo-e2e-transparent, demo-e2e-errors, demo-e2e-notifications, demo-e2e-public, etc.). This violates DRY principles and makes maintenance harder.💡 Recommended approach: Extract to shared E2E preset
Create a shared E2E coverage configuration file (e.g.,
jest.e2e.coverage.preset.js):module.exports = { coverageReporters: ['json'], collectCoverageFrom: [ '<rootDir>/../../../libs/sdk/src/**/*.ts', '<rootDir>/../../../libs/adapters/src/**/*.ts', '<rootDir>/../../../libs/plugins/src/**/*.ts', '!**/*.test.ts', '!**/*.spec.ts', // Reconsider this exclusion: // '!**/index.ts', ], };Then reference it in each E2E config:
import e2eCoveragePreset from '../../../jest.e2e.coverage.preset'; const config: Config.InitialOptions = { // ... other config coverageDirectory: '../../../coverage/e2e/demo-e2e-ui', ...e2eCoveragePreset, };scripts/merge-coverage.mjs (1)
101-124: Consider preserving stderr in error messages.The merge operation uses
stdio: 'pipe'which suppresses output. If the merge fails, the error message at line 122 might not include helpful stderr details fromnyc. Consider capturing stderr or usingstdio: 'inherit'for better debugging when issues occur.🔎 Optional improvement
try { // Merge coverage using nyc - execSync(`npx nyc merge "${NYC_OUTPUT}" "${join(MERGED_DIR, 'coverage-final.json')}"`, { + execSync(`npx nyc merge "${NYC_OUTPUT}" "${join(MERGED_DIR, 'coverage-final.json')}"`, { cwd: ROOT, - stdio: 'pipe', + stdio: ['pipe', 'pipe', 'inherit'], // inherit stderr for error visibility }); // Generate reports from merged coverage execSync( `npx nyc report --temp-dir="${MERGED_DIR}" --report-dir="${MERGED_DIR}" --reporter=lcov --reporter=html --reporter=text-summary`, { cwd: ROOT, stdio: 'inherit', } ); console.log('\nCoverage reports generated successfully:'); console.log(` HTML: ${MERGED_DIR}/index.html`); console.log(` LCOV: ${MERGED_DIR}/lcov.info`); console.log(` JSON: ${MERGED_DIR}/coverage-final.json`); } catch (error) { - console.error('\nError merging coverage:', error.message); + console.error('\nError merging coverage:', error.message); + if (error.stderr) console.error('stderr:', error.stderr.toString()); process.exit(1); }package.json (1)
13-20: Coverage scripts look good, but threshold alignment needed.The test and coverage scripts are well-structured. However, the
coverage:checkscript (line 20) relies on.nycrc.jsonthresholds, which are currently set to 80%. This is inconsistent with the 95%+ requirement from learnings and the 95% threshold enforced in the CI workflow.Consider explicitly specifying thresholds in the
coverage:checkscript to ensure consistency:- "coverage:check": "npx nyc check-coverage --temp-dir=coverage/merged" + "coverage:check": "npx nyc check-coverage --temp-dir=coverage/merged --statements 95 --branches 95 --functions 95 --lines 95"Based on learnings, 95%+ test coverage is required.
jest.coverage.preset.js (1)
15-15: Consider adding.types.tsexclusion for consistency.The
collectCoverageFrompattern excludes.d.tsfiles but not.types.tsfiles. The adapters package'sjest.config.tsexplicitly excludes!src/**/*.types.ts. For consistency across the codebase, consider adding this exclusion to the shared preset.🔎 Suggested fix
- collectCoverageFrom: ['src/**/*.ts', '!src/**/*.test.ts', '!src/**/*.spec.ts', '!src/**/index.ts', '!src/**/*.d.ts'], + collectCoverageFrom: ['src/**/*.ts', '!src/**/*.test.ts', '!src/**/*.spec.ts', '!src/**/index.ts', '!src/**/*.d.ts', '!src/**/*.types.ts'],libs/mcp-from-openapi/src/__tests__/generator.spec.ts (2)
308-316: Useexpect().rejectspattern instead of deprecatedfail().The
fail()function is deprecated in Jest. Consider using the more idiomatic pattern.🔎 Suggested refactor
- it('should throw LoadError with context on file not found', async () => { - try { - await OpenAPIToolGenerator.fromFile('/nonexistent/path/api.yaml'); - fail('Should have thrown'); - } catch (e) { - expect(e).toBeInstanceOf(LoadError); - expect((e as LoadError).message).toContain('Failed to load OpenAPI spec from file'); - } - }); + it('should throw LoadError with context on file not found', async () => { + await expect(OpenAPIToolGenerator.fromFile('/nonexistent/path/api.yaml')) + .rejects + .toThrow(LoadError); + + await expect(OpenAPIToolGenerator.fromFile('/nonexistent/path/api.yaml')) + .rejects + .toThrow('Failed to load OpenAPI spec from file'); + });
169-183: Addinstanceofcheck to validate error class.Per coding guidelines, error handling tests should include
instanceofchecks to validate the specific error class being thrown.🔎 Suggested addition
it('should throw LoadError on HTTP error', async () => { mockFetch.mockResolvedValue({ ok: false, status: 404, statusText: 'Not Found', }); - await expect(OpenAPIToolGenerator.fromURL('https://example.com/api.json')).rejects.toThrow(LoadError); + const error = await OpenAPIToolGenerator.fromURL('https://example.com/api.json').catch(e => e); + expect(error).toBeInstanceOf(LoadError); + expect(error.message).toContain('404'); });Based on coding guidelines, tests should include error class
instanceofchecks.libs/plugins/src/cache/__tests__/cache-redis.provider.test.ts (2)
77-83: Consider verifying the error message content.The test validates that an error is thrown but could be more specific about the error message.
🔎 Suggested enhancement
it('should throw for invalid type', () => { expect(() => { new CacheRedisProvider({ type: 'invalid' as any, } as RedisCacheOptions); - }).toThrow('Invalid cache provider type'); + }).toThrow(/Invalid cache provider type/); + + // Optionally verify the full error message includes the invalid type + expect(() => { + new CacheRedisProvider({ type: 'invalid' as any } as RedisCacheOptions); + }).toThrow(expect.stringContaining('invalid')); });
1-229: Consider adding Redis command failure tests.The test suite covers happy paths well, but could benefit from testing failure scenarios like Redis command rejections to ensure proper error propagation.
// Example additional test for error handling it('should propagate errors from Redis set command', async () => { mockClient.set.mockRejectedValue(new Error('Redis connection lost')); await expect(provider.setValue('key', 'value')).rejects.toThrow('Redis connection lost'); });libs/plugins/src/codecall/__tests__/self-reference-guard.test.ts (2)
67-107: Consider modernizing error property testing pattern.The tests correctly validate SelfReferenceError is thrown for blocked tools and include proper instanceof checks per coding guidelines.
Lines 85-93 use a try-catch with
fail()to test error properties. While functional, thefail()call is redundant since the subsequent expect statements would fail if the error isn't thrown. Consider a more modern pattern:🔎 Suggested refactor for cleaner error property testing
- it('should include tool name in error', () => { - try { - assertNotSelfReference('codecall:execute'); - fail('Expected SelfReferenceError to be thrown'); - } catch (error) { - expect(error).toBeInstanceOf(SelfReferenceError); - expect((error as SelfReferenceError).toolName).toBe('codecall:execute'); - } - }); + it('should include tool name in error', () => { + let error: SelfReferenceError | undefined; + try { + assertNotSelfReference('codecall:execute'); + } catch (e) { + error = e as SelfReferenceError; + } + expect(error).toBeInstanceOf(SelfReferenceError); + expect(error?.toolName).toBe('codecall:execute'); + });
128-131: Misleading test name: "readonly" is not actually tested.The test name "should return readonly explicit array" suggests immutability testing, but line 130 only verifies
Array.isArray(). TypeScript'sreadonlykeyword is a compile-time type constraint and doesn't provide runtime immutability.To accurately test the current behavior, either rename the test or add actual immutability verification.
🔎 Option 1: Rename test to match what it actually checks
- it('should return readonly explicit array', () => { + it('should return explicit tools as an array', () => { const patterns = getBlockedPatterns(); expect(Array.isArray(patterns.explicit)).toBe(true); });🔎 Option 2: Test actual immutability if that's the intent
- it('should return readonly explicit array', () => { + it('should return immutable explicit array', () => { const patterns = getBlockedPatterns(); - expect(Array.isArray(patterns.explicit)).toBe(true); + expect(Array.isArray(patterns.explicit)).toBe(true); + expect(() => { + (patterns.explicit as string[]).push('new-tool'); + }).toThrow(); });Note: This would require the implementation to return a truly immutable array (e.g., via Object.freeze).
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (3)
libs/uipack/src/build/__tests__/build-universal.test.tsis excluded by!**/build/**libs/uipack/src/build/index.tsis excluded by!**/build/**yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (61)
.github/workflows/push.yml.gitignore.nycrc.jsonapps/e2e/demo-e2e-cache/jest.e2e.config.tsapps/e2e/demo-e2e-codecall/jest.e2e.config.tsapps/e2e/demo-e2e-errors/jest.e2e.config.tsapps/e2e/demo-e2e-hooks/jest.e2e.config.tsapps/e2e/demo-e2e-multiapp/jest.e2e.config.tsapps/e2e/demo-e2e-notifications/jest.e2e.config.tsapps/e2e/demo-e2e-openapi/jest.e2e.config.tsapps/e2e/demo-e2e-orchestrated/jest.e2e.config.tsapps/e2e/demo-e2e-providers/jest.e2e.config.tsapps/e2e/demo-e2e-public/jest.e2e.config.tsapps/e2e/demo-e2e-redis/jest.e2e.config.tsapps/e2e/demo-e2e-serverless/jest.e2e.config.tsapps/e2e/demo-e2e-transparent/jest.e2e.config.tsapps/e2e/demo-e2e-ui/jest.e2e.config.tsjest.coverage.preset.jsjest.preset.jslibs/adapters/jest.config.tslibs/adapters/project.jsonlibs/adapters/src/openapi/__tests__/openapi-frontmcp-schema.spec.tslibs/adapters/src/openapi/__tests__/openapi-security-unit.spec.tslibs/adapters/src/openapi/__tests__/openapi-tool-execution.spec.tslibs/adapters/src/openapi/__tests__/openapi-transforms.spec.tslibs/cli/jest.config.tslibs/json-schema-to-zod-v3/jest.config.tslibs/json-schema-to-zod-v3/src/__tests__/handlers.spec.tslibs/json-schema-to-zod-v3/src/__tests__/security.spec.tslibs/mcp-from-openapi/jest.config.tslibs/mcp-from-openapi/src/__tests__/errors.spec.tslibs/mcp-from-openapi/src/__tests__/generator.spec.tslibs/mcp-from-openapi/src/__tests__/response-builder.spec.tslibs/mcp-from-openapi/src/__tests__/schema-builder.spec.tslibs/mcp-from-openapi/src/__tests__/security-resolver.spec.tslibs/mcp-from-openapi/src/__tests__/types.spec.tslibs/mcp-from-openapi/src/__tests__/validator.spec.tslibs/plugins/jest.config.tslibs/plugins/project.jsonlibs/plugins/src/cache/__tests__/cache-memory.provider.test.tslibs/plugins/src/cache/__tests__/cache-redis.provider.test.tslibs/plugins/src/codecall/__tests__/audit-logger.service.test.tslibs/plugins/src/codecall/__tests__/describe.utils.test.tslibs/plugins/src/codecall/__tests__/output-sanitizer.test.tslibs/plugins/src/codecall/__tests__/self-reference-guard.test.tslibs/plugins/src/codecall/__tests__/tool-call.errors.test.tslibs/sdk/jest.config.tslibs/sdk/package.jsonlibs/sdk/project.jsonlibs/sdk/src/mcp-apps/__tests__/mcp-apps.test.tslibs/sdk/src/mcp-apps/csp.tslibs/sdk/src/mcp-apps/index.tslibs/sdk/src/mcp-apps/schemas.tslibs/sdk/src/mcp-apps/template.tslibs/sdk/src/mcp-apps/types.tslibs/sdk/src/notification/notification.service.tslibs/testing/jest.config.tslibs/ui/jest.config.tslibs/uipack/jest.config.tspackage.jsonscripts/merge-coverage.mjs
💤 Files with no reviewable changes (8)
- libs/sdk/project.json
- libs/sdk/src/mcp-apps/index.ts
- libs/sdk/src/mcp-apps/csp.ts
- libs/sdk/src/mcp-apps/types.ts
- libs/sdk/package.json
- libs/sdk/src/mcp-apps/tests/mcp-apps.test.ts
- libs/sdk/src/mcp-apps/template.ts
- libs/sdk/src/mcp-apps/schemas.ts
🧰 Additional context used
📓 Path-based instructions (4)
**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.ts: Use strict TypeScript mode with noanytypes without strong justification - useunknowninstead for generic type defaults
Avoid non-null assertions (!) - use proper error handling and throw specific errors instead
Use type parameters with constraints instead of unconstrained generics
Do not mutate rawInput in flows - use state.set() for managing flow state instead
Files:
apps/e2e/demo-e2e-openapi/jest.e2e.config.tslibs/plugins/src/codecall/__tests__/self-reference-guard.test.tslibs/plugins/jest.config.tsapps/e2e/demo-e2e-orchestrated/jest.e2e.config.tsapps/e2e/demo-e2e-codecall/jest.e2e.config.tslibs/uipack/jest.config.tslibs/mcp-from-openapi/src/__tests__/errors.spec.tslibs/mcp-from-openapi/src/__tests__/types.spec.tslibs/mcp-from-openapi/jest.config.tslibs/mcp-from-openapi/src/__tests__/response-builder.spec.tslibs/plugins/src/codecall/__tests__/output-sanitizer.test.tslibs/mcp-from-openapi/src/__tests__/security-resolver.spec.tslibs/sdk/jest.config.tslibs/ui/jest.config.tsapps/e2e/demo-e2e-ui/jest.e2e.config.tslibs/adapters/src/openapi/__tests__/openapi-transforms.spec.tslibs/plugins/src/cache/__tests__/cache-redis.provider.test.tslibs/mcp-from-openapi/src/__tests__/generator.spec.tslibs/adapters/jest.config.tslibs/json-schema-to-zod-v3/src/__tests__/security.spec.tslibs/adapters/src/openapi/__tests__/openapi-frontmcp-schema.spec.tslibs/plugins/src/codecall/__tests__/tool-call.errors.test.tslibs/plugins/src/cache/__tests__/cache-memory.provider.test.tslibs/plugins/src/codecall/__tests__/audit-logger.service.test.tsapps/e2e/demo-e2e-multiapp/jest.e2e.config.tsapps/e2e/demo-e2e-errors/jest.e2e.config.tslibs/testing/jest.config.tslibs/mcp-from-openapi/src/__tests__/schema-builder.spec.tslibs/adapters/src/openapi/__tests__/openapi-security-unit.spec.tslibs/json-schema-to-zod-v3/src/__tests__/handlers.spec.tsapps/e2e/demo-e2e-notifications/jest.e2e.config.tslibs/plugins/src/codecall/__tests__/describe.utils.test.tslibs/json-schema-to-zod-v3/jest.config.tslibs/cli/jest.config.tsapps/e2e/demo-e2e-serverless/jest.e2e.config.tsapps/e2e/demo-e2e-redis/jest.e2e.config.tsapps/e2e/demo-e2e-public/jest.e2e.config.tsapps/e2e/demo-e2e-transparent/jest.e2e.config.tslibs/sdk/src/notification/notification.service.tsapps/e2e/demo-e2e-providers/jest.e2e.config.tsapps/e2e/demo-e2e-cache/jest.e2e.config.tsapps/e2e/demo-e2e-hooks/jest.e2e.config.tslibs/adapters/src/openapi/__tests__/openapi-tool-execution.spec.tslibs/mcp-from-openapi/src/__tests__/validator.spec.ts
**/*.test.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.test.{ts,tsx}: Achieve 95%+ test coverage across all metrics (statements, branches, functions, lines)
Test all code paths including error cases and constructor validation
Include error classinstanceofchecks in tests to validate error handling
Files:
libs/plugins/src/codecall/__tests__/self-reference-guard.test.tslibs/plugins/src/codecall/__tests__/output-sanitizer.test.tslibs/plugins/src/cache/__tests__/cache-redis.provider.test.tslibs/plugins/src/codecall/__tests__/tool-call.errors.test.tslibs/plugins/src/cache/__tests__/cache-memory.provider.test.tslibs/plugins/src/codecall/__tests__/audit-logger.service.test.tslibs/plugins/src/codecall/__tests__/describe.utils.test.ts
libs/**
⚙️ CodeRabbit configuration file
libs/**: Contains publishable SDK libraries. Review for API correctness, breaking changes, and consistency with docs. When public APIs change, ensure there is a matching docs/draft/docs/** update (not direct edits under docs/docs/**).
Files:
libs/plugins/src/codecall/__tests__/self-reference-guard.test.tslibs/plugins/jest.config.tslibs/uipack/jest.config.tslibs/mcp-from-openapi/src/__tests__/errors.spec.tslibs/mcp-from-openapi/src/__tests__/types.spec.tslibs/mcp-from-openapi/jest.config.tslibs/mcp-from-openapi/src/__tests__/response-builder.spec.tslibs/plugins/src/codecall/__tests__/output-sanitizer.test.tslibs/mcp-from-openapi/src/__tests__/security-resolver.spec.tslibs/sdk/jest.config.tslibs/ui/jest.config.tslibs/adapters/src/openapi/__tests__/openapi-transforms.spec.tslibs/plugins/src/cache/__tests__/cache-redis.provider.test.tslibs/mcp-from-openapi/src/__tests__/generator.spec.tslibs/adapters/jest.config.tslibs/json-schema-to-zod-v3/src/__tests__/security.spec.tslibs/adapters/src/openapi/__tests__/openapi-frontmcp-schema.spec.tslibs/plugins/src/codecall/__tests__/tool-call.errors.test.tslibs/plugins/src/cache/__tests__/cache-memory.provider.test.tslibs/plugins/src/codecall/__tests__/audit-logger.service.test.tslibs/testing/jest.config.tslibs/mcp-from-openapi/src/__tests__/schema-builder.spec.tslibs/adapters/src/openapi/__tests__/openapi-security-unit.spec.tslibs/json-schema-to-zod-v3/src/__tests__/handlers.spec.tslibs/plugins/src/codecall/__tests__/describe.utils.test.tslibs/json-schema-to-zod-v3/jest.config.tslibs/cli/jest.config.tslibs/adapters/project.jsonlibs/sdk/src/notification/notification.service.tslibs/plugins/project.jsonlibs/adapters/src/openapi/__tests__/openapi-tool-execution.spec.tslibs/mcp-from-openapi/src/__tests__/validator.spec.ts
libs/sdk/src/**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
libs/sdk/src/**/*.ts: MCP response types should use strict MCP protocol types (GetPromptResult, ReadResourceResult) instead ofunknown
Use specific error classes with MCP error codes instead of generic errors
UsegetCapabilities()method for dynamic capability exposure instead of hardcoding capabilities
UsechangeScopeproperty instead ofscopein change events to avoid confusion with Scope class
Validate URIs per RFC 3986 at metadata level using proper validation
Validate hook flows and fail fast on invalid hook configurations with specific error messages
Files:
libs/sdk/src/notification/notification.service.ts
🧠 Learnings (28)
📓 Common learnings
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.475Z
Learning: Applies to **/*.test.{ts,tsx} : Achieve 95%+ test coverage across all metrics (statements, branches, functions, lines)
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-24T00:41:41.819Z
Learning: Applies to libs/ui/src/**/*.test.{ts,tsx} : Test coverage must be 95%+ across statements, branches, functions, and lines
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-24T00:41:55.397Z
Learning: Applies to libs/uipack/src/{adapters,theme,build}/**/*.test.{ts,tsx,js,jsx} : Test component behavior across all platform configurations (OpenAI, Claude, etc.)
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-24T00:41:55.397Z
Learning: Achieve 95%+ test coverage across statements, branches, functions, and lines
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-24T00:41:41.819Z
Learning: Applies to libs/ui/src/**/*.test.{ts,tsx} : Use React Testing Library for component tests and include SSR/hydration tests for all interactive components
📚 Learning: 2025-12-24T00:41:55.397Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-24T00:41:55.397Z
Learning: Applies to libs/uipack/src/{adapters,theme,build}/**/*.test.{ts,tsx,js,jsx} : Test component behavior across all platform configurations (OpenAI, Claude, etc.)
Applied to files:
apps/e2e/demo-e2e-openapi/jest.e2e.config.tslibs/plugins/jest.config.tsapps/e2e/demo-e2e-orchestrated/jest.e2e.config.tsapps/e2e/demo-e2e-codecall/jest.e2e.config.tslibs/uipack/jest.config.tslibs/mcp-from-openapi/src/__tests__/errors.spec.tslibs/mcp-from-openapi/src/__tests__/types.spec.tslibs/mcp-from-openapi/jest.config.tslibs/sdk/jest.config.tslibs/ui/jest.config.tsapps/e2e/demo-e2e-ui/jest.e2e.config.tslibs/adapters/src/openapi/__tests__/openapi-transforms.spec.tslibs/adapters/jest.config.tslibs/adapters/src/openapi/__tests__/openapi-frontmcp-schema.spec.tslibs/plugins/src/codecall/__tests__/tool-call.errors.test.tslibs/plugins/src/codecall/__tests__/audit-logger.service.test.tsjest.coverage.preset.jsapps/e2e/demo-e2e-multiapp/jest.e2e.config.tsapps/e2e/demo-e2e-errors/jest.e2e.config.tslibs/testing/jest.config.tslibs/mcp-from-openapi/src/__tests__/schema-builder.spec.tslibs/adapters/src/openapi/__tests__/openapi-security-unit.spec.tslibs/json-schema-to-zod-v3/src/__tests__/handlers.spec.tsapps/e2e/demo-e2e-notifications/jest.e2e.config.tslibs/plugins/src/codecall/__tests__/describe.utils.test.tslibs/json-schema-to-zod-v3/jest.config.tslibs/cli/jest.config.tsapps/e2e/demo-e2e-serverless/jest.e2e.config.tslibs/adapters/project.jsonapps/e2e/demo-e2e-redis/jest.e2e.config.tsapps/e2e/demo-e2e-public/jest.e2e.config.tsapps/e2e/demo-e2e-transparent/jest.e2e.config.tsapps/e2e/demo-e2e-providers/jest.e2e.config.tsapps/e2e/demo-e2e-cache/jest.e2e.config.tslibs/plugins/project.jsonapps/e2e/demo-e2e-hooks/jest.e2e.config.tslibs/adapters/src/openapi/__tests__/openapi-tool-execution.spec.tslibs/mcp-from-openapi/src/__tests__/validator.spec.ts
📚 Learning: 2025-12-19T02:04:46.475Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.475Z
Learning: Applies to **/*.test.{ts,tsx} : Achieve 95%+ test coverage across all metrics (statements, branches, functions, lines)
Applied to files:
apps/e2e/demo-e2e-openapi/jest.e2e.config.tsscripts/merge-coverage.mjslibs/plugins/jest.config.tsapps/e2e/demo-e2e-orchestrated/jest.e2e.config.tsapps/e2e/demo-e2e-codecall/jest.e2e.config.tslibs/uipack/jest.config.tslibs/mcp-from-openapi/jest.config.tslibs/plugins/src/codecall/__tests__/output-sanitizer.test.tslibs/sdk/jest.config.tslibs/ui/jest.config.tsapps/e2e/demo-e2e-ui/jest.e2e.config.ts.github/workflows/push.ymllibs/adapters/jest.config.ts.nycrc.jsonlibs/plugins/src/codecall/__tests__/audit-logger.service.test.tsjest.coverage.preset.jsapps/e2e/demo-e2e-multiapp/jest.e2e.config.tsapps/e2e/demo-e2e-errors/jest.e2e.config.tslibs/testing/jest.config.tsapps/e2e/demo-e2e-notifications/jest.e2e.config.tslibs/plugins/src/codecall/__tests__/describe.utils.test.tslibs/json-schema-to-zod-v3/jest.config.tslibs/cli/jest.config.tsapps/e2e/demo-e2e-serverless/jest.e2e.config.tsapps/e2e/demo-e2e-redis/jest.e2e.config.tsapps/e2e/demo-e2e-public/jest.e2e.config.tsapps/e2e/demo-e2e-transparent/jest.e2e.config.tspackage.jsonapps/e2e/demo-e2e-providers/jest.e2e.config.tsapps/e2e/demo-e2e-cache/jest.e2e.config.tsapps/e2e/demo-e2e-hooks/jest.e2e.config.ts
📚 Learning: 2025-12-24T00:41:41.819Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-24T00:41:41.819Z
Learning: Applies to libs/ui/src/**/*.test.{ts,tsx} : Test coverage must be 95%+ across statements, branches, functions, and lines
Applied to files:
apps/e2e/demo-e2e-openapi/jest.e2e.config.tsscripts/merge-coverage.mjslibs/plugins/jest.config.tsapps/e2e/demo-e2e-orchestrated/jest.e2e.config.tsapps/e2e/demo-e2e-codecall/jest.e2e.config.tslibs/uipack/jest.config.tslibs/mcp-from-openapi/jest.config.tslibs/sdk/jest.config.tslibs/ui/jest.config.tsapps/e2e/demo-e2e-ui/jest.e2e.config.tslibs/adapters/jest.config.ts.nycrc.jsonlibs/plugins/src/codecall/__tests__/tool-call.errors.test.tslibs/plugins/src/codecall/__tests__/audit-logger.service.test.tsjest.coverage.preset.jsapps/e2e/demo-e2e-multiapp/jest.e2e.config.tsapps/e2e/demo-e2e-errors/jest.e2e.config.tslibs/testing/jest.config.tsapps/e2e/demo-e2e-notifications/jest.e2e.config.tslibs/plugins/src/codecall/__tests__/describe.utils.test.tslibs/json-schema-to-zod-v3/jest.config.tslibs/cli/jest.config.tsapps/e2e/demo-e2e-serverless/jest.e2e.config.tsapps/e2e/demo-e2e-redis/jest.e2e.config.tsapps/e2e/demo-e2e-public/jest.e2e.config.tsapps/e2e/demo-e2e-transparent/jest.e2e.config.tspackage.jsonapps/e2e/demo-e2e-providers/jest.e2e.config.tsapps/e2e/demo-e2e-cache/jest.e2e.config.tsapps/e2e/demo-e2e-hooks/jest.e2e.config.ts
📚 Learning: 2025-12-19T02:04:46.475Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.475Z
Learning: Applies to **/*.test.{ts,tsx} : Test all code paths including error cases and constructor validation
Applied to files:
apps/e2e/demo-e2e-openapi/jest.e2e.config.tslibs/plugins/src/codecall/__tests__/self-reference-guard.test.tslibs/plugins/jest.config.tsapps/e2e/demo-e2e-orchestrated/jest.e2e.config.tsapps/e2e/demo-e2e-codecall/jest.e2e.config.tslibs/uipack/jest.config.tslibs/mcp-from-openapi/src/__tests__/errors.spec.tslibs/mcp-from-openapi/src/__tests__/types.spec.tslibs/mcp-from-openapi/src/__tests__/response-builder.spec.tslibs/plugins/src/codecall/__tests__/output-sanitizer.test.tslibs/mcp-from-openapi/src/__tests__/security-resolver.spec.tslibs/ui/jest.config.tsapps/e2e/demo-e2e-ui/jest.e2e.config.tslibs/adapters/src/openapi/__tests__/openapi-transforms.spec.tslibs/mcp-from-openapi/src/__tests__/generator.spec.tslibs/adapters/jest.config.tslibs/json-schema-to-zod-v3/src/__tests__/security.spec.tslibs/adapters/src/openapi/__tests__/openapi-frontmcp-schema.spec.tslibs/plugins/src/codecall/__tests__/tool-call.errors.test.tslibs/plugins/src/cache/__tests__/cache-memory.provider.test.tslibs/plugins/src/codecall/__tests__/audit-logger.service.test.tsjest.coverage.preset.jsapps/e2e/demo-e2e-multiapp/jest.e2e.config.tsapps/e2e/demo-e2e-errors/jest.e2e.config.tslibs/testing/jest.config.tslibs/mcp-from-openapi/src/__tests__/schema-builder.spec.tslibs/adapters/src/openapi/__tests__/openapi-security-unit.spec.tslibs/json-schema-to-zod-v3/src/__tests__/handlers.spec.tsapps/e2e/demo-e2e-notifications/jest.e2e.config.tslibs/plugins/src/codecall/__tests__/describe.utils.test.tslibs/json-schema-to-zod-v3/jest.config.tsapps/e2e/demo-e2e-serverless/jest.e2e.config.tsapps/e2e/demo-e2e-redis/jest.e2e.config.tsapps/e2e/demo-e2e-public/jest.e2e.config.tsapps/e2e/demo-e2e-transparent/jest.e2e.config.tsapps/e2e/demo-e2e-providers/jest.e2e.config.tsapps/e2e/demo-e2e-cache/jest.e2e.config.tsapps/e2e/demo-e2e-hooks/jest.e2e.config.tslibs/adapters/src/openapi/__tests__/openapi-tool-execution.spec.tslibs/mcp-from-openapi/src/__tests__/validator.spec.ts
📚 Learning: 2025-12-24T00:41:55.397Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-24T00:41:55.397Z
Learning: Applies to libs/uipack/src/{renderers,utils,base-template,tool-template,runtime}/**/*.test.{ts,tsx,js,jsx} : Test HTML escaping for user-provided content in security-critical paths
Applied to files:
libs/plugins/src/codecall/__tests__/self-reference-guard.test.tslibs/plugins/jest.config.tslibs/uipack/jest.config.tslibs/plugins/src/codecall/__tests__/output-sanitizer.test.tslibs/sdk/jest.config.tslibs/ui/jest.config.tslibs/json-schema-to-zod-v3/src/__tests__/security.spec.tslibs/testing/jest.config.tslibs/adapters/src/openapi/__tests__/openapi-security-unit.spec.tslibs/plugins/src/codecall/__tests__/describe.utils.test.ts
📚 Learning: 2025-12-24T00:41:55.397Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-24T00:41:55.397Z
Learning: Applies to libs/uipack/src/*/index.ts : Implement entry point re-exports in index.ts files for each module (adapters, build, bundler, etc.)
Applied to files:
libs/uipack/jest.config.tsapps/e2e/demo-e2e-ui/jest.e2e.config.tsapps/e2e/demo-e2e-multiapp/jest.e2e.config.ts
📚 Learning: 2025-12-24T00:41:55.397Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-24T00:41:55.397Z
Learning: Applies to libs/uipack/src/{theme,build,bundler,base-template}/**/*.{ts,tsx,js,jsx} : Use theme.cdn configuration instead of hard-coding CDN URLs
Applied to files:
libs/uipack/jest.config.tslibs/sdk/jest.config.tslibs/ui/jest.config.tsapps/e2e/demo-e2e-ui/jest.e2e.config.tsapps/e2e/demo-e2e-multiapp/jest.e2e.config.tsapps/e2e/demo-e2e-cache/jest.e2e.config.ts
📚 Learning: 2025-12-24T00:41:55.397Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-24T00:41:55.397Z
Learning: Applies to libs/uipack/src/**/*.{ts,tsx,js,jsx} : No React dependency in frontmcp/uipack - use frontmcp/ui for React components and hooks
Applied to files:
libs/uipack/jest.config.tslibs/sdk/jest.config.ts
📚 Learning: 2025-12-19T02:04:46.475Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.475Z
Learning: Applies to libs/sdk/src/**/*.ts : Use specific error classes with MCP error codes instead of generic errors
Applied to files:
libs/mcp-from-openapi/src/__tests__/errors.spec.tslibs/mcp-from-openapi/src/__tests__/generator.spec.tslibs/plugins/src/codecall/__tests__/tool-call.errors.test.ts
📚 Learning: 2025-12-19T02:04:46.475Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.475Z
Learning: Applies to **/*.test.{ts,tsx} : Include error class `instanceof` checks in tests to validate error handling
Applied to files:
libs/mcp-from-openapi/src/__tests__/errors.spec.tslibs/mcp-from-openapi/src/__tests__/types.spec.tslibs/mcp-from-openapi/src/__tests__/generator.spec.tslibs/plugins/src/codecall/__tests__/tool-call.errors.test.tsapps/e2e/demo-e2e-errors/jest.e2e.config.tslibs/testing/jest.config.tslibs/plugins/src/codecall/__tests__/describe.utils.test.ts
📚 Learning: 2025-12-19T02:04:46.475Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.475Z
Learning: FrontMCP is a TypeScript-first schema validation framework - all types should align with MCP protocol definitions
Applied to files:
libs/mcp-from-openapi/src/__tests__/types.spec.tslibs/adapters/src/openapi/__tests__/openapi-frontmcp-schema.spec.tslibs/mcp-from-openapi/src/__tests__/schema-builder.spec.tslibs/adapters/src/openapi/__tests__/openapi-security-unit.spec.tslibs/sdk/src/notification/notification.service.tslibs/mcp-from-openapi/src/__tests__/validator.spec.ts
📚 Learning: 2025-12-19T02:04:46.475Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.475Z
Learning: Applies to libs/sdk/src/**/*.ts : MCP response types should use strict MCP protocol types (GetPromptResult, ReadResourceResult) instead of `unknown`
Applied to files:
libs/mcp-from-openapi/src/__tests__/types.spec.ts
📚 Learning: 2025-12-24T00:41:41.819Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-24T00:41:41.819Z
Learning: Applies to libs/ui/src/**/*.test.{ts,tsx} : Use React Testing Library for component tests and include SSR/hydration tests for all interactive components
Applied to files:
libs/mcp-from-openapi/src/__tests__/types.spec.tslibs/ui/jest.config.tsapps/e2e/demo-e2e-ui/jest.e2e.config.tsjest.coverage.preset.jslibs/testing/jest.config.tslibs/plugins/src/codecall/__tests__/describe.utils.test.ts
📚 Learning: 2025-12-24T00:41:55.397Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-24T00:41:55.397Z
Learning: Applies to libs/uipack/src/**/*.{ts,tsx} : Use `.strict()` on all Zod schemas for validation
Applied to files:
libs/mcp-from-openapi/src/__tests__/types.spec.tslibs/json-schema-to-zod-v3/src/__tests__/security.spec.tslibs/json-schema-to-zod-v3/src/__tests__/handlers.spec.ts
📚 Learning: 2025-12-24T00:41:41.819Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-24T00:41:41.819Z
Learning: Applies to libs/ui/src/**/*.test.{ts,tsx} : SSR components must be tested for correct HTML output and client-side hydration must be tested separately
Applied to files:
libs/plugins/src/codecall/__tests__/output-sanitizer.test.tslibs/ui/jest.config.tslibs/testing/jest.config.tslibs/plugins/src/codecall/__tests__/describe.utils.test.ts
📚 Learning: 2025-12-24T00:41:55.397Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-24T00:41:55.397Z
Learning: Applies to libs/uipack/src/**/*.{ts,tsx,js,jsx} : Do not expose internal error details to users - sanitize error messages
Applied to files:
libs/plugins/src/codecall/__tests__/output-sanitizer.test.ts
📚 Learning: 2025-12-24T00:41:41.819Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-24T00:41:41.819Z
Learning: Applies to libs/ui/src/bundler/**/*.{ts,tsx} : The bundler module must re-export utilities from frontmcp/uipack/bundler and provide SSR component bundling functionality
Applied to files:
libs/sdk/jest.config.tsapps/e2e/demo-e2e-ui/jest.e2e.config.tsapps/e2e/demo-e2e-multiapp/jest.e2e.config.tsapps/e2e/demo-e2e-serverless/jest.e2e.config.tsapps/e2e/demo-e2e-public/jest.e2e.config.tsapps/e2e/demo-e2e-transparent/jest.e2e.config.tsapps/e2e/demo-e2e-providers/jest.e2e.config.ts
📚 Learning: 2025-12-24T00:41:41.819Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-24T00:41:41.819Z
Learning: Applies to libs/ui/src/**/*.{ts,tsx} : Never import React-free utilities from frontmcp/ui; use frontmcp/uipack for bundling, build tools, platform adapters, and theme utilities
Applied to files:
libs/sdk/jest.config.tslibs/sdk/src/notification/notification.service.ts
📚 Learning: 2025-12-24T00:41:41.819Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-24T00:41:41.819Z
Learning: Applies to libs/ui/src/**/*.test.{ts,tsx} : Do not skip SSR/hydration testing for components; all interactive widgets must be tested in both rendering contexts
Applied to files:
libs/ui/jest.config.ts
📚 Learning: 2025-12-24T00:41:55.397Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-24T00:41:55.397Z
Learning: Achieve 95%+ test coverage across statements, branches, functions, and lines
Applied to files:
.nycrc.json
📚 Learning: 2025-12-19T02:04:46.475Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.475Z
Learning: Ensure all builds complete without TypeScript warnings and 100% test pass rate is required
Applied to files:
.nycrc.jsonlibs/testing/jest.config.ts
📚 Learning: 2025-12-19T02:04:46.475Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.475Z
Learning: Applies to libs/sdk/src/**/*.ts : Validate hook flows and fail fast on invalid hook configurations with specific error messages
Applied to files:
libs/plugins/src/codecall/__tests__/tool-call.errors.test.ts
📚 Learning: 2025-12-19T02:04:46.475Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.475Z
Learning: Applies to **/*.ts : Avoid non-null assertions (`!`) - use proper error handling and throw specific errors instead
Applied to files:
libs/plugins/src/codecall/__tests__/tool-call.errors.test.ts
📚 Learning: 2025-12-19T02:04:46.475Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.475Z
Learning: Use Nx for build system with commands like `nx build sdk`, `nx test`, `nx run-many -t test`
Applied to files:
libs/adapters/project.jsonpackage.jsonlibs/plugins/project.json
📚 Learning: 2025-12-19T02:04:46.475Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.475Z
Learning: Applies to libs/sdk/src/common/records/**/*.ts : Centralize record types in common/records directory and import from there instead of module-specific files
Applied to files:
libs/sdk/src/notification/notification.service.ts
📚 Learning: 2025-12-19T02:04:46.475Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.475Z
Learning: Applies to libs/sdk/src/**/index.ts : Export public API through barrel files - export users' needed items, no legacy exports with different names
Applied to files:
libs/sdk/src/notification/notification.service.ts
📚 Learning: 2025-12-24T00:41:55.397Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-24T00:41:55.397Z
Learning: Test all components with invalid inputs to ensure proper validation
Applied to files:
libs/mcp-from-openapi/src/__tests__/validator.spec.ts
🧬 Code graph analysis (9)
libs/plugins/src/codecall/__tests__/self-reference-guard.test.ts (2)
libs/plugins/src/codecall/security/self-reference-guard.ts (3)
isBlockedSelfReference(33-48)assertNotSelfReference(60-64)getBlockedPatterns(70-75)libs/plugins/src/codecall/errors/tool-call.errors.ts (1)
SelfReferenceError(121-131)
libs/plugins/src/codecall/__tests__/output-sanitizer.test.ts (1)
libs/plugins/src/codecall/services/output-sanitizer.ts (4)
DEFAULT_SANITIZER_CONFIG(68-76)sanitizeOutput(97-133)needsSanitization(354-370)sanitizeLogMessage(375-395)
libs/plugins/src/cache/__tests__/cache-redis.provider.test.ts (1)
libs/plugins/src/cache/cache.types.ts (1)
RedisCacheOptions(69-69)
libs/mcp-from-openapi/src/__tests__/generator.spec.ts (2)
libs/mcp-from-openapi/src/generator.ts (1)
OpenAPIToolGenerator(29-475)libs/mcp-from-openapi/src/errors.ts (2)
LoadError(22-26)ParseError(31-35)
libs/adapters/src/openapi/__tests__/openapi-frontmcp-schema.spec.ts (1)
libs/adapters/src/openapi/openapi.frontmcp-schema.ts (3)
validateFrontMcpExtension(171-215)FRONTMCP_SCHEMA_VERSION(16-16)SUPPORTED_VERSIONS(21-21)
libs/plugins/src/codecall/__tests__/tool-call.errors.test.ts (1)
libs/plugins/src/codecall/errors/tool-call.errors.ts (4)
TOOL_CALL_ERROR_CODES(7-14)createToolCallError(51-60)SelfReferenceError(121-131)ToolAccessDeniedError(137-148)
libs/plugins/src/codecall/__tests__/audit-logger.service.test.ts (1)
libs/plugins/src/codecall/services/audit-logger.service.ts (2)
AUDIT_EVENT_TYPES(8-38)AuditEvent(45-56)
libs/plugins/src/codecall/__tests__/describe.utils.test.ts (1)
libs/plugins/src/codecall/utils/describe.utils.ts (11)
jsonSchemaToSignature(73-78)jsonSchemaToNaturalLanguage(163-200)generateBasicExample(205-214)generatePaginationExample(341-353)generateFilterExample(358-364)hasFilterParams(302-317)getFilterProperties(322-336)generateGetExample(399-420)generateUpdateExample(438-464)generateDeleteExample(469-489)generateSearchExample(494-511)
libs/adapters/src/openapi/__tests__/openapi-tool-execution.spec.ts (2)
libs/adapters/src/openapi/openapi.tool.ts (1)
createOpenApiTool(27-203)libs/adapters/src/openapi/__tests__/fixtures.ts (1)
basicOpenApiSpec(10-84)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Build Libraries
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
♻️ Duplicate comments (1)
apps/e2e/demo-e2e-redis/jest.e2e.config.ts (1)
39-40: Coverage configuration follows established pattern.The coverage directory and preset spreading are consistent with other e2e test configurations across the project, enabling centralized coverage reporting.
Note: The concern about
!**/index.tsexclusion potentially missing SDK coverage (raised in past reviews) applies to the shared preset file (jest.e2e.coverage.preset.js), not this configuration file.
🧹 Nitpick comments (8)
libs/mcp-from-openapi/src/__tests__/generator.spec.ts (3)
84-93: Remove unused fake timers or add timeout testing.The fake timers are initialized but never advanced in any test. The timeout test at line 195 doesn't actually verify timeout behavior—it only checks that the generator accepts a timeout option.
Either remove
jest.useFakeTimers()/jest.useRealTimers()if timeout behavior isn't being tested, or add a proper timeout test that advances timers to trigger actual timeout scenarios.🔎 Example timeout test with timer advancement
+ it('should timeout when fetch takes too long', async () => { + mockFetch.mockImplementation( + () => new Promise((resolve) => setTimeout(resolve, 10000)) + ); + + const promise = OpenAPIToolGenerator.fromURL('https://example.com/api.json', { + timeout: 5000, + }); + + jest.advanceTimersByTime(5000); + + await expect(promise).rejects.toThrow(LoadError); + });
109-113: Use Headers object instead of Map for mock fetch responses.The mock returns
headers: new Map([...]), but the real Fetch API returns aHeadersobject with a different API surface (e.g.,get(),has(),entries()). While Map might work for basic operations, it doesn't accurately represent the runtime behavior.🔎 Proposed fix using Headers
mockFetch.mockResolvedValue({ ok: true, text: () => Promise.resolve(jsonSpec), - headers: new Map([['content-type', 'application/json']]), + headers: new Headers([['content-type', 'application/json']]), });Apply this pattern to all mock fetch responses in this test suite (lines 112, 137, 162, 212, 238, 270, 302).
195-219: Enhance timeout test to verify actual timeout behavior.This test only confirms that the
timeoutoption is accepted, but doesn't verify that it's actually enforced. Consider adding a test that simulates a delayed fetch response and advances fake timers to confirm the timeout triggers a LoadError.See the example in the comment on lines 84-93 for how to properly test timeout behavior.
libs/plugins/src/codecall/__tests__/tool-call.errors.test.ts (1)
103-125: Consider testing rawMessage behavior for TIMEOUT, ACCESS_DENIED, and SELF_REFERENCE.While the current tests verify the default messages, consider adding tests to explicitly verify that these error codes ignore the
rawMessageparameter (similar to the test for NOT_FOUND at lines 33-36). This would document the behavior more completely.🔎 Example test additions
describe('TIMEOUT error', () => { it('should create error with default message', () => { const error = createToolCallError('TIMEOUT', 'slow:operation'); expect(error.code).toBe('TIMEOUT'); expect(error.message).toBe('Tool "slow:operation" execution timed out'); }); + + it('should ignore raw message for TIMEOUT', () => { + const error = createToolCallError('TIMEOUT', 'test:tool', 'internal error details'); + expect(error.message).toBe('Tool "test:tool" execution timed out'); + }); }); describe('ACCESS_DENIED error', () => { it('should create error with default message', () => { const error = createToolCallError('ACCESS_DENIED', 'admin:delete'); expect(error.code).toBe('ACCESS_DENIED'); expect(error.message).toBe('Access denied for tool "admin:delete"'); }); + + it('should ignore raw message for ACCESS_DENIED', () => { + const error = createToolCallError('ACCESS_DENIED', 'test:tool', 'internal details'); + expect(error.message).toBe('Access denied for tool "test:tool"'); + }); }); describe('SELF_REFERENCE error', () => { it('should create error with default message', () => { const error = createToolCallError('SELF_REFERENCE', 'codecall:execute'); expect(error.code).toBe('SELF_REFERENCE'); expect(error.message).toBe('Cannot call CodeCall tools from within AgentScript'); }); + + it('should ignore raw message for SELF_REFERENCE', () => { + const error = createToolCallError('SELF_REFERENCE', 'test:tool', 'internal details'); + expect(error.message).toBe('Cannot call CodeCall tools from within AgentScript'); + }); });libs/plugins/src/cache/__tests__/cache-redis.provider.test.ts (4)
33-33: Fragile mock access pattern.Accessing
Redis.mock.results[0].valueassumes the first mock call is the current provider. If tests or setup logic changes to create multiple instances, this will break.🔎 Proposed fix
- mockClient = Redis.mock.results[0].value; + mockClient = Redis.mock.results[Redis.mock.results.length - 1].value;Or better yet, store a reference to the client during provider construction by exposing it for testing purposes.
77-87: Type assertions mask the test intent.Using
as anycircumvents type safety, which is the very thing being tested here.🔎 Alternative approach
expect(() => { new CacheRedisProvider({ - type: 'invalid' as any, - } as RedisCacheOptions); + type: 'invalid', + } as unknown as RedisCacheOptions); }).toThrow(Using
unknownis more explicit about bypassing type safety for testing purposes.
127-134: Consider testing edge cases for object serialization.While the basic object serialization is tested, consider adding tests for edge cases like circular references,
null,undefined, or objects with non-serializable properties.
171-177: Consider testing malformed JSON handling.The test verifies plain strings are returned as-is, but doesn't test the behavior when Redis returns malformed JSON (e.g.,
"{invalid"). Consider adding a test to verify graceful handling of JSON parse errors.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (30)
.github/workflows/push.yml.nycrc.jsonapps/e2e/demo-e2e-cache/jest.e2e.config.tsapps/e2e/demo-e2e-codecall/jest.e2e.config.tsapps/e2e/demo-e2e-errors/jest.e2e.config.tsapps/e2e/demo-e2e-hooks/jest.e2e.config.tsapps/e2e/demo-e2e-multiapp/jest.e2e.config.tsapps/e2e/demo-e2e-notifications/jest.e2e.config.tsapps/e2e/demo-e2e-openapi/jest.e2e.config.tsapps/e2e/demo-e2e-orchestrated/jest.e2e.config.tsapps/e2e/demo-e2e-providers/jest.e2e.config.tsapps/e2e/demo-e2e-public/jest.e2e.config.tsapps/e2e/demo-e2e-redis/jest.e2e.config.tsapps/e2e/demo-e2e-serverless/jest.e2e.config.tsapps/e2e/demo-e2e-transparent/jest.e2e.config.tsapps/e2e/demo-e2e-ui/jest.e2e.config.tsjest.coverage.preset.jsjest.e2e.coverage.preset.jslibs/adapters/project.jsonlibs/cli/src/__tests__/args.spec.tslibs/cli/src/args.tslibs/cli/src/cli.tslibs/cli/src/commands/test.tslibs/json-schema-to-zod-v3/src/__tests__/handlers.spec.tslibs/mcp-from-openapi/src/__tests__/generator.spec.tslibs/mcp-from-openapi/src/__tests__/types.spec.tslibs/plugins/src/cache/__tests__/cache-redis.provider.test.tslibs/plugins/src/codecall/__tests__/self-reference-guard.test.tslibs/plugins/src/codecall/__tests__/tool-call.errors.test.tslibs/plugins/src/codecall/errors/tool-call.errors.ts
🚧 Files skipped from review as they are similar to previous changes (10)
- libs/mcp-from-openapi/src/tests/types.spec.ts
- libs/json-schema-to-zod-v3/src/tests/handlers.spec.ts
- apps/e2e/demo-e2e-notifications/jest.e2e.config.ts
- apps/e2e/demo-e2e-hooks/jest.e2e.config.ts
- libs/plugins/src/codecall/tests/self-reference-guard.test.ts
- apps/e2e/demo-e2e-ui/jest.e2e.config.ts
- apps/e2e/demo-e2e-providers/jest.e2e.config.ts
- libs/adapters/project.json
- apps/e2e/demo-e2e-openapi/jest.e2e.config.ts
- jest.coverage.preset.js
🧰 Additional context used
📓 Path-based instructions (3)
**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.ts: Use strict TypeScript mode with noanytypes without strong justification - useunknowninstead for generic type defaults
Avoid non-null assertions (!) - use proper error handling and throw specific errors instead
Use type parameters with constraints instead of unconstrained generics
Do not mutate rawInput in flows - use state.set() for managing flow state instead
Files:
apps/e2e/demo-e2e-multiapp/jest.e2e.config.tsapps/e2e/demo-e2e-redis/jest.e2e.config.tslibs/mcp-from-openapi/src/__tests__/generator.spec.tslibs/plugins/src/codecall/errors/tool-call.errors.tslibs/cli/src/commands/test.tslibs/cli/src/args.tsapps/e2e/demo-e2e-errors/jest.e2e.config.tsapps/e2e/demo-e2e-transparent/jest.e2e.config.tslibs/cli/src/cli.tslibs/plugins/src/cache/__tests__/cache-redis.provider.test.tsapps/e2e/demo-e2e-codecall/jest.e2e.config.tslibs/cli/src/__tests__/args.spec.tsapps/e2e/demo-e2e-serverless/jest.e2e.config.tsapps/e2e/demo-e2e-public/jest.e2e.config.tslibs/plugins/src/codecall/__tests__/tool-call.errors.test.tsapps/e2e/demo-e2e-cache/jest.e2e.config.tsapps/e2e/demo-e2e-orchestrated/jest.e2e.config.ts
libs/**
⚙️ CodeRabbit configuration file
libs/**: Contains publishable SDK libraries. Review for API correctness, breaking changes, and consistency with docs. When public APIs change, ensure there is a matching docs/draft/docs/** update (not direct edits under docs/docs/**).
Files:
libs/mcp-from-openapi/src/__tests__/generator.spec.tslibs/plugins/src/codecall/errors/tool-call.errors.tslibs/cli/src/commands/test.tslibs/cli/src/args.tslibs/cli/src/cli.tslibs/plugins/src/cache/__tests__/cache-redis.provider.test.tslibs/cli/src/__tests__/args.spec.tslibs/plugins/src/codecall/__tests__/tool-call.errors.test.ts
**/*.test.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.test.{ts,tsx}: Achieve 95%+ test coverage across all metrics (statements, branches, functions, lines)
Test all code paths including error cases and constructor validation
Include error classinstanceofchecks in tests to validate error handling
Files:
libs/plugins/src/cache/__tests__/cache-redis.provider.test.tslibs/plugins/src/codecall/__tests__/tool-call.errors.test.ts
🧠 Learnings (19)
📓 Common learnings
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.475Z
Learning: Applies to **/*.test.{ts,tsx} : Achieve 95%+ test coverage across all metrics (statements, branches, functions, lines)
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-24T00:41:55.397Z
Learning: Applies to libs/uipack/src/{adapters,theme,build}/**/*.test.{ts,tsx,js,jsx} : Test component behavior across all platform configurations (OpenAI, Claude, etc.)
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-24T00:41:41.819Z
Learning: Applies to libs/ui/src/**/*.test.{ts,tsx} : Test coverage must be 95%+ across statements, branches, functions, and lines
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.475Z
Learning: Applies to **/*.test.{ts,tsx} : Test all code paths including error cases and constructor validation
📚 Learning: 2025-12-19T02:04:46.475Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.475Z
Learning: Applies to **/*.test.{ts,tsx} : Achieve 95%+ test coverage across all metrics (statements, branches, functions, lines)
Applied to files:
apps/e2e/demo-e2e-multiapp/jest.e2e.config.tsapps/e2e/demo-e2e-redis/jest.e2e.config.tslibs/cli/src/commands/test.tsapps/e2e/demo-e2e-transparent/jest.e2e.config.tslibs/cli/src/cli.tsapps/e2e/demo-e2e-codecall/jest.e2e.config.tslibs/cli/src/__tests__/args.spec.tsapps/e2e/demo-e2e-serverless/jest.e2e.config.tsapps/e2e/demo-e2e-public/jest.e2e.config.tsjest.e2e.coverage.preset.jslibs/plugins/src/codecall/__tests__/tool-call.errors.test.tsapps/e2e/demo-e2e-cache/jest.e2e.config.ts.github/workflows/push.yml.nycrc.jsonapps/e2e/demo-e2e-orchestrated/jest.e2e.config.ts
📚 Learning: 2025-12-24T00:41:55.397Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-24T00:41:55.397Z
Learning: Applies to libs/uipack/src/{adapters,theme,build}/**/*.test.{ts,tsx,js,jsx} : Test component behavior across all platform configurations (OpenAI, Claude, etc.)
Applied to files:
apps/e2e/demo-e2e-multiapp/jest.e2e.config.tsapps/e2e/demo-e2e-redis/jest.e2e.config.tslibs/cli/src/commands/test.tsapps/e2e/demo-e2e-errors/jest.e2e.config.tsapps/e2e/demo-e2e-transparent/jest.e2e.config.tsapps/e2e/demo-e2e-codecall/jest.e2e.config.tslibs/cli/src/__tests__/args.spec.tsapps/e2e/demo-e2e-serverless/jest.e2e.config.tsapps/e2e/demo-e2e-public/jest.e2e.config.tsjest.e2e.coverage.preset.jslibs/plugins/src/codecall/__tests__/tool-call.errors.test.tsapps/e2e/demo-e2e-cache/jest.e2e.config.ts.nycrc.jsonapps/e2e/demo-e2e-orchestrated/jest.e2e.config.ts
📚 Learning: 2025-12-24T00:41:41.819Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-24T00:41:41.819Z
Learning: Applies to libs/ui/src/**/*.test.{ts,tsx} : Test coverage must be 95%+ across statements, branches, functions, and lines
Applied to files:
apps/e2e/demo-e2e-multiapp/jest.e2e.config.tsapps/e2e/demo-e2e-redis/jest.e2e.config.tslibs/cli/src/commands/test.tsapps/e2e/demo-e2e-transparent/jest.e2e.config.tslibs/cli/src/cli.tslibs/cli/src/__tests__/args.spec.tsapps/e2e/demo-e2e-serverless/jest.e2e.config.tsapps/e2e/demo-e2e-public/jest.e2e.config.tsjest.e2e.coverage.preset.jslibs/plugins/src/codecall/__tests__/tool-call.errors.test.ts.github/workflows/push.yml.nycrc.jsonapps/e2e/demo-e2e-orchestrated/jest.e2e.config.ts
📚 Learning: 2025-12-19T02:04:46.475Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.475Z
Learning: Applies to **/*.test.{ts,tsx} : Test all code paths including error cases and constructor validation
Applied to files:
apps/e2e/demo-e2e-multiapp/jest.e2e.config.tsapps/e2e/demo-e2e-redis/jest.e2e.config.tslibs/mcp-from-openapi/src/__tests__/generator.spec.tslibs/cli/src/commands/test.tsapps/e2e/demo-e2e-errors/jest.e2e.config.tsapps/e2e/demo-e2e-transparent/jest.e2e.config.tsapps/e2e/demo-e2e-codecall/jest.e2e.config.tslibs/cli/src/__tests__/args.spec.tsapps/e2e/demo-e2e-serverless/jest.e2e.config.tsapps/e2e/demo-e2e-public/jest.e2e.config.tsjest.e2e.coverage.preset.jslibs/plugins/src/codecall/__tests__/tool-call.errors.test.ts.nycrc.json
📚 Learning: 2025-12-24T00:41:55.397Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-24T00:41:55.397Z
Learning: Applies to libs/uipack/src/*/index.ts : Implement entry point re-exports in index.ts files for each module (adapters, build, bundler, etc.)
Applied to files:
apps/e2e/demo-e2e-redis/jest.e2e.config.tsjest.e2e.coverage.preset.js
📚 Learning: 2025-12-19T02:04:46.475Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.475Z
Learning: Applies to libs/sdk/src/**/index.ts : Export public API through barrel files - export users' needed items, no legacy exports with different names
Applied to files:
apps/e2e/demo-e2e-redis/jest.e2e.config.tsjest.e2e.coverage.preset.js
📚 Learning: 2025-12-19T02:04:46.475Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.475Z
Learning: Applies to **/*.ts : Avoid non-null assertions (`!`) - use proper error handling and throw specific errors instead
Applied to files:
apps/e2e/demo-e2e-redis/jest.e2e.config.tslibs/plugins/src/codecall/__tests__/tool-call.errors.test.ts
📚 Learning: 2025-12-24T00:41:41.819Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-24T00:41:41.819Z
Learning: Applies to libs/ui/src/bundler/**/*.{ts,tsx} : The bundler module must re-export utilities from frontmcp/uipack/bundler and provide SSR component bundling functionality
Applied to files:
apps/e2e/demo-e2e-redis/jest.e2e.config.ts
📚 Learning: 2025-12-19T02:04:46.475Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.475Z
Learning: Applies to libs/sdk/src/**/*.ts : Use `getCapabilities()` method for dynamic capability exposure instead of hardcoding capabilities
Applied to files:
apps/e2e/demo-e2e-redis/jest.e2e.config.ts
📚 Learning: 2025-12-24T00:41:55.397Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-24T00:41:55.397Z
Learning: Applies to libs/uipack/src/{renderers,utils,base-template,tool-template,runtime}/**/*.test.{ts,tsx,js,jsx} : Test HTML escaping for user-provided content in security-critical paths
Applied to files:
apps/e2e/demo-e2e-redis/jest.e2e.config.ts
📚 Learning: 2025-12-24T00:41:55.397Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-24T00:41:55.397Z
Learning: Applies to libs/uipack/src/**/*.{ts,tsx} : Avoid using `any` type without justification in TypeScript
Applied to files:
apps/e2e/demo-e2e-redis/jest.e2e.config.ts
📚 Learning: 2025-12-19T02:04:46.475Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.475Z
Learning: Applies to libs/sdk/src/**/*.ts : Use specific error classes with MCP error codes instead of generic errors
Applied to files:
libs/mcp-from-openapi/src/__tests__/generator.spec.tslibs/plugins/src/codecall/__tests__/tool-call.errors.test.ts
📚 Learning: 2025-12-19T02:04:46.475Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.475Z
Learning: Applies to **/*.test.{ts,tsx} : Include error class `instanceof` checks in tests to validate error handling
Applied to files:
apps/e2e/demo-e2e-errors/jest.e2e.config.tslibs/plugins/src/codecall/__tests__/tool-call.errors.test.ts
📚 Learning: 2025-12-19T02:04:46.475Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.475Z
Learning: Applies to libs/sdk/src/common/records/**/*.ts : Centralize record types in common/records directory and import from there instead of module-specific files
Applied to files:
jest.e2e.coverage.preset.js
📚 Learning: 2025-12-24T00:41:41.819Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-24T00:41:41.819Z
Learning: Applies to libs/ui/src/**/*.test.{ts,tsx} : Use React Testing Library for component tests and include SSR/hydration tests for all interactive components
Applied to files:
jest.e2e.coverage.preset.js
📚 Learning: 2025-12-19T02:04:46.475Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.475Z
Learning: Applies to libs/sdk/src/**/*.ts : Validate hook flows and fail fast on invalid hook configurations with specific error messages
Applied to files:
libs/plugins/src/codecall/__tests__/tool-call.errors.test.ts
📚 Learning: 2025-12-24T00:41:55.397Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-24T00:41:55.397Z
Learning: Achieve 95%+ test coverage across statements, branches, functions, and lines
Applied to files:
.github/workflows/push.yml.nycrc.json
📚 Learning: 2025-12-19T02:04:46.475Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.475Z
Learning: Ensure all builds complete without TypeScript warnings and 100% test pass rate is required
Applied to files:
.github/workflows/push.yml.nycrc.json
🧬 Code graph analysis (4)
libs/cli/src/commands/test.ts (1)
libs/cli/src/colors.ts (1)
c(13-13)
libs/plugins/src/cache/__tests__/cache-redis.provider.test.ts (1)
libs/plugins/src/cache/cache.types.ts (1)
RedisCacheOptions(69-69)
libs/cli/src/__tests__/args.spec.ts (1)
libs/cli/src/args.ts (1)
parseArgs(34-58)
libs/plugins/src/codecall/__tests__/tool-call.errors.test.ts (1)
libs/plugins/src/codecall/errors/tool-call.errors.ts (5)
TOOL_CALL_ERROR_CODES(7-14)createToolCallError(51-60)SelfReferenceError(121-131)ToolAccessDeniedError(137-149)ToolNotFoundError(155-165)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Lint & Format Checks
- GitHub Check: Build Libraries
🔇 Additional comments (30)
libs/mcp-from-openapi/src/__tests__/generator.spec.ts (1)
80-308: Excellent test coverage expansion!These additions significantly improve test coverage with comprehensive scenarios:
- URL/file loading with multiple error conditions (HTTP errors, network failures, missing content-types)
- Custom naming strategies and conflict resolution
- Extensive parameter resolver coverage (security types, content-types, deprecated params, style/explode)
- Security requirements (bearer, apiKey, oauth2, openIdConnect, including edge cases)
- Metadata extraction (externalDocs, x-frontmcp extensions, servers)
- Operation filtering strategies
- Error handling paths (missing operations, validation failures, generation errors)
The test quality aligns well with the learning that requires 95%+ coverage across all metrics and testing all code paths including error cases.
Based on learnings, 95%+ test coverage is required across statements, branches, functions, and lines, with all code paths including error cases tested.
Also applies to: 310-323, 325-392, 834-1012, 1015-1516
libs/plugins/src/codecall/errors/tool-call.errors.ts (1)
147-147: Excellent fix! Consistent immutability across all error classes.The addition of
Object.freeze(this)to bothToolAccessDeniedErrorandToolNotFoundErroraddresses the past review feedback and ensures all three internal error classes have uniform freeze behavior. This prevents tampering with error properties and strengthens the security guarantees of the error handling system.Also applies to: 163-163
libs/plugins/src/codecall/__tests__/tool-call.errors.test.ts (6)
13-22: LGTM!The error codes constant is thoroughly tested with all six codes verified.
134-139: LGTM! Justified use ofas anyfor testing the default error case.The type assertion to
anyis appropriately used here to test the fallback behavior when an unknown error code is passed at runtime. This tests the default branch in the switch statement and ensures graceful degradation.
142-162: LGTM!Comprehensive testing of
SelfReferenceErrorwith property validation,instanceofchecks, and immutability verification. This aligns with the coding guidelines for testing error classes.
164-183: Excellent! Addresses past review feedback.The immutability test (lines 179-182) directly addresses the past review comment that flagged missing immutability tests for
ToolAccessDeniedError. The test suite now comprehensively covers properties,instanceofchecks, and immutability.
185-203: Excellent! Addresses past review feedback.The immutability test (lines 199-202) directly addresses the past review comment that flagged missing immutability tests for
ToolNotFoundError. The test suite now comprehensively covers properties,instanceofchecks, and immutability.
1-203: Outstanding test coverage that aligns with all coding guidelines.This comprehensive test suite achieves the 95%+ coverage requirement and thoroughly tests:
- All error codes and their message generation
- Message sanitization with various edge cases (Unix/Windows paths, line numbers, stack traces, truncation)
- All three error classes with property validation,
instanceofchecks, and immutability verification- Error handling for unknown error codes
The tests directly address the past review feedback by adding immutability tests for
ToolAccessDeniedErrorandToolNotFoundError, and the corresponding source file changes ensure all error classes are consistently frozen.Based on learnings from coding guidelines for this repository.
apps/e2e/demo-e2e-redis/jest.e2e.config.ts (1)
3-4: Preset loading pattern is appropriate for Jest configuration.The require statement for loading the coverage preset is appropriate in this context, as Jest configuration files commonly use CommonJS module resolution for preset loading. The ESLint disable comment is justified.
apps/e2e/demo-e2e-errors/jest.e2e.config.ts (1)
3-4: Coverage integration follows established pattern.The coverage preset integration and directory configuration are consistent with other e2e test suites in the project. The require statement is appropriate for Jest configuration loading.
Also applies to: 39-40
apps/e2e/demo-e2e-cache/jest.e2e.config.ts (1)
3-4: Coverage configuration is consistent across e2e suites.The implementation matches the pattern used by other demo-e2e configurations, providing uniform coverage collection and reporting.
Also applies to: 39-40
apps/e2e/demo-e2e-multiapp/jest.e2e.config.ts (1)
3-4: Coverage integration is properly configured.The coverage preset and directory configuration follow the established pattern across all e2e test suites.
Also applies to: 39-40
.nycrc.json (1)
1-21: NYC configuration aligns with project coverage requirements.The configuration correctly:
- Sets 95% thresholds across all metrics (statements, branches, functions, lines), meeting the project's coverage standards from learnings
- Specifically excludes only
libs/adapters/src/index.tsandlibs/plugins/src/index.ts(lines 7-8), avoiding the blanket!**/index.tsexclusion that would incorrectly omit executable code inlibs/sdk/src/index.ts- Configures appropriate reporters and output directories
Based on learnings, this meets the requirement for 95%+ test coverage across all metrics.
.github/workflows/push.yml (4)
186-193: Coverage job is appropriately scoped to main branch.The coverage job correctly:
- Runs only on the main branch to avoid redundant coverage collection on feature branches
- Depends on prior build, unit-tests, and e2e-tests jobs to ensure code quality before coverage analysis
214-219: Verify test execution strategy for coverage collection.The coverage job re-runs all unit and E2E tests with
--coverageflag. This means tests are executed twice: once in the dedicated test jobs (without coverage) and again here (with coverage).While this approach isolates coverage collection, it increases CI time. Consider whether the earlier
unit-testsande2e-testsjobs should collect coverage directly, or if this separation is intentional for performance reasons (running core tests faster without coverage overhead).
224-228: Codecov upload is configured to not fail the build.Line 227 sets
fail_ci_if_error: false, meaning Codecov upload failures won't block the pipeline. This is reasonable for preventing external service issues from breaking builds, but note that coverage quality enforcement relies solely on the local threshold check (line 231).
230-231: Coverage threshold enforcement meets project standards.The threshold check enforces 95% across all metrics (statements, branches, functions, lines), aligning with project learnings and requirements. Since there's no
continue-on-errorflag, the workflow will fail if coverage drops below these thresholds.Based on learnings, this correctly enforces the 95%+ test coverage requirement.
apps/e2e/demo-e2e-codecall/jest.e2e.config.ts (1)
3-4: Coverage configuration follows project-wide pattern.The implementation is consistent with other e2e test configurations, enabling centralized coverage collection and reporting.
Also applies to: 39-40
apps/e2e/demo-e2e-serverless/jest.e2e.config.ts (1)
3-4: Coverage integration completed for serverless e2e suite.The configuration matches the pattern established across all other e2e test suites, providing uniform coverage collection.
Also applies to: 39-40
apps/e2e/demo-e2e-orchestrated/jest.e2e.config.ts (1)
1-2: LGTM: Coverage preset integration is correct.The coverage preset is imported via
require()and merged into the Jest config. ThecoverageDirectoryis set before the preset spread, and since the preset (as shown injest.e2e.coverage.preset.js) doesn't definecoverageDirectory, there's no conflict. The pattern is consistent with other e2e demo configs in this PR.Also applies to: 49-50
libs/cli/src/cli.ts (1)
51-51: LGTM: Help text addition is accurate and consistent.The coverage flag documentation is correctly placed in the Test Options section and matches the implementation.
apps/e2e/demo-e2e-transparent/jest.e2e.config.ts (1)
3-4: LGTM: Coverage preset integration follows established pattern.The implementation is consistent with other e2e configs in this PR and properly typed with
Config.InitialOptions.Also applies to: 39-40
libs/cli/src/args.ts (2)
25-25: LGTM: Interface extension is correct.The
coveragefield is properly typed as an optional boolean, consistent with other test-related flags.
48-48: LGTM: Flag parsing implementation is correct.The parsing logic for
--coverageand-cfollows the same pattern as other boolean flags in this function.apps/e2e/demo-e2e-public/jest.e2e.config.ts (1)
3-4: LGTM: Coverage preset integration is consistent.The implementation matches the pattern used across all e2e demo configs in this PR.
Also applies to: 39-40
libs/cli/src/commands/test.ts (2)
140-143: LGTM: Coverage flag handling is implemented correctly.The coverage flag is properly passed to Jest and logged for user visibility.
Also applies to: 162-164
69-79: ThecollectCoverageFrompattern is correct as-is.All projects in the repository (libs, apps, and e2e subdirectories) consistently use a
src/directory structure. The pattern<rootDir>/src/**/*.tsis well-founded and requires no changes.Likely an incorrect or invalid review comment.
libs/cli/src/__tests__/args.spec.ts (2)
190-205: LGTM: Coverage flag tests are comprehensive.The tests cover all scenarios: long form (
--coverage), short form (-c), and absence of the flag. The assertions correctly validate both presence and absence.
227-236: LGTM: Integration test validates multi-flag scenarios.The combined flags test ensures the coverage flag works correctly alongside other test command flags.
jest.e2e.coverage.preset.js (1)
1-20: LGTM: E2E coverage preset is well-structured with clear intent.The configuration is appropriate for E2E coverage aggregation:
- JSON-only reporter enables merging coverage across e2e suites
- The exclusion pattern correctly omits test files
- The comment clearly explains why
sdk/index.tsis included (executable code) while barrel exports in adapters/plugins are excludedBased on learnings, ensure that the coverage thresholds (95%+ across all metrics) are enforced at the aggregation level, which appears to be handled by
.nycrc.jsonmentioned in the PR summary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (10)
apps/e2e/demo-e2e-notifications/jest.e2e.config.ts (2)
2-5: Add type safety and error handling for external preset loading.Same issue as in
demo-e2e-openapi: Therequire()call returnsanywithout type safety or error handling.See the proposed fix in the review comment for
apps/e2e/demo-e2e-openapi/jest.e2e.config.ts(lines 2-5).
40-41: Critical: Verify preset spread order doesn't overridecoverageDirectory.Same property override concern as in
demo-e2e-openapi. The spread order could cause all apps to share the same coverage directory.apps/e2e/demo-e2e-multiapp/jest.e2e.config.ts (2)
2-5: Add type safety and error handling for external preset loading.Same type safety and error handling issues as other E2E configs.
40-41: Critical: Verify preset spread order doesn't overridecoverageDirectory.Same property override concern across all E2E configs.
apps/e2e/demo-e2e-codecall/jest.e2e.config.ts (2)
2-5: Add type safety and error handling for external preset loading.Same type safety and error handling issues as other E2E configs.
40-41: Critical: Verify preset spread order doesn't overridecoverageDirectory.Same property override concern across all E2E configs.
apps/e2e/demo-e2e-cache/jest.e2e.config.ts (2)
2-5: Add type safety and error handling for external preset loading.Same type safety and error handling issues as other E2E configs.
40-41: Critical: Verify preset spread order doesn't overridecoverageDirectory.Same property override concern across all E2E configs.
apps/e2e/demo-e2e-serverless/jest.e2e.config.ts (2)
2-5: Add type safety and error handling for external preset loading.Same type safety and error handling issues as other E2E configs.
40-41: Critical: Verify preset spread order doesn't overridecoverageDirectory.Same property override concern across all E2E configs.
🧹 Nitpick comments (1)
libs/plugins/src/codecall/__tests__/audit-logger.service.test.ts (1)
121-121: Consider replacinganytype assertions with proper types.Throughout the test suite, event data is cast to
anyto access event-specific properties. This bypasses TypeScript's type safety and violates the coding guideline requiring strict typing.Consider defining specific interfaces for each event type's data payload and using type guards or typed helper functions instead. For example:
interface ExecutionStartData { scriptHash: string; scriptLength: number; } // Then in tests: const data = receivedEvents[0].data as ExecutionStartData; expect(data.scriptHash).toMatch(/^sh_[0-9a-f]{8}$/);This provides type safety, better IDE support, and catches potential issues at compile time.
As per coding guidelines: "Use strict TypeScript mode with no
anytypes without strong justification - useunknowninstead for generic type defaults."Also applies to: 149-149, 167-167, 191-191, 215-215, 227-227, 240-240, 249-249, 262-262, 274-274, 287-287, 299-299, 312-312, 321-321, 341-341, 350-350, 363-363, 374-374, 383-383, 394-394, 404-404, 414-414, 426-427, 437-438
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (15)
apps/e2e/demo-e2e-cache/jest.e2e.config.tsapps/e2e/demo-e2e-codecall/jest.e2e.config.tsapps/e2e/demo-e2e-errors/jest.e2e.config.tsapps/e2e/demo-e2e-hooks/jest.e2e.config.tsapps/e2e/demo-e2e-multiapp/jest.e2e.config.tsapps/e2e/demo-e2e-notifications/jest.e2e.config.tsapps/e2e/demo-e2e-openapi/jest.e2e.config.tsapps/e2e/demo-e2e-orchestrated/jest.e2e.config.tsapps/e2e/demo-e2e-providers/jest.e2e.config.tsapps/e2e/demo-e2e-public/jest.e2e.config.tsapps/e2e/demo-e2e-redis/jest.e2e.config.tsapps/e2e/demo-e2e-serverless/jest.e2e.config.tsapps/e2e/demo-e2e-transparent/jest.e2e.config.tsapps/e2e/demo-e2e-ui/jest.e2e.config.tslibs/plugins/src/codecall/__tests__/audit-logger.service.test.ts
🚧 Files skipped from review as they are similar to previous changes (8)
- apps/e2e/demo-e2e-ui/jest.e2e.config.ts
- apps/e2e/demo-e2e-public/jest.e2e.config.ts
- apps/e2e/demo-e2e-transparent/jest.e2e.config.ts
- apps/e2e/demo-e2e-redis/jest.e2e.config.ts
- apps/e2e/demo-e2e-errors/jest.e2e.config.ts
- apps/e2e/demo-e2e-providers/jest.e2e.config.ts
- apps/e2e/demo-e2e-hooks/jest.e2e.config.ts
- apps/e2e/demo-e2e-orchestrated/jest.e2e.config.ts
🧰 Additional context used
📓 Path-based instructions (3)
**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.ts: Use strict TypeScript mode with noanytypes without strong justification - useunknowninstead for generic type defaults
Avoid non-null assertions (!) - use proper error handling and throw specific errors instead
Use type parameters with constraints instead of unconstrained generics
Do not mutate rawInput in flows - use state.set() for managing flow state instead
Files:
apps/e2e/demo-e2e-multiapp/jest.e2e.config.tsapps/e2e/demo-e2e-cache/jest.e2e.config.tsapps/e2e/demo-e2e-openapi/jest.e2e.config.tsapps/e2e/demo-e2e-serverless/jest.e2e.config.tsapps/e2e/demo-e2e-codecall/jest.e2e.config.tsapps/e2e/demo-e2e-notifications/jest.e2e.config.tslibs/plugins/src/codecall/__tests__/audit-logger.service.test.ts
**/*.test.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.test.{ts,tsx}: Achieve 95%+ test coverage across all metrics (statements, branches, functions, lines)
Test all code paths including error cases and constructor validation
Include error classinstanceofchecks in tests to validate error handling
Files:
libs/plugins/src/codecall/__tests__/audit-logger.service.test.ts
libs/**
⚙️ CodeRabbit configuration file
libs/**: Contains publishable SDK libraries. Review for API correctness, breaking changes, and consistency with docs. When public APIs change, ensure there is a matching docs/draft/docs/** update (not direct edits under docs/docs/**).
Files:
libs/plugins/src/codecall/__tests__/audit-logger.service.test.ts
🧠 Learnings (11)
📓 Common learnings
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.475Z
Learning: Applies to **/*.test.{ts,tsx} : Achieve 95%+ test coverage across all metrics (statements, branches, functions, lines)
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-24T00:41:41.819Z
Learning: Applies to libs/ui/src/**/*.test.{ts,tsx} : Test coverage must be 95%+ across statements, branches, functions, and lines
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-24T00:41:55.397Z
Learning: Applies to libs/uipack/src/{adapters,theme,build}/**/*.test.{ts,tsx,js,jsx} : Test component behavior across all platform configurations (OpenAI, Claude, etc.)
📚 Learning: 2025-12-19T02:04:46.475Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.475Z
Learning: Applies to **/*.test.{ts,tsx} : Achieve 95%+ test coverage across all metrics (statements, branches, functions, lines)
Applied to files:
apps/e2e/demo-e2e-multiapp/jest.e2e.config.tsapps/e2e/demo-e2e-openapi/jest.e2e.config.tsapps/e2e/demo-e2e-serverless/jest.e2e.config.tsapps/e2e/demo-e2e-codecall/jest.e2e.config.tsapps/e2e/demo-e2e-notifications/jest.e2e.config.tslibs/plugins/src/codecall/__tests__/audit-logger.service.test.ts
📚 Learning: 2025-12-24T00:41:55.397Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-24T00:41:55.397Z
Learning: Applies to libs/uipack/src/{adapters,theme,build}/**/*.test.{ts,tsx,js,jsx} : Test component behavior across all platform configurations (OpenAI, Claude, etc.)
Applied to files:
apps/e2e/demo-e2e-multiapp/jest.e2e.config.tsapps/e2e/demo-e2e-cache/jest.e2e.config.tsapps/e2e/demo-e2e-openapi/jest.e2e.config.tsapps/e2e/demo-e2e-serverless/jest.e2e.config.tsapps/e2e/demo-e2e-codecall/jest.e2e.config.tsapps/e2e/demo-e2e-notifications/jest.e2e.config.tslibs/plugins/src/codecall/__tests__/audit-logger.service.test.ts
📚 Learning: 2025-12-24T00:41:41.819Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-24T00:41:41.819Z
Learning: Applies to libs/ui/src/**/*.test.{ts,tsx} : Test coverage must be 95%+ across statements, branches, functions, and lines
Applied to files:
apps/e2e/demo-e2e-multiapp/jest.e2e.config.tsapps/e2e/demo-e2e-openapi/jest.e2e.config.tsapps/e2e/demo-e2e-serverless/jest.e2e.config.tsapps/e2e/demo-e2e-codecall/jest.e2e.config.tsapps/e2e/demo-e2e-notifications/jest.e2e.config.tslibs/plugins/src/codecall/__tests__/audit-logger.service.test.ts
📚 Learning: 2025-12-19T02:04:46.475Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.475Z
Learning: Applies to **/*.test.{ts,tsx} : Test all code paths including error cases and constructor validation
Applied to files:
apps/e2e/demo-e2e-multiapp/jest.e2e.config.tsapps/e2e/demo-e2e-openapi/jest.e2e.config.tslibs/plugins/src/codecall/__tests__/audit-logger.service.test.ts
📚 Learning: 2025-12-19T02:04:46.475Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.475Z
Learning: Applies to libs/sdk/src/**/index.ts : Export public API through barrel files - export users' needed items, no legacy exports with different names
Applied to files:
apps/e2e/demo-e2e-openapi/jest.e2e.config.ts
📚 Learning: 2025-12-24T00:41:55.397Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-24T00:41:55.397Z
Learning: Applies to libs/uipack/src/*/index.ts : Implement entry point re-exports in index.ts files for each module (adapters, build, bundler, etc.)
Applied to files:
apps/e2e/demo-e2e-serverless/jest.e2e.config.ts
📚 Learning: 2025-12-24T00:41:55.397Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-24T00:41:55.397Z
Learning: Applies to libs/uipack/src/{renderers,utils,base-template,tool-template,runtime}/**/*.test.{ts,tsx,js,jsx} : Test HTML escaping for user-provided content in security-critical paths
Applied to files:
libs/plugins/src/codecall/__tests__/audit-logger.service.test.ts
📚 Learning: 2025-12-19T02:04:46.475Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.475Z
Learning: Applies to **/*.test.{ts,tsx} : Include error class `instanceof` checks in tests to validate error handling
Applied to files:
libs/plugins/src/codecall/__tests__/audit-logger.service.test.ts
📚 Learning: 2025-12-24T00:41:55.397Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-24T00:41:55.397Z
Learning: Achieve 95%+ test coverage across statements, branches, functions, and lines
Applied to files:
libs/plugins/src/codecall/__tests__/audit-logger.service.test.ts
📚 Learning: 2025-12-24T00:41:41.819Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-24T00:41:41.819Z
Learning: Applies to libs/ui/src/**/*.test.{ts,tsx} : SSR components must be tested for correct HTML output and client-side hydration must be tested separately
Applied to files:
libs/plugins/src/codecall/__tests__/audit-logger.service.test.ts
🧬 Code graph analysis (1)
libs/plugins/src/codecall/__tests__/audit-logger.service.test.ts (1)
libs/plugins/src/codecall/services/audit-logger.service.ts (2)
AUDIT_EVENT_TYPES(8-38)AuditEvent(45-56)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Build Libraries
- GitHub Check: Lint & Format Checks
🔇 Additional comments (2)
libs/plugins/src/codecall/__tests__/audit-logger.service.test.ts (1)
1-480: Excellent test coverage addressing all previous concerns.The test suite comprehensively covers the AuditLoggerService with all previously requested edge cases now included:
- Stack trace sanitization with multi-line errors (lines 354-368)
- Line number removal with explicit patterns (lines 370-377)
- Hash algorithm edge cases including empty strings, very long strings, and unicode (lines 389-441)
- Execution ID uniqueness under stress with 1000+ consecutive calls (lines 443-479)
All public methods are tested with normal paths, edge cases, error conditions, and data validation. Immutability is verified and listener isolation is confirmed. This should comfortably achieve the required 95%+ coverage across all metrics.
apps/e2e/demo-e2e-openapi/jest.e2e.config.ts (1)
40-41: No issue found: preset does not definecoverageDirectory.The
jest.e2e.coverage.preset.jsfile contains onlycoverageReportersandcollectCoverageFromproperties. Since the preset does not definecoverageDirectory, the spread operator cannot override the app-specific path defined at line 40. The configuration is correct as written.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
libs/mcp-from-openapi/src/__tests__/security-resolver.spec.ts (1)
360-376: Add a clarifying comment for theas anycast.The use of
as anyon line 368 is reasonable for testing unknown type handling, but per coding guidelines, a comment explaining why it's necessary would improve clarity.🔎 Suggested addition
it('should handle unknown security type', async () => { const mappers: ParameterMapper[] = [ { inputKey: 'Auth', key: 'Auth', type: 'header', security: { scheme: 'unknownScheme', + // Using 'as any' to test graceful handling of invalid security types type: 'unknown' as any, }, }, ];
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
libs/mcp-from-openapi/src/__tests__/security-resolver.spec.ts
🧰 Additional context used
📓 Path-based instructions (2)
**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.ts: Use strict TypeScript mode with noanytypes without strong justification - useunknowninstead for generic type defaults
Avoid non-null assertions (!) - use proper error handling and throw specific errors instead
Use type parameters with constraints instead of unconstrained generics
Do not mutate rawInput in flows - use state.set() for managing flow state instead
Files:
libs/mcp-from-openapi/src/__tests__/security-resolver.spec.ts
libs/**
⚙️ CodeRabbit configuration file
libs/**: Contains publishable SDK libraries. Review for API correctness, breaking changes, and consistency with docs. When public APIs change, ensure there is a matching docs/draft/docs/** update (not direct edits under docs/docs/**).
Files:
libs/mcp-from-openapi/src/__tests__/security-resolver.spec.ts
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.475Z
Learning: Applies to **/*.test.{ts,tsx} : Achieve 95%+ test coverage across all metrics (statements, branches, functions, lines)
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-24T00:41:41.819Z
Learning: Applies to libs/ui/src/**/*.test.{ts,tsx} : Test coverage must be 95%+ across statements, branches, functions, and lines
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-24T00:41:55.397Z
Learning: Applies to libs/uipack/src/{adapters,theme,build}/**/*.test.{ts,tsx,js,jsx} : Test component behavior across all platform configurations (OpenAI, Claude, etc.)
📚 Learning: 2025-12-19T02:04:46.475Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.475Z
Learning: Applies to **/*.test.{ts,tsx} : Test all code paths including error cases and constructor validation
Applied to files:
libs/mcp-from-openapi/src/__tests__/security-resolver.spec.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Build Libraries
- GitHub Check: Lint & Format Checks
🔇 Additional comments (9)
libs/mcp-from-openapi/src/__tests__/security-resolver.spec.ts (9)
1-13: LGTM! Clean test setup.The imports and test setup follow best practices with proper type imports and test isolation via
beforeEach.
15-85: LGTM! Comprehensive coverage of basic resolve scenarios.The tests effectively cover empty mappers, non-security parameter skipping, context-based security (certificates, cookies), and bearer authentication. All assertions are precise and appropriate.
87-336: LGTM! Excellent coverage of authentication types.The tests comprehensively cover all major authentication schemes (Basic, Digest, API Key in multiple locations, OAuth2, OpenID Connect, custom resolvers, named API keys, and custom headers). Each test properly validates the expected output format.
338-358: LGTM! Solid error handling and edge case coverage.The tests effectively verify signature detection, unknown type/scheme handling, and missing authentication value scenarios. The resolver correctly handles these edge cases without throwing errors.
Also applies to: 378-418
421-486: LGTM! Thorough validation of missing security detection.The
checkMissingSecuritytests properly verify detection of unresolved security schemes while correctly skipping non-security parameters.
489-574: LGTM! Excellent signRequest error handling.The tests cover successful signature generation with header preservation, proper error handling when
signatureGeneratoris missing (line 542), and correct skipping of non-signature security parameters.
577-602: LGTM! Validates minimal Digest auth formatting.The test correctly verifies that Digest authentication works with only username and password fields, ensuring graceful handling of partial Digest configurations.
605-677: LGTM! Comprehensive edge case coverage.Excellent coverage of edge cases including async custom resolvers, undefined return values with fallback behavior, and sensible defaults for missing httpScheme. These tests ensure robust handling of various real-world scenarios.
681-716: LGTM! Complete createSecurityContext validation.The tests thoroughly verify the
createSecurityContexthelper function with partial auth, full auth types (including custom resolver functions), and empty auth objects. Good coverage of the context creation API.
…uity and state preservation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🧹 Nitpick comments (6)
apps/e2e/demo-e2e-transport-recreation/src/apps/transport-test/tools/get-session-info.tool.ts (1)
22-41: Optimize redundant map access.The counter is accessed three times: initialization check (line 28), increment (line 33), and return (line 39). The value retrieved and incremented on lines 33-34 should be reused in the return statement instead of accessing the map again on line 39.
🔎 Proposed refactor
async execute(_input: z.input<typeof inputSchema>): Promise<z.infer<typeof outputSchema>> { const authInfo = this.getAuthInfo(); const sessionId = authInfo.sessionId ?? 'no-session'; const hasSession = !!authInfo.sessionId; // Initialize counter if needed if (!sessionRequestCounts.has(sessionId)) { sessionRequestCounts.set(sessionId, 0); } // Increment request count - const currentCount = sessionRequestCounts.get(sessionId) ?? 0; - sessionRequestCounts.set(sessionId, currentCount + 1); + const currentCount = sessionRequestCounts.get(sessionId)!; + const newCount = currentCount + 1; + sessionRequestCounts.set(sessionId, newCount); return { sessionId, hasSession, - requestCount: sessionRequestCounts.get(sessionId) ?? 0, + requestCount: newCount, }; }apps/e2e/demo-e2e-transport-recreation/tsconfig.app.json (1)
9-10: Remove duplicate decorator configuration.
emitDecoratorMetadataandexperimentalDecoratorsare already enabled in the parenttsconfig.json(lines 4-5), making these settings redundant.🔎 Proposed refactor
{ "extends": "./tsconfig.json", "compilerOptions": { "outDir": "../../../dist/out-tsc", "module": "NodeNext", "moduleResolution": "NodeNext", "jsx": "react-jsx", - "types": ["node"], - "emitDecoratorMetadata": true, - "experimentalDecorators": true + "types": ["node"] }, "exclude": ["jest.config.ts", "jest.e2e.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts", "e2e/**/*.ts"], "include": ["src/**/*.ts", "src/**/*.tsx"] }apps/e2e/demo-e2e-transport-recreation/src/apps/transport-test/tools/increment-counter.tool.ts (2)
28-28: Use consistent authInfo access pattern.This file accesses
this.authInfodirectly (line 28), while the companionGetSessionInfoToolusesthis.getAuthInfo()(get-session-info.tool.ts, line 23). Use a consistent pattern across both tools for maintainability.🔎 Proposed fix for consistency
async execute(input: z.infer<typeof inputSchema>): Promise<z.infer<typeof outputSchema>> { - const sessionId = this.authInfo.sessionId ?? 'no-session'; + const authInfo = this.getAuthInfo(); + const sessionId = authInfo.sessionId ?? 'no-session'; const amount = input.amount ?? 1;
29-29: Remove unnecessary default fallback.The input schema already defines
.default(1)for theamountfield (line 6), so Zod will automatically provide the default value whenamountisundefined. The?? 1fallback is redundant.🔎 Proposed refactor
async execute(input: z.infer<typeof inputSchema>): Promise<z.infer<typeof outputSchema>> { const sessionId = this.authInfo.sessionId ?? 'no-session'; - const amount = input.amount ?? 1; + const amount = input.amount;apps/e2e/demo-e2e-transport-recreation/e2e/transport-recreation.e2e.test.ts (1)
84-84: JSON string matching in assertions may be fragile.While more specific than bare number matching, checking for JSON fragments like
'"previousValue":10'can still break if the response format changes (e.g., whitespace variations, field ordering). Consider parsing the response as JSON and asserting on structured data, or verify that the testing framework normalizes JSON formatting.🔎 Alternative approach using structured assertions
If the testing framework provides access to parsed response data, prefer:
// Example of more robust assertion if response is accessible as JSON const responseData = JSON.parse(result.content[0].text); expect(responseData.previousValue).toBe(10); expect(responseData.incrementedBy).toBe(1);Otherwise, ensure the current string matching approach is documented as expecting specific JSON formatting from the MCP protocol.
Also applies to: 107-107
apps/e2e/demo-e2e-transport-recreation/project.json (1)
41-41: Consider removingpassWithNoTests: trueafter initial development.While
passWithNoTests: trueis useful during initial setup, it can hide issues where tests are accidentally not discovered or executed. Since this PR adds actual e2e tests (transport-recreation.e2e.test.ts), consider whether this option should remain enabled.Also applies to: 50-50
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (14)
apps/e2e/demo-e2e-transport-recreation/e2e/transport-recreation.e2e.test.tsapps/e2e/demo-e2e-transport-recreation/jest.e2e.config.tsapps/e2e/demo-e2e-transport-recreation/project.jsonapps/e2e/demo-e2e-transport-recreation/src/apps/transport-test/index.tsapps/e2e/demo-e2e-transport-recreation/src/apps/transport-test/tools/get-session-info.tool.tsapps/e2e/demo-e2e-transport-recreation/src/apps/transport-test/tools/increment-counter.tool.tsapps/e2e/demo-e2e-transport-recreation/src/main.tsapps/e2e/demo-e2e-transport-recreation/tsconfig.app.jsonapps/e2e/demo-e2e-transport-recreation/tsconfig.jsonapps/e2e/demo-e2e-transport-recreation/webpack.config.jslibs/sdk/src/transport/__tests__/transport.registry.test.tslibs/sdk/src/transport/adapters/__tests__/sse-transport.test.tslibs/sdk/src/transport/adapters/__tests__/streamable-http-transport.test.tslibs/sdk/src/transport/adapters/streamable-http-transport.ts
🧰 Additional context used
📓 Path-based instructions (4)
**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.ts: Use strict TypeScript mode with noanytypes without strong justification - useunknowninstead for generic type defaults
Avoid non-null assertions (!) - use proper error handling and throw specific errors instead
Use type parameters with constraints instead of unconstrained generics
Do not mutate rawInput in flows - use state.set() for managing flow state instead
Files:
apps/e2e/demo-e2e-transport-recreation/src/apps/transport-test/index.tslibs/sdk/src/transport/adapters/__tests__/streamable-http-transport.test.tsapps/e2e/demo-e2e-transport-recreation/e2e/transport-recreation.e2e.test.tsapps/e2e/demo-e2e-transport-recreation/jest.e2e.config.tsapps/e2e/demo-e2e-transport-recreation/src/main.tsapps/e2e/demo-e2e-transport-recreation/src/apps/transport-test/tools/get-session-info.tool.tslibs/sdk/src/transport/__tests__/transport.registry.test.tslibs/sdk/src/transport/adapters/streamable-http-transport.tsapps/e2e/demo-e2e-transport-recreation/src/apps/transport-test/tools/increment-counter.tool.tslibs/sdk/src/transport/adapters/__tests__/sse-transport.test.ts
**/*.test.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.test.{ts,tsx}: Achieve 95%+ test coverage across all metrics (statements, branches, functions, lines)
Test all code paths including error cases and constructor validation
Include error classinstanceofchecks in tests to validate error handling
Files:
libs/sdk/src/transport/adapters/__tests__/streamable-http-transport.test.tsapps/e2e/demo-e2e-transport-recreation/e2e/transport-recreation.e2e.test.tslibs/sdk/src/transport/__tests__/transport.registry.test.tslibs/sdk/src/transport/adapters/__tests__/sse-transport.test.ts
libs/sdk/src/**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
libs/sdk/src/**/*.ts: MCP response types should use strict MCP protocol types (GetPromptResult, ReadResourceResult) instead ofunknown
Use specific error classes with MCP error codes instead of generic errors
UsegetCapabilities()method for dynamic capability exposure instead of hardcoding capabilities
UsechangeScopeproperty instead ofscopein change events to avoid confusion with Scope class
Validate URIs per RFC 3986 at metadata level using proper validation
Validate hook flows and fail fast on invalid hook configurations with specific error messages
Files:
libs/sdk/src/transport/adapters/__tests__/streamable-http-transport.test.tslibs/sdk/src/transport/__tests__/transport.registry.test.tslibs/sdk/src/transport/adapters/streamable-http-transport.tslibs/sdk/src/transport/adapters/__tests__/sse-transport.test.ts
libs/**
⚙️ CodeRabbit configuration file
libs/**: Contains publishable SDK libraries. Review for API correctness, breaking changes, and consistency with docs. When public APIs change, ensure there is a matching docs/draft/docs/** update (not direct edits under docs/docs/**).
Files:
libs/sdk/src/transport/adapters/__tests__/streamable-http-transport.test.tslibs/sdk/src/transport/__tests__/transport.registry.test.tslibs/sdk/src/transport/adapters/streamable-http-transport.tslibs/sdk/src/transport/adapters/__tests__/sse-transport.test.ts
🧠 Learnings (14)
📓 Common learnings
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.475Z
Learning: Applies to **/*.test.{ts,tsx} : Achieve 95%+ test coverage across all metrics (statements, branches, functions, lines)
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-24T00:41:41.819Z
Learning: Applies to libs/ui/src/**/*.test.{ts,tsx} : Test coverage must be 95%+ across statements, branches, functions, and lines
📚 Learning: 2025-12-24T00:41:55.397Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-24T00:41:55.397Z
Learning: Applies to libs/uipack/src/*/index.ts : Implement entry point re-exports in index.ts files for each module (adapters, build, bundler, etc.)
Applied to files:
apps/e2e/demo-e2e-transport-recreation/src/apps/transport-test/index.tsapps/e2e/demo-e2e-transport-recreation/webpack.config.js
📚 Learning: 2025-12-24T00:41:55.397Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-24T00:41:55.397Z
Learning: Applies to libs/uipack/src/{adapters,theme,build}/**/*.test.{ts,tsx,js,jsx} : Test component behavior across all platform configurations (OpenAI, Claude, etc.)
Applied to files:
apps/e2e/demo-e2e-transport-recreation/src/apps/transport-test/index.tslibs/sdk/src/transport/adapters/__tests__/streamable-http-transport.test.tsapps/e2e/demo-e2e-transport-recreation/e2e/transport-recreation.e2e.test.tsapps/e2e/demo-e2e-transport-recreation/jest.e2e.config.tsapps/e2e/demo-e2e-transport-recreation/tsconfig.app.jsonapps/e2e/demo-e2e-transport-recreation/tsconfig.jsonlibs/sdk/src/transport/adapters/__tests__/sse-transport.test.ts
📚 Learning: 2025-12-24T00:41:41.819Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-24T00:41:41.819Z
Learning: Applies to libs/ui/src/universal/**/*.{ts,tsx} : Universal app shell (UniversalApp, FrontMCPProvider) must provide platform-agnostic React context and initialization
Applied to files:
apps/e2e/demo-e2e-transport-recreation/src/apps/transport-test/index.ts
📚 Learning: 2025-12-19T02:04:46.475Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.475Z
Learning: Applies to **/*.test.{ts,tsx} : Test all code paths including error cases and constructor validation
Applied to files:
libs/sdk/src/transport/adapters/__tests__/streamable-http-transport.test.tslibs/sdk/src/transport/adapters/__tests__/sse-transport.test.ts
📚 Learning: 2025-12-19T02:04:46.475Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.475Z
Learning: FrontMCP is a TypeScript-first schema validation framework - all types should align with MCP protocol definitions
Applied to files:
apps/e2e/demo-e2e-transport-recreation/src/main.ts
📚 Learning: 2025-12-24T00:41:41.819Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-24T00:41:41.819Z
Learning: Applies to libs/ui/src/bundler/**/*.{ts,tsx} : The bundler module must re-export utilities from frontmcp/uipack/bundler and provide SSR component bundling functionality
Applied to files:
apps/e2e/demo-e2e-transport-recreation/webpack.config.js
📚 Learning: 2025-12-24T00:41:55.397Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/uipack/CLAUDE.md:0-0
Timestamp: 2025-12-24T00:41:55.397Z
Learning: Applies to libs/uipack/src/{theme,build,bundler,base-template}/**/*.{ts,tsx,js,jsx} : Use theme.cdn configuration instead of hard-coding CDN URLs
Applied to files:
apps/e2e/demo-e2e-transport-recreation/webpack.config.js
📚 Learning: 2025-12-19T02:04:46.475Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.475Z
Learning: Use Nx for build system with commands like `nx build sdk`, `nx test`, `nx run-many -t test`
Applied to files:
apps/e2e/demo-e2e-transport-recreation/project.json
📚 Learning: 2025-12-19T02:04:46.475Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.475Z
Learning: Applies to libs/sdk/src/common/records/**/*.ts : Centralize record types in common/records directory and import from there instead of module-specific files
Applied to files:
apps/e2e/demo-e2e-transport-recreation/tsconfig.app.jsonapps/e2e/demo-e2e-transport-recreation/tsconfig.json
📚 Learning: 2025-12-19T02:04:46.475Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.475Z
Learning: Applies to libs/sdk/src/**/index.ts : Export public API through barrel files - export users' needed items, no legacy exports with different names
Applied to files:
apps/e2e/demo-e2e-transport-recreation/tsconfig.app.json
📚 Learning: 2025-12-19T02:04:46.475Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-19T02:04:46.475Z
Learning: Applies to **/*.ts : Use strict TypeScript mode with no `any` types without strong justification - use `unknown` instead for generic type defaults
Applied to files:
apps/e2e/demo-e2e-transport-recreation/tsconfig.app.json
📚 Learning: 2025-12-24T00:41:41.819Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-24T00:41:41.819Z
Learning: Applies to libs/ui/src/**/*.test.{ts,tsx} : Use React Testing Library for component tests and include SSR/hydration tests for all interactive components
Applied to files:
apps/e2e/demo-e2e-transport-recreation/tsconfig.app.json
📚 Learning: 2025-12-24T00:41:41.819Z
Learnt from: CR
Repo: agentfront/frontmcp PR: 0
File: libs/ui/CLAUDE.md:0-0
Timestamp: 2025-12-24T00:41:41.819Z
Learning: Applies to libs/ui/src/**/*.test.{ts,tsx} : SSR components must be tested for correct HTML output and client-side hydration must be tested separately
Applied to files:
libs/sdk/src/transport/adapters/__tests__/sse-transport.test.ts
🧬 Code graph analysis (6)
libs/sdk/src/transport/adapters/__tests__/streamable-http-transport.test.ts (2)
libs/sdk/src/transport/adapters/streamable-http-transport.ts (1)
RecreateableStreamableHTTPServerTransport(58-160)libs/testing/src/client/mcp-test-client.ts (1)
sessionId(207-209)
apps/e2e/demo-e2e-transport-recreation/jest.e2e.config.ts (1)
libs/sdk/src/common/utils/decide-request-intent.utils.ts (1)
Config(58-60)
apps/e2e/demo-e2e-transport-recreation/src/main.ts (1)
apps/e2e/demo-e2e-orchestrated/src/main.ts (1)
Server(38-38)
apps/e2e/demo-e2e-transport-recreation/src/apps/transport-test/tools/get-session-info.tool.ts (3)
libs/cli/src/templates/3rd-party-integration/src/tools/example.list.ts (1)
inputSchema(12-17)apps/e2e/demo-e2e-transport-recreation/src/apps/transport-test/tools/increment-counter.tool.ts (1)
Tool(20-45)libs/testing/src/client/mcp-test-client.ts (1)
sessionId(207-209)
apps/e2e/demo-e2e-transport-recreation/src/apps/transport-test/tools/increment-counter.tool.ts (3)
libs/cli/src/templates/3rd-party-integration/src/tools/example.list.ts (1)
inputSchema(12-17)apps/e2e/demo-e2e-transport-recreation/src/apps/transport-test/tools/get-session-info.tool.ts (1)
Tool(15-42)libs/testing/src/client/mcp-test-client.ts (1)
sessionId(207-209)
libs/sdk/src/transport/adapters/__tests__/sse-transport.test.ts (1)
libs/testing/src/client/mcp-test-client.ts (1)
sessionId(207-209)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Build Libraries
- GitHub Check: Lint & Format Checks
🔇 Additional comments (11)
libs/sdk/src/transport/adapters/streamable-http-transport.ts (5)
59-63: LGTM - Well-documented deferred initialization field.The private
_pendingInitStatefield appropriately stores the sessionId when the internal transport isn't ready, which is essential for serverless cold start scenarios.
79-85: LGTM - Clean observability API.The
hasPendingInitStategetter provides a clean way to inspect whether initialization state is pending. This is useful for debugging and testing.
101-120: LGTM - Robust deferred initialization logic.The method correctly handles both immediate initialization (when transport is ready) and deferred initialization (when transport isn't ready yet). Input validation is thorough, covering empty strings, whitespace, and type checking.
122-140: LGTM - Well-designed helper with SDK version safety.The
_applyInitStatehelper centralizes the initialization logic and includes proper validation to detect MCP SDK version incompatibilities. This defensive coding will help catch breaking changes early.
142-159: LGTM - Correct first-request initialization handling.The
handleRequestoverride correctly applies any pending initialization state before delegating to the base implementation. This ensures session state is restored on the first request in serverless cold start scenarios, while still handling the edge case where the transport might not be ready.libs/sdk/src/transport/__tests__/transport.registry.test.ts (1)
637-1069: Excellent production scenario test coverage.This comprehensive test suite covers critical real-world scenarios including:
- Serverless cold starts with token validation
- Multi-instance failover with session preservation
- Security validations (token mismatches, client fingerprinting)
- Error handling (Redis failures, timeouts, corrupt data)
- Session and transport state preservation
The tests effectively validate the transport recreation mechanisms under production conditions and edge cases, ensuring robustness and reliability.
Based on learnings: Test coverage requirement of 95%+ across all metrics appears to be well-addressed by these additions.
libs/sdk/src/transport/adapters/__tests__/sse-transport.test.ts (1)
1-401: Outstanding test coverage for SSE transport recreation.This test suite provides exceptional coverage of the RecreateableSSEServerTransport with 36 tests covering:
- Constructor behavior with various options and edge cases
- Event ID counter lifecycle with comprehensive validation (negative, NaN, Infinity, non-integers, overflow)
- Session state restoration and mismatch handling
- Event ID continuity across reconnections
- Multi-instance failover scenarios
- Security validations (negative IDs, prototype pollution attempts)
The tests follow best practices by testing all code paths including error cases and constructor validation, meeting the 95%+ coverage requirement.
Based on learnings: Test coverage meets requirements - all code paths tested including error cases and constructor validation.
libs/sdk/src/transport/adapters/__tests__/streamable-http-transport.test.ts (1)
1-383: Excellent test coverage for pending initialization mechanism.This test suite provides comprehensive coverage of the RecreateableStreamableHTTPServerTransport with 34 tests, including:
- Constructor behavior and initialization state
- Pending state handling when internal transport is missing (critical for serverless cold starts)
- Deferred initialization application via handleRequest override
- Session recreation from stored state
- Multi-instance failover scenarios
- Edge cases (long IDs, unicode, special characters, idempotency)
- Thorough input validation (empty, whitespace, null, undefined session IDs)
The tests effectively validate the new pending initialization mechanism, which is the core feature of this PR, ensuring it works correctly in serverless environments.
Based on learnings: Test coverage meets requirements - all code paths tested including error cases and constructor validation, achieving 95%+ coverage across all metrics.
apps/e2e/demo-e2e-transport-recreation/e2e/transport-recreation.e2e.test.ts (2)
88-109: Good validation coverage for increment-counter tool.The input validation tests appropriately cover positive cases, negative values, zero values, and default behavior. This provides good confidence in the tool's parameter handling.
1-118: The@frontmcp/testingmodule already provides proper TypeScript types for all fixtures, matchers, and configuration options in strict mode with noanytypes. The matchers (toBeSuccessful,toHaveTextContent,toBeError,toContainTool) have correctMatcherFunctionsignatures, themcpfixture is properly typed asMcpTestClient, andTestConfigfully types all options. No changes are required.apps/e2e/demo-e2e-transport-recreation/project.json (1)
6-6: Well-defined project tags for organization.The tags
["scope:demo", "type:e2e", "feature:transport-recreation"]provide clear categorization for this e2e demo application, which will help with Nx task orchestration and project graph filtering.
Summary by CodeRabbit
New Features
Tests
Chores
Bug Fixes
Revert
✏️ Tip: You can customize this high-level summary in your review settings.