Skip to content

Keep upload columns in file order; clean 409s for templates and lists in use - #13

Merged
op-techy merged 1 commit into
mainfrom
fix/column-order-delete-conflicts
Dec 3, 2026
Merged

op-techy merged 1 commit into
mainfrom
fix/column-order-delete-conflicts

Conversation

@op-techy

@op-techy op-techy commented Dec 3, 2026

Copy link
Copy Markdown
Owner

Follow-ups from the last review.

Changes

  • Upload columns in file order. file_uploads.column_preview was JSONB, which reorders keys, so GET /api/uploads/{id}/status listed columns shuffled, which is confusing on the mapping screen. V26 makes it json, and the entity binds it as plain json (Hibernate's default binding sends jsonb, which would reorder keys before they reach the column). Uploads stored earlier keep their old order.
  • Clean 409s. Deleting a template or recipient list that a campaign uses is now checked first and refused with a reason ("This template is used by 2 campaigns. …"). Before, the delete hit the foreign key: the response was a generic 409 and Hibernate logged an ERROR, which could set off log alerts.
  • Bug found along the way: deleting a list that had uploads returned 409. file_uploads.recipient_list_id had no delete rule. V26 makes it ON DELETE CASCADE, so a list's upload history (and any file waiting for a column mapping) goes with it.

Testing

  • ColumnMappingIntegrationTest now checks the exact column order; SweepFixesIntegrationTest covers both in-use refusals and deleting a list with uploads.
  • Unit 356/356, integration 38/38, scale 9/9.
  • Docker image built; the end-to-end sweep (with new checks for column order and deleting a list with uploads) passed 68/68 and the app log had no ERROR lines (6 before).

…lists in use

- column_preview is stored as json instead of jsonb (V26) and bound as plain
  json, so the upload status lists columns in the file's order.
- Deleting a template or list that a campaign uses is checked up front and
  refused with 409 and a reason ("used by N campaigns"), instead of hitting the
  foreign key and logging an ERROR.
- Deleting a list that had uploads failed with 409: file_uploads now cascade
  with their list (V26).
@op-techy
op-techy merged commit b764312 into main Dec 3, 2026
2 checks passed
@op-techy
op-techy deleted the fix/column-order-delete-conflicts branch December 3, 2026 00:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant