Skip to content

Various AI agent-generated fixes - #348

Merged
jakobnissen merged 9 commits into
BioJulia:masterfrom
jakobnissen:fixes
Aug 30, 2026
Merged

Various AI agent-generated fixes#348
jakobnissen merged 9 commits into
BioJulia:masterfrom
jakobnissen:fixes

Conversation

@jakobnissen

Copy link
Copy Markdown
Member

Had an AI agent review bugs in the codebase. I will fix them over a period of time, then merge.

@codecov

codecov Bot commented Aug 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.83333% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.12%. Comparing base (95d9218) to head (540ce61).
⚠️ Report is 28 commits behind head on master.

Files with missing lines Patch % Lines
src/biosequence/biosequence.jl 93.75% 1 Missing ⚠️
src/geneticcode.jl 90.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #348      +/-   ##
==========================================
+ Coverage   90.87%   92.12%   +1.24%     
==========================================
  Files          31       29       -2     
  Lines        2400     2857     +457     
==========================================
+ Hits         2181     2632     +451     
- Misses        219      225       +6     
Flag Coverage Δ
unittests 92.12% <95.83%> (+1.24%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Had an AI agent fix up grammar, typos and formatting.
GeneticCode is an AbstractDict{UInt64, AminoAcid}, and exposes a getindex
function which does not boundscheck, thereby exposing UB.
I think this issue is a smell of a deeper design issue with GeneticCode: If it
is an AbstractDict, why is the key an undocumented and internal encoding?
Why is GeneticDict private? How can users make their own?

Here, do a bandaid solution. We fix it properly in a breaking release.
When matching empty strings in sequence search, an edge case meant that the
search could not advance, resulting in an infinite loop.
Always advance the search even for zero-length results.
Fix issue where join! on unknown-sized iterators did not shrink the target
sequence after joining.
Also redesign it: Assume AbstractArray, AbstractSet and Tuple are stateless,
and for all other iterables, collect the iterable first. Then, precompute the
full length, copy in the content and verify the size matches.
E.g. `findnext(!=(DNA_A), rna"A")` should just return 1 without searching
the RNA because DNA is unencodable in the RNA alphabet.
Previously, this would mutate the sequence and then throw when attempting to
resize!. Now, add a method that throws up front.
This does not solve the problem generally for non-resizable BioSequences, but
I don't think there is a good way to address that. At least we can add this
safety check even while not solving it generically.
GeneticCode subtypes AbstractDict, and so must yield Pairs.
This was documented but not actually implemented. Implementation is trivial.
@jakobnissen
jakobnissen marked this pull request as ready for review August 30, 2026 14:10
@jakobnissen
jakobnissen merged commit 9983db7 into BioJulia:master Aug 30, 2026
22 checks passed
@jakobnissen
jakobnissen deleted the fixes branch August 30, 2026 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant