Skip to content

Cache: Fix serialization#866

Merged
jan-janssen merged 2 commits intomainfrom
serial
Dec 12, 2025
Merged

Cache: Fix serialization#866
jan-janssen merged 2 commits intomainfrom
serial

Conversation

@jan-janssen
Copy link
Member

@jan-janssen jan-janssen commented Dec 12, 2025

Summary by CodeRabbit

  • Bug Fixes

    • Improved serialization and identification of callable objects without explicit names, yielding more consistent, human-readable identifiers for non-standard callables.
  • Tests

    • Updated test assertions to match the refined serialization output, including the representation used for None values.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 12, 2025

Walkthrough

Modified _get_function_name to derive names for callables without __name__ by parsing str(fn.__class__) instead of str(fn). Updated tests to expect "NoneType" where previously "None" was asserted.

Changes

Cohort / File(s) Summary
Function name derivation logic
src/executorlib/standalone/serialize.py
_get_function_name now extracts the quoted class name from str(fn.__class__) and takes the last dot-separated segment when a callable lacks __name__, replacing the prior str(fn)-based split logic.
Test expectations
tests/test_standalone_serialize.py
Updated test expectation for a None input from "None" to "NoneType" to reflect the new name derivation result.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Focus review on src/executorlib/standalone/serialize.py change and the corresponding test update.
  • Verify edge cases: builtins, functools.partial, and callables with unusual __class__ string representations.

Poem

🐰 I peeked inside a class name's quote,
Where callables now find a proper note.
None became NoneType with a tiny hop,
Tests twitched their noses — code won't stop. ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive The title 'Cache: Fix serialization' is vague and doesn't clearly describe what serialization issue is being fixed or in which component. Consider a more specific title that describes the actual serialization fix, such as 'Fix function name derivation in serialization for callables without name' or similar.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch serial

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 and usage tips.

@codecov
Copy link

codecov bot commented Dec 12, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.27%. Comparing base (c749923) to head (98afa0b).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #866   +/-   ##
=======================================
  Coverage   93.27%   93.27%           
=======================================
  Files          38       38           
  Lines        1800     1800           
=======================================
  Hits         1679     1679           
  Misses        121      121           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/executorlib/standalone/serialize.py (1)

104-108: Replace fragile string parsing with direct attribute access.

The current implementation parses str(fn.__class__) assuming a specific format (<class 'module.ClassName'>), which is fragile. Use fn.__class__.__name__ instead for a more robust and direct approach.

Apply this diff:

 def _get_function_name(fn: Callable) -> str:
     if hasattr(fn, "__name__"):
         return fn.__name__
     else:
-        return str(fn.__class__).split("'")[-2].split(".")[-1]
+        return fn.__class__.__name__
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between afa1dd6 and 98afa0b.

📒 Files selected for processing (1)
  • src/executorlib/standalone/serialize.py (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: benchmark (ubuntu-latest, 3.13, .ci_support/environment-openmpi.yml)
  • GitHub Check: benchmark (ubuntu-latest, 3.13, .ci_support/environment-mpich.yml)
  • GitHub Check: notebooks_integration
  • GitHub Check: unittest_win

@jan-janssen jan-janssen merged commit e5fa92c into main Dec 12, 2025
35 checks passed
@jan-janssen jan-janssen deleted the serial branch December 12, 2025 05:51
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