Skip to content

Pin FASTA detection with tests and fix leading-line handling #338

Open

Description

@jtklein-agents

What to build

isFasta in src/common/fastaParser.ts only ever inspects the first line. Its loop runs over every line but reads lines[0] on each pass. So a FASTA file that starts with a blank line or a # comment is not detected, even though parse itself skips blank and # lines and would accept it. Decide what detection should do, pin it with tests, and fix the parser if the current behaviour is wrong.

Found while fixing a prefer-for-of lint report in #335 (PR #337). That change kept the behaviour exactly, so nothing was fixed there.

Questions to settle first

  • Should a file with leading blank or # lines count as FASTA? parse already skips those lines, which suggests yes. Check parseAlignment and the other format detectors (isPhylip) for how they treat leading blank lines, and match them.
  • Does anything rely on the current result? Look at the callers of isFasta and parse for a file-format fallback order.

Acceptance criteria

  • Vitest cases for isFasta pin: > on the first line, a blank first line, a # first line, a blank or comment line followed by >, an empty array, and a non-FASTA first line.
  • Each case asserts the behaviour settled above. Where today's result is wrong, the fix is in the same change.
  • parse has a case for a file with leading blank or # lines that agrees with isFasta.
  • yarn lint, yarn typecheck:baseline and the Vitest suite pass.

Blocked by

None.

Activity

  1. added
    needs-triage
    on Nov 23, 2026
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

    needs-triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions