Skip to content

fix(generate): registry generation, go:embed for typed examples, inverted methods#158

Merged
iAlexeze merged 6 commits into
mainfrom
feat/early-access-version
Jun 2, 2026
Merged

fix(generate): registry generation, go:embed for typed examples, inverted methods#158
iAlexeze merged 6 commits into
mainfrom
feat/early-access-version

Conversation

@iAlexeze
Copy link
Copy Markdown
Collaborator

@iAlexeze iAlexeze commented Jun 2, 2026

Summary

  • go:embed silently skips subdirectories containing a go.mod (nested module rule) — 09-hooks, 10-constructor, and 11-mixed-operator-pattern were missing from ork init --pack advanced on every machine. Fixed by renaming go.mod/go.sum.txt at embed time; ork init restores them transparently on extraction, and the Makefiles restore them on the first make registry or make build.
  • cmd/cli/generate.go: generateKatalog was setting kat.Spec but never calling m.Enabled(), so kat.Enabled() always returned nil. generate.TypeRegistry iterated over nothing and silently exited — no registry was ever written.
  • pkg/types/methods.go: CustomHooksEnabled() and ConstructorEnabled() returned == nil instead of != nil — inverted for every call site. Safe for declarative CRDs (all call sites are guarded by DefaultReconcile()) but would have caused panics and wrong behavior for typed operators.
  • pkg/generate/registry_generator.go: TypeRegistry now returns (bool, error) so the caller knows whether anything was written.
  • cmd/cli/generate_registry.go: ensureMainGo is now only called when the registry was actually written. Output replaced with fmt using / / style matching other CLI commands.

Test plan

  • ork init --pack advanced includes 09-hooks, 10-constructor, 11-mixed-operator-pattern
  • make registry inside an extracted typed example restores go.mod and generates the registry
  • ork generate registry -f komposer.yaml from 11-mixed-operator-pattern produces zz_generated_typeregistry.go with hook and constructor entries
  • ork generate registry on a declarative-only katalog prints ○ nothing to generate and does not write main.go
  • ork run on a declarative katalog is unaffected
  • Release v0.7.0 and verify ork init --pack advanced delivers all 12 examples

@iAlexeze iAlexeze merged commit f7bf0f5 into main Jun 2, 2026
5 checks passed
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