From 315a81f3ec2b8eba540e2a423d779fbf38a709a0 Mon Sep 17 00:00:00 2001 From: lex00 <121451605+lex00@users.noreply.github.com> Date: Mon, 7 Sep 2026 09:37:22 -0600 Subject: [PATCH] docs(k8s): state WK8505's single-build-root assumption (#1939) A bundle-join post-synth check only sees the current chant build invocation, so it goes silent (not wrong) once the resources it joins move into separate build roots. Document that as a known limitation on the post-synth check authoring guide and on WK8505's own rule entries (the k8s lexicon's generated rules.mdx and the root audit-rules.mdx, regenerated from their metadata sources), pointing at #1939 for the tracked project-level mode. The flux-apps example does not mention WK8505, so it is left untouched. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01FoXyD9UvKQ5ZdhiR9JT1yB --- .../content/docs/lexicon-authoring/post-synth-checks.mdx | 8 ++++++++ docs/src/content/docs/lint-rules/audit-rules.mdx | 2 +- lexicons/k8s/docs/src/content/docs/rules.mdx | 2 +- lexicons/k8s/src/lint/audit-catalog.ts | 2 +- lexicons/k8s/src/lint/post-synth/wk8505.ts | 6 ++++-- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/docs/src/content/docs/lexicon-authoring/post-synth-checks.mdx b/docs/src/content/docs/lexicon-authoring/post-synth-checks.mdx index f19217f2bc..815b19df17 100644 --- a/docs/src/content/docs/lexicon-authoring/post-synth-checks.mdx +++ b/docs/src/content/docs/lexicon-authoring/post-synth-checks.mdx @@ -325,6 +325,14 @@ Keep helpers in a `*-helpers.ts` file — the barrel generator skips them (they This join is the pattern behind conformance checks generally — a custom resource against the schema that defines it, a composition against the kinds it references. Any check that needs to know about *other* resources in the output is a post-synth check, and this is its shape. +### One build root at a time (chant #1939) + +A bundle-join check only sees the build root of the *current* `chant build` invocation, since `ctx.outputs`, `ctx.docs` and `ctx.entities` are all scoped to that one invocation. Split the two halves of a join across separate build roots and the check goes silent rather than wrong, because a `PostSynthContext` has no way to tell "wired up in the other build" apart from "forgotten entirely." + +The k8s lexicon's `WK8505` (`lint/post-synth/wk8505.ts`) shows why this matters. It warns when a committed-encrypted secret has no Flux `Kustomization` setting `spec.decryption`, and that join needs the secret and the Kustomization declared in the same build root. A project that splits workload and Flux wiring into separate roots, a common shape as a project grows, gets no warning even when the decryption wiring is genuinely missing. + +Chant #1939 tracks whether checks like this should get an opt-in project-level mode that runs across every build root. Until that lands, a check that joins across resources stays single-build-root-scoped by construction, and an author has two options today: keep the resources a check joins across in the same build root, or accept that the check will not fire once those resources live apart. + ## Universal Check Patterns These patterns apply to most IaC formats: diff --git a/docs/src/content/docs/lint-rules/audit-rules.mdx b/docs/src/content/docs/lint-rules/audit-rules.mdx index 664909ec29..8b4174dee0 100644 --- a/docs/src/content/docs/lint-rules/audit-rules.mdx +++ b/docs/src/content/docs/lint-rules/audit-rules.mdx @@ -1298,7 +1298,7 @@ Point `file` at the committed ciphertext, make its metadata.name match the decla **committed-encrypted secret with no Flux decryption wiring** — report-only · guidance -Add decryption: "sops" to the FluxAppFor reconciling the path that carries the ciphertext sidecar, or ignore if that Kustomization is declared in a different build. +Add decryption: "sops" to the FluxAppFor reconciling the path that carries the ciphertext sidecar, or ignore if that Kustomization is declared in a different build. This check sees one build root at a time, so it goes silent once the secret and the Kustomization live in different build roots (chant #1939). | | | |---|---| diff --git a/lexicons/k8s/docs/src/content/docs/rules.mdx b/lexicons/k8s/docs/src/content/docs/rules.mdx index a44bf3089f..48418b8e76 100644 --- a/lexicons/k8s/docs/src/content/docs/rules.mdx +++ b/lexicons/k8s/docs/src/content/docs/rules.mdx @@ -64,4 +64,4 @@ Post-synth checks validate the serialized output after the build pipeline comple | `WK8502` | Custom resource spec field has the wrong type or a value outside its enum | | `WK8503` | Workload consumes a Secret nothing in the output produces — produce it (Secret, ExternalSecret, InfisicalSecret, Certificate) or declare its provenance with declareSecret() | | `WK8504` | committed-encrypted secret declaration does not resolve — the declared file is missing, is not the named Secret, or is not encrypted | -| `WK8505` | committed-encrypted secret with no Flux decryption wiring — add decryption: 'sops' to the FluxAppFor reconciling the path that carries it | +| `WK8505` | committed-encrypted secret with no Flux decryption wiring — add decryption: 'sops' to the FluxAppFor reconciling the path that carries it. Sees one build root at a time, so it goes silent when that Kustomization lives in a different build root (chant #1939). | diff --git a/lexicons/k8s/src/lint/audit-catalog.ts b/lexicons/k8s/src/lint/audit-catalog.ts index 61aa2e1531..a2709b182d 100644 --- a/lexicons/k8s/src/lint/audit-catalog.ts +++ b/lexicons/k8s/src/lint/audit-catalog.ts @@ -45,7 +45,7 @@ export const k8sAuditCatalog: Record = { WK8502: auditRule("WK8502", "merge-worthy", "guidance", "Custom resource spec field has the wrong type or enum value", "Match the CRD schema: use the declared scalar type and one of the enum values.", { category: "correctness" }), WK8503: auditRule("WK8503", "merge-worthy", "guidance", "Workload consumes a Secret nothing in the output produces", "Produce the Secret in the same build (Secret, ExternalSecret, InfisicalSecret, cert-manager Certificate), or declare its provenance with declareSecret() if it exists out of band.", { category: "correctness" }), WK8504: auditRule("WK8504", "merge-worthy", "guidance", "committed-encrypted secret declaration does not resolve", "Point `file` at the committed ciphertext, make its metadata.name match the declaration, and re-run `sops -e -i` so every data/stringData value is ENC[...].", { authority: [K8S_SECRETS] }), - WK8505: auditRule("WK8505", "report-only", "guidance", "committed-encrypted secret with no Flux decryption wiring", "Add decryption: \"sops\" to the FluxAppFor reconciling the path that carries the ciphertext sidecar, or ignore if that Kustomization is declared in a different build.", { category: "correctness" }), + WK8505: auditRule("WK8505", "report-only", "guidance", "committed-encrypted secret with no Flux decryption wiring", "Add decryption: \"sops\" to the FluxAppFor reconciling the path that carries the ciphertext sidecar, or ignore if that Kustomization is declared in a different build. This check sees one build root at a time, so it goes silent once the secret and the Kustomization live in different build roots (chant #1939).", { category: "correctness" }), }; // Prior art credits live beside the rules in ./audit-lineage.ts (see core audit/prior-art.ts). diff --git a/lexicons/k8s/src/lint/post-synth/wk8505.ts b/lexicons/k8s/src/lint/post-synth/wk8505.ts index c42ba12b6e..e4143f17b0 100644 --- a/lexicons/k8s/src/lint/post-synth/wk8505.ts +++ b/lexicons/k8s/src/lint/post-synth/wk8505.ts @@ -15,7 +15,9 @@ * invocations, so "no Kustomization in THIS build sets spec.decryption" can * mean "wired up in the other build" as easily as "forgotten" — the design * doc's §4 explains why no path-to-build-target join exists to tell those - * apart. Promote to error if that join ever becomes available. + * apart. Single-build-root scoped, tracked by chant #1939 as a candidate for + * an opt-in project-level mode; promote to error if that join ever becomes + * available. * * Fires only on claims that actually resolved (`problems.length === 0`, via * `resolveEncryptedSecretClaims`), not on every raw declaration. An @@ -39,7 +41,7 @@ function fluxKustomizations(manifests: K8sManifest[]): K8sManifest[] { export const wk8505: PostSynthCheck = { id: "WK8505", description: - "committed-encrypted secret with no Flux decryption wiring — add decryption: 'sops' to the FluxAppFor reconciling the path that carries it", + "committed-encrypted secret with no Flux decryption wiring — add decryption: 'sops' to the FluxAppFor reconciling the path that carries it. Sees one build root at a time, so it goes silent when that Kustomization lives in a different build root (chant #1939).", check(ctx: PostSynthContext): PostSynthDiagnostic[] { const kustomizations = fluxKustomizations(allManifests(ctx));