You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Lexicon contract: per-lexicon config namespaces are undeclared, unvalidated, and untypeable #1344
Core itself reaches into two of them with as casts.
ChantConfigSchema is .passthrough(), so at runtime any key is accepted and a typo (runnerLabel) is silently ignored — the dialect just uses defaults. The ChantConfig interface is closed, so the documented forgejo example does not compile:
error TS2353: Object literal may only specify known properties,
and 'forgejo' does not exist in type 'ChantConfig'.
Three lexicons, three workarounds: temporal exports its own widened TemporalChantConfig, k8s's docs drop satisfies, forgejo's docs keep satisfies ChantConfig and are wrong.
Into the contract
A lexicon may own the config namespace named after it, and says so:
A contract member — e.g. configSchema?: ZodType or configNamespace?(), declaring the shape of config[plugin.name].
Validation — core validates a declared namespace instead of passing everything through, so a typo is an error rather than a silent default. Namespaces of lexicons that declare nothing keep today's passthrough.
Typing — one supported way to write a typed config with lexicon keys, replacing the three ad-hoc workarounds. Whatever the mechanism (declaration merging, a generic ChantConfig<L>, an exported helper), the documented examples must compile.
A check that a lexicon reading config[name] declares it.
Done when
Namespace ownership is declared, not assumed
An unknown key inside a declared namespace fails rather than defaulting
The k8s, temporal, and forgejo doc examples typecheck as written
Activity
feat(config): a lexicon declares the config namespace it owns (#1344)
feat(config): a lexicon declares the config namespace it owns (#1344)
feat(config): a lexicon declares the config namespace it owns (#1344) (…
feat(ci): typecheck lexicon tests, scripts and examples, against a sh…
feat(ci): typecheck lexicon tests, scripts and examples, against a sh…
fix(k8s): the k8s config namespace reaches ChantConfig (#1370) (#1405)
fix(k8s): a read failure names the cluster context it read; the bindi…