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.
This commit is contained in:
Tianyi Cui committed 2026-09-19 20:59:52 +08:00
1 parent f56aecb314
commit df3f4477ea
1 file changed
+4 -2
@@ -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 } },