Skip to content

Commit 9362a09

Browse files
committed
Rebase on main
1 parent 44e0114 commit 9362a09

File tree

256 files changed

+5813
-4943
lines changed

Some content is hidden

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

256 files changed

+5813
-4943
lines changed

.github/workflows/dart.yml

Lines changed: 197 additions & 133 deletions
Large diffs are not rendered by default.

.github/workflows/token-test.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ jobs:
2525
steps:
2626
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
2727
- uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30
28-
with:
29-
sdk: dev
3028
- name: Install dependencies
3129
run: dart pub get
3230
working-directory: app

CHANGELOG.md

Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,69 @@ 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-
* Upgraded runtime Dart SDK to `3.5.0-196.0.dev`.
6-
* Upgraded runtimeVersion to `2024.06.11`
5+
* Bumped runtimeVersion to `2024.09.04`.
6+
* Upgraded stable Dart analysis SDK to `3.5.2`
7+
* Upgraded dartdoc to `8.1.0`.
8+
* Note: `Package.latest*` fields are recalculated with a full list of `PackageVersion` entities.
9+
10+
## `20240829t084400-all`
11+
* Bumped runtimeVersion to `2024.08.27`.
12+
* Upgraded stable Flutter analysis SDK to `3.24.1`.
13+
* Upgraded pana to `0.22.12`.
14+
* Upgraded dartdoc to `8.0.14`.
15+
* Note: the `report` experiment is enabled by default.
16+
17+
## `20240821t093600-all`
18+
* Bumped runtimeVersion to `2024.08.20`.
19+
* Upgraded stable Dart analysis SDK to `3.5.1`
20+
* Upgraded pana to `0.22.11`.
21+
22+
## `20240815t121700-all`
23+
* Bumped runtimeVersion to `2024.08.09`.
24+
* Upgraded runtime Dart SDK to `3.5.0`.
25+
* Upgraded dependencies including `mailer` and `googleapis`.
26+
* Additional memory to search instances.
27+
28+
## `20240808t114400-all`
29+
* Bumped runtimeVersion to `2024.08.08`.
30+
* Upgraded pana to `0.22.10`.
31+
32+
## `20240808t081100-all`
33+
* Bumped runtimeVersion to `2024.08.06`.
34+
* Upgraded stable Flutter analysis SDK to `3.24.0`.
35+
* Upgraded dartdoc to `8.0.13`.
36+
37+
## `20240805t095700-all`
38+
* Bumped runtimeVersion to `2024.08.05`.
39+
* Upgraded stable Dart analysis SDK to `3.5.0`
40+
* Upgraded stable Flutter analysis SDK to `3.22.3`.
41+
42+
## `20240718t101100-all`
43+
* Bumped runtimeVersion to `2024.07.18`.
44+
* Upgraded pana to `0.22.9`.
45+
46+
## `20240711t102500-all`
47+
* Bumped runtimeVersion to `2024.07.09`.
48+
* Upgraded pana to `0.22.8`.
49+
* Upgraded dartdoc to `8.0.10`.
50+
* Note: `setup-flutter.sh` uses http archives for stable/beta channel.
51+
* Note: started to use `Summary.result.licenses`.
52+
* Note: starting to check `hook/` files for new package uploads.
53+
54+
## `20240627t084200-all`
55+
* Bumped runtimeVersion to `2024.06.25`.
56+
* Upgraded stable Dart analysis SDK to `3.4.4`
57+
58+
## `20240620t083100-all`
59+
* Bumped runtimeVersion to `2024.06.19`.
60+
* Upgraded pana to `0.22.7`.
61+
62+
## `20240613t092600-all`
63+
* Bumped runtimeVersion to `2024.06.12`.
64+
* Upgraded stable Dart analysis SDK to `3.4.3`
65+
* Upgraded stable Flutter analysis SDK to `3.22.2`.
66+
* Upgraded pana to `0.22.6`.
67+
* Note: `Consent.fromUserId` and `Consent.createdBySiteAdmin` may be removed once this release gets stable.
768

869
## `20240606t114600-all`
970
* Bumped runtimeVersion to `2024.05.30`.

Dockerfile.app

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Keep version in-sync with .mono_repo.yml and app/lib/shared/versions.dart
2-
FROM dart:3.5.0-196.0.dev
2+
FROM dart:3.5.0
33

44
# After install we remove the apt-index again to keep the docker image diff small.
55
RUN apt-get update && \
@@ -17,17 +17,18 @@ COPY static /project/static
1717
COPY doc /project/doc
1818
COPY third_party /project/third_party
1919
COPY tool /project/tool
20-
COPY pubspec.yaml /project/pubspec.yaml
21-
22-
WORKDIR /project/
23-
RUN dart /project/tool/pub_get_offline.dart
2420

2521
WORKDIR /project/pkg/web_app
22+
RUN dart /project/tool/pub_get_offline.dart /project/pkg/web_app
2623
RUN ./build.sh
2724

2825
WORKDIR /project/pkg/web_css
26+
RUN dart /project/tool/pub_get_offline.dart /project/pkg/web_css
2927
RUN ./build.sh
3028

29+
WORKDIR /project/app
30+
RUN dart /project/tool/pub_get_offline.dart /project/app
31+
3132
RUN /project/tool/setup-webp.sh /usr/local/bin
3233

3334
# Clear out any arguments the base images might have set

Dockerfile.worker

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ FROM gcr.io/google-containers/debian-base-amd64:v2.0.0
22

