Skip to content

Update Timeseries and Location Group Stores to Support Partial Success #1731

@msweier

Description

@msweier

AI assisted feature request.

Is your feature request related to a problem? Please describe.
Groups are being used for a lot right now. Storing/patching a timeseries or location group is all-or-nothing: if 9 TSIDs are valid and 1 doesn't exist, the entire assign call fails and nothing is saved. PATCH may be worse the controller does rename -> unassign -> assign as separate non-transactional calls, so a failure on assign can leave the group renamed/cleared with no new assignments (related to #1654)?

Describe the solution you'd like
Support partial success on group assignment. AI suggests to add an ?ignore-missing=true query param to the TS group and location group store/patch endpoints. When set, CDA pre-validates the assignment list, sends only the valid entries to assign_ts_groups / assign_loc_groups, and returns 207 Multi-Status (or 200 with a body) listing the skipped IDs and reasons. Also wrap the PATCH controller's rename/unassign/assign sequence in a single transaction.

Describe alternatives you've considered
Right now, there is a lot of client side code being written to fall back or do a check if the locations/tsids are valid.

Chatbot suggests a better long term fix in the database. Add a DB-side variant (assign_ts_groups2 with p_ignore_missing and an OUT list of failed IDs) that wraps each iteration in its own BEGIN/EXCEPTION/END. Cleanest long term, but requires a cwms-database change and coordinated release.

Additional context
AI suggests the root cause — DB:

CDA side:

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    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