scverse / scverse/rustar-aligner

Audit: does DashMap/HashMap iteration order in the splice-junction path reach any output?

Open
#210 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Rust
Stars
75
Forks
7
Avg merge
8m
Merged PRs (30d)
1

Description

Not a new dependency: a question about the semantics of one we already have.

Observation

src/junction/sj_output.rs stores splice-junction counts in a DashMap<SjKey, SjCounts> and
exposes iter() (:342). filter_novel_junctions (src/junction/mod.rs:166-233) consumes that
iterator and .collect()s into a Vec<(NovelJunctionKey, JunctionInfo)>. A DashMap iteration
visits shards in an order that depends on hashing and on concurrent insertion, so the order of
that Vec is not guaranteed stable across runs or thread counts
.

Downstream, insert_novel (:145) inserts each entry into a HashMap<JunctionKey, JunctionInfo>,
which is order-insensitive for the map's contents. So the question is not whether the map ends up
the same, it is whether anything downstream ever observes an order derived from either of those
containers: two-pass SJ insertion into the genome/SA, SJ.out.tab emission, or any numbering /
indexing assigned in traversal order.

This may well be clean already. It should be verified and then locked, rather than left as an
assumption, because it is precisely the class of bug that reproduces only under load and only on
some machines.

Checklist

  • Trace every consumer of SpliceJunctionStats::iter() and of the HashMap in
    SpliceJunctionDb to the point where an order could become observable
  • If an order does escape: sort on an explicit total key (chr, start, end, strand) at the
    boundary, not deeper
  • Add a test running two-pass mode at two different thread counts and comparing the SJ outputs
    and the resulting index bytes
  • Same audit for any other HashMap/DashMap whose iteration reaches output

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/junction/sj_output.rs at SpliceJunctionStats::iter() and trace filter_novel_junctions in src/junction/mod.rs:166-233, then follow SpliceJunctionDb's HashMap through two-pass insertion and SJ.out.tab emission. Compare two-pass runs at different thread counts, including SJ outputs and index bytes; done means any escaping order is explicitly sorted or verified irrelevant, with tests added for the result.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
bioinformatics, testing
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.