Repository navigation
feat(ra): make identityCsrPEM optional on agent registration - #33
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Enables agents to register without providing an identityCsrPEM (V1 and V2 lanes), while keeping prior behavior unchanged when an identity CSR is supplied. This allows agents to progress through PENDING_VALIDATION → PENDING_DNS → ACTIVE without an identity certificate, and adds a guard to prevent adding an identity CSR later for agents that registered without one.
Changes:
- Spec/docs:
identityCsrPEMis no longer required and is documented as optional (with “no add later” semantics). - Domain/service: registration accepts
nilidentity CSR; registration persists/validates identity CSR only when provided;VerifyACMEtreats missing pending identity CSR as a no-op. - Lifecycle/tests: adds “no-add-later” conflict on
SubmitIdentityCSRfor ACTIVE agents that have no identity certs; adds/updates unit + handler tests for V1/V2 parity and event shapes.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| spec/api-spec-v2.yaml | Makes identityCsrPEM optional in the V2 OpenAPI spec and documents semantics. |
| internal/adapter/docsui/openapi/ra.yaml | Regenerates docs UI OpenAPI to match the updated optional field. |
| internal/domain/agent.go | Removes domain-level validation requiring a non-nil identity CSR at registration. |
| internal/domain/agent_test.go | Adds test coverage for nil identity CSR registration; removes “missing CSR” validation case. |
| internal/ra/service/registration.go | Skips identity CSR validation/persistence when omitted; passes nil CSR into NewRegistration. |
| internal/ra/service/registration_errors_test.go | Adds tests for register-without-identity-CSR and regression for supplied-CSR path. |
| internal/ra/service/lifecycle.go | Adds no-add-later guard in SubmitIdentityCSR; makes VerifyACME tolerate missing pending identity CSR. |
| internal/ra/service/lifecycle_test.go | New tests for lifecycle progression and V1/V2 event shapes when identity CSR is omitted. |
| internal/ra/handler/v1registration_test.go | Updates V1 handler test to expect success (202) without identity CSR and to reach ACTIVE. |
| internal/ra/handler/lifecycle_test.go | Adds V2 handler coverage for registration without identity CSR and the 409 “no add later” path. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Agents may now register without an identity CSR on both the V1 and V2 lanes. When identityCsrPEM is supplied, behavior is unchanged: the RA issues an identity certificate from it at verify-acme. When omitted, the agent registers with no identity certificate, drives through the lifecycle to ACTIVE normally, and emits TL events carrying empty identity certs. - domain: NewRegistration accepts a nil identity CSR. - service: RegisterAgent skips CSR validation/persistence when omitted; VerifyACME treats a missing pending identity CSR as a no-op rather than an inconsistent-state error. - no-add-later guard: an ACTIVE agent that registered without an identity CSR cannot obtain one via SubmitIdentityCSR (409 IDENTITY_CSR_NOT_PERMITTED); it must register a new version instead. - spec: identityCsrPEM removed from the required list; docsui regenerated. Tests follow the repo convention (unit-under-test + concern): - domain/agent_test.go pins nil-CSR acceptance. - service: RegisterAgent cases in registration_errors_test.go; new lifecycle_test.go covers VerifyACME/VerifyDNS V1+V2 wire shapes and the SubmitIdentityCSR guard. - handler: V2 202 + V1 reaches-ACTIVE parity, plus the 409 add-later path. Replaces the stale TestV1Register_MissingIdentityCSR_422. Signed-off-by: James Hateley <jhateley@godaddy.com>
jhateley-godaddy
force-pushed
the
feat/optional-identity-csr
branch
from
June 3, 2026 02:32
a3fe582 to
2a57287
Compare
Flatten SubmitIdentityCSR with an early-return AGENT_NOT_ACTIVE guard, removing the now-redundant nested status check. Reword the no-identity-CSR event tests: identityCert/identityCerts/ validIdentityCerts are all omitempty, so the fields are absent on the wire when empty rather than serialized as null/empty arrays. Comments and failure messages no longer assert a wire shape the encoder cannot produce. Signed-off-by: James Hateley <jhateley@godaddy.com>
Remove AC-* acceptance-criteria identifiers and plan-relative framing
("RED gauge", "the optional-identity-CSR feature", "as before the
optional path was introduced") from test comments. These pointed at an
implementation plan rather than describing behavior; reword them to
state what each test verifies in product terms.
Signed-off-by: James Hateley <jhateley@godaddy.com>
kperry-godaddy
approved these changes
Jun 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Agents may now register without an identity CSR on both the V1 and V2 lanes. When identityCsrPEM is supplied, behavior is unchanged: the RA issues an identity certificate from it at verify-acme. When omitted, the agent registers with no identity certificate, drives through the lifecycle to ACTIVE normally, and emits TL events carrying empty identity certs.
Tests follow the repo convention (unit-under-test + concern):