Skip to content

Include sunset_url in the 410 export-only response body #1938

Closed

Description

@MODSetter

The gap

docs/architecture/sunset.md lists this under Known gaps:

The 410 body carries no sunset_url.

Why it matters

While the hosted service is export-only, SunsetWriteBlockMiddleware answers every blocked write with 410 Gone and a detail sentence and nothing else. A client that hits that wall has no machine-readable way to reach the page explaining what happened — it would have to already know to call GET /health, which does return sunset_url. The two places a client learns the service is winding down should hand back the same URL.

The hosted data is purged on 18 Oct 2026, so anything that helps a user find the export page is worth doing soon.

Where

  • surfsense_backend/app/sunset.py — the JSONResponse at the end of SunsetWriteBlockMiddleware.dispatch(), and the _DETAIL constant above it.
  • sunset_url() already lives in that same module and is what GET /health reads, so the value is there for the taking. Don't add a second way to read SUNSET_URL.

What done looks like

  • The 410 body carries sunset_url next to detail.
  • It comes from sunset_url(), so a deployment that sets SUNSET_URL changes the health field and the 410 together.
  • The "Refusing writes" section of docs/architecture/sunset.md quotes the refusal body — update that quote.
  • Delete the Known gaps line in the same PR.

This is not a contract change: contract 4 covers GET /health only and says nothing about the 410 body, so you do not need sign-off from both sides.

How to verify

Tests for this middleware already exist in surfsense_backend/tests/unit/test_sunset_write_block.py. Add one that a blocked write returns 410 with sunset_url in the body, and one that a custom SUNSET_URL shows up there. Write the failing test first.

cd surfsense_backend
uv run pytest -m unit -k sunset
uv run ruff check .
python ../scripts/check_docs.py

Before you start

Read CONTRIBUTING.md and the sunset doc. Open your PR against dev, not main. Comment here to claim this.

Activity

  1. added
    help wantedExtra attention is needed
    backendPython/FastAPI backend
    hostedHosted service, license portal, scraper API and wind-down
    on Sep 28, 2026
  2. added a commit that references this issue on Sep 29, 2026
    30d073d
  3. MODSetter commented on Sep 29, 2026

    @MODSetter
    OwnerAuthor

    Fixed by #2022, fix(sunset): include sunset_url in the 410 export-only body, by @MannXo. Merged into dev.

    Closing by hand rather than by keyword: Fixes #1938 only auto-closes on a merge to the default branch, and this repo merges through dev (CONTRIBUTING), so this would have stayed open and claimable while the work was already done. It reaches main with the next release.

    Nothing left to pick up here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendPython/FastAPI backendgood first issueGood for newcomershelp wantedExtra attention is neededhostedHosted service, license portal, scraper API and wind-down

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions