Skip to content

Add utility function to check hash database for missing tags#91

Draft
bs2609 wants to merge 1 commit intoauthorblues:mainfrom
bs2609:patch-2
Draft

Add utility function to check hash database for missing tags#91
bs2609 wants to merge 1 commit intoauthorblues:mainfrom
bs2609:patch-2

Conversation

@bs2609
Copy link
Contributor

@bs2609 bs2609 commented Oct 13, 2025

As much of a suggestion with code attached as anything else, so it's open to changes around the concept and implementation.

For the benefit of the damage shuffler plugins that use the "hash database" format, this adds a function that takes [a table which maps tags to 'truthy' values] and [a hash -> tag db file] and returns two lists, which are the relative differences of the sets of tags in each (i.e. tags in the file but not the table, and tags in the table but not the file). If both sets are the same, the lists will be empty.

This is specifically and probably exclusively useful for validating the consistency of these files, especially around bulk additions where it's easy for a missing tag to go unnoticed until later when things break.

However, a) it's hard to do this other ways, b) code locality here is good for consistency, c) these mistakes do keep happening.

@bs2609
Copy link
Contributor Author

bs2609 commented Oct 14, 2025

As a minor note from while I was looking at this, there's another Newer Lua cleanup opportunity to use io.lines(filename) in place of file:lines() as with 5.4 it's better specified to close the file whenever control leaves the loop and also raise errors if the file cannot be opened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant