Skip to content

fix: create blueapi cache folder on login#1520

Merged
NeilSmithDLS merged 4 commits intomainfrom
fix--creating-blueapi-cache-folder-on-login
May 7, 2026
Merged

fix: create blueapi cache folder on login#1520
NeilSmithDLS merged 4 commits intomainfrom
fix--creating-blueapi-cache-folder-on-login

Conversation

@NeilSmithDLS
Copy link
Copy Markdown
Contributor

Check for the existence of the blueapi cache folder on login and if it doesn't exist create it.

fixes 1448

@NeilSmithDLS NeilSmithDLS requested a review from a team as a code owner April 27, 2026 08:20
Comment thread src/blueapi/service/authentication.py Outdated
@NeilSmithDLS NeilSmithDLS marked this pull request as draft April 27, 2026 13:44
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.35%. Comparing base (85cd819) to head (d4b4d28).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1520   +/-   ##
=======================================
  Coverage   95.34%   95.35%           
=======================================
  Files          43       43           
  Lines        3200     3205    +5     
=======================================
+ Hits         3051     3056    +5     
  Misses        149      149           

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

@NeilSmithDLS NeilSmithDLS force-pushed the fix--creating-blueapi-cache-folder-on-login branch from 5181f8f to 36ebbfc Compare April 30, 2026 11:56
@NeilSmithDLS NeilSmithDLS marked this pull request as ready for review April 30, 2026 11:56
os.chmod(self._file_path, 0o600)

def load_cache(self) -> Cache:
self._create_parent_folder_if_necessary()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we need to create the directory on load? If it doesn't exist, I imagine this will behave the same as if the cache file doesn't exist which is (hopefully) already handled.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

If you look in the stack trace on the ticket there were 2 errors thrown, the first when trying to open the file in this method, and the second when calling can_access_cache as part of the error handling for the first error.

If it is correct that this method should error and fall back on the error handling if the folder doesn't exist, then this can be removed, otherwise it does need to stay

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think load_cache will still throw the exception when the file doesn't exist so creating the directory doesn't really achieve much. The second exception where it can't start the device flow does need the directory to be present.

It doesn't really matter though so feel free to leave it if it would otherwise hold up the bug being fixed.

Comment thread src/blueapi/service/authentication.py Outdated
Copy link
Copy Markdown
Contributor Author

@NeilSmithDLS NeilSmithDLS left a comment

Choose a reason for hiding this comment

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

?

@NeilSmithDLS NeilSmithDLS force-pushed the fix--creating-blueapi-cache-folder-on-login branch from 47f7c6c to d4b4d28 Compare May 6, 2026 13:53
@tpoliaw tpoliaw linked an issue May 6, 2026 that may be closed by this pull request
@NeilSmithDLS NeilSmithDLS added this pull request to the merge queue May 7, 2026
Merged via the queue into main with commit 62353cd May 7, 2026
19 checks passed
@NeilSmithDLS NeilSmithDLS deleted the fix--creating-blueapi-cache-folder-on-login branch May 7, 2026 10:23
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.

ArgoCD Blueapi pod login fails

3 participants