Skip to content

feat: atom-ids in SMILES for debugging purposes - #18

Merged
r-fedorov merged 1 commit into
refactor_namerfrom
dev
Jun 19, 2026
Merged

feat: atom-ids in SMILES for debugging purposes#18
r-fedorov merged 1 commit into
refactor_namerfrom
dev

Conversation

@r-fedorov

@r-fedorov r-fedorov commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

Summary by Sourcery

Tests:

  • Add an integration test to verify that the description includes processed SMILES and corresponding atom IDs.

@sourcery-ai

sourcery-ai Bot commented Jun 19, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds inclusion of a processed SMILES sentence with atom IDs to the describer output, and introduces an integration test to verify the new debugging-oriented SMILES/atom-id rendering.

Sequence diagram for updated describer SMILES debugging output

sequenceDiagram
    actor Client
    participant describer_describe as describe
    participant processed_smiles as _processed_smiles_sentence

    Client->>describer_describe: describe(smiles, result)
    describer_describe->>processed_smiles: _processed_smiles_sentence(smiles)
    processed_smiles-->>describer_describe: smiles_sentence
    alt [smiles_sentence]
        describer_describe->>describer_describe: paragraphs.append(smiles_sentence)
    end
    describer_describe-->>Client: description_text
Loading

File-Level Changes

Change Details Files
Describer now appends a processed SMILES sentence (including atom IDs when available) to its textual output before decision components.
  • Calls a new helper _processed_smiles_sentence(smiles) in describe to build a SMILES-related sentence from the input SMILES.
  • Appends the returned SMILES sentence to the paragraphs list immediately after the summary, if the sentence is non-empty.
src/bluenamer/describer.py
Integration test added to ensure the describer output contains the processed SMILES and atom IDs for debugging.
  • Creates test_describe_includes_processed_smiles_atom_ids that calls describe with a chiral SMILES string and converts the result to text.
  • Asserts the summary line still starts with the expected prefix including the original SMILES.
  • Asserts the output text includes the processed SMILES line, an introductory label for atom IDs, and the expected SMILES annotated with atom indices.
tests/integration/test_describer.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Free

Run ID: e707c78d-a0fb-4451-9429-10d5fd87f9f3

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands and usage tips.

@r-fedorov r-fedorov self-assigned this Jun 19, 2026

@sourcery-ai sourcery-ai Bot 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.

Hey - I've found 1 issue, and left some high level feedback:

  • The new integration test tightly couples to the exact textual formatting (including full atom-id sequence and phrasing); consider matching only the key parts (e.g., presence of the processed SMILES and at least one atom-id pattern) to make the test less brittle to minor wording or formatting changes.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new integration test tightly couples to the exact textual formatting (including full atom-id sequence and phrasing); consider matching only the key parts (e.g., presence of the processed SMILES and at least one atom-id pattern) to make the test less brittle to minor wording or formatting changes.

## Individual Comments

### Comment 1
<location path="tests/integration/test_describer.py" line_range="35" />
<code_context>
+    assert d.summary.startswith("The molecule C[C@@H](Cl)C(=O)c1ccccc1 is named")
+    assert "Processed SMILES: C[C@@H](Cl)C(=O)c1ccccc1" in text
+    assert "Atom ids in that SMILES:" in text
+    assert "C{0}[C@@H]{1}(Cl{2})C{3}(=O{4})c{5}1c{6}c{7}c{8}c{9}c{10}1" in text
+
+
</code_context>
<issue_to_address>
**suggestion (testing):** This assertion is quite brittle; consider asserting structure or pattern instead of an exact atom-id string.

Hard-coding the entire atom-id-annotated SMILES makes the test fragile: any harmless change in atom ordering, formatting, or canonicalization will cause a failure. Instead, consider:
- Using a regex to verify the `{id}` pattern on atoms,
- Checking that the count of `{}`-wrapped indices matches the atom count, and/or
- Verifying a few key atom–id mappings rather than the full string.
This keeps the test resilient while still validating the mapping logic.
</issue_to_address>

Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

assert d.summary.startswith("The molecule C[C@@H](Cl)C(=O)c1ccccc1 is named")
assert "Processed SMILES: C[C@@H](Cl)C(=O)c1ccccc1" in text
assert "Atom ids in that SMILES:" in text
assert "C{0}[C@@H]{1}(Cl{2})C{3}(=O{4})c{5}1c{6}c{7}c{8}c{9}c{10}1" in text

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion (testing): This assertion is quite brittle; consider asserting structure or pattern instead of an exact atom-id string.

Hard-coding the entire atom-id-annotated SMILES makes the test fragile: any harmless change in atom ordering, formatting, or canonicalization will cause a failure. Instead, consider:

  • Using a regex to verify the {id} pattern on atoms,
  • Checking that the count of {}-wrapped indices matches the atom count, and/or
  • Verifying a few key atom–id mappings rather than the full string.
    This keeps the test resilient while still validating the mapping logic.

@r-fedorov
r-fedorov merged commit bf933f0 into refactor_namer Jun 19, 2026
11 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.

1 participant