-
Notifications
You must be signed in to change notification settings - Fork 166
Report unmapped fields in integrity checks + delete Package.isWithheld and withheldReason #8414
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
Changes from 1 commit
e3cbafb
a4e9087
9d9ae4a
383d78f
f4f2481
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,6 +40,11 @@ class IntegrityChecker { | |
| final DatastoreDB _db; | ||
| final int _concurrency; | ||
|
|
||
| static const _knownUnmappedFields = { | ||
|
||
| 'Package.isWithheld', | ||
| 'Package.withheldReason', | ||
| }; | ||
| final _unmappedFields = <String>{}; | ||
|
||
| final _userToOauth = <String, String?>{}; | ||
| final _oauthToUser = <String, String>{}; | ||
| final _deletedUsers = <String>{}; | ||
|
|
@@ -93,7 +98,13 @@ class IntegrityChecker { | |
| yield* _checkAuditLogs(); | ||
| yield* _checkModerationCases(); | ||
| yield* _reportPubspecVersionIssues(); | ||
| // TODO: report unmapped properties | ||
|
|
||
| if (_unmappedFields.isNotEmpty) { | ||
| for (final field in _unmappedFields) { | ||
| if (_knownUnmappedFields.contains(field)) continue; | ||
| yield 'Unmapped field found: $field.'; | ||
|
||
| } | ||
| } | ||
| } finally { | ||
| _httpClient.close(); | ||
| } | ||
|
|
@@ -448,6 +459,7 @@ class IntegrityChecker { | |
| } | ||
|
|
||
| await for (final pvi in pviQuery.run()) { | ||
| _updateUnmappedFields(pvi); | ||
| final key = pvi.qualifiedVersionKey; | ||
| pviKeys.add(key); | ||
| yield* checkPackageVersionKey('PackageVersionInfo', key); | ||
|
|
@@ -475,6 +487,7 @@ class IntegrityChecker { | |
| ..filter('package =', p.name); | ||
| final foundAssetIds = <String?>{}; | ||
| await for (final pva in pvaQuery.run()) { | ||
| _updateUnmappedFields(pva); | ||
| final key = pva.qualifiedVersionKey; | ||
| if (pva.id != | ||
| Uri(pathSegments: [pva.package!, pva.version!, pva.kind!]).path) { | ||
|
|
@@ -907,13 +920,23 @@ class IntegrityChecker { | |
| } | ||
| } | ||
|
|
||
| void _updateUnmappedFields(Model m) { | ||
| if (m is ExpandoModel && m.additionalProperties.isNotEmpty) { | ||
| for (final key in m.additionalProperties.keys) { | ||
| final field = [m.runtimeType.toString(), key].join('.'); | ||
| _unmappedFields.add(field); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| Stream<String> _queryWithPool<R extends Model>( | ||
| Stream<String> Function(R model) fn) async* { | ||
| final query = _db.query<R>(); | ||
| final pool = Pool(_concurrency); | ||
| final futures = <Future<List<String>>>[]; | ||
| try { | ||
| await for (final m in query.run()) { | ||
| _updateUnmappedFields(m); | ||
| final f = pool.withResource(() => fn(m).toList()); | ||
| futures.add(f); | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.