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

Standardize timestamp creation #8892

Merged
merged 6 commits into from
Jul 22, 2024
Merged

Standardize timestamp creation #8892

merged 6 commits into from
Jul 22, 2024

Conversation

twschiller
Copy link
Contributor

@twschiller twschiller commented Jul 20, 2024

What does this PR do?

For more information on our expectations for the PR process, see the
code review principles doc

@@ -127,30 +123,6 @@ export function validateRegistryId(id: string | undefined): RegistryId {
throw new Error("Invalid registry id");
}

function isTimestamp(value: string): value is Timestamp {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved to timeUtils

Copy link

github-actions bot commented Jul 20, 2024

Playwright test results

passed  124 passed
flaky  2 flaky
skipped  4 skipped

Details

report  Open report ↗︎
stats  130 tests across 40 suites
duration  9 minutes, 41 seconds
commit  1775420
info  For more information on how to debug and view this report, see our readme

Flaky tests

edgeSetup › setup/unaffiliated.setup.ts › authenticate with unaffiliated user
chromeSetup › setup/unaffiliated.setup.ts › authenticate with unaffiliated user

Skipped tests

chrome › tests/regressions/doNotCloseSidebarOnPageEditorSave.spec.ts › #8104: Do not automatically close the sidebar when saving in the Page Editor
edge › tests/regressions/doNotCloseSidebarOnPageEditorSave.spec.ts › #8104: Do not automatically close the sidebar when saving in the Page Editor
chrome › tests/runtime/googleSheetsIntegration.spec.ts › can activate a google spreadsheet mod with config options
edge › tests/runtime/googleSheetsIntegration.spec.ts › can activate a google spreadsheet mod with config options

@@ -223,14 +223,14 @@ type ActivatedModComponentBase = {
*
* Currently, not used for anything - might be used for sorting, etc. in the future.
*/
createTimestamp: string;
createTimestamp: Timestamp;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Refine type for upcoming PRs

* @since 2.0.6
* @see timestampFactory
*/
export function nowTimestamp(): Timestamp {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Method to generate timestamps with the Timestamp tagged type

Copy link

codecov bot commented Jul 20, 2024

Codecov Report

Attention: Patch coverage is 85.29412% with 5 lines in your changes missing coverage. Please review.

Project coverage is 74.41%. Comparing base (8318d74) to head (1775420).
Report is 106 commits behind head on main.

Files Patch % Lines
src/utils/timeUtils.ts 69.23% 4 Missing ⚠️
src/store/extensionsMigrations.ts 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8892      +/-   ##
==========================================
+ Coverage   74.24%   74.41%   +0.17%     
==========================================
  Files        1332     1339       +7     
  Lines       40817    41180     +363     
  Branches     7634     7707      +73     
==========================================
+ Hits        30306    30646     +340     
- Misses      10511    10534      +23     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines +74 to +75
createTimestamp: timestamp,
updateTimestamp: timestamp,
Copy link
Collaborator

@grahamlangford grahamlangford Jul 22, 2024

Choose a reason for hiding this comment

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

This is the second time I've seen us setting timestamps in the Extension. Assuming these values are persisted, why are we not relying on the server to set the timestamps and return them in a response?

Copy link
Contributor Author

@twschiller twschiller Jul 22, 2024

Choose a reason for hiding this comment

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

This is the second time I've seen us setting timestamps in the Extension. Assuming these values are persisted, why are we not relying on the server to set the timestamps and return them in a response?

You are correct - IIRC, these were originally introduced to detect if the activated standalone mod components was outdated (i.e., because it was activated in a different profile). For mod definitions, there's considerations on whether timestamps should be used to determine if the mod is out of date vs. solely relying on the version. (Which the version number might not get updated on save)

The timestamps ARE stored on the server (see the PR discussion on #8891)

Eventually we should not be setting these timestamps. I think this should be handled in the next phase (see the PR discussion on #8891). There's some gotchas around which server response types actually include the timestamps on them

Copy link

No loom links were found in the first post. Please add one there if you'd like to it to appear on Slack.

Do not edit this comment manually.

@twschiller twschiller merged commit 56f71c0 into main Jul 22, 2024
37 checks passed
@twschiller twschiller deleted the feature/timestamp-utils branch July 22, 2024 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants