You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unit-test assertExpectation in scripts/aichat-matrix.ts #1630
scripts/aichat-matrix.ts (added in #1364 / PR #1627) asserts agent behavior via a pure function, assertExpectation(expect: Expectation, toolsCalled: string[]). This function is the entire enforcement mechanism for the eval — a bug in its subsequence-matching (toolSequence) or run-length logic (noRetry) would silently make the eval pass when it shouldn't, with no signal that the harness itself is broken.
Raised as a non-blocking suggestion in the PR #1627 review.
Problem Statement
assertExpectation has no direct unit test coverage.
scripts/routing-eval.ts's equivalent (assertFixture) also has none — there's no existing pattern for testing these harness scripts in isolation.
Both are pure functions (no daemon/socket/DB needed), which makes them cheap to test directly without any live-agent scaffolding.
Proposed Solution
Add a small test file (e.g. scripts/aichat-matrix.test.ts, run via bun run test conventions used elsewhere, or a lightweight bun test-compatible script if scripts/ doesn't participate in the Vitest suite) covering:
noTools: passes with no action tools, fails with any action tool present, tolerates search_skills.
toolOnce: passes with exactly one call, fails with zero or multiple.
toolSequence: passes when the sequence appears as a subsequence (including with other tools interleaved), fails when out of order or missing.
noRetry: passes with no back-to-back repeats, fails on a repeated call, tolerates non-adjacent repeats.
noExtraTypes: passes with exactly one create_schema, fails with zero or multiple.
Acceptance Criteria
assertExpectation has direct unit test coverage for all five Expectation kinds, including edge cases (empty tool list, search_skills interleaved).
Tests run via the project's standard test command (documented in the test file or PR description).
Activity
malibio commentedon Jul 11, 2026
Baseline (Happy-DOM): 158 test files passed, 1 failed (Test Files: 1 failed | 158 passed). Frontend: 4030 passed, 1 failed. The 1 failure is architecture-benchmarks.test.ts > bulk structural operations <25ms target (41.8ms actual) — known machine-load-flaky perf threshold, unrelated to this issue's scope.
Unit-test assertExpectation in scripts/aichat-matrix.ts (#1631)