[Bug]: analytical-method-validation accepts or rejects the same record depending on whether it is supplied as JSON or CSV

Author: aniruddhaadak80Created Sep 30, 2026Updated Sep 30, 2026

What happened

parse_rows() in skills/analytical-method-validation/scripts/_common.py normalises the CSV branch and not the JSON branch:

python
# CSV
rows.append({(k or "").strip(): (v or "").strip() for k, v in row.items()})
# JSON
rows.append({str(k): "" if v is None else str(v) for k, v in item.items()})

So the same logical record is accepted or rejected depending only on which of the two documented input formats it arrived in.

What you expected instead

Identical treatment, so a padded header is normalised whichever format it arrives in.

Steps to reproduce

python
import json, importlib.util, sys

NAME = "amv_common"
spec = importlib.util.spec_from_file_location(
    NAME, "skills/analytical-method-validation/scripts/_common.py")
common = importlib.util.module_from_spec(spec)
sys.modules[NAME] = common          # dataclasses resolution needs this
spec.loader.exec_module(common)

from_json = common.parse_rows(json.dumps([{" level": 50, "response": 10100}]))
from_csv  = common.parse_rows(" level,response
50,10100
", path_hint="x.csv")

print(list(from_json[0].keys()))    # [' level', 'response']
print(list(from_csv[0].keys()))     # ['level', 'response']

common.require_columns(from_json, ["level", "response"])
common.require_columns(from_csv,  ["level", "response"])

Error output

The JSON call raises on the second line:

InputError: missing required column(s): level; found:  level, response

The CSV call returns normally. The same data, one accepted and one rejected.

Values are affected the same way:

JSON  "response": " 10100 "  ->  ' 10100 '
CSV    response:  10100     ->  '10100'

to_float strips before calling float(), so numeric cells happened to survive — which is likely why this went unnoticed — but string cells such as a named level or a sample id would keep their padding.

Why it matters

Six scripts read rows through parse_rows: check_response, check_accuracy_precision, check_detection_limits, compare_methods, check_bioanalytical_run and plan_validation. A user who exports their instrument output to JSON instead of CSV can get missing required column(s) for a column the file visibly contains, with no hint that whitespace is the cause.

Environment

  • Agent host: n/a (ran the script directly)
  • Model: n/a
  • Repository version or commit: 065b734 (main)
  • Python version: 3.12.10
  • Operating system: Windows 10

A fix is proposed alongside that applies the same normalisation to the JSON branch, keeping the existing None -> "" mapping intact.

Source: K-Dense-AI/scientific-agent-skills