Skip to content

Fixture tables for primary key edge cases, used by the row key tests - #3113

Merged
simonw merged 1 commit into
mainfrom
claude/funny-thompson-huk3kp
Nov 22, 2026
Merged

simonw merged 1 commit into
mainfrom
claude/funny-thompson-huk3kp

Conversation

@simonw

@simonw simonw commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

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 integer 1, the text '1', the float 1.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.py now run against those tables through ds_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_homepage now 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

🤖 Generated with Claude Code

https://claude.ai/code/session_016BvfqDra1ayZvE9LSDbxvF

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

codecov Bot commented Nov 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.00%. Comparing base (9e4cab0) to head (6b210dc).
⚠️ Report is 10 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@simonw
simonw merged commit 36e68b7 into main Nov 22, 2026
16 checks passed
@simonw
simonw deleted the claude/funny-thompson-huk3kp branch November 22, 2026 23:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants