Skip to content

chore: drop kcl 0.12.x evaluator workarounds - #37

Merged
Peefy merged 1 commit into
kcl-lang:mainfrom
Peefy:remove-kcl-012-workarounds
Aug 29, 2026
Merged

Peefy merged 1 commit into
kcl-lang:mainfrom
Peefy:remove-kcl-012-workarounds

Conversation

@Peefy

@Peefy Peefy commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Now that kcl-lang/kcl#2130 is fixed upstream (kcl-lang/kcl@703b8ead: "fix(evaluator): restore local_vars after call, don't extend"), the workarounds introduced in #36 to keep the runtime usable against that bug are no longer required.

Changes

  • models/kube/utils/metadata_builder.k: drop the {} fallback for labels/annotations — bare config?.labels/config?.annotations are correct now.
  • models/kube/mixins/service_mixin.k: drop the pre-computed _singleService/_workloadType locals; read len(config.services)/config.workloadType inline again.
  • models/kube/backend/server_backend.k: drop the isolated _spec dict and inline the spec construction back into the workloadAttributes literal.

Test plan

  • cd examples/appops/guestbook/dev && kcl run — render must succeed without the earlier "invalid value 'UndefinedType' to load attribute 'workloadType'" panic.
  • Run the full konfig examples test suite (./scripts/test.sh) against a KCL build containing kcl-lang/kcl@703b8ead.

🤖 Generated with Claude Code

Now that kcl-lang/kcl#2130 is fixed upstream (commit 703b8ead:
"fix(evaluator): restore local_vars after call, don't extend"), the
workarounds introduced in PR kcl-lang#36 to keep the runtime usable against
that bug are no longer required.

Removes:
- the inline `{}` fallback on labels/annotations in
  `models.kube/utils/metadata_builder.k`
- the pre-computed `_singleService`/`_workloadType` locals in
  `models/kube/mixins/service_mixin.k`
- the isolated `_spec` dict extraction in
  `models/kube/backend/server_backend.k`

This restores the simpler, native dict-literal/merge-operator code
that the library was originally written against.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Peefy <xpf6677@163.com>
@Peefy
Peefy force-pushed the remove-kcl-012-workarounds branch from d09854d to feebef4 Compare August 24, 2026 10:57
@Peefy
Peefy merged commit 12025e8 into kcl-lang:main Aug 29, 2026
5 of 6 checks passed
@Peefy
Peefy deleted the remove-kcl-012-workarounds branch August 29, 2026 17:06
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