Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Preserve identity IDs when IDT is disabled #1359

Closed
wants to merge 3 commits into from

Conversation

pastuxso
Copy link
Contributor

@pastuxso pastuxso commented May 17, 2024

The issue is that when IDT is turned off, identity IDs need to remain unchanged, even if they are included in a notebook.

This includes:

  • runme.dev/stageId: This is a new metadata field used to transfer the IDT during serialize/deserialize requests only when RunmeIdentity is UNSPECIFIED.

  • Updates to assertDocumentContains to only match a portion of the document.

  • Test updates

Closes: #1354

@pastuxso pastuxso changed the title Inverts persistent vs ephemeral cell IDs Fix: Preserve identity IDs when IDT is disabled May 20, 2024
@pastuxso pastuxso marked this pull request as ready for review May 20, 2024 17:04
Copy link
Contributor

@degrammer degrammer left a comment

Choose a reason for hiding this comment

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

Looks good in general, just review a couple of questions before merging.

@sourishkrout
Copy link
Member

@degrammer @pastuxso I'll be doing the review on this. Please don't request reviews from one the more people at once or jump in unprompted. Context and duplication of work is costly.

@pastuxso pastuxso requested review from degrammer and sourishkrout and removed request for sourishkrout and degrammer May 24, 2024 14:31
Copy link

sonarcloud bot commented May 24, 2024

Copy link
Member

@sourishkrout sourishkrout left a comment

Choose a reason for hiding this comment

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

Again, I think we should try to solve the issue at deserialization where it originates instead of "fixing" reconciliation which wasn't intended to be a permanent solution.

return
}
if (cell.metadata?.['id']) {
cell.metadata['runme.dev/originalId'] = cell.metadata['id']
Copy link
Member

Choose a reason for hiding this comment

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

Don't think this is the right solution. It tries to fix "the issue" at the tail end of serialization instead of deserialization where it seems to originate.

I believe this code here's not "smart enough" yet. It ignores both identity requirements and the fact that runme.dev/id is not set which means cell identity wasn't required in the first place.
https://github.com/stateful/vscode-runme/blob/lifecycle-id-fixes/src/extension/serializer.ts#L319-L324

Copy link
Member

@sourishkrout sourishkrout May 28, 2024

Choose a reason for hiding this comment

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

One could argue that if runme.dev/id is not set the deserialization was requested without cell identity. One problem I could think of is that "newly inserted cells" through the notebook UX will likely not be treated correctly and go without ID. Checking the identity requirement directly should get around this issue.

@@ -355,6 +355,11 @@ export abstract class SerializerBase implements NotebookSerializer, Disposable {
}

data.cells.forEach((cell) => {
if (identity === RunmeIdentity.UNSPECIFIED && cell.metadata?.['runme.dev/originalId']) {
Copy link
Member

Choose a reason for hiding this comment

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

We should try to make reconcileCellIdentity go away instead of further expanding the quick fix band-aid that it was.

@sourishkrout
Copy link
Member

Closing as obsolete now that #1449 is merged.

@pastuxso pastuxso deleted the lifecycle-id-fixes branch September 23, 2024 13:26
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.

Invert persistent vs ephemeral cell IDs
3 participants