Repository navigation
Remove documented template variables that no default template uses - #3098
Merged
Merged
Conversation
Removes ok, path, editable, queries_more, page_size, limit, show_private_note, show_trusted_note, show_database and parameters from the template contexts where no default template uses them, so they are not frozen by the template context stability promise. Keeps url_csv, count_sql, rows, columns, next and base_url, which custom templates and plugins rely on, and adds a test with an allow-list so a documented variable that no template uses has to be listed on purpose. Closes #3088 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3098 +/- ##
=====================================
Coverage 0.00% 0.00%
=====================================
Files 80 80
Lines 14301 14289 -12
=====================================
+ Misses 14301 14289 -12 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
simonw
added a commit
that referenced
this pull request
Nov 23, 2026
Refs #1048, #1342, #1479, #1553, #1611, #1627, #1630, #1671, #1674, #1822, #1841, #1873, #1914, #1919, #1973, #2045, #2073, #2145, #2253, #2356, #2419, #2713, #2805, #2807, #2810, #2826, #2942, #2967, #3070, #3074, #3075, #3078, #3079, #3081, #3082, #3083, #3084, #3085, #3087, #3088, #3089, #3090, #3091, #3092, #3093, #3097, #3098, #3099, #3100, #3101, #3102, #3103, #3104, #3105, #3106, #3107, #3108, #3109, #3111, #3112, #3113, #3115
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes:
The template context documentation promises that documented variables are stable until Datasette 2.0. This removes the documented variables that none of the default templates use and that nothing else was found to depend on, so they are not frozen by 1.0.
Claude Fable 5.2 Medium
Removed
okokanalysis_error is None, andanalysis_erroris what the templates use.parameterspathurls.database(database).editableTrue, and documented incorrectly. The realeditableon the query page is unchanged.queries_morequeries_countandqueries.page_sizelimitstart,totalandqueries.show_private_note,show_trusted_noteshow_databasedatabase is none.Kept on purpose
These are also unused by the default templates, but are now on an allow-list in the new test with the reason for each:
url_csv(table, row, query): custom templates based on older default templates link to it.columns(table, row):render_template()passes it to theextra_body_script,extra_template_vars,extra_css_urlsandextra_js_urlsplugin hooks.rows(table, row): the raw values;display_rowsonly has rendered cells.next(table, stored query list): the pagination token.count_sql(table): matches?_extra=count_sql.base_url(every page): used by templates in plugins.JSON API
Unchanged, with one exception:
/-/queries.jsonand/<database>/-/queries.jsonno longer returnshow_private_noteandshow_trusted_note. They existed only for the old HTML page and those endpoints are not documented.ok,limit,show_database,pathandqueries_moreare still returned by the JSON endpoints that had them.Test
tests/test_template_context.pygainstest_documented_variables_are_used_by_default_templatesandtest_base_context_variables_are_used_by_default_templates. They parse each documented page's template and everything it includes withjinja2.meta, and fail if a documented variable is not used by any default template unless it is on the allow-list. The check runs in both directions, so an allow-listed variable that starts being used also fails.Checked
black,ruffandcog --checkclean;docs/template_context.rstregenerated with cog.For review
parameters,queries_moreandcount_sqlwere the close calls.count_sqlis kept and the other two removed; either is easy to flip.show_*_notekeys from the queries JSON is the only change outside the template context.🤖 Generated with Claude Code