RFC 0049 — Config JSON Schema
| Field | Value |
|---|---|
| Status | Implemented — signed off 2026-11-14; phases 0 to 2 landed together in #359; §17 records where the build differs |
| Short | Config JSON Schema |
| Settles | How the config schema is published for editors and for Helm, and why the chart needs no list of integer fields |
| Author | Max Batleforc maxleriche.60@gmail.com |
| Co-author | Claude Opus 5.5 noreply@anthropic.com |
| Created | 2026-11-14 |
| Supersedes | — |
| Touches | crates/config (derive, json_schema(), a schema test), crates/core (derive on the 18 config types it owns, schema feature), server (dump-config-schema), helm/batlehub (_helpers.tpl, values.yaml, values.schema.json, ci/values-integers.yaml, .helmignore), .tasks/docs.yaml, .tasks/scripts/config_schema_check.sh, mise.toml/mise.lock (taplo), config.example*.toml, .github/workflows (test.yaml path filter, helm-lint.yaml, build.yaml's release assets), docs (docs/public/schema/, docs/guide/configuration.md and docs/guide/install/helm.md with their docs/fr/ twins, docs/contributing/testing.md), CLAUDE.md, CHANGELOG.md |
| Risk | Low |
1. Summary
The server derives a JSON Schema from the Rust structs it deserializes its config into, commits it under docs/public/schema/, and attaches it to each release. An operator adds one #:schema line to config.toml and the editor completes keys and flags a mistyped one as they type. Phase 2 embeds the same schema in the Helm chart's values.schema.json, so helm install refuses a mistyped config: key before anything is deployed.
This RFC began as a way to generate the chart's list of integer fields from the schema (§2.1). The review found that list unnecessary: serde reads an integer into an f64, so the chart can turn every float with no fractional part into an integer, with no list at all. That is phase 0, which ships on its own (§15 question 1).
Before / after
# today (main)
values.yaml config.audit.access_retention_days: 30
config.toml access_retention_days = 30.0 → the server refuses to start
# phase 0 (phase 0)
config.toml access_retention_days = 30 every whole float, any key
config.toml access_retention_days = 30.5 left alone; the server refuses it
# phase 1, in the editor
#:schema https://github.com/batlehub/batlehub/releases/download/v1.11.0/config.schema.json
[audit]
acess_retention_days = 30 # flagged before the server ever reads the file2. Motivation
- The chart's integer list fell behind the structs, and the failure was a server that does not start.
batlehub.configinhelm/batlehub/templates/_helpers.tplconverted 19 field positions; the structs incrates/config/src/schema/have 77 (a struct reused underregistries[]andnamespaces[]counted per position). weebo-si carried a--setworkaround in Argo CD foraudit.*. Settled by phase 0 without the schema (§15 question 1). - An operator edits
config.tomlblind. 77 structs and 14 enums incrates/config/src/schema, plus 18 types fromcrates/core; tagged enums (type = "…"on auth, scanners, rules, notification channels);deny_unknown_fieldson 10 structs. A typo is found at load, by a server that refuses to start or a reload that is refused. No editor can check the file beforehand. - A Helm user finds a typo in
config:only in the pod's log. The chart renders any key it is given; a misspelt key is either refused at startup (underdeny_unknown_fields) or silently ignored (everywhere else). - The docs restate fields by hand.
config.example*.toml, the registry pages and the chart's values comments each list fields. This RFC checks the example files and the chart's rendered examples; the docs pages stay a non-goal (§3), so this motivation is only partly addressed.
3. Goals / non-goals
Goals
- A JSON Schema of
AppConfig, generated from the structs, committed, and attached to each release; a second, layer variant for files that hold part of the config. batlehub dump-config-schema: the schema of the exact binary.- A drift gate in
cargo test, and the shipped examples validated against the schema by a real client (taplo). - Phase 2:
values.schema.json, so a mistypedconfig:key failshelm install.
Non-goals
- A schema that proves a config loads.
AppConfig::validate()holds cross-field rules (RFC 0015 §4.9, themin_age_secsfloor of RFC 0018 §4.3) JSON Schema cannot express, andrequiredonly holds after the layers merge;explain-configstays the authority. - Catching
30.0in the editor. JSON Schema'sintegeraccepts a float with no fraction (§6.P observation 4); phase 0 is what fixes that defect. - Generating the chart's integer list from the schema. Phase 0 needs no list (§15 question 1).
- Checking the TOML in
docs/registries/*and the values comments. A docs-wide extractor is its own work; §2.4 stays partly open. - Defaults of struct-valued fields in hovers. schemars writes a
defaultwhen the field's type implementsSerialize: primitives get one (access_retention_daysshows0), config structs do not, and derivingSerializeon every struct for hovers is not worth it. RELOAD_KEYS, the CLI's own config, SchemaStore registration. Other readers, other files;config.tomlis not a name we own.
4. User-facing design
4.1 Configuration
No configuration key is added. The visible surface:
config.schema.json— every key,requiredwhere serde requires it. For the first--configlayer, or a single file.config-layer.schema.json— the same with everyrequiredremoved at every depth except an enum's tag. For a credentials layer or any overlay, which is partial by design (load_layered_textdeserializes once, after the merge,crates/config/src/lib.rs:178).- Both are committed under
docs/public/schema/, attached to each GitHub release beside the SBOMs and inside its signedchecksums, and printed bybatlehub dump-config-schema [--layer]. - The documented
#:schemaURL is the release asset of the version the operator runs.https://batlehub.dev/schema/config.schema.jsonexists and is labelled latest (main): an older binary paired with it accepts keys that binary ignores (§10.2). config.example*.tomlgain a#:schemaline naming the latest URL: they trackmain, which is that schema.
Absent #:schema, nothing changes. The console's config editor and editing values.yaml get no completion from phase 1; phase 2 gives yaml-language-server users completion under config: through values.schema.json.
4.2 Behaviour rules
- The schema follows serde.
rename_all,tag,default,deny_unknown_fields,flattenanduntaggedare what schemars reads; a field with#[serde(default)]is notrequired. additionalProperties: falseexactly where the server hasdeny_unknown_fields. Elsewhere the server accepts an unknown key, so the schema does too; tightening that is a server change.- TOML has no null. schemars writes
Option<T>as"type": ["integer","null"]oranyOf: [{$ref}, {type: null}]; a post-pass removes thenullarm. A null cannot be written in TOML, and the arm turns a typo's diagnostic into "not valid under any of the schemas listed in the 'anyOf' keyword" (§6.P observation 5). - A
$refbeside validation keywords becomes anallOf. schemars writes a tagged enum's newtype variant as$refplus the tag'sproperties; taplo, like every draft-07 validator, ignores keywords beside a$ref, so the tag vanished and everyoneOfmatched several variants. Found by the firsttaplo checkofconfig.example.toml(§6.P observation 9). - The layer variant keeps an enum's tag required. Every other
requiredgoes; a rule a layer adds must still say which variant it is, or serde cannot read it. - No
$id. Every$refis#/$defs/…, local to the document, so a downloaded copy never resolves against a remote one. ${VAR}placeholders.expand_env_vars_withruns on the text before the parse (crates/config/src/lib.rs:44); a placeholder inside a string validates as a string, and an unquoted${PORT}was never valid TOML for an editor.- Phase 0, in the chart. Every float64 whose value equals its
flooris set to an int64, in maps and lists at any depth, inconfigandcredentials.config. Nothing else is touched.
4.3 Validation
| Condition | Caught by | Says |
|---|---|---|
docs/public/schema/*.json differs from json_schema() | schema_is_current (cargo test) | the two file names and task docs:config-schema |
a config.example*.toml fails config.schema.json | task docs:config-schema:check (taplo) | taplo's diagnostic, file and line |
a deploy/helm render fails config-layer.schema.json | task docs:config-schema:check (taplo) | the values file, then taplo's diagnostic |
phase 2: values.schema.json differs from the generated one | schema_is_current | the file and the task |
There are no warnings. Only the drift rows are fixed by regenerating; an example that fails is fixed in the example or in the derive.
4.4 API surface
No HTTP route; the schema is a static file and a subcommand, never served by the server (§7.1).
4.5 Mocks
M2 and M3 are proposed output; M1 was run (observation 10), M4 and M5 quote taplo 0.10.0.
M1 — the subcommand.
$ batlehub dump-config-schema > config.schema.json; echo $?
0
$ batlehub dump-config-schema --layer > config-layer.schema.json; echo $?
0It decides that the output is the bare document on stdout, byte-identical to the committed file. Output is written with the same serializer as the test (pretty, trailing newline), and a closed pipe ends it with exit 0, not the println! panic dump-spec would give (server/src/main.rs:141).
M2 — drift, a field added without regenerating.
---- schema_is_current stdout ----
docs/public/schema/config.schema.json and config-layer.schema.json are out of
date with crates/config/src/schema — run `task docs:config-schema` and commit both
test result: FAILED. 0 passed; 1 failedM3 — an example that no longer validates (a renamed field):
$ task docs:config-schema:check
config.example-s3.toml: does not validate against config.schema.json
error: Additional properties are not allowed ('max_connections' was unexpected)
┌─ config.example-s3.toml:14:1
task: Failed to run task "docs:config-schema:check": exit status 1M4 — the editor, a typo (taplo 0.10.0's own text, §6.P observation 3):
error: Additional properties are not allowed ('acess_retention_days' was unexpected)
┌─ config.toml:4:24
4 │ acess_retention_days = 3M5 — the same typo without the null post-pass (observation 5): … is not valid under any of the schemas listed in the 'anyOf' keyword. It is what §4.2's rule removes.
M6 — phase 2, helm install with the typo under config.audit (observation 11, Helm's own text; exit 1, nothing rendered):
# Helm 3.19 and later (santhosh-tekuri/jsonschema)
Error: values don't meet the specifications of the schema(s) in the following chart(s):
batlehub:
- at '/config/audit': additional properties 'acess_retention_days' not allowed
# Helm 3.15 to 3.18 (gojsonschema)
Error: values don't meet the specifications of the schema(s) in the following chart(s):
batlehub:
- config.audit: Additional property acess_retention_days is not allowed5. Architecture
5.1 One source, the files it produces
It shows that every published copy comes from the function serde's derive sits beside, so a field cannot be deserialized without being in the schema.
5.2 Phase 0, where the float goes
Invariant. Because serde accepts an integer for an f64 and refuses a float for an integer type, converting every whole float is correct for every field the config has or will have, so the chart holds no per-field knowledge that can fall behind the structs.
6. Detailed design
6.0 Phase 0, helm/batlehub (this branch)
batlehub.wholeFloatsToInts recurses through maps, rebuilds lists (a template cannot assign to a list element) and sets every whole float64 to an int64; batlehub.config and batlehub.credentialsConfig both call it. The seven deploy/helm examples and the default values render byte-identical to main; helm-lint.yaml's Integer fields render as integers step renders ci/values-integers.yaml (every shape: tables, lists of tables, the scanners map, trigger_on_status, the credentials layer) and fails on any = N.0. It fails on main with 51 lines.
6.1 crates/config and crates/core
schemars = "1.2"(featurechrono04, forGrantsShadowConfig::until,src/schema/registry.rs:40) andserde_jsonas direct dependencies ofbatlehub-config;#[derive(JsonSchema)]beside everyDeserializeundersrc/schema/.MiseBackendConfig::Full { options: toml::Table }(src/schema/mise_auto_wire.rs:84) takes#[schemars(with = "serde_json::Map<String, serde_json::Value>")]:toml::Tablehas noJsonSchema.crates/coreowns 18 embedded types: the auth ports (OidcAuthConfig,KubernetesAuthConfig,ActionsOidcAuthConfig,ActionsGroupRule,Condition,ConditionMatchType,RuleMatch),S3StorageConfig,Severity,FindingKind,InstallHookMode,ScannerErrorMode,SecurityMode,Visibility,Immutable,GalaxyRoleMode,helm::HybridMerge,helm::OciEntries. They derive through#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]; onlybatlehub-configenablesschema. In the main workspace feature unification turns it on everywhere config is built (crates/examplesincluded); what it buys is the separatefuzz/workspace, which never compiles schemars and whoseCargo.lockdoes not change (checked withcargo metadata --locked).pub fn json_schema(layer: bool) -> serde_json::Value:schema_for!, then the null-arm post-pass (§4.2), then, forlayer,requiredremoved recursively.$idis never set.
6.2 server
Command::DumpConfigSchema { layer: bool } beside Command::DumpSpec (server/src/main.rs:117), writing through the shared serializer and treating BrokenPipe as success (M1). It reads no config and no database; run_subcommand runs before any config is loaded.
6.3 crates/config/tests/config_schema.rs
schema_is_current compares the two committed files with json_schema(false) / json_schema(true) as parsed serde_json::Values, so key order cannot make it flaky whatever preserve_order feature unification brings. BLESS=1 (the value 1, not any value, unlike reload_keys.rs:482) rewrites them. Phase 2 adds values.schema.json.
6.4 .tasks/docs.yaml, .tasks/helm.yaml, CI
docs:config-schemaruns theBLESS=1test;docs:config-schema:checkrunstaplo check --schemaon everyconfig.example*.tomlagainstconfig.schema.json(M3). taplo is pinned inmise.toml.- The same check renders each
deploy/helmfile andci/values-integers.yamland validates every rendered.tomlagainstconfig-layer.schema.json: a first layer may leavedatabase.urlto the credentials Secret (deploy/helm/values-external-secrets.yaml), so only types and unknown keys are checked there. - The taplo check runs as a step of
helm-lint.yaml'slintjob (taplo throughjdx/mise-action, helm already there), whose gate paths gaindeploy/helm/**,config.example*.tomlanddocs/public/schema/**: a new workflow would be a new required check for the ruleset. test.yaml's path filter gainsdocs/public/schema/**(and, in phase 2,helm/batlehub/values.schema.json), so a hand edit to a generated file still runs the drift test (it listsdocs/guide/hot-reload.mdfor the same reason today).- The release workflow (
build.yaml'sserverjob) dumps both files from the shipped binary and attaches them; thechecksumsjob already hashes every asset.version:setdoes nothing new: the PR gate keeps the files current.
6.5 Phase 2, helm/batlehub/values.schema.json
values_schema() in crates/config/src/json_schema.rs, committed by the same test: the layer schema moves under $defs/AppConfig beside its own definitions (so every #/$defs/… reference still resolves from the chart document's root, checked by values_schema_refs_all_resolve_from_its_root), its $schema moves to the top, and properties.config and properties.credentials.properties.config both $ref it. Both use the layer variant: required is a property of the merged config, and either half may hold any part of it. Every other value stays unconstrained. Draft 2020-12 is kept as-is: a draft-07 rewrite (definitions) was probed beside it and behaved identically on every Helm version (observation 11), so it buys nothing. helm-lint.yaml gains two steps: the typo of M6 must fail the render, the documented credentials layer (values.yaml:337-347) must not.
6.6 Docs
docs/guide/configuration.md (and docs/fr/) gains Editor support: the #:schema line with the release URL, which file for which layer, the subcommand, the 30.0 limit, and that this JSON Schema is unrelated to config_version. docs/contributing/testing.md gains the task docs:config-schema line; CLAUDE.md one sentence under Config loading; docs/guide/install/helm.md the minimum Helm version and the skip options once phase 2 lands.
6.P Proof against a real client
The consumers are taplo 0.10.0 (mise x taplo@0.10.0 -- taplo check, the engine of Even Better TOML), Helm v4.3.1, and the server's explain-config.
Run on 2026-11-14 against a hand-written one-property schema (audit as a plain object, access_retention_days uint32, additionalProperties: false), so 1 to 4 prove taplo's behaviour, not schemars' output:
access_retention_days = 30— exit 0.= 30.5and= "30"— exit 1,30.5 is not of type "integer","30" is not of type "integer".- Refusal:
acess_retention_days = 3— exit 1,Additional properties are not allowed ('acess_retention_days' was unexpected)at line 4 (M4). - Limit:
access_retention_days = 30.0— exit 0: JSON Schema'sintegeradmits a whole float. - Re-run by review with
auditas schemars writes anOption(anyOf: [$ref, null]): the typo gives… is not valid under any of the schemas listed in the 'anyOf' keyword(M5), which §4.2's post-pass exists to avoid.
Phase 0, run 2026-11-14 with Helm v4.3.1:
helm template -f ci/values-integers.yaml: no= N.0line in either rendered file; the same step against main's chart fails with 51.access_retention_days: 30.5renders30.5;outage_ratio: 1.0renders1; nested[[1, 2.5], [3]]renders unchanged.
Phase 1, run 2026-11-14 on this branch:
- Refusal, the generated schema:
config.example.tomlwithacess_retention_days = 3appended under[audit]and a local#:schema ./config.schema.json— exit 1,Additional properties are not allowed ('acess_retention_days' was unexpected)at line 1113, the typo's line, through$defs/$refand the null post-pass; nothing remote is named, since the document has no$id. A mistyped tag (type = "tokn") exits 1 with the generic valid under more than one of the schemas. - The first
taplo checkof the threeconfig.example*.tomlrefused all three: every tagged enum entry was valid under more than one of the schemas listed in the 'oneOf' keyword, because taplo ignores keywords beside a$ref(§4.2). After theallOfpost-pass: all three, the sevendeploy/helmrenders and both files ofci/values-integers.yamlexit 0 (task docs:config-schema:check). The same run caught two errors in the fixture (typefor the rules'kindtag,namefor a namespace'smatch), and the first layer variant, which dropped the tags, refused the corrected rules the same way; it now keeps them. batlehub dump-config-schemaand--layerare byte-identical to the committed files;| head -3exits 0 with no panic.
Phase 2, run 2026-11-14 on the Helm each Argo CD minor bundles (hack/tool-versions.sh at v2.12.0 to v3.6.1): 3.15.2, 3.16.3, 3.17.1, 3.18.4, 3.19.4, 4.2.1, 4.3.1:
- On all seven, with the 2020-12 document and with a draft-07 rewrite: the default values, the seven
deploy/helmfiles,ci/values-integers.yamland the documented credentials layer all render (10 of 10); the typo of M6 is refused with the text quoted there. - Refusals reach through
$ref,oneOfandallOf, on 3.15.2 and 4.3.1:auth[0].type: tokn('oneOf' failed, none matched … value must be 'token'),server.port: "abc"(got string, want integer), andcache.metadata_ttl_secs: 30.5(got number, want integer; 3.15.2: Invalid type. Expected: integer, given: number). The last is a value phase 0 leaves for the server to refuse; with phase 2 Helm refuses it first. --skip-schema-validationexists from Helm 3.16.3 (helm template --help) and not in 3.15.2; Argo CD'sApplicationSourceHelmhasSkipSchemaValidation(skipSchemaValidation) from v2.14.0, which bundles Helm 3.16.3, and not in v2.12.0 or v2.13.0.
ci/values-integers.yaml is not loaded by explain-config: its one registry carries fields of several kinds (refs of a forge, pending_nar_ttl_secs of nix), which validate() rightly refuses together. The seven deploy/helm files are what task helm:examples loads.
6.N Heavy coverage
No tests/heavy suite applies: no package manager or network client reads the schema, and the server's behaviour on the wire does not change. The consumers are an editor and Helm, and §6.P runs both directly. The regression signal is schema_is_current, task docs:config-schema:check, task helm:examples and helm-lint.yaml.
Deliberately untouched, so reviewers do not go looking:
AppConfig::validate()— §3.crates/config/src/reload_keys.rs— §3.ui/openapi.jsonand the generated client — the config editor posts TOML text; no DTO changes.
7. Security
Rating: Low. No route, no runtime input, no secret. The new surfaces are build-time files, a subcommand reading nothing, and documents derived from public source.
7.1 Threat model
| STRIDE | Threat | Mitigation and enforcement | Residual |
|---|---|---|---|
| Tampering | Hand edit of a generated file in a PR | schema_is_current; the path filter of §6.4 makes it run on such a PR; BLESS only on 1 | none |
| Tampering | A compromised docs host serves a schema whose descriptions suggest insecure values | documented URL is the release asset, in the signed checksums; dump-config-schema for offline | the latest URL; owner: docs |
| Information disclosure | Doc comments become description strings | the source is public (Apache-2.0); review found only placeholder hosts | accepted |
| Denial of service | Phase 2 schema refuses a valid install | layer variant for both halves; gates of §6.5; skip options documented | a key the server accepts and the schema forbids; owner: chart |
| Tampering | Phase 0 changes a value in an opaque map | only whole floats change; mise backend options is the one opaque table, and a version there must already be quoted or YAML mangles it | accepted |
7.2 Authentication and authorisation
None: the subcommand runs as the local user and reads nothing.
7.3 Input handling and injection
The generator writes no template text (the walker of the draft is gone), and the schema is never parsed by the server. Phase 0's helper reads values the chart already renders verbatim.
7.4 Secrets and cryptography
None. schemars emits a default only where the field's type implements Serialize (primitives, strings), and every secret-bearing field is an Option without default or a required field (checked by review: seal_signing_key, erasure_key, smtp_password, SignedUrlsConfig.secret, Bearer/Basic credentials).
7.5 Abuse and resource exhaustion
None at runtime. Phase 0 recurses over values the operator wrote.
7.6 Existing defences that still hold
serde's deny_unknown_fields and AppConfig::validate() still decide what loads; the schema adds an earlier check, never replaces one.
8. Supply chain
| Dependency | Version | Kind | Licence | Status |
|---|---|---|---|---|
schemars (+ schemars_derive 1.2.3, serde_derive_internals 0.30.0, dyn-clone 1.0.20, ref-cast/ref-cast-impl 1.0.27) | 1.2.3 | runtime, batlehub-config; optional in core | MIT (all six; ref-cast, dyn-clone, serde_derive_internals MIT OR Apache-2.0) | cargo deny check: advisories, bans, licenses, sources ok (2026-11-14) |
| taplo | 0.10.0 | dev tool, pinned in mise.toml | MIT | used by the tasks of §6.4; no Rust dependency |
The jsonschema crate was considered for validating examples and dropped: its default resolve-http would fetch remote $refs and pull a second reqwest, and deny.toml has multiple-versions = "deny". taplo is also the real client, which is what the proof should run. No image changes; the release workflow gains two assets.
9. Data and privacy
No new datum: the schema describes field names and types and holds no value from any deployment.
10. Operability
10.1 Observability
No metric, log or audit event: nothing runs in the server process except the subcommand, which exits.
10.2 Failure modes
| Failure | Detected by | Behaviour | Recovery |
|---|---|---|---|
| Field added, not regenerated | schema_is_current (M2) | PR red | task docs:config-schema |
| Example stops validating | docs:config-schema:check (M3) | PR red | fix the example or the derive |
| Editor on the latest URL, binary older | nothing | a key that binary ignores validates green: fails open | the release URL, which the docs give by default |
| Docs site or GitHub down | editor | no validation; the server is unaffected | dump-config-schema to a local path |
| Editor cached an older schema | editor | stale diagnostics until the cache expires | Editor support says how to refresh |
| Phase 2 refuses existing values | helm install, Argo CD | install refused; in Argo a ComparisonError, auto-sync stops, running pods unaffected | --skip-schema-validation (Helm 3.16+), skipSchemaValidation (Argo CD 2.14+), or the previous chart |
| Phase 0 regresses | helm-lint.yaml step | the server refuses N.0: fails closed | — |
10.3 Performance and capacity
The schema size and the derive's compile-time cost are measured in the phase 1 PR (CI timing against main). Phase 0 adds one walk over the values at render time.
11. Other concerns
- Accessibility: no UI; diagnostics are the editor's.
- Internationalisation: field names are the config's own; Editor support has its
docs/frtwin. - Compliance: a published, machine-checked schema is evidence for RFC 0036's secure-configuration line (CRA); that matrix gains the reference.
- Licensing: schemars and taplo are MIT, in policy; the published schema is Apache-2.0 like its source.
- Documentation: §6.6, the CHANGELOG.
- Deprecation: none; phase 2 is the first point a
helm installcan refuse a values file that installs today, and its CHANGELOG entry says so with the skip options.
12. Alternatives considered
| Alternative | Why rejected |
|---|---|
| Keep a hand list of integer fields (the first fix) | it is the state that missed 58 of 77; phase 0 needs none |
| Generate the integer list from the schema (this RFC's draft) | correct but a walker over every schemars shape (type arrays, allOf from flatten, $ref with siblings) to compute what one floor comparison decides |
| Accept a whole float for an integer in the server's loader | fixes every templater, but makes the server accept port = 8080.0 from a hand-written file; the float is Helm's doing, so the fix sits in the chart |
Config as a raw TOML string in values (externalManifest) | already possible, and loses per-key overrides, which is how weebo-si sets values |
| Generate at release time only | a field added mid-cycle is wrong on main until the release; the PR gate is earlier |
| Write the schema by hand | a third copy of the structs |
| Serve the schema from the server | a route on every instance for a build-time artifact |
utoipa instead of schemars | already a dependency (no new crates), but measured worse on the config's shapes; §15 question 4 |
13. Rollout and compatibility
- Default behaviour: phase 0 renders byte-identical output for every value it did not already break; phases 1 and 2 are opt-in or validation only.
- Config migration: none;
CURRENT_CONFIG_VERSIONdoes not move. - Operator prerequisites: an editor with taplo support; Helm 3.15 or later (§15 question 5).
- Rollback: revert; nothing is persisted. Phase 2 reverts alone, and a consumer can skip schema validation per install.
14. Test plan
- Unit:
json_schemapost-pass (nonullarm left;layerhas norequiredat any depth; no$id). - Integration:
schema_is_current(§6.3). - Real client:
docs:config-schema:check(taplo),helm-lint.yaml(phase 0, and in phase 2 the documented credentials layer and default values must render). - Negative, per §7.1 row: a hand-edited generated file is red (row 1); the release asset is in
checksums(row 2, the release workflow's own check); the layer-variant renders of §6.5 (row 4); observation 7 (row 5). - Heavy: none, §6.N.
- Existing suites unchanged:
task helm:examples,helm-lint.yaml,cargo test --workspace,task helm:docs:check,task fuzz:check.
15. Decisions and open questions
Resolved
| # | Question | Decision |
|---|---|---|
| 1 | Does the chart need a list of integer fields? | No: every whole float becomes an int64 (phase 0). The draft, and the brief that asked for this RFC, assumed a generic pass would break the f64 fields; probed with toml 1.2.0, serde reads r = 1 into an f64 and refuses n = 30.0 for a u32. Decided by the user against the draft's design. |
| 2 | Where does the drift gate run? | On every PR, in cargo test, with the path filter widened. A release gate is too late for deploys from main. |
| 3 | Which URL do the docs give? | The release asset of the running version. The latest URL fails open on version skew (§10.2). |
| 6 | Validate examples with the jsonschema crate or taplo? | taplo. The real client; the crate would pull a second reqwest past multiple-versions = "deny". |
| 7 | Which schema does Helm validate config and credentials.config against? | The layer variant, for both. required holds only after the merge; the full schema refused the chart's default credentials.config: {}. |
| 8 | Should version:set regenerate? | No. The PR gate keeps the files current; a release cut should not rewrite them. |
| 5 | Minimum Helm version, and how a consumer turns the schema off? | Helm 3.15; --skip-schema-validation (Helm 3.16+) or spec.source.helm.skipSchemaValidation (Argo CD 2.14+); on Helm 3.15 / Argo CD 2.12–2.13, pin the previous chart. Probed on the Helm each Argo CD minor from 2.12 bundles (observations 11–13): all validate the document identically. 3.15 is the oldest probed, not a known break below it; Chart.yaml has no field for a Helm floor, so the floor is stated in docs/guide/install/helm.md and the CHANGELOG. |
| 4 | schemars or utoipa? | schemars. Spiked on the config's own shapes (2026-11-14): utoipa 6 writes an untagged enum as oneOf (wrong when two variants accept one value), a u16 as int32 with no maximum, and references into #/components/schemas to be reassembled by hand; schemars writes anyOf, uint16 with maximum, and a self-contained $defs document. |
Still open
None.
16. Implementation phases
| Phase | Content |
|---|---|
| 0 | phase 0: batlehub.wholeFloatsToInts, the helm-lint.yaml step, the audit block in values.yaml. Ships alone. |
| 1 | The derive, json_schema(layer), dump-config-schema, the two committed files, schema_is_current, the taplo tasks, the path filter, the release assets, Editor support. Useful alone. |
| 2 | values.schema.json with the layer variant, its two helm-lint.yaml steps, the Helm floor and skip options in the install guide. |
17. Revision against the tree (2026-11-14)
Phases 0 to 2 landed together in #359 (89aac113, 54794c4c), on the day the RFC was written; the sections above were revised as the build taught them, so this is the record of where the build moved the design.
Where the build differs from the first draft
- No integer list, generated or not. The draft generated
_int_fields.tplfrom the schema. The review found the premise behind it false: serde reads an integer into anf64(toml 1.2.0), so a generic whole-float pass is correct for every field. Phase 0 is that pass; the walker and its template were never built (§15 question 1). $refbeside validation keywords becomesallOf. Not in any draft. The firsttaplo checkrefused all three example configs: schemars puts a tagged variant's tag beside its$ref, and taplo ignores it there (§6.P observation 9).- The layer variant keeps enum tags required. The draft removed every
required; the corrected fixture's rules then matched several variants. - schemars emits
defaultfor primitive fields. The draft said it emitted none; the spike showedaccess_retention_dayswithdefault: 0. §3 and §7.4 were corrected; no secret-bearing field has a default. - 18 core types, not 16 or 17,
Immutablethe one first missed; six new crates,ref-cast-implthe one first missed. fuzz/Cargo.lockdoes not change. The draft expected the optional dependency to enter it;cargo metadata --lockedpasses untouched.- The fixture was wrong twice (
typefor the rules'kind,namefor a namespace'smatch), found by the schema it was meant to exercise. It is not a loadable config, which observation 10's first wording assumed. - The taplo check runs in
helm-lint.yaml, not a new workflow (a new required check), and the render check lives in the same script rather than intask helm:examples.
The proof, as observed
§6.P observations 1 to 13 are all observed, none predicted: taplo 0.10.0 on the hand probe and on the generated schema; Helm 3.15.2 to 4.3.1 on the chart; Argo CD's tool-versions.sh and types.go from v2.12.0 to v3.6.1.
Threats, as tested
| §7.1 row | Test |
|---|---|
| Hand edit of a generated file | schema_is_current (crates/config/tests/config_schema.rs), red on any value difference in the three files; BLESS only on 1; test.yaml and helm-lint.yaml path filters include docs/public/schema/** and values.schema.json |
| Compromised docs host | release assets dumped from the shipped binary in build.yaml and hashed by its checksums job; Editor support names the release URL first |
| Doc comments published | holds: public source, placeholders only |
| Phase 2 refuses a valid install | helm-lint.yaml The documented credentials layer passes the schema; task docs:config-schema:check renders the seven deploy/helm files; observation 11 on seven Helm versions |
| Phase 0 changes an opaque value | observation 7 ([[1, 2.5], [3]]); residual accepted as written |
Supply chain and gates, as shipped
schemars 1.2.3 with schemars_derive 1.2.3, serde_derive_internals 0.30.0, dyn-clone 1.0.20, ref-cast/ref-cast-impl 1.0.27: cargo deny check advisories, bans, licenses, sources ok. taplo 0.10.0 pinned in mise.toml and mise.lock.
CI on 54794c4c (2026-11-14): Lint (clippy + fmt), Unit tests (+ coverage), Integration tests (+ coverage) (cargo test --workspace), Fuzz targets (task fuzz:check, which the authoring environment could not run for want of a C++ compiler), helm lint + rendered-manifest assertions (the integer step, the taplo step, the schema's must-refuse and must-pass steps), the docs gates, the dependency audits and SonarCloud all green; 83 checks passed, none failed. The heavy client matrix was still queued when this was written; §6.N is why it is not this RFC's evidence, and the merge waits for it like any other PR.