mostlyright.core.source_identity
mostlyright.core.source_identity
Section titled “mostlyright.core.source_identity”Canonical home for the assert_source_identity source-pinning gate.
assert_source_identity is a source-identity VALIDATOR utility, not a “mode”.
Phase 30 (D-04) relocates its canonical implementation here from the deprecated
mostlyright.mode2 module and re-exports it from mostlyright.core, so
callers reach it as from mostlyright.core import assert_source_identity without
touching the deprecated module path.
Import direction is one-way: core DEFINES the function; mode2 back-imports
it for backward compatibility. The reverse (core importing mode2) would be
a partial-initialization cycle — mode2 already imports
mostlyright.core.exceptions at module load.
Functions
Section titled “Functions”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 gate: mirrors the per-row check in
mostlyright.core.validator.validate_dataframe() but at the
source-pinned dispatch layer so callers get a role-flavored 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