Skip to content

Fix bug in VSOClient where ill formatted times would cause a crash - #8702

Merged
Cadair merged 3 commits into
sunpy:mainfrom
samaloney:vsoclient-baddate
Aug 20, 2026
Merged

Fix bug in VSOClient where ill formatted times would cause a crash#8702
Cadair merged 3 commits into
sunpy:mainfrom
samaloney:vsoclient-baddate

Conversation

@samaloney

@samaloney samaloney commented Jul 2, 2026

Copy link
Copy Markdown
Member

PR Description

Closes #8687 by treating dates which can't be parsed in a similar way to missing dates, use a dummy value and mask the corresponding entry in the table.

AI Assistance Disclosure

AI tools were used for:

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding
  • No AI tools were used

Regardless of AI use, the human contributor remains fully responsible for correctness, design choices, licensing compatibility, and long-term maintainability.


def test_QueryResponse_build_table_bad_time_format(mocker):
mocker.patch("sunpy.net.vso.vso.build_client", return_value=True)
records = (MockQRRecord(start_time="20220102030462"),)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I suggest testing using a more wildly incorrect time, such as the 73rd month of the year. At some point, we could conceivably modify parse_time() to handle slight overages in seconds (similar to how we catch and fix "24:00:00").

@samaloney samaloney Jul 2, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

How about?

Suggested change
records = (MockQRRecord(start_time="20220102030462"),)
records = (MockQRRecord(start_time="20169998979695"),)

Yea I guess if we made some assumptions we could do that do something for these cases.

But I had a look at the underling fits file in one case where the time in the json response is '20160518065962' and the time related headers from the file kanz_caiik_fi_20160518_065959.fts are

DATE_OBS= '2016-05-18T06:59:59Z' / Date of observation
DATE-OBS= '2016-05-18T06:59:59' / Date of observation
...
EXP_TIME=                2.333 / Exposure Time [ms]

So not clear to me where the 62 for this specific files come from unless they round up and take ms as s to get 59+3?

I've no idea if a 2.33ms exposure time makes sense for a KANZELHOEHE CIIk filter image.

@ayshih ayshih Jul 2, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

So not clear to me where the 62 for this specific files come from unless they round up and take ms as s to get 59+3?

Ha ha, it certainly gives the appearance of someone mistaking milliseconds for seconds. Google searching indicates that the exposure time can be as long 35 ms, so it'd be good to try to find a long exposure to see if the end time is pushed out by that many seconds. Otherwise, it could simply be that 3 seconds is a canonical observation interval (e.g., maybe how long it takes to read out the sensor).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@ayshih @samaloney does this thread need resolving before we merge this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yea I think the 99th month the the 98th day ... 97, 96, 95, are wildly enough wrong 😆

@samaloney

Copy link
Copy Markdown
Member Author

Don't think the test fails are related

@samaloney
samaloney force-pushed the vsoclient-baddate branch from 3050de2 to f98878a Compare July 11, 2026 19:51
* Now unparable times are replaced with a dummy value and the entry is masked, similar to how missing value were already treated.
Comment thread sunpy/net/vso/table_response.py Outdated

@Hermanlrx Hermanlrx left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM with indent fix

@Cadair
Cadair requested a review from ayshih August 19, 2026 16:28
Co-authored-by: Stuart Mumford <stuart@cadair.com>
@Cadair
Cadair merged commit 9a36cf1 into sunpy:main Aug 20, 2026
65 of 71 checks passed
@Cadair Cadair added the net Affects the net submodule label Aug 20, 2026
@Cadair

This comment was marked as duplicate.

@Cadair Cadair added the backport 8.0 on-merge: backport to 8.0 label Aug 20, 2026
@Cadair

Cadair commented Aug 20, 2026

Copy link
Copy Markdown
Member

@meeseeksdev backport to 8.0

Cadair added a commit that referenced this pull request Aug 20, 2026
Cadair added a commit that referenced this pull request Aug 20, 2026
…2-on-8.0

Backport PR #8702 on branch 8.0 (Fix bug in VSOClient where ill formatted times would cause a crash)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport 8.0 on-merge: backport to 8.0 net Affects the net submodule

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VSO client queries can fail when data provider timestamps are in an unsupported format

5 participants