Skip to content

Exclude trashed items from Google Drive folder lookup (PP-4435)#3378

Merged
dbernstein merged 2 commits into
mainfrom
bugfix/playtime-report-trashed-folder-filter
May 27, 2026
Merged

Exclude trashed items from Google Drive folder lookup (PP-4435)#3378
dbernstein merged 2 commits into
mainfrom
bugfix/playtime-report-trashed-folder-filter

Conversation

@dbernstein
Copy link
Copy Markdown
Contributor

@dbernstein dbernstein commented May 22, 2026

Description

Adds trashed = false to the get_file query in GoogleDriveService so that folders moved to the Drive trash are excluded from lookup results.

Motivation and Context

Without this filter, a trashed folder named e.g. "Blackstone Unlimited" would be returned by get_file as though it were a live folder. create_nested_folders_if_not_exist would then use the trashed folder's ID as the parent for nested folders and the final file upload — causing all uploaded reports to land inside a trashed (invisible) directory.
JIRA: https://ebce-lyrasis.atlassian.net/browse/PP-4435

How Has This Been Tested?

  • Added test_get_file_excludes_trashed_items which verifies trashed = false appears in the decoded Drive API request URI.
  • All existing Google Drive service tests continue to pass.

Checklist

  • I have updated the documentation accordingly.
  • All new and existing tests passed.

@dbernstein dbernstein added the bug Something isn't working label May 22, 2026
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 22, 2026

Claude finished @dbernstein's task in 1m 2s —— View job


Summary

The fix is minimal, focused, and correct. Adding trashed = false to the Drive API list query is exactly the right mechanism to exclude trashed items; the existing create_nested_folders_if_not_exist / create_file callers immediately benefit without needing any changes. The test validates the filter correctly by inspecting the decoded request URI rather than mocking out the query-building logic.

Details

Nit: src/palace/manager/service/google_drive/google_drive.py:29-31

The inline comment restates the same explanation already captured in the method docstring (:return: line and the method description). Per the project's commenting guidelines, inline comments should only appear when the WHY is not otherwise communicated. Since the docstring already covers it, this comment adds no new information and could be removed.

# Explicitly exclude trashed items so that a folder moved to the
# Drive trash is not mistaken for a live folder, which would cause
# uploads to land inside a trashed (invisible) directory.


@dbernstein dbernstein requested a review from a team May 22, 2026 04:58
@codecov
Copy link
Copy Markdown

codecov Bot commented May 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.34%. Comparing base (5315bfb) to head (e9312d4).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3378      +/-   ##
==========================================
- Coverage   93.34%   93.34%   -0.01%     
==========================================
  Files         507      507              
  Lines       46434    46434              
  Branches     6336     6336              
==========================================
- Hits        43345    43343       -2     
- Misses       1999     2000       +1     
- Partials     1090     1091       +1     

☔ 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.

dbernstein and others added 2 commits May 22, 2026 09:50
get_file was querying Google Drive without a 'trashed = false' filter,
so folders that had been moved to the trash were returned as valid
parents. Any report uploaded to a trashed folder is invisible to users.

Add 'trashed = false' to the query and cover the behaviour with a test
that inspects the raw request URI sent to the Drive API.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dbernstein dbernstein force-pushed the bugfix/playtime-report-trashed-folder-filter branch from 8d0fa4c to e9312d4 Compare May 22, 2026 16:50
@dbernstein dbernstein changed the title Exclude trashed items from Google Drive folder lookup Exclude trashed items from Google Drive folder lookup (PP-4435) May 22, 2026
@dbernstein dbernstein merged commit b79b00f into main May 27, 2026
21 checks passed
@dbernstein dbernstein deleted the bugfix/playtime-report-trashed-folder-filter branch May 27, 2026 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants