kcl-generate: resolve fragment imports and enforce the composition contract #16
Labels
No labels
needs-info
needs-triage
ready-for-agent
ready-for-human
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ginjiruu/toolbelt#16
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Parent
#14 — Spec: Per-package KCL config fragments — service-owned defaults (db, embeddednats, embeddedfga)
What to build
The config generator stops string-merging an embedded universal schema into an app's schema. Instead it resolves native KCL fragment imports (
import toolbelt.<pkg>) through the kcl.mod at build time, so the schema an app authors is exactly the schema that is validated and codegen and runtime can never disagree about which fields exist. This is the mechanism the service packages' own fragments (ticket 3) plug into.Two composition contracts are enforced at codegen, failing while the app author is still in the editor:
db:,nats:,fga:,log:,session:,rebuild:); a mis-named composition (e.g.jetstream:) is rejected. App-authored schemas under any key (e.g.oidc:) stay legal — enforcement keys off fragment provenance, not a closed key list.pathfield (lands with ticket 3).App-wins-by-not-importing works with no merge-precedence code: an app that defines its own schema and doesn't import the fragment is accepted. Fragment-vs-fragment schema-name collisions are KCL module-level errors. Schema names (
NATS,DB,FGA,Log) are preserved for qualified-import composition. The embedded universalLogschema and the tool's-universalflag are removed.Acceptance criteria
jetstream: NATS = NATS {}) fails codegen.Logand the-universalflag are gone; existing generator tests are updated andgo test ./...passes in the tools module.Implemented, verified (go test green in root/tools/example, task check-kcl green), and reviewed via /code-review. Landed in commit
f3cbcd0on master.