Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Ginovski created an issue. See original summary.

Ginovski’s picture

Adding schema for the views plugin in datetime module, not sure if it is correctly defined with the config inheritance.

mpdonadio’s picture

Status: Active » Needs review
Issue tags: +VDC

Little confused why this wasn't caught when the strict config checking got enabled.

mpdonadio’s picture

Status: Needs review » Needs work
Berdir’s picture

> Little confused why this wasn't caught when the strict config checking got enabled.

Me too.

We noticed this in a custom install profile, where we run config schema validation on all our default configuration.

I think this kind of works because views has wildcard schema definitions for most of its things, for example this:

views.sort.*:
  type: views_sort
  label: 'Default sort'

So it works as long as you don't add special settings keys.

In our case it failed because of the missing schema for the granularity setting in the sort plugin.

The test fails are because the type definition is wrong in the current patch, we're working on that.

Ginovski’s picture

Assigned: Unassigned » Ginovski
Status: Needs work » Needs review
FileSize
941 bytes

Fixing schema

Ginovski’s picture

Ginovski’s picture

Fixed date filter in the views schema and added it properly in the datetime module.

The last submitted patch, 7: datetime_module_missing-2895544-7-test-only.patch, failed testing. View results

dawehner’s picture

Status: Needs review » Needs work
+++ b/core/modules/datetime/config/schema/datetime.views.schema.yml
@@ -0,0 +1,32 @@
+views.argument.datetime_year:
+  type: views.argument.date_year

I am not 100% convinced of these changes: \Drupal\datetime\Plugin\views\argument\YearDate extends \Drupal\datetime\Plugin\views\Argument\Date and not \Drupal\views\Plugin\views\argument\YearDate

Ginovski’s picture

Changed the type of the views arguments.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

jhedstrom’s picture

Assigned: Ginovski » dawehner

Assigning to @dawehner for final review. I think these look good at this point.

Lendude’s picture

+++ b/core/modules/datetime/tests/modules/datetime_test/test_views/views.view.test_sort_datetime.yml
@@ -33,6 +33,7 @@ display:
+          granularity: second

This is fairly minimal test coverage, somebody could remove this and everything would still be green and we'd have no indication that we lost coverage.
Would probably be a good idea to have a test that verifies that this granularity is set, that way we'd have a failing test if somebody removed the setting from the view.

Also it only 'tests' the sort schema, not sure what type of coverage is expected for the other schema.

jhedstrom’s picture

Assigned: dawehner » Unassigned
Status: Needs review » Needs work
Issue tags: +Needs tests

I agree with @Lendude's assessment of the fragility of this test, so marking NW to work for #14.

jhedstrom’s picture

Just marked #2721339: Missing schema for field_date_value as a duplicate. There was the start of some more explicit tests there.

mpdonadio’s picture

Status: Needs work » Needs review
FileSize
4.12 KB
2.02 KB

I started a test, but I can't get one to fail..

Lendude’s picture

The last submitted patch, 18: 2895544-18-TEST_ONLY.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

jhedstrom’s picture

Status: Needs review » Reviewed & tested by the community

I think this is good to go.

xjm’s picture

Priority: Normal » Major
larowlan’s picture

Adding review credits

larowlan’s picture

Version: 8.5.x-dev » 8.4.x-dev

Fixed on commit

diff --git a/core/modules/datetime/tests/src/Kernel/Views/DateTimeSchemaTest.php b/core/modules/datetime/tests/src/Kernel/Views/DateTimeSchemaTest.php
index 7641c33..f763c49 100644
--- a/core/modules/datetime/tests/src/Kernel/Views/DateTimeSchemaTest.php
+++ b/core/modules/datetime/tests/src/Kernel/Views/DateTimeSchemaTest.php
@@ -17,7 +17,7 @@ class DateTimeSchemaTest extends DateTimeHandlerTestBase {
   /**
    * {@inheritdoc}
    */
-  public static $testViews = ['test_argument_datetime','test_filter_datetime', 'test_sort_datetime'];
+  public static $testViews = ['test_argument_datetime', 'test_filter_datetime', 'test_sort_datetime'];
 
   /**
    * Test argument plugin schema.

Committed 93045af and pushed to 8.5.x.

Leaving at RTBC and moving to 8.4 for possible backport.

  • larowlan committed 93045af on 8.5.x
    Issue #2895544 by Ginovski, Lendude, mpdonadio, jhedstrom, Berdir,...
mpdonadio’s picture

$ git pull
$ git checkout 8.4.x
$ git cherry-pick 93045af
$ git diff origin/8.4.x > 2895544-26.patch

Just uploading this so we have runs against 8.4.x

This is currently a major bug with a clean cherry-pick, so I think this should be good against 8.4.x. I can't think of a potential disruption?

xjm’s picture

So if someone somehow had a view that had these saved in a different format than what the schema requires, or a child instance that didn't comply with the new schemata, what would happen?

xjm credited kgoel.

xjm’s picture

Adding credit for @kgoel who worked on the duplicate. (It's helpful when closing duplicates to add a list of contributors from the duplicate to the summary so committers can credit them too.) Thanks!

xjm’s picture

What is the case for backporting it? That it's needed for the other major bugfixes like #2786577: The Views integration Datetime Range fields should extend the views integration for regular Datetime fields?

Gábor Hojtsy’s picture

So if someone somehow had a view that had these saved in a different format than what the schema requires, or a child instance that didn't comply with the new schemata, what would happen?

I *think* it would be casted on the next save / import, but if directly validated, it will not be valid anymore. Would be good to verify though.

xjm’s picture

Status: Reviewed & tested by the community » Needs review
Issue tags: +Needs manual testing, +Needs change record

Let's manually test for #31 before we backport this, to see what happens and evaluate the risk. Depending on what happens we might also consider an upgrade path?

Also probably should have a CR, and ideally the CR would include information on the impact for existing data as well.

Thanks!

andrewbelcher’s picture

Case for backporting is that is causes contrib/end product config schema tests to fail, e.g. granularity on a datetime sort. Sticking with failing tests, removing test coverage or having to patch core until 8.5.0 is not a good alternative.

jhedstrom’s picture

I'm fine with backporting if somebody can verify #31 manually as @xjm requested in #32.

Berdir’s picture

Version: 8.4.x-dev » 8.5.x-dev
Status: Needs review » Fixed
Issue tags: -Needs manual testing, -Needs change record

Only critical fixes will be backported to 8.4.x anymore, so closing this and setting back to 8.5.x.

I could not find any existing change records for similar changes in the past, IMHO this doesn't need one. We didn't *change* the schema, we added missing schema. Anyone we already validates his schema would have had fails before no matter what type they were.

Feel free to re-open if you disagree but nothing happened in 2 month here so I doubt it will if we re-open.

Status: Fixed » Closed (fixed)

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