fix(linear): preserve mixed-version RPC filtering compatibility (#8192)
* fix(linear): guard mixed-version RPC filtering * fix(linear): surface filter capability failures correctly Prevent capability checks from pinning to rejected compatibility cache entries, and rethrow typed attribute-filter unsupported errors from the Linear store so TaskPage can show an upgrade message instead of an empty filtered list. * fix(runtime): refresh cached capability verdicts * test(linear): mock isLinearIssueAttributeFilterUnsupportedError Prevents the invalidation slice test from failing after the runtime client gained this export, which was otherwise undefined in the mock. * Fix cold-cache capability probes firing duplicate status.get calls Coalesce concurrent status.get requests for the same environment by publishing the in-flight probe to the compatibility cache before awaiting it, so parallel capability checks share one RPC call. On failure, drop the cache entry immediately since this probe always re-fetches and must not leave a stale cached verdict.
This commit is contained in:
@@ -12,6 +12,26 @@ describe('RuntimeRpcEnvelopeSchema', () => {
|
||||
expect(parsed.success).toBe(true)
|
||||
})
|
||||
|
||||
it('accepts and strips additive future success fields', () => {
|
||||
const parsed = RuntimeRpcEnvelopeSchema.safeParse({
|
||||
id: 'req-1',
|
||||
ok: true,
|
||||
result: { value: 1, futureResultField: true },
|
||||
futureEnvelopeField: 'new',
|
||||
_meta: { runtimeId: 'runtime-1', futureMetaField: 2 }
|
||||
})
|
||||
|
||||
expect(parsed).toEqual({
|
||||
success: true,
|
||||
data: {
|
||||
id: 'req-1',
|
||||
ok: true,
|
||||
result: { value: 1, futureResultField: true },
|
||||
_meta: { runtimeId: 'runtime-1' }
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
it('accepts a well-formed failure envelope', () => {
|
||||
const parsed = RuntimeRpcEnvelopeSchema.safeParse({
|
||||
id: 'req-1',
|
||||
@@ -39,6 +59,31 @@ describe('RuntimeRpcEnvelopeSchema', () => {
|
||||
expect(parsed.success).toBe(true)
|
||||
})
|
||||
|
||||
it('accepts and strips additive future failure fields', () => {
|
||||
const parsed = RuntimeRpcEnvelopeSchema.safeParse({
|
||||
id: 'req-1',
|
||||
ok: false,
|
||||
futureEnvelopeField: 'new',
|
||||
error: {
|
||||
code: 'failed',
|
||||
message: 'Nope',
|
||||
data: { retryable: true },
|
||||
futureErrorField: 2
|
||||
},
|
||||
_meta: { runtimeId: 'runtime-1', futureMetaField: 3 }
|
||||
})
|
||||
|
||||
expect(parsed).toEqual({
|
||||
success: true,
|
||||
data: {
|
||||
id: 'req-1',
|
||||
ok: false,
|
||||
error: { code: 'failed', message: 'Nope', data: { retryable: true } },
|
||||
_meta: { runtimeId: 'runtime-1' }
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
it('accepts a failure envelope without _meta', () => {
|
||||
// Why: the runtime may fail before it has resolved its own runtimeId, in
|
||||
// which case _meta is omitted. The schema must tolerate that rather than
|
||||
@@ -70,6 +115,17 @@ describe('RuntimeRpcEnvelopeSchema', () => {
|
||||
expect(parsed.success).toBe(false)
|
||||
})
|
||||
|
||||
it('still rejects malformed known fields when future fields are present', () => {
|
||||
const parsed = RuntimeRpcEnvelopeSchema.safeParse({
|
||||
id: 'req-1',
|
||||
ok: false,
|
||||
error: { code: 500, message: 'Nope', futureErrorField: true },
|
||||
futureEnvelopeField: 'new'
|
||||
})
|
||||
|
||||
expect(parsed.success).toBe(false)
|
||||
})
|
||||
|
||||
it('rejects a frame with unrelated fields only', () => {
|
||||
const parsed = RuntimeRpcEnvelopeSchema.safeParse({ hello: 'world' })
|
||||
expect(parsed.success).toBe(false)
|
||||
|
||||
Reference in New Issue
Block a user