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:
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=truequery param to the TS group and location group store/patch endpoints. When set, CDA pre-validates the assignment list, sends only the valid entries toassign_ts_groups/assign_loc_groups, and returns207 Multi-Status(or200with 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:
cwms_ts.assign_ts_groupsis a bareFORloop with no exception handler, so the first bad TSID raises and rolls back the whole call.cwms_ts.assign_ts_groupcallsvalidate_ts_id/get_ts_code, which raiseTS_ID_NOT_FOUNDwhen the TSID is missing.cwms_loc.assign_loc_groups3is a singleMERGE, so it is atomically all-or-nothing in the same way.CDA side:
TimeSeriesGroupDao.assignTs— passes the entireTS_ALIAS_TAB_Tarray in one call.TimeSeriesGroupController.update— rename / unassign / assign run as separate DAO calls with no transaction boundary.LocationGroupDao.assignLocsandLocationGroupController.update— same pattern for locations.