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

test: migrate release-note Anthropic mocks to aimock

未關閉
#2,482 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Python
星號
15.9k
分支
1.4k
平均合併
1 天 17 小時
30 天內合併 PR
163

描述

## 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.

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。