33
RUN apt-get update && \
44
apt-get upgrade -y && \
5-
apt-get install -y unzip ca-certificates curl bash git && \
5+
apt-get install -y unzip ca-certificates curl bash git xz-utils && \
66
rm -rf /var/lib/apt/lists/*
77

88
ENV PUB_ENVIRONMENT="bot.pub_dev.pub_worker"
99
ENV CI="true"
10+
ENV NO_COLOR="true"
1011

1112
# Configure a 'worker' user, to avoid running processes as root when this is not
1213
# necessary (this is just docker hardening).
@@ -18,18 +19,14 @@ COPY --chown=worker:worker . /home/worker/pub-dev
1819
WORKDIR /home/worker/pub-dev
1920

2021
# A config directory for preview SDKs.
21-
RUN mkdir -p /home/worker/config/dart-dev
2222
RUN mkdir -p /home/worker/config/dart-stable
2323
RUN mkdir -p /home/worker/config/flutter-stable
2424

25-
# Setup Dart SDK as stable analysis 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.4.1
27-
28-
# Setup Dart SDK for running pana into /home/worker/dart/runtime/
29-
RUN XDG_CONFIG_HOME=/home/worker/config/dart-stable tool/setup-dart.sh /home/worker/dart/runtime 3.5.0-196.0.dev
25+
# 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
3027

3128
# Setup Flutter SDK into /home/worker/flutter/{stable,preview}/
32-
RUN XDG_CONFIG_HOME=/home/worker/config/flutter-stable tool/setup-flutter.sh /home/worker/flutter/stable 3.22.1
29+
RUN XDG_CONFIG_HOME=/home/worker/config/flutter-stable tool/setup-flutter.sh /home/worker/flutter/stable 3.24.1
3330

3431
# Setup webp
3532
RUN tool/setup-webp.sh /home/worker/bin
@@ -38,8 +35,8 @@ RUN tool/setup-webp.sh /home/worker/bin
3835
ENV DART_SDK="/home/worker/dart/stable"
3936
ENV FLUTTER_ROOT="/home/worker/flutter/stable"
4037

41-
# Use runtime Dart-SDK in PATH
42-
ENV PATH="/home/worker/bin:/home/worker/dart/runtime/bin:${PATH}"
38+
# Use stable Dart-SDK in PATH
39+
ENV PATH="/home/worker/bin:/home/worker/dart/stable/bin:${PATH}"
4340

4441
# Install dependencies for pub_worker
4542
WORKDIR /home/worker/pub-dev/pkg/pub_worker

app/config/dartlang-pub-dev.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ cosImage: projects/cos-cloud/global/images/family/cos-105-lts
2020
taskWorkerServiceAccount: [email protected]
2121
imageBucketName: dartlang-pub-dev--pub-images
2222
reportsBucketName: dartlang-pub-dev-reports
23+
downloadCountsBucketName: dartlang-pub-download-counts
2324
storageBaseUrl: https://storage.googleapis.com
2425
pubClientAudience: 818368855108-8grd2eg9tj9f38os6f1urbcvsq399u8n.apps.googleusercontent.com
2526
pubServerAudience: 621485135717-082tj8o9vu32lbmquftsolqngk2o13lp.apps.googleusercontent.com

app/config/dartlang-pub.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ cosImage: projects/cos-cloud/global/images/family/cos-105-lts
2323
taskWorkerServiceAccount: [email protected]
2424
imageBucketName: dartlang-pub--pub-images
2525
reportsBucketName: dartlang-pub-reports
26+
downloadCountsBucketName: dartlang-pub-download-counts
2627
storageBaseUrl: https://storage.googleapis.com
2728
pubClientAudience: 818368855108-8grd2eg9tj9f38os6f1urbcvsq399u8n.apps.googleusercontent.com
2829
pubServerAudience: 818368855108-ulq5tn5t51ga21hg8jkcavbooaljiasp.apps.googleusercontent.com

app/dart_test.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,15 @@ tags:
1414
presets:
1515
sanity:
1616
skip: false # Don't skip these tests.
17+
build:
18+
skip: 'Build tests are run separately, always in a single thread.'
19+
presets:
20+
build-only:
21+
skip: false # Don't skip these tests.
22+
23+
presets:
24+
build-only:
25+
skip: 'Only build tests are run' # Skip all tests, as they are run separately
26+
tags:
27+
build:
28+
skip: false # Run only build tags

app/lib/account/backend.dart

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ Future<AuthenticatedUser> requireAuthenticatedWebUser() async {
8484
/// the given [permission].
8585
///
8686
/// Throws [AuthorizationException] if it doesn't have the permission.
87-
Future<AuthenticatedGcpServiceAccount> requireAuthenticatedAdmin(
87+
Future<SupportAgent> requireAuthenticatedAdmin(
8888
AdminPermission permission) async {
8989
final agent = await _requireAuthenticatedAgent();
9090
if (agent is AuthenticatedGcpServiceAccount) {
@@ -96,7 +96,7 @@ Future<AuthenticatedGcpServiceAccount> requireAuthenticatedAdmin(
9696
'Authenticated user (${agent.displayId}) is trying to access unauthorized admin APIs.');
9797
throw AuthorizationException.userIsNotAdminForPubSite();
9898
}
99-
return agent;
99+
return SupportAgent();
100100
} else {
101101
throw AuthenticationException.tokenInvalid('not a GCP service account');
102102
}
@@ -639,22 +639,26 @@ class AccountBackend {
639639
String userId,
640640
bool isModerated, {
641641
required Key? refCaseKey,
642-
required String? message,
642+
required String? moderatedReason,
643+
required String? note,
643644
}) async {
644645
await withRetryTransaction(_db, (tx) async {
645646
final user =
646647
await tx.lookupOrNull<User>(_db.emptyKey.append(User, id: userId));
647648
if (user == null) throw NotFoundException.resource('User:$userId');
648649

649-
user.updateIsModerated(isModerated: isModerated);
650+
user.updateIsModerated(
651+
isModerated: isModerated,
652+
moderatedReason: moderatedReason,
653+
);
650654
tx.insert(user);
651655

652656
if (refCaseKey != null) {
653657
final mc = await tx.lookupValue<ModerationCase>(refCaseKey);
654658
mc.addActionLogEntry(
655659
ModerationSubject.user(user.email!).fqn,
656660
isModerated ? ModerationAction.apply : ModerationAction.revert,
657-
message,
661+
note,
658662
);
659663
tx.insert(mc);
660664
}

app/lib/account/consent_backend.dart

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ class ConsentBackend {
106106
/// - if it was sent recently, do nothing.
107107
Future<api.InviteStatus> _invite({
108108
required AuthenticatedAgent activeAgent,
109-
required User activeUser,
110109
required String email,
111110
required String kind,
112111
required List<String> args,
@@ -129,7 +128,7 @@ class ConsentBackend {
129128
await _delete(old, (a) => a.onExpire(old));
130129
} else if (old.shouldNotify()) {
131130
// non-expired entries just re-send the notification
132-
return await _sendNotification(activeUser.email!, old);
131+
return await _sendNotification(activeAgent.displayId, old);
133132
} else {
134133
return api.InviteStatus(
135134
emailSent: false, nextNotification: old.nextNotification);
@@ -138,30 +137,26 @@ class ConsentBackend {
138137
// Create a new entry.
139138
final consent = Consent.init(
140139
fromAgent: activeAgent.agentId,
141-
fromUserId: activeUser.userId,
142140
email: email,
143141
kind: kind,
144142
args: args,
145-
createdBySiteAdmin: activeAgent is SupportAgent,
146143
);
147144
await _db.commit(inserts: [
148145
consent,
149146
auditLogRecord,
150147
]);
151-
return await _sendNotification(activeUser.email!, consent);
148+
return await _sendNotification(activeAgent.displayId, consent);
152149
});
153150
}
154151

155152
/// Invites a new uploader to the package.
156153
Future<api.InviteStatus> invitePackageUploader({
157154
required AuthenticatedAgent agent,
158-
required User activeUser,
159155
required String packageName,
160156
required String uploaderEmail,
161157
}) async {
162158
return await _invite(
163159
activeAgent: agent,
164-
activeUser: activeUser,
165160
email: uploaderEmail,
166161
kind: ConsentKind.packageUploader,
167162
args: [packageName],
@@ -182,7 +177,6 @@ class ConsentBackend {
182177
final user = authenticatedUser.user;
183178
return await _invite(
184179
activeAgent: authenticatedUser,
185-
activeUser: user,
186180
email: contactEmail,
187181
kind: ConsentKind.publisherContact,
188182
args: [publisherId, contactEmail],
@@ -194,13 +188,11 @@ class ConsentBackend {
194188
/// Invites a new member for the publisher.
195189
Future<api.InviteStatus> invitePublisherMember({
196190
required AuthenticatedAgent authenticatedAgent,
197-
required User activeUser,
198191
required String publisherId,
199192
required String invitedUserEmail,
200193
}) async {
201194
return await _invite(
202195
activeAgent: authenticatedAgent,
203-
activeUser: activeUser,
204196
email: invitedUserEmail,
205197
kind: ConsentKind.publisherMember,
206198
args: [publisherId],
@@ -328,7 +320,6 @@ class _PackageUploaderAction extends ConsentAction {
328320
@override
329321
Future<void> onAccept(Consent consent) async {
330322
final packageName = consent.args![0];
331-
final createdBySiteAdmin = consent.createdBySiteAdmin ?? false;
332323
final currentUser = await requireAuthenticatedWebUser();
333324
if (currentUser.email?.toLowerCase() != consent.email?.toLowerCase()) {
334325
throw NotAcceptableException(
@@ -339,7 +330,6 @@ class _PackageUploaderAction extends ConsentAction {
339330
packageName,
340331
currentUser.user,
341332
consentRequestFromAgent: consent.fromAgent!,
342-
consentRequestCreatedBySiteAdmin: createdBySiteAdmin,
343333
);
344334
}
345335

@@ -405,7 +395,6 @@ class _PublisherContactAction extends ConsentAction {
405395
publisherId,
406396
contactEmail,
407397
consentRequestFromAgent: consent.fromAgent!,
408-
consentRequestCreatedBySiteAdmin: consent.createdBySiteAdmin ?? false,
409398
);
410399
}
411400

@@ -485,7 +474,6 @@ class _PublisherMemberAction extends ConsentAction {
485474
publisherId,
486475
currentUser.userId,
487476
consentRequestFromAgent: consent.fromAgent!,
488-
consentRequestCreatedBySiteAdmin: consent.createdBySiteAdmin ?? false,
489477
);
490478
}
491479

0 commit comments

Comments
 (0)