ag-ui-protocol / ag-ui-protocol/ag-ui

test: migrate release-note Anthropic mocks to aimock

Ouverte
#2,482 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Python
Étoiles
15.9k
Forks
1.4k
Merge moyen
1 j 17 h
PR mergées (30 j)
163

Description

## Context

The retired-Anthropic-model audit exposed test-hygiene debt in `scripts/release/generate-ai-release-notes.test.ts`. The audit-remediation PR intentionally keeps its scope to updating model references; this issue tracks the test cleanup separately.

## Problem

The Anthropic request-path tests currently use hand-written HTTP servers instead of the repository's preferred aimock fixtures. In the affected test regions this also leaves:

- a dynamic `await import("node:http")` inside a test callback;
- type and non-null assertions such as `server!`, `server.address() as { port: number }`, and `receivedBody.messages!`;
- duplicated HTTP-server setup across multiple tests;
- a bespoke Anthropic response stub that can drift from provider request and response shapes.

## Proposed remediation

- Migrate the release-note Anthropic integration tests to Vitest with `@copilotkit/aimock/vitest` in strict replay mode.
- Add deterministic fixtures and assert the request journal, including method, path, headers, selected model, token limit, and prompt content.
- Replace dynamic imports, casts, non-null assertions, and duplicated server setup with typed file-local helpers.
- Keep the existing success, transport-failure, and non-2xx fail-soft coverage.
- Update the release-script CI workflow and package dependencies as required by the isolated migration.

## Acceptance criteria

- All existing release-note test behaviors remain covered.
- No live Anthropic request or credential is required.
- Unmatched model requests fail loudly in CI.
- The migrated test passes formatting, lint, explicit typecheck, and the full release-script test workflow.

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.