Skip to content

Drift tooling doesn't compare enum variant values against the spec #275

Description

@sdairs

Problem

Neither scripts/check-openapi-drift.py nor spec_coverage_test.rs compares the values of inline enums (the spec's enum: [...] arrays) against the Rust enum variants. They track:

  • enum/struct/type names (existence)
  • struct fields
  • field optionality (Option<T> vs T)

…but a value added to or removed from a spec enum is invisible to both the daily drift check (reports 0) and the coverage test.

How it surfaced

In #273 (PR resolving #224), the spec dropped seekSnapshot and removed snapshot from the PubSub seekType enum (now ["latest","earliest","timestamp"]). The companion seekSnapshot field removal was caught, but the stale Snapshot variant on ClickPipePostPubSubSourceSeektype / ClickPipePubSubSourceSeektype was left behind and serialized to "snapshot" — a value the API now rejects. The drift check still reported 0. Caught only by Cursor Bugbot, fixed in #273.

Proposed fix

Extend drift detection to enum variant values, bidirectionally (mirroring the missing/extra split already used for methods and struct fields):

  • spec → code: every spec enum value has a matching Rust variant (catches added values)
  • code → spec: every Rust variant (excluding the Unknown(String) catch-all and #[serde(untagged)] arms) maps to a spec value (catches removed values, which is the case above)

Add the check to both check-openapi-drift.py (report section + the daily CI run) and a new spec_coverage_test.rs assertion against the vendored snapshot, keeping them in lockstep like the existing field checks. Compare against the #[serde(rename = "...")] values, not the variant identifiers.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requesttest-coverageLive API integration test coverage work

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions