Recommended approach to saving and restoring a cell's id

I’m working on an extension and I need a unique identifier for the cells, which naturally led me to considering the notebook cell ID. However, I need the ID to be restored when the notebook is restored; currently cell IDs are not saved in the cell’s metadata, so they cannot be restored.

I tried to save the ID in the metadata then restore using the cells.changed signal, but I don’t see any way of changing the cell’s id after it’s been created. I tried cellModel.modelDB.setValue('id', cellModel.metadata.get('id')) but it gives me the error Can only call setValue on an ObservableValue. Similarly, cellModel.id = '123' gives the error that id is readonly.

Does someone have a suggestion for how I can restore the cell ID? I could also try overriding the cell model’s fromJSON method, but that would be a bit messy for such a simple operation…

Also as a side note, it seems like cellID is added to the metadata, but never saved? https://github.com/jupyterlab/jupyterlab/blob/d322d6b1f2d7abb32a2ab1c1a457beaa006ec8c1/packages/cells/src/widget.ts#L1041-L1046

Could you tag (notebook cell tags) each cell with an ID and use that?

Hey I just now saw your response. Tags would almost work except for the fact that they need to be readonly – I don’t want users to be able to delete/edit them