Skip to content

Submission date extraction failure is not reported well (and date-guessing heuristics are delicate) #8434

@jennifer-richards

Description

@jennifer-richards

Describe the issue

If a user submits an XML draft with a missing or incomplete date, the submission tool tries to fill in a reasonable guess. The rule is roughly

  1. Use year if provided, otherwise assume the current year
  2. Use month if provided, otherwise if the year is the current year, assume the current month
  3. ... similar stuff to guess a day ...

There's a poorly handled corner case here: if a user provides a year but not a month / day, the date is filled in but only if the year is the current year. If it's any other year, the month and day are left as None. This leads to an unhandled exception that is logged as a generic "A system error occurred" type message in the submission's history.

This appears to have come up for at least one and maybe a couple users following 2025-01-01. I don't have their draft source, but I'm guessing they were using "2024" as the date in their drafts.

To resolve this, we must at least raise a SubmissionError in the date extraction code for the case that we're unable to extract a date. If we raise this with a message that indicates that the problem was in the date element, then it will be reported to the submitter who will then have a useful nudge toward fixing their problem.

We might also consider improving the heuristics to look at time intervals rather than calendar years/months for deciding whether it's reasonable to assume "today" or "this month" as the date. That's a bigger can of worms, though.

Code of Conduct

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions