Skip to content

Conversation

@618coffee
Copy link
Contributor

Issue #, if available:

Description of changes:
the log is printed out too often even query is not called

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@codecov
Copy link

codecov bot commented Dec 10, 2020

Codecov Report

Merging #957 (8b99d48) into main (6fb4841) will increase coverage by 0.00%.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #957   +/-   ##
=======================================
  Coverage   70.39%   70.40%           
=======================================
  Files         920      920           
  Lines       39049    39048    -1     
=======================================
  Hits        27490    27490           
+ Misses      11559    11558    -1     
Flag Coverage Δ
API_plugin_unit_test 64.16% <ø> (+0.07%) ⬆️
Analytics_plugin_unit_test 72.38% <ø> (ø)
Auth_plugin_unit_test 75.13% <ø> (ø)
DataStore_plugin_unit_test 83.69% <ø> (ø)
Predictions_plugin_unit_test 50.43% <ø> (ø)
Storage_plugin_unit_test 74.74% <ø> (ø)
build_test_amplify 62.37% <ø> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
Amplify/Categories/DataStore/Query/ModelKey.swift 22.44% <ø> (+0.44%) ⬆️
...ugins/AWSHubPlugin/Internal/SerialDispatcher.swift 82.35% <0.00%> (-5.89%) ⬇️
Amplify/Categories/Hub/HubFilter.swift 52.63% <0.00%> (-5.27%) ⬇️
...Hub/DefaultPluginTests/DefaultHubPluginTests.swift 87.20% <0.00%> (-1.17%) ⬇️
...CategoryPlugin/Operation/AWSGraphQLOperation.swift 63.29% <0.00%> (+2.53%) ⬆️
...s/AWSHubPlugin/Internal/HubChannelDispatcher.swift 97.05% <0.00%> (+2.94%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6fb4841...8b99d48. Read the comment docs.


var columnName: String {
guard let modelSchema: ModelSchema = ModelRegistry.modelSchema(from: modelName) else {
log.warn("Please upgrade to the latest version of Amplify CLI and rerun `amplify codegen models`")
Copy link
Member

Choose a reason for hiding this comment

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

Why is removing the message the right thing here? What should a customer do to fix this if not upgrade & regen models?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The message is printed out too often even you don't explicitly call DataStore.query().

For example:
During Amplify.DataStore.start(), clearStateOutgoingMutations will be called, it creates a predicate which accesses columnName, but MutationEvent is not in ModelRegistry so that it fails the guard comment and print out the warning message.

func clearStateOutgoingMutations(completion: @escaping BasicClosure) {
        let fields = MutationEvent.keys
        let predicate = fields.inProcess == true
        let sort = QuerySortDescriptor(fieldName: fields.createdAt.stringValue, order: .ascending)
        storageAdapter.query(MutationEvent.self,
                             predicate: predicate,
                             sort: [sort],
                             paginationInput: nil) { result in
                                switch result {
                                case .failure(let dataStoreError):
                                    log.error("Failed on clearStateOutgoingMutations: \(dataStoreError)")
                                case .success(let mutationEvents):
                                    if !mutationEvents.isEmpty {
                                        updateMutationsState(mutationEvents: mutationEvents,
                                                             completion: completion)
                                    } else {
                                        completion()
                                    }
                                }
        }
    }

But like you said, the removal of message won't tell customer the fix unless they create a Github issue and we reply to tell them.

@618coffee
Copy link
Contributor Author

Closing because of a PR reverting the change: #963

@618coffee 618coffee closed this Dec 11, 2020
@palpatim palpatim deleted the fix/removecodingkeywarn branch March 11, 2021 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants