Skip to content

🏹🚆 Trainsformer Validations: Make sure all errors are reported to frontend#1354

Open
firestack wants to merge 10 commits intomasterfrom
kf/feat/trainsformer-export-error-refactor
Open

🏹🚆 Trainsformer Validations: Make sure all errors are reported to frontend#1354
firestack wants to merge 10 commits intomasterfrom
kf/feat/trainsformer-export-error-refactor

Conversation

@firestack
Copy link
Member

@firestack firestack commented Feb 3, 2026

Summary of changes

Asana Ticket: 🏹🚆 Trainsformer Validations: Make sure all errors are reported to frontend

This is a somewhat large refactor of the way we're reporting errors and warnings from the Arrow.Trainsformer.ExportUpload validation module, and how ArrowWeb Trainsformer pages use those errors & warnings.

This change bundles reporting invalid CSV errors and reporting multiple errors and warnings at once because implementing multiple errors without also implementing changes on the other functions was a bit of a mess to manage multiple error "shapes" on top of the existing ways errors were reported.

I tried a few different ways of returning multiple errors & warnings to the frontend, and a few different ways of returning errors (4 element tuple for warnings & errors, rather than nested tuples) and I found that I think this is the implementation I favored the most in terms of friction and extensibility.

I tried to make the commits make logical sense in the order of refactors and changes, so you should be able to read the commits in order to understand the intention and reasoning.

Reviewer Checklist

  • Meets ticket's acceptance criteria
  • Any new or changed functions have typespecs
  • Tests were added for any new functionality (don't just rely on Codecov)
  • This branch was deployed to the staging environment and is currently running with no unexpected increase in warnings, and no errors or crashes.

@firestack firestack marked this pull request as ready for review February 3, 2026 22:27
@firestack firestack requested a review from a team as a code owner February 3, 2026 22:27
@firestack firestack requested review from jzimbel-mbta and removed request for a team February 3, 2026 22:27
@firestack firestack force-pushed the kf/feat/trainsformer-export-error-refactor branch from 94dbfb2 to 9af52e1 Compare February 3, 2026 22:32
@firestack firestack force-pushed the kf/feat/trainsformer-export-error-refactor branch from 9af52e1 to 3e78eef Compare February 3, 2026 22:34
Comment on lines 312 to 319
defp alert_message(%{data: data} = assigns) when not is_nil(data) do
~H"""
{@message}
<ul>
<li :for={element <- @data}>{element}</li>
</ul>
"""
end
Copy link
Member Author

Choose a reason for hiding this comment

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

note: one issue I have with this implementation is that there's this undocumented/implicit behavior where if there's a metadata key that matches the key of the error/warning, it uses this implementation to render the contents nicely as a list.

I wanted to use translate_error/1 or some Gettext function to do this, but I haven't been able to figure out how to blend HTML/HEEx with Gettext so this was the best idea I could come up with :/

Copy link
Member Author

Choose a reason for hiding this comment

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

I tried to make it a bit more clear with 704ecfa (this PR)

But that doesn't help with discoverability of the "convention" in export_upload.ex

@firestack firestack force-pushed the kf/feat/trainsformer-export-error-refactor branch from 3a41102 to 704ecfa Compare February 3, 2026 22:57
@firestack firestack force-pushed the kf/feat/trainsformer-export-error-refactor branch from 704ecfa to d54c3bc Compare February 4, 2026 12:51
@firestack firestack force-pushed the kf/feat/trainsformer-export-error-refactor branch from d54c3bc to 621fbc6 Compare February 4, 2026 12:53
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