Repository navigation
Fixture tables for primary key edge cases, used by the row key tests - #3113
Merged
Merged
Conversation
Adds three tables to the fixtures database so latest.datasette.io has rows with null, empty string, binary and untyped primary keys: - primary_key_edge_cases: a primary key column with no declared type holding an integer, text, a float, a binary value, an empty string, text that looks like a marker, and three nulls - compound_primary_key_edge_cases: empty strings and nulls in a compound primary key - primary_key_edge_case_references: foreign keys to those rows The read-only tests in test_row_keys.py now run against those tables. Tests that write, or that need tied sort values, keep their own in-memory database. A foreign key cell that references an empty string primary key now has 'empty' as its link text. It was an empty link with nothing to click. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016BvfqDra1ayZvE9LSDbxvF
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3113 +/- ##
======================================
Coverage 0.00% 0.00%
======================================
Files 81 81
Lines 14612 14742 +130
======================================
- Misses 14612 14742 +130 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Owner
Author
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.
Follow-up to #3112. The fixtures database had no reachable rows with a null, empty string, binary or untyped primary key, so latest.datasette.io could not show the new row pages.
Claude Fable 5.2 Medium
New fixture tables
primary_key_edge_cases: a primary key column with no declared type, holding the integer1, the text'1', the float1.5, a binary value, an empty string, the text'i:1', the text'$null', and three nulls.compound_primary_key_edge_cases: empty strings and nulls in a compound primary key.primary_key_edge_case_references: foreign keys to three of those rows.Tests
The read-only tests in
tests/test_row_keys.pynow run against those tables throughds_client: row links, row pages, pagination, cursors, status codes, redirects, fragments,primary_key_values, binary display,?_shape=object, foreign key links, autocomplete and the once-per-request null key check.Tests that write to the database (update, delete, the edit and delete buttons) keep an in-memory database. So does sorted pagination past null keys, which needs rows that share both a sort value and a null primary key.
Three existing tests listed or counted the fixture tables and are updated.
test_homepagenow searches for the items it checks, because the three new tables pushed them onto the second page of the list.One fix
A foreign key cell that references an empty string primary key was a link with no text, so there was nothing to click. It now reads empty, like the primary key link for that row. The new fixtures showed this up.
On the row page that same foreign key value is not a link. It shows the grey empty string placeholder that the row page uses for any empty text value.
Once deployed
$null) and https://latest.datasette.io/fixtures/primary_key_edge_cases/$null (404)🤖 Generated with Claude Code
https://claude.ai/code/session_016BvfqDra1ayZvE9LSDbxvF