Skip to content

Test membership invariants for local research transformations

Use operation-specific assertions to catch silent row loss and unintended expansion.

Guides

Test membership invariants for local research transformations — what should the operator record?

A file that parses is not necessarily a faithful transformation of its input. Define invariants appropriate to the operation: a sort preserves membership, a filter explains exclusions and a flattening step preserves parent relationships. These checks expose operational mistakes without asserting that the underlying returned evidence is complete or independently true.

Practical operations check
Use operation-specific assertions to catch silent row loss and unintended expansion.
Record operation_type, input_grain and output_grain in the validation contract. Do not require equal row counts universally; instead specify the identity relationship that the actual operation should preserve or intentionally change, using qualified keys and permitted lineage references rather than display labels.
Publish which invariants ran and their observed outcomes for the exact artifact revision. Passing these checks supports operational faithfulness to the declared input, not a guarantee of population coverage, source accuracy or permission for every possible recipient to view the derived table.
01 / Guides

Declare expected behavior

Record operation_type, input_grain and output_grain in the validation contract. Do not require equal row counts universally; instead specify the identity relationship that the actual operation should preserve or intentionally change, using qualified keys and permitted lineage references rather than display labels.

02 / Guides

Choose membership assertions

For a projection, compare key multisets; for a filter, require each output key to belong to the eligible input; for expansion, verify parent references. Keep multiplicity checks where repeated observations are valid rather than reducing every assertion to simple distinct-key equality by convenience.

03 / Guides

Test meaningful failures

Use labeled fixtures with a dropped row, duplicated key and orphaned child. Each should fail the relevant invariant with a specific reason, proving the checks can detect actual contract violations rather than merely affirming that a well-formed example produces some output.

04 / Guides

Inspect actual violations

Attach failing key references and operation revision to a restricted exception artifact. Separate intended exclusions from unexplained loss, and do not repair the validation report by altering expected counts to match whatever the transformation happened to emit on its first run.

05 / Guides

Release with tested assertions

Publish which invariants ran and their observed outcomes for the exact artifact revision. Passing these checks supports operational faithfulness to the declared input, not a guarantee of population coverage, source accuracy or permission for every possible recipient to view the derived table.

Keep the boundaries clear.

  • Use operation-specific assertions to catch silent row loss and unintended expansion.
  • Operational record: Declare expected behavior. Context badges do not certify access.

Start with a read-only check: ask your agent to report actual source coverage before collecting records or exporting an audience.

Primary references

Documentation reviewed 2026-11-15. Product capabilities, client availability and plans can change. Third-party marks identify their products, not an affiliation.

Know what social media shows about you.
Start with a question.

Get started
montage