Skip to content

fix(harvester): error on withdrawn inspire records - #915

Merged
kpsherva merged 1 commit into
CERNDocumentServer:masterfrom
TahaKhan998:fix/issue-906-withdrawn-already-harvested
Aug 21, 2026
Merged

fix(harvester): error on withdrawn inspire records#915
kpsherva merged 1 commit into
CERNDocumentServer:masterfrom
TahaKhan998:fix/issue-906-withdrawn-already-harvested

Conversation

@TahaKhan998

Copy link
Copy Markdown

Part of #906
if inspire marks a record as withdrawn we error and dont create/update it. if its already in cds we also put the cds id in the error so curators can open that record. if its not harvested yet we just say its withdrawn.

@TahaKhan998 TahaKhan998 linked an issue Aug 12, 2026 that may be closed by this pull request
6 tasks
)

rdm_entry["_inspire_ctx"] = {"cds_id": cds_id, "versions": versions}
withdrawn = bool(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to handle it like other fields, with a dedicated function and raise an error if the field exists - otherwise it is a bit "hidden" inside another code flow by not following the common convention

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, added a dedicated WithdrawnMapper like the other fields.

@TahaKhan998
TahaKhan998 force-pushed the fix/issue-906-withdrawn-already-harvested branch from 042ba44 to 03d7465 Compare August 19, 2026 09:56
return None

elif match_result.found:
if self._is_withdrawn(stream_entry):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need the additional check? the mapper will throw an error anyways

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well i thought that already harvested records with the withdrawn flag should be logged but i didnt realize that while being harvested, if the record has the withdrawn flag then the mapper would raise an error and we would just never reach the writer, thanks for catching this, i have dropped the writer error

@TahaKhan998
TahaKhan998 force-pushed the fix/issue-906-withdrawn-already-harvested branch 3 times, most recently from 2e35a9c to f521f25 Compare August 20, 2026 15:50
Comment on lines +353 to +359
if ctx.cds_rdm_id:
ctx.errors.append(
"Record is withdrawn on INSPIRE. "
f"| details: cds_id={ctx.cds_rdm_id}"
)
else:
ctx.errors.append("Record is withdrawn on INSPIRE.")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

last tiny thing... why does it matter if it has cds id in this case or not? I would always raise. If the CDS PID is none, just display None :)
in general I would not add conditional statements to modify log lines, since it does not handle bussiness logic in any way

@TahaKhan998
TahaKhan998 force-pushed the fix/issue-906-withdrawn-already-harvested branch from f521f25 to 55f9f95 Compare August 21, 2026 08:32
@kpsherva
kpsherva merged commit 054e0db into CERNDocumentServer:master Aug 21, 2026
3 checks passed
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.

harverster feedback it2

2 participants