Export and import: the files sent with an application and a sent document's \"sent to\" line are lost #469
Labels
No labels
accessibility
authentication
breaking change
bug
documentation
enhancement
interface
internationalisation
observability
performance
security
tier
1
tier
2
tier
3
tier/4
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Postulo/postulo#469
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found on 2026-09-29 in a read-only review of postulo at
95348908d, comparing the models' fields with whatcore/export.pywrites and running an export-and-import round trip.Checked again on 2026-10-01 against
mainat0a5cad587: still present. The code is now atdocuments/models.py:638-644(sent_to),documents/models.py:745-753(went_with_an_application) anddocuments/rendering.py:563-565(exported_on_its_own);core/export.py,core/importer.pyandapplications/models.pyhave not moved.Two parts of the record of what was sent do not travel in the archive, although the export's docstring promises every record and the wiki promises every document you sent:
Application.sent_uploads("Files you already had, as opposed to documents Postulo rendered",applications/models.py:411-417) is never written. The archive carriessent_link_idsfor the sibling many-to-many (core/export.py:704, read back atcore/importer.py:671-678) and nothing for the files.RenderedDocument.sent_to(documents/models.py:610-616) is not inSENT_FIELDS(core/export.py:285-293). The model keeps it as text precisely so that a sent PDF can still be placed after its application is deleted.Where:
core/export.py:704and:285-293inbuild_document;core/importer.py:635and:671-678and:864-889inload.What happens: a round trip of an application with one sent upload came back with
sent_uploads.count() == 0. A sent document whose application had been deleted, withsent_to"Research Engineer at Black Mesa", came back withsent_to == "", andwent_with_an_application(documents/models.py:717-725) turned from true to false: the restored PDF now counts as a CV exported on its own (documents/rendering.py:589-591,exported_on_its_own) rather than one an employer received.Why it matters: after moving or restoring an account, every application forgets which portfolio or transcript went with it, and every sent PDF whose application was tidied away loses the only words saying where it went and is filed as a draft export.
Fix: write
"sent_upload_ids": [u.pk for u in application.sent_uploads.all()](prefetched with the applications) and resolve it on import once the uploads exist, aspending_supersedesdoes. Addsent_totoSENT_FIELDS. BumpFORMAT_VERSION(now 25) and keep reading older archives, where both are absent.Done when
tests/test_export.pycovers an application with a sent upload and a sent document withsent_toand no application, and asserts both come back unchanged.