Skip to content

refactor(types): consolidate shared task/tag/link models and normalize task status typing #64

@joshrotenberg

Description

@joshrotenberg

Summary

Several response models that should be shared across the crate are currently duplicated across endpoint modules. The biggest example is TaskStateUpdate, which exists in multiple files with slightly different field shapes and typing. CloudTag/CloudTags are also duplicated, and task status is an enum in one place but a raw string elsewhere.

Why this matters

  • increases drift risk when the API adds fields or semantics change
  • makes docs and examples less consistent across handlers
  • complicates Python bindings and future codegen/harmonization work
  • makes it harder to reason about compatibility because similar names do not always mean the same type

Relevant code

Repeated TaskStateUpdate

  • src/types.rs:16
  • src/tasks.rs:71
  • src/users.rs:113
  • src/cloud_accounts.rs:200
  • src/acl.rs:367
  • src/fixed/subscriptions.rs:365
  • src/fixed/databases.rs:478
  • src/flexible/subscriptions.rs:801
  • src/flexible/databases.rs:1241

Repeated tag/link models

  • src/types.rs:111
  • src/types.rs:118
  • src/types.rs:146
  • src/types.rs:159
  • src/fixed/databases.rs:179
  • src/fixed/databases.rs:310
  • src/flexible/databases.rs:252
  • src/flexible/databases.rs:1166

Suggested direction

  • choose canonical shared models in src/types.rs
  • migrate handlers to those shared types where the wire format is actually the same
  • normalize task status typing so one representation is the source of truth
  • use aliases or re-exports only where they preserve compatibility without reintroducing drift

Acceptance criteria

  • one canonical shared representation exists for task state, tags, and links where the payload shape is the same
  • task status typing is consistent across handlers, or any intentional exceptions are documented
  • endpoint modules stop redefining structurally identical shared models
  • tests and examples are updated to the canonical types

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    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