Skip to content

Cross‐Language Conformance

Danny edited this page Aug 20, 2026 · 1 revision

Cross-Language Conformance

Assurance infrastructure is only useful if its own behavior is predictable.

DProvenanceKit therefore treats cross-language consistency as part of the reliability model.

The Python and Swift implementations are intended to share a common behavioral contract rather than evolving as unrelated libraries with similar names.


Why Conformance Matters

Consider a trace produced in one implementation and evaluated in another.

If the implementations disagree about:

  • event representation,
  • canonical ordering,
  • fingerprints,
  • query semantics,
  • alignment behavior,
  • or regression severity,

then the assurance result itself becomes implementation-dependent.

That weakens confidence in the evidence.

Cross-language conformance reduces that risk.


A Shared Behavioral Contract

The goal is not to make the Python and Swift codebases internally identical.

The goal is to make them agree where the shared behavioral model says they should agree.

That includes areas such as:

Event representation
        ↓
Canonical behavior
        ↓
Fingerprints
        ↓
Query semantics
        ↓
Alignment
        ↓
Regression verdicts

This creates a behavioral contract that both implementations can test independently.


Canonical Test Vectors

A practical way to maintain conformance is through canonical test vectors.

A vector defines:

Known input
    ↓
Expected interpretation
    ↓
Expected result

Each implementation runs the same case and verifies that it produces the same expected behavior.

For example:

Golden:
A → B → C

Candidate:
A → C

The implementations should agree that:

B is missing
      ↓
material structural change
      ↓
expected regression outcome

The important property is not merely that both libraries can parse the same data.

They should agree on what the data means.


Event Representation

The event model is the foundation of the assurance system.

If two implementations interpret the same event differently, every later operation may diverge.

Conformance therefore starts with shared expectations around:

  • event types,
  • priorities,
  • sequence,
  • payload representation,
  • identifiers,
  • and structural relationships.

Conceptually:

Same logical event
      │
      ├──────────────┐
      ▼              ▼
   Python          Swift
      │              │
      ▼              ▼
Equivalent interpretation

Canonical Ordering

Execution order matters.

If one implementation treats insertion order as authoritative while another treats an explicit sequence field as authoritative, the same run could produce different behavioral conclusions.

The shared contract therefore needs a consistent interpretation of ordering.

For example:

Input events:

sequence 3 → decide
sequence 1 → retrieve
sequence 2 → verify

A conforming implementation should interpret the logical execution as:

retrieve
   ↓
verify
   ↓
decide

The language-specific container order should not silently redefine the behavioral meaning.


Fingerprints

Fingerprints provide a compact representation of behavioral structure.

For fingerprints to be useful across implementations, both sides need to agree on what information participates in the fingerprint and how that information is normalized.

Conceptually:

Trace
  ↓
Canonical representation
  ↓
Fingerprint

The same canonical trace should produce the same expected fingerprint behavior regardless of whether the implementation is Python or Swift.

This matters when fingerprints are used for:

  • regression comparison,
  • baseline identification,
  • change detection,
  • or cross-platform analysis.

Query Semantics

A behavioral query should mean the same thing in every implementation.

For example, if a query expresses:

A occurred before B

both implementations should agree about what qualifies as before.

Similarly, compound queries should preserve shared semantics around:

  • AND,
  • OR,
  • missing steps,
  • sequence relationships,
  • and other supported predicates.

Without conformance here, a run could pass an assurance check in one implementation and fail the same logical check in another.


Alignment Semantics

Not every candidate event maps perfectly to a baseline event.

DProvenanceKit therefore uses alignment logic to reason about how two executions correspond.

A simplified example:

GOLDEN                   CANDIDATE

retrieve                 retrieve
   ↓                        ↓
verify                  verify_v2
   ↓                        ↓
decide                   decide

The question is not simply:

Are the event names identical?

The question may instead be:

Are these events equivalent enough under the configured alignment profile to represent the same behavioral step?

Cross-language conformance helps ensure that both implementations interpret these cases consistently.


Regression Verdicts

Alignment alone is not the final result.

A system also needs to interpret the difference.

For example:

Critical step removed
       ↓
Regression severity
       ↓
Gate result

If Python considers the change HIGH severity while Swift considers the same canonical case harmless, the assurance model is inconsistent.

Shared conformance vectors can pin the expected verdict.


Profiles and Policy

Different workflows may require different levels of strictness.

For example:

strict audit
developer debugging
semantic exploration

A conformance contract should preserve the meaning of those profiles across implementations.

The internal implementation can differ.

The observable behavioral result should remain consistent where the contract defines it.


Cross-Language Trace Portability

Conformance also improves the usefulness of traces across platforms.

For example:

Swift application
      ↓
Structured trace
      ↓
Shared behavioral semantics
      ↓
Python analysis / tooling

or:

Python application
      ↓
Structured trace
      ↓
Shared behavioral semantics
      ↓
Swift inspection / tooling

The goal is not merely compatible serialization.

The more important property is consistent interpretation.


Conformance Protects DProvenanceKit Itself

Cross-language testing is also an internal quality guardrail.

When one implementation changes, the conformance suite can reveal whether the behavior has unintentionally diverged from the shared contract.

That makes conformance useful for detecting regressions in DProvenanceKit itself.

Examples include changes to:

  • payload encoding,
  • fingerprints,
  • temporal query behavior,
  • alignment logic,
  • severity calculations,
  • or canonical event handling.

Implementation Independence

Python and Swift do not need to use the same internal architecture.

For example:

Python implementation
        │
language-specific storage
language-specific concurrency
language-specific APIs
        │
        ▼
Shared behavioral contract
        ▲
        │
Swift implementation
        │
language-specific storage
language-specific concurrency
language-specific APIs

This allows each implementation to use appropriate language and platform patterns without sacrificing shared behavioral meaning.


Why This Matters for Assurance

Behavioral assurance depends on interpretation.

If the interpretation changes unpredictably between implementations, then the assurance system becomes less trustworthy.

The chain should instead be:

Execution
   ↓
Structured trace
   ↓
Shared semantics
   ↓
Regression analysis
   ↓
Consistent result

Conformance helps stabilize that chain.


Conformance vs. Identical Implementation

These are not the same goal.

DProvenanceKit does not require:

Python code == Swift code

It requires:

Shared input
     ↓
Shared contract
     ↓
Equivalent observable behavior

That distinction keeps the implementations flexible while preserving interoperability where it matters.


The Core Principle

A behavioral assurance system should be able to explain not only:

What result did this implementation produce?

but also:

Would another conforming implementation interpret the same evidence the same way?

Cross-language conformance helps make the answer predictable.


Next