Skip to content

studiobench: ab_plan rows are silently dropped by the header section collapse in assemble_rows #9580

Closed

Description

@danielhanchen

What happens

report/payload.py::assemble_rows routes rows into sections via ROW_TYPE_SECTIONS, then collapses the header section to its first element:

"header": sections.get("header", [{}])[0] if sections.get("header") else {},

Two row types map to header:

ROW_TYPE_SECTIONS: Mapping[str, str] = {
    "run_meta": "header",
    ...
    "ab_plan": "header",
}

run_meta is emitted first and ab_plan is emitted "before the first cell", so the section is [run_meta, ab_plan] and the [0] keeps only run_meta. The ab_plan row is dropped from the assembled payload without a warning, and record_counts reports header: 2 while the payload carries one row.

Why it is latent rather than breaking

Nothing currently reads ab_plan out of the assembled payload. Both consumers scan the raw row stream instead:

  • __main__.py:1796 filters row_type not in ("run_meta", "ab_plan", "cell")
  • __main__.py:1835 reads treatment_ref off the raw ab_plan row

So the loss is invisible today. It becomes a real defect the moment anyone reads payload["header"] expecting the A/B ordering to be there, which is exactly what the field comment invites:

# Bookkeeping about HOW the A/B was run, not a measurement of the app. It belongs beside the
# identity fields so a reader can see whether the order was balanced without digging.

The comment describes an intent the assembly step does not deliver. ab_plan records whether the run order was balanced, which is how a reader establishes that linear drift cancelled. A reader who trusts the comment gets {} and cannot distinguish that from "the order was not recorded".

How it was found

While mapping comparability and cell_aborted into ROW_TYPE_SECTIONS. Filing comparability under header was the obvious placement and would have been silently swallowed the same way.

Suggested fix

Either give ab_plan its own section and surface it as a payload key, or keep the mapping and make the collapse explicit about only ever taking run_meta. The current form is a mapping that claims a destination and a reader that discards it.

Worth checking at the same time that no other row type gets added to header on the assumption that the section is a list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions