- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Thanks, @meghasharma, for getting this going! :)
-
wim leers โ
committed 8ade7ebe on 0.x authored by
meghasharma โ
Issue #3525759 by wim leers, meghasharma, larowlan:...
-
wim leers โ
committed 8ade7ebe on 0.x authored by
meghasharma โ
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
๐ค I think it can still be wrong.
Because
\Drupal\experience_builder\ComponentSource\ComponentSourceBase::generateVersionHash()
looks at$normalized_data = [ 'settings' => $typed_source_specific_settings->toArray(), 'slot_definitions' => $this instanceof ComponentSourceWithSlotsInterface ? self::normalizeSlotDefinitions($this->getSlotDefinitions()) : [], 'schema' => $this->getExplicitInputDefinitions(), ];
There's nothing preventing
$typed_source_specific_settings
to contain too much data โ that'd just end up being hashed along with it; still resulting in a predictable version โฆ just one based on mismatched settings.In fact,
\Drupal\Tests\experience_builder\Kernel\Config\ComponentValidationTest::setUp()
proves that this is still the case. - ๐ฆ๐บAustralia larowlan ๐ฆ๐บ๐.au GMT+10
I think is probably moot post ๐ Deterministic Component version hash should depend not only on source-specific settings, but also slots + explicit input schema Active as the validation won't pass because the version doesn't match?
-
wim leers โ
committed 7c299d95 on 0.x authored by
larowlan โ
Issue #3526127 by larowlan, wim leers: Ensure deterministic config...
-
wim leers โ
committed 7c299d95 on 0.x authored by
larowlan โ
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Per @larowlan at ๐ [SPIKE] Prove that it's possible to apply block settings update paths to stored XB component trees Active , this MR blocks that one.
-
wim leers โ
committed 1911c983 on 0.x authored by
larowlan โ
Issue #3528362 by larowlan, wim leers: Deterministic Component version...
-
wim leers โ
committed 1911c983 on 0.x authored by
larowlan โ
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Updated
/admin/appearance/component
to show the number of versions of each component, and shows the active version upon hover. - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Thanks, @larowlan, for pushing this to completion! All I had to do here was fix nits, and add docs for the tricky bits ๐
Issue summary updated.
- First commit to issue fork.
- ๐ฆ๐บAustralia larowlan ๐ฆ๐บ๐.au GMT+10
This should be ready for review ๐ค
- @larowlan opened merge request.
- ๐ฆ๐บAustralia larowlan ๐ฆ๐บ๐.au GMT+10
Picking up where Wim left off.
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
@larowlan mentioned he wasn't happy with one area. I investigated and implemented a counterproposal.
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
AFAICT this also blocks #3519878 now, see #3519878-22: [PP-1] ContentCreatorVisibleXbConfigEntityAccessControlHandler's `view` access must refuse access to disabled config entities โ . IOW: I think/hope that once this is fixed, the remaining test failures there will disappear.
The test coverage here is definitely sufficient, so removing tag.
P.S.: This removed a few
@todo
s pointing to ๐ SdcPropKeysConstraintValidator::validate() should complain about extraneous keys too, not just missing keys Active , because those bits were getting in the way of getting this MR to pass. This is critical for data model stability, so this takes precedence. - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
- ๐ฆ๐บAustralia larowlan ๐ฆ๐บ๐.au GMT+10
Got something going that uses the schema, but I'm not 100% happy with it.
I think its probably ok, but there's a chicken-egg scenario with creating a version string vs having a component typed data adapter that prevents using being able to use\Drupal\Core\Config\Schema\TypeResolver::resolveDynamicTypeName
The workaround seems ok, but is not ideal.
- ๐ฆ๐บAustralia acbramley
Squashed and rebased this branch since it wasn't rebasing cleanly.
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
๐ฅณ
BTW, ๐ Constraint slot names allowed by XB in its component tree Active added a todo pointing here โ this MR should be able to drop those lines.
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
#6: gave this some more thought.
Youโre right that itโs impossible to validate old versions (any besides the active one) if they depend on data not contained within the config entity.
So โฆ I think the solution is actually very simple, plus it would prevent brittleness in the future: only validate
active_version
!That way, even if a
ComponentSource
plugin changes what information is used to deterministically compute the hash, old versions (hashes) continue to work fine. Because in the proposal I made in the issue summary, any such logic change would have caused all old versions (hashes) to become invalid ๐And that is actually perfectly in line with the source-specific settings for old (non-active) versions: those already use
type: ignore
because the config schema for older versions might have been different. What weโre dealing with here is similar. - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Didn't get to reviewing this today :/