Skip to content

feat: async keystore creation - #182

Merged
minh-nghia merged 15 commits into
openkcm:mainfrom
davidbolet:feature/async-keystore-creation
Oct 27, 2026
Merged

minh-nghia merged 15 commits into
openkcm:mainfrom
davidbolet:feature/async-keystore-creation

Conversation

@davidbolet

@davidbolet davidbolet commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Add support for asynchronous keystore creation to handle cases where
AWS account activation can take >24 hours and cause timeouts.

Changes:

  • Add optional fields to CreateKeystoreResponse:

    • status (field 5): 'ACTIVE', 'PENDING_ACTIVATION', or 'FAILED'
    • account_id (field 6): for tracking
    • error_message (field 7): failure details
  • Add GetKeystoreStatus RPC (read-only):

    • Check current status of pending keystore
    • Does not modify any state
    • Returns status and error message only
  • Add FinalizeKeystoreSetup RPC (state-modifying):

    • Complete keystore setup after account is active
    • Creates cloud resources (trust anchors, roles, profiles)
    • Returns full keystore configuration

Copilot AI lite review requested due to automatic review settings September 18, 2026 09:49
@coderabbitai

coderabbitai Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e46ff0ec-d9de-499d-8fd8-4072e0ed5cb4

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The repo tracks generated Go protobuf stubs, but the PR updates the .proto without regenerating/committing the corresponding generated files, which will cause API drift and likely break consumers.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

This PR extends the keystore management protobuf API to support asynchronous keystore creation flows (to avoid timeouts during delayed hyperscaler account activation) by adding creation status metadata and introducing new RPCs to poll status and finalize setup.

Changes:

  • Adds async lifecycle fields (status, hyperscaler_account_id, error_message) to CreateKeystoreResponse.
  • Adds two new RPCs: GetKeystoreStatus (read-only) and FinalizeKeystoreSetup (state-modifying).
  • Updates .gitignore to ignore PROTO_CHANGES_BACKWARDS_COMPATIBLE.md.
File summaries
File Description
proto/plugin/keystore/management/v1/management.proto Adds async keystore creation status fields and new status/finalization RPCs/messages.
.gitignore Ignores a local proto compatibility artifact file.
Review details

Suppressed comments (2)

proto/plugin/keystore/management/v1/management.proto:124

  • For consistency with CreateKeystoreResponse (and to allow presence checks in proto3), consider making this status field optional as well; otherwise clients can’t distinguish “unset” from “set to empty”.
  // Current status: "PENDING_ACTIVATION", "ACTIVE", or "FAILED"
  string status = 1;

proto/plugin/keystore/management/v1/management.proto:151

  • Same proto3 presence concern here: if callers need to distinguish missing vs empty, this should be optional (or an enum). Keeping the wire semantics consistent across the three status responses will reduce client-side edge cases.
  // Status: should always be "ACTIVE" on success, "FAILED" on error
  string status = 4;
  • Files reviewed: 1/2 changed files
  • Comments generated: 3
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@davidbolet
davidbolet force-pushed the feature/async-keystore-creation branch from 8070c23 to b6436ab Compare September 18, 2026 10:01
Copilot AI review requested due to automatic review settings September 18, 2026 10:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The proto documentation for new fields has a couple of concrete inaccuracies/misleading statements that should be corrected to avoid confusing API consumers.

Review details

Files not reviewed (2)

  • proto/plugin/keystore/management/v1/management.pb.go: Generated file
  • proto/plugin/keystore/management/v1/management_grpc.pb.go: Generated file

Suppressed comments (2)

proto/plugin/keystore/management/v1/management.proto:56

  • Proto3 non-optional string fields don’t have presence; “not set” isn’t distinguishable from an empty string, so the comment should describe empty-string semantics rather than implying a separate unset state.
  // Status of keystore creation
  // Values: "ACTIVE" (default, immediately ready), "PENDING_ACTIVATION" (account created, waiting for activation), "FAILED" (creation failed)
  // If not set or empty, defaults to "ACTIVE" for backwards compatibility
  string status = 5;

proto/plugin/keystore/management/v1/management.proto:140

  • These comments imply common_name/cmk_region were provided during CreateKeystore, but CreateKeystoreRequest only has a provider-defined google.protobuf.Struct values. That makes the documentation misleading for API consumers.
  // Common name for the keystore (same as was intended during CreateKeystore)
  string common_name = 2;

  // CMK region (same as was intended during CreateKeystore)
  string cmk_region = 3;
  • Files reviewed: 1/4 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Copilot AI review requested due to automatic review settings September 18, 2026 10:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The new status API uses stringly-typed states with inconsistent “absent/default” semantics across responses, which is likely to confuse clients and should be made more explicit/consistent before release.

Get a fresh assessment by requesting another Copilot review.

Review details

Files not reviewed (2)

  • proto/plugin/keystore/management/v1/management.pb.go: Generated file
  • proto/plugin/keystore/management/v1/management_grpc.pb.go: Generated file
  • Files reviewed: 1/4 changed files
  • Comments generated: 2
  • Review effort level: Lite

Copilot AI review requested due to automatic review settings September 18, 2026 10:35

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The new status contract relies on optional string fields/presence semantics in a way that is ambiguous and error-prone for API consumers and should be revised before merging.

Review details

Files not reviewed (2)

  • proto/plugin/keystore/management/v1/management.pb.go: Generated file
  • proto/plugin/keystore/management/v1/management_grpc.pb.go: Generated file

Suppressed comments (3)

proto/plugin/keystore/management/v1/management.proto:57

  • The new status field is a free-form string even though the API contract defines a closed set of values, and it also relies on field presence for backwards-compat semantics ("absent" => treat as ACTIVE). This is easy to misuse (typos/new values) and is difficult for clients to implement consistently across languages (e.g., generated getters typically return the empty string rather than an "ACTIVE" default). Consider introducing a KeystoreStatus enum (e.g., STATUS_UNSPECIFIED=0, ACTIVE=1, PENDING_ACTIVATION=2, FAILED=3) and using it for all status fields; document that STATUS_UNSPECIFIED should be treated as ACTIVE for legacy responses.
  // Status of keystore creation
  // Values: "ACTIVE" (immediately ready), "PENDING_ACTIVATION" (account created, waiting for activation), "FAILED" (creation failed)
  // Optional field - when not set (absent), clients should treat the keystore as "ACTIVE" for backwards compatibility with old plugins
  // New plugins should explicitly set this field to indicate the actual status
  optional string status = 5;

proto/plugin/keystore/management/v1/management.proto:127

  • Using optional string status to represent an unknown state by omission makes the wire contract harder for clients to reason about and encourages retry loops when presence handling differs across languages/JSON bindings. Prefer returning an explicit status value (e.g., an enum with STATUS_UNSPECIFIED) rather than encoding "unknown" as "field not set".
  // Current status: "PENDING_ACTIVATION", "ACTIVE", or "FAILED"
  // Optional field - when not set (absent), status is unknown and client should retry the request
  optional string status = 1;

proto/plugin/keystore/management/v1/management.proto:152

  • The response contract here is ambiguous: it says that if status is absent clients should consult error_message, but error_message is also optional, so success vs failure can be unclear. Consider making status always populated (or using an enum with a clear default like STATUS_UNSPECIFIED) and specifying that failures must set status=FAILED and populate error_message.
  // Status: "ACTIVE" on success, "FAILED" on error
  // Optional field - when not set (absent), clients should check error_message to determine success/failure
  optional string status = 4;
  • Files reviewed: 1/4 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@davidbolet
davidbolet force-pushed the feature/async-keystore-creation branch from 8dd1618 to 31b4e64 Compare September 18, 2026 10:44
Add status field and GetKeystoreStatus RPC to support asynchronous
keystore creation

Signed-off-by: davidbolet <[email protected]>
Regenerate protobuf Go files to include new RPCs and messages:
- GetKeystoreStatus RPC (read-only status check)
- FinalizeKeystoreSetup RPC (complete setup after activation)
- Updated CreateKeystoreResponse with status, hyperscaler_account_id, and error_message fields
- New request/response messages for status and finalization

Files updated:
- management.pb.go: Added new message types and fields
- management_grpc.pb.go: Added new RPC method signatures

This addresses Copilot's feedback about missing generated files.

Signed-off-by: davidbolet <[email protected]>
Address Copilot feedback: In proto3, non-optional string fields cannot
distinguish between 'unset' and empty string, making presence-based
backwards compatibility impossible.

Changes:
- Make 'status' field optional in CreateKeystoreResponse (field 5)
- Make 'hyperscaler_account_id' optional in CreateKeystoreResponse (field 6)
- Make 'error_message' optional in CreateKeystoreResponse (field 7)
- Make 'status' optional in GetKeystoreStatusResponse (field 1)
- Make 'error_message' optional in GetKeystoreStatusResponse (field 2)
- Make 'status' optional in FinalizeKeystoreSetupResponse (field 4)
- Make 'error_message' optional in FinalizeKeystoreSetupResponse (field 5)

Updated documentation to clarify:
- Old plugins: fields absent → clients treat as ACTIVE
- New plugins: explicitly set status field
- Error messages: only present when status is FAILED

This enables proper presence detection in clients using HasField() checks.

Regenerated Go files to reflect optional field semantics with pointer types.

Signed-off-by: davidbolet <[email protected]>
Address Copilot feedback: FinalizeKeystoreSetupRequest was requiring
common_name and cmk_region even though these are already passed in
CreateKeystoreRequest. This creates two sources of truth and makes
the async flow harder to use correctly.

Changes:
- Remove 'common_name' field (was field 2) from FinalizeKeystoreSetupRequest
- Remove 'cmk_region' field (was field 3) from FinalizeKeystoreSetupRequest
- Updated documentation to clarify plugin responsibility

Design rationale:
- Plugin receives all parameters in CreateKeystoreRequest (opaque Struct)
- Plugin stores mapping: hyperscaler_account_id -> original request parameters
- FinalizeKeystoreSetup only needs hyperscaler_account_id to lookup context
- Single source of truth: CreateKeystoreRequest is authoritative
- Simpler client code: no need to track and re-send parameters

Plugin implementation pattern:
1. CreateKeystore: store (account_id -> request params) mapping
2. FinalizeKeystoreSetup: lookup params by account_id, complete setup
3. No risk of parameter mismatch between create and finalize

Regenerated Go files to reflect simplified request message.

Signed-off-by: davidbolet <[email protected]>
@davidbolet
davidbolet force-pushed the feature/async-keystore-creation branch from 31b4e64 to ff1d8a7 Compare September 18, 2026 10:46
Comment thread .gitignore Resolved
Copilot AI review requested due to automatic review settings September 22, 2026 11:53

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

The new status enum/fields have ambiguous documented semantics around “unset” vs UNSPECIFIED, and the API surface/PR description scope needs to be made consistent before approval.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 3 Low severity

Open (3)
Resolved since last review (4)
Files not reviewed (2)
  • proto/plugin/keystore/management/v1/management.pb.go: Generated file
  • proto/plugin/keystore/management/v1/management_grpc.pb.go: Generated file

- Rename hyperscaler_account_id to account_id in all messages
- Add values field to FinalizeKeystoreSetupRequest for stateless plugin
- Regenerate all proto files

Signed-off-by: davidbolet <[email protected]>
Signed-off-by: davidbolet <[email protected]>
Copilot AI lite review requested due to automatic review settings October 8, 2026 08:37
@davidbolet
davidbolet requested a review from minh-nghia October 8, 2026 08:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The new proto API documentation and PR description are currently inconsistent/contradictory in ways that could mislead API consumers.

4 open findings
2 resolved since last review
Files not reviewed (19)
  • internal/proto/service/init/v1/init.pb.go: Generated file
  • internal/proto/service/init/v1/init_grpc.pb.go: Generated file
  • proto/plugin/certificate_issuer/v1/certificate_issuer.pb.go: Generated file
  • proto/plugin/certificate_issuer/v1/certificate_issuer_grpc.pb.go: Generated file
  • proto/plugin/identity_management/v1/identity_management.pb.go: Generated file
  • proto/plugin/identity_management/v1/identity_management_grpc.pb.go: Generated file
  • proto/plugin/keystore/common/v1/common.pb.go: Generated file
  • proto/plugin/keystore/management/v1/management.pb.go: Generated file
  • proto/plugin/keystore/management/v1/management_grpc.pb.go: Generated file
  • proto/plugin/keystore/operations/v1/operations.pb.go: Generated file
  • proto/plugin/keystore/operations/v1/operations_grpc.pb.go: Generated file
  • proto/plugin/notification/v1/notification.pb.go: Generated file
  • proto/plugin/notification/v1/notification_grpc.pb.go: Generated file
  • proto/plugin/systeminformation/v1/systeminformation.pb.go: Generated file
  • proto/plugin/systeminformation/v1/systeminformation_grpc.pb.go: Generated file
  • proto/plugin/test/v1/test.pb.go: Generated file
  • proto/plugin/test/v1/test_grpc.pb.go: Generated file
  • proto/service/common/config/v1/config.pb.go: Generated file
  • proto/service/common/config/v1/config_grpc.pb.go: Generated file
Previously missed (1)

In code that hasn't changed since last review

Low severity Conflicting ownership of CreateKeystore parameter mapping

proto/​plugin/​keystore/​management/​v1/​management.proto:74

This comment says the plugin maintains the mapping between account_id and the original CreateKeystore parameters, but later FinalizeKeystoreSetupRequest states CMK stores/passes those parameters back so the plugin can remain stateless. These statements conflict; align the CreateKeystoreResponse comment with the stateless approach (CMK maintains the mapping).

This issue also appears on line 140 of the same file.

🧠 Review effort: Lite


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

Signed-off-by: davidbolet <[email protected]>
Copilot AI lite review requested due to automatic review settings October 8, 2026 11:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The new async-status API has documentation/contract ambiguities (presence vs UNSPECIFIED semantics and optional status in new responses) plus a mismatch with the PR description that should be resolved before approval.

1 open finding
3 resolved since last review
Files not reviewed (19)
  • internal/proto/service/init/v1/init.pb.go: Generated file
  • internal/proto/service/init/v1/init_grpc.pb.go: Generated file
  • proto/plugin/certificate_issuer/v1/certificate_issuer.pb.go: Generated file
  • proto/plugin/certificate_issuer/v1/certificate_issuer_grpc.pb.go: Generated file
  • proto/plugin/identity_management/v1/identity_management.pb.go: Generated file
  • proto/plugin/identity_management/v1/identity_management_grpc.pb.go: Generated file
  • proto/plugin/keystore/common/v1/common.pb.go: Generated file
  • proto/plugin/keystore/management/v1/management.pb.go: Generated file
  • proto/plugin/keystore/management/v1/management_grpc.pb.go: Generated file
  • proto/plugin/keystore/operations/v1/operations.pb.go: Generated file
  • proto/plugin/keystore/operations/v1/operations_grpc.pb.go: Generated file
  • proto/plugin/notification/v1/notification.pb.go: Generated file
  • proto/plugin/notification/v1/notification_grpc.pb.go: Generated file
  • proto/plugin/systeminformation/v1/systeminformation.pb.go: Generated file
  • proto/plugin/systeminformation/v1/systeminformation_grpc.pb.go: Generated file
  • proto/plugin/test/v1/test.pb.go: Generated file
  • proto/plugin/test/v1/test_grpc.pb.go: Generated file
  • proto/service/common/config/v1/config.pb.go: Generated file
  • proto/service/common/config/v1/config_grpc.pb.go: Generated file
Previously missed (1)

In code that hasn't changed since last review

Low severity Define retry semantics using UNSPECIFIED, not field absence

proto/​plugin/​keystore/​management/​v1/​management.proto:142

The GetKeystoreStatusResponse docs talk about the status field being absent, but many consumers (and generated getters) will primarily see KEYSTORE_CREATION_STATUS_UNSPECIFIED when the field is unset. It’s clearer to define retry/unknown semantics in terms of the UNSPECIFIED enum value rather than presence.

🧠 Review effort: Lite


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

@davidbolet davidbolet changed the title Feature/async keystore creation feat: Async keystore creation Oct 8, 2026
@davidbolet davidbolet changed the title feat: Async keystore creation feat: async keystore creation Oct 8, 2026
Signed-off-by: davidbolet <[email protected]>
Copilot AI lite review requested due to automatic review settings October 9, 2026 07:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The new enum-backed status fields are documented with string values in the proto comments, which is misleading for generated clients and JSON enum encoding and should be corrected before approval.

2 open findings
Files not reviewed (19)
  • internal/proto/service/init/v1/init.pb.go: Generated file
  • internal/proto/service/init/v1/init_grpc.pb.go: Generated file
  • proto/plugin/certificate_issuer/v1/certificate_issuer.pb.go: Generated file
  • proto/plugin/certificate_issuer/v1/certificate_issuer_grpc.pb.go: Generated file
  • proto/plugin/identity_management/v1/identity_management.pb.go: Generated file
  • proto/plugin/identity_management/v1/identity_management_grpc.pb.go: Generated file
  • proto/plugin/keystore/common/v1/common.pb.go: Generated file
  • proto/plugin/keystore/management/v1/management.pb.go: Generated file
  • proto/plugin/keystore/management/v1/management_grpc.pb.go: Generated file
  • proto/plugin/keystore/operations/v1/operations.pb.go: Generated file
  • proto/plugin/keystore/operations/v1/operations_grpc.pb.go: Generated file
  • proto/plugin/notification/v1/notification.pb.go: Generated file
  • proto/plugin/notification/v1/notification_grpc.pb.go: Generated file
  • proto/plugin/systeminformation/v1/systeminformation.pb.go: Generated file
  • proto/plugin/systeminformation/v1/systeminformation_grpc.pb.go: Generated file
  • proto/plugin/test/v1/test.pb.go: Generated file
  • proto/plugin/test/v1/test_grpc.pb.go: Generated file
  • proto/service/common/config/v1/config.pb.go: Generated file
  • proto/service/common/config/v1/config_grpc.pb.go: Generated file

🧠 Review effort: Lite

Signed-off-by: davidbolet <[email protected]>
Copilot AI lite review requested due to automatic review settings October 9, 2026 08:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The new async-status API semantics and documentation around UNSPECIFIED/absence and finalize success criteria are currently ambiguous, and the PR description doesn’t match the added creation_time API surface.

2 open findings
Files not reviewed (19)
  • internal/proto/service/init/v1/init.pb.go: Generated file
  • internal/proto/service/init/v1/init_grpc.pb.go: Generated file
  • proto/plugin/certificate_issuer/v1/certificate_issuer.pb.go: Generated file
  • proto/plugin/certificate_issuer/v1/certificate_issuer_grpc.pb.go: Generated file
  • proto/plugin/identity_management/v1/identity_management.pb.go: Generated file
  • proto/plugin/identity_management/v1/identity_management_grpc.pb.go: Generated file
  • proto/plugin/keystore/common/v1/common.pb.go: Generated file
  • proto/plugin/keystore/management/v1/management.pb.go: Generated file
  • proto/plugin/keystore/management/v1/management_grpc.pb.go: Generated file
  • proto/plugin/keystore/operations/v1/operations.pb.go: Generated file
  • proto/plugin/keystore/operations/v1/operations_grpc.pb.go: Generated file
  • proto/plugin/notification/v1/notification.pb.go: Generated file
  • proto/plugin/notification/v1/notification_grpc.pb.go: Generated file
  • proto/plugin/systeminformation/v1/systeminformation.pb.go: Generated file
  • proto/plugin/systeminformation/v1/systeminformation_grpc.pb.go: Generated file
  • proto/plugin/test/v1/test.pb.go: Generated file
  • proto/plugin/test/v1/test_grpc.pb.go: Generated file
  • proto/service/common/config/v1/config.pb.go: Generated file
  • proto/service/common/config/v1/config_grpc.pb.go: Generated file

🧠 Review effort: Lite

minh-nghia
minh-nghia previously approved these changes Oct 9, 2026

@jmpTeixeira02 jmpTeixeira02 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As stated before, disable your copilot! This makes reviewing any PR a nightmare as there are super verbosy messages in the middle of the changes and we already have our own AI reviewing tools. For future reference I won't be reviewing any other PR where this is enabled

Also, use some code quality skils as this PR is 90% comments where almost all of them dont add any value. Try ponytail, pstack, etc.

Signed-off-by: davidbolet <[email protected]>
@jmpTeixeira02
jmpTeixeira02 dismissed their stale review October 20, 2026 08:49

Dismissing as this is needed and I wont block it, but my comment above still aplies

Signed-off-by: davidbolet <[email protected]>
@minh-nghia
minh-nghia merged commit 0786322 into openkcm:main Oct 27, 2026
7 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.

5 participants