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

Log when non-current version of main.json is replaced #20749

Merged
merged 12 commits into from Feb 21, 2018

Conversation

davidsbailey
Copy link
Member

@davidsbailey davidsbailey commented Feb 20, 2018

Background

The problem scenario

  1. open project in tab A, write "// version 1", and press run

  2. still in tab A, write "// version 2", and press run

  3. open the same project in tab B, write "// version 3 with many changes", and press run

  4. in tab A, write "// version 4" and press run

    EXPECTED: warning that project is being edited in multiple places
    ACTUAL: no warning

  5. go back to tab B and refresh the page

    EXPECTED: "version 3 ..." remains visible, or a warning is displayed with link to version history
    ACTUAL: "version 3 ..." disappears, though still exists in version history

How project versions work

  • when loading a project, read the latest version (if one exists) and then create an identical "current" version (see currentSourceVersionId)
  • when saving changes to a project, write a newer version, and remove the "current" version
  • do nothing special when reloading/leaving the page. by "forgetting" the current version id, it can no longer be replaced when the project is run, effectively making it a persistent entry in the version history.

Description

Start logging to Firehose when the problem sequence happens. Do this by detecting when the version of main.json being replaced is not the latest version of that file.

For each tab, remember the server timestamp from the first time it saved a copy of the current project (firstSaveTimestamp). Persist this timestamp only when logging to Firehose, in order to

  1. uniquely identify multiple tabs;
  2. enable inferring which entries in version history were created by which tab; and
  3. avoid persisting this timestamp when no problem is detected.

This PR gathers logging information only, and does not fix the EXPECTED/ACTUAL discrepancies listed above.

Copy link
Contributor

@islemaster islemaster 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, looking forward to having this data.

@davidsbailey
Copy link
Member Author

@islemaster , I've added the tab id when replacing non-current versions, and it appears to be (1) unique between tabs and (2) consistent across reloads within the same tab. PTAL?

Copy link
Contributor

@islemaster islemaster left a comment

Choose a reason for hiding this comment

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

Cool. Tab ID implementation looks good.

@davidsbailey davidsbailey merged commit 4b8241f into staging Feb 21, 2018
@davidsbailey davidsbailey deleted the log-project-version-mismatch branch February 21, 2018 02:50
davidsbailey added a commit that referenced this pull request Feb 21, 2018
@davidsbailey
Copy link
Member Author

if reverting, will also need to revert e748f05 .

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.

None yet

2 participants