Skip to content

design: should build-level post-synth checks (e.g. WK8505) get a project-level, cross-build-root mode? #1939

Closed

Description

@lex00

WK8505 (lexicons/k8s/src/lint/post-synth/wk8505.ts — warns when a committed-encrypted secret has no Flux Kustomization in the build setting spec.decryption) is build-invocation-scoped: it only sees the Kustomizations and secret declarations present in the current chant build. Its own docstring already names the limitation:

The reference project shape (examples/flux-apps) runs the workload build and the Flux build as separate chant build invocations, so "no Kustomization in THIS build sets spec.decryption" can mean "wired up in the other build" as easily as "forgotten" — [...] no path-to-build-target join exists to tell those apart.

iac-cd-bench's golden project demonstrates this isn't just theoretical: it deliberately splits build roots (infra/clusters/delivery), and WK8505 goes structurally silent in per-root verification even when the decryption wiring is genuinely missing — it fires correctly on a combined build of the same inputs (before the wiring was added) and goes silent after splitting the roots (transcript on lex00/iac-cd-bench PR #49's head commit). See lex00/iac-cd-bench#55 ("fourth upstream item") for the fuller writeup.

Open design question (not a proposed fix): should build-level post-synth checks like WK8505 get an opt-in project-level mode that can see across build roots, or should the docs just state the single-build assumption explicitly so authors know the check won't catch a split-root miss? Filing this as a design discussion rather than a bug, since WK8505 is already deliberately a warning (not error) for exactly this reason.

Activity

  1. added
    area:k8s
    design
    on Aug 25, 2026
  2. lex00 commented on Aug 26, 2026

    @lex00
    ContributorAuthor

    Design memo (2026-08-26) — proposed decision for maintainer ratification.

    Recommendation: both halves, sequenced. Document the single-build assumption now; add an opt-in project-level pass later, built on existing per-root artifacts rather than a combined mega-build — and gate that pass on #975.

    Why docs alone aren't enough: WK8505's failure mode is structural silence in exactly the configurations where the check matters most. Committed-encrypted secrets in a real estate almost always live in split-root projects (the iac-cd-bench golden project split its roots for good reasons), so the check's value asymptotically approaches zero as the project matures. A documented limitation makes that honest but not useful.

    Why not make WK8505 itself smarter per-root: the docstring already names the core problem — no path-to-build-target join exists inside one invocation, and inventing one per-check would be a heuristic. The information genuinely lives at the project level.

    Proposed shape for the project-level mode:

    1. A check opts in by declaring project scope (e.g. scope: "project" alongside the existing check metadata). Build-scoped behavior stays the default; nothing changes for existing checks.
    2. Project-scoped checks run in a separate invocation that already knows the build roots — the natural host is the estate machinery (OperatorStack/ConvergeOp already enumerate per-environment builds; collectBuildRootContributors exists in build.ts). The runner builds (or reads the Build Archive of) each root and hands the check a PostSynthContext whose outputs is the union across roots, with each entry tagged by root so findings can say where the wiring was found or missed.
    3. Parsed-output view (ctx.docs) for post-synth checks and org policies #975's ctx.docs is the right substrate — a project-scoped check should iterate parsed docs across roots, not re-parse per-root YAML. Land Parsed-output view (ctx.docs) for post-synth checks and org policies #975/Migrate k8s post-synth checks onto ctx.docs (drop parseK8sManifests) #976 first, then this rides on it.
    4. WK8505 becomes the reference migration: per-root it keeps its warning-with-caveat; project-scoped it can say definitively "no Kustomization in ANY root sets spec.decryption for this secret" and upgrade its confidence accordingly.

    Near-term action regardless of ratification: add the single-build assumption to the post-synth-checks authoring docs and WK8505's rule docs, since that's true today and cheap.

    If ratified, the implementation is a separate issue (project-scope metadata + estate-level runner + WK8505 migration); this issue can then close as decided.

  3. lex00 commented on Sep 7, 2026

    @lex00
    ContributorAuthor

    The docs half landed in #2208 (f065e60): the post-synth-checks authoring page states the single-build-root assumption, and WK8505's description and remediation carry the caveat on both generated reference pages. What remains here is the design question itself, whether checks like this get an opt-in project-level mode across build roots.

  4. lex00 commented on Oct 23, 2026

    @lex00
    ContributorAuthor

    Maintainer ruling (2026-10-23)

    Post-synth checks get an opt-in cross-build-root mode. A check declares that it reads across build roots, and it's off by default, so level 0 never pays. This unblocks #2554 and #2549, and through them #2525 and terragucci#753's cross-repo ordering.

  5. lex00 commented on Oct 24, 2026

    @lex00
    ContributorAuthor

    Landed on integration/chant-goal in 4a0bb79 (merge of d890e7f), per the 2026-10-23 ruling.

    A check declares scope: "cross-root" and becomes a CrossRootCheck. Only runCrossRootChecks(checks, roots, { env?, activityContracts? }) runs it, over roots the caller has already built ({ root, dir?, env?, buildResult }). chant build, chant lint, lint.policies and the check-barrel discovery skip it, so level 0 pays nothing. The context gives roots (one PostSynthContext per root), root(name), and lazy root-tagged docs and entities. Findings carry root. Lexicons ship these from a new plugin member, crossRootChecks(). Docs: lexicon-authoring/post-synth-checks. #2554 and #2549 can now build on it. WK8505 hasn't been migrated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:k8sdesign

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions