Open
Conversation
We have had lots of intermittent test failures on these tasks. These tasks are all swallowing their errors which makes it difficult to debug. We could make the tests output the rails log to standard out or make the log available after but this will make the output hard to match up to the individual test. Generally we shouldn't swallow errors like this as it makes it difficult to debug and easy for tests to pass for the wrong reasons. The transaction will work as before as any error raised in a transaction will call a rollback.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes local error-swallowing in seed-related rake tasks so that failures propagate to the caller (tests/CI and the reseed endpoint), making intermittent failures actionable while still preserving transactional rollback behavior.
Changes:
- Removed
rescue StandardErrorblocks that logged and then raisedActiveRecord::Rollback(which suppresses the original exception). - Allowed exceptions inside
ActiveRecord::Base.transactionblocks to bubble up naturally (rollback still occurs automatically).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
lib/tasks/test_seeds.rake |
Stops converting task failures into silent rollbacks; errors now fail the task and surface in output. |
lib/tasks/for_education.rake |
Same change across the for_education seed/destroy tasks to avoid masking failures. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Test coverage89.81% line coverage reported by SimpleCov. |
The previous commit caused of the for education tests to fail as it was trying to destroy a school that didn't exist. This might have been the cause of the intermittent failures as previously if the school didn't exist (but other data did) it would rollback and restore the other data.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We have had lots of intermittent test failures on these tasks. These tasks are all swallowing their errors which makes it difficult to debug (e.g. https://github.com/RaspberryPiFoundation/editor-api/actions/runs/22575865268/job/65394916486 )
We could make the tests output the rails log to standard out or make the log available after but this will make the output hard to match up to the individual test.
Generally we shouldn't swallow errors like this as it makes it difficult to debug and easy for tests to pass for the wrong reasons.
The transaction will work as before as any error raised in a transaction will call a rollback.