Comment not saved when deleting a record
Problem
Occasionally Open Library records must be removed from the catalog completely. It is helpful to have a comment saved should the reason be questioned at a later time. However, including a comment and hitting "delete" does not actually save the comment explaining the reason for deletion.
https://openlibrary.org/books/OL57651673M?m=history
Reproducing the bug
- Go to ...
- Do ...
- Expected behavior:
- Actual behavior:
Context
- Browser (Chrome, Safari, Firefox, etc):
- OS (Windows, Mac, etc):
- Logged in (Y/N):
- Environment (prod, dev, local): prod
Breakdown
Implementation Details (for maintainers)
Requirements Checklist
- [ ]
Related files
Stakeholders
Instructions for Contributors
- Please run these commands to ensure your repository is up to date before creating a new branch to work on this issue and each time after pushing code to Github, because the pre-commit bot may add commits to your PRs upstream.
Noting that comments are persisted when authors are deleted. This issue affects edition and work records.
Context
Codebase research confirms the root cause and shows it is already fixed on master:
- The "Delete Record" button lived in its own
<form id="delete-record">, separate from the main edit form (id="addWork"/id="addAuthor") that contains the_commenttext input rendered byEditButtons.html. Submitting the delete form therefore never included the comment field —openlibrary/templates/books/edit.html#L45-L47. - By contrast,
type/author/edit.htmlassociates its delete button with the main form via the HTMLform="addAuthor"attribute, so the comment is submitted for author deletions — matching @jimchamp's comment above that author-delete comments persist while edition/work-delete comments did not. - The backend was already comment-aware:
SaveBookHelper.save()readsformdata.pop("_comment", "")and passes it through todelete(), which callsdoc._save(comment=comment)—openlibrary/plugins/upstream/addbook.py#L556-L571. The bug was purely that the comment value never reached the delete request. - This issue is already resolved. PR internetarchive/openlibrary#13223 ("Persist comments when books are deleted", merged 2026-07-29) closes this issue. It adds a click handler (
initRecordDeletion) that appends the_commentinput into the delete form and callsform.requestSubmit(elem)before the delete form is submitted. The currentmastercheckout already has this fix in place (edit.js,index.js, and theclass="delete-record"hook inedit.html).
Issue Assessment
Action items
- [x] Is this already fixed? (Answer: Yes — see PR #13223, merged 2026-07-29, which closes this issue and matches the root cause found in research above.)
Needs: Lead has been removed (superseded by the existing Lead: @jimchamp label). Needs: Triage and Needs: Breakdown remain applied per the label table's stated removal conditions, but given the fix has already merged and shipped, a maintainer may want to clear these during triage.
🔔 Stakeholders
No new stakeholder ping needed — @jimchamp (already tagged as Lead) authored and merged the fix in #13223.
Full triage checklist
- [x] Triage — correct labels applied or removed (
Needs: Leadremoved as superseded;Needs: Triage/Needs: Breakdownleft for maintainer judgment given the merged fix) - [x] Problem / opportunity — problem is clear, audience identified (librarians deleting records), actionable
- [x] Scope — well-scoped; single, narrow bug
- [ ] Justification — no explicit measurable impact/frequency stated in the original report
- [ ] Success & testing criteria — no explicit "definition of done" in the issue body itself
- [ ] Proposal & breakdown — issue's own Breakdown section was left as unfilled placeholders (moot now — fix already merged)
- [ ] If bug: environment & repro steps — Browser/OS/repro steps left blank in the template
- [x] Risks, concerns, open questions — none outstanding; resolved by research above
- [x] Richy context — relevant code, commits, PRs reviewed; superseding PR (#13223) found and confirmed as the fix, no duplicate
- [x] References — permalinks to the exact code and fixing PR provided above
[!NOTE] This comment was automatically generated by Richy, Open Library's issue enrichment assistant, on behalf of @mekarpeles. This is NOT a sign-off. This issue needs lead review before work begins.