fix(tests): model deactivation filtering - #1107
Conversation
Update tests to reflect that models with some deactivated providers but at least one active provider remain included in API responses. Verify response contains models and that deactivated_at dates are valid ISO strings if present, removing incorrect assumptions that all deactivated models are excluded. Co-authored-by: terragon-labs[bot] <terragon-labs[bot]@users.noreply.github.com>
WalkthroughTest modifications in the models specification file that relax assertions on the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Possibly related PRs
Pre-merge checks and finishing touches✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
apps/gateway/src/models/models.spec.ts (1)
66-67: Remove redundantinstanceof Datecheck.The check on line 66 is redundant:
new Date()always returns aDateinstance in JavaScript/TypeScript, even when the input string is invalid. Line 67 correctly validates that the date is actually parseable by checkingisNaN(deactivatedAt.getTime()).Apply this diff to remove the redundant check:
if (model.deactivated_at) { const deactivatedAt = new Date(model.deactivated_at); - expect(deactivatedAt instanceof Date).toBe(true); expect(isNaN(deactivatedAt.getTime())).toBe(false); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
apps/gateway/src/models/models.spec.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Always use top-level import; never use require() or dynamic import()
Files:
apps/gateway/src/models/models.spec.ts
**/*.spec.ts
📄 CodeRabbit inference engine (AGENTS.md)
Unit tests should be written in *.spec.ts files
Unit test files should be named with the
.spec.tssuffix
Files:
apps/gateway/src/models/models.spec.ts
apps/{gateway,api}/**/*.ts
📄 CodeRabbit inference engine (AGENTS.md)
apps/{gateway,api}/**/*.ts: Use Hono for HTTP routing in Gateway and API services
Use Zod schemas for request/response validation in server routes
Files:
apps/gateway/src/models/models.spec.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx}: Never useanyoras anyin this TypeScript project unless absolutely necessary
Always use top-levelimport; do not userequireor dynamicimport()
Files:
apps/gateway/src/models/models.spec.ts
{apps/{api,gateway}/**/*.ts,packages/db/**/*.ts}
📄 CodeRabbit inference engine (CLAUDE.md)
For read operations, use
db().query.<table>.findMany()ordb().query.<table>.findFirst()
Files:
apps/gateway/src/models/models.spec.ts
🧠 Learnings (2)
📚 Learning: 2025-10-20T21:33:03.287Z
Learnt from: CR
Repo: theopenco/llmgateway PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-10-20T21:33:03.287Z
Learning: Applies to apps/gateway/src/api-individual.e2e.ts : Place isolated E2E test cases that need separation in `apps/gateway/src/api-individual.e2e.ts`
Applied to files:
apps/gateway/src/models/models.spec.ts
📚 Learning: 2025-09-29T21:46:22.366Z
Learnt from: CR
Repo: theopenco/llmgateway PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-29T21:46:22.366Z
Learning: Applies to apps/gateway/src/api-individual.e2e.ts : Place isolated/individual E2E test cases that need isolation in apps/gateway/src/api-individual.e2e.ts
Applied to files:
apps/gateway/src/models/models.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). (10)
- GitHub Check: test / run
- GitHub Check: build / run
- GitHub Check: generate / run
- GitHub Check: lint / run
- GitHub Check: e2e-shards (4)
- GitHub Check: e2e-shards (5)
- GitHub Check: e2e-shards (2)
- GitHub Check: e2e-shards (1)
- GitHub Check: e2e-shards (3)
- GitHub Check: autofix
🔇 Additional comments (1)
apps/gateway/src/models/models.spec.ts (1)
52-60: LGTM! Clear documentation and sensible assertion.The explanatory comment clarifies the deactivation semantics well, and the new assertion ensures the endpoint returns data as expected under the revised filtering logic.
Summary
deactivated_atrepresents the earliest deactivation date among the model's providers.Changes
Tests
apps/gateway/src/models/models.spec.ts:deactivated_atis a valid ISO date string when present.Behavior validated
Rationale
Test plan
deactivated_at, if present, is a valid ISO dateDocumentation
🌿 Generated by Terry
ℹ️ Tag @terragon-labs to ask questions and address PR feedback
📎 Task: https://www.terragonlabs.com/task/8574c8b6-1eb6-40d2-b5df-7c379e6d97c4
Summary by CodeRabbit