Read workspace name and disabled state in one query on the invitation page
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 68/100
Research direction
Start with server/orcaster_server/workspaces/seam.py and the two queries in server/orcaster_server/workspaces/service.py; trace how describe_invitation handles disabled, missing, and enabled workspaces. Add a deterministic test for the interleaving and check query counts, alias and uppercase UUID forms, and the invitation mint path in server/orcaster_server/api/admin_ui.py. Done when one read supplies both fields, existing behaviors pass, and the changelog has an Unreleased entry.
Written by the indexing model from the issue text.
Description
Problem
The invitation page decides whether it may name a workspace and then reads the name, in two separate queries.
describe_invitation calls is_workspace_disabled (server/orcaster_server/workspaces/seam.py:70) and then get_workspace_name (server/orcaster_server/workspaces/seam.py:83). The two queries are server/orcaster_server/workspaces/service.py:147 and server/orcaster_server/workspaces/service.py:128.
The engine does not set an isolation level (server/orcaster_server/db.py:23), so PostgreSQL uses READ COMMITTED and each query sees its own snapshot. If a workspace is disabled and renamed in one commit between the two queries, the page withholds nothing and prints the new name of a workspace that is already disabled.
The window is a few milliseconds and needs two concurrent changes. The exposure is small, but the check and the value it protects should come from the same read. A valid page view also runs two queries where one is enough.
Steps to reproduce
- Create a valid invitation for an enabled workspace.
- Wrap
is_workspace_disabledin a test so that, right after it returns, another session commits one transaction that setsdisabled_atand changesname. - Render the invitation page.
- The page answers 200 and shows the new name, although the workspace is disabled at that point.
Proposed change
- Add one service function that parses the id once and reads
nameanddisabled_atin one statement. It returns nothing when the workspace does not exist or the id is not usable. describe_invitationcalls it once. A disabled row givesINVITATION_WITHHELD. An enabled row gives the usual description. A missing row keeps today's behavior (warning,None).- Keep
get_workspace_namefor the invitation mint (server/orcaster_server/api/admin_ui.py:1453). - Keep a single UUID parsing rule: make
is_workspace_disableda thin wrapper over the new function, or remove it if nothing else needs it. Note that the two helpers accept different id forms today (server/orcaster_server/workspaces/service.py:136); the permissive form of the disabled check must stay. - No change of isolation level or locking.
Acceptance criteria
-
describe_invitationruns one workspace query per call (a test counts statements or spies on the service function). - A deterministic test reproduces the interleaving and shows that the page never prints the name of a workspace that is disabled at read time.
- A disabled workspace gives the withheld text, also when the payload id is an alias form of the UUID. An enabled workspace gives
Workspace “<name>” as <role>. A missing workspace and unusable payloads behave as before. - Uppercase canonical ids still resolve, and the id parsing rule exists in one place.
-
get_workspace_namestill serves the invitation mint and its tests pass. - Existing deployments keep working without config or schema changes.
- CHANGELOG entry under Unreleased.
- Dominant language
- Python
- Stars
- 0
- Forks
- 0
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 10
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from AInvirion/orcaster
-
enhancement P3 server
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
Maintainers usually reply within 1 day
-
enhancement good first issue P3 server
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
bug P2 server
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Maintainers usually reply within 1 day
-
bug P3 server
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
enhancement P3 server
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
All issues in AInvirion/orcaster
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 69/100
daniel-ospina/tortoise#15308 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day
-
difficulty:easy prio:low type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
NatronGitHub/Natron#2405 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Jstar269/nakagawa-recomp#3746 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day