Repository navigation
feat(catalog): export human-readable control names and categories - #441
Merged
Merged
Conversation
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.
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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):ControlMetagainsDisplayNameandCategory, filled for all 66 controls.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 byTestControlCategoriesFollowTheCodeBlocks. One addition the site does not document yet:Repository Hygienefor the benched 9xx block (rename the one constant if the site later chooses another heading).configuration.ControlsCatalog()(sorted, defensively copied, includes the per-control provider applicability that was previously unexported) andconfiguration.ControlMetaFor(name). Issue-type display names were already programmatically reachable viacontrol.LookupCode(...).Title; the outputs now carry them too.Outputs, verified e2e on real runs against the mock GitLab/platform:
plumber-report.jsoncontrol blocks:{"controlName": "cicdVariablesMustBeProtected", "name": "CI/CD variables must be protected", "category": "CI/CD Variables", ...}.{"code": "ISSUE-201", "title": "CI/CD settings variable is not protected", ...}next to the existingdocUrl.{"control": "...", "name": "...", "category": "..."}, additive (the platform ignores unknown fields).ControlMetaForis 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).
ControlsCatalogcarries a named deadcode-gate exemption in the Makefile + ci.yml, same reasoning as the existingfinding/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