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
fix(cli): emit ocspStapled in SSL assertion codegen [SIM-313] (#1396)
* fix(cli): emit ocspStapled in SSL assertion codegen [SIM-313]
PR #1392 added 'OCSP_STAPLED' to SslAssertionSource and the matching
SslAssertionBuilder.ocspStapled() builder, but never added the codegen case.
valueForSslAssertion fell through to its `default:` clause, so `checkly import`
threw `Unsupported SSL assertion source OCSP_STAPLED` and aborted whenever it
rendered an SSL monitor carrying an OCSP-stapling assertion.
Add the case, mapping to ocspStapled with the existing generalNoArgs shape —
the same no-property/no-regex shape as the neighbouring CHAIN_TRUSTED,
HOSTNAME_VERIFIED and CERT_NOT_EXPIRED cases.
Also extend the SSL codegen round-trip test to cover all 12 assertion sources
with their exact emitted call chains; it previously exercised only
CERT_EXPIRES_IN_DAYS and CHAIN_TRUSTED, which is why the gap went unnoticed.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* refactor(cli): make assertion-source codegen switches exhaustive [SIM-313]
Every assertion-source `switch (assertion.source)` ended in `default: throw`,
which leaves the switch non-exhaustive at compile time: adding a member to an
assertion source union produces no type error, so tsc stays green and the
missing codegen case surfaces only as a runtime throw during `checkly import`.
That is exactly how the OCSP_STAPLED gap reached main.
Add a shared unsupportedAssertionSource(source: never, kind?: string) guard and
use it as the default clause in all eight switches (api, dns, grpc, icmp, ssl,
tcp, traceroute, url). Since Assertion<Source>.source is typed as the literal
union, TypeScript narrows it to never in an exhaustive default, so an unhandled
member now fails to compile. The runtime throw is retained because wire data may
carry a source this version of the CLI does not know about.
`kind` is optional because the API check's message carries no kind word; all
eight messages remain byte-identical, now locked by assertion-codegen.spec.ts.
The comparison switches cannot be guarded the same way: Assertion.comparison is
typed `string` rather than the Comparison union, which would need wire-data
retyping.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
0 commit comments