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 SDK constraints for Dart 3.0 and 3.1 stable releases #2207

Merged
merged 4 commits into from
Sep 7, 2023

Conversation

parlough
Copy link
Member

@parlough parlough commented Sep 1, 2023

Update SDK constraints for most packages to the first dev release of 3.2.0 since the stable 3.1.0 release doesn't actually include the DDC debugger runtime API changes, but will allow for package resolution with the 3.1.0-...-dev constraint and a 3.1.0 SDK. This will prevent that.

Others are updated to stable releases.

Issue reference: dart-lang/sdk#53459

@parlough parlough marked this pull request as ready for review September 1, 2023 04:03
Copy link
Contributor

@annagrin annagrin left a comment

Choose a reason for hiding this comment

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

@parlough Could you please clarify why the update is necessary? Technically using any SDK that currently satisfies the constraint we have is ok, so why do we want to make the constraint stricter? Generally we try to keep it a wide as possible to prevent integration problems. Unless something is breaking currently, I think it makes sense to keep the constraints as is until 3.2.0 is released, and then change them all at once, for all pubspec files that we have.

@parlough
Copy link
Member Author

parlough commented Sep 7, 2023

Could you please clarify why the update is necessary?

I apologize for not being super clear. package:dwds v20.0.0 and therefore package:webdev v3.0.7 were updated to use the new DDC debugger runtime. However, their Dart SDK constraint is currently >=3.1.0-340.0.dev <4.0.0, which allows for users running a stable build of Dart 3.1.X to use those package versions. The DDC debugger runtime changes landed after the 3.1 stable cutoff though, so if users use webdev 3.0.7 and debug they may get errors and some debugger functionality will not work. Many users likely just use the latest stable version of packages but it won't be clear where the issue is coming from.

Open for an example I just reproduced when just trying to evaluate a function.
[WARNING] Library org-dartlang-app:///web/main.dart is not loaded. This can happen for unreferenced libraries.
[WARNING] Failed to evaluate expression 'test'. 
[INFO] Unexpected error from chrome devtools:
text: Uncaught
exception:
  preview: null
  description: TypeError: dart.getFunctionMetadata is not a function
    at Function.<anonymous> (<anonymous>:4:21)
    at Object.test (http://127.0.0.1:8080/main.ddc.js:33:5)
    at http://127.0.0.1:8080/main.ddc.js:26:12
    at Object._checkAndCall (http://127.0.0.1:8080/packages/build_web_compilers/src/dev_compiler/dart_sdk.js:4986:16)
    at Object.dcall (http://127.0.0.1:8080/packages/build_web_compilers/src/dev_compiler/dart_sdk.js:4991:17)
    at HTMLDivElement.<anonymous> (http://127.0.0.1:8080/packages/build_web_compilers/src/dev_compiler/dart_sdk.js:102587:100)
  type: object
  value: null
attempted JS eval: `      function() {
        const sdk = require('dart_sdk');
        const dart = sdk.dart;
        return dart.getFunctionMetadata(this);
      }
    `
stack trace:
()               3:20
test()          http://127.0.0.1:8080/main.ddc.js 32:4
()              http://127.0.0.1:8080/main.ddc.js 25:11
_checkAndCall() http://127.0.0.1:8080/packages/build_web_compilers/src/dev_compiler/dart_sdk.js 4985:15
dcall()         http://127.0.0.1:8080/packages/build_web_compilers/src/dev_compiler/dart_sdk.js 4990:16
()              http://127.0.0.1:8080/packages/build_web_compilers/src/dev_compiler/dart_sdk.js 102586:99
:#0      handleErrorIfPresent (package:dwds/src/utilities/server.dart:91:5)
dart-lang/webdev#1      FunctionMetaData.metaDataFor (package:dwds/src/debugging/metadata/function.dart:36:5)
<asynchronous suspension>
dart-lang/webdev#2      StackZoneSpecification._registerUnaryCallback.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:127:15)
<asynchronous suspension>

Perhaps this is caused by a different issue as I'm not very familiar with these packages. However, reverting to webdev v3.0.6 or using a 3.2.0-dev SDK (with the new runtime debugger API) does fix the issue, so it seems to be at least partially related.

As for the few other constraints, I thought it would be best to more closely standardize them, but I'd be happy to pull them back :)

Edit: Updated incorrectly pasted constraint :)

@parlough
Copy link
Member Author

parlough commented Sep 7, 2023

As a note, this doesn't fully fix the issue for Dart 3.1.X users, just prevents it from happening in potential next webdev releases as well. Even with a new release with these updated constraints, package resolution will still pull down package:webdev:3.0.7 for them. They'd have to be suggested to pin webdev at 3.0.6 for now or the pub team could specially retract 3.0.7 since it has been more than 7 days.

@annagrin
Copy link
Contributor

annagrin commented Sep 7, 2023

@parlough This is indeed weird, as I remeber updating the constraints for the new debugger API... looks like the constraints are correct? (db1f552)

However, their Dart SDK constraint is currently >=3.1.0-254.0.dev <4.0.0,

as the change I mentioned above shows they are >=3.1.0-340.0.dev <4.0.0, so i am not really sure what is happening. I'll investigate, will keep this thread updated

@parlough
Copy link
Member Author

parlough commented Sep 7, 2023

Oops, I meant >=3.1.0-340.0.dev <4.0.0 not 3.1.0-254.0.dev (updated now). Either way, both constraints allow stable Dart 3.1.X versions which don't have the new debugger API.

There's been some other similar issues with the 3.1.0 release, since the dev tags weren't updated to 3.2.0 until quite a bit after the final stable commits. If you check the 3.1.0 tag(https://github.com/dart-lang/sdk/commits/3.1.0), it looks like the last dev release to make it in without cherry picks was 3.1.0-262.0.dev.

@annagrin
Copy link
Contributor

annagrin commented Sep 7, 2023

Either way, both constraints allow stable Dart 3.1.X versions which don't have the new debugger API.

Hmm all stable 3.1.0 versions should have new debugger API... I could not repro this - I installed the sdk previous to the constraint and run pub global activate webdev and it pulled webdev version 3.0.6. Could you please create an issue with your repro steps?

@parlough
Copy link
Member Author

parlough commented Sep 7, 2023

Resolution will work correctly with -dev releases. But any SDK constraint 3.1.0-dev will allow for a stable 3.1.0 stable SDK, as that is assumed to include the -dev changes. But the stable release of Dart 3.1.0 did not include the runtime API. You can see the commit is not included in the tag 3.1.0 (dart-lang/sdk@a322a97) and the new _internal/js_dev_runtime/private/ddc_runtime/debugger.dart file doesn't exist on stable.

The core issue is not a mistake on the side of webdev as the constraint should usually work, but due to the reality of the Dart 3.1.0 stable release which doesn't include all 3.1.0-dev changes (for some reason), the fix has to be in webdev.

I will create a new issue with reproduction steps, but the reproduction requires using a stable release.

Edit: Created an issue with reproduction steps dart-lang/sdk#53459

@annagrin
Copy link
Contributor

annagrin commented Sep 7, 2023

But the stable release of Dart 3.1.0 did not include the runtime API. You can see the commit is not included in the tag 3.1.0 (dart-lang/sdk@a322a97) and the new _internal/js_dev_runtime/private/ddc_runtime/debugger.dart file doesn't exist on stable.

That seems like a bug! Thanks for creating an issue. 3.1.0 > 3.1.0-x semantically so the SDK should follow that versioning scheme... I will follow up on that.

In the meanwhile, the current change is LGTM but you might need to rerun the failed tests (due to a bug in the SDK that is already fixed)

Copy link
Contributor

@annagrin annagrin left a comment

Choose a reason for hiding this comment

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

LGTM!

@elliette
Copy link
Contributor

elliette commented Sep 7, 2023

Hi @parlough, thanks for bringing this to our attention!

Making sure I understand what the issue is:

  • The DDC debugger API changes were included in SDK version 3.1.0-340.0.dev, which did not make the 3.1.0 stable cut off
  • The Webdev 3.0.7 SDK constraint was correctly using>=3.1.0-340.0.dev <4.0.0 so that developers would only get 3.0.7 if their SDK version had the DDC debugger API
  • However, if a developer is on the stable SDK version 3.1.0, then the Webdev 3.0.7 version would resolve for them (I'm guessing because semantic versioning considers any dev version equivalent to its respective major/minor/patch version, although I don't know enough about semantic versioning to say for sure).

If this is the case, I wonder if we could instead update the constraints to 3.1.1 (the current stable version) instead of 3.2.x?

Copy link
Contributor

@elliette elliette left a comment

Choose a reason for hiding this comment

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

Use the latest stable 3.1.1

@parlough
Copy link
Member Author

parlough commented Sep 7, 2023

Thank you both for taking a look at this. Sorry I didn't properly explain in the beginning.

That seems like a bug!

Yeah I think it's been the source of confusion for a few issues. I opened and commented in dart-lang/sdk#53298 (comment) with some further context.

Making sure I understand what the issue is:

Your understanding is correct. Thanks for the summary.

Use the latest stable 3.1.1

As for using 3.1.1 as the lower SDK constraint. I don't think that will work either, as it still does not contain the debugger changes. In this PR I went with the first 3.2.0 dev release as that should be guaranteed to include it.

dwds/CHANGELOG.md Outdated Show resolved Hide resolved
@elliette
Copy link
Contributor

elliette commented Sep 7, 2023

Thank you both for taking a look at this. Sorry I didn't properly explain in the beginning.

That seems like a bug!

Yeah I think it's been the source of confusion for a few issues. I opened and commented in dart-lang/sdk#53298 (comment) with some further context.

Making sure I understand what the issue is:

Your understanding is correct. Thanks for the summary.

Use the latest stable 3.1.1

As for using 3.1.1 as the lower SDK constraint. I don't think that will work either, as it still does not contain the debugger changes. In this PR I went with the first 3.2.0 dev release as that should be guaranteed to include it.

Got it, thanks for the explanation. This looks good to me once the CHANGELOGS are updated to include the PR link. Thanks!

@annagrin
Copy link
Contributor

annagrin commented Sep 7, 2023

@elliette Looks after this PR is in we need to remove the https://pub.dev/packages/webdev/versions/3.0.7 and release a new one.

@nshahan - FYI: The new constraint should not block the new type system changes AFAIK, as both flutter and internal usage are already on some SDK past 3.2.0-0

@parlough
Copy link
Member Author

parlough commented Sep 7, 2023

I updated the changelog entries with a link to the PR :)

Looks after this PR is in we need to remove the https://pub.dev/packages/webdev/versions/3.0.7 and release a new one.

I think that sounds like the best course of action if it's possible. Default retraction only supports within 7 days so you may need to ask someone with administrative access to pub.

I filed #2218 so that the follow-up release work isn't lost.

@auto-submit auto-submit bot merged commit 9851c23 into dart-lang:master Sep 7, 2023
54 checks passed
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.

3 participants