mostlyright.core.source_identity
Canonical home for the assert_source_identity source-pinning check.
assert_source_identity validates source identity; it is not a “mode”. Its
implementation lives here and is re-exported from mostlyright.core, so
callers reach it as from mostlyright.core import assert_source_identity
without touching the deprecated mostlyright.mode2 path.
Imports run one way: core defines the function and the deprecated mode2
module imports it for backward compatibility. The reverse (core importing
mode2) would be a partial-initialization cycle, because mode2 already
imports mostlyright.core.exceptions at module load.
Functions
Section titled “Functions”| Function | Description |
|---|---|
assert_source_identity(df, expected_source, *) | Raise SourceMismatchError if any row’s source != expected. |
mostlyright.core.source_identity.assert_source_identity(df, expected_source, , role=‘observations’)
Section titled “mostlyright.core.source_identity.assert_source_identity(df, expected_source, , role=‘observations’)”Raise SourceMismatchError if any row’s source != expected.
A defense-in-depth per-row check: it repeats the per-row check in
mostlyright.core.validator.validate_dataframe() at the point where a
source-pinned fetch is dispatched, so callers get a role-specific error
message when a pinned single-source frame carries a foreign row.
- Parameters:
- Raises:
SourceMismatchError – when one or more rows carry a
sourceother thanexpected_source. - Return type:
None