topmark.config.resolution.bridge¶
topmark / config / resolution / bridge
Bridge helpers between TOML source resolution and config draft construction.
This module defines the small public bridge between TOML-side source
resolution (topmark.toml.resolution) and config-side draft construction.
It performs no per-path applicability checks and no runtime override
application.
Its diagnostics role is to replay source-level TOML validation issues into the merged config draft's TOML-source validation stage so later staged config/preflight validation sees the full config-loading diagnostic picture.
ResolvedConfigDraft
dataclass
¶
Resolved TOML-side state and the mutable config draft built from it.
Attributes:
| Name | Type | Description |
|---|---|---|
resolved |
ResolvedTopmarkTomlSources
|
Resolved TOML-side state, including source provenance, writer options, and TOML-side strictness. |
draft |
MutableConfig
|
Mutable config draft produced by merging the resolved config layers. |
build_mutable_config_from_resolved_toml_sources ¶
Merge resolved TOML sources into one mutable config draft.
This helper consumes already-resolved TOML-side state and performs the config-layer construction and merge step without re-running TOML discovery.
In addition to merging the layered config fragments, it replays whole-source
TOML schema validation issues collected during TOML loading into the merged
draft's TOML-source validation stage. This ensures that the effective
strictness derived from strict sees schema issues outside
the layered-config subset, such as invalid top-level keys under
[tool.topmark], unknown keys in [writer], or TOML-layer missing-section
INFO diagnostics.
Source-local config-loading options such as strict are
resolved on the TOML side. This helper only performs config-layer
construction, merging, and diagnostic aggregation; it does not re-run TOML
schema validation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
resolved
|
ResolvedTopmarkTomlSources
|
Resolved TOML-side state for the current run. |
required |
Returns:
| Type | Description |
|---|---|
MutableConfig
|
Merged mutable config draft built from the defaults layer plus all |
MutableConfig
|
resolved layered TOML sources, with source-level TOML schema issues |
MutableConfig
|
replayed into its TOML-source validation stage for later staged |
MutableConfig
|
config/preflight validation. |
Source code in src/topmark/config/resolution/bridge.py
resolve_toml_sources_and_build_mutable_config ¶
resolve_toml_sources_and_build_mutable_config(
*,
input_paths=None,
extra_config_files=None,
strict=None,
no_config=False,
)
Resolve TOML sources once and build the merged config draft from them.
This helper is the preferred bridge between TOML-side source resolution and config-layer merge for callers that need both the resolved TOML-side state and the merged mutable config draft.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_paths
|
Iterable[Path] | None
|
Optional discovery anchors. The first path is used to pick the project-discovery starting directory. If it points to a file, its parent directory is used. If omitted, discovery falls back to the current working directory. |
None
|
extra_config_files
|
Iterable[Path] | None
|
Explicit config files to merge after discovered layers. Later files override earlier ones. |
None
|
strict
|
bool | None
|
Optional explicit override for the TOML-side strictness preference that later governs staged staged config-loading validation. |
None
|
no_config
|
bool
|
If |
False
|
Returns:
| Type | Description |
|---|---|
ResolvedConfigDraft
|
Resolved TOML-side state and the merged mutable config draft built from it. |
Source code in src/topmark/config/resolution/bridge.py
resolve_default_template_and_build_mutable_config ¶
Resolve the bundled init template and build its config draft.
This helper is intended for machine-readable topmark config init output.
It consumes the bundled template text, or the generated fallback text when
the bundled template cannot be read, and replays that fallback error into
the returned config draft diagnostics.
Human output should continue to render the template text directly so comments and formatting are preserved.
Returns:
| Type | Description |
|---|---|
ResolvedConfigDraft
|
Resolved TOML-side state and mutable config draft built from the bundled |
ResolvedConfigDraft
|
init template. |
Source code in src/topmark/config/resolution/bridge.py
resolve_default_table_and_build_mutable_config ¶
Resolve the built-in default TOML table and build its config draft.
This helper is intended for machine-readable topmark config defaults
output. It uses the code-defined canonical default TOML table rather than
the annotated starter template used by topmark config init.
Returns:
| Type | Description |
|---|---|
ResolvedConfigDraft
|
Resolved TOML-side state and mutable config draft built from the canonical |
ResolvedConfigDraft
|
default TOML table. |