Skip to content

fix: handle empty V3000 bond block - #314

Merged
fbaensch-beilstein merged 2 commits into
devfrom
Fix/V3000EmptyBondBlock_GHI52
Nov 9, 2026
Merged

fbaensch-beilstein merged 2 commits into
devfrom
Fix/V3000EmptyBondBlock_GHI52

Conversation

@nnuk

@nnuk nnuk commented Nov 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

when COUNTS declares zero bonds, MolfileV3000ReadBondsBlock() skips bond parsing, leaving an explicitly empty BEGIN BOND / END BOND section unread. The change handles that optional section in MolfileV3000ReadTailOfCTAB() and adds regression coverage.

Type of change

  • feat — new feature (minor bump)
  • fix — bug fix (patch bump)
  • perf — performance improvement (patch bump)
  • BREAKING CHANGE — incompatible change (! in title or footer; major bump)
  • refactor / docs / chore / build / ci / test (no release)

Checklist

  • PR title follows Conventional Commits
  • Builds cleanly for both targets (./INCHI-1-TEST/build_with_cmake.sh all)
  • Compiles without new warnings on GCC/Clang/MSVC where applicable
  • Code follows .editorconfig (4-space indent, LF, no trailing whitespace)
  • Unit tests pass (ctest in the full_build test dir)
  • CLI tests pass (pytest INCHI-1-TEST/tests/test_executable)
  • New behavior is covered by tests
  • Public API / behavior changes are documented (Doxygen in headers + README/docs if applicable)

Related issues

Closes #52

@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Unit Test Coverage Report

Coverage Regression Summary

Metric PR (%) Base (%) Difference (pp)
Lines 34.3 34.3 +0.00
Branches 22.3 22.3 +0.00

Find details on the base coverage at https://iupac-inchi.github.io/InChI/coverage/index.html

Find details on this PR's coverage by downloading coverage-reports-42402321616 and opening html/index.html

@nnuk
nnuk requested a balanced review from Copilot November 7, 2026 18:42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues block the change supporting explicit empty bond blocks in zero-bond V3000 molfiles.

No open issues 🎉

What changed in this PR

Fixes issue #52 by allowing the V3000 molfile parser to accept an explicit empty bond block when COUNTS declares zero bonds.

Changes:

  • Consumes the optional empty bond block before parsing the remaining CTAB sections.
  • Enables the regression test, checks expected methane output, and adds coverage rejecting nonempty bond blocks with a zero bond count.
  • Documents the fix in the changelog.
File Description
INCHI-1-TEST/​tests/​test_executable/​test_github_52.py Verifies empty and omitted bond blocks succeed, while inconsistent bond data is rejected.
INCHI-1-SRC/​INCHI_BASE/​src/​mol_fmt3.c Handles the optional empty bond block during CTAB tail parsing.
INCHI-1-DOC/​CHANGELOG.md Records the fix for issue #52.

Review effort: Balanced

@fbaensch-beilstein fbaensch-beilstein left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed and verified: CLI and libinchi tests pass, no regression diffs, and the MSVC build passes on Windows (dry-run release). Thanks!

@fbaensch-beilstein
fbaensch-beilstein merged commit 0ef4aa0 into dev Nov 9, 2026
7 of 9 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.

V3000 Molfile with empty bond block gives error

3 participants