feat!(backend): add CrossRef writeEnabled flag, fail crossRef.isActive check if empty strings are passed#6687
Conversation
writeEnabled flagwriteEnabled flag
|
This PR may be related to: #5471 (Seqsets created but don't actually exist on crossref) |
|
Claude finished @tombch's task in 4m 28s —— View job Code Review
SummaryThe feature is clean and well-structured, but there's one significant bug: the caller in
...causing the user-facing request to fail with an unhandled error, even though this read-only mode is supposed to just skip the CrossRef posting gracefully. Fix needed in // Before (buggy when writeEnabled=false):
if (crossRefService.isActive) {
// After:
if (crossRefService.isActive && crossRefService.isWriteEnabled) {Other observations
Missing test for the write-enabled path: There's no test that verifies
Description style: The new |
…nd post xml functions mocked
…oculus into crossref-write-enabled
… causing failing tests with null or blank check
…oculus into crossref-write-enabled
writeEnabled flagwriteEnabled flag, fail crossRef.isActive check if empty strings are passed
|
@claude review |
|
Claude finished @tombch's task in 1m 33s —— View job Code Review
SummaryThe implementation is clean and correct. The bug flagged in the previous Claude review (DB write happening before Issues Found1. Missing test: All three endpoint test setup methods now mock @Test
fun `createSeqSetDOI returns 403 when crossref write is not enabled`() {
every { crossRefService.isWriteEnabled } returns false
// ... call DOI endpoint and assert 403
}2. Per 3. The 4. Description style inconsistency — nit
What Looks Good
|
|
side note: before merging lets prepare a PR for PPX with this config change and adding the secrets to staging |
resolves #6643
BREAKING CHANGES
To enable DOI creation on PPX the
writeEnabledflag now needs to be set to true (default is false), additionally we can now give staging access to the crossRef credentials and setwriteEnabled: falsefor staging.Summary
crossref.writeEnabledflag, defaulting tofalse, which when set totrueenables Crossref write operations (in this case, generating DOIs).createSeqSetDOIfunction to require the Crossref service is both active and write enabled before creating any entries in the database - previously, it would create an entry in the database, and then silently skip posting to Crossref if not active.isActivevalue, by requiring non-blank values rather than just non-null. This then flagged an issue in the GitHub CI where empty secrets were previously being passed into the test, and the service would still be marked as active..toString()conversions being flagged when linting the backend.Screenshot
PR Checklist
🚀 Preview: https://crossref-write-enabled.loculus.org