From 24592850528d188fae65162f38e4ed7f63479c20 Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Sat, 1 Nov 2025 20:32:38 -0700 Subject: [PATCH] Additional upgrade notes by Codex CLI Refs https://github.com/simonw/datasette/issues/2549#issuecomment-3477398336 Refs #2564 --- docs/upgrade-1.0a20.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/upgrade-1.0a20.md b/docs/upgrade-1.0a20.md index 0dbb9626..af57ca83 100644 --- a/docs/upgrade-1.0a20.md +++ b/docs/upgrade-1.0a20.md @@ -173,6 +173,14 @@ This is no longer necessary in Datasette 1.0a20 - the `"root"` actor automatical The `permission_allowed()` hook in this example can be entirely removed. +### Root-enabled instances during testing + +When writing tests that exercise root-only functionality, make sure to set `datasette.root_enabled = True` on the `Datasette` instance. Root permissions are only granted automatically when Datasette is started with `datasette --root` or when the flag is enabled directly in tests. + +## Target the new APIs exclusively + +Datasette 1.0a20’s permission system is substantially different from previous releases. Attempting to keep plugin code compatible with both the old `permission_allowed()` and the new `allowed()` interfaces leads to brittle workarounds. Prefer to adopt the 1.0a20 APIs (`register_actions`, `permission_resources_sql()`, and `datasette.allowed()`) outright and drop legacy fallbacks. + ## Fixing async with httpx.AsyncClient(app=app) Some older plugins may use the following pattern in their tests, which is no longer supported: