Expired sessions are not handled, and eight copies of the request helper have drifted apart

Open
#235 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
43/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
python, react, typescript

Research direction

Start with the eight request helpers and app/src/lib/query/client.ts; trace how each screen handles write permissions and how sign-in accepts a return address. Then map the helpers and screens that need consolidation, and check how the project tests API requests and permissions. Done means one shared typed helper is used everywhere, 4xx responses are not retried, expired sessions redirect to sign-in, write controls respect the shared permission check, and tests cover 401 redirects and 204 responses.

Written by the indexing model from the issue text.

Description

enhancement

Found in the 2026-11-29 whole-repo review. Reported by a reviewer from reading the code.

Problem

Each area of the app has its own copy of the "call our API" helper (connectionFetch, associationFetch, processFetch, extensionFetch, cubeFetch, settingsFetch, two apiFetch), each with its own error type. They differ: three try to parse a body on an empty (204) response; one drops the error code and does not send cookies. None handles a 401, and the query client retries every error once, including 4xx (app/src/lib/query/client.ts).

How it goes wrong

When a session expires mid-edit every request fails with "Request failed: 401" and nothing sends the user to sign in again.

Related UX gap: product, item and extension screens show create/edit/delete buttons to users whose role cannot write (other screens hide them), so they fill in a form and get refused on submit.

Suggested fix

One shared helper with a typed error; no retry on 4xx; on 401 redirect to sign-in with a return address; one shared "can this user write" hook used on every screen.

Acceptance criteria

  • One helper, used everywhere; test for the 401 redirect and the 204 case
Dominant language
Python
Stars
0
Forks
2
Avg merge
8h 26m
Merged PRs (30d)
47

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from TechTraverse/stac-higher

All issues in TechTraverse/stac-higher

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.