ietf-tools / datatracker

The day-to-day front-end to the IETF database for people who work on IETF standards.
https://datatracker.ietf.org
BSD 3-Clause "New" or "Revised" License
608 stars 376 forks source link

Error in hourly cron scripts related to rfc_number being None #6770

Closed jennifer-richards closed 11 months ago

jennifer-richards commented 11 months ago

Describe the issue

After deploying v12.0.0, the hourly cron scripts fail with a traceback including

  File "[...]/ietf/doc/management/commands/generate_idnits2_rfcs_obsoleted.py", line 16, in handle
    blob = generate_idnits2_rfcs_obsoleted()
  File "[...]/ietf/doc/utils.py", line 1181, in generate_idnits2_rfcs_obsoleted
    obsdict[int(r.target.rfc_number)].append(int(r.source.rfc_number)) # Aren't these already guaranteed to be ints?
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
hourly(89): Command failed with error code 1 ([2300] [...]/bin/hourly )

Code of Conduct

rjsparks commented 11 months ago

This is likely damage to the data from the rogue code running during migration:

>>> Counter(RelatedDocument.objects.filter(relationship_id='obs').values_list('source__type_id','target__type_id'))
Counter({('rfc', 'rfc'): 1489, ('rfc', 'draft'): 1})
rjsparks commented 11 months ago

Yes, that one RelatedDocument object is bogus - it was built from a DocAlias pk and not a Document pk. The real obs relationship from the affected rfc is already in place and deleting the bogus relation is all that is needed, I will do in the admin.

rjsparks commented 11 months ago

For the sake of documentation:

>>> RelatedDocument.objects.filter(relationship_id='obs',target__type_id='draft')
<QuerySet [<RelatedDocument: rfc9386 obsoletes draft-ohba-pana-pemk>]>
>>> RelatedDocument.objects.filter(relationship_id='obs',target__type_id='draft').get().target.became_rfc()
<Document: rfc5807>
>>> RelatedDocument.objects.filter(relationship_id='obs',source__name='rfc9386')
<QuerySet [<RelatedDocument: rfc9386 obsoletes rfc6036>, <RelatedDocument: rfc9386 obsoletes draft-ohba-pana-pemk>]>
rjsparks commented 11 months ago

RelatedDocument 1296946 removed using the admin.