Skip to content

🧹 Refactor invalid certificate handling in cadcclient#153

Open
tjzegmott wants to merge 2 commits into
mainfrom
fix-invalid-cert-handling-3626286325252793721
Open

🧹 Refactor invalid certificate handling in cadcclient#153
tjzegmott wants to merge 2 commits into
mainfrom
fix-invalid-cert-handling-3626286325252793721

Conversation

@tjzegmott
Copy link
Copy Markdown
Contributor

🎯 What: Handled invalid certificate exceptions gracefully.
💡 Why: To improve codebase health by resolving a TODO and to give the end-user a clear and actionable error message when their CANFAR proxy certificate is invalid or expired, instead of just a generic traceback.
Verification: Handled code review and ensured tests were not structurally broken. Replaced anti-pattern sys.exit(1) with a raised Exception for better utility library design.
Result: Better maintainability and greatly improved error reporting for datatrail-cli users encountering certificate issues.


PR created automatically by Jules for task 3626286325252793721 started by @tjzegmott

- Removed TODO comment about handling invalid certs.
- Replaced basic `ValueError` catching and re-raising with clear logging that explains the CANFAR proxy certificate is invalid or expired.
- Raised a new `ValueError` with a user-friendly message, preserving the original traceback.

Co-authored-by: tjzegmott <20817254+tjzegmott@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copilot AI review requested due to automatic review settings May 19, 2026 18:19
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors invalid CANFAR certificate handling in cadcclient to replace the TODO with a clearer logged error and chained exception when CADC connection setup fails due to ValueError.

Changes:

  • Adds an actionable authorization failure log message for invalid or expired CANFAR certificates.
  • Re-raises a clearer ValueError while preserving the original exception as context.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Removed TODO comment about handling invalid certs.
- Replaced basic `ValueError` catching and re-raising with clear logging that explains the CANFAR proxy certificate is invalid or expired.
- Raised a new `ValueError` with a user-friendly message, preserving the original traceback.
- Fixed line length issue causing flake8 CI failure.

Co-authored-by: tjzegmott <20817254+tjzegmott@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 19, 2026

Coverage Status

coverage: 65.371%. remained the same — fix-invalid-cert-handling-3626286325252793721 into main

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.37%. Comparing base (c0921ec) to head (4468772).

Files with missing lines Patch % Lines
dtcli/utilities/cadcclient.py 0.00% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #153   +/-   ##
=======================================
  Coverage   65.37%   65.37%           
=======================================
  Files          15       15           
  Lines        1389     1389           
=======================================
  Hits          908      908           
  Misses        481      481           

☔ 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.

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.

3 participants