Skip to content

v2: Refactor task-related properties and improve type definitions #1275

Closed

Description

@felixweinberger

Summary

Refactoring opportunities for the v2 implementation related to task properties and TypeScript type definitions.

Motivation and Context

The current implementation has some patterns that could be improved for better code organization and type safety.

Proposed Changes

1. Group task-related properties

Currently there are multiple taskX variables at the same level:

taskId?: string;
taskStore?: RequestTaskStore;
taskRequestedTtl?: number | null;

Consider grouping these under a single task object:

task?: {
    id: string;
    store: RequestTaskStore;
    requestedTtl: number | null;
};

This provides better organization and makes it clearer these properties are related.

2. Distinguish between optional properties and undefined values

In TypeScript:

// Property may be omitted entirely
{ prop?: string; }

// Property must be present, but can be undefined
{ prop: string | undefined; }

These have different semantics:

  • prop?: string - the property may not exist at all
  • prop: string | undefined - the property always exists but may be undefined

We should audit the codebase and use the appropriate pattern based on actual intent. This affects:

  • API contracts (what callers must provide)
  • Serialization behavior (omitted vs explicit undefined)
  • Type narrowing (in checks vs value checks)

Additional context

Low priority - should be addressed if time permits during v2 development.

Activity

  1. added
    enhancementRequest for a new feature that's not currently supported
    v2Ideas, requests and plans for v2 of the SDK which will incorporate major changes and fixes
    on Dec 9, 2025
  2. added
    ready for workEnough information for someone to start working on
    P2Moderate issues affecting some users, edge cases, potentially valuable feature
    on Dec 16, 2025
  3. felixweinberger commented on Dec 16, 2025

    @felixweinberger
    ContributorAuthor

    cc @LucaButBoring FYI - tracking task-related refactoring for v2

  4. LucaButBoring commented on Dec 16, 2025

    @LucaButBoring
    Contributor

    Depending on how soon v2 is going out I can handle this, feel free to assign me to this

  5. felixweinberger commented on Dec 17, 2025

    @felixweinberger
    ContributorAuthor

    Depending on how soon v2 is going out I can handle this, feel free to assign me to this

    We've already set up a long-lived branch v1.x and the next release from main is going to be a 2.0.0-alpha aiming to ship early in Q1.

    Thanks for offering to take it on! Assigning to you for now.

  6. LucaButBoring commented on Dec 18, 2025

    @LucaButBoring
    Contributor

    PR is up: #1315

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2Moderate issues affecting some users, edge cases, potentially valuable featureenhancementRequest for a new feature that's not currently supportedready for workEnough information for someone to start working onv2Ideas, requests and plans for v2 of the SDK which will incorporate major changes and fixes

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions