Repository navigation
Fix project file writing, KCL generation determinism, and incomplete schema generation - #542
Conversation
The zero metadata.creationTimestamp marshals as an explicit null, so every dependency add or composition generate rewrote the project file with a creationTimestamp: null line. Signed-off-by: Christopher Haar <christopher.haar@upbound.io>
The import statements were built by ranging over a map, so the order of imports in a generated function's main.k varied between runs. Signed-off-by: Christopher Haar <christopher.haar@upbound.io>
function-kcl v0.12.1 returns duplicate composed resources when the composition function is invoked with observed resources, failing with 'multiple composed resources with name ... returned'. v0.12.3 behaves correctly. Signed-off-by: Christopher Haar <christopher.haar@upbound.io>
update-cache regenerated schemas for dependencies but not for the project's own APIs, which were only generated during build. Language tooling that imports the project's XRD models (functions, tests, editors) therefore saw incomplete models after update-cache - e.g. go mod tidy in an embedded function failed before the first build. Signed-off-by: Christopher Haar <christopher.haar@upbound.io>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 39 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codecov Report❌ Patch coverage is 🚀 New features to boost your workflow:
|
| return errors.Wrap(err, "failed to marshal project") | ||
| } | ||
| bs = stripNullCreationTimestamp(bs) | ||
| return afero.WriteFile(projFS, projFile, bs, 0o644) |
There was a problem hiding this comment.
While we're here, should we also avoid no-op writes, so that we can preserve users comments and manual edits (e.g., field reordering) in more cases? In up we marshal before and after the update and write only if the yaml has changed.
There was a problem hiding this comment.
Let me open an followup for this
Description of your changes
Four small, independent fixes in the project tooling:
Fixes #
I have:
./nix.sh flake checkto ensure this PR is ready for review.backport release-x.ylabels to auto-backport this PR.Need help with this checklist? See the cheat sheet.
Validation
Unit tests for the import ordering and project file writing; the function-kcl and update-cache changes verified end-to-end against a project with an XRD and an embedded KCL function (render with observed resources, go mod tidy after update-cache alone).