Problem/Motivation

We have 140+ default/test views in core with configurations created by UI/hand. Over this period, we have made few changes in plugins, configuration keys etc. So not all views configuration in same state.

Here is the list of views in core.

Location view config file
core/modules/action/tests/action_bulk_test/config/install views.view.test_bulk_form.yml
core/modules/aggregator/config/install views.view.aggregator_rss_feed.yml
core/modules/aggregator/tests/modules/aggregator_test_views/test_views views.view.test_aggregator_items.yml
core/modules/block/tests/modules/block_test_views/test_views views.view.test_view_block.yml
views.view.test_view_block2.yml
core/modules/comment/config/install views.view.comments_recent.yml
core/modules/comment/tests/modules/comment_test_views/test_views views.view.test_comment_row.yml
views.view.test_comment_rss.yml
views.view.test_comment_user_uid.yml
core/modules/contact/tests/modules/contact_test_views/test_views views.view.test_contact_link.yml
core/modules/content_translation/tests/modules/content_translation_test_views/test_views views.view.test_entity_translations_link.yml
core/modules/dblog/tests/modules/dblog_test_views/test_views views.view.test_dblog.yml
core/modules/entity_reference/tests/modules/entity_reference_test/config/install views.view.test_entity_reference.yml
core/modules/entity_reference/tests/modules/entity_reference_test_views/test_views views.view.test_entity_reference_view.yml
core/modules/field/tests/modules/field_test_views/test_views views.view.test_view_fieldapi.yml
core/modules/file/config/install views.view.files.yml
core/modules/file/tests/modules/file_test_views/test_views views.view.file_extension_view.yml
core/modules/forum/tests/modules/forum_test_views/test_views views.view.test_forum_index.yml
core/modules/node/config/install views.view.archive.yml
views.view.content.yml
views.view.content_recent.yml
views.view.frontpage.yml
views.view.glossary.yml
core/modules/node/tests/modules/node_test_views/test_views views.view.test_contextual_links.yml
views.view.test_field_type.yml
views.view.test_filter_node_uid_revision.yml
views.view.test_language.yml
views.view.test_node_bulk_form.yml
views.view.test_node_revision_nid.yml
views.view.test_node_revision_vid.yml
views.view.test_node_row_plugin.yml
views.view.test_node_view.yml
views.view.test_status_extra.yml
core/modules/rest/tests/modules/rest_test_views/test_views views.view.test_serializer_display_entity.yml
views.view.test_serializer_display_field.yml
views.view.test_serializer_node_display_field.yml
core/modules/statistics/tests/modules/statistics_test_views/test_views views.view.test_statistics_integration.yml
core/modules/taxonomy/config/install views.view.taxonomy_term.yml
core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views views.view.test_filter_taxonomy_index_tid.yml
views.view.test_groupwise_term.yml
views.view.test_taxonomy_node_term_data.yml
views.view.test_taxonomy_parent.yml
core/modules/tracker/tests/modules/tracker_test_views/test_views views.view.test_tracker_user_uid.yml
core/modules/user/config/install views.view.user_admin_people.yml
views.view.who_s_new.yml
views.view.who_s_online.yml
core/modules/user/tests/modules/user_test_views/test_views views.view.test_access_perm.yml
views.view.test_access_role.yml
views.view.test_field_permission.yml
views.view.test_filter_permission.yml
views.view.test_groupwise_user.yml
views.view.test_plugin_argument_default_current_user.yml
views.view.test_user_bulk_form.yml
views.view.test_user_data.yml
views.view.test_user_name.yml
views.view.test_user_relationship.yml
views.view.test_user_uid_argument.yml
views.view.test_view_argument_validate_user.yml
views.view.test_view_argument_validate_username.yml
views.view.test_views_handler_field_role.yml
views.view.test_views_handler_field_user_name.yml
core/modules/views/tests/modules/views_test_config/test_views views.view.test_access_none.yml
views.view.test_aggregate_count.yml
views.view.test_ajax_view.yml
views.view.test_alias.yml
views.view.test_area_title.yml
views.view.test_area_view.yml
views.view.test_argument_date.yml
views.view.test_argument_default_current_user.yml
views.view.test_argument_default_fixed.yml
views.view.test_attachment_ui.yml
views.view.test_cache.yml
views.view.test_click_sort.yml
views.view.test_destroy.yml
views.view.test_display.yml
views.view.test_display_attachment.yml
views.view.test_display_defaults.yml
views.view.test_display_empty.yml
views.view.test_display_feed.yml
views.view.test_display_invalid.yml
views.view.test_display_more.yml
views.view.test_dropbutton.yml
views.view.test_entity_area.yml
views.view.test_entity_row.yml
views.view.test_entity_row_renderers.yml
views.view.test_entity_type_filter.yml
views.view.test_example_area.yml
views.view.test_executable_displays.yml
views.view.test_exposed_admin_ui.yml
views.view.test_exposed_block.yml
views.view.test_exposed_form.yml
views.view.test_exposed_form_buttons.yml
views.view.test_field_classes.yml
views.view.test_field_get_entity.yml
views.view.test_field_output.yml
views.view.test_field_tokens.yml
views.view.test_filter.yml
views.view.test_filter_date_between.yml
views.view.test_filter_group_override.yml
views.view.test_filter_groups.yml
views.view.test_filter_in_operator_ui.yml
views.view.test_get_attach_displays.yml
views.view.test_glossary.yml
views.view.test_grid.yml
views.view.test_group_by_count.yml
views.view.test_group_by_in_filters.yml
views.view.test_handler_relationships.yml
views.view.test_handler_test_access.yml
views.view.test_history.yml
views.view.test_http_status_code.yml
views.view.test_mini_pager.yml
views.view.test_page_display.yml
views.view.test_page_display_arguments.yml
views.view.test_page_display_menu.yml
views.view.test_page_display_route.yml
views.view.test_page_view.yml
views.view.test_pager_full.yml
views.view.test_pager_none.yml
views.view.test_pager_some.yml
views.view.test_preview.yml
views.view.test_redirect_view.yml
views.view.test_search.yml
views.view.test_simple_argument.yml
views.view.test_store_pager_settings.yml
views.view.test_style_mapping.yml
views.view.test_style_opml.yml
views.view.test_table.yml
views.view.test_tag_cache.yml
views.view.test_tokens.yml
views.view.test_view.yml
views.view.test_view_argument_validate_numeric.yml
views.view.test_view_argument_validate_php.yml
views.view.test_view_broken.yml
views.view.test_view_delete.yml
views.view.test_view_display_template.yml
views.view.test_view_empty.yml
views.view.test_view_handler_weight.yml
views.view.test_view_pager_full_zero_items_per_page.yml
views.view.test_view_render.yml
views.view.test_view_status.yml
views.view.test_view_storage.yml
views.view.test_views_groupby_save.yml
core/modules/views/tests/modules/views_test_data/test_views views.view.test_access_static.yml

Proposed resolution

Revisit all views and make sure auto generated with latest config/plugin changes. It might not be applicable for test views in views module.

Remaining tasks

Discuss and make sure it is necessary.
Issue patch
Test.

User interface changes

N/A

API changes

N/A

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

vijaycs85’s picture

Status: Active » Postponed
Issue tags: +revisit before release
Related issues: +#2313159: [meta] Make multilingual views work
dawehner’s picture

Well, just like all config shipped with core modules, views also has to regularly be resaved based upon core/its modules changes.
It almost feels like we would need a recurring issue for that :)

In general for tests I would like to stay away from requiring a full blown export as otherwise writing tests will be impossible,
given that you'd need to get it working in the actual UI.

dawehner’s picture

So +1 for suggesting to rexport the default ones again.

Gábor Hojtsy’s picture

vijaycs85’s picture

In general for tests I would like to stay away from requiring a full blown export as otherwise writing tests will be impossible,
given that you'd need to get it working in the actual UI.

Agreed. but we need to make sure the test configs are excluded for config schema or properly hand written, so won't throw any error on config schema.

dawehner’s picture

In general for tests I would like to stay away from requiring a full blown export as otherwise writing tests will be impossible,
given that you'd need to get it working in the actual UI.

On top of that I also hat that all codes implicit assumes that all config is set always. This feels more like a implementation detail of the config system in an abstract way.

Gábor Hojtsy’s picture

Well, in fact config schemas don't assume completeness, the validation just validates the keys that are there are according to their type definition. That is why regenerating test/default config based on the schema and diffing that with their current core state would help spot both outdated config and missing schemas. (ie. to remove items that are not in schema and compare with the starting point).

vijaycs85’s picture

Status: Postponed » Active

as we are in beta stage, I guess we can fix this one as it can solve lots of other config schema issues like #2325269: Test and fix views in test_views directories against their configuration schema

alexpott’s picture

Status: Active » Postponed

Promoting this to critical since it blocks #2325269: Test and fix views in test_views directories against their configuration schema and ensuring views comply with schema allows them to be translated. Postponing on #2267453: Views plugins do not store additional dependencies since that issue will change all views to expose their dependencies.

alexpott’s picture

tim.plunkett’s picture

Priority: Normal » Critical

Per #9

catch’s picture

Status: Postponed » Active
Wim Leers’s picture

Title: Revisit all build-in test/default views configuration in core » Revisit all built-in test/default views configuration in core
Berdir’s picture

Status: Active » Needs review
FileSize
99.58 KB

Did not see a quicker way to do this than manually import all views if necessary (test_views directory) and then update using full or single export.

All modules up until statistics, including test views updated. Will continue another time.

dawehner’s picture

Thank you, quite some work!

There are confusing things in there:

Why should we have to add a new field?

--- a/core/modules/node/config/install/views.view.content_recent.yml
+++ b/core/modules/node/config/install/views.view.content_recent.yml
@@ -24,9 +24,11 @@ display:
         type: perm
         options:
           perm: 'access content'
+        provider: user
       cache:
         type: none
         options: {  }
+        provider: views
       query:
         type: views_query
         options:
@@ -35,6 +37,7 @@ display:
           replica: false
           query_comment: false
           query_tags: {  }
+        provider: views
       exposed_form:
         type: basic
         options:
@@ -45,11 +48,13 @@ display:
           expose_sort_order: true
           sort_asc_label: Asc
           sort_desc_label: Desc
+        provider: views
       pager:
         type: some
         options:
           items_per_page: 10
           offset: 0
+        provider: views
       style:
         type: table
         options:
@@ -105,8 +110,10 @@ display:
               responsive: ''
           default: '-1'
           empty_table: false
+        provider: views
       row:
         type: fields
+        provider: views
       fields:
         title:
           id: title
@@ -158,6 +165,59 @@ display:
           hide_alter_empty: true
           link_to_node: true
           plugin_id: node
+          provider: node
+        timestamp:
+          id: timestamp
+          table: history
+          field: timestamp
+          relationship: none
+          group_type: group
+          admin_label: ''
+          label: ''
+          exclude: false
+          alter:
+            alter_text: false
+            text: ''
+            make_link: false
+            path: ''
+            absolute: false
+            external: false
+            replace_spaces: false
+            path_case: none
+            trim_whitespace: false
+            alt: ''
+            rel: ''
+            link_class: ''
+            prefix: ''
+            suffix: ''
+            target: ''
+            nl2br: false
+            max_length: ''
+            word_boundary: true
+            ellipsis: true
+            more_link: false
+            more_link_text: ''
+            more_link_path: ''
+            strip_tags: false
+            trim: false
+            preserve_tags: ''
+            html: false
+          element_type: ''
+          element_class: ''
+          element_label_type: ''
+          element_label_class: ''
+          element_label_colon: false
+          element_wrapper_type: ''
+          element_wrapper_class: ''
+          element_default_classes: true
+          empty: ''
+          hide_empty: false
+          empty_zero: false
+          hide_alter_empty: true
+          link_to_node: false
+          comments: false
+          plugin_id: history_user_timestamp
+          provider: history
         name:

Status: Needs review » Needs work

The last submitted patch, 14: resaved_views-2345725-14.patch, failed testing.

alexpott’s picture

Status: Needs work » Needs review
FileSize
308.62 KB

I've got a script to do this - https://gist.github.com/alexpott/f0650fbb7954df8497e4 (this script is built to do this for any config entity type - its to be run using drush scr)

The script fixes all the files and outputs:

Saving views.view.test_exposed_form has generated the following exception: The "test_exposed_form" plugin does not exist.
Saving views.view.test_view_argument_validate_php has generated the following exception: The "php" plugin does not exist.

Neither of these appear to be used to removing.

Status: Needs review » Needs work

The last submitted patch, 17: 2316909.17.patch, failed testing.

Berdir’s picture

Nice, that is a lot easier than what I did ;)

I checked the difference of our two patches and they are quite different. Take the mentioned content_recent above, your patch only removes a single dependency there and does not add the provider lines, for example? That said, I have no idea why mine would add that field, I don't think I made any manual changes...

Wondering if that is because you have different modules installed, so the schema is not present?

alexpott’s picture

The provider key should have been removed by #2267453: Views plugins do not store additional dependencies it looks like you weren't running with that patch - since that would also account for the dependency removals in your patch.

Status: Needs work » Needs review

alexpott queued 17: 2316909.17.patch for re-testing.

Status: Needs review » Needs work

The last submitted patch, 17: 2316909.17.patch, failed testing.

Berdir’s picture

Status: Needs work » Needs review
FileSize
317.48 KB
1.34 KB

Yeah, I messed up.

The test fails are because the display order changed, @alexpott mentioned that there is an issue to make that more reliable, for now, changed the tests to sort explicitly.

vijaycs85’s picture

Thanks @alexpott for the nice script. One thing I noticed in the config is every time we generate config, the order of elements get shuffled. Though it doesn't matter as it is yaml file, it can make the config reviews so hard. Is there any issue to fix the order? otherwise, we should raise one.
Update: raised #2378503: Save configuration in a consistent order

vijaycs85’s picture

Issue summary: View changes
dawehner’s picture

@vijaycs85
That sorting everytime you safe is fixed in #2350821: Sort views displays by display name ... its freaking annoying if you actually build a site.

vijaycs85’s picture

@dawehner, good point. Though I agree that the special treatment for displays is necessary(default, block, page, others), Do you think it can/should be done by a separate element (say weight field), so that the overall config can still stay in a generic order?

alexpott’s picture

Status: Needs review » Postponed
Related issues: +#2350821: Sort views displays by display name
alexpott’s picture

Status: Postponed » Needs review
FileSize
303.03 KB

New patch now that #2350821: Sort views displays by display name has landed. The tests that failed #17 pass without the fixes from #23.

vijaycs85’s picture

I guess, reviewing a configuration update patch generating by a script == reviewing a feature updated patch in drupal 7. i.e. there *can not* be anything wrong in the generated code, until there is nothing wrong in the generated script. So definitely this is RTBC.

However it is also important to get the script reviewed and *may be* make it as part of core before we get this patch in.

dawehner’s picture

Came up with a bunch of things I saw in the rexport, read through the full patch, sorry alex ...
Issues which cleary have been a schema bug, got reported on https://www.drupal.org/node/2380457

Other questions are attached onto this issue:

--- a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_contextual_links.yml
+          total_pages: null

Mh, this is an integer, are we sure NULL is a proper value? I would argue that the proper value should rather be 0?

+++ b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_field_permission.yml
+label: null

Mh, null instead of an empty string? This is odd, given that the schema looks correct.

+++ b/core/modules/user/tests/modules/user_test_views/test_views/views.view.test_views_handler_field_role.yml
+          items_per_page: null

Can we do something about those things?

+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_argument_date.yml
+    position: null

This is defined as integer, mhh

+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_click_sort.yml
+label: {  }

OH

DONE, this is not the first time I will dream views exports :p

Gábor Hojtsy’s picture

Some test views are missing plugin_id elements and views schemas are very much centered around wiring the definitions together with the plugin_id. #2379683: Fix configuration schema issues in contact (indirectly user and system) modules adds plugin_ids for a test view which fails in those tests. As we add more tests, we'll find more of these but looks like this script does not identify / rectify those. Not sure if that is realistic to expect from this script though. For illustration of how much views relies on plugin_id:

core/modules/views/config/schema/views.data_types.schema.yml:        - type: views.field.[plugin_id]
core/modules/views/config/schema/views.data_types.schema.yml:        - type: views.area.[plugin_id]
core/modules/views/config/schema/views.data_types.schema.yml:        - type: views.sort.[plugin_id]
core/modules/views/config/schema/views.data_types.schema.yml:        - type: views.argument.[plugin_id]
core/modules/views/config/schema/views.data_types.schema.yml:        - type: views.filter.[plugin_id]
core/modules/views/config/schema/views.data_types.schema.yml:        - type: views.relationship.[plugin_id]
core/modules/views/config/schema/views.data_types.schema.yml:      - type: views.area.[plugin_id]
core/modules/views/config/schema/views.data_types.schema.yml:      - type: views.area.[plugin_id]
core/modules/views/config/schema/views.data_types.schema.yml:      type: views.sort_expose.[%parent.plugin_id]
core/modules/views/config/schema/views.data_types.schema.yml:      type: views.filter_value.[%parent.plugin_id]
core/modules/views/config/schema/views.data_types.schema.yml:          type: views.filter.group_items.[plugin_id]
Berdir’s picture

@dawehner: null is afaik always a valid value.

Should we postpone this again on the schema fixes in #2380457: Some fixes of the views config schema ? Otherwise we have to do it again after we changed it.

Berdir’s picture

FileSize
309.52 KB

Another angle at "reviewing" this, I combined this patch with #2325269: Test and fix views in test_views directories against their configuration schema, and the amount of errors when from 1214 to 191, so this certainly helps, but still quite a few errors. Attaching the patch, so we can see the remaining errors, maybe we can also fix them in #2380457: Some fixes of the views config schema or yet another issue, but again, the re-save only really makes sense once the schema is (mostly) correct...

On the other side, I suspect that quite a few of the remaining problems is left-over stuff, that should be removed, which in turn is only useful *after* this :)

Status: Needs review » Needs work

The last submitted patch, 34: 2316909-2.29-combined.patch, failed testing.

alexpott’s picture

I think there is value in committing #29 and then working on the other issues and then doing it again - now we have https://gist.github.com/alexpott/f0650fbb7954df8497e4 this does not take long. It'll massively reduce the noise in other views schema issues.

Gábor Hojtsy’s picture

Status: Needs work » Reviewed & tested by the community

I agree this would massively reduce the noise as demonstrated by Berdir. Let's commit #29.

catch’s picture

Status: Reviewed & tested by the community » Fixed

Yes removing noise is good. Let's do this now, then again when it's useful.

  • catch committed 6714300 on 8.0.x
    Issue #2316909 by Berdir, alexpott: Revisit all built-in test/default...
vijaycs85’s picture

yay! thanks all. We might need to run this again once after fixed all open config schema issues (like #2380457: Some fixes of the views config schema).

xjm’s picture

Issue tags: -revisit before release +revisit before release candidate

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

alexpott’s picture

Issue tags: -revisit before release candidate
Related issues: +#2567183: Re-export all built-in configuration in core