fix(apply): merge live plugin hints into forma schema before patch generation#431
Closed
JeroenSoeters wants to merge 1 commit into
Closed
fix(apply): merge live plugin hints into forma schema before patch generation#431JeroenSoeters wants to merge 1 commit into
JeroenSoeters wants to merge 1 commit into
Conversation
…neration Patch-time Schema.Hints come from whichever formae SDK version the client's PklProject pins, which may lag behind the SDK bundled with the running agent. Newly-added Hint paths on the agent side (e.g. a hasProviderDefault on a deep sub-resource field) were absent from the CLI-supplied schema, so the recursive provider-default stripper had nothing to walk and createOnly ancestors tripped spurious replacements on reapply. Only the Synchronizer refreshed schemas before patch generation, and sync-driven refreshes never fire for resources without drift — stored state stayed frozen at its creation-time SDK version indefinitely. Fetch the live per-resource-type Schema from the PluginCoordinator in ApplyForma, then merge its Hints into each forma resource before GenerateResourceUpdates runs. Hints are merged, not wholesale-replaced: live hints override on key collision; CLI-supplied hints the live schema doesn't know about are preserved. Fields, Identifier, Portable, and the rest of the Schema are untouched — those reflect the resource instance's property shape. Exercised by a new reconcile test that mirrors the ECS TaskDefinition Volumes.EFSVolumeConfiguration.RootDirectory shape: a CLI-supplied Schema missing a deep hasProviderDefault hint, a stored resource carrying the AWS-populated default, and a live plugin schema that has the hint. The resulting plan contains no replacement.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Schema.Hintsthe CLI baked into the forma at PKL eval time. Those hints come from the formae SDK version the client'sPklProjectpins, which may lag behind the SDK bundled with the running agent. Newly-added Hint paths on the agent side (e.g. ahasProviderDefaulton a deep sub-resource field, such as the one added in fix(pkl-schema): emit hints for fields under SubResources without a FieldHint #428 forVolumes.EFSVolumeConfiguration.RootDirectory) were absent from the CLI-supplied schema, so the recursive provider-default stripper had nothing to walk. Stored state carrying an AWS-populated default stayed untouched and acreateOnlyancestor tripped a full replacement on every reapply.Synchronizerrefreshed schemas before patch generation. Sync-driven refreshes only write a row when OOB drift is detected, so any resource whose cloud-side read equals its stored state never had its schema refreshed — storedSchema.Hintsstayed frozen at the SDK version in play when the resource was created.Schemafrom thePluginCoordinatorinApplyForma, then merge itsHintsinto each forma resource beforeGenerateResourceUpdatesruns. Hints are merged, not wholesale-replaced: live hints override on key collision; CLI-supplied hints the live schema doesn't know about are preserved.Fields,Identifier,Portable, and the rest of theSchemaare deliberately untouched — those reflect the resource instance's property shape (e.g. classifying properties as regular vs read-only) and must stay in the form the CLI produced.resource_update_generator_reconcile_test.gomirrors the ECSAWS::ECS::TaskDefinition.Volumes.EFSVolumeConfiguration.RootDirectoryshape: a CLI-supplied Schema missing the deephasProviderDefaulthint, a stored resource carrying the AWS-populated default, and a live plugin schema that has the hint. With the merge in place the stripper neutralizes the default symmetrically and no replacement is emitted.Synchronizer(already stamps fresh schemas inline upstream),Discovery,AutoReconciler,StackExpirer— passnilfor the new parameter.ApplyFormaandDestroyFormathread the fetched schemas throughFormaCommandFromForma.