Skip to content

refactor(exporters): read the typed benchmark section in the engine - #65

Merged
aaronlippold merged 1 commit into
nextfrom
refactor/fh9l15-typed-benchmark-section
Nov 19, 2026
Merged

aaronlippold merged 1 commit into
nextfrom
refactor/fh9l15-typed-benchmark-section

Conversation

@aaronlippold

Copy link
Copy Markdown
Member

The engine now builds everything that comes from the style's benchmark section from the typed model it holds (MappingConfig.style), not the dict.

  • Builders: the notice, reference, plain text, Benchmark elements (the section's extra entries, typed SourcedElement), Benchmark id template and profile generation read the model. generate_profiles_from_rules takes Profiles and ProfileMapping.
  • Namespaces: MappingConfig.namespaces, which the exporter reads, now comes from style.benchmark.namespaces. The engine's Dublin Core prefix lookup reads it too. No .get() on benchmark-section data is left in src/cis_bench/exporters.
  • Defaults: a plain text's content defaults to "" in the model. The notice id terms-of-use, written when a style gives no id or an empty one, stays in the engine; the guide now says so.
  • Removed engine check: a profile mapping with its own id is already refused when the style loads, so the engine's check for it is gone.
  • Tests: tests that changed benchmark dicts now load a style file, or build the model where a style file cannot express the case (dropping an inherited namespace, replacing a whole notice). The source-text assertion on map_benchmark's loop is replaced by a test of what it writes.

Checks:

  • Full suite, tests/scripts, mypy, ruff and mkdocs build --strict pass.
  • All 28 exports (9 cached real benchmarks and 5 synthetic fixtures, DISA and CIS) are byte-identical to next and pass cis-bench validate.

Card: cis-bench-fh9l.15. The remaining sections and the removal of MappingConfig are cis-bench-fh9l.9.

The notice, matter, reference, plain text, Benchmark elements, Benchmark
id template and profile generation read the StyleConfig's benchmark
section; the exporter's and the engine's namespace reads take
style.benchmark.namespaces. generate_profiles_from_rules takes Profiles
and its mappings ProfileMapping.

A plain text's content defaults to "" in the model (the engine's default
before). The notice id "terms-of-use", written when a style gives no id or
an empty one, stays the engine's and the guide now says so. A profile
mapping with its own id is refused when the style loads, so the engine's
check for it is gone; an empty match still loads and is still refused at
export.

Tests that changed benchmark dicts now load a style file or build the
model; the source-text assertion on map_benchmark's loop is replaced by a
test of what it writes. The 28 exports are byte-identical.

Refs: cis-bench-fh9l.15
Signed-off-by: Aaron Lippold <lippold@gmail.com>
@aaronlippold
aaronlippold merged commit cf16c38 into next Nov 19, 2026
7 checks passed
@aaronlippold
aaronlippold deleted the refactor/fh9l15-typed-benchmark-section branch November 19, 2026 22:59
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.

1 participant