Skip to content

Write the _modified alignment beside the original when a parent folder contains its base name - #514

Merged
jtklein merged 2 commits into
AntonelliLab:masterfrom
jtklein-agents:340-write-modified-alignment-beside-original
Nov 24, 2026
Merged

jtklein merged 2 commits into
AntonelliLab:masterfrom
jtklein-agents:340-write-modified-alignment-beside-original

Conversation

@jtklein-agents

@jtklein-agents jtklein-agents commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Loading an alignment that needs renamed taxa failed with ENOENT … <name>_modified/<name>.fas whenever a parent folder contained the file's base name. String.replace rewrote the first match, which was the folder. This is the most-reported file error (upstream reports 194, 199, 200, 233, 248, 250, 274, 293, 312, 359, 379).

 // src/main/parseAlignment.ts
 if ( modified )
-  newFilePath = actualPath.replace( baseName, `${baseName}_modified` )
+  { dir, name, ext } = path.parse( actualPath )
+  newFilePath = path.join( dir, `${name}_modified${ext}` )
   write( newFilePath, alignment )

A second commit runs the unit tests in CI on macOS, Linux and Windows, and adds a yarn verify script:

 # .github/workflows/lint.yaml (ubuntu)
-  yarn react-test
+  yarn test
 # .github/workflows/build.yaml (macos-15, ubuntu-24.04, windows-latest)
   yarn
+  yarn test
   download-binaries

Evidence

  • Before: /tmp/abc/abc.fas with an illegal taxon name → written to /tmp/abc_modified/abc.fas (folder does not exist, ENOENT)
    After: written to /tmp/abc/abc_modified.fas; same for /tmp/abc ML/abc.fas → /tmp/abc ML/abc_modified.fas
it.each([abc/abc.fas, "abc ML"/abc.fas])
  parseAlignment(path) with taxon "A B"
  expect written path == path.join(dir, "abc_modified.fas")

yarn verify (lint, typecheck, tests): clean, 70 test files / 483 tests passed (macOS).

Merge Danger

Door: two-way

Revert restores the old path logic and CI steps; no data or file format changes.

Blast Radius: small

Only alignments that need renaming get a new path, and only when the folder name contained the base name did that path change. The new CI step can fail the release job on Windows or macOS if a test assumes POSIX paths; those tests have not yet run there.

🤖 Generated with Claude Code

jtklein-agents and others added 2 commits November 24, 2026 08:47
…r contains its base name (#340)

String.replace rewrote the first match of the base name, which could be a
parent folder, so the write went to a folder that does not exist (ENOENT).
Build the path from the directory and file name instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lint.yaml ran Vitest on Linux only, under the react-test alias. Path code
behaves differently on Windows, so build.yaml now runs yarn test on its
macOS/Linux/Windows matrix. yarn verify runs lint, the typecheck baseline
and the tests in one command.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jtklein-agents
jtklein-agents force-pushed the 340-write-modified-alignment-beside-original branch from 5561957 to c6f0dee Compare November 24, 2026 07:48
@jtklein
jtklein merged commit 013b630 into AntonelliLab:master Nov 24, 2026
7 checks passed
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.

2 participants