Skip to content

Fix project file writing, KCL generation determinism, and incomplete schema generation - #542

Open
haarchri wants to merge 4 commits into
crossplane:mainfrom
haarchri:fix/project-generation-fixes
Open

haarchri wants to merge 4 commits into
crossplane:mainfrom
haarchri:fix/project-generation-fixes

Conversation

@haarchri

Copy link
Copy Markdown
Member

Description of your changes

Four small, independent fixes in the project tooling:

  • Strip the null creationTimestamp when writing project files. The zero metadata.creationTimestamp marshals as an explicit null, so every dependency add or composition generate rewrote crossplane-project.yaml with a creationTimestamp: null line.
  • Sort generated KCL imports. function generate --language=kcl built the import list by ranging over a map, so the order of imports in a generated main.k differed between runs.
  • Bump the function-kcl base image to v0.12.3. v0.12.1 returns duplicate composed resources when a composition function is invoked with observed resources, failing with multiple composed resources with name ... returned. v0.12.3 behaves correctly.
  • Generate project API schemas during dependency update-cache. 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.

Fixes #

I have:

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).

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>
@haarchri
haarchri requested review from a team, jcogilvie and tampakrap as code owners November 18, 2026 13:50
@haarchri
haarchri requested review from phisco and removed request for a team November 18, 2026 13:50
@coderabbitai

coderabbitai Bot commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 3a126a7 and 9d2644a.

Files selected for processing: 4

  • cmd/crossplane/dependency/cache.go
  • cmd/crossplane/function/generate.go
  • internal/project/functions/kcl.go
  • internal/project/projectfile/projectfile.go
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@codecov

codecov Bot commented Nov 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 47.61905% with 22 lines in your changes missing coverage. Please review.
✅ Project coverage is 61.75%. Comparing base (c1738aa) to head (9d2644a).
⚠️ Report is 5 commits behind head on main.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant