Skip to content

[FIX] Sign pyopenms python_modules component during macOS packaging - #9828

Closed
timosachsenberg wants to merge 2 commits into
developfrom
claude/sweet-fermat-tf6nmd
Closed

timosachsenberg wants to merge 2 commits into
developfrom
claude/sweet-fermat-tf6nmd

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Description

Today's nightly Release workflow run (run 30506465700) failed on macos-15 at the "Notarize macOS Package" step. Apple rejected the ...-python_modules.pkg sub-package with errors for every pyopenms .so it contains, e.g.:

"message": "The binary is not signed with a valid Developer ID certificate."
"message": "The signature does not include a secure timestamp."

Root cause: cmake/package_mac_productbuild.cmake re-signs the TOPP binaries (COMPONENT Dependencies) and the shared libraries (COMPONENT library) with the Developer ID identity after fix_dependencies.rb rewrites their rpaths, but the pyopenms extension modules — installed under COMPONENT python_modules in src/pyOpenMS/CMakeLists.txt — were never covered by any of those install(CODE ...) signing steps. They therefore only carried the ad-hoc signature applied by the linker at build time, which notarization rejects.

This adds an equivalent codesign --force --options runtime --timestamp pass, scoped to COMPONENT python_modules, mirroring the existing pattern used for the library component.

Since this is the first real run of the new nightly Release workflow (added recently in #9523) with a Developer ID cert configured, this is a new/previously-unexercised code path rather than a regression or flaky failure.

Note: I don't have access to a macOS runner in this environment, so this fix could not be locally verified end-to-end (build + codesign + notarize); it should be confirmed by a subsequent Release/nightly CI run.

Checklist

  • Make sure that you are listed in the AUTHORS file
  • Add relevant changes and new features to the CHANGELOG file
  • I have commented my code, particularly in hard-to-understand areas
  • New and existing unit tests pass locally with my changes
  • Updated or added python bindings for changed or new classes (Tick if no updates were necessary.)

Generated by Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved macOS packaging reliability by ensuring included Python extension modules are code signed.
    • Packaging now fails clearly when required modules are missing or cannot be signed, preventing incomplete or unverifiable installers.

Today's nightly Release run (workflow run 30506465700) failed Apple
notarization on macos-15 with "not signed with a valid Developer ID
certificate" / "signature does not include a secure timestamp" for every
pyopenms .so under the python_modules pkg component.

package_mac_productbuild.cmake already re-signs the TOPP binaries (component
Dependencies) and the shared libraries (component library) with the Developer
ID identity after fix_dependencies.rb rewrites their rpaths, but the pyopenms
extension modules installed under COMPONENT python_modules (see
src/pyOpenMS/CMakeLists.txt) were never covered by any of those install(CODE)
signing steps, so they only carried the ad-hoc signature applied at build
time. This adds the equivalent codesign pass for that component.

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@cmake/package_mac_productbuild.cmake`:
- Around line 130-133: Update the install(CODE) signing block to capture the
codesign result via RESULT_VARIABLE or COMMAND_ERROR_IS_FATAL and terminate
packaging on any non-zero status. Also track whether the find command matched
any *.so files and fail when no PyOpenMS modules were found, while preserving
the existing signing output and component behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4c4a9db4-4932-4a28-a02a-36d2d42caed3

📥 Commits

Reviewing files that changed from the base of the PR and between 193b2e7 and 73de966.

📒 Files selected for processing (1)
  • cmake/package_mac_productbuild.cmake

Comment thread cmake/package_mac_productbuild.cmake Resolved
Addresses CodeRabbit review on #9828: the previous find|codesign pipe only
captured output text, never a real exit status, so a codesign failure (or
zero pyopenms .so files present) would silently pass and could ship an
unnotarized/unsigned pyopenms component.

Switched to signing each discovered .so directly via execute_process with
RESULT_VARIABLE, since (verified empirically) GNU find's own exit status
does not reflect the exit status of commands it invokes via -exec/-execdir
with the ';' terminator - the prior find-based RESULT_VARIABLE approach
would not have caught a failing codesign call either. Also added an
explicit check that at least one .so was found to sign.

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9eedd77c-32a9-4ba4-8c44-4bd21b88bfd5

📥 Commits

Reviewing files that changed from the base of the PR and between 193b2e7 and ed693a4.

📒 Files selected for processing (1)
  • cmake/package_mac_productbuild.cmake

📝 Walkthrough

Walkthrough

The macOS packaging script now locates installed PyOpenMS extension modules, signs each .so with the configured Developer ID certificate, and fails packaging when modules are missing or signing fails.

Changes

MacOS Packaging

Layer / File(s) Summary
Sign PyOpenMS extension modules
cmake/package_mac_productbuild.cmake
The python_modules install step discovers pyopenms/*.so files, codesigns each with runtime and timestamp options, and raises fatal errors for missing modules or failed signing commands.

Possibly related PRs

  • OpenMS/OpenMS#9827: Updates the same packaging component by excluding python_modules from productbuild instead of signing its modules.

Poem

A rabbit checks each .so in the stack,
Signs every module and sends it back.
No modules? Halt! A failed seal? Stop!
Safe packages reach the mountaintop.
^._.^

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: signing the pyopenms python_modules component during macOS packaging.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/sweet-fermat-tf6nmd

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link
Copy Markdown
Contributor Author

Closing in favor of #9827, which fixes the same nightly-Release notarization failure but takes a different, maintainer-preferred approach.

While drafting this PR I found #9827 was opened first (also addressing this exact failure) and had already gone through review: @jpfeuffer flagged that pyopenms shouldn't be part of the desktop .pkg installer at all — it's shipped separately as wheels (pyopenms-wheels-cibuildwheel.yml) — so the fix should exclude the python_modules component from productbuild rather than sign it, which is what #9827 now does.

That makes this PR's approach (signing python_modules so it can ship inside the installer) the wrong direction architecturally, even though the hardening added here (fail-fast on missing/failed signing) doesn't carry over to a component that's being excluded rather than signed. Deferring to #9827.


Generated by Claude Code

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