Skip to content

feat(catalog): export human-readable control names and categories - #441

Merged
thomasboni merged 2 commits into
mainfrom
feat/export-control-display-metadata
Sep 1, 2026
Merged

thomasboni merged 2 commits into
mainfrom
feat/export-control-display-metadata

Conversation

@thomasboni

Copy link
Copy Markdown
Contributor

Closes #440.

Every surface identified controls and issue types only by their technical name, so every consumer hand-built a technicalName -> "Branch must be protected" map that silently drifted on each release. The display metadata now ships with the results, from one exported table. Technical ids stay the stable keys everywhere; the new fields are additive and display-only (per Thomas's ruling on the issue).

The exported table (configuration):

  • ControlMeta gains DisplayName and Category, filled for all 66 controls.
  • Categories are the docs catalog's own headings (getplumber.io/docs/cli/controls), verbatim: CI/CD Container Images, CI/CD Variables, CI/CD Secrets, Pipeline Composition, Access and Authorization, Security Source, Third-party Actions, Workflow Triggers and Permissions. Each control's category follows its issue-code block (1xx images ... 8xx triggers), pinned by TestControlCategoriesFollowTheCodeBlocks. One addition the site does not document yet: Repository Hygiene for the benched 9xx block (rename the one constant if the site later chooses another heading).
  • New embedder accessors: configuration.ControlsCatalog() (sorted, defensively copied, includes the per-control provider applicability that was previously unexported) and configuration.ControlMetaFor(name). Issue-type display names were already programmatically reachable via control.LookupCode(...).Title; the outputs now carry them too.

Outputs, verified e2e on real runs against the mock GitLab/platform:

  • plumber-report.json control blocks: {"controlName": "cicdVariablesMustBeProtected", "name": "CI/CD variables must be protected", "category": "CI/CD Variables", ...}.
  • Issue rows: {"code": "ISSUE-201", "title": "CI/CD settings variable is not protected", ...} next to the existing docUrl.
  • Platform push findings: {"control": "...", "name": "...", "category": "..."}, additive (the platform ignores unknown fields).
  • PBOM/CycloneDX name no controls today (their compliance sections key on issue codes as booleans), so there is nothing to decorate there; the day one grows a control listing, ControlMetaFor is the source.

Guards: completeness test (every control has a non-empty name and a closed-set category), the code-block derivation test, and a drift test pinning that a control's exported name matches its terminal catalog wording (the per-run computed forbidden-tags name and the per-provider Pipeline-vs-Workflows wordings are the two documented tolerances, and the test fails loudly if the catalogs ever build zero entries so it can never go vacuous). ControlsCatalog carries a named deadcode-gate exemption in the Makefile + ci.yml, same reasoning as the existing finding/identity/ exemption: an embedder surface with no in-repo caller by design, pinned by tests.

Verified: full go test ./... green, golangci-lint 0 issues, the exact CI deadcode step reproduced clean, and both e2e modes show the fields on the wire.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DzQcbUy6pBGj3sgVaXV5jo

Every surface identified controls and issue types only by technical
name, so every consumer hand-built a technicalName-to-display map that
drifted on each release. The display metadata now ships with the
results, from one exported table; technical ids stay the stable keys
everywhere, the new fields are additive and display-only.

- configuration.ControlMeta gains DisplayName and Category, filled for
  all 66 controls. Categories are the docs catalog's own headings
  (getplumber.io/docs/cli/controls), verbatim, derived from each
  control's issue-code block (1xx container images ... 8xx triggers and
  permissions), plus one Repository Hygiene heading for the benched 9xx
  block the site does not document yet.
  TestControlCategoriesFollowTheCodeBlocks pins the derivation.
- New module accessors for embedders: configuration.ControlsCatalog()
  (sorted, copied) and configuration.ControlMetaFor(name). Issue-type
  display names were already exported through control.LookupCode's
  Title. ControlsCatalog carries a named deadcode-gate exemption
  (Makefile + ci.yml), same reasoning as the finding/identity package:
  an embedder surface with no in-repo caller by design, pinned by tests.
- plumber-report.json: every control block carries name and category
  next to controlName; every issue row carries title (the code
  registry's docs wording) next to code.
- The platform push findings carry name and category next to control,
  additively (the platform ignores unknown fields).
- Terminal display names and the exported table are drift-pinned:
  a control's exported name must be one of its catalog wordings (the
  per-run computed forbidden-tags name and the per-provider
  Pipeline-vs-Workflows wordings stay as they are).

PBOM and CycloneDX name no controls today (their compliance sections
key on issue codes as booleans), so there is nothing to decorate there;
the day one grows a control listing, ControlMetaFor is the source.
Comment thread cmd/platform_push.go Resolved
…all three finding branches

The review thread's point: the decoration was only tested through the
helper in isolation, so reverting any platformFindingsFor branch to a
bare literal - or the fail branch's LookupCode-based control-name path
returning an unregistered name - would drop Name/Category from the push
silently. The integration test now asserts both fields on the decoded
body for the fail, pass and not_evaluable branches against the exported
catalog, pinning the real wiring at the wire level.
@thomasboni
thomasboni merged commit 2dbf0c5 into main Sep 1, 2026
16 checks passed
@thomasboni
thomasboni deleted the feat/export-control-display-metadata branch September 1, 2026 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Export human-readable control names and categories in reports and the module API

1 participant