Server overview 500s as soon as a backup exists: a span handed to timesince #83
Labels
No labels
accessibility
authentication
breaking change
bug
documentation
enhancement
interface
internationalisation
observability
security
tier
1
tier
2
tier
3
tier/4
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Postulo/postulo#83
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Observation
Reported from the live instance: Server settings → Overview returns 500 as soon as there
is a backup on disk.
What is wrong
_newest_backupincore/server_views.pyreturns the age as a span:and
server/overview.htmlhands that span totimesince, which wants a moment:timesinceimmediately readsd.year, and atimedeltahas no year.The line below it,
{% if newest_backup.age.days >= 7 %}, is correct —.daysis aquestion about a span. Both readings of "age" are in the same six lines of template, and
only one of them matches what the view returns.
Why nothing caught it
No test has ever rendered this page with a backup on disk. With an empty backup
directory the template takes the
{% else %}branch and prints "none yet", never touchingtimesince— so the unit tests passed,tests/test_page_coverage.pywas satisfied that thepage was visited, and the accessibility suite ran axe over it happily. Every one of them
looked at the empty state.
The first real archive to exist anywhere was one taken by hand before an upgrade. The page
had been broken for as long as the feature had existed, and was reachable by anybody who had
ever run
manage.py backup— which is to say, anybody following the documentation.The fix
Return both, since the page needs both and they are not interchangeable:
made_at|timesincefor the words,age.daysfor the week. Three tests come with it: abackup on disk renders, one older than a week says so, and an empty directory still says
"none yet" — the last so the branch that used to be the only one tested stays tested.
Worth thinking about beyond this bug
The empty state is the easy state, and it is the one a fixture gives you for free. Every
page whose interesting branch needs a file, a backup or a plugin on disk is a page whose
interesting branch may never have been rendered.
tests/test_page_coverage.pyproves a pagewas visited; it cannot prove it was visited with anything in it.
Classification
Bug. Present in 0.2.0 and in every release before it.