Skip to content

Conversation

@ponyisi
Copy link
Collaborator

@ponyisi ponyisi commented Jul 12, 2025

If servicex cache list is called while jobs are listed in the cache in the SUBMITTED state, it will crash since the stored documents are not proper TransformedResults. Exclude these requests from the list.

@codecov
Copy link

codecov bot commented Jul 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.50%. Comparing base (188c034) to head (d58ae54).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #618   +/-   ##
=======================================
  Coverage   96.50%   96.50%           
=======================================
  Files          29       29           
  Lines        1974     1974           
=======================================
  Hits         1905     1905           
  Misses         69       69           
Flag Coverage Δ
unittests 96.50% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR prevents the cached_queries method from attempting to instantiate TransformedResults for entries still in the SUBMITTED state and adds a test to ensure it doesn’t crash or return results for those entries.

  • Filter out SUBMITTED-state documents in cached_queries
  • Add assertion in tests that cached_queries returns an empty list when only SUBMITTED entries are present

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
tests/test_query_cache.py Added assertion that cached_queries returns an empty list for SUBMITTED jobs
servicex/query_cache.py Updated database query to exclude status == "SUBMITTED"
Comments suppressed due to low confidence (3)

tests/test_query_cache.py:328

  • [nitpick] Rephrase this comment for clarity, e.g.: “Assert that cached_queries() returns an empty list without errors when only SUBMITTED entries exist.”
        # assert that in this state that cached_queries does NOT crash and returns nothing

tests/test_query_cache.py:331

  • Consider adding a test to verify that cached_queries actually returns TransformedResults for non-SUBMITTED statuses (e.g., COMPLETED) to confirm the filter isn’t over-restrictive.
        cache.close()

tests/test_query_cache.py:329

  • This assertion assumes you're testing a SUBMITTED state, but this test is still using the completed_status fixture. You’ll need to insert or configure a SUBMITTED-state entry (or use a dedicated submitted_status fixture) so that cached_queries is actually filtering out SUBMITTED documents.
        assert len(cache.cached_queries()) == 0

Copy link
Collaborator

@gordonwatts gordonwatts left a comment

Choose a reason for hiding this comment

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

Perfect!

@ponyisi ponyisi merged commit d10f54b into master Jul 12, 2025
37 checks passed
@ponyisi ponyisi deleted the fix-cache-view branch July 12, 2025 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants