w3c / aria-at-app

Test runner and results reporter for ARIA-AT
http://aria-at.w3.org/
Other
35 stars 15 forks source link

Reset TestPlanVersion `nextval` during import if IDs aren't used #1153

Closed howard-e closed 1 month ago

howard-e commented 1 month ago

I was inspecting the production's data from July 10 2024 and took note of significantly high id numbers in the TestPlanVersion table. The latest row's id is 163615 but there is just 103 rows in the table, which uses auto-increment IDs. Running select currval(pg_get_serial_sequence('"TestPlanVersion"', 'id')) also gives 175465.

This happens because the import-tests script is dependent on knowing the "next" id to create relevant data that is retrieved using postgres' nextval (which also also updates the next possible ID value). The issue with this is that those ids could go unused if a potential TestPlanVersion being created is "discarded" if non-unique data is found, but the incremented value is left as is.

The amount of test plan versions that could be imported is 35 and the cronjob responsible for doing that should run every 15 minutes . So potentially, the incremented value is unnecessarily bumped 140 times per hour (105 at a minimum) if there are no new test plan versions.

So this PR does the following: