nf-core / nf-core/nft-utils

sanitizeOutput still hashes the CWD for empty strings in 1.1.1

Open
#87 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
13
Forks
11
Avg merge
1d 16h
Merged PRs (30d)
6

Description

Summary

sanitizeOutput() / OutputSanitizer.recursiveParse treats every String as a filesystem path. In nft-utils 1.1.1 (latest release) an empty string becomes the current working directory:

java.nio.file.Path path = Paths.get(strValue);
if (Files.isDirectory(path)) {
    // recursively list + hash children
}

Paths.get("") is the CWD, Files.isDirectory is true, and the sanitizer walks the whole tree (.git, plugin caches, conda/pixi envs, …). Nested copies of that listing then explode workflow snapshots.

Reproducer

Any sanitizeOutput() of a map/channel that contains "", for example an unset BAM @RG CN stored as an empty string:

assert snapshot(sanitizeOutput([meta: [CN: '']])).match()

In nf-cmgg/preprocessing this turned tests/workflows/preprocessing.nf.test.snap into a ~27 MB file. readgroup.CN was a recursive MD5 listing of the repo, repeated on every FASTP emit that still carried sample meta.

Expected

Leave empty / non-path strings alone. Only walk a value when it is actually an output directory.

Related

This is the same root cause as #84. The empty-string guard landed on main in #85 (if (strValue.isEmpty()) return IGNORE) after 1.1.1 and has not been released.

Please cut a 1.1.2 that includes #85.

Remaining gap on main

#85 only skips empty strings. Any other relative directory name still matches Files.isDirectory and is walked, including ".", "..", and names that happen to exist in the test CWD ("docs", "conf", …). A safer check would require an absolute path (or otherwise look like a pipeline output path) before recursing.

Contributor guide

No contributing guide indexed for this repository

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 at OutputSanitizer.recursiveParse and reproduce the empty-string case with the sanitizeOutput assertion shown in the issue. Check the existing empty-string handling from #85 and define the remaining path cases to cover; done means empty and non-path strings are left alone and output directories are sanitized without recursively walking unrelated directories.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.