Skip to content

Commit c2ba6b7

Browse files
committed
Merge remote-tracking branch 'origin/master' into workspace
2 parents d9dd382 + 5396f91 commit c2ba6b7

File tree

316 files changed

+8153
-3060
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

316 files changed

+8153
-3060
lines changed

.github/workflows/dart.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Created with package:mono_repo v6.6.1
1+
# Created with package:mono_repo v6.6.2
22
name: Dart CI
33
on:
44
push:
@@ -36,7 +36,7 @@ jobs:
3636
name: Checkout repository
3737
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
3838
- name: mono_repo self validate
39-
run: dart pub global activate mono_repo 6.6.1
39+
run: dart pub global activate mono_repo 6.6.2
4040
- name: mono_repo self validate
4141
run: dart pub global run mono_repo generate --validate
4242
job_002:

CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,31 @@ Important changes to data models, configuration, and migrations between each
22
AppEngine version, listed here to ease deployment and troubleshooting.
33

44
## Next Release (replace with git tag when deployed)
5+
6+
## `20241031t095600-all`
7+
* Bumped runtimeVersion to `2024.10.29`.
8+
* Upgraded stable Dart analysis SDK to `3.5.4`
9+
* Upgraded stable Flutter analysis SDK to `3.24.4`.
10+
* Upgraded pana to `0.22.15`.
11+
12+
## `20241022t092400-all`
13+
* Bumped runtimeVersion to `2024.10.21`.
14+
15+
## `20241017t095600-all`
16+
* Bumped runtimeVersion to `2024.10.15`.
17+
* Upgraded pana to `0.22.13`.
18+
* Upgraded dependencies (including `mailer`).
19+
20+
## `20241008t115400-all`
21+
22+
## `20241003t100900-all`
23+
24+
## `20240926t112500-all`
25+
* Bumped runtimeVersion to `2024.09.17`.
26+
* Upgraded stable Dart analysis SDK to `3.5.3`
27+
* Upgraded stable Flutter analysis SDK to `3.24.3`.
28+
29+
## `20240911t105800-all`
530
* Bumped runtimeVersion to `2024.09.10`.
631
* Upgraded stable Flutter analysis SDK to `3.24.2`.
732

Dockerfile.worker

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ RUN mkdir -p /home/worker/config/dart-stable
2323
RUN mkdir -p /home/worker/config/flutter-stable
2424

2525
# Setup Dart SDK into /home/worker/dart/{stable,preview}/
26-
RUN XDG_CONFIG_HOME=/home/worker/config/dart-stable tool/setup-dart.sh /home/worker/dart/stable 3.5.2
26+
RUN XDG_CONFIG_HOME=/home/worker/config/dart-stable tool/setup-dart.sh /home/worker/dart/stable 3.5.4
2727

2828
# Setup Flutter SDK into /home/worker/flutter/{stable,preview}/
29-
RUN XDG_CONFIG_HOME=/home/worker/config/flutter-stable tool/setup-flutter.sh /home/worker/flutter/stable 3.24.2
29+
RUN XDG_CONFIG_HOME=/home/worker/config/flutter-stable tool/setup-flutter.sh /home/worker/flutter/stable 3.24.4
3030

3131
# Setup webp
3232
RUN tool/setup-webp.sh /home/worker/bin

analysis_options.yaml

