Skip to content

feat(dns): M1 construct support for record types, dnsConfig and answer assertions#1416

Open
danielpaulus wants to merge 2 commits into
mainfrom
dns-v2-m1-construct-support
Open

feat(dns): M1 construct support for record types, dnsConfig and answer assertions#1416
danielpaulus wants to merge 2 commits into
mainfrom
dns-v2-m1-construct-support

Conversation

@danielpaulus

Copy link
Copy Markdown
Contributor

Summary

Extends the DNS constructs to match the DNS v2 M1 backend surface (checkly monorepo progress 2.8), so a user can express every M1 feature in code (and codegen roundtrips it on import).

  • Record types: DnsRecordType union gains HTTPS + PTR, SRV, CAA, DS, DNSKEY, TLSA, NAPTR — now equal to the backend's 15 accepted types (schemas.js dnsMonitorRecordTypes).
  • dnsConfig: DnsRequest gains an optional dnsConfig { queryTimeoutSeconds, followCname }.
  • ANSWER assertions: DnsAssertionBuilder gains answerData()/answerName()/answerType()/answerTtl() (quantifier-aware — EVERY|SOME|NONE) and answerCount() (numeric, no quantifier). They emit source: 'ANSWER' + property + quantifier per the backend validate-dns-answer-assertion contract (quantifier required for all properties except count).
  • Regex comparators: matches()/notMatches() added to the shared GeneralAssertionBuilder (available to all check types; RE2 semantics noted in the docstring).
  • Validation: DnsMonitor.validate() mirrors the backend cross-field rules — IP-shaped query only allowed when recordType == PTR, ASCII/punycode query, and queryTimeoutSeconds integer 1..30.
  • Codegen: dns-request-codegen emits dnsConfig; dns-assertion-codegen emits the answer*/matches/notMatches calls; the shared internal/assertion-codegen learns MATCHES/NOT_MATCHES.

The new Assertion.quantifier field is optional and emitted only when set, so sibling check types' synthesized output stays byte-identical.

Tests

  • dns-monitor.spec.ts — new validation cases (PTR/IP, non-ASCII query, queryTimeoutSeconds range) + a synthesize() case with dnsConfig and ANSWER assertions.
  • dns-assertion.spec.ts (new) — builder output shape for every answer* method, matches/notMatches, and that existing assertions keep no quantifier key.
  • dns-monitor-codegen.spec.ts (new) — codegen roundtrip for record types, dnsConfig, quantified ANSWER assertions, and shared matches/notMatches.

All three suites: 31/31 passing; eslint clean.

🤖 Generated with Claude Code

Ubuntu and others added 2 commits July 18, 2026 04:25
…r assertions

Extend the DNS constructs to match the DNS v2 M1 backend surface:
- DnsRecordType union gains HTTPS + PTR, SRV, CAA, DS, DNSKEY, TLSA, NAPTR
  (now equals the backend's 15 accepted types).
- DnsRequest gains an optional dnsConfig { queryTimeoutSeconds, followCname }.
- DnsAssertionBuilder gains answerData/answerName/answerType/answerTtl
  (quantifier-aware: EVERY|SOME|NONE) and answerCount (numeric, no quantifier),
  emitting source: 'ANSWER' + property + quantifier per the backend contract.
- matches()/notMatches() added to the shared GeneralAssertionBuilder (RE2 semantics).
- DnsMonitor.validate() mirrors the backend cross-field rules: IP query only for
  PTR, ASCII/punycode query, queryTimeoutSeconds integer 1..30.
- Codegen (dns-request/dns-assertion) roundtrips dnsConfig and every new
  assertion shape; shared assertion-codegen learns MATCHES/NOT_MATCHES.
- Construct + codegen unit tests (dns-monitor, dns-assertion, dns-monitor-codegen).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add DnsChangeDetection { enabled; includeTtl? } to the DnsConfig
interface (sibling of followCname) mirroring the backend
dnsConfig.changeDetection wire shape, and roundtrip it through the
DnsMonitor codegen. Covered by codegen roundtrip + synthesize tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant