Addresses the PR #138 review. Blocker 1 — duplicate chat row: a brand-new chat whose first turn errors BEFORE the SSE 'start' chunk never receives the authoritative chatId, so metadata adoption can't run; a retry then sent chatId:null and the server inserted a SECOND chat row, orphaning the first turn. Keep metadata adoption as the primary path (resolveAdoptedChatId) and add a bounded, unambiguous fallback: on a new-chat finish with no server id, snapshot the known chat ids and, once the list refetch lands, adopt the SINGLE newly-appeared id (pickNewlyCreatedChatId). Zero or >1 new ids (e.g. two tabs racing) → no adoption — no items[0] guessing, so #137 stays fixed. The wait-for-refetch guard compares set membership (robust to a concurrent delete), and the diff dedupes so a repeated id from a paginated list never reads as ambiguous. Blocker 2 — tests: new adopt-chat-id.test.ts covers both pure helpers (adopt decision + newly-created-id diff incl. dedupe/reorder); the server messageMetadata callback is extracted to chatStreamStartMetadata and unit-tested (start -> {chatId}, otherwise undefined). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
A progressive Node.js framework for building efficient and scalable server-side applications.
Description
Nest framework TypeScript starter repository.
Installation
$ npm install
Running the app
# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod
Migrations
# This creates a new empty migration file named 'init'
$ npm run migration:create --name=init
# Generates 'init' migration file from existing entities to update the database schema
$ npm run migration:generate --name=init
# Runs all pending migrations to update the database schema
$ npm run migration:run
# Reverts the last executed migration
$ npm run migration:revert
# Reverts all migrations
$ npm run migration:revert
# Shows the list of executed and pending migrations
$ npm run migration:show
## Test
```bash
# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:cov
Support
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.
Stay in touch
- Author - Kamil Myśliwiec
- Website - https://nestjs.com
- Twitter - @nestframework
License
Nest is MIT licensed.