Skip to content

Serialization: missing cardinality in pre-existing tagged joins defaults to 'one' #223

@hachej

Description

@hachej

Problem

In src/boring_semantic_layer/serialization/reconstruct.py:264, the join reconstructor uses:

cardinality = metadata.get("cardinality", "one")

Before #217 added the cardinality field to extract_join, serialized joins never emitted cardinality. This means any persisted/cached tagged model created before that change will now deserialize join_many as join_one, potentially producing incorrect aggregation results.

Since bsl_version is still "2.0", from_tagged() has no way to distinguish old payloads from new ones.

Impact

Any persisted tagged expressions that used join_many or join_cross before #217 will silently change behavior after upgrading.

Suggested fix

Either:

  1. Bump bsl_version to "2.1" and treat missing cardinality in "2.0" payloads as "many" (safer default), or
  2. Default to "many" instead of "one" when cardinality is absent (since join_one is a strict subset of join_many behavior, but not vice versa)

Found by

Codex CLI review of #222.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions