Fix Internal Server Error on /finished_labs with null timestamps - #300
Merged
Conversation
The /finished_labs view crashed with an AttributeError when a LabInstances row had a NULL created_at (or updated_at), since strftime() was called directly on None. Guard both fields and render "--" when the timestamp is missing, matching the existing convention used for finish_reason. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
What
Guards the
created_atandupdated_atfields in the/finished_labsview (view_finished_labs) so they render"--"whenNoneinstead of crashing.Why
Accessing the finished_labs page returned an Internal Server Error. The server log showed:
One or more finished
LabInstancesrows have aNULLcreated_at, sostrftime()was called onNone. The adjacentupdated_atfield had the same exposure, so both are now guarded. The"--"fallback matches the existing convention already used forfinish_reasonon the line below.Reviewer notes
created_atis normally auto-populated on insert, so aNULLvalue suggests some rows were created via a path that bypassed the default (bulk insert / migration). This PR only fixes the crash; the underlying data question of why a timestamp is null may be worth a follow-up.