Skip to content

Conversation

@kevinkim-ogp
Copy link
Contributor

Problem

A bug in the email attachments field caused attachments that were deleted from FormSG to remain in the parameters. As a result, users hit the maximum limit of 10 attachments, even though fewer than 10 were visible in the UI.

Solution

When user is making changes to the selected attachments, add a filter on the existing parameters to remove attachments that no longer exist within the FormSG that is connected.

How to test?

  1. Create a FormSG with a few attachment fields and use them in email by postman step
  • Selected attachments are saved in the step parameters
  1. Modify the FormSG, remove the OLD attachment fields, and add NEW attachments
  2. Return to Plumber and click on 'Check step again'
  • Previous attachments should no longer appear in the input nor as suggestions
  • Select the NEW attachments in the popover
  • Verify in DB that the step parameters only include the NEW attachments
  • Verify that can select up to 10 attachments
  1. Sanity check that manually uploaded attachments still work as intended
  • Can upload new
  • Can select / remove
  • Can delete

@kevinkim-ogp kevinkim-ogp requested a review from a team as a code owner July 28, 2025 08:00
@datadog-opengovsg
Copy link

datadog-opengovsg bot commented Jul 28, 2025

✅ Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 47d1f69 | Was this helpful? Give us feedback!

@kevinkim-ogp
Copy link
Contributor Author

bugbot run

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bugbot free trial expires on July 29, 2025
Learn more in the Cursor dashboard.

flowData,
priorExecutionSteps,
variableTypes,
[getValues, name, setError, options],
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Validation Inconsistency with Deleted Attachments

The validateFiles function validates against unfiltered form values, while the form update operates on filtered values that exclude deleted attachments. This inconsistency causes validation (e.g., attachment limit checks) to incorrectly count deleted attachments, leading to premature failures.

Locations (1)

Fix in Cursor Fix in Web

@kevinkim-ogp kevinkim-ogp changed the title fix: remove deleted attachments from step params PLU-532: Remove deleted FormSG attachments from email step parameters Jul 28, 2025
@linear
Copy link

linear bot commented Jul 28, 2025

Copy link
Contributor

@pregnantboy pregnantboy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

verified, works! good catch

@kevinkim-ogp kevinkim-ogp merged commit 5d22386 into develop-v2 Aug 4, 2025
6 checks passed
@kevinkim-ogp kevinkim-ogp deleted the fix/postman/remove-deleted-form-attachments branch August 4, 2025 08:55
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.

3 participants