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

#9419: add registry lookup to platform protocol #9421

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

twschiller
Copy link
Contributor

@twschiller twschiller commented Nov 6, 2024

What does this PR do?

Discussion

  • This PR likely isn't sufficient to completely eliminate the memory registry alias in: https://github.com/pixiebrix/pixiebrix-app/pull/4848. But it's a step in the right direction
  • There's also probably some places the brickRegistry is getting used where it shouldn't be (e.g., in inner definition hydration code)

Future Work

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

@twschiller twschiller added the do not merge Merging of this PR is blocked by another one label Nov 6, 2024
@twschiller twschiller self-assigned this Nov 6, 2024
@twschiller twschiller added enhancement New feature or request platform-protocol and removed enhancement New feature or request labels Nov 6, 2024
@twschiller twschiller added this to the 2.1.8 milestone Nov 6, 2024
@twschiller twschiller changed the title #9419: [WIP] add registry to platform protocol #9419: add registry to platform protocol Nov 6, 2024
@twschiller twschiller marked this pull request as ready for review November 6, 2024 20:12
Base automatically changed from feature/9419-content-script-protocol to main November 6, 2024 20:18
@twschiller twschiller removed the do not merge Merging of this PR is blocked by another one label Nov 6, 2024
@@ -76,9 +74,6 @@ export async function init(): Promise<void> {
registerBuiltinBricks();
registerContribBricks();
markDocumentAsFocusableByUser();
// Since 1.8.2, the brick registry was de-coupled from the runtime to avoid circular dependencies
// Since 1.8.10, we inject the platform into the runtime
initRuntime(brickRegistry);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Required registry methods are in the platform now

import { nowTimestamp } from "@/utils/timeUtils";
import { flagOn } from "@/auth/featureFlagStorage";
import castError from "@/utils/castError";

// Introduce a layer of indirection to avoid cyclical dependency between runtime and registry
// eslint-disable-next-line local-rules/persistBackgroundData -- Static
let brickRegistry: RegistryProtocol<RegistryId, Brick> = {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Available in the platform now

Copy link

github-actions bot commented Nov 6, 2024

Playwright test results

passed  152 passed
flaky  2 flaky
skipped  2 skipped

Details

report  Open report ↗︎
stats  156 tests across 51 suites
duration  10 minutes, 20 seconds
commit  0feb4f3
info  For more information on how to debug and view this report, see our readme

Flaky tests

chrome › tests/pageEditor/copyMod.spec.ts › run a copied mod with a built-in integration
msedge › tests/telemetry/errors.spec.ts › can report an indexdb error to telemetry service

Skipped tests

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 changed the title #9419: add registry to platform protocol #9419: add registry lookup to platform protocol Nov 6, 2024
Copy link

codecov bot commented Nov 6, 2024

Codecov Report

Attention: Patch coverage is 83.01887% with 9 lines in your changes missing coverage. Please review.

Project coverage is 75.64%. Comparing base (8318d74) to head (0feb4f3).
Report is 462 commits behind head on main.

Files with missing lines Patch % Lines
src/contentScript/executor.ts 0.00% 3 Missing ⚠️
src/extensionPages/extensionPagePlatform.ts 50.00% 2 Missing ⚠️
src/platform/platformBase.ts 0.00% 2 Missing ⚠️
...elds/schemaFields/widgets/varPopup/SourceLabel.tsx 0.00% 1 Missing ⚠️
.../pageEditor/modals/addBrickModal/AddBrickModal.tsx 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9421      +/-   ##
==========================================
+ Coverage   74.24%   75.64%   +1.39%     
==========================================
  Files        1332     1398      +66     
  Lines       40817    42311    +1494     
  Branches     7634     7795     +161     
==========================================
+ Hits        30306    32006    +1700     
+ Misses      10511    10305     -206     

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant