From df3f4477ea247fbf74e11ff1e7d6283ae0ba4b03 Mon Sep 17 00:00:00 2001 From: Tianyi Cui <53024+tianyicui@users.noreply.github.com> Date: Sat, 19 Sep 2026 20:50:09 +0800 Subject: [PATCH] test(agent-team): type opaque JSON fixtures without unknown assertions The new no-unknown-casts check rejects two assertions introduced by these projection regressions. Both fixtures intentionally represent unknown content: malformed input sent to the admission checks, and a cached plugin block whose opaque field was already lost. Declare those inputs as unknown variables instead of asserting their expressions to unknown. Keep the same malformed values, content assertions, checkpoint replay, and production validation. Do not expand the recorded cast allowances or change any runtime behavior. --- .../experimental/agent-team/tests/projection-events.spec.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/experimental/agent-team/tests/projection-events.spec.ts b/packages/experimental/agent-team/tests/projection-events.spec.ts index d6f0a12619..333f157eb0 100644 --- a/packages/experimental/agent-team/tests/projection-events.spec.ts +++ b/packages/experimental/agent-team/tests/projection-events.spec.ts @@ -347,7 +347,8 @@ describe('Agent Teams projection events', () => { { type: null }, { type: 'text', text: false }, ])('rejects malformed content in events and checkpoints: %j', (block) => { - const saved = message({ content: [block] as unknown as ContentBlock[] }) + const content: unknown = [block] + const saved = message({ content: content as ContentBlock[] }) const queued = event('team/message/queued', { version: 2, teamId: TEAM, message: saved }, SessionSeq(0)) expect(() => projectTeam(ROOT, [queued])).toThrow(/team\/message\/queued payload is invalid/) expect(() => teamProjectionDefinition.stateSchema.parse({ ...project(ROOT, []), messages: [saved] })).toThrow() @@ -363,8 +364,9 @@ describe('Agent Teams projection events', () => { const queued = event('team/message/queued', { version: 2, teamId: TEAM, message: message({ content: [extension] }), }, SessionSeq(0)) + const oldContent: unknown = [{ type: 'plugin/custom' }] const oldState = project(ROOT, [event('team/message/queued', { - version: 2, teamId: TEAM, message: message({ content: [{ type: 'plugin/custom' } as unknown as ContentBlock] }), + version: 2, teamId: TEAM, message: message({ content: oldContent as ContentBlock[] }), }, SessionSeq(0))]) const restored = ctx.sessionProjections.restore( { agentTeam: { ver: 3, seq: SessionSeq(0), val: oldState } },