Lines changed: 76 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -8,73 +8,79 @@ analyzer:
88
# https://dart.dev/lints
99
linter:
1010
rules:
11-
- always_declare_return_types
12-
- always_require_non_null_named_parameters
13-
- annotate_overrides
14-
- avoid_empty_else
15-
- avoid_init_to_null
16-
- avoid_null_checks_in_equality_operators
17-
- avoid_relative_lib_imports
18-
- avoid_return_types_on_setters
19-
- avoid_shadowing_type_parameters
20-
- avoid_types_as_parameter_names
21-
- await_only_futures
22-
- camel_case_extensions
23-
- camel_case_types
24-
- cancel_subscriptions
25-
- close_sinks
26-
- collection_methods_unrelated_type
27-
- comment_references
28-
- constant_identifier_names
29-
- control_flow_in_finally
30-
- curly_braces_in_flow_control_structures
31-
- directives_ordering
32-
- empty_catches
33-
- empty_constructor_bodies
34-
- empty_statements
35-
- hash_and_equals
36-
- implementation_imports
37-
- library_names
38-
- library_prefixes
39-
- literal_only_boolean_expressions
40-
- no_duplicate_case_values
41-
- non_constant_identifier_names
42-
- null_closures
43-
#- omit_local_variable_types
44-
- one_member_abstracts
45-
- only_throw_errors
46-
- overridden_fields
47-
- package_names
48-
- package_prefixed_library_names
49-
- prefer_adjacent_string_concatenation
50-
- prefer_collection_literals
51-
- prefer_conditional_assignment
52-
- prefer_contains
53-
- prefer_equal_for_default_values
54-
- prefer_final_fields
55-
- prefer_final_locals
56-
- prefer_for_elements_to_map_fromIterable
57-
- prefer_generic_function_type_aliases
58-
- prefer_if_null_operators
59-
- prefer_is_empty
60-
- prefer_is_not_empty
61-
- prefer_iterable_whereType
62-
- prefer_single_quotes
63-
- prefer_spread_collections
64-
- prefer_typing_uninitialized_variables
65-
- recursive_getters
66-
- slash_for_doc_comments
67-
- test_types_in_equals
68-
- throw_in_finally
69-
- type_init_formals
70-
- unawaited_futures
71-
- unnecessary_brace_in_string_interps
72-
- unnecessary_const
73-
- unnecessary_getters_setters
74-
- unnecessary_new
75-
- unnecessary_null_in_if_null_operators
76-
- unnecessary_this
77-
- unrelated_type_equality_checks
78-
- use_function_type_syntax_for_parameters
79-
- use_rethrow_when_possible
80-
- valid_regexps
11+
- always_declare_return_types
12+
- annotate_overrides
13+
- avoid_empty_else
14+
- avoid_init_to_null
15+
- avoid_null_checks_in_equality_operators
16+
- avoid_relative_lib_imports
17+
- avoid_return_types_on_setters
18+
- avoid_shadowing_type_parameters
19+
- avoid_types_as_parameter_names
20+
- await_only_futures
21+
- camel_case_extensions
22+
- camel_case_types
23+
- cancel_subscriptions
24+
- close_sinks
25+
- collection_methods_unrelated_type
26+
- comment_references
27+
- constant_identifier_names
28+
- control_flow_in_finally
29+
- curly_braces_in_flow_control_structures
30+
- dangling_library_doc_comments
31+
- directives_ordering
32+
- empty_catches
33+
- empty_constructor_bodies
34+
- empty_statements
35+
- hash_and_equals
36+
- implementation_imports
37+
- library_annotations
38+
- library_names
39+
- library_prefixes
40+
- literal_only_boolean_expressions
41+
- no_duplicate_case_values
42+
- non_constant_identifier_names
43+
- null_closures
44+
#- omit_local_variable_types
45+
- one_member_abstracts
46+
- only_throw_errors
47+
- overridden_fields
48+
- package_names
49+
- package_prefixed_library_names
50+
- prefer_adjacent_string_concatenation
51+
- prefer_collection_literals
52+
- prefer_conditional_assignment
53+
- prefer_contains
54+
- prefer_final_fields
55+
- prefer_final_in_for_each
56+
- prefer_final_locals
57+
- prefer_for_elements_to_map_fromIterable
58+
- prefer_generic_function_type_aliases
59+
- prefer_if_null_operators
60+
- prefer_is_empty
61+
- prefer_is_not_empty
62+
- prefer_iterable_whereType
63+
- prefer_null_aware_operators
64+
- prefer_single_quotes
65+
- prefer_spread_collections
66+
- prefer_typing_uninitialized_variables
67+
- recursive_getters
68+
- slash_for_doc_comments
69+
- test_types_in_equals
70+
- throw_in_finally
71+
- type_init_formals
72+
- unawaited_futures
73+
- unnecessary_brace_in_string_interps
74+
- unnecessary_const
75+
- unnecessary_getters_setters
76+
- unnecessary_late
77+
- unnecessary_library_name
78+
- unnecessary_library_directive
79+
- unnecessary_new
80+
- unnecessary_null_in_if_null_operators
81+
- unnecessary_this
82+
- unrelated_type_equality_checks
83+
- use_function_type_syntax_for_parameters
84+
- use_rethrow_when_possible
85+
- use_string_in_part_of_directives
86+
- valid_regexps
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
import 'dart:convert';
6+
import 'dart:io';
7+
8+
import 'package:pub_dev/package/overrides.dart';
9+
import 'package:pub_dev/search/mem_index.dart';
10+
import 'package:pub_dev/search/models.dart';
11+
import 'package:pub_dev/search/search_service.dart';
12+
13+
/// Loads a search snapshot and executes queries on it, benchmarking their total time to complete.
14+
Future<void> main(List<String> args) async {
15+
// Assumes that the first argument is a search snapshot file.
16+
final file = File(args.first);
17+
final content =
18+
json.decode(utf8.decode(gzip.decode(await file.readAsBytes())))
19+
as Map<String, Object?>;
20+
final snapshot = SearchSnapshot.fromJson(content);
21+
snapshot.documents!
22+
.removeWhere((packageName, doc) => isSoftRemoved(packageName));
23+
final index = InMemoryPackageIndex(documents: snapshot.documents!.values);
24+
25+
// NOTE: please add more queries to this list, especially if there is a performance bottleneck.
26+
final queries = [
27+
'json',
28+
'camera',
29+
'android camera',
30+
'sql database',
31+
];
32+
33+
final sw = Stopwatch()..start();
34+
var count = 0;
35+
for (var i = 0; i < 100; i++) {
36+
index.search(ServiceSearchQuery.parse(query: queries[i % queries.length]));
37+
count++;
38+
}
39+
sw.stop();
40+
print('${(sw.elapsedMilliseconds / count).toStringAsFixed(2)} ms/request');
41+
}

