Skip to content

refactor(exporters): read typed ident, CCI and metadata mappings in the engine - #62

Merged
aaronlippold merged 2 commits into
nextfrom
refactor/fh9l8-typed-ident-metadata
Nov 19, 2026
Merged

aaronlippold merged 2 commits into
nextfrom
refactor/fh9l8-typed-ident-metadata

Conversation

@aaronlippold

Copy link
Copy Markdown
Member

The engine now reads the style model that ConfigLoader validated for the ident, CCI lookup and metadata mappings, instead of dicts with a default at each .get().

  • ConfigLoader.load hands back the StyleConfig built by its last check (the merged style) as MappingConfig.style. There is no second validation. MappingConfig itself goes in cis-bench-fh9l.9.
  • These take their mapping's model: generate_idents_from_config, generate_metadata_from_config, _build_config_element, _metadata_attributes, _cci_service, get_ccis_with_deduplication and the metadata-holder setup. map_rule passes the typed mapping to the ident and metadata builders.
  • .get() calls in those methods went from 28 to 2. The two left read metadata and cci_deduplication, not field mappings. The whole file went from 101 to 74.
  • The defaults are now stated once, in the models, with the same values: every transform is "none", an ident's system_template is "" and its value_template "{item}", an ident attribute's template is "", and cci_lookup.extract is "all". The published style JSON Schema now shows these defaults, and no longer lists null for them; null was already refused.
  • StyleConfig.cci_lookup returns the cci_lookup of the mapping named ident, as the engine read it before.
  • The engine's "ident attribute needs a name" check is removed, because the schema already refuses a missing name when the style loads.
  • An ident mapping with an empty source_field or an empty ident_spec still writes no ident (measured on next); a new test covers both.

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.8. The map_rule dispatch and the remaining builders are cis-bench-fh9l.14.

…he engine

ConfigLoader.load hands back the StyleConfig its last check built (the
merged style) as MappingConfig.style. The ident, CCI lookup and metadata
builders take their mapping's model: generate_idents_from_config,
generate_metadata_from_config, _build_config_element, _metadata_attributes,
_cci_service, get_ccis_with_deduplication and the metadata holders.

The defaults those reads carried are stated once in the models: every
transform defaults to "none", an ident's system_template to "" and its
value_template to "{item}", an ident attribute's template to "", and
cci_lookup.extract to "all". The ident's missing-name check goes: the
schema refuses an ident attribute without a name when the style loads.

The 28 exports are byte-identical.

Refs: cis-bench-fh9l.8
Signed-off-by: Aaron Lippold <lippold@gmail.com>
…tes no ident

Refs: cis-bench-fh9l.8
Signed-off-by: Aaron Lippold <lippold@gmail.com>
@aaronlippold
aaronlippold merged commit 6913938 into next Nov 19, 2026
7 checks passed
@aaronlippold
aaronlippold deleted the refactor/fh9l8-typed-ident-metadata branch November 19, 2026 19:36
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