Skip to content

Guard get_certificate_chain(s) against undef URL#67

Merged
toddr merged 3 commits intomainfrom
koan.toddr.bot/guard-get-certificate-chain
Apr 6, 2026
Merged

Guard get_certificate_chain(s) against undef URL#67
toddr merged 3 commits intomainfrom
koan.toddr.bot/guard-get-certificate-chain

Conversation

@toddr-bot
Copy link
Copy Markdown
Contributor

@toddr-bot toddr-bot commented Apr 5, 2026

What

Adds an early guard in get_certificate_chain() and get_certificate_chains() that throws a clear X::Generic exception when the order's certificate URL is not set.

Why

When callers invoke these methods on an order that hasn't reached valid status, $order->certificate() returns undef. This propagated into _post_as_get(), eventually producing a confusing low-level error ("Must be https!") with no indication of what went wrong or how to fix it.

How

Both methods now check the return value of $order->certificate() before proceeding. On undef, they throw a structured exception that names the current order status and tells the caller to poll until valid.

Testing

  • New test file t/Net-ACME2-get-certificate-guard.t verifies the guard fires for pending and processing orders
  • Full suite passes: 294 tests across 19 files

🤖 Generated with Claude Code


Quality Report

Changes: 3 files changed, 107 insertions(+), 2 deletions(-)

Code scan: clean

Tests: passed (OK)

Branch hygiene: clean

Generated by Kōan post-mission quality pipeline

toddr-bot and others added 3 commits April 5, 2026 23:29
Without the guard, calling get_certificate_chain() on an order that
hasn't reached 'valid' status produces a confusing "Must be https!"
error deep in the HTTP layer, because the certificate URL is undef.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When an order hasn't reached 'valid' status, its certificate URL is
undef. Previously this propagated to _post_as_get, producing a
confusing "Must be https!" error. Now both get_certificate_chain()
and get_certificate_chains() throw a clear X::Generic exception
that names the current order status and tells the caller to poll.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@toddr toddr marked this pull request as ready for review April 6, 2026 01:11
@toddr toddr merged commit 8841ec0 into main Apr 6, 2026
20 checks passed
@toddr toddr deleted the koan.toddr.bot/guard-get-certificate-chain branch April 6, 2026 01:12
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