app/lib/account/agent.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ abstract class KnownAgents {
2525
///
2626
/// Deprecated and should not be used for new audit-log entries.
2727
/// This value is still present in some older audit-log entries.
28-
static const _genericGithubActions = 'service:github-actions';
28+
static const _genericGitHubActions = 'service:github-actions';
2929

3030
/// Non-specific agent - only specifies it is from GCP Service Account.
3131
///
@@ -67,7 +67,7 @@ abstract class KnownAgents {
6767
];
6868

6969
static const _nonSpecificAgentIds = <String>{
70-
_genericGithubActions,
70+
_genericGitHubActions,
7171
_genericGcpServiceAccount,
7272
pubSupport,
7373
};
@@ -132,15 +132,15 @@ abstract class AuthenticatedAgent {
132132
/// Holds the authenticated GitHub Action information.
133133
///
134134
/// The [agentId] has the following format: `service:github-actions:<repositoryOwnerId>/<repositoryId>`
135-
class AuthenticatedGithubAction implements AuthenticatedAgent {
135+
class AuthenticatedGitHubAction implements AuthenticatedAgent {
136136
@override
137137
late final agentId = KnownAgents.githubActionsAgentId(
138138
repositoryOwnerId: payload.repositoryOwnerId,
139139
repositoryId: payload.repositoryId,
140140
);
141141

142142
@override
143-
String get displayId => KnownAgents._genericGithubActions;
143+
String get displayId => KnownAgents._genericGitHubActions;
144144

145145
/// OIDC `id_token` the request was authenticated with.
146146
///
@@ -155,7 +155,7 @@ class AuthenticatedGithubAction implements AuthenticatedAgent {
155155
/// The parsed, GitHub-specific JWT payload.
156156
final GitHubJwtPayload payload;
157157

158-
AuthenticatedGithubAction({
158+
AuthenticatedGitHubAction({
159159
required this.idToken,
160160
required this.payload,
161161
}) {

app/lib/account/backend.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ Future<AuthenticatedAgent?> _tryAuthenticateServiceAgent(String token) async {
170170
if (payload == null) {
171171
throw AuthenticationException.tokenInvalid('unable to parse payload');
172172
}
173-
return AuthenticatedGithubAction(
173+
return AuthenticatedGitHubAction(
174174
idToken: idToken,
175175
payload: payload,
176176
);
@@ -241,7 +241,7 @@ class AccountBackend {
241241
/// Uses in-memory cache to store entries locally for up to 10 minutes.
242242
Future<List<String?>> getEmailsOfUserIds(List<String> userIds) async {
243243
final result = <String?>[];
244-
for (String userId in userIds) {
244+
for (final userId in userIds) {
245245
result.add(await getEmailOfUserId(userId));
246246
}
247247
return result;

app/lib/account/consent_backend.dart

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@ import '../frontend/templates/consent.dart';
1414
import '../package/backend.dart';
1515
import '../publisher/backend.dart';
1616
import '../service/email/backend.dart';
17+
import '../service/email/email_templates.dart' show createInviteEmail;
1718
import '../shared/datastore.dart';
18-
import '../shared/email.dart' show createInviteEmail;
1919
import '../shared/exceptions.dart';
2020
import '../shared/urls.dart';
21-
2221
import 'backend.dart';
2322
import 'models.dart';
2423

@@ -61,7 +60,7 @@ class ConsentBackend {
6160
final c = await _lookupAndCheck(consentId, user);
6261
final action = _actions[c.kind]!;
6362
final fromAgent = c.fromAgent!;
64-
late String invitingUserEmail;
63+
final String invitingUserEmail;
6564
if (looksLikeUserId(fromAgent)) {
6665
invitingUserEmail = (await accountBackend.getEmailOfUserId(fromAgent))!;
6766
} else {
@@ -231,7 +230,7 @@ class ConsentBackend {
231230
Future<void> deleteObsoleteConsents() async {
232231
final query = _db.query<Consent>()
233232
..filter('expires <', clock.now().toUtc());
234-
await for (var entry in query.run()) {
233+
await for (final entry in query.run()) {
235234
try {
236235
await _delete(entry, (a) => a.onExpire(entry));
237236
} catch (e) {

app/lib/account/default_auth_provider.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ import 'package:googleapis_auth/auth_io.dart' as auth;
1212
import 'package:http/http.dart' as http;
1313
import 'package:logging/logging.dart';
1414

15+
import '../service/email/email_templates.dart' show looksLikeEmail;
1516
import '../service/openid/gcp_openid.dart';
1617
import '../service/openid/github_openid.dart';
1718
import '../service/openid/jwt.dart';
1819
import '../service/openid/openid_models.dart';
1920
import '../service/secret/backend.dart';
2021
import '../shared/configuration.dart';
21-
import '../shared/email.dart' show looksLikeEmail;
2222
import '../shared/exceptions.dart';
2323
import '../shared/monitoring.dart';
2424
import '../shared/utils.dart' show fixedTimeEquals;
@@ -207,7 +207,7 @@ abstract class BaseAuthProvider extends AuthProvider {
207207
if (idToken.payload.iss == GitHubJwtPayload.issuerUrl) {
208208
// The token claims to be issued by GitHub. If there is any problem
209209
// with the token, the authentication should fail without any fallback.
210-
await _verifyToken(idToken, openIdDataFetch: fetchGithubOpenIdData);
210+
await _verifyToken(idToken, openIdDataFetch: fetchGitHubOpenIdData);
211211
return idToken;
212212
}
213213

app/lib/account/models.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class User extends db.ExpandoModel<String> {
7575
}
7676

7777
late final isVisible = !isBlocked && !isModerated && !isDeleted;
78-
late final isNotVisible = !isVisible;
78+
bool get isNotVisible => !isVisible;
7979

8080
void updateIsModerated({
8181
required bool isModerated,
@@ -415,8 +415,7 @@ String consentDedupId({
415415
required List<String> args,
416416
}) =>
417417
[fromAgentId, email, kind, ...args]
418-
.where((s) => s != null)
419-
.whereType<String>()
418+
.nonNulls
420419
.map(Uri.encodeComponent)
421420
.join('/');
422421

0 commit comments

Comments
 (0)