Skip to content

feat: v1.1.0 — test coverage 80%+, OpenAPI docs, OpenAI adapter, CLI benchmarks#18

Merged
pixelstrade-dev merged 8 commits intomainfrom
claude/caims-consciousness-framework-2EOiI
Apr 6, 2026
Merged

feat: v1.1.0 — test coverage 80%+, OpenAPI docs, OpenAI adapter, CLI benchmarks#18
pixelstrade-dev merged 8 commits intomainfrom
claude/caims-consciousness-framework-2EOiI

Conversation

@pixelstrade-dev
Copy link
Copy Markdown
Owner

Summary

4 améliorations Tier 1 issues #13, #11, #4, #5 :

Fichiers créés

  • lib/adapters/openai.ts — OpenAI adapter complet
  • lib/adapters/index.ts — Factory multi-provider
  • lib/openapi/spec.ts — Spec OpenAPI 3.1.0
  • app/api/docs/route.ts — Swagger UI dark theme
  • app/api/openapi.json/route.ts — Spec endpoint
  • cli/benchmark.ts — CLI scoring benchmarks
  • benchmarks/sample.json — 5 interactions de référence
  • 6 nouveaux fichiers de test

Fichiers modifiés

  • 4 fichiers migrés de getAnthropicAdapter()getAdapter()
  • .env.example — config multi-provider documentée
  • docs/OPEN_SOURCE_LAUNCH_STRATEGY.md — supprimé (doc interne confidentiel)
  • Corrections: scoreColor 0-100, try-catch GET debate/[id], health endpoint envelope

Test plan

  • Build Next.js production : 0 erreurs
  • 139/139 tests passent (11 suites)
  • Coverage : Stmts 96.5% | Branch 82% | Func 91.5% | Lines 96.7%
  • CLI benchmark fonctionne (--help validé)
  • OpenAPI spec validée par 14 tests ($ref integrity, paths, schemas)
  • Adapter factory : 8 tests (default, env, override, erreurs)
  • OpenAI adapter : 11 tests (chat, judge, errors, base URL)
  • Rétrocompatibilité : défaut = anthropic, aucun changement pour utilisateurs existants
  • Vérifier déploiement Docker staging

https://claude.ai/code/session_01Y7wiMwFa2D4P8zD9RhCgsv

claude added 8 commits April 6, 2026 06:21
Coverage results:
- Statements: 73% → 96.5%
- Branches:   48% → 82.1%
- Functions:  57% → 91.5%
- Lines:      75% → 96.7%

New test files:
- logger.test.ts: dev/prod output modes, all 4 log levels, data formatting
- agents.test.ts: agent definitions, getAgentById, getAgentsByIds
Extended test files:
- composite.test.ts: parseThreshold env validation, getWeightsFromEnv edge cases
- rate-limit.test.ts: getRateLimitHeaders, independent tracking, default config
- api-routes-errors.test.ts: debate orchestrator logic, IP fallback, score happy path

https://claude.ai/code/session_01Y7wiMwFa2D4P8zD9RhCgsv
- OpenAPI 3.1.0 spec covering all 6 API routes (9 operations)
- /api/openapi.json serves the machine-readable spec
- /api/docs serves interactive Swagger UI with dark theme
- 14 tests validating spec completeness and $ref integrity
- Documents all request/response schemas, error codes, rate limits
- Describes 5 KPIs (CQ/AQ/CFI/EQ/SQ), debate formats, agent IDs

Total: 113 tests, 8 suites

https://claude.ai/code/session_01Y7wiMwFa2D4P8zD9RhCgsv
- New OpenAIAdapter (lib/adapters/openai.ts) with fetch-based API calls,
  retry/backoff, timeout, and custom base URL support (OPENAI_BASE_URL)
- Adapter factory (lib/adapters/index.ts) selects provider via
  CAIMS_LLM_PROVIDER env var (anthropic | openai, default: anthropic)
- Replaced all 4 getAnthropicAdapter() calls with getAdapter():
  chat/route.ts, debate/[id]/route.ts, orchestrator.ts, scoring-engine.ts
- Updated .env.example with new provider configuration
- 19 new tests: adapter factory (8) + OpenAI adapter (11)
- Updated existing test mocks to use new factory import

Total: 132 tests, 10 suites

https://claude.ai/code/session_01Y7wiMwFa2D4P8zD9RhCgsv
- cli/benchmark.ts: standalone CLI for scoring LLM interactions
  - Single interaction mode: --question + --response
  - Dataset mode: --file benchmarks/sample.json
  - Output: table (default) or JSON (--format json)
  - Results export: --output results.json
  - Parallel scoring: --concurrency 1-10
  - Pass/fail thresholds via expected.minComposite/maxComposite
  - Exit code 1 if any items fail expectations (CI-friendly)
- benchmarks/sample.json: 5-item reference dataset covering
  high-consciousness, aligned, context-drift, epistemic, mechanical
- npm script: npm run benchmark
- 7 new tests validating dataset schema and coverage

Usage: npm run benchmark -- -f benchmarks/sample.json
Total: 139 tests, 11 suites

https://claude.ai/code/session_01Y7wiMwFa2D4P8zD9RhCgsv
- api-routes-errors.test.ts: mock scores now match CQDetails interface
  (phi_proxy/gwt_proxy/hot_proxy instead of integration/emergence)
- logger.test.ts: cast process.env for NODE_ENV assignment (read-only in strict)
- spec.test.ts: type op.responses as Record<string, unknown> for Object.keys()

https://claude.ai/code/session_01Y7wiMwFa2D4P8zD9RhCgsv
After merging origin/main, the ETHICIST agent was added to
CAIMS_DEFAULT_AGENTS. Updated test assertions from 5 to 6 agents
and added agt-ethicist to expected IDs.

https://claude.ai/code/session_01Y7wiMwFa2D4P8zD9RhCgsv
@pixelstrade-dev pixelstrade-dev merged commit 9a2b7a6 into main Apr 6, 2026
2 of 3 checks passed
@pixelstrade-dev pixelstrade-dev deleted the claude/caims-consciousness-framework-2EOiI branch April 6, 2026 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants