Batch B4: controller extraction (#27) and unified error shape (#28) #57

Merged
amiryahaya merged 3 commits from fix/b4-controller-errors into main 2026-11-15 16:14:42 +01:00
Owner

Batch B4 — #27 (controller god module) and #28 (error contracts).

#27 CertManagementController is parse/render only (951 → ~290 lines). Revocation moved to MdidWs.CertManagement.Revocation, status lookup to MdidWs.CertManagement.Status. Revoke outcome merge is covered by a table test.

#28 All /api/v1/cert_mgmt errors (controllers, auth plugs, admin, CA downloads) render through MdidWsWeb.ApiError as {iErrorCode, sErrorMessage}.

Breaking for clients

  • Enrollment, admin and CA-download errors were {"error": ...}; now ICD shape (README/AGENTS updated).
  • Renewal invalid-CSR message no longer echoes the internal reason; renewal cert_validity overflow now also returns requested/maximum.
  • Test/ops SOAP overrides moved: MdidWsWeb.CertManagementController :revoke_soap_options/:status_soap_options → MdidWs.CertManagement.Revocation|Status, :soap_options.

Kept as-is (compat): HTTP-200 ICD outcomes (-101, RN102, RV200, RV201), auth-plug code values, OAuth token endpoint RFC 6749 errors. #28's "stop overloading iErrorCode with HTTP codes" is therefore only partly done.

Verification: mix precommit 306 passed. Coverage (changed modules): Revocation 85.7%+, Status 94.5%, CertManagementController 86.5%, AdminController 82.4%, ApiError/RequireScope 100%; whole-app 74.5%. Two-pass review done; the last small fixes (test + def outcome) did not get a second Pass 1.

🤖 Generated with Claude Code

Batch B4 — #27 (controller god module) and #28 (error contracts). **#27** `CertManagementController` is parse/render only (951 → ~290 lines). Revocation moved to `MdidWs.CertManagement.Revocation`, status lookup to `MdidWs.CertManagement.Status`. Revoke outcome merge is covered by a table test. **#28** All `/api/v1/cert_mgmt` errors (controllers, auth plugs, admin, CA downloads) render through `MdidWsWeb.ApiError` as `{iErrorCode, sErrorMessage}`. **Breaking for clients** - Enrollment, admin and CA-download errors were `{"error": ...}`; now ICD shape (README/AGENTS updated). - Renewal invalid-CSR message no longer echoes the internal reason; renewal `cert_validity` overflow now also returns `requested`/`maximum`. - Test/ops SOAP overrides moved: `MdidWsWeb.CertManagementController :revoke_soap_options/:status_soap_options` → `MdidWs.CertManagement.Revocation|Status, :soap_options`. **Kept as-is (compat)**: HTTP-200 ICD outcomes (-101, RN102, RV200, RV201), auth-plug code values, OAuth token endpoint RFC 6749 errors. #28's "stop overloading iErrorCode with HTTP codes" is therefore only partly done. **Verification**: `mix precommit` 306 passed. Coverage (changed modules): Revocation 85.7%+, Status 94.5%, CertManagementController 86.5%, AdminController 82.4%, ApiError/RequireScope 100%; whole-app 74.5%. Two-pass review done; the last small fixes (test + `def outcome`) did not get a second Pass 1. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
CertManagementController is now parse/render only; revocation and status
logic moved to MdidWs.CertManagement.Revocation and Status. All cert_mgmt
errors go through MdidWsWeb.ApiError ({iErrorCode,sErrorMessage}); enrollment
and admin errors no longer use {error: ...}.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
test: Revocation outcome table (B4 pass-2)
All checks were successful
Lint / lint (pull_request) Successful in 2m43s
Security / Dependency advisories (mix hex.audit) (pull_request) Successful in 24s
Security / Secret scan (gitleaks) (pull_request) Successful in 12s
Unit tests / test (pull_request) Successful in 3m25s
b1613bfa38
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign in to join this conversation.
No description provided.