Skip to content

Split the database tests and identify duals by their ID - #500

Merged
ScriptRaccoon merged 4 commits into
mainfrom
test-refactor
Nov 26, 2026
Merged

ScriptRaccoon merged 4 commits into
mainfrom
test-refactor

Conversation

@ScriptRaccoon

@ScriptRaccoon ScriptRaccoon commented Nov 26, 2026 •

Copy link
Copy Markdown
Owner

This PR changes how the deduction recognizes the original structure in a dual pair, and reorganizes the database tests.

  • Duals: The deduction no longer recognizes the dual structure in a pair by a name starting with "dual". The ID of the dual must now be the ID of the original followed by _op (e.g. Set_op), and db:test checks this. The contribution guidelines now state that a dual is the literal opposite, never a category that is only equivalent to it (such as the category of affine schemes for CRing).
  • Test files: The checks run by db:test are now in database/scripts/tests/, one file per group of checks. The checks and their messages are unchanged.
  • Distinct proof keys: Category properties and special morphisms must have distinct IDs, since both are used as ?proof= keys on category pages. The database schema now enforces this, so db:seed fails with an error naming the shared ID, and db:test no longer checks it. Run pnpm db:setup once after pulling.
  • Duals stay in the tests: The schema could also enforce that structures and their duals, as well as properties and their duals, are mutual, with a foreign key from a row to its dual. But the seed defers the foreign key checks to the end of each transaction, and then SQLite only reports "FOREIGN KEY constraint failed" without naming the row. The tests print the IDs of the non-mutual pair, so they stay.
  • Database diagram: updated, see below.

Updated database diagram

The last update has been done a month ago, so this is long overdue.

db schema

@ScriptRaccoon
ScriptRaccoon merged commit be211c1 into main Nov 26, 2026
1 check passed
@ScriptRaccoon
ScriptRaccoon deleted the test-refactor branch November 26, 2026 10:05
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.

1 participant