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

#9221: Attach db name and operation name to idb errors #9223

Merged
merged 10 commits into from
Oct 2, 2024

Conversation

grahamlangford
Copy link
Collaborator

What does this PR do?

Discussion

  • Still rethrows the errors, which means some errors will likely be double-reported
  • In logging.ts, we swallow some of the errors but not others
    • @fungairino, what criteria did you use to determine which errors should be swallowed?

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

@grahamlangford grahamlangford self-assigned this Oct 1, 2024
@grahamlangford grahamlangford added this to the 2.1.3 milestone Oct 1, 2024
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Tests copied from logging.test.ts

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Extracted from logging.ts for reuse

Copy link

codecov bot commented Oct 1, 2024

Codecov Report

Attention: Patch coverage is 75.00000% with 26 lines in your changes missing coverage. Please review.

Project coverage is 74.81%. Comparing base (8318d74) to head (175653b).
Report is 328 commits behind head on main.

Files with missing lines Patch % Lines
src/telemetry/reportToApplicationErrorTelemetry.ts 72.09% 12 Missing ⚠️
src/telemetry/logging.ts 60.00% 6 Missing ⚠️
src/telemetry/trace.ts 58.33% 5 Missing ⚠️
src/registry/packageRegistry.ts 75.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9223      +/-   ##
==========================================
+ Coverage   74.24%   74.81%   +0.56%     
==========================================
  Files        1332     1367      +35     
  Lines       40817    42139    +1322     
  Branches     7634     7879     +245     
==========================================
+ Hits        30306    31526    +1220     
- Misses      10511    10613     +102     

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

Copy link

github-actions bot commented Oct 1, 2024

Playwright test results

passed  124 passed
flaky  10 flaky
skipped  4 skipped

Details

report  Open report ↗︎
stats  138 tests across 45 suites
duration  33 minutes, 10 seconds
commit  175653b
info  For more information on how to debug and view this report, see our readme

Flaky tests

chrome-setup › setup/affiliated.setup.ts › authenticate with affiliated user
chrome-setup › setup/affiliated.setup.ts › authenticate with affiliated user
chrome-setup › setup/unaffiliated.setup.ts › authenticate with unaffiliated user
chrome › tests/extensionConsole/activation.spec.ts › activating a mod when the quickbar shortcut is not configured
msedge › tests/extensionConsole/modsPage.spec.ts › can open mod in the workshop
msedge › tests/modLifecycle.spec.ts › create, run, package, and update mod
chrome › tests/pageEditor/addStarterBrick.spec.ts › Add starter brick to mod
msedge › tests/pageEditor/addStarterBrick.spec.ts › Add starter brick to mod
msedge › tests/pageEditor/saveMod.spec.ts › shows error notification when updating a public mod without incrementing the version
msedge › tests/runtime/sidebar/sidebarNavigation.spec.ts › sidebar mod panels are persistent during navigation

Skipped tests

chrome › tests/regressions/doNotCloseSidebarOnPageEditorSave.spec.ts › #8104: Do not automatically close the sidebar when saving in the Page Editor
msedge › 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
msedge › tests/runtime/googleSheetsIntegration.spec.ts › can activate a google spreadsheet mod with config options

@twschiller twschiller added error-telemetry telemetry customer Required for a customer projct labels Oct 2, 2024
Comment on lines +93 to +94
// Rather than use reportError from @/telemetry/reportError, IDB errors are directly reported
// to application error telemetry to avoid attempting to record the error in the idb log database.
Copy link
Collaborator

@fungairino fungairino Oct 2, 2024

Choose a reason for hiding this comment

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

This was the case with errors that got thrown when writing to the idb LOG database, but I think that we probably should call the normal reportError when writing to the other dbs so that if the error is related to a mod run it will get recorded in the idb log database.

To handle this we could consider defining an optional reportError param that defaults to using reportError and we can override that for the logging db operations.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I agree, but we would need to refactor the report functions. It's not worth the added effort right now. We're not catching the errors that we're using to make reportToApplicationErrorTelemetry calls, so the error will still be reported to the error service and the logging idb

Comment on lines 102 to 104
| ValueOf<typeof IDB_OPERATION.LOG>
| ValueOf<typeof IDB_OPERATION.TRACE>
| ValueOf<typeof IDB_OPERATION.PACKAGE_REGISTRY>;
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: there is probably a more terse way to write this, but this is probably fine. Maybe consider defining a type for this.

Another way to write this:

ValueOf<
      | typeof IDB_OPERATION.LOG
      | typeof IDB_OPERATION.TRACE
      | typeof IDB_OPERATION.PACKAGE_REGISTRY
    >;

PACKAGE_REGISTRY: "BRICK_REGISTRY",
} as const;

export const IDB_OPERATION = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

We might want to consider defining the common operations as helper methods in this file like count and recreateDB

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't disagree. But I think we should do that as a separate PR if that's a path we want to go down

} as const;

export const IDB_OPERATION = {
LOG: {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: you could make this refer to the const you defined above for stricter typing:

[DATABASE_NAME.LOG]: {
  ...

@fungairino
Copy link
Collaborator

In logging.ts, we swallow some of the errors but not others
@fungairino, what criteria did you use to determine which errors should be swallowed?

Some functions were used in features or returned a value in which case they were not swallowed. In cases were we returning void, and didn't care if the function was successful, we swallowed the error.

@@ -64,7 +64,7 @@ export class ModsPage extends BasePageObject {
.waitForEvent("requestfinished", {
predicate: (request) =>
request.url().includes(API_PATHS.REGISTRY_BRICKS),
timeout: 15_000,
timeout: 30_000,
Copy link
Collaborator

@fungairino fungairino Oct 2, 2024

Choose a reason for hiding this comment

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

Can we create a github issue for this and link it in an inline comment?

Copy link

github-actions bot commented Oct 2, 2024

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.

@grahamlangford grahamlangford merged commit 1279b4c into main Oct 2, 2024
26 checks passed
@grahamlangford grahamlangford deleted the attach-db-name-and-operation-name-to-idb-errors branch October 2, 2024 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer Required for a customer projct error-telemetry telemetry
Development

Successfully merging this pull request may close these issues.

Add consistent idb operation execution and error handling across all idb databases
3 participants