You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
See #234 for previous notes/context. This rebased PR supersedes the old one. It includes some additional fixes and improvements.
Some work is still needed after the rebase:
The Redis client/db used for API key store needs to be made to use secure Redis, and also needs a dedicated db index (or maybe not depending how prefixing works in Redis now?)
We should make secure Redis default to True? Or even better, remove this flag completely and only use secure Redis?
Normalized beamline vs not for Redis location and prefix? Get on the same page about prefixing in general (and greedy RedisJSONDict ingestion)
The host resolver needs to be retooled to be more robust
Check that pixi has the right requirements for the new version
Add Redis parameters to doctstrings
Double check that I strung the Redis parameters through everywhere
Possibly reorder the argsparse section, as well as the added function arguments
And some things to callout:
I added the beamline TLA to the Redis location and prefix for better disambiguation - avoids endstation/endstation and endstation/beamline naming conflicts (multiple beamlines may have an ARPES endstation, for example)
I had done this for the key prefixes in the previous PR, but the rebase is almost all Redis changes, so I point it out explicitly here
I changed the enable-ssl flag to capitalized -S, since -s is used in the new version for an important function (switching between authorized proposals)
I also updated the pixi-.lock after dependency changes:
$ pixi lock
[...]
✔ Updated lock file
Environment: default
- P ldap3 2.9.1
- P pyasn1 0.6.4
Environment: dev
- P ldap3 2.9.1
- P pyasn1 0.6.4
+ P pytest-asyncio 1.4.0
Environment: py311
- P ldap3 2.9.1
- P pyasn1 0.6.4
+ P pytest-asyncio 1.4.0
Environment: py312
- P ldap3 2.9.1
- P pyasn1 0.6.4
+ P pytest-asyncio 1.4.0
Environment: py313
- P ldap3 2.9.1
- P pyasn1 0.6.4
+ P pytest-asyncio 1.4.0
And hardened the decisions made about when to clear the active API key, or retain it and insist upon successful revocation:
Situation
HTTP / Result
Redis Key
Operation
No key stored
No request
Unchanged / empty
Continues
Valid key, revocation succeeds
204
Cleared
Continues
Key expired before context creation
401
Cleared
Continues
Key expired before which_api_key()
401
Cleared
Continues
Key manually deleted before validation
401
Cleared
Continues
Valid key lacks revoke scope
401 from revoke
Retained
Aborts
Revocation explicitly forbidden
403
Retained
Aborts
Key disappears after validation
404 from revoke
Cleared
Continues
Network error or timeout
Request error
Retained
Aborts
Tiled server error
5xx
Retained
Aborts
Unexpected context creation error
Any other error
Retained
Aborts
Redis clearing fails after revocation
Redis error
Possibly retained
Aborts; retry later detects unusable key
logout() or close() fails
Cleanup error
Already cleared or retained based on preceding result
Experiments (proposals) are "authorized". Then, one of the authorized
experiments is "activated". Multiple proposals may be authorized at the
same time, but only one proposal can be active at a time.
This should make more clear what the tool is doing, and how the policy
works, as opposed to before (authorize/activate vs activate/select or
activate/load).
Includes some other minor word fixes.
The reason will be displayed to describe this comment to others. Learn more.
This is one of the things I needed to dig into from the prefix change. However, the hostname list in the utils should be removed, and the resolver needs to be made more robust than its current naive sub-string check.
For beamline='sst1' with an sst1 Tiled profile and no endstation, this passes sst to profile lookup and raises Cannot find Tiled profile, ignoring the configured profile. Revocation uses the same normalized name. Preserve the requested beamline for Tiled profile selection in both authentication and revocation, and pass the Redis namespace separately.
The removed validate_proposal handled an error_message inside the proposal payload even when HTTP status was successful. That response now reaches proposal['instruments'] and raises KeyError, hiding the server's explanation. Restore the error-payload check before accessing proposal fields.
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See #234 for previous notes/context. This rebased PR supersedes the old one. It includes some additional fixes and improvements.
Some work is still needed after the rebase:
True? Or even better, remove this flag completely and only use secure Redis?RedisJSONDictingestion)Check that pixi has the right requirements for the new versionAdd Redis parameters to doctstringsDouble check that I strung the Redis parameters through everywherePossibly reorder the argsparse section, as well as the added function argumentsAnd some things to callout:
enable-sslflag to capitalized-S, since-sis used in the new version for an important function (switching between authorized proposals)I also updated the
pixi-.lockafter dependency changes:And hardened the decisions made about when to clear the active API key, or retain it and insist upon successful revocation:
204401which_api_key()401401401from revoke403404from revoke5xxlogout()orclose()fails