Skip to content

Remove unused Python code#347

Merged
mangelajo merged 2 commits into
jumpstarter-dev:mainfrom
raballew:024-remove-unused-python
Mar 20, 2026
Merged

Remove unused Python code#347
mangelajo merged 2 commits into
jumpstarter-dev:mainfrom
raballew:024-remove-unused-python

Conversation

@raballew
Copy link
Copy Markdown
Member

Summary

  • Remove 7 confirmed dead code symbols across 7 files (47 lines removed):
    • FileAccessError exception class (jumpstarter core)
    • raise_expired_token_error function (client config)
    • remove_logger_source method (exporter session)
    • is_token_expired function (CLI common)
    • FileWriteError exception class (HTTP driver)
    • StorageObjectError exception class (iSCSI driver)
    • is_subpath function (TFTP server) - filed TFTP server missing path traversal protection #346 for missing path traversal check
  • Restore should_end_lease on HookExecutionError (incorrectly identified as dead)

Test plan

  • make lint passes with zero violations
  • make test passes (18 suites pass, 1 pre-existing opendal failure)
  • Verified zero remaining references to all removed symbols via grep
  • Re-ran vulture to confirm no cascading dead code

🤖 Generated with Claude Code

raballew and others added 2 commits March 19, 2026 14:35
Remove 8 dead code symbols verified by vulture and manual cross-referencing
against entry points, __all__ exports, and TYPE_CHECKING blocks:

- FileAccessError (exceptions.py): unused exception class
- raise_expired_token_error (client.py): unused function
- should_end_lease (hooks.py): unused method
- remove_logger_source (session.py): unused method
- is_token_expired (oidc.py): unused function
- FileWriteError (http driver.py): unused exception class
- StorageObjectError (iscsi driver.py): unused exception class
- is_subpath (tftp server.py): unused function

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This method was incorrectly removed as dead code. It belongs to the
public API of an actively-used exception class alongside
should_shutdown_exporter.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@netlify
Copy link
Copy Markdown

netlify Bot commented Mar 19, 2026

Deploy Preview for jumpstarter-docs ready!

Name Link
🔨 Latest commit 6888ecf
🔍 Latest deploy log https://app.netlify.com/projects/jumpstarter-docs/deploys/69bc02433aa60d0008c61050
😎 Deploy Preview https://deploy-preview-347--jumpstarter-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 19, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f790959a-cb81-4e38-8c64-60f34a491a38

📥 Commits

Reviewing files that changed from the base of the PR and between d1e9012 and 6888ecf.

📒 Files selected for processing (7)
  • python/packages/jumpstarter-cli-common/jumpstarter_cli_common/oidc.py
  • python/packages/jumpstarter-driver-http/jumpstarter_driver_http/driver.py
  • python/packages/jumpstarter-driver-iscsi/jumpstarter_driver_iscsi/driver.py
  • python/packages/jumpstarter-driver-tftp/jumpstarter_driver_tftp/server.py
  • python/packages/jumpstarter/jumpstarter/common/exceptions.py
  • python/packages/jumpstarter/jumpstarter/config/client.py
  • python/packages/jumpstarter/jumpstarter/exporter/session.py
💤 Files with no reviewable changes (6)
  • python/packages/jumpstarter-driver-http/jumpstarter_driver_http/driver.py
  • python/packages/jumpstarter-driver-iscsi/jumpstarter_driver_iscsi/driver.py
  • python/packages/jumpstarter/jumpstarter/exporter/session.py
  • python/packages/jumpstarter/jumpstarter/common/exceptions.py
  • python/packages/jumpstarter-cli-common/jumpstarter_cli_common/oidc.py
  • python/packages/jumpstarter-driver-tftp/jumpstarter_driver_tftp/server.py

📝 Walkthrough

Walkthrough

This pull request removes unused or deprecated utility functions and exception classes across multiple packages: token expiration helpers (is_token_expired, raise_expired_token_error), unused exception types (FileAccessError, FileWriteError, StorageObjectError), helper functions (is_subpath), and a logger source management method (remove_logger_source). No new functionality is introduced.

Changes

Cohort / File(s) Summary
Token & Authentication Helpers
python/packages/jumpstarter-cli-common/jumpstarter_cli_common/oidc.py, python/packages/jumpstarter/jumpstarter/config/client.py
Removed is_token_expired() and raise_expired_token_error() helper functions; removed unused NoReturn type import from client.py.
Exception Classes
python/packages/jumpstarter/jumpstarter/common/exceptions.py, python/packages/jumpstarter-driver-http/jumpstarter_driver_http/driver.py, python/packages/jumpstarter-driver-iscsi/jumpstarter_driver_iscsi/driver.py
Removed public exception classes: FileAccessError, FileWriteError, and StorageObjectError.
Utility Functions
python/packages/jumpstarter-driver-tftp/jumpstarter_driver_tftp/server.py
Removed is_subpath() helper function used for path validation.
Session Logging
python/packages/jumpstarter/jumpstarter/exporter/session.py
Removed remove_logger_source() method from Session class.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested reviewers

  • evakhoni
  • mangelajo

Poem

🐰 Old tokens expire, helpers must go,
Exceptions unused—off with the show!
Logger sources fade, paths lose their way,
Cleanup and tidying—hip-hip-hooray! 🧹✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: removing unused Python code across the codebase, which is reflected in all file changes.
Description check ✅ Passed The description provides detailed information about the specific dead code symbols being removed, the test plan, and verification steps taken, all directly related to the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

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.

@mangelajo mangelajo merged commit 56b85a8 into jumpstarter-dev:main Mar 20, 2026
31 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