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

Update to the latest package:test #46592

Merged
merged 18 commits into from
Oct 23, 2023
Merged

Conversation

natebosch
Copy link
Contributor

@natebosch natebosch commented Oct 5, 2023

  • Update the pinned version of test to the latest published.
  • Add support for reading the source.location of messages to the JS
    interop library.
  • Update host.dart to support the new communication pattern with the
    test frame. See Simplify the communication between the browser host and iframe dart-lang/test#2065
  • Use Runtime.edge for the edge browser. We may deprecate or remove
    the constant. Edge is a more appropriate value for this usage.

@natebosch natebosch requested a review from yjbanov October 5, 2023 19:11
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie or stuartmorgan on the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@github-actions github-actions bot added the platform-web Code specifically for the web engine label Oct 5, 2023
@natebosch
Copy link
Contributor Author

It looks like there is at least one place where this code is being used against an older version of test_api.

Running `dart pub get` in 'engine/src/flutter/lib/web_ui'
dev/edge.dart:27:45: Error: Member not found: 'edge'.
  Runtime get packageTestRuntime => Runtime.edge;
                                            ^^^^

@natebosch
Copy link
Contributor Author

natebosch commented Oct 5, 2023

I don't expect this to have any behavior change. Both Runtime instances only differ in small ways, and the edge runtime is more correct for the edge browser. The identifier is the most important bit, and the code already ensures that the identifier matches the registered platform.

Registered at

browserEnvironment.packageTestRuntime,

Selected by the args with

'--platform=${browserEnvironment.packageTestRuntime.identifier}',

There are other uses which I think are not meaningful, but I'm less certain.:
It impacts a configuration to webdriver,

uri: driverUri, desired: <String, dynamic>{'browserName': packageTestRuntime.identifier});

and a fragment put into the URL

'browser': _browserEnvironment.packageTestRuntime.identifier

I don't expect either to have a meaningful or user visible impact, but @yjbanov might know if there is more I should be checking.

@natebosch
Copy link
Contributor Author

It looks like there is at least one place where this code is being used against an older version of test_api.

@yjbanov - How does this package/repo handle these dependencies?

I see that package:ui has a pubspec which uses test_api as a dev_dependency and leaves the version unconstrained, despite importing that package under lib/.

test_api: any

Is there a reason test_api isn't a normal dependency? Where can I constrain this code to only run against new enough versions of package:test_api?

@natebosch
Copy link
Contributor Author

natebosch commented Oct 5, 2023

How does this package/repo handle these dependencies?

I would have expected the DEPS file to handle it. I don't know why we'd see an older version that causes the static failure.

engine/DEPS

Lines 480 to 481 in 98d3eba

'src/third_party/dart/third_party/pkg/test':
Var('dart_git') + '/test.git@367aa397ab1cb08755f8a7582ab21101ceb9d29b',

Are there places in CI we are using stale packages?

@eyebrowsoffire
Copy link
Contributor

We have been meaning to switch to using the DEPS provided packages in web_ui, but we haven't done so. We are just relying on pub currently. If it simplifies things to switch some of the packages to use the path from the gclient checkout (as dart:ui does) I think that would probably be a good change

@natebosch
Copy link
Contributor Author

We are just relying on pub currently

Hmm, I don't think I understand the strategy this repo takes to writing pubspecs... I think the intention appears to be to pin most packages to a single version? I'll try pinning to a newer package:test in the pubspecs which reference that package...

@stuartmorgan
Copy link
Contributor

test-exempt: is a test

@yjbanov
Copy link
Contributor

yjbanov commented Oct 7, 2023

We are just relying on pub currently

Hmm, I don't think I understand the strategy this repo takes to writing pubspecs... I think the intention appears to be to pin most packages to a single version? I'll try pinning to a newer package:test in the pubspecs which reference that package...

Sorry, my bad. I should have paid attention when reviewing https://github.com/flutter/engine/pull/34986/files#diff-8cbbe86127b013f147ecc979fa6d1e02e96c45fdb7491e91bc44ea151f11805c. We do want to pin at least all the directly imported packages. Feel free to submit whatever works, and I'll do a clean-up of pubspecs as a follow-up.

@natebosch
Copy link
Contributor Author

@yjbanov - I cannot find any relevant errors in the CI logs. Do you know where I should be looking for the cause of the failure?

What is the typical process for rolling to new version of package:test in this repo?

natebosch added a commit to dart-lang/test that referenced this pull request Oct 13, 2023
Allow backwards compatibility with current callers. This might make it
easier to land flutter/engine#46592
natebosch added a commit to dart-lang/test that referenced this pull request Oct 13, 2023
Allow backwards compatibility with current callers. This might make it
easier to land flutter/engine#46592
Splitting from flutter#46592 to separate code changes from the package roll.
See dart-lang/test#2065

Multiple copies of the host and iframe side implementations have been
updated, but this copy of `host.dart` was missed. Apply some of the
changes from the linked test issue to this copy.

- Add `MessageEventSource` and `MessageEventSourceLocation` interop
  classes. The frame side communication no longer includes an `href`
  field in the map, read it through `message.source.location`.
- Move the `DomMessageChannel` initiation into the handler for the
  `{'ready': true}` event. This removes the need for the
  `readyCompleter` since we do not start forwarding messages until the
  port is ready for use.
- Add handling for the new pattern, when the iframe sends a message with
  the string `'port'` instead of a Map.
@natebosch natebosch changed the title Use Runtime.edge for the edge browser Update to the latest package:test Oct 20, 2023
@natebosch
Copy link
Contributor Author

I was able to track down the reason for the failure - some discussion in #46905 Fix is to update the copy of host.dart in this repo.

In that PR I was confused by some failures that now appear to have been intermittent or flakes.

I had made this optional to ease the migration and not need a
synchronous code change with the package upgrade, but this diagnostic
makes that impossible. Whenever the upstream package makes the argument
required again we'll need another atomic change.
@natebosch natebosch added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 23, 2023
@auto-submit auto-submit bot merged commit fbc0a34 into flutter:main Oct 23, 2023
25 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 23, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Oct 23, 2023
…137088)

flutter/engine@1ac3086...e89f042

2023-10-23 [email protected] Roll Skia from 8a0324990bf5 to 4976279e4441 (1 revision) (flutter/engine#47230)
2023-10-23 [email protected] Update to the latest package:test (flutter/engine#46592)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
harryterkelsen pushed a commit that referenced this pull request Oct 23, 2023
- Update the pinned version of `test` to the latest published.
- Add support for reading the `source.location` of messages to the JS
  interop library.
- Update `host.dart` to support the new communication pattern with the
  test frame. See dart-lang/test#2065
- Use `Runtime.edge` for the edge browser. We may deprecate or remove
  the constant. Edge is a more appropriate value for this usage.
@natebosch natebosch deleted the runtime-edge branch November 16, 2023 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App platform-web Code specifically for the web engine
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants