Skip to content

feat(api)!: retire /api/v1 behind a 410 tombstone - #3200

Merged
Quick104 merged 1 commit into
mainfrom
silo/deprecate-api-v1
Nov 11, 2026
Merged

Quick104 merged 1 commit into
mainfrom
silo/deprecate-api-v1

Conversation

@Quick104

@Quick104 Quick104 commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Related issue: #886
Validation tasks: changes #1190 C1

Silo has served two native business APIs since /api/v2 shipped: the frozen alpha /api/v1 and /api/v2. The web client and the current Apple and Android apps use only v2. Keeping v1 means every behavior change has to be checked against two transports, and v1-only code paths keep drifting from the v2 rules. The plan in #886 was to carry v1 through two published pre-1.0 bridge releases. The maintainer waived those releases on 2026-10-27, since v2 has shipped long enough.

This change retires /api/v1 now. Every /api/v1 route on the main API listener answers 410 Gone with client_upgrade_required. The v1 handlers and the migration tooling that compared v1 with v2 are removed.

Approach

Tombstone.

  • Behavior:
    • /api/v1, /api/v1/, and every descendant answer 410 with Cache-Control: no-store.
    • The body is the v1 error shape, so an old client can still show the reason: {"error":"client_upgrade_required","message":…,"docs_url":"https://siloserver.org/docs/update-to-1.0"}.
    • It runs no authentication and never redirects. Old URLs can carry tokens.
  • Unchanged:
    • GET /api/v1/health and GET /api/v1/ready.
    • The proxy and transcode-node GET /api/v1/health.
  • Retired URLs that carry a credential in the path are registered on the tombstone by name: the autoscan, webhook-sync, and Plex-sync webhooks, and invitation tokens. This keeps the request and activity logs redacting the secret when an external service keeps calling the old URL.

Removed with v1:

  • The v1 router block and the handler methods only it used.
  • The v1 branches in shared code:
    • Middleware path tables: activity log, temporary-password routes, API-key scopes.
    • Playback start and replan.
    • The SubRip sidecar route.
    • OAuth start, callback, and completion.
    • The plugin proxy. Its same-origin redirect check is now always on; only v1 used the variant without it.
    • The request Discover service.
    • Bridge branches main added after this branch was opened: the frozen-v1 shaping of playback decisions, the bridge's device and lifecycle source at playback start, the events socket's bridge filter, and the v1 body buffering for household writes.
  • Code that only v1 reached, found with the unused linter and a reachability check against main:
    • About 320 request and response types, constants, and helpers the v1 handlers left behind, and about 50 request-reading helpers that only v1 or tests still called, with the tests of those helpers.
    • The v1 rule vocabulary (V1Rules, ValidateV1Rules) and the catalog parser's opt-in grammar. The parser now has one grammar, the one v2 used.
    • The v1 watch-together member projection and its narrower host band. The v2 room socket requires its subprotocol, so no connection could take that path.
    • The subtitle search bridge and the provider spelling it carried.
    • RequireAdmin, RequireActingAdmin, and NewPolicyActingAdminMiddleware. The router uses RequireActingAdminWith over the same deciders.
  • The migration harness: contracts/api/v2/migration.json and its schema, internal/contractledger, the scenario catalogs and executor, offline-routes.txt, scripts/apiv2-ledger, and their Makefile and CI targets. They existed to prove v1→v2 parity. Every route had a ratified disposition, and the parity they checked is now tested once against the v2 entry points.

Setup v2 depends on. The v1 router block also configured handler instances that v2 shares:

  • Playback item access and lookups.
  • The subtitle file authorizer.
  • Metadata AI access and its limiter.
  • Trailer refresh.
  • The notification public URL and image resolver.
  • OAuth availability.
  • Node capability refresh, invalidation, and acceleration policy.

That setup now runs where each handler is built. Methods v2 reaches only through runtime interface assertions are kept, and internal/apiv2 tests now assert those interfaces at compile time. Examples are the personal collection lifecycle, admin collection extras, and the profile-scoped history imports.

Tests. Handler tests that exercised shared behavior through a v1 route now call the method v2 uses. Tests of v1-only wire behavior were deleted.

Docs. CLAUDE.md/AGENTS.md and docs/architecture/api-contract.md record the retirement. docs/architecture/v1-scope.md stays the historical record. docs/update-to-1.0.md says integrations move when admins update to this release, not at 1.0. The surface docs under docs/ no longer describe v1 behavior.

Clients and compatibility.

  • silo-apple and silo-android main call v1 only for the retained health probe. Older app builds that still call v1 stop working against this server.
  • Jellyfin compatibility is unaffected.
  • The user manual needs an "Update to 1.0" page at the tombstone's docs_url. An issue for siloserver.org is drafted, not yet filed.

Validation

Rebased onto main at a9c75803, after #3199 merged. Run on that head:

  • go build ./..., go vet ./..., gofmt: clean.
  • make lint-changed: 0 issues.
  • verify-route-inventory, verify-apiv2-openapi, verify-apiv2-contract, verify-apiv2-fixtures, verify-local-paths, verify-migrations, verify-size-ratchet, verify-settings-bindings, verify-playback-fixtures: pass. Every test the CI workflows and scripts/ci lists name still exists, and the subprocess-test package list matches.
  • go test ./...: every package passes except two real-ffmpeg tests (TestCopyRemuxSubtitleRenditionRealFFmpeg, TestRunStatsWithRealFFmpeg), which fail the same way on main on that host.
  • Database tests: not run locally; CI runs them. Two were ported to the v2 entry points in this rebase (TestSignupCommitPolicyErrorsDB, TestEmailPrefsStayOnTheAccountDB).
  • Web gate: not run, no file under web/ changed.
  • New tests:
    • The tombstone through the real listener: root, descendants, each method, HEAD without a body, no auth, both probes.
    • Path-credential redaction. It fails without the explicit registrations.
    • Both fail on main (404) and pass here.
  • Live, on a sandbox built from main and then from the head before this rebase (e7cfed31); not repeated after it:
    • Every /api/v1 route answered 410 client_upgrade_required with Cache-Control: no-store, with or without credentials, and HEAD had no body. /api/v1/health and /api/v1/ready still answered 200.
    • The activity and request logs recorded retired path credentials as [redacted].
    • The web app's main pages made only /api/v2 requests and none failed. Playback started through /api/v2/playback/start.
    • A Jellyfin client signed in, listed libraries and movies, and got playback info, with the same results on both builds.
  • Validation impact: API keys — Server #1190 C1 recorded 403 from the v1 create routes as part of its pass. Those routes now answer 410 and still create no key; the v2 half of the case is unchanged.

Evidence

Evidence: https://evidence.siloserver.org/r/silo-server/pr-3200/

Risks

  • Breaking for anything still calling /api/v1:

    • Old app builds.
    • Third-party clients.
    • Integration URLs configured in other services: Sonarr/Radarr autoscan, webhook-sync, the Plex-sync receiver (no v2 successor of its own; move it to webhook-sync), OAuth redirect URIs, and Discord links.
    • Email links sent before the update.

    None of these redirect. Admins regenerate the URLs from the server, as docs/update-to-1.0.md describes.

  • Silent loss of setup from the deleted v1 block. The known cases are covered above. A missed one would show up as a v2 operation reporting "unavailable" or skipping a check, not as a build error.

  • Not changed here: the squashed 1.0 migration baseline and its guard remain open on API v2 Phase 6: Silo 1.0 cutover and v2 lock #886.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.
  • Each test this pull request adds meets "Decide what to test" in CONTRIBUTING.md.
  • The Evidence section shows every change a user can see, or says there is none.

AI Disclosure

  • Harness: Claude Code (in T3 Code)
  • Tool(s): Claude Code, with Claude Code subagents for porting tests and updating docs
  • Model(s): claude-opus-5-5, claude-fable-5-2 (rebase and dead-code removal)
  • Involvement: Fully AI-generated, human verified
  • Adversarial review: n/a. An automated security review of the commit flagged unredacted path credentials on retired URLs; fixed and covered by a test.

🤖 Generated with Claude Code

Note

Remove /api/v1 routes and return a 410 Gone tombstone

  • Removes the /api/v1 route group and dozens of v1-only HTTP handlers across settings, collections, catalog, notifications, admin, subtitle, playback, and watch-together areas in internal/api/handlers.
  • Adds a v1Tombstone handler in v1_tombstone.go that returns 410 Gone with a JSON upgrade notice and documentation URL; no redirect or authentication logic.
  • Deletes the v1 OAuth init/callback/complete handlers and migrates OAuth tests to the v2 paths in oauth_handler.go.
  • Drops v1-only code paths in playback, catalog validation (ValidateV1Rules, V1Rules flags), and the v1 legacy watch-together protocol, and removes related Make targets and CI contract paths.
  • Risk: breaking change — all /api/v1 clients now receive 410 Gone; check newChiRouter in router.go and the removed RequireAdmin/DemoGuard middleware in auth.go and demo_guard.go for in-tree consumers. Smart-collection rule validation now runs unconditionally instead of only for non-v1 requests, which can reject definitions the old v1 path accepted.

Macroscope summarized 0d98333.

@silo-triage silo-triage Bot added the size/XXXL 3000+ added + deleted lines (all files); change volume, not priority. label Oct 28, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T17:39:45.590435Z 0d98333 New commits
🔒 Security Review ✅ Completed 2026-11-11T17:40:28.059404Z 0d98333 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor
Pre-merge checks: Inconclusive 2

Failed Failed checks: 2 inconclusive

Check name Status Explanation Resolution
Title check Pending This assessment has not completed. The check will be retried on the next pre-merge check run.
Description check Pending This assessment has not completed. The check will be retried on the next pre-merge check run.
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@silo-kody

silo-kody Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@macroscopeapp

macroscopeapp Bot commented Oct 28, 2026

Copy link
Copy Markdown

The retired native /api/v1 routes now return 410 Gone with client_upgrade_required instead of their prior responses (internal/api/router.go, internal/api/v1_tombstone.go). Add before-and-after response excerpts for the same representative request, including status and body, and name the surface and build/commit; the current Evidence line incorrectly says there is no user-visible change.

Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness.

Posted via Macroscope — Visible change evidence

@silo-triage silo-triage Bot added api-v2 API v2 / Huma migration program (epic #135); long-running, stacked by phase enhancement New feature or request go Pull requests that update go code impact: compat Breaks a supported client or server path priority: P2 Limited scope, workaround exists, or polish labels Oct 28, 2026
@silo-triage

silo-triage Bot commented Oct 28, 2026

Copy link
Copy Markdown

Please open and link the siloserver.org follow-up mentioned in the description. CONTRIBUTING.md requires the manual issue when the PR is ready for review; it should cover the tombstone's upgrade-guide destination and the integration URLs admins must regenerate.

for _, apiPrefix := range []string{oauthV1Prefix, oauthV2Prefix} {
http.SetCookie(w, oauthCompletionCookie(completionBinder, h.PublicURL(apiPrefix+oauthCompletePath, nil)))
}
http.SetCookie(w, oauthCompletionCookie(completionBinder, h.PublicURL(oauthV2Prefix+oauthCompletePath, nil)))
Haldir31 pushed a commit to Haldir31/sffs that referenced this pull request Oct 28, 2026
Silo retire /api/v1 (PR Silo-Server/silo-server#3200 : 410 Gone). La liste
des bibliothèques (création, relance d'une bibliothèque injoignable) et la
chaîne des fournisseurs (NFO désactivé) passent par /api/v2/libraries :
liste paginée (items, page), identifiant en chaîne, niveaux en liste
(content_level, entries). Vérifié sur silo2 (Silo d'avant la PR).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AbUx511UGbcCoLk6U5BQjP
@Quick104
Quick104 force-pushed the silo/deprecate-api-v1 branch from 1445904 to e7cfed3 Compare November 5, 2026 06:52
@silo-kody

silo-kody Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

Every /api/v1 route on the main API listener now answers 410 Gone with
client_upgrade_required, Cache-Control: no-store and a link to the upgrade
guide. It runs no authentication and never redirects. GET /api/v1/health and
GET /api/v1/ready, and the node health probes, are unchanged. Retired URLs
that carry a credential in the path are registered on the tombstone so the
request and activity logs keep redacting it.

The planned two pre-1.0 bridge releases are waived (#886). The v1 handlers,
the v1 branches in shared middleware, playback and OAuth code, and the
migration harness (ledger, scenario catalogs, offline routes, v1 route
freeze) are removed. Setup the v1 router block did for handlers v2 shares is
moved next to their construction. Tests that exercised shared behavior
through v1 handlers now run against the v2 entry points.

Code that only v1 reached goes with it: the request and response types and
request-reading helpers the handlers left behind, the v1 rule vocabulary and
catalog grammar switches, the v1 watch-together member projection and host
band, the subtitle search bridge, and the request-wrapping admin middleware.

BREAKING CHANGE: clients and integrations that still call /api/v1 receive
410 and must move to /api/v2.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
@Quick104
Quick104 force-pushed the silo/deprecate-api-v1 branch from e7cfed3 to 0d98333 Compare November 11, 2026 17:35
@silo-kody

silo-kody Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@Quick104
Quick104 merged commit 7bb66f9 into main Nov 11, 2026
18 checks passed
@Quick104
Quick104 deleted the silo/deprecate-api-v1 branch November 11, 2026 17:55
Quick104 added a commit to Rhainland/silo-server that referenced this pull request Nov 12, 2026
Main retired /api/v1 (Silo-Server#3200), which removed the v1 admin account delete
this branch had changed; the v2 delete keeps the artwork cleanup.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Quick104 added a commit to Rhainland/silo-server that referenced this pull request Nov 12, 2026
Main retired /api/v1 (Silo-Server#3200), deleting the v1 events socket, the v1
watch-together socket and the v1 household gate test this branch edited.
Those hunks drop with the code they changed; the v2 gates keep the change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Quick104 added a commit to bulderi/silo-server that referenced this pull request Nov 13, 2026
Main retired the /api/v1 bridge (Silo-Server#3200), so the v1 route test for
collection_type is gone with the handlers it called. Main also removed
TestCollectionProblemRendersInvalidArtworkAsValidationProblem (Silo-Server#2817);
the conflict keeps that removal and this branch's v2 test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Quick104 added a commit that referenced this pull request Nov 14, 2026
Main retired /api/v1 (#3200), which removed the v1 event socket handler.
Admission now covers the native v2 events socket and the Jellyfin socket
only. The v1-only admission tests are dropped, and the lifecycle tests
that drove the v1 handler now drive the v2 ticket handshake. The docs no
longer describe a v1 bridge exception.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Quick104 added a commit that referenced this pull request Nov 14, 2026
Resolve the conflicts with main's changes since d941225:

- Query normalization moved to catalog.NormalizeQueryDefinitionJSON;
  structural admission moves with it, so backup restores also pass it.
- /api/v1 is retired (#3200): drop the v1-only item loaders and doc text
  and the V1Rules test field.
- The web collections pages are translated (#3902): "Count unavailable"
  and the manual editor's add-blocked messages become catalog keys
  (synced locally until the silo-translations change merges).
- Server smart rules name their own libraries (#3711): a server save
  sends query_definition only when the rules change.
- Save returns to the list (#3709) and smart collections need a rule
  (#3710): adjust the PR's tests to observe what they still can.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Quick104 added a commit that referenced this pull request Nov 22, 2026
… contracts (#5104)

/api/v1 now answers a 410 tombstone (#3200), but many references still
described the frozen bridge as live. Remove the present-tense v1 text,
correct the v2 status codes and contracts that drifted from the handlers
(downloads, playback v3, admin settings, diagnostics, realtime API keys,
device headers, parity), document the series date_viewed rule, and state
shipped behaviour where notes still called it pending.

Consolidate references documented twice: merge the duplicated admin-api
sections, move admin settings and catalog search status to their own
references, keep push and marker contracts in one place each, and fold
admin-system-api, scan-control-api, jellycompat-subtitles-api and
notification-webhook-revisions into the documents they repeat. Index every
API reference from docs/README.md, settle the Apple and Android follow-up
list in update-to-1.0 against the clients, and drop migration-era
bookkeeping and branch notes.

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-v2 API v2 / Huma migration program (epic #135); long-running, stacked by phase enhancement New feature or request go Pull requests that update go code impact: compat Breaks a supported client or server path priority: P2 Limited scope, workaround exists, or polish size/XXXL 3000+ added + deleted lines (all files); change volume, not priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants