feat(pubs): filter the candidate queue and retract accepted papers - #27
Merged
Conversation
Two curator tools for the publication-candidate review screen, which had grown a backlog too long to page through (5.6k rejected, 564 pending). Filters: `list_candidates` now takes a `CandidateFilter` carrying a free-text term (title / journal / DOI / OpenAlex id, LIKE metacharacters escaped so `100%` matches literally) and a sort (newest or oldest found, publication date, title). The three controls live in one `#pc-filters` box and each hx-includes the whole box, so they compose; none sends `page`, so changing a filter lands back on page 1. Retract: an accepted candidate can be moved back to rejected. Accepting *promotes* the candidate into `pubs.publication`, and that promotion may have reused a paper the curators already owned rather than creating one — so removing the paper is opt-in, and refused outright (server-side, not just hidden) once samples or studies reference it. The candidate always flips back to rejected; the panel now also links the paper the accept produced. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Two curator tools for the publication-candidate review screen, which had grown a backlog too long to page through (5,629 rejected / 564 pending in the dev DB).
1. Queue filters
du_db::publication::list_candidatesnow takes aCandidateFilter { status, q, sort }:100%matches a literal%. Thecount(*)is filtered too, so the pager doesn't advertise phantom pages.The three controls sit in one
#pc-filtersbox and eachhx-includes the whole box, so status + search + sort compose (the house pattern from the haplogroups curator page). None of them sendspage, so changing a filter lands back on page 1.Sanity check against the dev DB: "ancient" narrows the 564 pending to 80.
2. Move an accepted paper back to rejected
An accepted candidate's panel gains a Move back to rejected form, backed by
retract_candidate.The judgment call worth a look in review: accepting promotes the candidate into
pubs.publication, andpromote_candidatemay have reused a paper the curators already owned rather than creating one. So deleting the paper is opt-in rather than automatic:rejected.The panel also now links the paper an accept produced (
#42→/references?query=…).Verification
cargo test -p du-db --test publication_candidate— 4 pass, including newqueue_search_and_sort(all four searched fields, escaped%, filtered count, both new sorts) andretract_moves_accepted_back_to_rejected(keep-paper, delete-paper, refuse-delete-when-attached).cargo test -p du-web --bins -- --test-threads=1— 69 pass, including 4 new template-render tests and the locale-parity test covering the newpc.*keys in en/es/fr.No live browser pass: local login is OAuth-only, so the HTMX wiring is covered by render assertions (
hx-include="#pc-filters"on all four elements,action=retract,delete_publication) rather than by clicking through it.No migration; no API or job changes.
🤖 Generated with Claude Code