Skip to content

candidate_summary_card validator accepts lowercase sequences but its test requires rejection (code-vs-test conflict) #842

Open

Description

@cschanhniem

Summary

tests/evidence/test_candidate_summary_card.py::test_lowercase_sequence_fails fails on main. It asserts a lowercase sequence must fail validation (assert not result.passed), but validate_candidate_summary_card passes it.

This was hidden until now because CI's pytest step aborted at collection (fixed in #841). This test fails on unmodified main.

Root cause

src/openamp_foundry/evidence/candidate_summary_card.py:79:

invalid_chars = set(entry.sequence.upper()) - VALID_AMINO_ACIDS

The validator uppercases the sequence before checking it against VALID_AMINO_ACIDS, so a lowercase sequence like "kwklfkkiek" normalizes to valid characters and passes. The test expects the opposite.

Why this needs a decision (not a blind fix)

There is a genuine conflict about intended behavior:

  • The validator's own code (.upper()) is written to accept/normalize lowercase.
  • Its own test demands rejection.
  • src/openamp_foundry/qc/presynth_check.py:208 also does seq.upper().strip() — i.e. normalizes (accepts) lowercase elsewhere in the codebase.
  • docs/evidence/GUIDE_SEQUENCE_VALIDATION.md:9 states "Sequence is uppercase."

So either:

  • (a) the validator should reject non-uppercase input (add an explicit entry.sequence == entry.sequence.upper() check) — matches the test and the guide, but diverges from presynth_check's normalize-and-accept behavior; or
  • (b) the test is stale and lowercase should be accepted/normalized — matches the code and presynth_check, but contradicts the guide.

Both are defensible. Picking one changes validation semantics, so it needs an owner's call, not an agent guess.

Repro

pip install -e ".[dev]"
python -m pytest tests/evidence/test_candidate_summary_card.py::test_lowercase_sequence_fails

Introduced in #820 (Phase L L3 candidate summary card).

Activity

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions