feat(sdk): card-phase preflight planners (label hex, report filter)#280
Conversation
InternalApiClient.execute_query was the only GraphQL client in the SDK that accepted a raw query string and parsed it with gql() internally, carrying a `# type: ignore[override]` that existed solely to accept str. Every other endpoint, including the portal interfaces client, already accepts a parsed DocumentNode. Drop the override entirely (it becomes a pure pass-through to BasePipefyClient.execute_query once the parse_gql call is removed) and wrap the internal mutation constants in gql() at module load, so all query definitions share one style and syntax errors surface at import time. No behavior change.
Pure validation for #RGB/#RRGGBB label colors and ReportCardsFilter shape before GraphQL. No MCP/CLI wiring yet.
Codify that static typing is the contract for internal code and runtime isinstance guards belong only at trust boundaries (MCP tool signatures, nested values of dict-typed args), not inside internal functions. Prevents per-function defensive type checks from becoming the norm; the enforcement mechanism for internal type contracts is a type checker, not hand-written guards.
ReviewTwo pure SDK planners ( Findings
|
docs(agents): make boundary-only type validation an invariant
…tnode refactor(sdk): make InternalApiClient accept a gql DocumentNode
|
Thanks @gbrlcustodio — agreed on the naming, and rather than renaming in place here, the rename lands in #291 together with the SDK-boundary move you proposed on #284: |
Enforce ReportCardsFilterQueryOperators and ReportCardsFilterFieldTypes, iterate rejected root keys deterministically, and expose EXAMPLE_PHASE_FILTER as a read-only MappingProxyType.
During agent-seeding of the Analytics pipe (
306996636), agents usedexecute_graphqlandintrospect_type/search_schemawhen first-class tools lacked card/phase workflows. Spec:.cursor/dev-planning/specs/archive/card-phase-ergonomics/Stack replacing closed #277. Merge prior PRs in the stack before this one.
Objective
Pure SDK planners (no GraphQL, no MCP/CLI):
normalize_label_color(#RGB/#RRGGBB) andvalidate_report_cards_filter(ReportCardsFilter shape).Why now
Chaos-pipe hit
create_label("red")and malformed report filters; validation belongs in a testable layer before tools call GraphQL.Improvements