Skip to content

Implement offline access in python #1851

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Apr 3, 2025
Merged

Implement offline access in python #1851

merged 8 commits into from
Apr 3, 2025

Conversation

jmthomas
Copy link
Member

@jmthomas jmthomas commented Jan 20, 2025

closes #1304

I don't think this is complete to fully close 1304 but I did the initial port of the offline access stuff.

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
E Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Copy link

codecov bot commented Jan 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.56%. Comparing base (aa6b0d3) to head (a75f17a).
Report is 14 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1851      +/-   ##
==========================================
+ Coverage   76.81%   79.56%   +2.74%     
==========================================
  Files         629      528     -101     
  Lines       47002    41656    -5346     
  Branches      755        0     -755     
==========================================
- Hits        36105    33143    -2962     
+ Misses      10814     8513    -2301     
+ Partials       83        0      -83     
Flag Coverage Δ
frontend ?
python 83.88% <ø> (-0.16%) ⬇️
ruby-api 48.30% <ø> (ø)
ruby-backend 82.86% <ø> (-0.01%) ⬇️

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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jmthomas jmthomas requested a review from ryanmelt February 23, 2025 16:36
@jmthomas jmthomas marked this pull request as ready for review February 23, 2025 16:36
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
E Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@ryanmelt
Copy link
Member

I think what is really needed for this PR is the ability to query Keycloak for an offline_access token. Currently we can only do that from the frontend.

@ryanmelt
Copy link
Member

ryanmelt commented Apr 2, 2025

This is now complete

@@ -19,28 +19,29 @@
require 'openc3/models/model'

module OpenC3
# Note: This model is locked to the DEFAULT scope
Copy link
Member Author

Choose a reason for hiding this comment

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

Is this because you really only need 1 offline access token and the DEFAULT scope is always there?

Copy link
Member

Choose a reason for hiding this comment

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

Exactly.

if @scope == 'DEFAULT'
# Periodic Microservice
deploy_periodic_microservice(gem_path, variables, @parent)
end
Copy link
Member Author

Choose a reason for hiding this comment

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

I think this makes sense to only be the DEFAULT scope but our 20221210174900_convert_to_multi.rb migration starts the periodic microservice for all scopes. Do we need a migration to stop this for all existing scopes except DEFAULT?

Copy link
Member

Choose a reason for hiding this comment

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

That would be better yes. The extras won't hurt anything, but they are unneeded so we can add a migration to remove them.

@@ -75,14 +75,14 @@ def initialize(url)
end

# Load the token from the environment
def token(include_bearer: true)
def token(include_bearer: true, openid_scope: 'openid')
Copy link
Member Author

Choose a reason for hiding this comment

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

What is this scope? I assume it has something to do with keycloak? Why does it now have to be configurable?

Copy link
Member

Choose a reason for hiding this comment

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

This is the "scope" of the token. I need to modify it to include "offline_access" to get the offline access token.

Copy link

sonarqubecloud bot commented Apr 2, 2025

@ryanmelt ryanmelt merged commit a641d91 into main Apr 3, 2025
29 of 30 checks passed
@ryanmelt ryanmelt deleted the py_access branch April 3, 2025 15:41
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.

ability to execute scripts uploaded by "put_target_file" outside script runner
2 participants